Our code unit 90 has some helpful code that I dont know if its standard or not....
IF PurchHeader."Document Type" = PurchHeader."Document Type"::Invoice THEN
BEGIN
PurchHeader.TESTFIELD("Inv. Approval Status", PurchHeader."Inv. Approval Status"::"Inv. Approved");
// Ensure that the 'Invoice Value' entered on the purchase header matches the Total Amount Incl. VAT
// of the invoice.
CLEAR(codPurchInvRegister);
deCalculatedInvAmount := codPurchInvRegister.fCalculateInvAmount(PurchHeader);
IF deCalculatedInvAmount <> PurchHeader."Invoice Value"
THEN ERROR('The %1 entered to register %2 %3 does not match the calculated amount.',
PurchHeader.FIELDNAME(PurchHeader."Invoice Value"),
PurchHeader."Document Type", PurchHeader."No.");
END;
Is this standard? And can anyone see any problems with changing the if statement to add: OR (PurchHeader."Document Type" = PurchHeader."Document Type"::Order)
as we post most of our invoices from the order not from the invoices screen. So it would be a helpful change to us.
0
Comments
You can also see this by looking at the names of the variables.
codPurchInvRegister and deCalculatedInvAmount are names that Navision never would have used.
If you want the code also to be triggered when invoicing on a order be sure to test if the "Invoice" boolean is true. This is a global varable.
If this is false the user is only posting a shipment.
RIS Plus, LLC