Fix customer return confirm, auto credit note VAT and quotation link

Store the put-away location on return lines (new td_return_item columns, needs setup.php), split auto credit notes into net and VAT with the parent's department, drop the write to a td_quotation column that does not exist, and have the demo seed confirm its customer return.
This commit is contained in:
Thanakorn
2026-09-19 07:32:07 +07:00
parent 114cf73748
commit 3668f22e55
5 changed files with 121 additions and 27 deletions
+12
View File
@@ -872,12 +872,24 @@ CREATE TABLE IF NOT EXISTS `td_return_item` (
`warehouse_id` int(11) NOT NULL DEFAULT 0,
`stock_out_id` int(11) NOT NULL DEFAULT 0,
`stock_out_warehouse_id` int(11) NOT NULL DEFAULT 0,
`zone` varchar(255) NOT NULL DEFAULT '',
`aisle` varchar(255) NOT NULL DEFAULT '',
`bin` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `uq_return_item` (`return_id`,`item_id`),
KEY `idx_return` (`company_id`,`return_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
", 'td_return_item');
// Put-away location of each returned line. The Customer Return form has always
// asked for it and ReturnManager::confirmReturn() has always read it, but the
// table had nowhere to keep it: the choice was dropped on save and every
// confirmation then failed in WarehouseManager::occupyBin() with
// "Bin -- does not exist". Same widths as td_stock's location columns.
run($pdo, "ALTER TABLE `td_return_item` ADD COLUMN `zone` varchar(255) NOT NULL DEFAULT '' AFTER `stock_out_warehouse_id`", 'td_return_item.zone');
run($pdo, "ALTER TABLE `td_return_item` ADD COLUMN `aisle` varchar(255) NOT NULL DEFAULT '' AFTER `zone`", 'td_return_item.aisle');
run($pdo, "ALTER TABLE `td_return_item` ADD COLUMN `bin` varchar(255) NOT NULL DEFAULT '' AFTER `aisle`", 'td_return_item.bin');
run($pdo, "
CREATE TABLE IF NOT EXISTS `td_purchase_request` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,