Bug #3071
Implement Add Voucher UI and Frontend API Integration
Description
Implement the frontend Add Voucher screen for accounting voucher entry.
Scope:
- Add Voucher screen for:
- Cash Payment (CP)
- Cash Receipt (CR)
- Bank Payment (BP)
- Bank Receipt (BR)
- Journal (JV)
- Contra (CT)
Frontend requirements:
- Load Voucher Type and Transaction Mode options from:
GET /api/v1/station/accounting/metadata
- Load/search active ledgers for Particulars from:
GET /api/v1/station/ledgers?search={text}
- Implement dynamic Transaction Mode behavior based on Voucher Type:
- Cash Payment / Cash Receipt → CASH
- Bank Payment / Bank Receipt → CHEQUE / NEFT / RTGS / UPI
- Journal / Contra → hide Transaction Mode and related fields
- Show/hide and validate Instrument No. and Cheque Issuer Bank based on Transaction Mode.
- Implement voucher line table with:
- S.No.
- Debit/Credit selector
- Particulars / Ledger
- Debit Amount
- Credit Amount
- Ensure each row has either Debit or Credit amount, not both.
- Maintain running Total Debit and Total Credit.
- Disable Submit when Debit and Credit totals are not equal.
- Apply client-side validation before API submission.
Submit flow:
- Use:
POST /api/v1/station/accounting/vouchers/submit
- Voucher must be created and posted in a single API call.
- On successful response, display the generated Voucher Number (voucherNo).
Document upload:
- Upload documents only after successful voucher creation using the returned voucher ID.
- Use:
POST /api/v1/station/accounting/vouchers/{id}/attachments
- Support multiple files.
- Allowed formats:
.jpg, .jpeg, .png, .bmp, .pdf
- Maximum file size: 5 MB per file.
- Implement attachment list/download/delete where required.
Error handling:
- Display backend validation/error messages returned by the API to the user.
Reference UI:
Follow the provided Add Voucher reference screens and UI specification while keeping the backend API flow as defined above.
Note:
- Do not use the old Draft → Post flow for this screen.
- Add Voucher uses the single-submit API and the voucher is posted immediately.
Updated by Yashaditya Singh 15 minutes ago
I worked on the Add Voucher frontend implementation based on the provided UI specification and existing project design patterns. I integrated the accounting metadata, ledger search, voucher submit, and document upload APIs into the frontend flow. I also worked on the dynamic voucher type and transaction mode behavior for cash, bank, journal, and contra vouchers, along with debit/credit validation, balance calculations, required field checks, and attachment validation. The Add Voucher screen is being aligned with the project's existing branding, colors, typography, spacing, MUI components, and reusable design tokens to avoid any UI mismatch. The implementation is still in progress, with further frontend testing and validation remaining.