Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

printing from delphi part1

Posted on 2004-04-09
1
Medium Priority
?
181 Views
Last Modified: 2010-04-05
I have a POS application. I am trying to format my text before I print it.
I need to add Store Name, address, & phone number,
Date & Time, - as well as some formating of the receipt items. I also need to add two types of taxes (GST, PST)



ps. If Shane Holmes is out there, i'd appreciate his help, since he knows all about the POS
0
Comment
Question by:zgeorge_2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 11

Accepted Solution

by:
shaneholmes earned 2000 total points
ID: 10795133
Hi George, Its added and I have emailed you the code.

Modified the following

procedure TfrmMainPOS.actPrintExecute(Sender: TObject);
var
 I: Integer;
begin
 with frmPrint.memPrint.Lines do
  begin
   Add(StoreName);
   Add(StoreAddress);
   Add(StoreCity + ', ' + StoreProvince + '  ' + StorePostal);
   Add(StorePhone);
   Add('');
   Add(DateTimeToSTr(Now));
   Add('');
   for I:= 0 to lvwReceipt.Items.COunt - 1 do
    Add( lvwReceipt.Items[I].SubItems[0] + '  ' +
         lvwReceipt.Items[I].Caption + '  ' +
         lvwReceipt.Items[I].SubItems[1] + '  ' +
         lvwReceipt.Items[I].SubItems[2]);
   Add('');
   Add('Total Items = ' + sttTotalQty.Caption);
   Add('Total Cost = ' + sttTotalCost.Caption);
   Add('Total Tax = ' + sttTotalTax.Caption);
   Add('Grand Total = ' + sttGrandTotal.Caption);
  end;
 if frmPrint.ShowModal = mrOK then
 begin
  if DefaultPrinter <> '' then
   PrintMemo(frmPrint.memPrint, False, False);
 end;
end;

procedure WriteRegistry;
var
 Reg: TRegistry;
begin
  Reg := TRegistry.Create;
  try
    Reg.RootKey := HKEY_CURRENT_USER;
    if Reg.OpenKey('\Software\POS\', True) then
    begin
     Reg.WriteFloat('GST', GST);
     Reg.WriteFloat('PST', PST);
     Reg.WriteString('Store Name', StoreName);
     Reg.WriteString('Store Address', StoreAddress);
     Reg.WriteString('Store City', StoreCity);
     Reg.WriteString('Store State', StoreProvince);
     Reg.WriteString('Store Postal', StorePostal);
     Reg.WriteString('Store Phone', StorePhone);
     Reg.CloseKey;
    end;
  finally
    Reg.Free;
  end;
end;

procedure ReadRegistry;
var
 Reg: TRegistry;
begin
  Reg := TRegistry.Create;
  try
    Reg.RootKey := HKEY_CURRENT_USER;
    if Reg.OpenKey('\Software\POS\', True) then
    begin
    if Reg.ValueExists('GST') then
     GST:= Reg.ReadFloat('GST')
    else
     GST:= 0.08;
    if Reg.ValueExists('PST') then
     PST:= Reg.ReadFloat('PST')
    else
     PST:= 0.07;
    if Reg.ValueExists('Store Name') then
     StoreName:= Reg.ReadString('Store Name')
    else
     StoreName:= 'Acme Store';
    if Reg.ValueExists('Store Address') then
     StoreAddress:= Reg.ReadString('Store Address')
    else
     StoreAddress:= '111 Anywhere';
    if Reg.ValueExists('Store City') then
     StoreCity:= Reg.ReadString('Store City')
    else
     StoreCity:= 'Toronto';
    if Reg.ValueExists('Store Provice') then
     StoreProvince:= Reg.ReadString('Store Provice')
    else
     StoreProvince:= 'ONT';
    if Reg.ValueExists('Store Postal') then
     StorePostal:= Reg.ReadString('Store Postal')
    else
     StorePostal:= 'M4X 1M9';
    if Reg.ValueExists('Store Phone') then
    StorePhone:= Reg.ReadString('Store Phone')
    else
     StorePhone:= '';
     Reg.CloseKey;
    end;
  finally
    Reg.Free;
  end;
end;

Shane
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question