Page 1 of 3

Best way to print Invoice ?

PostPosted: Mon May 18, 2009 12:04 pm
by anserkk
Hi all,

I am very much new to printing using FWH. I need to print Invoices from the application using FWH on a laser printer.
I am trying to convert only the printing portion of an old Clipper application. My new FWH application will have a dialog with a text box in it accepting the Invoice no. Once the user keys in the Invoice no. the FWH application should print on an Blank A4 paper on a laser printer with all the Heading, Address, Invoice No, Date, Boxes/Lines and then the detailed lines containing the Items and then at the end of the page with the Bill Total and other Statuatory declarations.

In DOS Clipper I am doing this using the code

Code: Select all  Expand view
@prow()+1,00 say BOLD_ON+PADC("Company Name",80) +BOLD_OFF
@prow()+1,00 say PADC("Company Address",80)

@prow()+1,00 say "Invoice No : "+str(nInvoiceNo,4)
@prow()   ,50 say "Invoice Dt  : "+dtoc(dInvDate)

@prow()+1,00 say "/---------------------------------------------------------------------------------------------\"
@prow()+1,00 say "
| Sr# | Item Name     | Qty  |  Price | VAT % | VAT Amt | Total Amt |"
@prow()+1,00 say "
|-------|--------------------|--------|----------|----------|--------------|---------------|"

// Process and Print the Line Items
Do while Bill->InvoiceNo == nInvoiceNo .and. !eof()
    cLine:="
|"+str(n++,5)+"| "+ITEM_NAME+" | "+str(QTY,3)+" | "+STR(PRICE,8,2)+" | "+str(VAT_TYPE)
    cLine+=+"
| "+ STR(VAT_AMT,8,2)+" | "+str(TOTAL_AMT)+" |"
    @prow()+1,00 say cLine

    Select Bill
    Skip
Enddo
@prow()+1,00 say "
|-------|--------------------|--------|----------|----------|--------------|---------------|"
@prow()+1,00 say "
|                                                             TOTAL       |"+str(GRAND_TOTAL)+" |"
@prow()+1,00 say "
\---------------------------------------------------------------------------------------------/"

Bill should appear like this

Code: Select all  Expand view
                        [b]ABC Company[/b]
    Address 12/123445, That Street, Pincode : 999999

Invoice No :  23                                          Invoice Dt : 15-05-2009
/---------------------------------------------------------------------------------------------\
| Sr# | Item Name           | Qty  |  Price | VAT % | VAT Amt | Total Amt |
|-------|--------------------|--------|----------|----------|--------------|---------------|
|    1  | Item 1             |  3    | 10.00  |    4%   |     0.40    |   10.40     |
|    2  | Item 2             |  5    | 15.00  |    4%   |     0.40    |   15.40     |
|    3  | Item 3             |  2    | 20.00  |    4%   |     0.40    |   20.40     |
|       |                    |        |         |           |              |               |
|       |                    |        |         |           |              |               |
|       |                    |        |         |           |              |               |
|       |                    |        |         |           |              |               |
|-------|--------------------|--------|----------|----------|--------------|---------------|
|                                                                TOTAL    |   46.20     |
\---------------------------------------------------------------------------------------------/
Goods once sold will not be take back .........
 
Can anybody help me where should I start to get a print out similiar to the above.
Any sample code will be helpful. I am confused after seeing the Samples TestPrn3 etc etc. like CMSay()
I would also like to use Boxes and Lines instead of the character "-----" so that the print out appears neat and tidy

Regards

Anser

Re: Best way to print Invoice ?

PostPosted: Mon May 18, 2009 1:14 pm
by Otto
EasyReport

Best regards,
Otto


PRINTAREA's : you can have as many as you want

PRINTAREA 1 = header
PRINTAREA 2 = items
PRINTAREA 3 = footer

You have a Report designer which creates the vrd-files.
These are ASCII files. You can edit them also with an editor.

10=Image||700| 0|1|1|26|119|28|33|C:\whtouch\logo\LOGO.JPG|0|
11=Text|Firma|401| 0|1|1|27|115|70|5|1|3|2|3|0|0||0
12=Text|Adr1|402| 0|1|1|24|115|70|4|11|3|2|3|0|0||0
13=Text|Adr2|403| 0|1|1|30|115|70|4|11|3|2|3|0|0||0
14=Text|Adr3|404| 0|1|1|36|115|70|4|11|3|2|3|0|0||0

