User Manual: EFD Z Report Functionality in CSF TZ for ERPNext
This user manual provides step-by-step guidance for using the EFD Z Report DocType in CSF TZ for ERPNext, based on the stored Python logic. It covers features such as creating a report, fetching sales invoices, validation, submission, and cancellation.
1. Overview
The EFD Z Report module is designed to:
- Retrieve and link sales invoices to a fiscal Z report.
 - Validate data consistency between sales invoices and manually entered totals.
 - Ensure compliance with fiscal reporting standards.
 
2. Key Features
Validation Checks:
- Ensures no submission is made without linked sales invoices.
 - Confirms data integrity and allowable differences for turnover, VAT, and other fields.
 
Sales Invoice Retrieval:
- Fetches sales invoices based on the fiscal device and Z report date/time.
 
Submission Logic:
- Links sales invoices to the Z report upon submission.
 - Performs validation to prevent submission if discrepancies exist.
 
Cancellation Logic:
- Unlinks sales invoices if the Z report is cancelled.
 
3. Step-by-Step Instructions
3.1. Creating an EFD Z Report
- Navigate to the EFD Z Report module.
 - Click New to create a new report.
 Fill in the required fields:
- Electronic Fiscal Device: Link to the fiscal device used.
 - Z No: Unique identifier for the Z Report.
 - Z Report Date Time: Specify the date and time of the Z report.
 - Receipts Issued: Number of receipts issued during the period.
 
Click Save.
3.2. Fetching Sales Invoices
- After saving the report, click the Get Invoices button.
 The system will fetch sales invoices based on:
- Fiscal device and date/time.
 - Exclusions for already linked or returned invoices.
 
Review the invoices populated in the EFD Z Report Invoices table.
3.3. Validating the Report
Ensure that the following match within the allowable difference:
- Total Turnover matches Total Turnover (Ticked).
 - Total Excluding VAT matches Total Excluding VAT (Ticked).
 - Total VAT matches Total VAT (Ticked).
 - Total Turnover Exempted / Sp. Relief matches Total Turnover Exempted / Sp. Relief (Ticked).
 
Confirm that the number of ticked invoices matches the Receipts Issued field.
3.4. Submitting the Report
- Once validations pass, click Submit.
 - During submission:
- The system checks for discrepancies.
 - Links the Z Report to the associated sales invoices.
 
 - If any sales invoice is already linked to another Z Report, an error will be displayed.
 
3.5. Cancelling the Report
- To cancel a submitted report:
- Open the Z Report.
 - Click Cancel.
 
 - The system will:
- Unlink the Z Report from all associated sales invoices.
 - Save the unlinked invoices.
 
 
4. Error Messages and Troubleshooting
"No Sales Invoice Found in the Table":
- Ensure the Get Invoices button has been clicked, and invoices are populated.
 
"Sales Invoice Amount is not equal to Money Entered":
- Review turnover fields for mismatches and adjust data within allowable differences.
 
"The Number of Sales Invoice (Include is checked) in the table is not equal to Receipts Issued":
- Ensure the ticked invoices count matches the number entered in Receipts Issued.
 
"The Sales Invoice {Invoice} is linked to EFD Z Report {Report}":
- Check if the invoice is already linked to another Z Report and unlink it if necessary.
 
5. Key Functional Details
Fetching Sales Invoices:
- Filters sales invoices that are not yet linked to a Z Report and meet the fiscal device and date/time criteria.
 - Special calculations handle invoices with exempted or special relief VAT.
 
Validation Logic:
- Checks for:
- Consistency in totals (Turnover, VAT, and others).
 - Allowable differences defined in the report.
 - Correct number of linked invoices.
 
 
- Checks for:
 Submission Logic:
- Links invoices and saves the Z Report.
 - Removes unselected invoices from the list.
 
Cancellation Logic:
- Clears the EFD Z Report field in linked invoices upon cancellation.
 
6. Advanced Use Cases
Handling Allowable Differences:
- The Allowable Difference field defines acceptable discrepancies during validation.
 - Adjust this value if minor discrepancies are expected.
 
Unlinking Specific Invoices:
- Untick the Include checkbox for invoices you want to exclude before submission.
 
7. Conclusion
By following this manual, users can effectively manage fiscal Z Reports in ERPNext using the custom logic provided. The system ensures compliance, consistency, and efficient handling of sales invoices linked to fiscal devices. For further assistance, contact your ERPNext administrator.