Creating a functional design document for ZATCA-compliant e-invoicing in Saudi Arabia involves detailing the system's features, workflows, and compliance measures. Below is a structured outline to guide you:
1. Introduction
Purpose: Define the objective of the document, focusing on designing an e-invoicing system compliant with ZATCA regulations.
Scope: Specify the boundaries of the system, including supported invoice types (e.g., tax invoices, credit notes) and integration with existing ERP/POS systems.
2. System Overview
Architecture: Describe the system's architecture, highlighting components like the e-invoicing solution, integration middleware, and connections to ZATCA's platform.
User Roles: Identify user roles such as administrators, accountants, and auditors, detailing their permissions and responsibilities.
3. Functional Requirements
Invoice Generation:
Ensure the system can generate invoices in XML or PDF/A-3 format, embedding all mandatory fields as per ZATCA's specifications.
Implement unique identifiers (UUIDs) and cryptographic stamps for each invoice to maintain authenticity and integrity.
Integration with ZATCA:
Establish real-time integration for invoice clearance, where tax invoices are validated by ZATCA before being issued to customers.
For simplified invoices, ensure reporting to ZATCA within 24 hours of generation.
Data Validation:
Incorporate over 150 smart data validations to ensure invoice data complies with ZATCA regulations, reducing errors and rejections.
Error Handling:
Develop mechanisms for automated error detection, alerting users to issues with invoices, and providing guided correction assistance.
Reporting and Dashboards:
Provide comprehensive dashboards and reports to monitor e-invoicing activities, track compliance status, and analyze invoice data.
4. Non-Functional Requirements
Performance:
Design the system to handle high volumes of invoices efficiently, ensuring scalability to process thousands of invoices per second.
Security:
Implement robust security measures, including data encryption, secure access controls, and compliance with data protection laws.
Availability:
Ensure high system availability with minimal downtime, supporting continuous business operations.
5. Compliance Considerations
Prohibited Functionalities:
Prevent functionalities such as generating multiple invoice sequences simultaneously, altering timestamps, and exporting cryptographic keys, as these are prohibited by ZATCA.
Data Archival:
Implement data archival solutions to store e-invoices securely for up to six years, as required by regulations.
6. Integration Details
ERP/POS Integration:
Outline the integration process with existing ERP or POS systems, detailing API endpoints, data formats, and communication protocols.
ZATCA API Integration:
Describe the integration with ZATCA's APIs for invoice clearance and reporting, including authentication methods and data exchange formats.
7. User Interface Design
Invoice Management:
Design intuitive interfaces for creating, viewing, and managing invoices, ensuring user-friendly navigation and operation.
Error Resolution:
Provide interfaces for users to view error alerts, understand issues, and apply corrections efficiently.
8. Testing and Validation
Unit Testing:
Develop test cases for individual components to ensure they function correctly in isolation.
Integration Testing:
Test the interactions between system components, including ERP/POS systems and ZATCA's platform, to ensure seamless integration.
User Acceptance Testing (UAT):
Conduct UAT to validate the system's functionality and usability from the end-users' perspective.
9. Deployment and Maintenance
Deployment Plan:
Detail the steps for deploying the system, including environment setup, data migration, and go-live procedures.
Maintenance Strategy:
Outline the plan for ongoing maintenance, including regular updates, compliance checks, and support mechanisms.
10. Appendices
Glossary:
Define technical terms and acronyms used in the document.
References:
List all regulatory documents, technical guides, and resources referenced during the design process.
By following this structured approach, you can develop a comprehensive functional design document that ensures your e-invoicing system aligns with ZATCA's requirements and supports your business operations effectively.
User
Project Galaxy
Integration Functional Specification
RICE Name: LMG Galaxy - FDD - Integration - Payroll to ZATCA Clear Tax
Document Control Information
Document Identification Functional Specification document
Document Name LMG Galaxy - FDD - Integration - Payroll to ZATCA Clear Tax
Creation Date 14-04-2025
Intended Audience LMG
Document Author Ankit
Document Status
Document Version 1.00
Last Updated 14-04-2025
Revision and Signoff Sheet
Change Record
Date Author Version Change Reference
14-04-2025 Ankit Mishra 1.00 Initial Draft
Requirements overview 4
2.1. Dependencies and prerequisites 4
2.2. Setup requirements 4
2.3. Access Requirement: 5
2.4. Business Validations required: 5
2.5. File format, data mapping and transformation. 5
2.6. Data flow diagram 6
2.7. User procedure overview 7
2.8. Error handling and reporting 7
Additional Information 8
2.1. Acronyms, abbreviations, and definitions 8
2.2. Open items, risks, issues, dependencies, and future considerations 8
Introduction
1.1. Project Overview
LMG intends to migrate its existing application & processes (Oracle EBS R12) to Oracle Fusion Payroll Cloud ERP to establish standard, simple and scalable system landscape to achieve sustainable business growth.
1.2. Document Purpose and Scope
The Purpose of this Document is to detail the Integration process of generating the QR Code generation from ZATCA Clear Tax and generate the report in Cloud Payroll. Also, it provides the functional specification details and Mappings required for of generating the BI Extracts, transforming in the OIC and generation of QR code.
The Document scope is limited to Cloud Payroll Applications and OIC, and it is outbound mechanism.
2. Requirements overview
2.1. Dependencies and prerequisites
Below is the sequence of action which would be performed every month during payroll process. This is the approach would be applicable only for Saudi wherein VAT invoice is being generated based on QR code generation from ZATCA.
S.No Action performed Owner Source path Destination path Remarks
1 Payroll process to be completed for each of the payroll for the specific period Payroll Team Fusion Payroll Fusion Payroll
2 Prepayments process to be completed for each of the payroll for the specific period Payroll Team Fusion Payroll Fusion Payroll
3 Salary Payment Transfer Payroll Team Fusion Payroll Bank Portal Manual Process
2.2. Setup requirements
This integration will require configuration for the VAT invoice generation process.
Elements Configuration
Element entries need to be attached to the employees.
BI Extracts to be created to generate the payroll run results specific to VAT related payroll elements.
Introduction
1.1. Project Overview
1.2. Document Purpose and Scope
Requirements Overview
2.1. Dependencies and Prerequisites
2.2. Setup Requirements
2.3. Access Requirements
2.4. Business Validations Required
2.5. File Format, Data Mapping, and Transformation
2.6. Data Flow Diagram
2.7. User Procedure Overview
2.8. Error Handling and Reporting
Additional Information
3.1. Acronyms, Abbreviations, and Definitions
3.2. Open Items, Risks, Issues, Dependencies, and Future Considerations
1. Introduction
1.1. Project Overview
LMG intends to migrate its existing application and processes from Oracle EBS R12 to Oracle Fusion Payroll Cloud ERP to establish a standardized, simple, and scalable system landscape, aiming for sustainable business growth.
1.2. Document Purpose and Scope
This document details the integration process for generating QR codes from ZATCA Clear Tax and producing reports in Cloud Payroll. It provides functional specifications and mappings required for generating BI Extracts, transforming data in the Oracle Integration Cloud (OIC), and generating QR codes.
Create QR code by using Mirco Service and send VAT employees details to Clear Tax Portal.
LMG Payroll to ZATCA Clear Tax Process needs to be creates as below given process to complete the Payroll ZATCA Solution.
Program Name Interface Type
LMG Saudi ZATCA Cleare Tax Program Integration (Outbound)
LMG Saudi ZATCA DOR Load Integration (Inboud)
LMG ZATCA VAT Invoice Report Integration (Generating the VAT Report)
2.3. Access Requirement:
Integration User should have access to following Roles and privileges with Data Access Set.
Payroll Administrator role
2.4. Business Validations required:
Regular payroll process should be completed successfully.
Consider only the employees whoever is attached with VAT deduction element.
Only Payroll action with “R” & “Q” should be picked up
Don’t consider the entries which is processed with zero value.
Element with classification as “'Involuntary Deductions” & “'Voluntary Deductions'” should be considered
Invoice number needs to be generated using sequence object to maintain the uniqueness. Below is the As-is logic used for invoice number generation. It needs to be replicated.
• If Payroll type is “Regular” then sequencing format will be 'PAY' || “lmhr_pay_saudi_vat_seq.”
• If Payroll type is “FNF: then sequencing format will be 'FNF' || lmhr_ff_saudi_vat_seq.NEXTVAL
Create a lookup to maintain the “VAT Deduction rate” which is 15% as per As-Is logic and use it to derive the VAT amount from the element value.
2.5. File format, data mapping and transformation.
The file below provides details of fields that would form the basis of the format for creating VAT invoice through BI extracts.
Payroll to BI Extract Mapping
BI Columns TO BE Mapping
PERSON_ID Get the Person ID From Person Secured View
ASSIGNMENT_ID Get the Assignment ID From Person Secured View
EMPLOYEE_NUMBER Get the employee number form Person Secured View
EMPLOYEE_NAME From Person Names table
ASSIGNMENT_NUMBER From Assignment Table
EMAIL_ADDRESS From Email Address Table
LEGAL_ENTITY_NAME From Organization tables
PAYROLL_ACTON_ID From Payroll Actions tables
PAYROLL_NAME From Payroll Name Tables
PAYROLL_TYPE From Payroll Actions tables
ELEMENT NAME Payroll Results tables
Amount Payroll Results tables
Currency Payroll Results tables
VAT Percentage From Common Lookups tables
VAT Amount From Common Lookups tables
Total Amount & VAT From Common Lookups tables
Effective Date Zatca Run date
Period Name Payroll Period Tables
Tax Currency Code Payroll Tables(Same as Payroll Currency)
Party Reg. Name LE Name
Party Company ID LE ORG Code
BUILD_NAME From Legal Address Table (Only for KSA)
Flat name From Legal Address Table (Only for KSA)
Street name From Legal Address Table (Only for KSA)
City From Legal Address Table (Only for KSA)
Sub-City From Legal Address Table (Only for KSA)
Postal Code From Legal Address Table (Only for KSA)
Postal Country From Legal Address Table (Only for KSA)
OIC to Microservice Mapping
OIC to DOR Mapping
DOR to VAT Report
Refer Attached FDD for ZATCA VAT report.
Below are the points considered during transformation: -
In case of lines details If deduction element name is Like 'International%Courier%' THEN this should be displayed ‘The international transport of Goods' under tax exemption reason code.
In case of lines details If deduction element name is Like ‘'International%Ticket%'’ THEN this should be displayed ‘international transport of passengers' as tax exemption reason code.
Once BI Extracts is completed then details will be processed/transformed in the OIC and it will be captured in some ATP tables where the QR code response will be updated with reference to each invoices as per ZATCA Clear Tax.
Arabic Versions of element are captured in the following lookup LM_HR_FINAL_SET_REPORT at EBS so, similar kind of lookup to be created in Fusion or it can be fetched from standard Translation tables
Invoice Tax category should be captured based on the VAT Percentage like below
• If its zero then transform as Z
• If its 15 then transform as S
• Else default S
If element name is like “International” then don’t apply the 15% VAT amount and consider only the base value. For any other elements, display sum of element base value and VAT amount.
Below are the static values used in the AS-IS context which needs to be considered accordingly
table column Display Name Static- Column Value
INV_TAX_SCHEME_ID Tax Scheme ID VAT
INV_ITEM_QTY Item Quantity 1
INV_ITME_QTY_CODE Item Quantity Code EA
INV_LINE_AMT_CUR Invoice Line Amount Currency SAR
INV_LINE_VAT_CUR Invoice Line VAT currency SAR
INV_LINE_INC_VAT_CUR Invoice Line with VAT Currency SAR
INV_LINE_AMT_SUM_CUR Invoice Line Amount Sum Currency SAR
2.6. Data flow diagram
Stage 1 - Oracle Cloud Payroll to OIC
Employee’s payroll processed details with respect to VAT process gets generated through BI Extracts and its will be placed in some SFTP folder.
BI report will be used to check the status of QR code and VAT invoice generation program submitted accordingly as per the status.
Stage 2 – OIC to ZATCA by Using Microservices.
BI Extracts file gets consumed from SFTP folder and transformation gets done as per the given transformation logic and captures in the ATP custom tables which will be used to pass inputs to ZATCA clear Tax and gets responses from ZATCA through Microservices and it will be inserted into same ATP custom tables to capture the QR code response and Invoice Status.
Stage 3 – OIC to Document of Record
After generating the QR code successfully load the QR code into Employee wise DOR – ZATCA QR CODE.
In Oracle HCM Cloud.
Stage 4 – DOR to VAT Report Generation
Once QR code loaded in QR code DOR then User will submit the ESS process to generate the report.
2.7. User procedure overview
This integration will be submitted by Payroll team to run after payroll process is finalized.
When the integration fails in any stage, business team & IT support team will get error/warning email.
In case of errors in OIC from source which get errors in Oracle payroll application, IT support will do the following to correct the errors
Standard procedures for invoice creation is validated from source.
Error records will be notified to Business users / IT Support through email and Integration Dashboard available to check status of Integration processing
Business users / IT Support team can download the errors and sent to Payroll team if in case of any data corrections required
Payroll team rectifies the data errors and rerun the program.
2.8. Error handling and reporting
Following are some errors and Resolutions to perform to clear journal lines errors in GL Interface tables:
Error Scenario Resolution
1 VAT details not generated for the employee Check whether VAT deduction element was attached to the employee. Check for error message under ZATCA report.
2 VAT details are generated but QR code not generated Check in ZATCA portal whether QR code generation process is completed which should be taken care by business.
Reporting:
Integration Dashboard access will be available to business users and IT users to review the data processing status and find error records.
Email will be sent to distribution list for Integration errors with predefined format (Format will be decided in build phase with consultation of business)
Integration status report can be built to list error records with details of errors.
1.1. Testing Scenarios:
S. No Test Scenarios Result
1 Run the LMHR Saudi ZATCA Cleare Tax Program – HCM Extracts The data should be populated properly as per the defined format without any issues
2 Check the QR code generation status in the report The QR code status should reflect as generated.
Additional Information
2.1. Acronyms, abbreviations, and definitions
Term Definition
ERPM Enterprise Resource Planning and Performance Management
SFTP Secure File Transfer Protocol
OIC Oracle Integration Cloud
2.2. Open items, risks, issues, dependencies, and future considerations
Category Description
validate and correct the english and mapping according to Payroll to OIC to ZATCA Clear Tax
The scope is limited to Cloud Payroll Applications and OIC, focusing on outbound mechanisms.
2. Requirements Overview
2.1. Dependencies and Prerequisites
The following sequence of actions will be performed monthly during the payroll process, applicable only for Saudi Arabia, where VAT invoices are generated based on QR code generation from ZATCA:
Payroll Processing: Complete payroll for each specific period.
Prepayments Processing: Complete prepayments for each specific period.
Salary Payment Transfer: Transfer salaries via the bank portal (manual process).
2.2. Setup Requirements
This integration requires configuration for the VAT invoice generation process:
Element Configuration: Configure payroll elements related to VAT deductions.
Element Entries: Attach relevant elements to employees.
BI Extracts: Create BI Extracts to generate payroll run results specific to VAT-related payroll elements.
QR Code Generation: Utilize a microservice to create QR codes and send VAT employee details to the Clear Tax Portal.
The following programs need to be created to complete the Payroll ZATCA Solution:
LMG Saudi ZATCA Clear Tax Program: Integration (Outbound)
LMG Saudi ZATCA DOR Load: Integration (Inbound)
LMG ZATCA VAT Invoice Report: Integration (Generating the VAT Report)
2.3. Access Requirements
The integration user should have access to the following roles and privileges with Data Access Set:
Payroll Administrator Role
2.4. Business Validations Required
Payroll Completion: Ensure regular payroll processes are completed successfully.
Element Attachment: Consider only employees with VAT deduction elements attached.
Payroll Actions: Process only payroll actions with statuses "R" (Regular) and "Q" (QuickPay).
Non-Zero Entries: Exclude entries processed with zero value.
Element Classification: Consider elements classified as "Involuntary Deductions" and "Voluntary Deductions."
Invoice Number Generation: Generate unique invoice numbers using sequence objects:
For Regular Payroll: 'PAY' || "lmhr_pay_saudi_vat_seq."
For Final Settlement (FNF): 'FNF' || lmhr_ff_saudi_vat_seq.NEXTVAL
VAT Deduction Rate: Maintain a lookup for the VAT deduction rate (15%) and use it to derive the VAT amount from the element value.
2.5. File Format, Data Mapping, and Transformation
The following details outline the fields for creating VAT invoices through BI Extracts:
1. Payroll to BI Extract Mapping
BI Column
Mapping Description
PERSON_ID
Retrieve from Person Secured View
ASSIGNMENT_ID
Retrieve from Person Secured View
EMPLOYEE_NUMBER
Retrieve from Person Secured View
EMPLOYEE_NAME
Retrieve from Person Names Table
ASSIGNMENT_NUMBER
Retrieve from Assignment Table
EMAIL_ADDRESS
Retrieve from Email Address Table
LEGAL_ENTITY_NAME
Retrieve from Organization Tables
PAYROLL_ACTION_ID
Retrieve from Payroll Actions Tables
PAYROLL_NAME
Retrieve from Payroll Name Tables
PAYROLL_TYPE
Retrieve from Payroll Actions Tables
ELEMENT_NAME
Retrieve from Payroll Results Tables
AMOUNT
Retrieve from Payroll Results Tables
CURRENCY
Retrieve from Payroll Results Tables
VAT_PERCENTAGE
Retrieve from Common Lookups Tables
VAT_AMOUNT
Retrieve from Common Lookups Tables
TOTAL_AMOUNT_VAT
Retrieve from Common Lookups Tables
EFFECTIVE_DATE
ZATCA Run Date
PERIOD_NAME
Retrieve from Payroll Period Tables
TAX_CURRENCY_CODE
Same as Payroll Currency
PARTY_REG_NAME
Legal Entity Name
PARTY_COMPANY_ID
Legal Entity Organization Code
BUILD_NAME
Retrieve from Legal Address Table (Only for KSA)
FLAT_NAME
Retrieve from Legal Address Table (Only for KSA)
STREET_NAME
Retrieve from Legal Address Table (Only for KSA)
CITY
Retrieve from Legal Address Table (Only for KSA)
SUB_CITY
Retrieve from Legal Address Table (Only for KSA)
POSTAL_CODE
Retrieve from Legal Address Table (Only for KSA)
POSTAL_COUNTRY
Retrieve from Legal Address Table (Only for KSA)
2. OIC to Microservice Mapping
Details to be provided during the build phase.
3. OIC to DOR Mapping
Details to be provided during the build phase.
4. DOR to VAT Report
Refer to the attached Functional Design Document (FDD) for