As we all know in Purchase Invoice screen, Supplier Invoice Date field is mandatory. In Sage X3, while creating Purchase Invoice transaction, it displays current date by default in the Supplier Invoice Date as well as in the Accounting date fields. But one of our client requested to add a validation for the dates where, for the Purchase Invoice, Supplier Invoice Date should not be greater than the current date (Purchase invoice booking date). But if the selected Supplier Invoice Date falls 2 months (60 days) before the current date, then an alert notification should be displayed on the screen.
For this purpose, we did a customization on Purchase Invoice screen. Refer below screenshot in which Accounting Date i.e. Invoice Booking Date is ‘03/09/21’ i.e. 9th March. And same date is getting displayed in the Supplier invoice date field by default.
There are two cases. In the first case, we will check what happens when we try to enter the date greater than the current date in the Supplier Invoice Date field.
As you can see in the above screenshot, we have entered ‘03/10/21’ i.e. 10th March in Supplier Invoice Date and 10th March is greater than 9th March. Therefore, the pop-up message is getting displayed that “Supplier Invoice date is greater than Purchase Invoice date”. After giving this pop-up, it will not allow you to create invoice. So as per our first condition, we are restricting purchase invoice creation.
Now in the second case, we will check the working of this customization. Now we have entered ‘01/07/21’ i.e. 7th January in Supplier Invoice Date. 7th January is the date which falls 60 days before ‘03/09/21’ i.e. 9th March. Therefore, the pop-up message is getting displayed that “Supplier Invoice date has exceeded more than 60 days” as shown in the below screenshot.
In this condition, only alert message will be generated. It will not restrict user to create purchase invoice. And if user is entering current date in Supplier Invoice Date or any date between current date and 60 days before current date then it will not generate any alert message and will allow you to create Invoice.
Hence with the help of this customization, we can restrict a Purchase Invoice creation on the basis of Supplier Invoice Date. Invoice creation is restricted only if Supplier Invoice date is greater than Invoice booking date but if the date falls within 2 months (60 days) of the current date, only alert box will be generated.