Code: Select all  Expand view


   EASYREPORT oVRD NAME ".\xVRD\WellnessTermine.vrd" ;
 PREVIEW lPreview TO cPrinter   PRINTDIALOG IIF( lPreview, .F., .F. )

IF oVRD:lDialogCancel = .T.
RETURN( .F. )
ENDIF

PRINTAREA 1 OF oVRD ;
   ITEMIDS    { 102 } ;
   ITEMVALUES { kunden->name }

do while .not. eof()

   PRINTAREA 2 OF oVRD ;
      ITEMIDS    { 100,101,102 } ;
      ITEMVALUES {test->test1, test->test2, test->test3     }


   select test
   skip

enddo


PRINTAREA 3 OF oVRD ;
   ITEMIDS    { 102,102,103,104 } ;
   ITEMVALUES { "here","are","your","test" }



oVRD:End()
 
   
 
   
   
 

Re: Best way to print Invoice ?

PostPosted: Mon May 18, 2009 1:29 pm
by anserkk
Dear Mr.Otto,

Thank you very much for the information :D
I think EasyReport is a commercial one right ? With FWH purchase 1 License is free right ? I don't remember whether this is 1 developer license and whether I can use this while distributing the application :?

My fisrt preference is to stick on to FWH itself without relying on a third party control. Anyway if getiing this done using FWH is too complicated then I may have to think about EasyReport.

I beleive that the EasyReport report file will be an external file (.rpt) which needs to be there along with FWH Application.

Regards

Anser

Re: Best way to print Invoice ?

PostPosted: Mon May 18, 2009 1:41 pm
by Otto
Hello Anser,

>I think EasyReport is a commercial one right ?
Yes – but worth the money.

>My fisrt preference is to stick on to FWH itself without relying on a third party control.
>Anyway if getiing this done using FWH is too complicated then I may have to think about EasyReport.
I had for a very long time hardcoded reports. But a report designer is the better choice.

I beleive that the EasyReport report file will be an external file (.rpt) which needs to be there along with FWH Application.
Yes.

As EasyReport is written in Fivewin you have full control over your reports.
No installation/setup is necessary – if your Fivewin application executes on the client machine also the report is working!
(I had so many problems with CR. )
Also the speed to create reports is high.

Best regards,
Otto

Re: Best way to print Invoice ?

PostPosted: Mon May 18, 2009 1:58 pm
by Marco Turco
Hi,
take a look at http://www.paritetsoft.ru/frh.htm

It's the xharbour wrapper (class) for Fast Report. It's really easy to use and with great features.

Re: Best way to print Invoice ?

PostPosted: Mon May 18, 2009 6:08 pm
by mmercado
anserkk wrote:I am very much new to printing using FWH. I need to print Invoices from the application using FWH on a laser printer.
I am trying to convert only the printing portion of an old Clipper application. My new FWH application will have a dialog with a text box in it accepting the Invoice no. Once the user keys in the Invoice no. the FWH application should print on an Blank A4 paper on a laser printer with all the Heading, Address, Invoice No, Date, Boxes/Lines and then the detailed lines containing the Items and then at the end of the page with the Bill Total and other Statuatory declarations.
Hi Anser:

With TCliPrt class you can use your original clipper printig code in FWH\xHarbour programs. It's free.

You can download it from here:

http://www.box.net/shared/5ac0n9e88g

Best regards.

Manuel Mercado

Re: Best way to print Invoice ?

PostPosted: Mon May 18, 2009 11:00 pm
by Colin Haig
Hi Anserkk

I use the PDF class to generate all my invoices and reports - this also makes
it easier to email the report or invoice as an attachment.

Regards

Colin

Re: Best way to print Invoice ?

PostPosted: Mon May 18, 2009 11:18 pm
by nageswaragunupudi
Colin Haig wrote:Hi Anserkk

I use the PDF class to generate all my invoices and reports - this also makes
it easier to email the report or invoice as an attachment.

