diff --git a/assets/pasted-20260219-071453-ee93359e.png b/assets/pasted-20260219-071453-ee93359e.png new file mode 100644 index 0000000..3a9b7fe Binary files /dev/null and b/assets/pasted-20260219-071453-ee93359e.png differ diff --git a/index.php b/index.php index a198369..25eb6bc 100644 --- a/index.php +++ b/index.php @@ -7096,73 +7096,96 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System';
-
- Opening Balance: - OMR -
prepare("SELECT p.payment_method, SUM(p.amount) as total FROM pos_payments p JOIN pos_transactions t ON p.transaction_id = t.id WHERE t.register_session_id = ? AND t.status = 'completed' GROUP BY p.payment_method"); $breakdown->execute([$s['id']]); $methods = $breakdown->fetchAll(); - $total_sales = 0; - foreach ($methods as $m): $total_sales += $m['total']; ?> + + $cash_sales = 0; + $card_sales = 0; + $credit_sales = 0; + $bank_transfer_sales = 0; + + foreach ($methods as $m) { + $method = strtolower($m['payment_method']); + if ($method === 'cash') $cash_sales = $m['total']; + elseif ($method === 'card' || strpos($method, 'card') !== false) $card_sales = $m['total']; + elseif ($method === 'credit') $credit_sales = $m['total']; + elseif (strpos($method, 'transfer') !== false || strpos($method, 'bank') !== false) $bank_transfer_sales = $m['total']; + else $cash_sales += $m['total']; + } + $total_sales = $cash_sales + $card_sales + $credit_sales + $bank_transfer_sales; + $expected_balance = (float)$s['opening_balance'] + $cash_sales; // Usually balance in hand is opening + cash sales + $total_all = (float)$s['opening_balance'] + $total_sales; + ?> +
- Sales (): - OMR + Opening Balance: + OMR
- -
- Total Sales: - OMR +
+ Cash Sales: + OMR
-
-
- Expected Cash in Hand: - OMR +
+ Credit Card Sales: + OMR
-
- Actual Cash in Hand: - OMR +
+ Credit: + OMR
-
- Difference: - OMR +
+ Bank Transfer: + OMR +
+ +
+ Balance (Total): + OMR +
+ +
+
Transaction Details
+
+ + + + + + + + + + + + prepare("SELECT t.*, c.name as customer_name, GROUP_CONCAT(p.payment_method SEPARATOR ', ') as methods FROM pos_transactions t LEFT JOIN pos_payments p ON t.id = p.transaction_id LEFT JOIN customers c ON t.customer_id = c.id WHERE t.register_session_id = ? AND t.status = 'completed' GROUP BY t.id ORDER BY t.created_at DESC"); + $txs_stmt->execute([$s['id']]); + $txs = $txs_stmt->fetchAll(); + foreach ($txs as $tx): + ?> + + + + + + + + + + + +
TimeOrder #CustomerMethodAmount
No transactions
+

-
Detailed Transactions by Method
- prepare("SELECT t.transaction_no, t.created_at, p.amount FROM pos_payments p JOIN pos_transactions t ON p.transaction_id = t.id WHERE t.register_session_id = ? AND t.status = 'completed' AND p.payment_method = ?"); - $details->execute([$s['id'], $m['payment_method']]); - $trans = $details->fetchAll(); - ?> -
-
- - OMR -
- - - - - - - - - - - - - - - - - -
TX #TimeAmount
OMR
+
+
Expected Cash: OMR
+
Actual Cash: OMR
-
@@ -7238,34 +7261,94 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System'; $curBreakdown = db()->prepare("SELECT p.payment_method, SUM(p.amount) as total FROM pos_payments p JOIN pos_transactions t ON p.transaction_id = t.id WHERE t.register_session_id = ? AND t.status = 'completed' GROUP BY p.payment_method"); $curBreakdown->execute([$session['id']]); $curMethods = $curBreakdown->fetchAll(); - $curCashSales = 0; - foreach($curMethods as $cm) if(strtolower($cm['payment_method']) === 'cash') $curCashSales = (float)$cm['total']; + + $cash_sales = 0; + $card_sales = 0; + $credit_sales = 0; + $bank_transfer_sales = 0; + + foreach ($curMethods as $m) { + $method = strtolower($m['payment_method']); + if ($method === 'cash') $cash_sales = $m['total']; + elseif ($method === 'card' || strpos($method, 'card') !== false) $card_sales = $m['total']; + elseif ($method === 'credit') $credit_sales = $m['total']; + elseif (strpos($method, 'transfer') !== false || strpos($method, 'bank') !== false) $bank_transfer_sales = $m['total']; + else $cash_sales += $m['total']; + } + $total_sales = $cash_sales + $card_sales + $credit_sales + $bank_transfer_sales; + $expected_cash = (float)$session['opening_balance'] + $cash_sales; + $total_all = (float)$session['opening_balance'] + $total_sales; ?>
Session Summary
- Opening Cash: + Opening Balance: OMR
Cash Sales: - OMR + OMR +
+
+ Credit Card Sales: + OMR +
+
+ Credit: + OMR +
+
+ Bank Transfer: + OMR

