def format_for_ca(data, invoice_type): if invoice_type == "GST_PURCHASE": voucher = "Purchase" debit = "Purchase A/c" credit = data["Vendor"] elif invoice_type == "SALES": voucher = "Sales" debit = data["Vendor"] credit = "Sales A/c" elif invoice_type == "CREDIT_NOTE": voucher = "Credit Note" debit = data["Vendor"] credit = "Purchase Return A/c" else: voucher = "Journal" debit = "Unknown" credit = "Unknown" narration = f"Being transaction with {data['Vendor']} vide inv {data['Invoice No']}" return { "Date": data["Date"], "Voucher Type": voucher, "Vendor": data["Vendor"], "GSTIN": data["GSTIN"], "Invoice No": data["Invoice No"], "Taxable": data["Taxable"], "CGST": data["CGST"], "SGST": data["SGST"], "IGST": data["IGST"], "Total": data["Total"], "Debit Ledger": debit, "Credit Ledger": credit, "Narration": narration, "Confidence": "Pending" }