Regards

Colin


Mr Colin

Can you please enlighten us more about how do you use the PDF class to prepare and print reports? Where can we get the PDF class?

Thanks in advance

Re: Best way to print Invoice ?

PostPosted: Tue May 19, 2009 12:20 am
by Colin Haig
Mr Rao

Here is a sample - I have removed some of the code but it should be enough to see how it works.

I am not sure where you can get pdf.prg but I can send you a copy


PUBLIC aReport := array( PARAMLEN )

aStyle := { "Normal", "Bold", "Italic", "BoldItalic" }

aFonts := { { "Times", .t., .t., .t., .t. },;
{ "Helvetica", .t., .t., .t., .t. },;
{ "Courier", .t., .t., .t., .t. } }

cPdf := cPath + 'PO' + alltrim(cPoNum) + '.pdf'

pdfOpen(cPdf, 200, .t.,cPath)

pdfSetLPI( 48 ) // allows best placement of text on graphics
do while ! oPoitms:eof()
cJbNo := oPoitms:jb_no
fnHeader(aSupplier,cPoNum,dPo,@nPage,@nPrRow,cPath,lConfirm,lEmail,aShipTo,cSub)
pdfAtSay(oPoitms:code,nPrRow, 0 ,"R")
pdfAtSay(oPoitms:desc,nPrRow, 28 ,"R")
pdfAtSay(str(oPoitms:qty,7,2),nPrRow, 114 ,"R")
oPoitms:skip()
nPrRow++
enddo
SysRefresh()
pdfAtSay('Document Type ',nMaxRow - 5, 0 ,"R")
pdfBold()
pdfAtSay(cType,nMaxRow - 5, 30 ,"R")
pdfNormal()
pdfBox( 255 , 150, 280 , 206, 0.01, 8 , "M" ,,)
pdfAtSay('Sub Total',nMaxRow - 5, 151 ,"R")
pdfAtSay(str(nTotal,9,2),nMaxRow -5, 171 ,"R")
pdfAtSay('Raised By ',nMaxRow - 3, 0 ,"R")
pdfBold()
pdfAtSay(alltrim(cUserName) + '/' + alltrim(cNetName),nMaxRow - 3, 30 ,"R")
pdfNormal()
if lPrices
pdfAtSay(' G.S.T',nMaxRow - 3, 151 ,"R")
pdfAtSay(str(nTotGst,9,2),nMaxRow - 3, 171 ,"R")
endif
pdfAtSay('Job Number ',nMaxRow - 1, 0 ,"R")
pdfBold()
pdfAtSay(cJbNo,nMaxRow - 1, 30 ,"R")
pdfNormal()
if lPrices
pdfAtSay(' Total',nMaxRow - 1, 151 ,"R")
pdfAtSay(str(nTotal + nTotGst,9,2),nMaxRow -1, 171 ,"R")
endif
pdfClose()

