Sales Invoice Print.

We have “coded” (onafter get record) into our sales invoice print a function that it a field X is at status Y then do not print invoice. This works fine. I would like to add to this, that if sell to customer = 1 AND field X = Y then do not print, however when i add (infront of the current code) : (“Sell-to Customer No.” = 1) AND… then i get the message Type Conversion Is Not Possible Because 1 of the Operators Contains an Invalid Type. Code = Interger. I am presuming this is due the the account number… Is there any way round this? THanks

  • “Sell-to Customer No.” is a field of type Code 20 - 1 is an integer That’s why you have this “type conversion” error. If 1 is the Customer No., you can simply change your code to: IF “Sell-to Customer No.” = ‘1’ … or IF “Sell-to Customer No.” = FORMAT(1) Hope this helps

Insted of hard coding the 1 or ‘1’ in your case, I would suggest adding a new field to the Customer table called “Print Invoice”. This field would default to Yes (true). Then in the report you can simply put in a line of code like: if not Cust.“Print on Invoice” then CURRREPORT.SKIP; You should avoid the hard coding of values if at all possible.

On the Customer Card Invoicing Tab there is a field No of Invoices we can set this to -1 Sales-Invoice Report In the Sales Invoice DataItem called CopyLoop there is code NoOfLoops := ABS(NoOfCopies) + Cust.“Invoice Copies” + 1; IF NoOfLoops <= 0 THEN NoOfLoops := 1; CopyText := ‘’; SETRANGE(Number,1,NoOfLoops); We do not know what the user may set the number of copies in the Sales Invoice report selection so we cannot rely on a -1 or -2 to return a zero //We can change this code to skip with no hard coding at all If Cust.“Invoice Copies” < 0 Then CurrReport.BREAK; NoOfLoops := ABS(NoOfCopies) + Cust.“Invoice Copies” + 1; IF NoOfLoops <= 0 THEN NoOfLoops := 1; CopyText := ‘’; SETRANGE(Number,1,NoOfLoops);

Thanks for your replys everyone! I went for option 1 - i was nearly there, simply forgetting the ’ :smiley: - I did try putting " round the account number - but this then tried to look for field 1. :eek: