[2026-06-08 02:53:22] [INFO] ===========================================
[2026-06-08 02:53:22] [INFO] Quotations Processor Log
[2026-06-08 02:53:22] [INFO] Record ID: 000019ea-5262-75ea-c4ab-88c6ecd62bfb
[2026-06-08 02:53:22] [INFO] Table: quotations
[2026-06-08 02:53:22] [INFO] Timestamp: 2026-06-08 02:53:22
[2026-06-08 02:53:22] [INFO] ===========================================
[2026-06-08 02:53:22] [INFO] ========== START: processQuotationSubmission ==========
[2026-06-08 02:53:22] [INFO] Function called for record ID: 000019ea-5262-75ea-c4ab-88c6ecd62bfb
[2026-06-08 02:53:22] [DEBUG] Form data received: {"table":"quotations","tenant_id":"019b6d0e-53fa-7513-32f3-8ecf0105b3ea"}
[2026-06-08 02:53:22] [INFO] Detected table: quotations (Type: proforma)
[2026-06-08 02:53:22] [DEBUG] ID field: quotation_id, Number field: quotation_number
[2026-06-08 02:53:22] [DEBUG] STEP 1: Fetching quotation data from database
[2026-06-08 02:53:22] [DEBUG] QueryBuilder instance created
[2026-06-08 02:53:22] [DEBUG] Database query executed for quotation_id: 000019ea-5262-75ea-c4ab-88c6ecd62bfb
[2026-06-08 02:53:22] [DEBUG] Quotation found successfully
[2026-06-08 02:53:22] [INFO] quotation_type from record overrides invoiceType: proforma
[2026-06-08 02:53:22] [DEBUG] Using org_id: 019b6d0e-53fa-7513-32f3-8ecf0105b3ea
[2026-06-08 02:53:22] [INFO] Fetched quotation data: {"quotation_id":"000019ea-5262-75ea-c4ab-88c6ecd62bfb","quotation_number":"00005","date":"2026-06-08","customer_id":"000019e5-bc8b-7042-b3ab-a0fda6cb4a14","org_id":"019b6d0e-53fa-7513-32f3-8ecf0105b3ea","client_id":null,"line_items":"{\"row_0\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"210\", \"product_id\": null, \"unit_price\": \"70\", \"vat_amount\": \"23.33\", \"description\": \"19\\\" Tool Bag\", \"line_subtotal\": \"210\"}, \"row_1\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"67.5\", \"product_id\": null, \"unit_price\": \"22.50\", \"vat_amount\": \"7.5\", \"description\": \"10\\\" Shifting Spanner\", \"line_subtotal\": \"67.5\"}, \"row_2\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"85.5\", \"product_id\": null, \"unit_price\": \"28.50\", \"vat_amount\": \"9.5\", \"description\": \"12\\\" Shifting Spanner\", \"line_subtotal\": \"85.5\"}, \"row_3\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"43.5\", \"product_id\": null, \"unit_price\": \"14.50\", \"vat_amount\": \"4.83\", \"description\": \"10\\\" Pipe Wrench\", \"line_subtotal\": \"43.5\"}, \"row_4\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"103.5\", \"product_id\": null, \"unit_price\": \"34.50\", \"vat_amount\": \"11.5\", \"description\": \"12\\\" Pipe Wrench\", \"line_subtotal\": \"103.5\"}, \"row_5\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"85.5\", \"product_id\": null, \"unit_price\": \"28.50\", \"vat_amount\": \"9.5\", \"description\": \"Tube cutter\", \"line_subtotal\": \"85.5\"}, \"row_6\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"10.5\", \"product_id\": null, \"unit_price\": \"3.50\", \"vat_amount\": \"1.17\", \"description\": \"100grams PVC Glue\", \"line_subtotal\": \"10.5\"}, \"row_7\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"55.5\", \"product_id\": null, \"unit_price\": \"18.50\", \"vat_amount\": \"6.17\", \"description\": \"8\\\" RASP File\", \"line_subtotal\": \"55.5\"}, \"row_8\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"37.5\", \"product_id\": null, \"unit_price\": \"12.50\", \"vat_amount\": \"4.17\", \"description\": \"Hack Saw\", \"line_subtotal\": \"37.5\"}, \"row_9\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"97.5\", \"product_id\": null, \"unit_price\": \"32.50\", \"vat_amount\": \"10.83\", \"description\": \"Claw Hammer\", \"line_subtotal\": \"97.5\"}, \"row_10\": {\"quantity\": \"12\", \"vat_rate\": \"VIP\", \"line_total\": \"354\", \"product_id\": null, \"unit_price\": \"29.50\", \"vat_amount\": \"39.33\", \"description\": \"15mm Stop Cock Peglar\", \"line_subtotal\": \"354\"}, \"row_11\": {\"quantity\": \"12\", \"vat_rate\": \"VIP\", \"line_total\": \"288\", \"product_id\": null, \"unit_price\": \"24\", \"vat_amount\": \"32\", \"description\": \"Brass Tap Peglar\", \"line_subtotal\": \"288\"}, \"row_12\": {\"quantity\": \"30\", \"vat_rate\": \"VIP\", \"line_total\": \"21\", \"product_id\": null, \"unit_price\": \"0.70\", \"vat_amount\": \"2.33\", \"description\": \"Bip Tap Washer\", \"line_subtotal\": \"21\"}, \"row_13\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"135\", \"product_id\": null, \"unit_price\": \"45\", \"vat_amount\": \"15\", \"description\": \"Shower Rose\", \"line_subtotal\": \"135\"}, \"row_14\": {\"quantity\": \"12\", \"vat_rate\": \"VIP\", \"line_total\": \"7.2\", \"product_id\": null, \"unit_price\": \"0.60\", \"vat_amount\": \"0.8\", \"description\": \"15mm PVC Elbow\", \"line_subtotal\": \"7.2\"}, \"row_15\": {\"quantity\": \"12\", \"vat_rate\": \"VIP\", \"line_total\": \"7.8\", \"product_id\": null, \"unit_price\": \"0.65\", \"vat_amount\": \"0.87\", \"description\": \"15mm PVC Tee Joint\", \"line_subtotal\": \"7.8\"}, \"row_16\": {\"quantity\": \"12\", \"vat_rate\": \"VIP\", \"line_total\": \"11.4\", \"product_id\": null, \"unit_price\": \"0.95\", \"vat_amount\": \"1.27\", \"description\": \"15mm Male Socket\", \"line_subtotal\": \"11.4\"}, \"row_17\": {\"quantity\": \"12\", \"vat_rate\": \"VIP\", \"line_total\": \"10.2\", \"product_id\": null, \"unit_price\": \"0.85\", \"vat_amount\": \"1.13\", \"description\": \"15mm Female Socket\", \"line_subtotal\": \"10.2\"}, \"row_18\": {\"quantity\": \"12\", \"vat_rate\": \"VIP\", \"line_total\": \"6.6\", \"product_id\": null, \"unit_price\": \"0.55\", \"vat_amount\": \"0.73\", \"description\": \"15mm PVC Jointer\", \"line_subtotal\": \"6.6\"}, \"row_19\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"67.5\", \"product_id\": null, \"unit_price\": \"22.50\", \"vat_amount\": \"7.5\", \"description\": \"Measuring Tape\", \"line_subtotal\": \"67.5\"}}","note":null,"terms":null,"validity_days":30,"status":"draft","total_amount":"1705.20","tax_amount":"189.46","template_id":null,"sent_at":null,"expires_at":"2026-06-15","accepted_at":null,"rejected_at":null,"rejection_reason":null,"converted_invoice_id":null,"created_by":null,"updated_by":null,"isdeleted":false,"updatedat":"2026-06-08 02:53:22.057243+00","taxcore_submission_id":null,"taxcore_submission_id_fk":null,"taxcore_receipt_data":null,"taxcore_submitted_at":null,"taxcore_verification_url":null,"taxcore_qr_code":null,"journal_entry_id":null,"converted_to_invoice_id":null,"po_number":null,"notes_additional":null,"payment_terms_details":null,"quotation_type":"proforma"}
[2026-06-08 02:53:22] [DEBUG] STEP 2: Parsing line_items JSON
[2026-06-08 02:53:22] [DEBUG] Parsed 20 line items
[2026-06-08 02:53:22] [DEBUG] Line items: {"row_0":{"quantity":"3","vat_rate":"VIP","line_total":"210","product_id":null,"unit_price":"70","vat_amount":"23.33","description":"19\" Tool Bag","line_subtotal":"210"},"row_1":{"quantity":"3","vat_rate":"VIP","line_total":"67.5","product_id":null,"unit_price":"22.50","vat_amount":"7.5","description":"10\" Shifting Spanner","line_subtotal":"67.5"},"row_2":{"quantity":"3","vat_rate":"VIP","line_total":"85.5","product_id":null,"unit_price":"28.50","vat_amount":"9.5","description":"12\" Shifting Spanner","line_subtotal":"85.5"},"row_3":{"quantity":"3","vat_rate":"VIP","line_total":"43.5","product_id":null,"unit_price":"14.50","vat_amount":"4.83","description":"10\" Pipe Wrench","line_subtotal":"43.5"},"row_4":{"quantity":"3","vat_rate":"VIP","line_total":"103.5","product_id":null,"unit_price":"34.50","vat_amount":"11.5","description":"12\" Pipe Wrench","line_subtotal":"103.5"},"row_5":{"quantity":"3","vat_rate":"VIP","line_total":"85.5","product_id":null,"unit_price":"28.50","vat_amount":"9.5","description":"Tube cutter","line_subtotal":"85.5"},"row_6":{"quantity":"3","vat_rate":"VIP","line_total":"10.5","product_id":null,"unit_price":"3.50","vat_amount":"1.17","description":"100grams PVC Glue","line_subtotal":"10.5"},"row_7":{"quantity":"3","vat_rate":"VIP","line_total":"55.5","product_id":null,"unit_price":"18.50","vat_amount":"6.17","description":"8\" RASP File","line_subtotal":"55.5"},"row_8":{"quantity":"3","vat_rate":"VIP","line_total":"37.5","product_id":null,"unit_price":"12.50","vat_amount":"4.17","description":"Hack Saw","line_subtotal":"37.5"},"row_9":{"quantity":"3","vat_rate":"VIP","line_total":"97.5","product_id":null,"unit_price":"32.50","vat_amount":"10.83","description":"Claw Hammer","line_subtotal":"97.5"},"row_10":{"quantity":"12","vat_rate":"VIP","line_total":"354","product_id":null,"unit_price":"29.50","vat_amount":"39.33","description":"15mm Stop Cock Peglar","line_subtotal":"354"},"row_11":{"quantity":"12","vat_rate":"VIP","line_total":"288","product_id":null,"unit_price":"24","vat_amount":"32","description":"Brass Tap Peglar","line_subtotal":"288"},"row_12":{"quantity":"30","vat_rate":"VIP","line_total":"21","product_id":null,"unit_price":"0.70","vat_amount":"2.33","description":"Bip Tap Washer","line_subtotal":"21"},"row_13":{"quantity":"3","vat_rate":"VIP","line_total":"135","product_id":null,"unit_price":"45","vat_amount":"15","description":"Shower Rose","line_subtotal":"135"},"row_14":{"quantity":"12","vat_rate":"VIP","line_total":"7.2","product_id":null,"unit_price":"0.60","vat_amount":"0.8","description":"15mm PVC Elbow","line_subtotal":"7.2"},"row_15":{"quantity":"12","vat_rate":"VIP","line_total":"7.8","product_id":null,"unit_price":"0.65","vat_amount":"0.87","description":"15mm PVC Tee Joint","line_subtotal":"7.8"},"row_16":{"quantity":"12","vat_rate":"VIP","line_total":"11.4","product_id":null,"unit_price":"0.95","vat_amount":"1.27","description":"15mm Male Socket","line_subtotal":"11.4"},"row_17":{"quantity":"12","vat_rate":"VIP","line_total":"10.2","product_id":null,"unit_price":"0.85","vat_amount":"1.13","description":"15mm Female Socket","line_subtotal":"10.2"},"row_18":{"quantity":"12","vat_rate":"VIP","line_total":"6.6","product_id":null,"unit_price":"0.55","vat_amount":"0.73","description":"15mm PVC Jointer","line_subtotal":"6.6"},"row_19":{"quantity":"3","vat_rate":"VIP","line_total":"67.5","product_id":null,"unit_price":"22.50","vat_amount":"7.5","description":"Measuring Tape","line_subtotal":"67.5"}}
[2026-06-08 02:53:22] [DEBUG] STEP 3: Preparing items for TaxCore
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_0 -> {"quantity":"3","vat_rate":"VIP","line_total":"210","product_id":null,"unit_price":"70","vat_amount":"23.33","description":"19\" Tool Bag","line_subtotal":"210"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 70, TotalAmount: 210
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_1 -> {"quantity":"3","vat_rate":"VIP","line_total":"67.5","product_id":null,"unit_price":"22.50","vat_amount":"7.5","description":"10\" Shifting Spanner","line_subtotal":"67.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 22.5, TotalAmount: 67.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_2 -> {"quantity":"3","vat_rate":"VIP","line_total":"85.5","product_id":null,"unit_price":"28.50","vat_amount":"9.5","description":"12\" Shifting Spanner","line_subtotal":"85.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 28.5, TotalAmount: 85.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_3 -> {"quantity":"3","vat_rate":"VIP","line_total":"43.5","product_id":null,"unit_price":"14.50","vat_amount":"4.83","description":"10\" Pipe Wrench","line_subtotal":"43.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 14.5, TotalAmount: 43.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_4 -> {"quantity":"3","vat_rate":"VIP","line_total":"103.5","product_id":null,"unit_price":"34.50","vat_amount":"11.5","description":"12\" Pipe Wrench","line_subtotal":"103.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 34.5, TotalAmount: 103.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_5 -> {"quantity":"3","vat_rate":"VIP","line_total":"85.5","product_id":null,"unit_price":"28.50","vat_amount":"9.5","description":"Tube cutter","line_subtotal":"85.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 28.5, TotalAmount: 85.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_6 -> {"quantity":"3","vat_rate":"VIP","line_total":"10.5","product_id":null,"unit_price":"3.50","vat_amount":"1.17","description":"100grams PVC Glue","line_subtotal":"10.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 3.5, TotalAmount: 10.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_7 -> {"quantity":"3","vat_rate":"VIP","line_total":"55.5","product_id":null,"unit_price":"18.50","vat_amount":"6.17","description":"8\" RASP File","line_subtotal":"55.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 18.5, TotalAmount: 55.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_8 -> {"quantity":"3","vat_rate":"VIP","line_total":"37.5","product_id":null,"unit_price":"12.50","vat_amount":"4.17","description":"Hack Saw","line_subtotal":"37.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 12.5, TotalAmount: 37.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_9 -> {"quantity":"3","vat_rate":"VIP","line_total":"97.5","product_id":null,"unit_price":"32.50","vat_amount":"10.83","description":"Claw Hammer","line_subtotal":"97.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 32.5, TotalAmount: 97.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_10 -> {"quantity":"12","vat_rate":"VIP","line_total":"354","product_id":null,"unit_price":"29.50","vat_amount":"39.33","description":"15mm Stop Cock Peglar","line_subtotal":"354"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 12, UnitPrice: 29.5, TotalAmount: 354
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_11 -> {"quantity":"12","vat_rate":"VIP","line_total":"288","product_id":null,"unit_price":"24","vat_amount":"32","description":"Brass Tap Peglar","line_subtotal":"288"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 12, UnitPrice: 24, TotalAmount: 288
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_12 -> {"quantity":"30","vat_rate":"VIP","line_total":"21","product_id":null,"unit_price":"0.70","vat_amount":"2.33","description":"Bip Tap Washer","line_subtotal":"21"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 30, UnitPrice: 0.7, TotalAmount: 21
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_13 -> {"quantity":"3","vat_rate":"VIP","line_total":"135","product_id":null,"unit_price":"45","vat_amount":"15","description":"Shower Rose","line_subtotal":"135"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 45, TotalAmount: 135
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_14 -> {"quantity":"12","vat_rate":"VIP","line_total":"7.2","product_id":null,"unit_price":"0.60","vat_amount":"0.8","description":"15mm PVC Elbow","line_subtotal":"7.2"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 12, UnitPrice: 0.6, TotalAmount: 7.2
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_15 -> {"quantity":"12","vat_rate":"VIP","line_total":"7.8","product_id":null,"unit_price":"0.65","vat_amount":"0.87","description":"15mm PVC Tee Joint","line_subtotal":"7.8"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 12, UnitPrice: 0.65, TotalAmount: 7.8
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_16 -> {"quantity":"12","vat_rate":"VIP","line_total":"11.4","product_id":null,"unit_price":"0.95","vat_amount":"1.27","description":"15mm Male Socket","line_subtotal":"11.4"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 12, UnitPrice: 0.95, TotalAmount: 11.4
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_17 -> {"quantity":"12","vat_rate":"VIP","line_total":"10.2","product_id":null,"unit_price":"0.85","vat_amount":"1.13","description":"15mm Female Socket","line_subtotal":"10.2"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 12, UnitPrice: 0.85, TotalAmount: 10.2
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_18 -> {"quantity":"12","vat_rate":"VIP","line_total":"6.6","product_id":null,"unit_price":"0.55","vat_amount":"0.73","description":"15mm PVC Jointer","line_subtotal":"6.6"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 12, UnitPrice: 0.55, TotalAmount: 6.6
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_19 -> {"quantity":"3","vat_rate":"VIP","line_total":"67.5","product_id":null,"unit_price":"22.50","vat_amount":"7.5","description":"Measuring Tape","line_subtotal":"67.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 22.5, TotalAmount: 67.5
[2026-06-08 02:53:22] [DEBUG] Prepared 20 items for TaxCore
[2026-06-08 02:53:22] [INFO] TaxCore items: [{"name":"19\" Tool Bag","quantity":3,"unitPrice":"70.00","totalAmount":"210.00","Labels":["G"]},{"name":"10\" Shifting Spanner","quantity":3,"unitPrice":"22.50","totalAmount":"67.50","Labels":["G"]},{"name":"12\" Shifting Spanner","quantity":3,"unitPrice":"28.50","totalAmount":"85.50","Labels":["G"]},{"name":"10\" Pipe Wrench","quantity":3,"unitPrice":"14.50","totalAmount":"43.50","Labels":["G"]},{"name":"12\" Pipe Wrench","quantity":3,"unitPrice":"34.50","totalAmount":"103.50","Labels":["G"]},{"name":"Tube cutter","quantity":3,"unitPrice":"28.50","totalAmount":"85.50","Labels":["G"]},{"name":"100grams PVC Glue","quantity":3,"unitPrice":"3.50","totalAmount":"10.50","Labels":["G"]},{"name":"8\" RASP File","quantity":3,"unitPrice":"18.50","totalAmount":"55.50","Labels":["G"]},{"name":"Hack Saw","quantity":3,"unitPrice":"12.50","totalAmount":"37.50","Labels":["G"]},{"name":"Claw Hammer","quantity":3,"unitPrice":"32.50","totalAmount":"97.50","Labels":["G"]},{"name":"15mm Stop Cock Peglar","quantity":12,"unitPrice":"29.50","totalAmount":"354.00","Labels":["G"]},{"name":"Brass Tap Peglar","quantity":12,"unitPrice":"24.00","totalAmount":"288.00","Labels":["G"]},{"name":"Bip Tap Washer","quantity":30,"unitPrice":"0.70","totalAmount":"21.00","Labels":["G"]},{"name":"Shower Rose","quantity":3,"unitPrice":"45.00","totalAmount":"135.00","Labels":["G"]},{"name":"15mm PVC Elbow","quantity":12,"unitPrice":"0.60","totalAmount":"7.20","Labels":["G"]},{"name":"15mm PVC Tee Joint","quantity":12,"unitPrice":"0.65","totalAmount":"7.80","Labels":["G"]},{"name":"15mm Male Socket","quantity":12,"unitPrice":"0.95","totalAmount":"11.40","Labels":["G"]},{"name":"15mm Female Socket","quantity":12,"unitPrice":"0.85","totalAmount":"10.20","Labels":["G"]},{"name":"15mm PVC Jointer","quantity":12,"unitPrice":"0.55","totalAmount":"6.60","Labels":["G"]},{"name":"Measuring Tape","quantity":3,"unitPrice":"22.50","totalAmount":"67.50","Labels":["G"]}]
[2026-06-08 02:53:22] [DEBUG] STEP 4: Preparing payment method as Credit
[2026-06-08 02:53:22] [INFO] Payment prepared (Credit): [{"paymentType":"0","amount":1705.2}]
[2026-06-08 02:53:22] [DEBUG] STEP 5: Fetching cashier information
[2026-06-08 02:53:22] [DEBUG] User ID from formData: 019b6d0e-53fa-7513-32f3-8ecf0105b3ea
[2026-06-08 02:53:22] [DEBUG] Querying users table for user_id: 019b6d0e-53fa-7513-32f3-8ecf0105b3ea
[2026-06-08 02:53:22] [INFO] Cashier name found: System
[2026-06-08 02:53:22] [DEBUG] STEP 6: Building TaxCore payload
[2026-06-08 02:53:22] [DEBUG] Base payload created with type=proforma
[2026-06-08 02:53:22] [DEBUG] STEP 7: Adding customer/buyer information
[2026-06-08 02:53:22] [DEBUG] Customer ID found: 000019e5-bc8b-7042-b3ab-a0fda6cb4a14
[2026-06-08 02:53:22] [DEBUG] Customer found: {"name":"Habitat for Humanity Fiji ","tin":null}
[2026-06-08 02:53:22] [INFO] TaxCore payload prepared: {
    "items": [
        {
            "name": "19\" Tool Bag",
            "quantity": 3,
            "unitPrice": "70.00",
            "totalAmount": "210.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "10\" Shifting Spanner",
            "quantity": 3,
            "unitPrice": "22.50",
            "totalAmount": "67.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "12\" Shifting Spanner",
            "quantity": 3,
            "unitPrice": "28.50",
            "totalAmount": "85.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "10\" Pipe Wrench",
            "quantity": 3,
            "unitPrice": "14.50",
            "totalAmount": "43.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "12\" Pipe Wrench",
            "quantity": 3,
            "unitPrice": "34.50",
            "totalAmount": "103.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Tube cutter",
            "quantity": 3,
            "unitPrice": "28.50",
            "totalAmount": "85.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "100grams PVC Glue",
            "quantity": 3,
            "unitPrice": "3.50",
            "totalAmount": "10.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "8\" RASP File",
            "quantity": 3,
            "unitPrice": "18.50",
            "totalAmount": "55.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Hack Saw",
            "quantity": 3,
            "unitPrice": "12.50",
            "totalAmount": "37.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Claw Hammer",
            "quantity": 3,
            "unitPrice": "32.50",
            "totalAmount": "97.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "15mm Stop Cock Peglar",
            "quantity": 12,
            "unitPrice": "29.50",
            "totalAmount": "354.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Brass Tap Peglar",
            "quantity": 12,
            "unitPrice": "24.00",
            "totalAmount": "288.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Bip Tap Washer",
            "quantity": 30,
            "unitPrice": "0.70",
            "totalAmount": "21.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Shower Rose",
            "quantity": 3,
            "unitPrice": "45.00",
            "totalAmount": "135.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "15mm PVC Elbow",
            "quantity": 12,
            "unitPrice": "0.60",
            "totalAmount": "7.20",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "15mm PVC Tee Joint",
            "quantity": 12,
            "unitPrice": "0.65",
            "totalAmount": "7.80",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "15mm Male Socket",
            "quantity": 12,
            "unitPrice": "0.95",
            "totalAmount": "11.40",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "15mm Female Socket",
            "quantity": 12,
            "unitPrice": "0.85",
            "totalAmount": "10.20",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "15mm PVC Jointer",
            "quantity": 12,
            "unitPrice": "0.55",
            "totalAmount": "6.60",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Measuring Tape",
            "quantity": 3,
            "unitPrice": "22.50",
            "totalAmount": "67.50",
            "Labels": [
                "G"
            ]
        }
    ],
    "payment": [
        {
            "paymentType": "0",
            "amount": 1705.2
        }
    ],
    "Cashier": "System",
    "type": "proforma",
    "invoiceNumber": "00005",
    "Buyer": {
        "Name": "Habitat for Humanity Fiji "
    }
}
[2026-06-08 02:53:22] [DEBUG] STEP 8: Creating Journal Entry in Finance module
[2026-06-08 02:53:22] [INFO] --- createJournalEntry: Starting ---
[2026-06-08 02:53:22] [INFO] Is Cancelled/Refund: NO
[2026-06-08 02:53:22] [DEBUG] Calculated totals - Subtotal: 1705.2, Tax: 213.15, Total: 1918.35
[2026-06-08 02:53:22] [DEBUG] Looking for customer-specific AR account for: Habitat for Humanity Fiji 
[2026-06-08 02:53:22] [INFO] Found customer-specific AR account: 1300-004 - AR - Habitat for Humanity Fiji 
[2026-06-08 02:53:22] [DEBUG] Found GL accounts - Revenue: 4000, Tax: 2410, Receivables: 1300-004 (AR - Habitat for Humanity Fiji )
[2026-06-08 02:53:22] [ERROR] ERROR creating journal entry: Undefined variable $orgId
[2026-06-08 02:53:22] [ERROR] Stack trace: #0 /var/www/POS/api/services/QuotationsProcessor.php(632): {closure}()
#1 /var/www/POS/api/services/QuotationsProcessor.php(301): App\Services\QuotationsProcessor::createJournalEntry()
#2 [internal function]: App\Services\QuotationsProcessor::processQuotationSubmission()
#3 /var/www/POS/api/services/workflow_steps/CustomFunctionStep.php(121): call_user_func_array()
#4 /var/www/POS/api/services/WorkflowEngine.php(508): App\Services\WorkflowSteps\CustomFunctionStep->execute()
#5 /var/www/POS/api/services/WorkflowEngine.php(767): App\Services\WorkflowEngine->executeStep()
#6 /var/www/POS/api/services/WorkflowEngine.php(144): App\Services\WorkflowEngine->runSteps()
#7 /var/www/POS/api/services/WorkflowEngine.php(177): App\Services\WorkflowEngine->handleEvent()
#8 /var/www/POS/api/services/WorkflowEngine.php(189): App\Services\WorkflowEngine->emit()
#9 /var/www/POS/api/controllers/GenericController.php(373): App\Services\WorkflowEngine::trigger()
#10 /var/www/POS/api/controllers/SyncController.php(212): App\Controllers\GenericController->processWorkflowEvents()
#11 /var/www/POS/api/controllers/SyncController.php(224): App\Controllers\GenericController@anonymous->exec()
#12 /var/www/POS/api/controllers/SyncController.php(1330): App\Controllers\SyncController->triggerWorkflow()
#13 /var/www/POS/api/router.php(272): App\Controllers\SyncController->push()
#14 /var/www/POS/api/index.php(32): require_once('...')
#15 {main}
[2026-06-08 02:53:22] [WARN] WARNING: Journal entry creation failed: Undefined variable $orgId
[2026-06-08 02:53:22] [DEBUG] STEP 9: Checking if TaxCore integration is enabled
[2026-06-08 02:53:22] [DEBUG] Checking TaxCore integration status for org_id: 019b6d0e-53fa-7513-32f3-8ecf0105b3ea (table: quotations)
[2026-06-08 02:53:22] [INFO] Found quotation_taxcore_enabled in orgs.settings: false
[2026-06-08 02:53:22] [INFO] TaxCore integration enabled: NO
[2026-06-08 02:53:22] [INFO] TaxCore integration is disabled - skipping TaxCore submission
[2026-06-08 02:53:22] [INFO] TaxCore call completed successfully
[2026-06-08 02:53:22] [INFO] TaxCore response: {
    "skipped": true,
    "reason": "TaxCore integration disabled for this organization",
    "invoiceNumber": null
}
[2026-06-08 02:53:22] [DEBUG] STEP 10: Updating quotations record with TaxCore and Journal Entry details
[2026-06-08 02:53:22] [DEBUG] Update data prepared: {"quotation_id":"000019ea-5262-75ea-c4ab-88c6ecd62bfb"}
[2026-06-08 02:53:22] [INFO] Quotations record updated successfully
[2026-06-08 02:53:22] [INFO] Skipping sales_receipts insert - TaxCore disabled or submission failed
[2026-06-08 02:53:22] [DEBUG] STEP 12: Saving audit file to storage
[2026-06-08 02:53:22] [DEBUG] Storage file path: /var/www/POS/storage/quotations/quotation_000019ea-5262-75ea-c4ab-88c6ecd62bfb_2026-06-08_02-53-22.json
[2026-06-08 02:53:22] [INFO] Audit file saved successfully to: /var/www/POS/storage/quotations/quotation_000019ea-5262-75ea-c4ab-88c6ecd62bfb_2026-06-08_02-53-22.json
[2026-06-08 02:53:22] [DEBUG] STEP 13: Preparing final result
[2026-06-08 02:53:22] [INFO] ========== SUCCESS: Process completed ==========
[2026-06-08 02:53:22] [INFO] Final result: {"success":true,"message":"Quotations processed successfully (TaxCore disabled)","record_id":"000019ea-5262-75ea-c4ab-88c6ecd62bfb","table":"quotations","invoice_type":"proforma","taxcore_enabled":false,"journal_entry_id":null,"journal_entry_number":null,"taxcore_invoice_number":null,"taxcore_verification_url":null,"taxcore_skipped":true,"processed_at":"2026-06-08 02:53:22","saved_to":"\/var\/www\/POS\/storage\/quotations\/quotation_000019ea-5262-75ea-c4ab-88c6ecd62bfb_2026-06-08_02-53-22.json","log_file":"\/var\/www\/POS\/storage\/quotations\/logs\/quotation_000019ea-5262-75ea-c4ab-88c6ecd62bfb_2026-06-08_02-53-22.log"}
[2026-06-08 02:53:22] [INFO] ===========================================
[2026-06-08 02:53:22] [INFO] Quotations Processor Log
[2026-06-08 02:53:22] [INFO] Record ID: 000019ea-5262-75ea-c4ab-88c6ecd62bfb
[2026-06-08 02:53:22] [INFO] Table: quotations
[2026-06-08 02:53:22] [INFO] Timestamp: 2026-06-08 02:53:22
[2026-06-08 02:53:22] [INFO] ===========================================
[2026-06-08 02:53:22] [INFO] ========== START: processQuotationSubmission ==========
[2026-06-08 02:53:22] [INFO] Function called for record ID: 000019ea-5262-75ea-c4ab-88c6ecd62bfb
[2026-06-08 02:53:22] [DEBUG] Form data received: {"table":"quotations","tenant_id":"019b6d0e-53fa-7513-32f3-8ecf0105b3ea"}
[2026-06-08 02:53:22] [INFO] Detected table: quotations (Type: proforma)
[2026-06-08 02:53:22] [DEBUG] ID field: quotation_id, Number field: quotation_number
[2026-06-08 02:53:22] [DEBUG] STEP 1: Fetching quotation data from database
[2026-06-08 02:53:22] [DEBUG] QueryBuilder instance created
[2026-06-08 02:53:22] [DEBUG] Database query executed for quotation_id: 000019ea-5262-75ea-c4ab-88c6ecd62bfb
[2026-06-08 02:53:22] [DEBUG] Quotation found successfully
[2026-06-08 02:53:22] [INFO] quotation_type from record overrides invoiceType: proforma
[2026-06-08 02:53:22] [DEBUG] Using org_id: 019b6d0e-53fa-7513-32f3-8ecf0105b3ea
[2026-06-08 02:53:22] [INFO] Fetched quotation data: {"quotation_id":"000019ea-5262-75ea-c4ab-88c6ecd62bfb","quotation_number":"00005","date":"2026-06-08","customer_id":"000019e5-bc8b-7042-b3ab-a0fda6cb4a14","org_id":"019b6d0e-53fa-7513-32f3-8ecf0105b3ea","client_id":null,"line_items":"{\"row_0\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"210\", \"product_id\": null, \"unit_price\": \"70\", \"vat_amount\": \"23.33\", \"description\": \"19\\\" Tool Bag\", \"line_subtotal\": \"210\"}, \"row_1\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"67.5\", \"product_id\": null, \"unit_price\": \"22.50\", \"vat_amount\": \"7.5\", \"description\": \"10\\\" Shifting Spanner\", \"line_subtotal\": \"67.5\"}, \"row_2\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"85.5\", \"product_id\": null, \"unit_price\": \"28.50\", \"vat_amount\": \"9.5\", \"description\": \"12\\\" Shifting Spanner\", \"line_subtotal\": \"85.5\"}, \"row_3\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"43.5\", \"product_id\": null, \"unit_price\": \"14.50\", \"vat_amount\": \"4.83\", \"description\": \"10\\\" Pipe Wrench\", \"line_subtotal\": \"43.5\"}, \"row_4\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"103.5\", \"product_id\": null, \"unit_price\": \"34.50\", \"vat_amount\": \"11.5\", \"description\": \"12\\\" Pipe Wrench\", \"line_subtotal\": \"103.5\"}, \"row_5\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"85.5\", \"product_id\": null, \"unit_price\": \"28.50\", \"vat_amount\": \"9.5\", \"description\": \"Tube cutter\", \"line_subtotal\": \"85.5\"}, \"row_6\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"10.5\", \"product_id\": null, \"unit_price\": \"3.50\", \"vat_amount\": \"1.17\", \"description\": \"100grams PVC Glue\", \"line_subtotal\": \"10.5\"}, \"row_7\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"55.5\", \"product_id\": null, \"unit_price\": \"18.50\", \"vat_amount\": \"6.17\", \"description\": \"8\\\" RASP File\", \"line_subtotal\": \"55.5\"}, \"row_8\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"37.5\", \"product_id\": null, \"unit_price\": \"12.50\", \"vat_amount\": \"4.17\", \"description\": \"Hack Saw\", \"line_subtotal\": \"37.5\"}, \"row_9\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"97.5\", \"product_id\": null, \"unit_price\": \"32.50\", \"vat_amount\": \"10.83\", \"description\": \"Claw Hammer\", \"line_subtotal\": \"97.5\"}, \"row_10\": {\"quantity\": \"12\", \"vat_rate\": \"VIP\", \"line_total\": \"354\", \"product_id\": null, \"unit_price\": \"29.50\", \"vat_amount\": \"39.33\", \"description\": \"15mm Stop Cock Peglar\", \"line_subtotal\": \"354\"}, \"row_11\": {\"quantity\": \"12\", \"vat_rate\": \"VIP\", \"line_total\": \"288\", \"product_id\": null, \"unit_price\": \"24\", \"vat_amount\": \"32\", \"description\": \"Brass Tap Peglar\", \"line_subtotal\": \"288\"}, \"row_12\": {\"quantity\": \"30\", \"vat_rate\": \"VIP\", \"line_total\": \"21\", \"product_id\": null, \"unit_price\": \"0.70\", \"vat_amount\": \"2.33\", \"description\": \"Bip Tap Washer\", \"line_subtotal\": \"21\"}, \"row_13\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"135\", \"product_id\": null, \"unit_price\": \"45\", \"vat_amount\": \"15\", \"description\": \"Shower Rose\", \"line_subtotal\": \"135\"}, \"row_14\": {\"quantity\": \"12\", \"vat_rate\": \"VIP\", \"line_total\": \"7.2\", \"product_id\": null, \"unit_price\": \"0.60\", \"vat_amount\": \"0.8\", \"description\": \"15mm PVC Elbow\", \"line_subtotal\": \"7.2\"}, \"row_15\": {\"quantity\": \"12\", \"vat_rate\": \"VIP\", \"line_total\": \"7.8\", \"product_id\": null, \"unit_price\": \"0.65\", \"vat_amount\": \"0.87\", \"description\": \"15mm PVC Tee Joint\", \"line_subtotal\": \"7.8\"}, \"row_16\": {\"quantity\": \"12\", \"vat_rate\": \"VIP\", \"line_total\": \"11.4\", \"product_id\": null, \"unit_price\": \"0.95\", \"vat_amount\": \"1.27\", \"description\": \"15mm Male Socket\", \"line_subtotal\": \"11.4\"}, \"row_17\": {\"quantity\": \"12\", \"vat_rate\": \"VIP\", \"line_total\": \"10.2\", \"product_id\": null, \"unit_price\": \"0.85\", \"vat_amount\": \"1.13\", \"description\": \"15mm Female Socket\", \"line_subtotal\": \"10.2\"}, \"row_18\": {\"quantity\": \"12\", \"vat_rate\": \"VIP\", \"line_total\": \"6.6\", \"product_id\": null, \"unit_price\": \"0.55\", \"vat_amount\": \"0.73\", \"description\": \"15mm PVC Jointer\", \"line_subtotal\": \"6.6\"}, \"row_19\": {\"quantity\": \"3\", \"vat_rate\": \"VIP\", \"line_total\": \"67.5\", \"product_id\": null, \"unit_price\": \"22.50\", \"vat_amount\": \"7.5\", \"description\": \"Measuring Tape\", \"line_subtotal\": \"67.5\"}}","note":null,"terms":null,"validity_days":30,"status":"draft","total_amount":"1705.20","tax_amount":"189.46","template_id":null,"sent_at":null,"expires_at":"2026-06-15","accepted_at":null,"rejected_at":null,"rejection_reason":null,"converted_invoice_id":null,"created_by":null,"updated_by":null,"isdeleted":false,"updatedat":"2026-06-08 02:53:22.088851+00","taxcore_submission_id":null,"taxcore_submission_id_fk":null,"taxcore_receipt_data":null,"taxcore_submitted_at":null,"taxcore_verification_url":null,"taxcore_qr_code":null,"journal_entry_id":null,"converted_to_invoice_id":null,"po_number":null,"notes_additional":null,"payment_terms_details":null,"quotation_type":"proforma"}
[2026-06-08 02:53:22] [DEBUG] STEP 2: Parsing line_items JSON
[2026-06-08 02:53:22] [DEBUG] Parsed 20 line items
[2026-06-08 02:53:22] [DEBUG] Line items: {"row_0":{"quantity":"3","vat_rate":"VIP","line_total":"210","product_id":null,"unit_price":"70","vat_amount":"23.33","description":"19\" Tool Bag","line_subtotal":"210"},"row_1":{"quantity":"3","vat_rate":"VIP","line_total":"67.5","product_id":null,"unit_price":"22.50","vat_amount":"7.5","description":"10\" Shifting Spanner","line_subtotal":"67.5"},"row_2":{"quantity":"3","vat_rate":"VIP","line_total":"85.5","product_id":null,"unit_price":"28.50","vat_amount":"9.5","description":"12\" Shifting Spanner","line_subtotal":"85.5"},"row_3":{"quantity":"3","vat_rate":"VIP","line_total":"43.5","product_id":null,"unit_price":"14.50","vat_amount":"4.83","description":"10\" Pipe Wrench","line_subtotal":"43.5"},"row_4":{"quantity":"3","vat_rate":"VIP","line_total":"103.5","product_id":null,"unit_price":"34.50","vat_amount":"11.5","description":"12\" Pipe Wrench","line_subtotal":"103.5"},"row_5":{"quantity":"3","vat_rate":"VIP","line_total":"85.5","product_id":null,"unit_price":"28.50","vat_amount":"9.5","description":"Tube cutter","line_subtotal":"85.5"},"row_6":{"quantity":"3","vat_rate":"VIP","line_total":"10.5","product_id":null,"unit_price":"3.50","vat_amount":"1.17","description":"100grams PVC Glue","line_subtotal":"10.5"},"row_7":{"quantity":"3","vat_rate":"VIP","line_total":"55.5","product_id":null,"unit_price":"18.50","vat_amount":"6.17","description":"8\" RASP File","line_subtotal":"55.5"},"row_8":{"quantity":"3","vat_rate":"VIP","line_total":"37.5","product_id":null,"unit_price":"12.50","vat_amount":"4.17","description":"Hack Saw","line_subtotal":"37.5"},"row_9":{"quantity":"3","vat_rate":"VIP","line_total":"97.5","product_id":null,"unit_price":"32.50","vat_amount":"10.83","description":"Claw Hammer","line_subtotal":"97.5"},"row_10":{"quantity":"12","vat_rate":"VIP","line_total":"354","product_id":null,"unit_price":"29.50","vat_amount":"39.33","description":"15mm Stop Cock Peglar","line_subtotal":"354"},"row_11":{"quantity":"12","vat_rate":"VIP","line_total":"288","product_id":null,"unit_price":"24","vat_amount":"32","description":"Brass Tap Peglar","line_subtotal":"288"},"row_12":{"quantity":"30","vat_rate":"VIP","line_total":"21","product_id":null,"unit_price":"0.70","vat_amount":"2.33","description":"Bip Tap Washer","line_subtotal":"21"},"row_13":{"quantity":"3","vat_rate":"VIP","line_total":"135","product_id":null,"unit_price":"45","vat_amount":"15","description":"Shower Rose","line_subtotal":"135"},"row_14":{"quantity":"12","vat_rate":"VIP","line_total":"7.2","product_id":null,"unit_price":"0.60","vat_amount":"0.8","description":"15mm PVC Elbow","line_subtotal":"7.2"},"row_15":{"quantity":"12","vat_rate":"VIP","line_total":"7.8","product_id":null,"unit_price":"0.65","vat_amount":"0.87","description":"15mm PVC Tee Joint","line_subtotal":"7.8"},"row_16":{"quantity":"12","vat_rate":"VIP","line_total":"11.4","product_id":null,"unit_price":"0.95","vat_amount":"1.27","description":"15mm Male Socket","line_subtotal":"11.4"},"row_17":{"quantity":"12","vat_rate":"VIP","line_total":"10.2","product_id":null,"unit_price":"0.85","vat_amount":"1.13","description":"15mm Female Socket","line_subtotal":"10.2"},"row_18":{"quantity":"12","vat_rate":"VIP","line_total":"6.6","product_id":null,"unit_price":"0.55","vat_amount":"0.73","description":"15mm PVC Jointer","line_subtotal":"6.6"},"row_19":{"quantity":"3","vat_rate":"VIP","line_total":"67.5","product_id":null,"unit_price":"22.50","vat_amount":"7.5","description":"Measuring Tape","line_subtotal":"67.5"}}
[2026-06-08 02:53:22] [DEBUG] STEP 3: Preparing items for TaxCore
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_0 -> {"quantity":"3","vat_rate":"VIP","line_total":"210","product_id":null,"unit_price":"70","vat_amount":"23.33","description":"19\" Tool Bag","line_subtotal":"210"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 70, TotalAmount: 210
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_1 -> {"quantity":"3","vat_rate":"VIP","line_total":"67.5","product_id":null,"unit_price":"22.50","vat_amount":"7.5","description":"10\" Shifting Spanner","line_subtotal":"67.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 22.5, TotalAmount: 67.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_2 -> {"quantity":"3","vat_rate":"VIP","line_total":"85.5","product_id":null,"unit_price":"28.50","vat_amount":"9.5","description":"12\" Shifting Spanner","line_subtotal":"85.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 28.5, TotalAmount: 85.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_3 -> {"quantity":"3","vat_rate":"VIP","line_total":"43.5","product_id":null,"unit_price":"14.50","vat_amount":"4.83","description":"10\" Pipe Wrench","line_subtotal":"43.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 14.5, TotalAmount: 43.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_4 -> {"quantity":"3","vat_rate":"VIP","line_total":"103.5","product_id":null,"unit_price":"34.50","vat_amount":"11.5","description":"12\" Pipe Wrench","line_subtotal":"103.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 34.5, TotalAmount: 103.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_5 -> {"quantity":"3","vat_rate":"VIP","line_total":"85.5","product_id":null,"unit_price":"28.50","vat_amount":"9.5","description":"Tube cutter","line_subtotal":"85.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 28.5, TotalAmount: 85.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_6 -> {"quantity":"3","vat_rate":"VIP","line_total":"10.5","product_id":null,"unit_price":"3.50","vat_amount":"1.17","description":"100grams PVC Glue","line_subtotal":"10.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 3.5, TotalAmount: 10.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_7 -> {"quantity":"3","vat_rate":"VIP","line_total":"55.5","product_id":null,"unit_price":"18.50","vat_amount":"6.17","description":"8\" RASP File","line_subtotal":"55.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 18.5, TotalAmount: 55.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_8 -> {"quantity":"3","vat_rate":"VIP","line_total":"37.5","product_id":null,"unit_price":"12.50","vat_amount":"4.17","description":"Hack Saw","line_subtotal":"37.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 12.5, TotalAmount: 37.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_9 -> {"quantity":"3","vat_rate":"VIP","line_total":"97.5","product_id":null,"unit_price":"32.50","vat_amount":"10.83","description":"Claw Hammer","line_subtotal":"97.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 32.5, TotalAmount: 97.5
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_10 -> {"quantity":"12","vat_rate":"VIP","line_total":"354","product_id":null,"unit_price":"29.50","vat_amount":"39.33","description":"15mm Stop Cock Peglar","line_subtotal":"354"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 12, UnitPrice: 29.5, TotalAmount: 354
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_11 -> {"quantity":"12","vat_rate":"VIP","line_total":"288","product_id":null,"unit_price":"24","vat_amount":"32","description":"Brass Tap Peglar","line_subtotal":"288"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 12, UnitPrice: 24, TotalAmount: 288
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_12 -> {"quantity":"30","vat_rate":"VIP","line_total":"21","product_id":null,"unit_price":"0.70","vat_amount":"2.33","description":"Bip Tap Washer","line_subtotal":"21"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 30, UnitPrice: 0.7, TotalAmount: 21
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_13 -> {"quantity":"3","vat_rate":"VIP","line_total":"135","product_id":null,"unit_price":"45","vat_amount":"15","description":"Shower Rose","line_subtotal":"135"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 45, TotalAmount: 135
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_14 -> {"quantity":"12","vat_rate":"VIP","line_total":"7.2","product_id":null,"unit_price":"0.60","vat_amount":"0.8","description":"15mm PVC Elbow","line_subtotal":"7.2"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 12, UnitPrice: 0.6, TotalAmount: 7.2
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_15 -> {"quantity":"12","vat_rate":"VIP","line_total":"7.8","product_id":null,"unit_price":"0.65","vat_amount":"0.87","description":"15mm PVC Tee Joint","line_subtotal":"7.8"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 12, UnitPrice: 0.65, TotalAmount: 7.8
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_16 -> {"quantity":"12","vat_rate":"VIP","line_total":"11.4","product_id":null,"unit_price":"0.95","vat_amount":"1.27","description":"15mm Male Socket","line_subtotal":"11.4"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 12, UnitPrice: 0.95, TotalAmount: 11.4
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_17 -> {"quantity":"12","vat_rate":"VIP","line_total":"10.2","product_id":null,"unit_price":"0.85","vat_amount":"1.13","description":"15mm Female Socket","line_subtotal":"10.2"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 12, UnitPrice: 0.85, TotalAmount: 10.2
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_18 -> {"quantity":"12","vat_rate":"VIP","line_total":"6.6","product_id":null,"unit_price":"0.55","vat_amount":"0.73","description":"15mm PVC Jointer","line_subtotal":"6.6"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 12, UnitPrice: 0.55, TotalAmount: 6.6
[2026-06-08 02:53:22] [DEBUG] Processing line item: row_19 -> {"quantity":"3","vat_rate":"VIP","line_total":"67.5","product_id":null,"unit_price":"22.50","vat_amount":"7.5","description":"Measuring Tape","line_subtotal":"67.5"}
[2026-06-08 02:53:22] [DEBUG] Calculated - Quantity: 3, UnitPrice: 22.5, TotalAmount: 67.5
[2026-06-08 02:53:22] [DEBUG] Prepared 20 items for TaxCore
[2026-06-08 02:53:22] [INFO] TaxCore items: [{"name":"19\" Tool Bag","quantity":3,"unitPrice":"70.00","totalAmount":"210.00","Labels":["G"]},{"name":"10\" Shifting Spanner","quantity":3,"unitPrice":"22.50","totalAmount":"67.50","Labels":["G"]},{"name":"12\" Shifting Spanner","quantity":3,"unitPrice":"28.50","totalAmount":"85.50","Labels":["G"]},{"name":"10\" Pipe Wrench","quantity":3,"unitPrice":"14.50","totalAmount":"43.50","Labels":["G"]},{"name":"12\" Pipe Wrench","quantity":3,"unitPrice":"34.50","totalAmount":"103.50","Labels":["G"]},{"name":"Tube cutter","quantity":3,"unitPrice":"28.50","totalAmount":"85.50","Labels":["G"]},{"name":"100grams PVC Glue","quantity":3,"unitPrice":"3.50","totalAmount":"10.50","Labels":["G"]},{"name":"8\" RASP File","quantity":3,"unitPrice":"18.50","totalAmount":"55.50","Labels":["G"]},{"name":"Hack Saw","quantity":3,"unitPrice":"12.50","totalAmount":"37.50","Labels":["G"]},{"name":"Claw Hammer","quantity":3,"unitPrice":"32.50","totalAmount":"97.50","Labels":["G"]},{"name":"15mm Stop Cock Peglar","quantity":12,"unitPrice":"29.50","totalAmount":"354.00","Labels":["G"]},{"name":"Brass Tap Peglar","quantity":12,"unitPrice":"24.00","totalAmount":"288.00","Labels":["G"]},{"name":"Bip Tap Washer","quantity":30,"unitPrice":"0.70","totalAmount":"21.00","Labels":["G"]},{"name":"Shower Rose","quantity":3,"unitPrice":"45.00","totalAmount":"135.00","Labels":["G"]},{"name":"15mm PVC Elbow","quantity":12,"unitPrice":"0.60","totalAmount":"7.20","Labels":["G"]},{"name":"15mm PVC Tee Joint","quantity":12,"unitPrice":"0.65","totalAmount":"7.80","Labels":["G"]},{"name":"15mm Male Socket","quantity":12,"unitPrice":"0.95","totalAmount":"11.40","Labels":["G"]},{"name":"15mm Female Socket","quantity":12,"unitPrice":"0.85","totalAmount":"10.20","Labels":["G"]},{"name":"15mm PVC Jointer","quantity":12,"unitPrice":"0.55","totalAmount":"6.60","Labels":["G"]},{"name":"Measuring Tape","quantity":3,"unitPrice":"22.50","totalAmount":"67.50","Labels":["G"]}]
[2026-06-08 02:53:22] [DEBUG] STEP 4: Preparing payment method as Credit
[2026-06-08 02:53:22] [INFO] Payment prepared (Credit): [{"paymentType":"0","amount":1705.2}]
[2026-06-08 02:53:22] [DEBUG] STEP 5: Fetching cashier information
[2026-06-08 02:53:22] [DEBUG] User ID from formData: 019b6d0e-53fa-7513-32f3-8ecf0105b3ea
[2026-06-08 02:53:22] [DEBUG] Querying users table for user_id: 019b6d0e-53fa-7513-32f3-8ecf0105b3ea
[2026-06-08 02:53:22] [INFO] Cashier name found: System
[2026-06-08 02:53:22] [DEBUG] STEP 6: Building TaxCore payload
[2026-06-08 02:53:22] [DEBUG] Base payload created with type=proforma
[2026-06-08 02:53:22] [DEBUG] STEP 7: Adding customer/buyer information
[2026-06-08 02:53:22] [DEBUG] Customer ID found: 000019e5-bc8b-7042-b3ab-a0fda6cb4a14
[2026-06-08 02:53:22] [DEBUG] Customer found: {"name":"Habitat for Humanity Fiji ","tin":null}
[2026-06-08 02:53:22] [INFO] TaxCore payload prepared: {
    "items": [
        {
            "name": "19\" Tool Bag",
            "quantity": 3,
            "unitPrice": "70.00",
            "totalAmount": "210.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "10\" Shifting Spanner",
            "quantity": 3,
            "unitPrice": "22.50",
            "totalAmount": "67.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "12\" Shifting Spanner",
            "quantity": 3,
            "unitPrice": "28.50",
            "totalAmount": "85.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "10\" Pipe Wrench",
            "quantity": 3,
            "unitPrice": "14.50",
            "totalAmount": "43.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "12\" Pipe Wrench",
            "quantity": 3,
            "unitPrice": "34.50",
            "totalAmount": "103.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Tube cutter",
            "quantity": 3,
            "unitPrice": "28.50",
            "totalAmount": "85.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "100grams PVC Glue",
            "quantity": 3,
            "unitPrice": "3.50",
            "totalAmount": "10.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "8\" RASP File",
            "quantity": 3,
            "unitPrice": "18.50",
            "totalAmount": "55.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Hack Saw",
            "quantity": 3,
            "unitPrice": "12.50",
            "totalAmount": "37.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Claw Hammer",
            "quantity": 3,
            "unitPrice": "32.50",
            "totalAmount": "97.50",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "15mm Stop Cock Peglar",
            "quantity": 12,
            "unitPrice": "29.50",
            "totalAmount": "354.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Brass Tap Peglar",
            "quantity": 12,
            "unitPrice": "24.00",
            "totalAmount": "288.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Bip Tap Washer",
            "quantity": 30,
            "unitPrice": "0.70",
            "totalAmount": "21.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Shower Rose",
            "quantity": 3,
            "unitPrice": "45.00",
            "totalAmount": "135.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "15mm PVC Elbow",
            "quantity": 12,
            "unitPrice": "0.60",
            "totalAmount": "7.20",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "15mm PVC Tee Joint",
            "quantity": 12,
            "unitPrice": "0.65",
            "totalAmount": "7.80",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "15mm Male Socket",
            "quantity": 12,
            "unitPrice": "0.95",
            "totalAmount": "11.40",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "15mm Female Socket",
            "quantity": 12,
            "unitPrice": "0.85",
            "totalAmount": "10.20",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "15mm PVC Jointer",
            "quantity": 12,
            "unitPrice": "0.55",
            "totalAmount": "6.60",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Measuring Tape",
            "quantity": 3,
            "unitPrice": "22.50",
            "totalAmount": "67.50",
            "Labels": [
                "G"
            ]
        }
    ],
    "payment": [
        {
            "paymentType": "0",
            "amount": 1705.2
        }
    ],
    "Cashier": "System",
    "type": "proforma",
    "invoiceNumber": "00005",
    "Buyer": {
        "Name": "Habitat for Humanity Fiji "
    }
}
[2026-06-08 02:53:22] [DEBUG] STEP 8: Creating Journal Entry in Finance module
[2026-06-08 02:53:22] [INFO] --- createJournalEntry: Starting ---
[2026-06-08 02:53:22] [INFO] Is Cancelled/Refund: NO
[2026-06-08 02:53:22] [DEBUG] Calculated totals - Subtotal: 1705.2, Tax: 213.15, Total: 1918.35
[2026-06-08 02:53:22] [DEBUG] Looking for customer-specific AR account for: Habitat for Humanity Fiji 
[2026-06-08 02:53:22] [INFO] Found customer-specific AR account: 1300-004 - AR - Habitat for Humanity Fiji 
[2026-06-08 02:53:22] [DEBUG] Found GL accounts - Revenue: 4000, Tax: 2410, Receivables: 1300-004 (AR - Habitat for Humanity Fiji )
[2026-06-08 02:53:22] [ERROR] ERROR creating journal entry: Undefined variable $orgId
[2026-06-08 02:53:22] [ERROR] Stack trace: #0 /var/www/POS/api/services/QuotationsProcessor.php(632): {closure}()
#1 /var/www/POS/api/services/QuotationsProcessor.php(301): App\Services\QuotationsProcessor::createJournalEntry()
#2 [internal function]: App\Services\QuotationsProcessor::processQuotationSubmission()
#3 /var/www/POS/api/services/workflow_steps/CustomFunctionStep.php(121): call_user_func_array()
#4 /var/www/POS/api/services/WorkflowEngine.php(508): App\Services\WorkflowSteps\CustomFunctionStep->execute()
#5 /var/www/POS/api/services/WorkflowEngine.php(767): App\Services\WorkflowEngine->executeStep()
#6 /var/www/POS/api/services/WorkflowEngine.php(144): App\Services\WorkflowEngine->runSteps()
#7 /var/www/POS/api/services/WorkflowEngine.php(177): App\Services\WorkflowEngine->handleEvent()
#8 /var/www/POS/api/services/WorkflowEngine.php(189): App\Services\WorkflowEngine->emit()
#9 /var/www/POS/api/controllers/GenericController.php(373): App\Services\WorkflowEngine::trigger()
#10 /var/www/POS/api/controllers/SyncController.php(212): App\Controllers\GenericController->processWorkflowEvents()
#11 /var/www/POS/api/controllers/SyncController.php(224): App\Controllers\GenericController@anonymous->exec()
#12 /var/www/POS/api/controllers/SyncController.php(1330): App\Controllers\SyncController->triggerWorkflow()
#13 /var/www/POS/api/router.php(272): App\Controllers\SyncController->push()
#14 /var/www/POS/api/index.php(32): require_once('...')
#15 {main}
[2026-06-08 02:53:22] [WARN] WARNING: Journal entry creation failed: Undefined variable $orgId
[2026-06-08 02:53:22] [DEBUG] STEP 9: Checking if TaxCore integration is enabled
[2026-06-08 02:53:22] [DEBUG] Checking TaxCore integration status for org_id: 019b6d0e-53fa-7513-32f3-8ecf0105b3ea (table: quotations)
[2026-06-08 02:53:22] [INFO] Found quotation_taxcore_enabled in orgs.settings: false
[2026-06-08 02:53:22] [INFO] TaxCore integration enabled: NO
[2026-06-08 02:53:22] [INFO] TaxCore integration is disabled - skipping TaxCore submission
[2026-06-08 02:53:22] [INFO] TaxCore call completed successfully
[2026-06-08 02:53:22] [INFO] TaxCore response: {
    "skipped": true,
    "reason": "TaxCore integration disabled for this organization",
    "invoiceNumber": null
}
[2026-06-08 02:53:22] [DEBUG] STEP 10: Updating quotations record with TaxCore and Journal Entry details
[2026-06-08 02:53:22] [DEBUG] Update data prepared: {"quotation_id":"000019ea-5262-75ea-c4ab-88c6ecd62bfb"}
[2026-06-08 02:53:22] [INFO] Quotations record updated successfully
[2026-06-08 02:53:22] [INFO] Skipping sales_receipts insert - TaxCore disabled or submission failed
[2026-06-08 02:53:22] [DEBUG] STEP 12: Saving audit file to storage
[2026-06-08 02:53:22] [DEBUG] Storage file path: /var/www/POS/storage/quotations/quotation_000019ea-5262-75ea-c4ab-88c6ecd62bfb_2026-06-08_02-53-22.json
[2026-06-08 02:53:22] [INFO] Audit file saved successfully to: /var/www/POS/storage/quotations/quotation_000019ea-5262-75ea-c4ab-88c6ecd62bfb_2026-06-08_02-53-22.json
[2026-06-08 02:53:22] [DEBUG] STEP 13: Preparing final result
[2026-06-08 02:53:22] [INFO] ========== SUCCESS: Process completed ==========
[2026-06-08 02:53:22] [INFO] Final result: {"success":true,"message":"Quotations processed successfully (TaxCore disabled)","record_id":"000019ea-5262-75ea-c4ab-88c6ecd62bfb","table":"quotations","invoice_type":"proforma","taxcore_enabled":false,"journal_entry_id":null,"journal_entry_number":null,"taxcore_invoice_number":null,"taxcore_verification_url":null,"taxcore_skipped":true,"processed_at":"2026-06-08 02:53:22","saved_to":"\/var\/www\/POS\/storage\/quotations\/quotation_000019ea-5262-75ea-c4ab-88c6ecd62bfb_2026-06-08_02-53-22.json","log_file":"\/var\/www\/POS\/storage\/quotations\/logs\/quotation_000019ea-5262-75ea-c4ab-88c6ecd62bfb_2026-06-08_02-53-22.log"}
