Solved

printing from delphi part1

Posted on 2004-04-09
1
176 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 500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

738 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