summaryrefslogtreecommitdiff
path: root/list_movements.php
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-06-09 11:15:23 +0100
committerLester Caine <lester@lsces.co.uk>2026-06-09 11:15:23 +0100
commit1de8f2f90284c375449326285f0b87e5e700a0c8 (patch)
treef5d0d33b7229f4094ae30563b3b7d6ec4b934ea7 /list_movements.php
parenta838a2d3963738b2e9bc496b31e078ead79d4a43 (diff)
downloadstock-1de8f2f90284c375449326285f0b87e5e700a0c8.tar.gz
stock-1de8f2f90284c375449326285f0b87e5e700a0c8.tar.bz2
stock-1de8f2f90284c375449326285f0b87e5e700a0c8.zip
stock: PCK/SHT fractional display, movement qty summing, import qty type
Display fixes: - list_stock, list_movements, view_component: PCK stock divides by pack_size for fractional strip display; SHT shows 2 decimal places - list_movements: pack_size fetched per component for PCK display - All fractional formats use %.2f consistently StockMovement::getList component filter: - Replace INNER JOIN on xcmp with EXISTS subquery to avoid duplicate rows when a component appears multiple times in a movement BOM - cmp_qty now SUMs all matching xref rows so multi-assembly RQs show total quantity rather than silently dropping duplicate rows Movement BOM edit templates: - stockmovement/edit_xref_bom_item.tpl: proper edit form for SGL/SHT/VOL lines linking back to view_component - stockmovement/edit_xref_bompck_item.tpl: same for PCK with pack size hint Import: - ImportSimpleComponent: columns 6/7 (qty_type, qty_value) wired up; PCK/SHT/VOL writes qty xref so movement CSV imports pick up default type Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'list_movements.php')
-rw-r--r--list_movements.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/list_movements.php b/list_movements.php
index 1557dbd..8ae66e4 100644
--- a/list_movements.php
+++ b/list_movements.php
@@ -19,11 +19,18 @@ $listHash = $_REQUEST;
$movementList = $movement->getList( $listHash );
$componentTitle = '';
+$packSize = null;
if( $componentContentId ) {
$componentTitle = $gBitDb->getOne(
"SELECT `title` FROM `".BIT_DB_PREFIX."liberty_content` WHERE `content_id` = ?",
[ $componentContentId ]
) ?: '';
+ $ps = $gBitDb->getOne(
+ "SELECT CAST(x.`xkey` AS DOUBLE PRECISION) FROM `".BIT_DB_PREFIX."liberty_xref` x
+ WHERE x.`content_id` = ? AND x.`item` = 'PCK'",
+ [ $componentContentId ]
+ );
+ $packSize = $ps ? (float)$ps : null;
}
$gBitSmarty->assign( 'listInfo', $listHash['listInfo'] );
@@ -32,5 +39,6 @@ $gBitSmarty->assign( 'filterType', $_REQUEST['ref_type'] ?? '' );
$gBitSmarty->assign( 'assemblyContentId', isset( $_REQUEST['assembly_content_id'] ) && is_numeric( $_REQUEST['assembly_content_id'] ) ? (int)$_REQUEST['assembly_content_id'] : null );
$gBitSmarty->assign( 'componentContentId', $componentContentId );
$gBitSmarty->assign( 'componentTitle', $componentTitle );
+$gBitSmarty->assign( 'packSize', $packSize );
$gBitSystem->display( 'bitpackage:stock/list_movements.tpl', 'Movements', [ 'display_mode' => 'list' ] );