[2026-06-30 15:19:23] live.INFO: Original end_date from request: 30/06/2026  
[2026-06-30 15:19:23] live.INFO: Date converted manually from DD/MM/YYYY to: 2026-06-30  
[2026-06-30 15:19:23] live.INFO: Final parameters - Date: 2026-06-30, Location: null, Business: 1  
[2026-06-30 15:19:23] live.INFO: === SALES BREAKDOWN METHOD START ===  
[2026-06-30 15:19:23] live.INFO: Parameters - Business ID: 1, Date: 2026-06-30, Location: null  
[2026-06-30 15:19:23] live.INFO: Base query built for business 1, date 2026-06-30  
[2026-06-30 15:19:23] live.INFO: Final SQL query: select * from `transactions` where `business_id` = ? and `type` = ? and `status` = ? and date(`transaction_date`) = ?  
[2026-06-30 15:19:23] live.INFO: Query bindings: ["1","sell","final","2026-06-30"]  
[2026-06-30 15:19:23] live.INFO: Total transactions found: 24  
[2026-06-30 15:19:23] live.INFO: Today's sales for date 2026-06-30: 14945.8000  
[2026-06-30 15:19:23] live.INFO: Raw SQL result: {"count":"24","subtotal":"14945.8000","tax":"0.0000","discount":"0.0000","total":"14945.8000","paid_amount":"14945.8000","due_amount":"0.0000","partial_amount":"0.0000"}  
[2026-06-30 15:19:23] live.INFO: Final processed result: {"count":24,"subtotal":14945.8,"tax":0,"discount":0,"total":14945.8,"paid_amount":14945.8,"due_amount":0,"partial_amount":0}  
[2026-06-30 15:19:23] live.INFO: === SALES BREAKDOWN METHOD END ===  
[2026-06-30 15:19:23] live.INFO: Today's purchases for date 2026-06-30: 0  
[2026-06-30 15:19:23] live.INFO: Today's expenses for date 2026-06-30: 0  
[2026-06-30 15:19:23] live.INFO: === CALCULATING CASH IN HAND FOR DATE: 2026-06-30 ===  
[2026-06-30 15:19:23] live.INFO: Cash in hand calculated for 2026-06-30: 210405.7000  
[2026-06-30 15:19:23] live.INFO: === CALCULATING BANK BALANCE FOR DATE: 2026-06-30 ===  
[2026-06-30 15:19:23] live.INFO: Bank balance calculated for 2026-06-30: 1460.0000  
[2026-06-30 15:19:23] live.INFO: === GETTING MONTHLY CASH BREAKDOWN UP TO DATE: 2026-06-30 ===  
[2026-06-30 15:19:23] live.INFO: Today's collections for date 2026-06-30: 14945.8000  
[2026-06-30 15:19:23] live.INFO: Monthly cash breakdown calculated: [{"month":"2026-06","month_name":"June 2026","transaction_count":391,"net_cash_flow":210405.7,"running_total":210405.7}] 
[2026-06-30 15:19:23] live.INFO: Calculating opening balance for date 2026-06-30, using previous date: 2026-06-29  
[2026-06-30 15:19:23] live.INFO: === CALCULATING CASH IN HAND FOR DATE: 2026-06-29 ===  
[2026-06-30 15:19:23] live.INFO: Cash in hand calculated for 2026-06-29: 195459.9000  
[2026-06-30 15:19:23] live.INFO: === CALCULATING BANK BALANCE FOR DATE: 2026-06-29 ===  
[2026-06-30 15:19:23] live.INFO: Bank balance calculated for 2026-06-29: 1460.0000  
[2026-06-30 15:19:23] live.INFO: === DAILY REPORT DEBUG END ===  
[2026-06-30 15:20:55] live.INFO: Getting customer details {"customer_id":"1","year":"2026"} 
[2026-06-30 15:20:55] live.INFO: Found transactions {"count":50} 
[2026-06-30 15:21:58] live.INFO: getProfitAnalysis called with params: {"draw":"1","columns":[{"data":"product","name":"product","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"quantity","name":"quantity","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"revenue","name":"revenue","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"cost","name":"cost","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"profit","name":"profit","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"margin","name":"margin","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"action","name":"action","searchable":"false","orderable":"false","search":{"value":null,"regex":"false"}}],"order":[{"column":"0","dir":"asc"}],"start":"0","length":"25","search":{"value":null,"regex":"false"},"type":"product","_":"1782813117971"}  
[2026-06-30 15:21:58] live.INFO: Analysis type: product, Business ID: 1  
[2026-06-30 15:21:58] live.INFO: getProfitAnalysis called with params: {"draw":"1","columns":[{"data":"customer","name":"customer","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"orders_count","name":"orders_count","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"revenue","name":"revenue","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"cost","name":"cost","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"profit","name":"profit","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"margin","name":"margin","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"avg_order_value","name":"avg_order_value","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}}],"order":[{"column":"0","dir":"asc"}],"start":"0","length":"25","search":{"value":null,"regex":"false"},"type":"customer","_":"1782813117974"}  
[2026-06-30 15:21:58] live.INFO: getProfitAnalysis called with params: {"draw":"1","columns":[{"data":"category","name":"category","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"products_count","name":"products_count","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"revenue","name":"revenue","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"cost","name":"cost","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"profit","name":"profit","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"margin","name":"margin","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"contribution","name":"contribution","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}}],"order":[{"column":"0","dir":"asc"}],"start":"0","length":"25","search":{"value":null,"regex":"false"},"type":"category","_":"1782813117972"}  
[2026-06-30 15:21:58] live.INFO: getProfitAnalysis called with params: {"draw":"1","columns":[{"data":"brand","name":"brand","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"products_count","name":"products_count","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"revenue","name":"revenue","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"cost","name":"cost","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"profit","name":"profit","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"margin","name":"margin","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"market_share","name":"market_share","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}}],"order":[{"column":"0","dir":"asc"}],"start":"0","length":"25","search":{"value":null,"regex":"false"},"type":"brand","_":"1782813117973"}  
[2026-06-30 15:21:58] live.INFO: getProfitAnalysis called with params: {"draw":"1","columns":[{"data":"location","name":"location","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"transactions_count","name":"transactions_count","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"revenue","name":"revenue","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"cost","name":"cost","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"profit","name":"profit","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"margin","name":"margin","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"performance","name":"performance","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}}],"order":[{"column":"0","dir":"asc"}],"start":"0","length":"25","search":{"value":null,"regex":"false"},"type":"location","_":"1782813117975"}  
[2026-06-30 15:21:58] live.INFO: Analysis type: customer, Business ID: 1  
[2026-06-30 15:21:58] live.INFO: Analysis type: location, Business ID: 1  
[2026-06-30 15:21:58] live.INFO: Analysis type: category, Business ID: 1  
[2026-06-30 15:21:58] live.INFO: Analysis type: brand, Business ID: 1  
[2026-06-30 15:21:58] live.INFO: getProfitAnalysis called with params: {"draw":"1","columns":[{"data":"staff","name":"staff","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"sales_count","name":"sales_count","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"revenue","name":"revenue","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"cost","name":"cost","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"profit","name":"profit","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"margin","name":"margin","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"commission","name":"commission","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}}],"order":[{"column":"0","dir":"asc"}],"start":"0","length":"25","search":{"value":null,"regex":"false"},"type":"staff","_":"1782813117976"}  
[2026-06-30 15:21:58] live.INFO: Analysis type: staff, Business ID: 1  
[2026-06-30 15:21:58] live.INFO: getProfitAnalysis called with params: {"draw":"2","columns":[{"data":"product","name":"product","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"quantity","name":"quantity","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"revenue","name":"revenue","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"cost","name":"cost","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"profit","name":"profit","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"margin","name":"margin","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"action","name":"action","searchable":"false","orderable":"false","search":{"value":null,"regex":"false"}}],"order":[{"column":"0","dir":"asc"}],"start":"0","length":"25","search":{"value":null,"regex":"false"},"start_date":"2026-06-01","end_date":"2026-06-30","location_id":null,"customer_id":null,"type":"product","_":"1782813117978"}  
[2026-06-30 15:21:58] live.INFO: Analysis type: product, Business ID: 1  
[2026-06-30 15:21:58] live.INFO: getProfitAnalysis called with params: {"draw":"1","columns":[{"data":"invoice_no","name":"invoice_no","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"transaction_date","name":"transaction_date","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"customer_name","name":"customer_name","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"location_name","name":"location_name","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"revenue","name":"revenue","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"cost","name":"cost","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"profit","name":"profit","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"margin","name":"margin","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"payment_status","name":"payment_status","searchable":"true","orderable":"true","search":{"value":null,"regex":"false"}},{"data":"action","name":"action","searchable":"false","orderable":"false","search":{"value":null,"regex":"false"}}],"order":[{"column":"1","dir":"desc"}],"start":"0","length":"25","search":{"value":null,"regex":"false"},"type":"invoice","_":"1782813117977"}  
[2026-06-30 15:21:58] live.INFO: Analysis type: invoice, Business ID: 1  
