diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-09 11:15:23 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-09 11:15:23 +0100 |
| commit | 1de8f2f90284c375449326285f0b87e5e700a0c8 (patch) | |
| tree | f5d0d33b7229f4094ae30563b3b7d6ec4b934ea7 /view_component.php | |
| parent | a838a2d3963738b2e9bc496b31e078ead79d4a43 (diff) | |
| download | stock-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 'view_component.php')
| -rwxr-xr-x | view_component.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/view_component.php b/view_component.php index 82f7c18..2940441 100755 --- a/view_component.php +++ b/view_component.php @@ -59,7 +59,13 @@ if( $gContent->isValid() ) { foreach( $rows as $row ) { $stockLevels[$row['qty_type']] = (float)$row['stock_level']; } + $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'", + [ $gContent->mContentId ] + ); $gBitSmarty->assign( 'componentStockLevels', $stockLevels ); + $gBitSmarty->assign( 'packSize', $ps ? (float)$ps : null ); } require_once STOCK_PKG_INCLUDE_PATH.'display_stock_component_inc.php'; |
