WD Direct print
// Printing till ticket
I is int
rGrandTotal is real
//Open the port
PortOpening()
// Print the header of the ticket
bPrintLine(sStartBold+"GROCERY CORNER"+sEndBold)
bPrintLine("----------------")
bPrintLine("")
bPrintLine(sStartCompress+RepeatString("-",42)+sEndCompress)
bPrintLine(sStartCompress+Complete("Article",20)+"!Qty! Price ! Total"+sEndCompress)
bPrintLine(sStartCompress+RepeatString("-",42)+sEndCompress)
Imax is int =TableCount(TABLE_Products)
// Print the ticket lines
FOR I=1 TO Imax
IF COL_LineTotal[I]<>0 THEN // Print if non-empty row
// Format the line
bPrintLine( sStartCompress+Complete(COL_Caption[I],20)+"!"+...
NumToString(COL_Quantity[I],"%3d")+"!"+...
NumToString(COL_UnitPrice[I],"%8.2f")+"!"+...
NumToString(COL_LineTotal[I],"%8.2f")+sEndCompress)
// Sum for total
rGrandTotal+=COL_LineTotal[I]
END
END
bPrintLine(sStartCompress+RepeatString("-",42)+sEndCompress)
// Total row
bPrintLine( sStartCompress+Complete("Total due: ",34)+...
NumToString(rGrandTotal,"%8.2f")+sEndCompress)
bPrintLine("")
bPrintLine("")
bPrintLine(StringBuild(sStartCompress+"Paid cash on %1 at %2", DateToString(Today()),TimeToString(Now(),"HH:MM"))+sEndCompress)
bPrintLine("")
// Print the footer of the ticket
bPrintLine("THANK YOU FOR YOUR BUSINESS")
bPrintLine(" SEE YOU SOON")
bPrintLine("")
bPrintLine("")
bPrintLine("")
sClose(nPrinterPort) // Close the parallel port
CASE ERROR :
Error(ErrorInfo())
sClose(nPrinterPort)
RETURN