Posts Tagged Printing

Too Many Invoice Copies

Ever had the “Too many copies are printed!” problem? Your customer wants to prints an invoice copy when posting invoices. So you set the Invoice Copies field on the Invocing tab of the Customer Card to 1.

Problem is, now the program will always print an invoice copy even when you manually reprint a posted invoice. Even though the option tab of the report shows No. Of Copies = 0 , a copy will be printed. If you change the No. Of Copies to 1, the system prints 2 copies, it doesn’t make sense!

The happens because of the following line of code in the CopyLoop OnPreDataItem() trigger:

NoOfLoops := ABS(NoOfCopies) + Cust."Invoice Copies" + 1;

The system actually takes the sum of the No. of Copies on the option tab and the Invoice Copies on the Customer Card to calculate how many copies it will print, this makes it impossible no to print an invoice copy when reprinting posted invoices, which is probable not what you want.

I used the solution below which will use the Invoice Copies field on the customer card to calculate the no. of copies when posting and the No. of Copies on the option tab of the report when manually printing a posted invoice, not the sum of both.

In the The CopyLoop OnPreDataItem() I changed

NoOfLoops := ABS(NoOfCopies) + Cust."Invoice Copies" + 1;

to

IF blManuallyOpened THEN
  NoOfLoops := ABS(NoOfCopies) + 1
ELSE
  NoOfLoops := Cust."Invoice Copies" + 1;

And in the CopyLoop – OnOpenForm() trigger I added the following line:

blManuallyOpened := TRUE;

Since the CopyLoop – OnOpenForm() trigger is only run when you open the report manually, it will now use the info from the customer card to calculate copies when posting and the info from the option tab of the report to calculate copies when printing manually.

Below you see the screens where the no. of copies are set.

Sales - Invoice, Option Tab

Customer Card, Invoicing Tab

Add comment June 30, 2008


Tags

BIDS Business Intelligence Development Studio C/AL Codeunit Conversion Date Dump Dynamics NAV Excel File Import Invoice List Microsoft Office Multilanguage Postal Code Printing Report Shipment SQL Server SSIS ZIP Code

Blogroll

Dynamics NAV

Recent Comments

mart1n0 on Make Exporting Excel Formulas …
AntidotE on Make Exporting Excel Formulas …
AntidotE on Make Exporting Excel Formulas …
David Singleton on Make Exporting Excel Formulas …