Hello,
I would like to know the reason for the following code in the OnInsert Trigger of the Customer or Vendor table:
"Payment Days Code" := "No.";
"Non-Paymt. Periods Code" := "No.";
Because of this code, the codeunit 10700 is not working correctly and does not calculate the correct duedate in the case there is a specific Payment date configured in the Company Information table
The code of codeunit 10700 (Version List: NAVES4.00)
PurchAdjustDueDate(VAR Duedate :Date;VendorNo :Code[20]
Vendor.GET(VendorNo);
PaymentDay.RESET;
IF Vendor."Payment Days Code" <> '' THEN BEGIN
PaymentDay.SETRANGE("Table Name",PaymentDay."Table Name"::Vendor);
PaymentDay.SETRANGE(Code,Vendor."Payment Days Code");
PaymentDay."Table Name" := PaymentDay."Table Name"::Vendor;
PaymentDay.Code := Vendor."Payment Days Code";
END ELSE BEGIN
CompanyInfo.GET;
IF CompanyInfo."Payment Days Code" <> '' THEN BEGIN
PaymentDay.SETRANGE("Table Name",PaymentDay."Table Name"::"Company Information");
PaymentDay.SETRANGE(Code,CompanyInfo."Payment Days Code");
PaymentDay."Table Name" := PaymentDay."Table Name"::"Company Information";
PaymentDay.Code := CompanyInfo."Payment Days Code";
END;
END;
NonPaymentPeriod.RESET;
IF Vendor."Non-Paymt. Periods Code" <> '' THEN BEGIN
NonPaymentPeriod.SETRANGE("Table Name",NonPaymentPeriod."Table Name"::Vendor);
NonPaymentPeriod.SETRANGE(Code,Vendor."Non-Paymt. Periods Code");
NonPaymentPeriod."Table Name" := NonPaymentPeriod."Table Name"::Vendor;
NonPaymentPeriod.Code := Vendor."Non-Paymt. Periods Code";
END ELSE BEGIN
CompanyInfo.GET;
IF CompanyInfo."Non-Paymt. Periods Code" <> '' THEN BEGIN
NonPaymentPeriod.SETRANGE("Table Name",NonPaymentPeriod."Table Name"::"Company Information");
NonPaymentPeriod.SETRANGE(Code,CompanyInfo."Non-Paymt. Periods Code");
NonPaymentPeriod."Table Name" := NonPaymentPeriod."Table Name"::"Company Information";
NonPaymentPeriod.Code := CompanyInfo."Non-Paymt. Periods Code";
END;
END;
AdjustDate(DueDate);
0
Comments
You can define Nonpayment days for each customer / vendor. When calculating due date will taking in care those day by advancing due date to next payment day.
Each customer and vendor have their own payment days table, that’s why its creates a code with customer / vendor number.
Freelance Dynamics AX
Blog : http://axnmaia.wordpress.com/
The problem is that you can configure in the Company Information, the day that the company is going to pay, for example every month at day 15. You can also configure a special day at Vendor level
The vendor configuration has a higher priority as the Company configuration, but here is the problem. Because for default it is filling the fields in the vendor table, it will never take into account the configuration at Company level.
I don´t know if it is usual in Portugal to pay at a specific day at month, but here in Spain it is very usual.
Freelance Dynamics AX
Blog : http://axnmaia.wordpress.com/