In Sage X3, only posted transactions will be considered for accounting effects. Here in this blog we had a requirment from a client that , there should be a field on the header of purchase invoice screen, in which total transaction amount of the Supplier should be displayed for current fiscal year according to the PAN No of the Supplier.
For e.g., if a supplier 1 has XYZ PAN No. and supplier 2 also has XYZ PAN No., then same total transaction amount will be displayed in the Purchase invoice screen for supplier 1 as well as supplier 2.
To fullfil user’s requirment follow below steps:
Step 1: Add “Total invoice Amt for current fiscal yr “(ZINVAMT) field into (PINVOICE)table and (header) screen
New Stuff: Validation on Purchase Invoice screen
![[Table]](https://www.greytrix.com/blogs/sagex3/wp-content/uploads/2021/06/table-1024x464.png)
![[Screen]](https://www.greytrix.com/blogs/sagex3/wp-content/uploads/2021/06/screen-1024x416.png)
Step 2: Add below code into SPEPIH script
####################################################################################
Local DECIMAL A
Local DECIMAL B
Local DECIMAL C
Local Char REQUEST1(255)(8)
REQUEST1(0) = ” SELECT SUM(AMTATI_0) FROM “+nomap+”.PINVOICE P “
REQUEST1(1) = ” LEFT OUTER JOIN “+nomap+”.BPSUPPLIER BPS ON BPS.BPSNUM_0=P.BPR_0 “
REQUEST1(2) = ” LEFT OUTER JOIN “+nomap+”.BPSUPPLIER BPS1 ON BPS1.BPSNUM_0='”+NUM$([M:PIH0]BPR)+”‘”
REQUEST1(3) = ” WHERE BPS.XX1P4PANNO_0=BPS1.XX1P4PANNO_0 AND P.STA_0= ‘3’ AND P.ACCDAT_0 BETWEEN DateFromParts((CASE WHEN MONTH(‘”+[M:PIH0]ACCDAT+”‘) IN(1,2,3) THEN (YEAR(‘”+[M:PIH0]ACCDAT+”‘)-1) ELSE YEAR(‘”+[M:PIH0]ACCDAT+”‘) END),04,01) and ‘”+[M:PIH0]ACCDAT+”‘ “
REQUEST1(4) = ” GROUP BY BPS1.XX1P4PANNO_0″
FOR (DECIMAL DTEXTE_0) FROM “5” Sql REQUEST1 As [YCHD]
A =[YCHD]DTEXTE_0
NEXT
C=A-B
[M:PIH0]ZINVAMT=C
AFFZO[M:PIH0]ZINVAMT
######################################################################
Step 3: Compile SPEPIH script
![[Output]](https://www.greytrix.com/blogs/sagex3/wp-content/uploads/2021/06/output-1024x340.png)
Now after validation of script, when user will create new purchase invoice, the total transaction amount of the posted invoices created against the supplier for the current fiscal year according to PAN No gets calculated and displayed in the ZINVAMT field as shown in above screenshot.
About Us
Greytrix – a globally recognized and one of the oldest Sage Development Partners is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience and expertise, 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 has some unique integration solutions developed for Sage CRM with Sage ERPs namely Sage X3, Sage Intacct, Sage 100, Sage 500, and Sage 300. We also offer best-in-class Sage ERP and Sage CRM customization and development services to Business Partners, End Users, and Sage PSG worldwide. Greytrix helps in the migration of Sage CRM from Salesforce | ACT! | SalesLogix | Goldmine | Sugar CRM | Maximizer. Our Sage CRM Product Suite includes addons like Greytrix Business Manager, Sage CRM Project Manager, Sage CRM Resource Planner, Sage CRM Contract Manager, Sage CRM Event Manager, Sage CRM Budget Planner, Gmail Integration, Sage CRM Mobile Service Signature, Sage CRM CTI Framework.
Greytrix is a recognized Sage Champion Partner for GUMU™ Sage X3 – Sage CRM integration listed on Sage Marketplace and Sage CRM – Sage Intacct integration listed on Sage Intacct Marketplace. The GUMU™ Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for the processing and execution of application programs at the click of a button.
For more information on our integration solutions, please contact us at sage@greytrix.com. We will be glad to assist you.