As we know in Purchase Invoice screen, Supplier Document No and Supplier Invoice Date fields are mandatory. In Sage X3, while creating Purchase Invoice transaction, user can enter same No and Date for different invoice numbers. But one of our client requested to add a validation for the Purchase Invoice where, if the Supplier, Supplier Invoice date and Gross amount (Invoice-tax) are same but supplier doc number is different then an alert notification should be displayed on the screen.
For Example: – A purchase Invoice is created against the vendor: V03941 with supplier invoice no(Doc number): CHNCNT208-2021 and invoice Date: 09/08/20, and having gross amount: 168000
Consider below screenshot for reference:
New Stuff: How to enable “Accounting Cancellation” option on Purchase Invoice Screen
![[PI 1 - Supplier Doc No and Date]](http://www.greytrix.com/blogs/sagex3/wp-content/uploads/2021/06/PI-1-Supplier-Doc-No-and-Date.jpg)
![[PI 1 - (Invoice-tax)]](http://www.greytrix.com/blogs/sagex3/wp-content/uploads/2021/06/PI-1-Invoice-tax.jpg)
If the user is trying to create new purchase invoice with the same supplier invoice date: 09/08/20, gross amount: 168000 but different invoice number: CHICNT390-2021 then the system should show a pop-up/warning regarding the same.
Consider below screenshot for reference:
![[PI 2 - Supplier Doc No and Date]](http://www.greytrix.com/blogs/sagex3/wp-content/uploads/2021/06/PI-2-Supplier-Doc-No-and-Date.jpg)
![[PI 2 - (Invoice-tax)]](http://www.greytrix.com/blogs/sagex3/wp-content/uploads/2021/06/PI-2-Invoice-tax.jpg)
For this purpose, we did a customization on Purchase Invoice screen. Refer below code:
######################################################################
If !clalev([ZPIH]) : Local File PINVOICE[ZPIH] : Endif
FOR [F:ZPIH] WHERE [F:ZPIH]NUM<>[M:PIH0]NUM and [F:ZPIH]BPRVCR<>”” and [F:ZPIH]BPRVCR=[M:PIH1]BPRVCR and [F:ZPIH]BPRDAT=[M:PIH1]BPRDAT AND [F:ZPIH]AMTNOT=[M:PIH4]TOTLINAMT
if [M:PIH1]BPRVCR = [F:ZPIH]BPRVCR AND [M:PIH0]BPR = [F:ZPIH]BPR and [F:ZPIH]BPRDAT=[M:PIH1]BPRDAT AND [F:ZPIH]AMTNOT=[M:PIH4]TOTLINAMT
INFBOX “Supplier Document Number, Supplier Inv Date and Amount already exist for Invoice No : ” + [F:ZPIH]NUM
OK = 0
GOK = 0
GPE = 1
mkstat=2
break
endif
NEXT
######################################################################
Add the above code in VERIF_MOD and VERIF_CRE events on SPEPIH script.
After adding the above code if user try to create new purchase invoice with the same supplier invoice date, gross amount but different supplier doc number then the system will show a pop-up/warning regarding the same and It will restrict user to create purchase invoice.
![Warning message]](http://www.greytrix.com/blogs/sagex3/wp-content/uploads/2021/06/Warning-message.jpg)
Hence with the help of this customization, we can restrict a Purchase Invoice creation on the basis of Supplier Document No, Supplier Invoice Date and Gross Amount.
About Us
Greytrix – a globally recognized and one of the oldest Sage Development Partner is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development and implementation competence.
Greytrix caters to a wide range of Sage X3, a Sage Business Cloud Solution, offerings. Our unique GUMU integrations include Sage X3 for Sage CRM, Salesforce.com, Dynamics 365 CRM and Magento eCommerce along with Implementation and Technical Support worldwide for Sage X3. Currently we are Sage X3 Implementation Partner in East Africa, Middle East, Australia, Asia, US, UK. We also offer best-in-class Sage X3 customization and development services, integrated applications such as POS | WMS | Payment Gateway | Shipping System | Business Intelligence | eCommerce and have developed add-ons such as Catch – Weight and Letter of Credit and India Legislation for Sage X3 to Sage business partners, end users and Sage PSG worldwide.
Greytrix is a recognized Sage champion ISV Partner for GUMU Sage X3 – Sage CRM integration also listed on Sage Marketplace; GUMU
integration for Sage X3 – Salesforce is a 5-star rated app listed on Salesforce AppExchange and GUMU
integration for Dynamics 365 CRM – Sage ERP listed on Microsoft AppSource.
For more information on Sage X3 Integration and Services, please contact us at x3@greytrix.com, We will like to hear from you.