-
- Expected Cash in Hand: - OMR +
+ Balance (Total): + OMR
- - -
- Total: - OMR +
+ Expected Cash: + OMR
-
+ +
+
Transaction Details
+
+ + + + + + + + + + + + prepare("SELECT t.*, c.name as customer_name, GROUP_CONCAT(p.payment_method SEPARATOR ', ') as methods FROM pos_transactions t LEFT JOIN pos_payments p ON t.id = p.transaction_id LEFT JOIN customers c ON t.customer_id = c.id WHERE t.register_session_id = ? AND t.status = 'completed' GROUP BY t.id ORDER BY t.created_at DESC"); + $txs_stmt->execute([$session['id']]); + $txs = $txs_stmt->fetchAll(); + foreach ($txs as $tx): + ?> + + + + + + + + + + + +
TimeOrder #CustomerMethodAmount
No transactions
+
+
+
@@ -9887,11 +9970,15 @@ document.addEventListener('DOMContentLoaded', function() { Card
-
- - Credit -
-
+
+ + Credit +
+
+ + Transfer +
+
diff --git a/post_debug.log b/post_debug.log index 257cce7..2e823a8 100644 --- a/post_debug.log +++ b/post_debug.log @@ -57,3 +57,6 @@ 2026-02-19 06:50:40 - POST: {"name_en":"Tissue","name_ar":"\u0645\u062d\u0627\u0631\u0645 \u0648\u0631\u0642\u064a\u0629","category_id":"2","unit_id":"2","supplier_id":"6","sku":"5673086966938977","sale_price":"0.25","purchase_price":"0.2","stock_quantity":"0.000","min_stock_level":"0.000","vat_rate":"5","expiry_date":"","promotion_start":"","promotion_end":"","promotion_percent":"0.00","add_item":""} 2026-02-19 06:53:36 - POST: {"action":"save_pos_transaction","customer_id":"","payments":"[{\"method\":\"cash\",\"amount\":0.978}]","total_amount":"0.9775","discount_code_id":"","discount_amount":"0","loyalty_redeemed":"0","items":"[{\"id\":1,\"qty\":2,\"price\":0.3825},{\"id\":2,\"qty\":1,\"price\":0.2125}]"} 2026-02-19 07:01:43 - POST: {"name_en":"Tissue","name_ar":"\u0645\u062d\u0627\u0631\u0645 \u0648\u0631\u0642\u064a\u0629","category_id":"2","unit_id":"2","supplier_id":"6","sku":"760115926272","sale_price":"0.25","purchase_price":"0.2","stock_quantity":"5","min_stock_level":"0.000","vat_rate":"5","expiry_date":"","promotion_start":"","promotion_end":"","promotion_percent":"0.00","add_item":""} +2026-02-19 07:02:59 - POST: {"name_en":"Tissue","name_ar":"\u0645\u062d\u0627\u0631\u0645 \u0648\u0631\u0642\u064a\u0629","category_id":"2","unit_id":"2","supplier_id":"6","sku":"760115926272","sale_price":"0.25","purchase_price":"0.2","stock_quantity":"5","min_stock_level":"0.000","vat_rate":"5","expiry_date":"","promotion_start":"","promotion_end":"","promotion_percent":"0.00","add_item":""} +2026-02-19 07:12:25 - POST: {"action":"save_pos_transaction","customer_id":"","payments":"[{\"method\":\"cash\",\"amount\":0.883}]","total_amount":"0.8825000000000001","discount_code_id":"","discount_amount":"0","loyalty_redeemed":"0","items":"[{\"id\":1,\"qty\":1,\"price\":0.3825},{\"id\":3,\"qty\":2,\"price\":0.25}]"} +2026-02-19 07:12:39 - POST: {"close_register":"1","session_id":"3","cash_in_hand":"5","notes":""}