Skip to content

Commit 47c7249

Browse files
committed
Fix PurchaseOrderItem unit_price mapping
1 parent d9b6a9c commit 47c7249

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

deploy/clean_localseed.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,39 +94,34 @@ addMock('sale_order_items',
9494
'`id`, `sale_order_id`, `product_variant_id`, `product_name`, `sku`, `quantity`, `unit_price`, `line_discount_amount`, `line_tax_amount`, `line_total_amount`, `notes`',
9595
"1, 1, 1, 'Mock Product', 'SKU-001', 2, 25000, 0, 0, 50000, ''");
9696

97-
// 2. Purchase Orders
9897
addMock('purchase_orders',
9998
'`id`, `po_number`, `supplier_id`, `contract_id`, `created_by`, `location_id`, `order_date`, `expected_delivery_date`, `actual_delivery_date`, `status`, `subtotal`, `tax_amount`, `tax_percent`, `discount_amount`, `shipping_fee`, `paid_amount`, `total_amount`, `notes`, `rejection_reason`, `shortage_reason`, `shortage_submitted_at`, `manager_decision`, `manager_decision_note`, `manager_decided_at`, `created_at`, `updated_at`',
10099
"1, 'PO-202603-001', 1, null, 1, 1, '2026-03-28', '2026-03-29', '2026-03-29', 'RECEIVED', 100000, 0, 0, 0, 0, 100000, 100000, 'Mock', null, null, null, null, null, null, '2026-03-28 10:00:00', '2026-03-28 10:00:00'");
101100
addMock('purchase_order_items',
102-
'`id`, `purchase_order_id`, `variant_id`, `quantity`, `unit_cost`, `total_cost`, `received_quantity`, `notes`, `expiry_date`',
101+
'`id`, `purchase_order_id`, `variant_id`, `quantity`, `unit_price`, `total_cost`, `received_quantity`, `notes`, `expiry_date`',
103102
"1, 1, 1, 10, 10000, 100000, 10, 'Mock', '2030-01-01'");
104103

105-
// 3. Inventory Counts
106104
addMock('inventory_counts',
107105
'`id`, `code`, `status`, `location_id`, `total_shortage_value`, `total_overage_value`, `total_difference_value`, `created_by`, `confirmed_by`, `created_at`, `confirmed_at`',
108106
"1, 'IC-202603-001', 'CONFIRMED', 1, 0, 0, 0, 1, 1, '2026-03-28 10:00:00', '2026-03-28 10:05:00'");
109107
addMock('inventory_count_items',
110108
'`id`, `inventory_count_id`, `batch_id`, `system_quantity`, `actual_quantity`, `difference_quantity`, `difference_value`, `reason`',
111109
"1, 1, 1, 10, 10, 0, 0, 'Match'");
112110

113-
// 4. Disposal Vouchers
114111
addMock('disposal_vouchers',
115112
'`id`, `code`, `location_id`, `status`, `reason_type`, `notes`, `total_items`, `total_quantity`, `total_value`, `created_by`, `created_at`, `confirmed_by`, `confirmed_at`, `rejection_reason`, `version`',
116113
"1, 'DV-202603-001', 1, 'CONFIRMED', 'DAMAGED', 'Mock Notes', 1, 5, 50000, 1, '2026-03-28 10:00:00', 1, '2026-03-28 10:05:00', null, 1");
117114
addMock('disposal_voucher_items',
118115
'`id`, `disposal_voucher_id`, `batch_id`, `product_id`, `batch_code`, `quantity`, `unit_cost`, `total_cost`, `expiry_date`',
119116
"1, 1, 1, 1, 'BATCH-001', 5, 10000, 50000, '2030-01-01'");
120117

121-
// 5. Product Combos
122118
addMock('product_combos',
123119
'`id`, `combo_code`, `combo_name`, `description`, `image_url`, `original_price`, `combo_price`, `saved_amount`, `discount_percent`, `valid_from`, `valid_to`, `is_active`, `max_quantity_per_order`, `total_sold`, `stock_limit`, `combo_type`, `is_featured`, `display_order`, `tags`, `status`, `created_by_id`, `updated_at`, `category_id`',
124120
"1, 'CB-SNACK-VIP', 'Combo Snack VIP', 'Mock', '', 150000, 120000, 30000, 20, '2026-01-01', '2026-12-31', 1, 5, 0, 0, 'VIP', 0, 1, 'New', 'ACTIVE', 1, '2026-03-28 10:00:00', 1");
125121
addMock('product_combo_items',
126122
'`id`, `combo_id`, `product_variant_id`, `min_quantity`, `max_quantity`, `is_optional`, `can_substitute`, `display_order`, `notes`',
127123
"1, 1, 1, 1, 1, 0, 0, 1, 'None'");
128124

129-
// 6. Price Expiry Alert Logs
130125
addMock('price_expiry_alert_logs',
131126
'`id`, `variant_price_id`, `alert_date`, `sent_at`',
132127
"1, 1, '2026-03-28', '2026-03-28 10:15:00'");

deploy/fix_seed.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ INSERT INTO `purchase_orders` (`id`, `po_number`, `supplier_id`, `contract_id`,
487487
(1, 'PO-202603-001', 1, null, 1, 1, '2026-03-28', '2026-03-29', '2026-03-29', 'RECEIVED', 100000, 0, 0, 0, 0, 100000, 100000, 'Mock', null, null, null, null, null, null, '2026-03-28 10:00:00', '2026-03-28 10:00:00');
488488

489489
TRUNCATE TABLE purchase_order_items;
490-
INSERT INTO `purchase_order_items` (`id`, `purchase_order_id`, `variant_id`, `quantity`, `unit_cost`, `total_cost`, `received_quantity`, `notes`, `expiry_date`) VALUES
490+
INSERT INTO `purchase_order_items` (`id`, `purchase_order_id`, `variant_id`, `quantity`, `unit_price`, `total_cost`, `received_quantity`, `notes`, `expiry_date`) VALUES
491491
(1, 1, 1, 10, 10000, 100000, 10, 'Mock', '2030-01-01');
492492

493493
TRUNCATE TABLE inventory_counts;

0 commit comments

Comments
 (0)