| @@ -767,9 +767,9 @@ fun searchMaterialStockOutTraceabilityReport( | |||
| } | |||
| /** | |||
| * Queries the database for Stock Balance Report data. | |||
| * Queries the database for Stock Balance Report data (one summarized row per item). | |||
| * Uses stock_ledger with report period (fromDate/toDate): opening = before fromDate, cum in/out = in period, current = up to toDate. | |||
| * Unit from uom_conversion.udfudesc; includes per-lot and per-item totals plus in/out breakdown by source (PO, JO, StockTake, Adj) and type (Miss, Bad, Adj, StockTake, DO, JO, Consumable). | |||
| * totalStockBalance = SUM(pol.qty * pol.up) per item via purchase_order_line; avgUnitPrice = totalStockBalance / totalCurrentBalance. | |||
| */ | |||
| fun searchStockBalanceReport( | |||
| stockCategory: String?, | |||
| @@ -802,137 +802,136 @@ fun searchMaterialStockOutTraceabilityReport( | |||
| val sql = """ | |||
| SELECT | |||
| '' as stockSubCategory, | |||
| COALESCE(it.code, '') as itemNo, | |||
| COALESCE(it.name, '') as itemName, | |||
| COALESCE(uc.udfudesc, uc.code, '') as unitOfMeasure, | |||
| COALESCE(lot.lotNo, '') as lotNo, | |||
| COALESCE(DATE_FORMAT(lot.expiryDate, '%Y-%m-%d'), '') as expiryDate, | |||
| FORMAT(ROUND(COALESCE(agg.openingBalance, 0), 0), 0) as openingBalance, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockIn, 0), 0), 0) as cumStockIn, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockOut, 0), 0), 0) as cumStockOut, | |||
| FORMAT(ROUND(COALESCE(agg.currentBalance, 0), 0), 0) as currentBalance, | |||
| '' as reOrderLevel, | |||
| COALESCE(item_agg.itemNo, '') as itemNo, | |||
| COALESCE(item_agg.itemName, '') as itemName, | |||
| COALESCE(item_agg.unitOfMeasure, '') as unitOfMeasure, | |||
| '' as lotNo, | |||
| '' as expiryDate, | |||
| '' as openingBalance, | |||
| '' as cumStockIn, | |||
| '' as cumStockOut, | |||
| '' as currentBalance, | |||
| '' as reOrderQty, | |||
| COALESCE(agg.storeLocation, '') as storeLocation, | |||
| COALESCE(DATE_FORMAT(agg.lastInDate, '%Y-%m-%d'), '') as lastInDate, | |||
| COALESCE(DATE_FORMAT(agg.lastOutDate, '%Y-%m-%d'), '') as lastOutDate, | |||
| FORMAT(ROUND(SUM(COALESCE(agg.openingBalance, 0)) OVER w_item, 0), 0) as totalOpeningBalance, | |||
| FORMAT(ROUND(SUM(COALESCE(agg.cumStockIn, 0)) OVER w_item, 0), 0) as totalCumStockIn, | |||
| FORMAT(ROUND(SUM(COALESCE(agg.cumStockOut, 0)) OVER w_item, 0), 0) as totalCumStockOut, | |||
| FORMAT(ROUND(SUM(COALESCE(agg.currentBalance, 0)) OVER w_item, 0), 0) as totalCurrentBalance, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockOutMiss, 0), 0), 0) as misInputAndLost, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockOutBad, 0), 0), 0) as defectiveGoods, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockOutAdjStockTake, 0), 0), 0) as variance, | |||
| COALESCE(item_agg.storeLocation, '') as storeLocation, | |||
| COALESCE(DATE_FORMAT(item_agg.lastInDate, '%Y-%m-%d'), '') as lastInDate, | |||
| COALESCE(DATE_FORMAT(item_agg.lastOutDate, '%Y-%m-%d'), '') as lastOutDate, | |||
| FORMAT(ROUND(COALESCE(item_agg.totalOpeningBalance, 0), 0), 0) as totalOpeningBalance, | |||
| FORMAT(ROUND(COALESCE(item_agg.totalCumStockIn, 0), 0), 0) as totalCumStockIn, | |||
| FORMAT(ROUND(COALESCE(item_agg.totalCumStockOut, 0), 0), 0) as totalCumStockOut, | |||
| FORMAT(ROUND(COALESCE(item_agg.totalCurrentBalance, 0), 0), 0) as totalCurrentBalance, | |||
| '' as misInputAndLost, | |||
| '' as defectiveGoods, | |||
| '' as variance, | |||
| FORMAT(ROUND(COALESCE(item_agg.totalMisInputAndLost, 0), 0), 0) as totalMisInputAndLost, | |||
| FORMAT(ROUND(COALESCE(item_agg.totalVariance, 0), 0), 0) as totalVariance, | |||
| FORMAT(ROUND(COALESCE(item_agg.totalDefectiveGoods, 0), 0), 0) as totalDefectiveGoods, | |||
| FORMAT(ROUND(COALESCE(ipv.totalStockBalanceRaw, 0), 2), 0) as totalStockBalance, | |||
| CASE | |||
| WHEN agg.lastInDate IS NULL AND agg.lastOutDate IS NULL THEN '' | |||
| WHEN agg.lastInDate IS NULL THEN DATE_FORMAT(agg.lastOutDate, '%Y-%m-%d') | |||
| WHEN agg.lastOutDate IS NULL THEN DATE_FORMAT(agg.lastInDate, '%Y-%m-%d') | |||
| ELSE DATE_FORMAT(GREATEST(agg.lastInDate, agg.lastOutDate), '%Y-%m-%d') | |||
| END as lastMovementDate, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockInByPO, 0), 0), 0) as cumStockInByPurchaseOrder, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockInByJO, 0), 0), 0) as cumStockInByJobOrder, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockInByStockTake, 0), 0), 0) as cumStockInByStockTake, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockInByAdj, 0), 0), 0) as cumStockInByAdj, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockOutMiss, 0), 0), 0) as cumStockOutMissQty, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockOutBad, 0), 0), 0) as cumStockOutBadQty, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockOutAdj, 0), 0), 0) as cumStockOutAdj, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockOutAdjTransfer, 0), 0), 0) as cumStockOutAdjTransfer, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockOutAdjStockTake, 0), 0), 0) as cumStockOutAdjStockTake, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockOutStockTake, 0), 0), 0) as cumStockOutStockTake, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockOutByDO, 0), 0), 0) as cumStockOutByDO, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockOutByJO, 0), 0), 0) as cumStockOutByJO, | |||
| FORMAT(ROUND(COALESCE(agg.cumStockOutByConsumable, 0), 0), 0) as cumStockOutByConsumable | |||
| WHEN COALESCE(item_agg.totalCurrentBalance, 0) > 0 AND ipv.totalStockBalanceRaw IS NOT NULL AND ipv.totalStockBalanceRaw <> 0 | |||
| THEN FORMAT(ROUND(ipv.totalStockBalanceRaw / item_agg.totalCurrentBalance, 2), 0) | |||
| ELSE '0' | |||
| END as avgUnitPrice | |||
| FROM ( | |||
| SELECT | |||
| sl.itemCode, | |||
| sl.itemId, | |||
| COALESCE(il_in.id, il_out.id) AS lotId, | |||
| SUM(CASE WHEN DATE(sl.date) < :fromDate THEN COALESCE(sl.inQty, 0) - COALESCE(sl.outQty, 0) ELSE 0 END) AS openingBalance, | |||
| SUM( | |||
| CASE | |||
| WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate | |||
| AND sil.stockTakeLineId IS NULL -- 不是「由盤點」產生的入庫 | |||
| THEN COALESCE(sl.inQty, 0) | |||
| ELSE 0 | |||
| END | |||
| ) AS cumStockIn, | |||
| SUM( | |||
| CASE | |||
| WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate | |||
| AND COALESCE(sl.outQty, 0) > 0 | |||
| AND NOT ( | |||
| -- 1) 盤點正式出庫 | |||
| LOWER(TRIM(COALESCE(sl.type, ''))) = 'stocktake' | |||
| -- 2) 盤點差異調整出庫(你已經算在 cumStockOutAdjStockTake) | |||
| OR ( | |||
| LOWER(TRIM(COALESCE(sl.type, ''))) = 'adj' | |||
| AND (sol.stockTransferId IS NULL OR sol.id IS NULL) | |||
| ) | |||
| -- 3) 錯誤輸入或遺失出庫 | |||
| OR LOWER(TRIM(COALESCE(sl.type, ''))) = 'miss' | |||
| OR LOWER(TRIM(COALESCE(sol.type, ''))) = 'miss' | |||
| -- 4) 不良品棄置出庫 | |||
| OR LOWER(TRIM(COALESCE(sl.type, ''))) = 'bad' | |||
| OR LOWER(TRIM(COALESCE(sol.type, ''))) = 'bad' | |||
| ) | |||
| THEN COALESCE(sl.outQty, 0) | |||
| ELSE 0 | |||
| END | |||
| ) AS cumStockOut, | |||
| SUM(CASE WHEN DATE(sl.date) <= :toDate THEN COALESCE(sl.inQty, 0) - COALESCE(sl.outQty, 0) ELSE 0 END) AS currentBalance, | |||
| MAX(CASE WHEN COALESCE(sl.inQty, 0) > 0 THEN sl.date END) AS lastInDate, | |||
| MAX(CASE WHEN COALESCE(sl.outQty, 0) > 0 THEN sl.date END) AS lastOutDate, | |||
| MAX(lot_wh.storeLocation) AS storeLocation, | |||
| SUM(CASE WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate AND COALESCE(sl.inQty, 0) > 0 AND sil.purchaseOrderId IS NOT NULL THEN sl.inQty ELSE 0 END) AS cumStockInByPO, | |||
| SUM(CASE WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate AND COALESCE(sl.inQty, 0) > 0 AND sil.jobOrderId IS NOT NULL THEN sl.inQty ELSE 0 END) AS cumStockInByJO, | |||
| SUM(CASE WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate AND COALESCE(sl.inQty, 0) > 0 AND sil.stockTakeLineId IS NOT NULL THEN sl.inQty ELSE 0 END) AS cumStockInByStockTake, | |||
| SUM(CASE WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate AND COALESCE(sl.inQty, 0) > 0 AND LOWER(TRIM(COALESCE(sl.type, ''))) = 'adj' THEN sl.inQty ELSE 0 END) AS cumStockInByAdj, | |||
| SUM(CASE WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate AND COALESCE(sl.outQty, 0) > 0 AND (LOWER(TRIM(COALESCE(sl.type, ''))) = 'miss' OR LOWER(TRIM(COALESCE(sol.type, ''))) = 'miss') THEN sl.outQty ELSE 0 END) AS cumStockOutMiss, | |||
| SUM(CASE WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate AND COALESCE(sl.outQty, 0) > 0 AND (LOWER(TRIM(COALESCE(sl.type, ''))) = 'bad' OR LOWER(TRIM(COALESCE(sol.type, ''))) = 'bad') THEN sl.outQty ELSE 0 END) AS cumStockOutBad, | |||
| SUM(CASE WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate AND COALESCE(sl.outQty, 0) > 0 AND LOWER(TRIM(COALESCE(sl.type, ''))) = 'adj' THEN sl.outQty ELSE 0 END) AS cumStockOutAdj, | |||
| SUM(CASE WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate AND COALESCE(sl.outQty, 0) > 0 AND LOWER(TRIM(COALESCE(sl.type, ''))) = 'adj' AND sol.stockTransferId IS NOT NULL THEN sl.outQty ELSE 0 END) AS cumStockOutAdjTransfer, | |||
| SUM(CASE WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate AND COALESCE(sl.outQty, 0) > 0 AND LOWER(TRIM(COALESCE(sl.type, ''))) = 'adj' AND (sol.stockTransferId IS NULL OR sol.id IS NULL) THEN sl.outQty ELSE 0 END) AS cumStockOutAdjStockTake, | |||
| SUM(CASE WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate AND COALESCE(sl.outQty, 0) > 0 AND LOWER(TRIM(COALESCE(sl.type, ''))) = 'stocktake' THEN sl.outQty ELSE 0 END) AS cumStockOutStockTake, | |||
| SUM(CASE WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate AND COALESCE(sl.outQty, 0) > 0 AND LOWER(TRIM(COALESCE(po.type, ''))) = 'do' THEN sl.outQty ELSE 0 END) AS cumStockOutByDO, | |||
| SUM(CASE WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate AND COALESCE(sl.outQty, 0) > 0 AND LOWER(TRIM(COALESCE(po.type, ''))) = 'jo' THEN sl.outQty ELSE 0 END) AS cumStockOutByJO, | |||
| SUM(CASE WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate AND COALESCE(sl.outQty, 0) > 0 AND LOWER(TRIM(COALESCE(po.type, ''))) = 'consumable' THEN sl.outQty ELSE 0 END) AS cumStockOutByConsumable | |||
| FROM stock_ledger sl | |||
| LEFT JOIN stock_in_line sil ON sl.stockInLineId = sil.id AND sil.deleted = 0 | |||
| LEFT JOIN inventory_lot il_in ON sil.inventoryLotId = il_in.id AND il_in.deleted = 0 | |||
| LEFT JOIN stock_out_line sol ON sl.stockOutLineId = sol.id AND sol.deleted = 0 | |||
| LEFT JOIN inventory_lot_line ill_out ON sol.inventoryLotLineId = ill_out.id AND ill_out.deleted = 0 | |||
| LEFT JOIN inventory_lot il_out ON ill_out.inventoryLotId = il_out.id AND il_out.deleted = 0 | |||
| LEFT JOIN pick_order_line pol ON sol.pickOrderLineId = pol.id AND pol.deleted = 0 | |||
| LEFT JOIN pick_order po ON pol.poId = po.id AND po.deleted = 0 | |||
| LEFT JOIN ( | |||
| SELECT il.id AS lotId, MAX(wh.code) AS storeLocation | |||
| FROM inventory_lot il | |||
| LEFT JOIN inventory_lot_line ill ON ill.inventoryLotId = il.id AND ill.deleted = 0 | |||
| LEFT JOIN warehouse wh ON ill.warehouseId = wh.id AND wh.deleted = 0 | |||
| GROUP BY il.id | |||
| ) lot_wh ON lot_wh.lotId = COALESCE(il_in.id, il_out.id) | |||
| WHERE sl.deleted = 0 | |||
| AND sl.itemCode IS NOT NULL AND sl.itemCode <> '' | |||
| AND DATE(sl.date) <= :toDate | |||
| AND COALESCE(il_in.id, il_out.id) IS NOT NULL | |||
| $itemCodeSql | |||
| GROUP BY sl.itemCode, sl.itemId, COALESCE(il_in.id, il_out.id) | |||
| ) agg | |||
| LEFT JOIN items it ON agg.itemId = it.id AND it.deleted = 0 | |||
| LEFT JOIN item_uom iu ON it.id = iu.itemId AND iu.stockUnit = 1 AND iu.deleted = 0 | |||
| LEFT JOIN uom_conversion uc ON iu.uomId = uc.id | |||
| LEFT JOIN (SELECT id, lotNo, expiryDate FROM inventory_lot WHERE deleted = 0) lot ON lot.id = agg.lotId | |||
| WHERE 1 = 1 | |||
| $stockCategorySql | |||
| $storeLocationSql | |||
| HAVING 1=1 | |||
| WINDOW w_item AS (PARTITION BY agg.itemCode) | |||
| agg.itemCode AS itemNo, | |||
| agg.itemId, | |||
| it.name AS itemName, | |||
| COALESCE(uc.udfudesc, uc.code, '') AS unitOfMeasure, | |||
| SUM(agg.openingBalance) AS totalOpeningBalance, | |||
| SUM(agg.cumStockIn) AS totalCumStockIn, | |||
| SUM(agg.cumStockOut) AS totalCumStockOut, | |||
| SUM(agg.currentBalance) AS totalCurrentBalance, | |||
| SUM(agg.cumStockOutMiss) AS totalMisInputAndLost, | |||
| SUM(agg.cumStockOutAdjStockTake) AS totalVariance, | |||
| SUM(agg.cumStockOutBad) AS totalDefectiveGoods, | |||
| MAX(agg.storeLocation) AS storeLocation, | |||
| MAX(agg.lastInDate) AS lastInDate, | |||
| MAX(agg.lastOutDate) AS lastOutDate | |||
| FROM ( | |||
| SELECT | |||
| sl.itemCode, | |||
| sl.itemId, | |||
| COALESCE(il_in.id, il_out.id) AS lotId, | |||
| SUM(CASE WHEN DATE(sl.date) < :fromDate THEN COALESCE(sl.inQty, 0) - COALESCE(sl.outQty, 0) ELSE 0 END) AS openingBalance, | |||
| SUM( | |||
| CASE | |||
| WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate | |||
| AND sil.stockTakeLineId IS NULL | |||
| THEN COALESCE(sl.inQty, 0) | |||
| ELSE 0 | |||
| END | |||
| ) AS cumStockIn, | |||
| SUM( | |||
| CASE | |||
| WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate | |||
| AND COALESCE(sl.outQty, 0) > 0 | |||
| AND NOT ( | |||
| LOWER(TRIM(COALESCE(sl.type, ''))) = 'stocktake' | |||
| OR ( | |||
| LOWER(TRIM(COALESCE(sl.type, ''))) = 'adj' | |||
| AND (sol.stockTransferId IS NULL OR sol.id IS NULL) | |||
| ) | |||
| OR LOWER(TRIM(COALESCE(sl.type, ''))) = 'miss' | |||
| OR LOWER(TRIM(COALESCE(sol.type, ''))) = 'miss' | |||
| OR LOWER(TRIM(COALESCE(sl.type, ''))) = 'bad' | |||
| OR LOWER(TRIM(COALESCE(sol.type, ''))) = 'bad' | |||
| ) | |||
| THEN COALESCE(sl.outQty, 0) | |||
| ELSE 0 | |||
| END | |||
| ) AS cumStockOut, | |||
| SUM(CASE WHEN DATE(sl.date) <= :toDate THEN COALESCE(sl.inQty, 0) - COALESCE(sl.outQty, 0) ELSE 0 END) AS currentBalance, | |||
| MAX(CASE WHEN COALESCE(sl.inQty, 0) > 0 THEN sl.date END) AS lastInDate, | |||
| MAX(CASE WHEN COALESCE(sl.outQty, 0) > 0 THEN sl.date END) AS lastOutDate, | |||
| MAX(lot_wh.storeLocation) AS storeLocation, | |||
| SUM(CASE WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate AND COALESCE(sl.inQty, 0) > 0 AND (LOWER(TRIM(COALESCE(sl.type, ''))) = 'miss' OR LOWER(TRIM(COALESCE(sol.type, ''))) = 'miss') THEN sl.outQty ELSE 0 END) AS cumStockOutMiss, | |||
| SUM(CASE WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate AND COALESCE(sl.outQty, 0) > 0 AND (LOWER(TRIM(COALESCE(sl.type, ''))) = 'bad' OR LOWER(TRIM(COALESCE(sol.type, ''))) = 'bad') THEN sl.outQty ELSE 0 END) AS cumStockOutBad, | |||
| SUM(CASE WHEN DATE(sl.date) BETWEEN :fromDate AND :toDate AND COALESCE(sl.outQty, 0) > 0 AND LOWER(TRIM(COALESCE(sl.type, ''))) = 'adj' AND (sol.stockTransferId IS NULL OR sol.id IS NULL) THEN sl.outQty ELSE 0 END) AS cumStockOutAdjStockTake | |||
| FROM stock_ledger sl | |||
| LEFT JOIN stock_in_line sil ON sl.stockInLineId = sil.id AND sil.deleted = 0 | |||
| LEFT JOIN inventory_lot il_in ON sil.inventoryLotId = il_in.id AND il_in.deleted = 0 | |||
| LEFT JOIN stock_out_line sol ON sl.stockOutLineId = sol.id AND sol.deleted = 0 | |||
| LEFT JOIN inventory_lot_line ill_out ON sol.inventoryLotLineId = ill_out.id AND ill_out.deleted = 0 | |||
| LEFT JOIN inventory_lot il_out ON ill_out.inventoryLotId = il_out.id AND il_out.deleted = 0 | |||
| LEFT JOIN ( | |||
| SELECT il.id AS lotId, MAX(wh.code) AS storeLocation | |||
| FROM inventory_lot il | |||
| LEFT JOIN inventory_lot_line ill ON ill.inventoryLotId = il.id AND ill.deleted = 0 | |||
| LEFT JOIN warehouse wh ON ill.warehouseId = wh.id AND wh.deleted = 0 | |||
| GROUP BY il.id | |||
| ) lot_wh ON lot_wh.lotId = COALESCE(il_in.id, il_out.id) | |||
| WHERE sl.deleted = 0 | |||
| AND sl.itemCode IS NOT NULL AND sl.itemCode <> '' | |||
| AND DATE(sl.date) <= :toDate | |||
| AND COALESCE(il_in.id, il_out.id) IS NOT NULL | |||
| $itemCodeSql | |||
| GROUP BY sl.itemCode, sl.itemId, COALESCE(il_in.id, il_out.id) | |||
| ) agg | |||
| LEFT JOIN items it ON agg.itemId = it.id AND it.deleted = 0 | |||
| LEFT JOIN item_uom iu ON it.id = iu.itemId AND iu.stockUnit = 1 AND iu.deleted = 0 | |||
| LEFT JOIN uom_conversion uc ON iu.uomId = uc.id | |||
| WHERE 1 = 1 | |||
| $stockCategorySql | |||
| $storeLocationSql | |||
| GROUP BY agg.itemCode, agg.itemId, it.id, it.code, it.name, uc.udfudesc, uc.code | |||
| HAVING 1=1 | |||
| ) item_agg | |||
| LEFT JOIN ( | |||
| SELECT itemId, SUM(pol_qty_up) AS totalStockBalanceRaw | |||
| FROM ( | |||
| SELECT sil.itemId, MAX(COALESCE(pol.qty, 0) * COALESCE(pol.up, 0)) AS pol_qty_up | |||
| FROM stock_in_line sil | |||
| LEFT JOIN purchase_order_line pol ON sil.purchaseOrderLineId = pol.id AND pol.deleted = 0 | |||
| WHERE sil.deleted = 0 | |||
| GROUP BY sil.itemId, pol.id | |||
| ) t | |||
| GROUP BY itemId | |||
| ) ipv ON item_agg.itemId = ipv.itemId | |||
| WHERE 1=1 | |||
| """.trimIndent() | |||
| val havingConditions = mutableListOf<String>() | |||
| val currentBalanceExpr = "COALESCE(agg.currentBalance, 0)" | |||
| val currentBalanceExpr = "COALESCE(totalCurrentBalance, 0)" | |||
| if (!balanceFilterStart.isNullOrBlank()) { | |||
| args["balanceFilterStart"] = balanceFilterStart.toDoubleOrNull() ?: 0.0 | |||
| @@ -945,30 +944,30 @@ SUM( | |||
| if (!lastInDateStart.isNullOrBlank()) { | |||
| val formattedDate = lastInDateStart.replace("/", "-") | |||
| args["lastInDateStart"] = formattedDate | |||
| havingConditions.add("(agg.lastInDate IS NOT NULL AND DATE(agg.lastInDate) >= DATE(:lastInDateStart))") | |||
| havingConditions.add("(lastInDate IS NOT NULL AND DATE(lastInDate) >= DATE(:lastInDateStart))") | |||
| } | |||
| if (!lastInDateEnd.isNullOrBlank()) { | |||
| val formattedDate = lastInDateEnd.replace("/", "-") | |||
| args["lastInDateEnd"] = formattedDate | |||
| havingConditions.add("(agg.lastInDate IS NOT NULL AND DATE(agg.lastInDate) <= DATE(:lastInDateEnd))") | |||
| havingConditions.add("(lastInDate IS NOT NULL AND DATE(lastInDate) <= DATE(:lastInDateEnd))") | |||
| } | |||
| if (!lastOutDateStart.isNullOrBlank()) { | |||
| val formattedDate = lastOutDateStart.replace("/", "-") | |||
| args["lastOutDateStart"] = formattedDate | |||
| havingConditions.add("(agg.lastOutDate IS NOT NULL AND DATE(agg.lastOutDate) >= DATE(:lastOutDateStart))") | |||
| havingConditions.add("(lastOutDate IS NOT NULL AND DATE(lastOutDate) >= DATE(:lastOutDateStart))") | |||
| } | |||
| if (!lastOutDateEnd.isNullOrBlank()) { | |||
| val formattedDate = lastOutDateEnd.replace("/", "-") | |||
| args["lastOutDateEnd"] = formattedDate | |||
| havingConditions.add("(agg.lastOutDate IS NOT NULL AND DATE(agg.lastOutDate) <= DATE(:lastOutDateEnd))") | |||
| havingConditions.add("(lastOutDate IS NOT NULL AND DATE(lastOutDate) <= DATE(:lastOutDateEnd))") | |||
| } | |||
| val finalSql = if (havingConditions.isNotEmpty()) { | |||
| sql.replace("HAVING 1=1", "HAVING ${havingConditions.joinToString(" AND ")}") | |||
| } else { | |||
| sql.replace("HAVING 1=1", "") | |||
| sql.replace("GROUP BY agg.itemCode, agg.itemId, it.id, it.code, it.name, uc.udfudesc, uc.code\n HAVING 1=1", "GROUP BY agg.itemCode, agg.itemId, it.id, it.code, it.name, uc.udfudesc, uc.code") | |||
| } | |||
| return jdbcDao.queryForList("$finalSql ORDER BY itemNo, lotNo", args) | |||
| return jdbcDao.queryForList("$finalSql ORDER BY itemNo", args) | |||
| } | |||
| /** | |||
| * Compiles and fills a Jasper Report, then exports to Excel (.xlsx). Same layout/columns as the report template. | |||
| @@ -1,5 +1,5 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!-- Created with Jaspersoft Studio version 6.21.3.final using JasperReports Library version 6.21.3-4a3078d20785ebe464f18037d738d12fc98c13cf --> | |||
| <!-- Created with Jaspersoft Studio version 6.17.0.final using JasperReports Library version 6.17.0-6d93193241dd8cc42629e188b94f9e0bc5722efd --> | |||
| <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="StockBalanceReport" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b6cc79a8-6025-4490-938c-b90508da62d0"> | |||
| <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> | |||
| <parameter name="stockSubCategory" class="java.lang.String"> | |||
| @@ -60,83 +60,132 @@ | |||
| <field name="totalCurrentBalance" class="java.lang.String"/> | |||
| <field name="lastOutDate" class="java.lang.String"/> | |||
| <field name="lastInDate" class="java.lang.String"/> | |||
| <field name="reOrderLevel" class="java.lang.String"/> | |||
| <field name="avgUnitPrice" class="java.lang.String"/> | |||
| <field name="reOrderQty" class="java.lang.String"/> | |||
| <field name="storeLocation" class="java.lang.String"/> | |||
| <field name="misInputAndLost" class="java.lang.String"/> | |||
| <field name="totalMisInputAndLost" class="java.lang.String"/> | |||
| <field name="totalVariance" class="java.lang.String"/> | |||
| <field name="totalDefectiveGoods" class="java.lang.String"/> | |||
| <field name="lastMovementDate" class="java.lang.String"/> | |||
| <field name="totalStockBalance" class="java.lang.String"/> | |||
| <field name="defectiveGoods" class="java.lang.String"/> | |||
| <field name="variance" class="java.lang.String"/> | |||
| <group name="Group1" keepTogether="true"> | |||
| <groupExpression><![CDATA[$F{itemNo}]]></groupExpression> | |||
| <groupHeader> | |||
| <band height="18"> | |||
| <textField textAdjust="StretchHeight"> | |||
| <reportElement isPrintRepeatedValues="false" x="10" y="0" width="579" height="18" uuid="e4c7bd9f-44af-488b-89e4-d47e75bb2193"/> | |||
| <textElement textAlignment="Left" verticalAlignment="Top" markup="styled"> | |||
| <font fontName="微軟正黑體" isBold="true"/> | |||
| <band height="24"> | |||
| <textField> | |||
| <reportElement x="669" y="0" width="51" height="20" uuid="7faf8dc0-de0e-49bb-abbc-8c6e4818e6c6"> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Right" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{itemNo}+" "+$F{itemName}+" "+$F{unitOfMeasure}]]></textFieldExpression> | |||
| <textFieldExpression><![CDATA[$F{avgUnitPrice}]]></textFieldExpression> | |||
| </textField> | |||
| </band> | |||
| </groupHeader> | |||
| <groupFooter> | |||
| <band height="19"> | |||
| <printWhenExpression><![CDATA[$V{Group1_COUNT} > 1]]></printWhenExpression> | |||
| <staticText> | |||
| <reportElement x="260" y="0" width="60" height="18" uuid="d10fdf4f-4a2a-439c-9877-125998c975db"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <textField textAdjust="StretchHeight"> | |||
| <reportElement x="488" y="0" width="59" height="20" uuid="2a8242a0-f8a7-4e2c-9084-1e54d35857d6"> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Right" verticalAlignment="Top"> | |||
| <font fontName="微軟正黑體" size="10"/> | |||
| <textElement textAlignment="Right" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體"/> | |||
| </textElement> | |||
| <text><![CDATA[貨品總量:]]></text> | |||
| </staticText> | |||
| <textFieldExpression><![CDATA[$F{totalVariance}]]></textFieldExpression> | |||
| </textField> | |||
| <textField> | |||
| <reportElement x="320" y="0" width="60" height="18" uuid="0e884be5-64f2-4ade-a2bb-50275accbcdd"> | |||
| <reportElement x="610" y="0" width="59" height="20" uuid="0994677f-b92e-4229-8540-98a41d6fb246"> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Right" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{totalCurrentBalance}]]></textFieldExpression> | |||
| </textField> | |||
| <textField textAdjust="StretchHeight"> | |||
| <reportElement x="242" y="0" width="66" height="20" uuid="689d73a8-2b3e-4f34-bbb3-0272e40b6d4d"> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Right" verticalAlignment="Top"> | |||
| <textElement textAlignment="Right" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{totalCumStockIn}]]></textFieldExpression> | |||
| <textFieldExpression><![CDATA[$F{totalOpeningBalance}]]></textFieldExpression> | |||
| </textField> | |||
| <textField textAdjust="StretchHeight"> | |||
| <reportElement x="547" y="0" width="63" height="20" uuid="eef9c887-4acb-4dc9-b96a-e9b9db1dea9a"> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Right" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{totalDefectiveGoods}]]></textFieldExpression> | |||
| </textField> | |||
| <textField textAdjust="StretchHeight"> | |||
| <reportElement x="428" y="0" width="60" height="20" uuid="c2fba89a-c051-4982-8eec-60ad665302ca"> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Right" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{totalMisInputAndLost}]]></textFieldExpression> | |||
| </textField> | |||
| <textField> | |||
| <reportElement x="380" y="0" width="60" height="18" uuid="d2bc3efc-fd44-42b8-b451-7b6bc5e77cea"> | |||
| <reportElement x="368" y="0" width="60" height="20" uuid="d2bc3efc-fd44-42b8-b451-7b6bc5e77cea"> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Right" verticalAlignment="Top"> | |||
| <textElement textAlignment="Right" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{totalCumStockOut}]]></textFieldExpression> | |||
| </textField> | |||
| <textField> | |||
| <reportElement x="629" y="0" width="62" height="18" uuid="0994677f-b92e-4229-8540-98a41d6fb246"/> | |||
| <textElement textAlignment="Right" verticalAlignment="Top"> | |||
| <font fontName="微軟正黑體"/> | |||
| <textField textAdjust="StretchHeight" pattern="#,##0"> | |||
| <reportElement x="180" y="0" width="62" height="20" uuid="52e894e2-98f9-4691-a52d-8c53780999b6"/> | |||
| <textElement textAlignment="Left" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體" size="10"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{totalCurrentBalance}]]></textFieldExpression> | |||
| <textFieldExpression><![CDATA[$F{unitOfMeasure}]]></textFieldExpression> | |||
| </textField> | |||
| <line> | |||
| <reportElement x="0" y="18" width="799" height="1" uuid="f22e204d-b70a-4e70-99ce-e1e6d60d6934"> | |||
| <textField textAdjust="StretchHeight" pattern="#,##0"> | |||
| <reportElement x="10" y="0" width="48" height="20" uuid="ff45d0af-b31c-481b-a2b3-957582bfd48e"/> | |||
| <textElement textAlignment="Left" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體" size="10"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{itemNo}]]></textFieldExpression> | |||
| </textField> | |||
| <textField textAdjust="StretchHeight" pattern="#,##0"> | |||
| <reportElement x="58" y="0" width="112" height="20" uuid="40c3dc48-d215-4c2f-8f79-7a8bdfd1877e"/> | |||
| <textElement textAlignment="Left" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體" size="10"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{itemName}]]></textFieldExpression> | |||
| </textField> | |||
| <textField> | |||
| <reportElement x="720" y="0" width="78" height="20" uuid="b58a8878-7093-4af2-b1a8-cf44de1fb4a6"> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| </reportElement> | |||
| </line> | |||
| <line> | |||
| <reportElement x="260" y="0" width="431" height="1" uuid="eaaa7506-fc74-4f38-be61-e3cb56968baa"> | |||
| <textElement textAlignment="Right" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{totalStockBalance}]]></textFieldExpression> | |||
| </textField> | |||
| <textField> | |||
| <reportElement x="308" y="0" width="60" height="20" uuid="0e884be5-64f2-4ade-a2bb-50275accbcdd"> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| </reportElement> | |||
| </line> | |||
| <textElement textAlignment="Right" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{totalCumStockIn}]]></textFieldExpression> | |||
| </textField> | |||
| </band> | |||
| </groupHeader> | |||
| <groupFooter> | |||
| <band height="1"> | |||
| <printWhenExpression><![CDATA[$V{Group1_COUNT} == 1]]></printWhenExpression> | |||
| <printWhenExpression><![CDATA[$V{Group1_COUNT} > 1]]></printWhenExpression> | |||
| <line> | |||
| <reportElement x="0" y="0" width="799" height="1" uuid="d0796042-728a-4d02-89f5-b71f13369e20"> | |||
| <reportElement x="0" y="0" width="799" height="1" uuid="f22e204d-b70a-4e70-99ce-e1e6d60d6934"> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| </reportElement> | |||
| </line> | |||
| @@ -147,7 +196,7 @@ | |||
| <band height="17" splitType="Stretch"/> | |||
| </background> | |||
| <pageHeader> | |||
| <band height="77" splitType="Stretch"> | |||
| <band height="87" splitType="Stretch"> | |||
| <staticText> | |||
| <reportElement x="351" y="0" width="101" height="23" uuid="e670cb8d-d591-4418-8bce-36398e286e1f"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| @@ -159,7 +208,7 @@ | |||
| <text><![CDATA[庫存結餘報告]]></text> | |||
| </staticText> | |||
| <staticText> | |||
| <reportElement x="567" y="58" width="62" height="18" uuid="b208e97a-9d94-40ba-9922-3399d8e2f3ac"> | |||
| <reportElement x="548" y="58" width="62" height="28" uuid="b208e97a-9d94-40ba-9922-3399d8e2f3ac"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| @@ -170,18 +219,7 @@ | |||
| <text><![CDATA[不良品棄置]]></text> | |||
| </staticText> | |||
| <staticText> | |||
| <reportElement x="110" y="58" width="60" height="18" uuid="a78ad88c-d542-4a5f-9662-c3f9f90776b8"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Center" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體" size="10"/> | |||
| </textElement> | |||
| <text><![CDATA[到期日]]></text> | |||
| </staticText> | |||
| <staticText> | |||
| <reportElement x="320" y="58" width="60" height="18" uuid="e95456ea-35da-4b71-8dc6-f11cf1c519d5"> | |||
| <reportElement x="308" y="58" width="60" height="28" uuid="e95456ea-35da-4b71-8dc6-f11cf1c519d5"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| </reportElement> | |||
| @@ -191,29 +229,7 @@ | |||
| <text><![CDATA[纍計存入量]]></text> | |||
| </staticText> | |||
| <staticText> | |||
| <reportElement x="10" y="58" width="100" height="18" uuid="aa7590f2-5ce0-4877-b98d-b197fa799fee"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Left" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體" size="10"/> | |||
| </textElement> | |||
| <text><![CDATA[批號]]></text> | |||
| </staticText> | |||
| <staticText> | |||
| <reportElement x="170" y="58" width="90" height="18" uuid="4bb9dbca-a6bb-4596-969e-86e8dd60c215"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Center" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體" size="10"/> | |||
| </textElement> | |||
| <text><![CDATA[存貨位置]]></text> | |||
| </staticText> | |||
| <staticText> | |||
| <reportElement x="440" y="58" width="76" height="18" uuid="7a1741f9-6a23-4c04-81dd-c5e87c7a5142"> | |||
| <reportElement x="428" y="58" width="60" height="28" uuid="7a1741f9-6a23-4c04-81dd-c5e87c7a5142"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| @@ -221,10 +237,11 @@ | |||
| <textElement textAlignment="Right" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體" size="10"/> | |||
| </textElement> | |||
| <text><![CDATA[錯誤輸入或遺失]]></text> | |||
| <text><![CDATA[錯誤輸入 | |||
| 或遺失]]></text> | |||
| </staticText> | |||
| <staticText> | |||
| <reportElement x="516" y="58" width="51" height="18" uuid="66934b77-2d44-4218-b459-680e2aeca2e4"> | |||
| <reportElement x="488" y="58" width="60" height="28" uuid="66934b77-2d44-4218-b459-680e2aeca2e4"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| @@ -314,23 +331,12 @@ | |||
| </reportElement> | |||
| </line> | |||
| <line> | |||
| <reportElement x="0" y="76" width="799" height="1" uuid="bebf0ac8-d6c7-4bee-9f1c-fe064db93be5"> | |||
| <reportElement x="0" y="86" width="799" height="1" uuid="bebf0ac8-d6c7-4bee-9f1c-fe064db93be5"> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| </reportElement> | |||
| </line> | |||
| <staticText> | |||
| <reportElement isPrintRepeatedValues="false" x="691" y="58" width="107" height="18" isPrintInFirstWholeBand="true" uuid="5ae5e1a3-1742-4c46-a6f0-c3dae205c18d"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Center" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體" size="10"/> | |||
| </textElement> | |||
| <text><![CDATA[最後出入倉日期]]></text> | |||
| </staticText> | |||
| <staticText> | |||
| <reportElement x="260" y="58" width="60" height="18" uuid="360cf13a-93e7-45d4-8a4d-9e9506a6ad3f"> | |||
| <reportElement x="242" y="58" width="66" height="28" uuid="360cf13a-93e7-45d4-8a4d-9e9506a6ad3f"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| @@ -341,7 +347,7 @@ | |||
| <text><![CDATA[期初存量]]></text> | |||
| </staticText> | |||
| <staticText> | |||
| <reportElement x="380" y="58" width="60" height="18" uuid="a3ea1b07-2108-409f-adee-8478374d767a"> | |||
| <reportElement x="368" y="58" width="60" height="28" uuid="a3ea1b07-2108-409f-adee-8478374d767a"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| </reportElement> | |||
| @@ -351,7 +357,7 @@ | |||
| <text><![CDATA[纍計存出量]]></text> | |||
| </staticText> | |||
| <staticText> | |||
| <reportElement x="629" y="58" width="62" height="18" uuid="4efdbfd9-2ad2-45de-aab9-b234d43b6026"> | |||
| <reportElement x="610" y="58" width="59" height="28" uuid="4efdbfd9-2ad2-45de-aab9-b234d43b6026"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| @@ -361,103 +367,61 @@ | |||
| </textElement> | |||
| <text><![CDATA[現存存貨]]></text> | |||
| </staticText> | |||
| </band> | |||
| </pageHeader> | |||
| <detail> | |||
| <band height="18" splitType="Stretch"> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| <textField textAdjust="StretchHeight"> | |||
| <reportElement x="110" y="1" width="60" height="17" uuid="01dd0420-eac9-4e0a-b1a5-c74f164a59a5"/> | |||
| <textElement textAlignment="Center" verticalAlignment="Top"> | |||
| <font fontName="微軟正黑體"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{expiryDate}]]></textFieldExpression> | |||
| </textField> | |||
| <textField textAdjust="StretchHeight"> | |||
| <reportElement x="10" y="1" width="100" height="17" uuid="8776b0f9-71ff-46be-b97a-1be0ea4c3bab"> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Left" verticalAlignment="Top"> | |||
| <font fontName="微軟正黑體" size="10"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{lotNo}]]></textFieldExpression> | |||
| </textField> | |||
| <textField textAdjust="StretchHeight"> | |||
| <reportElement x="320" y="1" width="60" height="17" uuid="3e286375-b747-416e-8817-fe3290ca3d94"> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Right" verticalAlignment="Top"> | |||
| <font fontName="微軟正黑體"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{cumStockIn}]]></textFieldExpression> | |||
| </textField> | |||
| <textField textAdjust="StretchHeight"> | |||
| <reportElement x="380" y="1" width="60" height="17" uuid="904a410e-b94f-4fe0-8659-0558e891fdaa"> | |||
| <staticText> | |||
| <reportElement x="10" y="58" width="48" height="28" uuid="f9475692-14cd-49e8-aac0-ad972aca79e1"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Right" verticalAlignment="Top"> | |||
| <font fontName="微軟正黑體"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{cumStockOut}]]></textFieldExpression> | |||
| </textField> | |||
| <textField textAdjust="StretchHeight"> | |||
| <reportElement x="629" y="1" width="62" height="17" uuid="3d91b4d0-6775-4ea4-96cd-41251ad448c7"/> | |||
| <textElement textAlignment="Right" verticalAlignment="Top"> | |||
| <font fontName="微軟正黑體"/> | |||
| <textElement textAlignment="Left" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體" size="10" isBold="false"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{currentBalance}]]></textFieldExpression> | |||
| </textField> | |||
| <textField textAdjust="StretchHeight"> | |||
| <reportElement x="170" y="1" width="90" height="17" uuid="192315a1-142d-465e-8dfa-6e443fb12a3d"> | |||
| <text><![CDATA[貨品編號]]></text> | |||
| </staticText> | |||
| <staticText> | |||
| <reportElement x="180" y="58" width="62" height="28" uuid="e6c47019-de01-4e76-b4f8-cad3826d88b0"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Center" verticalAlignment="Top"> | |||
| <font fontName="微軟正黑體"/> | |||
| <textElement textAlignment="Left" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體" size="10" isBold="false"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{storeLocation}]]></textFieldExpression> | |||
| </textField> | |||
| <textField textAdjust="StretchHeight"> | |||
| <reportElement x="260" y="1" width="60" height="17" uuid="91b9dd25-38ac-42c6-8b10-9286ba2ad815"> | |||
| <text><![CDATA[單位]]></text> | |||
| </staticText> | |||
| <staticText> | |||
| <reportElement x="58" y="58" width="112" height="28" uuid="759e71ab-8f6b-4664-9669-1da737d41343"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Right" verticalAlignment="Top"> | |||
| <font fontName="微軟正黑體"/> | |||
| <textElement textAlignment="Left" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體" size="10" isBold="false"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{openingBalance}]]></textFieldExpression> | |||
| </textField> | |||
| <textField textAdjust="StretchHeight"> | |||
| <reportElement x="691" y="1" width="107" height="17" uuid="117ddf52-f659-41b2-a9ac-5b8af592a456"> | |||
| <text><![CDATA[貨品名稱]]></text> | |||
| </staticText> | |||
| <staticText> | |||
| <reportElement x="720" y="58" width="78" height="28" uuid="722cd2e3-3d4a-4edd-a2fc-ca82fd34efb6"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Center" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{lastMovementDate}]]></textFieldExpression> | |||
| </textField> | |||
| <textField textAdjust="StretchHeight"> | |||
| <reportElement x="516" y="1" width="50" height="17" uuid="501c7609-a18e-4cab-8512-4ec78271cf51"/> | |||
| <textElement textAlignment="Right" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體"/> | |||
| <font fontName="微軟正黑體" size="10"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{variance}]]></textFieldExpression> | |||
| </textField> | |||
| <textField textAdjust="StretchHeight"> | |||
| <reportElement x="440" y="1" width="76" height="17" uuid="bfcdaef4-f059-4c96-8d66-ed89fb7264e1"> | |||
| <text><![CDATA[庫存總價值]]></text> | |||
| </staticText> | |||
| <staticText> | |||
| <reportElement x="669" y="58" width="51" height="28" uuid="c2ce0900-1c3a-4732-ba95-5ba2d60e8f78"> | |||
| <property name="com.jaspersoft.studio.unit.y" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.height" value="px"/> | |||
| <property name="com.jaspersoft.studio.unit.width" value="px"/> | |||
| </reportElement> | |||
| <textElement textAlignment="Right" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{misInputAndLost}]]></textFieldExpression> | |||
| </textField> | |||
| <textField textAdjust="StretchHeight"> | |||
| <reportElement x="566" y="1" width="63" height="17" uuid="00ec8d65-72fd-42b8-b7b6-6d30dac9cab3"/> | |||
| <textElement textAlignment="Right" verticalAlignment="Middle"> | |||
| <font fontName="微軟正黑體"/> | |||
| <font fontName="微軟正黑體" size="10"/> | |||
| </textElement> | |||
| <textFieldExpression><![CDATA[$F{defectiveGoods}]]></textFieldExpression> | |||
| </textField> | |||
| <text><![CDATA[單位均價]]></text> | |||
| </staticText> | |||
| </band> | |||
| </detail> | |||
| </pageHeader> | |||
| </jasperReport> | |||