WinExec("acrord32 " + (cPdf))
return(nil)
//--------------------------------------------------------------------------------------//
function fnheader(aSupplier,cPoNum,dPo,nPage,nPrRow,cPath,lConfirm,lEmail,aShipTo,cSub)
if nPage == 0 .or. nPrRow > 55
nPage++
pdfNewPage( "A4", "P", 6 )
if lEmail
pdfImage(cPath + 'cbdlogo2.jpg',0,0,"M",25,105)
pdfSetFont(aFonts[3,1], 0, 14,)
pdfAtSay('xxxxxxxxxxxxx', 0, 145, "R" )
pdfAtSay('xxxxxxxxxxxxx', 1, 145, "R" )
pdfSetFont(aFonts[3,1], 0, 13,)
pdfAtSay('Phone (08)123456789', 3, 145, "R" )
pdfAtSay('Fax (08)234567890', 4, 145, "R" )
pdfAtSay('ABN 00 001 111 xxx', 5, 145, "R" )
endif
pdfSetFont(aFonts[3,1], 0, 10,)
pdfBox( 30 , 5 , 38 , 205 ,0.01, 10 , "M" ,,)
pdfAtSay('Date : ' + dtoc(dPo), 7.5, 1 ,"R")
pdfAtSay('Printed Date : ' + dtoc(date()), 7.5, 70 ,"R")
pdfAtSay('P.O. No.: ' + alltrim(cPoNum) + '/' + cSub, 7.5, 160 ,"R")
pdfBox( 40 , 5 , 48 , 205 ,0.01, 10 , "M" ,,)
pdfBold()
pdfAtSay('Supplier Details', 9.5, 1 ,"R")
pdfAtSay('Shipping Details', 9.5, 110 ,"R")
pdfNormal()
pdfBox( 48 , 5 , 80 , 205 ,0.01, 10 , "M" ,,)
pdfAtSay(aSupplier[1], 12, 1 ,"R")
if ! empty(aShipTo[1])
pdfAtSay(aShipTo[1], 12, 110 ,"R")
endif
if ! empty(aSupplier[2])
pdfAtSay(aSupplier[2], 13, 1 ,"R")
endif
if ! empty(aShipTo[2])
pdfAtSay(aShipTo[2], 13, 110 ,"R")
endif
if ! empty(aShipTo[3])
pdfAtSay(aShipTo[3], 14, 110 ,"R")
endif
if ! empty(aSupplier[3])
pdfAtSay(aSupplier[3], 14, 1 ,"R")
if ! empty(aSupplier[4])
pdfAtSay(aSupplier[4], 15, 1 ,"R")
endif
else
if ! empty(aSupplier[4])
pdfAtSay(aSupplier[4], 15, 1 ,"R")
endif
endif
if lConfirm
pdfBold()
pdfAtSay('*** Please Note - Confirmation Only ***', 19.5, 45 ,"R")
pdfNormal()
endif
pdfSetFont(aFonts[3,1], 0, 9,)
pdfBox( 90 , 5 , 100 , 205 ,0.01, 10 , "M" ,,)
pdfAtSay('Code', 22, .1 ,"R")
pdfAtSay('Description', 22, 28 ,"R")
pdfAtSay('Qty', 22, 121 ,"R")
pdfAtSay('Rate', 22, 147 ,"R")
pdfAtSay('Amount', 22, 177 ,"R")
nPrRow := 24
endif
return(nil)
//--------------------------------------------------------------------------------------------------//

Re: Best way to print Invoice ?

PostPosted: Tue May 19, 2009 12:36 am
by reinaldocrespo
Try the fw tReport class. Easy, simple, powerful, you already own it. You can actually print just about anything with it (reports as well invoices). No 3rd parties. Always compatible. And there is a free tmreport class that inherits from treport that allows you to export your reports/invoices to excel.

Look at the samples in fwh\samples folder. It is a good place to get started.

Hope it helps.


Reinaldo.

Re: Best way to print Invoice ?

PostPosted: Tue May 19, 2009 1:18 am
by Armando
Colin:

May I have a copy of PDF sources ?.

My e-mail address

soisa2002 at prodigy dot net dot mx

Best regards and thank you very much

Re: Best way to print Invoice ?

PostPosted: Tue May 19, 2009 3:05 am
by nageswaragunupudi
Mr Colin

Thank you very much.
Would you mind sending me the pdf.prg ?
My email is nageswaragunupudi@gmail.com

Thank you in advance

Re: Best way to print Invoice ?

PostPosted: Tue May 19, 2009 4:41 am
by anserkk
Dear All,

I thank each and every one of you for providing these information's regarding the printing of an Invoice. Now I will have to decide the one, which I should use to get a simple invoice printed without spending too much time.

By the way Mr.Colin, I would also like to have the copy of the pdf.prg, my email id is anserkk@gmail.com (Please remember that gmail does not accept .zip file attachment, if it is a zip file, then please rename .zip to .zop )

Regards

Anser

Re: Best way to print Invoice ?

PostPosted: Tue May 19, 2009 6:30 am
by nageswaragunupudi
Mr reinaldocrespo

>
And there is a free tmreport class that inherits from treport that allows you to export your reports/invoices to excel.
>

Where can we get the Tmreport class please ?

Re: Best way to print Invoice ?

PostPosted: Tue May 19, 2009 6:53 am
by frose
Anser,

for a complete list of printing solutions:
PageScript from http://www.abeelabs.com.

Frank