PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD 19] - Problem with sales slip
[WD 19] - Problem with sales slip
Iniciado por guest, 02,abr. 2015 13:03 - 4 respuestas
Publicado el 02,abril 2015 - 13:03
Hi friend,

i want to create a print like a "sales slip" with a termal printer.
What is the right format to configure the report to have the right print and the printer cut the paper at the end of the document.

Thaks
Publicado el 02,abril 2015 - 13:32
Giovanni,

First of all, your approach in WX will depend on the type of printer you have; USB, Parallel, Serial?

If USB, you can use the WX report editor for your slip.
If not USB, then you will have to hand code your slip using Epson (or similar) esc/p language.

In WX to do things like paper cut or till draw open, iEscape is used: <a class="ExternalLink" rel="nofollow" target="_blank" href="http://doc.windev.com/en-US/?3046054&name">http://doc.windev.com/en-US/&hellip;</a>=

Also note; Thermal printers normally have an "auto-cut" setting.

Hope this helps to get you started...
Publicado el 02,abril 2015 - 15:11
Hi Giovanni

I'm going to modify a little Darren's answer...

It's not because of USB or not USB that you can or cannot use the report editor... It is just a question about using the printer windows DRIVER or print DIRECTLY on the printer via its connection (USB, Network, serial, etc)...

So if you printer comes with a driver, and you can print from notepad on it, you can use the report editor...

However, I find it often easier for such a task to use direct printing commands (iprint, iLine, etc, etc), as the format and margin management for the report editor can be a pain in the ass on very small size prints.

Best regards
Publicado el 02,abril 2015 - 17:29
Thanks...

i use a usb printer.
So, i have created a report in WD and the printer correctly print.
But, in a report description i have set the height of the report (I have try to set the max height like 600 mm) and so print 600mm, but the print can be 100mm depend to the body and i wanna be to print only the real height
Publicado el 03,abril 2015 - 01:52
Hi Giovanni,

Here you are, some code I use to print the details of a currently selected product without the need for the report designer, and as Fabrice suggests, I use iPrint + some other functions from the "i" family :cheers:

// Print the current product details // Set up header text glocalsHeaderText is string = "Quick Product Details" glocalsImageName is string = "C:\ImagePath\Company_Logo.jpg" // Set up the fonts to be used iCreateFont(1, 7, iNormal, "Arial", iBlack, 0) iCreateFont(2, 10, iNormal, "Arial Black", iBlack, 0) // Print company logo iPrintImage(glocalsImageName, 0, 0, iImageWidth(glocalsImageName), iImageHeight(glocalsImageName), iHomoCenteredDisplay) // Blank line iPrint(iYPos(iImageHeight(glocalsImageName) - 6)) // Print header iHLine(0,iPageWidth,2) iPrint(iFont(2) + iXPos((iPageWidth() - iTextWidth(glocalsHeaderText))/2, True) + glocalsHeaderText) iHLine(0,iPageWidth,2) // Blank line iPrint(iFont(1) + " ") // Send the product details to the print buffer iPrint(iFont(1) + "Internal Code: " + WEDIT_CCode_Internal) iPrint(iFont(1) + "External Code: " + WEDIT_CCode_External) //iPrintBarCode(WEDIT_CBarcodeInt,BC_CODE128,10,10,5) iPrint(iFont(1) + "Internal Barcode: " + WEDIT_CBarcodeInt) //iPrintBarCode(WEDIT_CBarcodeExt,BC_EAN13,10,10,50) iPrint(iFont(1) + "Manufac Barcode: " + WEDIT_CBarcodeExt) iPrint(iFont(1) + "Description: " + WEDIT_CTitle1) iPrint(iFont(1) + "Options: " + WEDIT_COptionsText) // Blank line iPrint(iFont(1) + " ") // Horizontal line iHLine(0,iPageWidth,2) // Blank line iPrint(iFont(1) + " ") // Print date line glocalsFormattedDate is string = DateToString(DateSys(),"DD/MM/YYYY") iPrint(iFont(1) + "Printed on: " + glocalsFormattedDate) // Print the details iEndPrinting()