diff --git a/assets/pasted-20260221-173518-a5e18486.png b/assets/pasted-20260221-173518-a5e18486.png new file mode 100644 index 0000000..bf839d9 Binary files /dev/null and b/assets/pasted-20260221-173518-a5e18486.png differ diff --git a/db/migrations/20260221_fix_invoice_items_columns.sql b/db/migrations/20260221_fix_invoice_items_columns.sql new file mode 100644 index 0000000..414ebd0 --- /dev/null +++ b/db/migrations/20260221_fix_invoice_items_columns.sql @@ -0,0 +1,4 @@ +-- Fix missing columns in invoice_items table +-- Date: 2026-02-21 + +ALTER TABLE invoice_items ADD COLUMN IF NOT EXISTS vat_amount DECIMAL(15,3) DEFAULT 0.000 AFTER unit_price; diff --git a/db/migrations/20260221_fix_pos_invoices_columns.sql b/db/migrations/20260221_fix_pos_invoices_columns.sql new file mode 100644 index 0000000..89cbf48 --- /dev/null +++ b/db/migrations/20260221_fix_pos_invoices_columns.sql @@ -0,0 +1,14 @@ +-- Fix missing columns in invoices table for POS transactions +-- Date: 2026-02-21 + +ALTER TABLE invoices ADD COLUMN IF NOT EXISTS transaction_no VARCHAR(50) DEFAULT NULL AFTER id; +ALTER TABLE invoices ADD COLUMN IF NOT EXISTS register_session_id INT(11) DEFAULT NULL; +ALTER TABLE invoices ADD COLUMN IF NOT EXISTS is_pos TINYINT(1) DEFAULT 0; +ALTER TABLE invoices ADD COLUMN IF NOT EXISTS discount_amount DECIMAL(15,3) DEFAULT 0.000; +ALTER TABLE invoices ADD COLUMN IF NOT EXISTS loyalty_points_earned DECIMAL(15,3) DEFAULT 0.000; +ALTER TABLE invoices ADD COLUMN IF NOT EXISTS loyalty_points_redeemed DECIMAL(15,3) DEFAULT 0.000; +ALTER TABLE invoices ADD COLUMN IF NOT EXISTS created_by INT(11) DEFAULT NULL; + +-- Ensure indexes for better performance +ALTER TABLE invoices ADD INDEX IF NOT EXISTS idx_transaction_no (transaction_no); +ALTER TABLE invoices ADD INDEX IF NOT EXISTS idx_register_session (register_session_id); diff --git a/debug.log b/debug.log new file mode 100644 index 0000000..ed20a90 --- /dev/null +++ b/debug.log @@ -0,0 +1,4 @@ +2026-02-21 17:52:10 - Items case hit +2026-02-21 17:52:37 - Items case hit +2026-02-21 17:53:18 - Items case hit +2026-02-21 18:10:28 - Items case hit diff --git a/debug_items.php b/debug_items.php new file mode 100644 index 0000000..f276260 --- /dev/null +++ b/debug_items.php @@ -0,0 +1,17 @@ +prepare("SELECT i.*, c.name_en as cat_en, c.name_ar as cat_ar, u.short_name_en as unit_en, u.short_name_ar as unit_ar, s.name as supplier_name + FROM stock_items i + LEFT JOIN stock_categories c ON i.category_id = c.id + LEFT JOIN stock_units u ON i.unit_id = u.id + LEFT JOIN suppliers s ON i.supplier_id = s.id + WHERE $whereSql + ORDER BY i.id DESC"); +$stmt->execute($params); +$items = $stmt->fetchAll(); +echo "Count: " . count($items) . "\n"; +foreach ($items as $item) { + echo "ID: {$item['id']}, Name: {$item['name_en']}\n"; +} diff --git a/index.php b/index.php index 031fc45..27e37e9 100644 --- a/index.php +++ b/index.php @@ -2468,6 +2468,7 @@ switch ($page) { // Already fetched globally break; case 'items': + file_put_contents('debug.log', date('Y-m-d H:i:s') . " - Items case hit\n", FILE_APPEND); $where = ["1=1"]; $params = []; if (!empty($_GET['search'])) { @@ -3795,8 +3796,8 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System'; - - + + @@ -3900,10 +3901,10 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System'; - - - - + + + +
@@ -4166,7 +4167,7 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System';
-
Stock Items
+
Stock Items ()