[2026-04-06 02:42:40] [INFO] ===========================================
[2026-04-06 02:42:40] [INFO] Quotations Processor Log
[2026-04-06 02:42:40] [INFO] Record ID: 000019d6-0abb-73d7-ea0a-b17b7e6a7155
[2026-04-06 02:42:40] [INFO] Table: quotations
[2026-04-06 02:42:40] [INFO] Timestamp: 2026-04-06 02:42:40
[2026-04-06 02:42:40] [INFO] ===========================================
[2026-04-06 02:42:40] [INFO] ========== START: processQuotationSubmission ==========
[2026-04-06 02:42:40] [INFO] Function called for record ID: 000019d6-0abb-73d7-ea0a-b17b7e6a7155
[2026-04-06 02:42:40] [DEBUG] Form data received: {"table":"quotations","tenant_id":"019c6fa4-12e6-7bda-e3b6-3340a31436d2"}
[2026-04-06 02:42:40] [INFO] Detected table: quotations (Type: proforma)
[2026-04-06 02:42:40] [DEBUG] ID field: quotation_id, Number field: quotation_number
[2026-04-06 02:42:40] [DEBUG] STEP 1: Fetching quotation data from database
[2026-04-06 02:42:40] [DEBUG] QueryBuilder instance created
[2026-04-06 02:42:40] [DEBUG] Database query executed for quotation_id: 000019d6-0abb-73d7-ea0a-b17b7e6a7155
[2026-04-06 02:42:40] [DEBUG] Quotation found successfully
[2026-04-06 02:42:40] [INFO] quotation_type from record overrides invoiceType: proforma
[2026-04-06 02:42:40] [DEBUG] Using org_id: 019c6fa4-12e6-7bda-e3b6-3340a31436d2
[2026-04-06 02:42:40] [INFO] Fetched quotation data: {"quotation_id":"000019d6-0abb-73d7-ea0a-b17b7e6a7155","quotation_number":"00006","date":"2026-04-06","customer_id":"000019d6-0a75-7dfc-d10e-e9c406bb7f61","org_id":"019c6fa4-12e6-7bda-e3b6-3340a31436d2","client_id":null,"line_items":"{\"row_0\": {\"quantity\": \"1\", \"vat_rate\": \"VIP\", \"line_total\": \"430\", \"product_id\": \"000019c6-fa96-7b3f-9359-8ac2da0c5bd8\", \"unit_price\": \"430\", \"vat_amount\": \"47.78\", \"description\": \"Room number 101\", \"line_subtotal\": \"430\"}, \"row_1\": {\"quantity\": \"1\", \"vat_rate\": \"VIP\", \"line_total\": \"160\", \"product_id\": \"000019c6-ffb8-753d-b746-95f4584112b1\", \"unit_price\": \"160.00\", \"vat_amount\": \"17.78\", \"description\": \"Room 102\", \"line_subtotal\": \"160\"}, \"row_2\": {\"quantity\": \"1\", \"vat_rate\": \"VIP\", \"line_total\": \"200\", \"product_id\": \"000019c6-ffc2-7e03-06e6-84afc7b3f6db\", \"unit_price\": \"200\", \"vat_amount\": \"22.22\", \"description\": \"deluxe room\", \"line_subtotal\": \"200\"}, \"row_3\": {\"quantity\": \"1\", \"vat_rate\": \"VIP\", \"line_total\": \"200\", \"product_id\": \"000019c6-ffc7-741b-5ac1-b20a6c71e996\", \"unit_price\": \"200\", \"vat_amount\": \"22.22\", \"description\": \"deluxe room\", \"line_subtotal\": \"200\"}, \"row_4\": {\"quantity\": \"1\", \"vat_rate\": \"VIP\", \"line_total\": \"160\", \"product_id\": \"000019c6-ffdb-720b-e18b-943ffe420edd\", \"unit_price\": \"160.00\", \"vat_amount\": \"17.78\", \"description\": \"Superior room\", \"line_subtotal\": \"160\"}, \"row_5\": {\"quantity\": \"1\", \"vat_rate\": \"VIP\", \"line_total\": \"300\", \"product_id\": \"000019c6-ffe8-7c1b-092a-79e36d3c4ec0\", \"unit_price\": \"300.00\", \"vat_amount\": \"33.33\", \"description\": \"dormitory\", \"line_subtotal\": \"300\"}, \"row_6\": {\"quantity\": \"1\", \"vat_rate\": \"VIP\", \"line_total\": \"200\", \"product_id\": \"000019c6-ffee-7ccb-ac36-4e9f44a83c12\", \"unit_price\": \"200.00\", \"vat_amount\": \"22.22\", \"description\": \"Standard Double room\", \"line_subtotal\": \"200\"}, \"row_7\": {\"quantity\": \"1\", \"vat_rate\": \"VIP\", \"line_total\": \"200\", \"product_id\": \"000019c6-fff3-7c3b-e7e9-14008422c965\", \"unit_price\": \"200.00\", \"vat_amount\": \"22.22\", \"description\": \"Standard Double room\", \"line_subtotal\": \"200\"}, \"row_8\": {\"quantity\": \"1\", \"vat_rate\": \"0\", \"line_total\": \"150\", \"product_id\": \"000019c6-fffa-73db-4b8b-207fc68bb280\", \"unit_price\": \"150\", \"vat_amount\": \"0\", \"description\": \"Day room\", \"line_subtotal\": \"150\"}}","note":null,"terms":null,"validity_days":30,"status":"draft","total_amount":"2000.00","tax_amount":"205.55","template_id":null,"sent_at":null,"expires_at":"2026-04-30","accepted_at":null,"rejected_at":null,"rejection_reason":null,"converted_invoice_id":null,"created_by":null,"updated_by":null,"isdeleted":false,"updatedat":"2026-04-06 02:42:40.379737+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":"MAY 22ND 2026.","notes_additional":"THIS IS THE WHOLE HOTEL ROOMS .ONCE YOU BOOK ALL THIS ROOMS YOU CAN USE THE HOTEL PREMISES FOR YOUR PARTY AND EVENT FOR FREE.,,THESE ROOMS CAN CATER FOR THE NUMBER YOU QUOTED...","payment_terms_details":"WE HAVE OUR RESTUARANT AND TRANSPORT SERVICES ,,,WE CAN DISCUSS DURING BOOKING CONFIRMATION....","quotation_type":"proforma"}
[2026-04-06 02:42:40] [DEBUG] STEP 2: Parsing line_items JSON
[2026-04-06 02:42:40] [DEBUG] Parsed 9 line items
[2026-04-06 02:42:40] [DEBUG] Line items: {"row_0":{"quantity":"1","vat_rate":"VIP","line_total":"430","product_id":"000019c6-fa96-7b3f-9359-8ac2da0c5bd8","unit_price":"430","vat_amount":"47.78","description":"Room number 101","line_subtotal":"430"},"row_1":{"quantity":"1","vat_rate":"VIP","line_total":"160","product_id":"000019c6-ffb8-753d-b746-95f4584112b1","unit_price":"160.00","vat_amount":"17.78","description":"Room 102","line_subtotal":"160"},"row_2":{"quantity":"1","vat_rate":"VIP","line_total":"200","product_id":"000019c6-ffc2-7e03-06e6-84afc7b3f6db","unit_price":"200","vat_amount":"22.22","description":"deluxe room","line_subtotal":"200"},"row_3":{"quantity":"1","vat_rate":"VIP","line_total":"200","product_id":"000019c6-ffc7-741b-5ac1-b20a6c71e996","unit_price":"200","vat_amount":"22.22","description":"deluxe room","line_subtotal":"200"},"row_4":{"quantity":"1","vat_rate":"VIP","line_total":"160","product_id":"000019c6-ffdb-720b-e18b-943ffe420edd","unit_price":"160.00","vat_amount":"17.78","description":"Superior room","line_subtotal":"160"},"row_5":{"quantity":"1","vat_rate":"VIP","line_total":"300","product_id":"000019c6-ffe8-7c1b-092a-79e36d3c4ec0","unit_price":"300.00","vat_amount":"33.33","description":"dormitory","line_subtotal":"300"},"row_6":{"quantity":"1","vat_rate":"VIP","line_total":"200","product_id":"000019c6-ffee-7ccb-ac36-4e9f44a83c12","unit_price":"200.00","vat_amount":"22.22","description":"Standard Double room","line_subtotal":"200"},"row_7":{"quantity":"1","vat_rate":"VIP","line_total":"200","product_id":"000019c6-fff3-7c3b-e7e9-14008422c965","unit_price":"200.00","vat_amount":"22.22","description":"Standard Double room","line_subtotal":"200"},"row_8":{"quantity":"1","vat_rate":"0","line_total":"150","product_id":"000019c6-fffa-73db-4b8b-207fc68bb280","unit_price":"150","vat_amount":"0","description":"Day room","line_subtotal":"150"}}
[2026-04-06 02:42:40] [DEBUG] STEP 3: Preparing items for TaxCore
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_0 -> {"quantity":"1","vat_rate":"VIP","line_total":"430","product_id":"000019c6-fa96-7b3f-9359-8ac2da0c5bd8","unit_price":"430","vat_amount":"47.78","description":"Room number 101","line_subtotal":"430"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 430, TotalAmount: 430
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_1 -> {"quantity":"1","vat_rate":"VIP","line_total":"160","product_id":"000019c6-ffb8-753d-b746-95f4584112b1","unit_price":"160.00","vat_amount":"17.78","description":"Room 102","line_subtotal":"160"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 160, TotalAmount: 160
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_2 -> {"quantity":"1","vat_rate":"VIP","line_total":"200","product_id":"000019c6-ffc2-7e03-06e6-84afc7b3f6db","unit_price":"200","vat_amount":"22.22","description":"deluxe room","line_subtotal":"200"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 200, TotalAmount: 200
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_3 -> {"quantity":"1","vat_rate":"VIP","line_total":"200","product_id":"000019c6-ffc7-741b-5ac1-b20a6c71e996","unit_price":"200","vat_amount":"22.22","description":"deluxe room","line_subtotal":"200"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 200, TotalAmount: 200
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_4 -> {"quantity":"1","vat_rate":"VIP","line_total":"160","product_id":"000019c6-ffdb-720b-e18b-943ffe420edd","unit_price":"160.00","vat_amount":"17.78","description":"Superior room","line_subtotal":"160"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 160, TotalAmount: 160
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_5 -> {"quantity":"1","vat_rate":"VIP","line_total":"300","product_id":"000019c6-ffe8-7c1b-092a-79e36d3c4ec0","unit_price":"300.00","vat_amount":"33.33","description":"dormitory","line_subtotal":"300"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 300, TotalAmount: 300
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_6 -> {"quantity":"1","vat_rate":"VIP","line_total":"200","product_id":"000019c6-ffee-7ccb-ac36-4e9f44a83c12","unit_price":"200.00","vat_amount":"22.22","description":"Standard Double room","line_subtotal":"200"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 200, TotalAmount: 200
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_7 -> {"quantity":"1","vat_rate":"VIP","line_total":"200","product_id":"000019c6-fff3-7c3b-e7e9-14008422c965","unit_price":"200.00","vat_amount":"22.22","description":"Standard Double room","line_subtotal":"200"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 200, TotalAmount: 200
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_8 -> {"quantity":"1","vat_rate":"0","line_total":"150","product_id":"000019c6-fffa-73db-4b8b-207fc68bb280","unit_price":"150","vat_amount":"0","description":"Day room","line_subtotal":"150"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 150, TotalAmount: 150
[2026-04-06 02:42:40] [DEBUG] Prepared 9 items for TaxCore
[2026-04-06 02:42:40] [INFO] TaxCore items: [{"name":"Room number 101","quantity":1,"unitPrice":"430.00","totalAmount":"430.00","Labels":["G"]},{"name":"Room 102","quantity":1,"unitPrice":"160.00","totalAmount":"160.00","Labels":["G"]},{"name":"deluxe room","quantity":1,"unitPrice":"200.00","totalAmount":"200.00","Labels":["G"]},{"name":"deluxe room","quantity":1,"unitPrice":"200.00","totalAmount":"200.00","Labels":["G"]},{"name":"Superior room","quantity":1,"unitPrice":"160.00","totalAmount":"160.00","Labels":["G"]},{"name":"dormitory","quantity":1,"unitPrice":"300.00","totalAmount":"300.00","Labels":["G"]},{"name":"Standard Double room","quantity":1,"unitPrice":"200.00","totalAmount":"200.00","Labels":["G"]},{"name":"Standard Double room","quantity":1,"unitPrice":"200.00","totalAmount":"200.00","Labels":["G"]},{"name":"Day room","quantity":1,"unitPrice":"150.00","totalAmount":"150.00","Labels":["G"]}]
[2026-04-06 02:42:40] [DEBUG] STEP 4: Preparing payment method as Credit
[2026-04-06 02:42:40] [INFO] Payment prepared (Credit): [{"paymentType":"0","amount":2000}]
[2026-04-06 02:42:40] [DEBUG] STEP 5: Fetching cashier information
[2026-04-06 02:42:40] [DEBUG] User ID from formData: 019c6fa4-12e6-7bda-e3b6-3340a31436d2
[2026-04-06 02:42:40] [DEBUG] Querying users table for user_id: 019c6fa4-12e6-7bda-e3b6-3340a31436d2
[2026-04-06 02:42:40] [INFO] Cashier name found: System
[2026-04-06 02:42:40] [DEBUG] STEP 6: Building TaxCore payload
[2026-04-06 02:42:40] [DEBUG] Base payload created with type=proforma
[2026-04-06 02:42:40] [DEBUG] STEP 7: Adding customer/buyer information
[2026-04-06 02:42:40] [DEBUG] Customer ID found: 000019d6-0a75-7dfc-d10e-e9c406bb7f61
[2026-04-06 02:42:40] [DEBUG] Customer found: {"name":"1 YEAR BIRTHDAY PARTY","tin":null}
[2026-04-06 02:42:40] [INFO] TaxCore payload prepared: {
    "items": [
        {
            "name": "Room number 101",
            "quantity": 1,
            "unitPrice": "430.00",
            "totalAmount": "430.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Room 102",
            "quantity": 1,
            "unitPrice": "160.00",
            "totalAmount": "160.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "deluxe room",
            "quantity": 1,
            "unitPrice": "200.00",
            "totalAmount": "200.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "deluxe room",
            "quantity": 1,
            "unitPrice": "200.00",
            "totalAmount": "200.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Superior room",
            "quantity": 1,
            "unitPrice": "160.00",
            "totalAmount": "160.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "dormitory",
            "quantity": 1,
            "unitPrice": "300.00",
            "totalAmount": "300.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Standard Double room",
            "quantity": 1,
            "unitPrice": "200.00",
            "totalAmount": "200.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Standard Double room",
            "quantity": 1,
            "unitPrice": "200.00",
            "totalAmount": "200.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Day room",
            "quantity": 1,
            "unitPrice": "150.00",
            "totalAmount": "150.00",
            "Labels": [
                "G"
            ]
        }
    ],
    "payment": [
        {
            "paymentType": "0",
            "amount": 2000
        }
    ],
    "Cashier": "System",
    "type": "proforma",
    "invoiceNumber": "00006",
    "Buyer": {
        "Name": "1 YEAR BIRTHDAY PARTY"
    }
}
[2026-04-06 02:42:40] [DEBUG] STEP 8: Creating Journal Entry in Finance module
[2026-04-06 02:42:40] [INFO] --- createJournalEntry: Starting ---
[2026-04-06 02:42:40] [INFO] Is Cancelled/Refund: NO
[2026-04-06 02:42:40] [DEBUG] Calculated totals - Subtotal: 2000, Tax: 250, Total: 2250
[2026-04-06 02:42:40] [DEBUG] Looking for customer-specific AR account for: 1 YEAR BIRTHDAY PARTY
[2026-04-06 02:42:40] [INFO] Found customer-specific AR account: 1300-015 - AR - 1 YEAR BIRTHDAY PARTY
[2026-04-06 02:42:40] [DEBUG] Found GL accounts - Revenue: 4000, Tax: 2410, Receivables: 1300-015 (AR - 1 YEAR BIRTHDAY PARTY)
[2026-04-06 02:42:40] [DEBUG] Journal entry header prepared: {"id":"ae505f1d-c091-497d-8728-51ba62f47b05","entry_date":"2026-04-06","description":"Quotation 00006","reference":"00006","source_module":"quotations","source_id":"000019d6-0abb-73d7-ea0a-b17b7e6a7155","total_debits":2250,"total_credits":2250,"status":"posted","is_balanced":true,"created_by":null,"org_id":null,"posted_at":"2026-04-06 02:42:40","posted_by":null}
[2026-04-06 02:42:40] [INFO] Journal entry header created: ae505f1d-c091-497d-8728-51ba62f47b05
[2026-04-06 02:42:40] [DEBUG] Prepared 3 journal lines
[2026-04-06 02:42:40] [ERROR] ERROR creating journal entry: SQL Error: SQLSTATE[23502]: Not null violation: 7 ERROR:  null value in column "org_id" of relation "gl_account_balances" violates not-null constraint
DETAIL:  Failing row contains (019d60a7-6474-789d-8135-f05f6315c766, null, 2250.00, 0.00, 2250.00, 2026-04-06 02:42:40.425811+00, 2026-04-06, 1, 2026-04-06 02:42:40.425811+00, 2026-04-06 02:42:40.425811+00, 019d60ab-baac-73a1-98d7-0b4162a84410).
CONTEXT:  SQL statement "INSERT INTO gl_account_balances (
        account_id,
        org_id,
        total_debits,
        total_credits,
        current_balance,
        last_updated,
        last_entry_date,
        transaction_count,
        updated_at
    ) VALUES (
        v_account_id,
        v_org_id,
        v_total_debits,
        v_total_credits,
        v_new_balance,
        CURRENT_TIMESTAMP,
        v_last_entry_date,
        v_transaction_count,
        CURRENT_TIMESTAMP
    )
    ON CONFLICT (account_id, org_id) DO UPDATE SET
        total_debits = EXCLUDED.total_debits,
        total_credits = EXCLUDED.total_credits,
        current_balance = EXCLUDED.current_balance,
        last_updated = EXCLUDED.last_updated,
        last_entry_date = EXCLUDED.last_entry_date,
        transaction_count = EXCLUDED.transaction_count,
        updated_at = EXCLUDED.updated_at"
PL/pgSQL function update_account_balance() line 49 at SQL statement | Query: INSERT INTO "gl_journal_lines" ("id", "journal_entry_id", "account_id", "memo", "debit", "credit", "org_id") VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING id
[2026-04-06 02:42:40] [ERROR] Stack trace: #0 /var/www/POS/api/utils/DB.php(231): Core\DB->runQuery()
#1 /var/www/POS/api/utils/QueryBuilder.php(466): Core\DB->insert()
#2 /var/www/POS/api/services/QuotationsProcessor.php(720): Core\QueryBuilder->insert()
#3 /var/www/POS/api/services/QuotationsProcessor.php(301): App\Services\QuotationsProcessor::createJournalEntry()
#4 [internal function]: App\Services\QuotationsProcessor::processQuotationSubmission()
#5 /var/www/POS/api/services/workflow_steps/CustomFunctionStep.php(121): call_user_func_array()
#6 /var/www/POS/api/services/WorkflowEngine.php(507): App\Services\WorkflowSteps\CustomFunctionStep->execute()
#7 /var/www/POS/api/services/WorkflowEngine.php(766): App\Services\WorkflowEngine->executeStep()
#8 /var/www/POS/api/services/WorkflowEngine.php(143): App\Services\WorkflowEngine->runSteps()
#9 /var/www/POS/api/services/WorkflowEngine.php(176): App\Services\WorkflowEngine->handleEvent()
#10 /var/www/POS/api/services/WorkflowEngine.php(188): App\Services\WorkflowEngine->emit()
#11 /var/www/POS/api/controllers/GenericController.php(373): App\Services\WorkflowEngine::trigger()
#12 /var/www/POS/api/controllers/SyncController.php(202): App\Controllers\GenericController->processWorkflowEvents()
#13 /var/www/POS/api/controllers/SyncController.php(214): App\Controllers\GenericController@anonymous->exec()
#14 /var/www/POS/api/controllers/SyncController.php(1321): App\Controllers\SyncController->triggerWorkflow()
#15 /var/www/POS/api/router.php(226): App\Controllers\SyncController->push()
#16 /var/www/POS/api/index.php(32): require_once('...')
#17 {main}
[2026-04-06 02:42:40] [WARN] WARNING: Journal entry creation failed: SQL Error: SQLSTATE[23502]: Not null violation: 7 ERROR:  null value in column "org_id" of relation "gl_account_balances" violates not-null constraint
DETAIL:  Failing row contains (019d60a7-6474-789d-8135-f05f6315c766, null, 2250.00, 0.00, 2250.00, 2026-04-06 02:42:40.425811+00, 2026-04-06, 1, 2026-04-06 02:42:40.425811+00, 2026-04-06 02:42:40.425811+00, 019d60ab-baac-73a1-98d7-0b4162a84410).
CONTEXT:  SQL statement "INSERT INTO gl_account_balances (
        account_id,
        org_id,
        total_debits,
        total_credits,
        current_balance,
        last_updated,
        last_entry_date,
        transaction_count,
        updated_at
    ) VALUES (
        v_account_id,
        v_org_id,
        v_total_debits,
        v_total_credits,
        v_new_balance,
        CURRENT_TIMESTAMP,
        v_last_entry_date,
        v_transaction_count,
        CURRENT_TIMESTAMP
    )
    ON CONFLICT (account_id, org_id) DO UPDATE SET
        total_debits = EXCLUDED.total_debits,
        total_credits = EXCLUDED.total_credits,
        current_balance = EXCLUDED.current_balance,
        last_updated = EXCLUDED.last_updated,
        last_entry_date = EXCLUDED.last_entry_date,
        transaction_count = EXCLUDED.transaction_count,
        updated_at = EXCLUDED.updated_at"
PL/pgSQL function update_account_balance() line 49 at SQL statement | Query: INSERT INTO "gl_journal_lines" ("id", "journal_entry_id", "account_id", "memo", "debit", "credit", "org_id") VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING id
[2026-04-06 02:42:40] [DEBUG] STEP 9: Checking if TaxCore integration is enabled
[2026-04-06 02:42:40] [DEBUG] Checking TaxCore integration status for org_id: 019c6fa4-12e6-7bda-e3b6-3340a31436d2 (table: quotations)
[2026-04-06 02:42:40] [INFO] TIN found, TaxCore could be enabled but no explicit setting - defaulting to false for safety
[2026-04-06 02:42:40] [INFO] No TaxCore configuration found for org_id: 019c6fa4-12e6-7bda-e3b6-3340a31436d2, defaulting to disabled
[2026-04-06 02:42:40] [INFO] TaxCore integration enabled: NO
[2026-04-06 02:42:40] [INFO] TaxCore integration is disabled - skipping TaxCore submission
[2026-04-06 02:42:40] [INFO] TaxCore call completed successfully
[2026-04-06 02:42:40] [INFO] TaxCore response: {
    "skipped": true,
    "reason": "TaxCore integration disabled for this organization",
    "invoiceNumber": null
}
[2026-04-06 02:42:40] [DEBUG] STEP 10: Updating quotations record with TaxCore and Journal Entry details
[2026-04-06 02:42:40] [DEBUG] Update data prepared: {"quotation_id":"000019d6-0abb-73d7-ea0a-b17b7e6a7155"}
[2026-04-06 02:42:40] [INFO] Quotations record updated successfully
[2026-04-06 02:42:40] [INFO] Skipping sales_receipts insert - TaxCore disabled or submission failed
[2026-04-06 02:42:40] [DEBUG] STEP 12: Saving audit file to storage
[2026-04-06 02:42:40] [DEBUG] Storage file path: /var/www/POS/storage/quotations/quotation_000019d6-0abb-73d7-ea0a-b17b7e6a7155_2026-04-06_02-42-40.json
[2026-04-06 02:42:40] [INFO] Audit file saved successfully to: /var/www/POS/storage/quotations/quotation_000019d6-0abb-73d7-ea0a-b17b7e6a7155_2026-04-06_02-42-40.json
[2026-04-06 02:42:40] [DEBUG] STEP 13: Preparing final result
[2026-04-06 02:42:40] [INFO] ========== SUCCESS: Process completed ==========
[2026-04-06 02:42:40] [INFO] Final result: {"success":true,"message":"Quotations processed successfully (TaxCore disabled)","record_id":"000019d6-0abb-73d7-ea0a-b17b7e6a7155","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-04-06 02:42:40","saved_to":"\/var\/www\/POS\/storage\/quotations\/quotation_000019d6-0abb-73d7-ea0a-b17b7e6a7155_2026-04-06_02-42-40.json","log_file":"\/var\/www\/POS\/storage\/quotations\/logs\/quotation_000019d6-0abb-73d7-ea0a-b17b7e6a7155_2026-04-06_02-42-40.log"}
[2026-04-06 02:42:40] [INFO] ===========================================
[2026-04-06 02:42:40] [INFO] Quotations Processor Log
[2026-04-06 02:42:40] [INFO] Record ID: 000019d6-0abb-73d7-ea0a-b17b7e6a7155
[2026-04-06 02:42:40] [INFO] Table: quotations
[2026-04-06 02:42:40] [INFO] Timestamp: 2026-04-06 02:42:40
[2026-04-06 02:42:40] [INFO] ===========================================
[2026-04-06 02:42:40] [INFO] ========== START: processQuotationSubmission ==========
[2026-04-06 02:42:40] [INFO] Function called for record ID: 000019d6-0abb-73d7-ea0a-b17b7e6a7155
[2026-04-06 02:42:40] [DEBUG] Form data received: {"table":"quotations","tenant_id":"019c6fa4-12e6-7bda-e3b6-3340a31436d2"}
[2026-04-06 02:42:40] [INFO] Detected table: quotations (Type: proforma)
[2026-04-06 02:42:40] [DEBUG] ID field: quotation_id, Number field: quotation_number
[2026-04-06 02:42:40] [DEBUG] STEP 1: Fetching quotation data from database
[2026-04-06 02:42:40] [DEBUG] QueryBuilder instance created
[2026-04-06 02:42:40] [DEBUG] Database query executed for quotation_id: 000019d6-0abb-73d7-ea0a-b17b7e6a7155
[2026-04-06 02:42:40] [DEBUG] Quotation found successfully
[2026-04-06 02:42:40] [INFO] quotation_type from record overrides invoiceType: proforma
[2026-04-06 02:42:40] [DEBUG] Using org_id: 019c6fa4-12e6-7bda-e3b6-3340a31436d2
[2026-04-06 02:42:40] [INFO] Fetched quotation data: {"quotation_id":"000019d6-0abb-73d7-ea0a-b17b7e6a7155","quotation_number":"00006","date":"2026-04-06","customer_id":"000019d6-0a75-7dfc-d10e-e9c406bb7f61","org_id":"019c6fa4-12e6-7bda-e3b6-3340a31436d2","client_id":null,"line_items":"{\"row_0\": {\"quantity\": \"1\", \"vat_rate\": \"VIP\", \"line_total\": \"430\", \"product_id\": \"000019c6-fa96-7b3f-9359-8ac2da0c5bd8\", \"unit_price\": \"430\", \"vat_amount\": \"47.78\", \"description\": \"Room number 101\", \"line_subtotal\": \"430\"}, \"row_1\": {\"quantity\": \"1\", \"vat_rate\": \"VIP\", \"line_total\": \"160\", \"product_id\": \"000019c6-ffb8-753d-b746-95f4584112b1\", \"unit_price\": \"160.00\", \"vat_amount\": \"17.78\", \"description\": \"Room 102\", \"line_subtotal\": \"160\"}, \"row_2\": {\"quantity\": \"1\", \"vat_rate\": \"VIP\", \"line_total\": \"200\", \"product_id\": \"000019c6-ffc2-7e03-06e6-84afc7b3f6db\", \"unit_price\": \"200\", \"vat_amount\": \"22.22\", \"description\": \"deluxe room\", \"line_subtotal\": \"200\"}, \"row_3\": {\"quantity\": \"1\", \"vat_rate\": \"VIP\", \"line_total\": \"200\", \"product_id\": \"000019c6-ffc7-741b-5ac1-b20a6c71e996\", \"unit_price\": \"200\", \"vat_amount\": \"22.22\", \"description\": \"deluxe room\", \"line_subtotal\": \"200\"}, \"row_4\": {\"quantity\": \"1\", \"vat_rate\": \"VIP\", \"line_total\": \"160\", \"product_id\": \"000019c6-ffdb-720b-e18b-943ffe420edd\", \"unit_price\": \"160.00\", \"vat_amount\": \"17.78\", \"description\": \"Superior room\", \"line_subtotal\": \"160\"}, \"row_5\": {\"quantity\": \"1\", \"vat_rate\": \"VIP\", \"line_total\": \"300\", \"product_id\": \"000019c6-ffe8-7c1b-092a-79e36d3c4ec0\", \"unit_price\": \"300.00\", \"vat_amount\": \"33.33\", \"description\": \"dormitory\", \"line_subtotal\": \"300\"}, \"row_6\": {\"quantity\": \"1\", \"vat_rate\": \"VIP\", \"line_total\": \"200\", \"product_id\": \"000019c6-ffee-7ccb-ac36-4e9f44a83c12\", \"unit_price\": \"200.00\", \"vat_amount\": \"22.22\", \"description\": \"Standard Double room\", \"line_subtotal\": \"200\"}, \"row_7\": {\"quantity\": \"1\", \"vat_rate\": \"VIP\", \"line_total\": \"200\", \"product_id\": \"000019c6-fff3-7c3b-e7e9-14008422c965\", \"unit_price\": \"200.00\", \"vat_amount\": \"22.22\", \"description\": \"Standard Double room\", \"line_subtotal\": \"200\"}, \"row_8\": {\"quantity\": \"1\", \"vat_rate\": \"0\", \"line_total\": \"150\", \"product_id\": \"000019c6-fffa-73db-4b8b-207fc68bb280\", \"unit_price\": \"150\", \"vat_amount\": \"0\", \"description\": \"Day room\", \"line_subtotal\": \"150\"}}","note":null,"terms":null,"validity_days":30,"status":"draft","total_amount":"2000.00","tax_amount":"205.55","template_id":null,"sent_at":null,"expires_at":"2026-04-30","accepted_at":null,"rejected_at":null,"rejection_reason":null,"converted_invoice_id":null,"created_by":null,"updated_by":null,"isdeleted":false,"updatedat":"2026-04-06 02:42:40.429967+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":"MAY 22ND 2026.","notes_additional":"THIS IS THE WHOLE HOTEL ROOMS .ONCE YOU BOOK ALL THIS ROOMS YOU CAN USE THE HOTEL PREMISES FOR YOUR PARTY AND EVENT FOR FREE.,,THESE ROOMS CAN CATER FOR THE NUMBER YOU QUOTED...","payment_terms_details":"WE HAVE OUR RESTUARANT AND TRANSPORT SERVICES ,,,WE CAN DISCUSS DURING BOOKING CONFIRMATION....","quotation_type":"proforma"}
[2026-04-06 02:42:40] [DEBUG] STEP 2: Parsing line_items JSON
[2026-04-06 02:42:40] [DEBUG] Parsed 9 line items
[2026-04-06 02:42:40] [DEBUG] Line items: {"row_0":{"quantity":"1","vat_rate":"VIP","line_total":"430","product_id":"000019c6-fa96-7b3f-9359-8ac2da0c5bd8","unit_price":"430","vat_amount":"47.78","description":"Room number 101","line_subtotal":"430"},"row_1":{"quantity":"1","vat_rate":"VIP","line_total":"160","product_id":"000019c6-ffb8-753d-b746-95f4584112b1","unit_price":"160.00","vat_amount":"17.78","description":"Room 102","line_subtotal":"160"},"row_2":{"quantity":"1","vat_rate":"VIP","line_total":"200","product_id":"000019c6-ffc2-7e03-06e6-84afc7b3f6db","unit_price":"200","vat_amount":"22.22","description":"deluxe room","line_subtotal":"200"},"row_3":{"quantity":"1","vat_rate":"VIP","line_total":"200","product_id":"000019c6-ffc7-741b-5ac1-b20a6c71e996","unit_price":"200","vat_amount":"22.22","description":"deluxe room","line_subtotal":"200"},"row_4":{"quantity":"1","vat_rate":"VIP","line_total":"160","product_id":"000019c6-ffdb-720b-e18b-943ffe420edd","unit_price":"160.00","vat_amount":"17.78","description":"Superior room","line_subtotal":"160"},"row_5":{"quantity":"1","vat_rate":"VIP","line_total":"300","product_id":"000019c6-ffe8-7c1b-092a-79e36d3c4ec0","unit_price":"300.00","vat_amount":"33.33","description":"dormitory","line_subtotal":"300"},"row_6":{"quantity":"1","vat_rate":"VIP","line_total":"200","product_id":"000019c6-ffee-7ccb-ac36-4e9f44a83c12","unit_price":"200.00","vat_amount":"22.22","description":"Standard Double room","line_subtotal":"200"},"row_7":{"quantity":"1","vat_rate":"VIP","line_total":"200","product_id":"000019c6-fff3-7c3b-e7e9-14008422c965","unit_price":"200.00","vat_amount":"22.22","description":"Standard Double room","line_subtotal":"200"},"row_8":{"quantity":"1","vat_rate":"0","line_total":"150","product_id":"000019c6-fffa-73db-4b8b-207fc68bb280","unit_price":"150","vat_amount":"0","description":"Day room","line_subtotal":"150"}}
[2026-04-06 02:42:40] [DEBUG] STEP 3: Preparing items for TaxCore
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_0 -> {"quantity":"1","vat_rate":"VIP","line_total":"430","product_id":"000019c6-fa96-7b3f-9359-8ac2da0c5bd8","unit_price":"430","vat_amount":"47.78","description":"Room number 101","line_subtotal":"430"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 430, TotalAmount: 430
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_1 -> {"quantity":"1","vat_rate":"VIP","line_total":"160","product_id":"000019c6-ffb8-753d-b746-95f4584112b1","unit_price":"160.00","vat_amount":"17.78","description":"Room 102","line_subtotal":"160"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 160, TotalAmount: 160
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_2 -> {"quantity":"1","vat_rate":"VIP","line_total":"200","product_id":"000019c6-ffc2-7e03-06e6-84afc7b3f6db","unit_price":"200","vat_amount":"22.22","description":"deluxe room","line_subtotal":"200"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 200, TotalAmount: 200
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_3 -> {"quantity":"1","vat_rate":"VIP","line_total":"200","product_id":"000019c6-ffc7-741b-5ac1-b20a6c71e996","unit_price":"200","vat_amount":"22.22","description":"deluxe room","line_subtotal":"200"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 200, TotalAmount: 200
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_4 -> {"quantity":"1","vat_rate":"VIP","line_total":"160","product_id":"000019c6-ffdb-720b-e18b-943ffe420edd","unit_price":"160.00","vat_amount":"17.78","description":"Superior room","line_subtotal":"160"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 160, TotalAmount: 160
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_5 -> {"quantity":"1","vat_rate":"VIP","line_total":"300","product_id":"000019c6-ffe8-7c1b-092a-79e36d3c4ec0","unit_price":"300.00","vat_amount":"33.33","description":"dormitory","line_subtotal":"300"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 300, TotalAmount: 300
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_6 -> {"quantity":"1","vat_rate":"VIP","line_total":"200","product_id":"000019c6-ffee-7ccb-ac36-4e9f44a83c12","unit_price":"200.00","vat_amount":"22.22","description":"Standard Double room","line_subtotal":"200"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 200, TotalAmount: 200
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_7 -> {"quantity":"1","vat_rate":"VIP","line_total":"200","product_id":"000019c6-fff3-7c3b-e7e9-14008422c965","unit_price":"200.00","vat_amount":"22.22","description":"Standard Double room","line_subtotal":"200"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 200, TotalAmount: 200
[2026-04-06 02:42:40] [DEBUG] Processing line item: row_8 -> {"quantity":"1","vat_rate":"0","line_total":"150","product_id":"000019c6-fffa-73db-4b8b-207fc68bb280","unit_price":"150","vat_amount":"0","description":"Day room","line_subtotal":"150"}
[2026-04-06 02:42:40] [DEBUG] Calculated - Quantity: 1, UnitPrice: 150, TotalAmount: 150
[2026-04-06 02:42:40] [DEBUG] Prepared 9 items for TaxCore
[2026-04-06 02:42:40] [INFO] TaxCore items: [{"name":"Room number 101","quantity":1,"unitPrice":"430.00","totalAmount":"430.00","Labels":["G"]},{"name":"Room 102","quantity":1,"unitPrice":"160.00","totalAmount":"160.00","Labels":["G"]},{"name":"deluxe room","quantity":1,"unitPrice":"200.00","totalAmount":"200.00","Labels":["G"]},{"name":"deluxe room","quantity":1,"unitPrice":"200.00","totalAmount":"200.00","Labels":["G"]},{"name":"Superior room","quantity":1,"unitPrice":"160.00","totalAmount":"160.00","Labels":["G"]},{"name":"dormitory","quantity":1,"unitPrice":"300.00","totalAmount":"300.00","Labels":["G"]},{"name":"Standard Double room","quantity":1,"unitPrice":"200.00","totalAmount":"200.00","Labels":["G"]},{"name":"Standard Double room","quantity":1,"unitPrice":"200.00","totalAmount":"200.00","Labels":["G"]},{"name":"Day room","quantity":1,"unitPrice":"150.00","totalAmount":"150.00","Labels":["G"]}]
[2026-04-06 02:42:40] [DEBUG] STEP 4: Preparing payment method as Credit
[2026-04-06 02:42:40] [INFO] Payment prepared (Credit): [{"paymentType":"0","amount":2000}]
[2026-04-06 02:42:40] [DEBUG] STEP 5: Fetching cashier information
[2026-04-06 02:42:40] [DEBUG] User ID from formData: 019c6fa4-12e6-7bda-e3b6-3340a31436d2
[2026-04-06 02:42:40] [DEBUG] Querying users table for user_id: 019c6fa4-12e6-7bda-e3b6-3340a31436d2
[2026-04-06 02:42:40] [INFO] Cashier name found: System
[2026-04-06 02:42:40] [DEBUG] STEP 6: Building TaxCore payload
[2026-04-06 02:42:40] [DEBUG] Base payload created with type=proforma
[2026-04-06 02:42:40] [DEBUG] STEP 7: Adding customer/buyer information
[2026-04-06 02:42:40] [DEBUG] Customer ID found: 000019d6-0a75-7dfc-d10e-e9c406bb7f61
[2026-04-06 02:42:40] [DEBUG] Customer found: {"name":"1 YEAR BIRTHDAY PARTY","tin":null}
[2026-04-06 02:42:40] [INFO] TaxCore payload prepared: {
    "items": [
        {
            "name": "Room number 101",
            "quantity": 1,
            "unitPrice": "430.00",
            "totalAmount": "430.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Room 102",
            "quantity": 1,
            "unitPrice": "160.00",
            "totalAmount": "160.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "deluxe room",
            "quantity": 1,
            "unitPrice": "200.00",
            "totalAmount": "200.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "deluxe room",
            "quantity": 1,
            "unitPrice": "200.00",
            "totalAmount": "200.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Superior room",
            "quantity": 1,
            "unitPrice": "160.00",
            "totalAmount": "160.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "dormitory",
            "quantity": 1,
            "unitPrice": "300.00",
            "totalAmount": "300.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Standard Double room",
            "quantity": 1,
            "unitPrice": "200.00",
            "totalAmount": "200.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Standard Double room",
            "quantity": 1,
            "unitPrice": "200.00",
            "totalAmount": "200.00",
            "Labels": [
                "G"
            ]
        },
        {
            "name": "Day room",
            "quantity": 1,
            "unitPrice": "150.00",
            "totalAmount": "150.00",
            "Labels": [
                "G"
            ]
        }
    ],
    "payment": [
        {
            "paymentType": "0",
            "amount": 2000
        }
    ],
    "Cashier": "System",
    "type": "proforma",
    "invoiceNumber": "00006",
    "Buyer": {
        "Name": "1 YEAR BIRTHDAY PARTY"
    }
}
[2026-04-06 02:42:40] [DEBUG] STEP 8: Creating Journal Entry in Finance module
[2026-04-06 02:42:40] [INFO] --- createJournalEntry: Starting ---
[2026-04-06 02:42:40] [INFO] Is Cancelled/Refund: NO
[2026-04-06 02:42:40] [DEBUG] Calculated totals - Subtotal: 2000, Tax: 250, Total: 2250
[2026-04-06 02:42:40] [DEBUG] Looking for customer-specific AR account for: 1 YEAR BIRTHDAY PARTY
[2026-04-06 02:42:40] [INFO] Found customer-specific AR account: 1300-015 - AR - 1 YEAR BIRTHDAY PARTY
[2026-04-06 02:42:40] [DEBUG] Found GL accounts - Revenue: 4000, Tax: 2410, Receivables: 1300-015 (AR - 1 YEAR BIRTHDAY PARTY)
[2026-04-06 02:42:40] [DEBUG] Journal entry header prepared: {"id":"959dcf48-99d8-4974-906f-0f879d14d2b2","entry_date":"2026-04-06","description":"Quotation 00006","reference":"00006","source_module":"quotations","source_id":"000019d6-0abb-73d7-ea0a-b17b7e6a7155","total_debits":2250,"total_credits":2250,"status":"posted","is_balanced":true,"created_by":null,"org_id":null,"posted_at":"2026-04-06 02:42:40","posted_by":null}
[2026-04-06 02:42:40] [ERROR] ERROR creating journal entry: SQL Error: SQLSTATE[23505]: Unique violation: 7 ERROR:  duplicate key value violates unique constraint "idx_journal_entries_unique_source"
DETAIL:  Key (source_module, source_id)=(quotations, 000019d6-0abb-73d7-ea0a-b17b7e6a7155) already exists. | Query: INSERT INTO "gl_journal_entries" ("id", "entry_date", "description", "reference", "source_module", "source_id", "total_debits", "total_credits", "status", "is_balanced", "created_by", "org_id", "posted_at", "posted_by", "branch_id") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id
[2026-04-06 02:42:40] [ERROR] Stack trace: #0 /var/www/POS/api/utils/DB.php(231): Core\DB->runQuery()
#1 /var/www/POS/api/utils/QueryBuilder.php(466): Core\DB->insert()
#2 /var/www/POS/api/services/QuotationsProcessor.php(640): Core\QueryBuilder->insert()
#3 /var/www/POS/api/services/QuotationsProcessor.php(301): App\Services\QuotationsProcessor::createJournalEntry()
#4 [internal function]: App\Services\QuotationsProcessor::processQuotationSubmission()
#5 /var/www/POS/api/services/workflow_steps/CustomFunctionStep.php(121): call_user_func_array()
#6 /var/www/POS/api/services/WorkflowEngine.php(507): App\Services\WorkflowSteps\CustomFunctionStep->execute()
#7 /var/www/POS/api/services/WorkflowEngine.php(766): App\Services\WorkflowEngine->executeStep()
#8 /var/www/POS/api/services/WorkflowEngine.php(143): App\Services\WorkflowEngine->runSteps()
#9 /var/www/POS/api/services/WorkflowEngine.php(176): App\Services\WorkflowEngine->handleEvent()
#10 /var/www/POS/api/services/WorkflowEngine.php(188): App\Services\WorkflowEngine->emit()
#11 /var/www/POS/api/controllers/GenericController.php(373): App\Services\WorkflowEngine::trigger()
#12 /var/www/POS/api/controllers/SyncController.php(202): App\Controllers\GenericController->processWorkflowEvents()
#13 /var/www/POS/api/controllers/SyncController.php(214): App\Controllers\GenericController@anonymous->exec()
#14 /var/www/POS/api/controllers/SyncController.php(1321): App\Controllers\SyncController->triggerWorkflow()
#15 /var/www/POS/api/router.php(226): App\Controllers\SyncController->push()
#16 /var/www/POS/api/index.php(32): require_once('...')
#17 {main}
[2026-04-06 02:42:40] [WARN] WARNING: Journal entry creation failed: SQL Error: SQLSTATE[23505]: Unique violation: 7 ERROR:  duplicate key value violates unique constraint "idx_journal_entries_unique_source"
DETAIL:  Key (source_module, source_id)=(quotations, 000019d6-0abb-73d7-ea0a-b17b7e6a7155) already exists. | Query: INSERT INTO "gl_journal_entries" ("id", "entry_date", "description", "reference", "source_module", "source_id", "total_debits", "total_credits", "status", "is_balanced", "created_by", "org_id", "posted_at", "posted_by", "branch_id") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id
[2026-04-06 02:42:40] [DEBUG] STEP 9: Checking if TaxCore integration is enabled
[2026-04-06 02:42:40] [DEBUG] Checking TaxCore integration status for org_id: 019c6fa4-12e6-7bda-e3b6-3340a31436d2 (table: quotations)
[2026-04-06 02:42:40] [INFO] TIN found, TaxCore could be enabled but no explicit setting - defaulting to false for safety
[2026-04-06 02:42:40] [INFO] No TaxCore configuration found for org_id: 019c6fa4-12e6-7bda-e3b6-3340a31436d2, defaulting to disabled
[2026-04-06 02:42:40] [INFO] TaxCore integration enabled: NO
[2026-04-06 02:42:40] [INFO] TaxCore integration is disabled - skipping TaxCore submission
[2026-04-06 02:42:40] [INFO] TaxCore call completed successfully
[2026-04-06 02:42:40] [INFO] TaxCore response: {
    "skipped": true,
    "reason": "TaxCore integration disabled for this organization",
    "invoiceNumber": null
}
[2026-04-06 02:42:40] [DEBUG] STEP 10: Updating quotations record with TaxCore and Journal Entry details
[2026-04-06 02:42:40] [DEBUG] Update data prepared: {"quotation_id":"000019d6-0abb-73d7-ea0a-b17b7e6a7155"}
[2026-04-06 02:42:40] [INFO] Quotations record updated successfully
[2026-04-06 02:42:40] [INFO] Skipping sales_receipts insert - TaxCore disabled or submission failed
[2026-04-06 02:42:40] [DEBUG] STEP 12: Saving audit file to storage
[2026-04-06 02:42:40] [DEBUG] Storage file path: /var/www/POS/storage/quotations/quotation_000019d6-0abb-73d7-ea0a-b17b7e6a7155_2026-04-06_02-42-40.json
[2026-04-06 02:42:40] [INFO] Audit file saved successfully to: /var/www/POS/storage/quotations/quotation_000019d6-0abb-73d7-ea0a-b17b7e6a7155_2026-04-06_02-42-40.json
[2026-04-06 02:42:40] [DEBUG] STEP 13: Preparing final result
[2026-04-06 02:42:40] [INFO] ========== SUCCESS: Process completed ==========
[2026-04-06 02:42:40] [INFO] Final result: {"success":true,"message":"Quotations processed successfully (TaxCore disabled)","record_id":"000019d6-0abb-73d7-ea0a-b17b7e6a7155","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-04-06 02:42:40","saved_to":"\/var\/www\/POS\/storage\/quotations\/quotation_000019d6-0abb-73d7-ea0a-b17b7e6a7155_2026-04-06_02-42-40.json","log_file":"\/var\/www\/POS\/storage\/quotations\/logs\/quotation_000019d6-0abb-73d7-ea0a-b17b7e6a7155_2026-04-06_02-42-40.log"}
