?
Solved

printing from delphi part1

Posted on 2004-04-09
1
Medium Priority
?
178 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month12 days, 23 hours left to enroll

777 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