diff --git a/src/main/java/com/ffii/fpsms/modules/report/service/ItemQcFailReportService.kt b/src/main/java/com/ffii/fpsms/modules/report/service/ItemQcFailReportService.kt
index 10061df..f835cab 100644
--- a/src/main/java/com/ffii/fpsms/modules/report/service/ItemQcFailReportService.kt
+++ b/src/main/java/com/ffii/fpsms/modules/report/service/ItemQcFailReportService.kt
@@ -19,13 +19,15 @@ open class ItemQcFailReportService(
val itemCodeSql = buildMultiValueLikeClause(itemCode, "it.code", "itemCode", args)
val lastInDateStartSql = if (!lastInDateStart.isNullOrBlank()) {
- args["lastInDateStart"] = lastInDateStart
- "AND sil.receiptDate >= :lastInDateStart"
+ val formattedDate = lastInDateStart.replace("/", "-")
+ args["lastInDateStart"] = formattedDate
+ "AND DATE(sil.receiptDate) >= DATE(:lastInDateStart)"
} else ""
val lastInDateEndSql = if (!lastInDateEnd.isNullOrBlank()) {
- args["lastInDateEnd"] = lastInDateEnd
- "AND sil.receiptDate < :lastInDateEnd"
+ val formattedDate = lastInDateEnd.replace("/", "-")
+ args["lastInDateEnd"] = formattedDate
+ "AND DATE(sil.receiptDate) <= DATE(:lastInDateEnd)"
} else ""
val sql = """
diff --git a/src/main/java/com/ffii/fpsms/modules/report/service/ReportService.kt b/src/main/java/com/ffii/fpsms/modules/report/service/ReportService.kt
index 0fc1793..23a7231 100644
--- a/src/main/java/com/ffii/fpsms/modules/report/service/ReportService.kt
+++ b/src/main/java/com/ffii/fpsms/modules/report/service/ReportService.kt
@@ -126,13 +126,15 @@ open class ReportService(
}
val lastOutDateStartSql = if (!lastOutDateStart.isNullOrBlank()) {
- args["lastOutDateStart"] = lastOutDateStart
- "AND DATE(IFNULL(dpor.RequiredDeliveryDate, do.estimatedArrivalDate)) >= :lastOutDateStart"
+ val formattedDate = lastOutDateStart.replace("/", "-")
+ args["lastOutDateStart"] = formattedDate
+ "AND DATE(IFNULL(dpor.RequiredDeliveryDate, do.estimatedArrivalDate)) >= DATE(:lastOutDateStart)"
} else ""
val lastOutDateEndSql = if (!lastOutDateEnd.isNullOrBlank()) {
- args["lastOutDateEnd"] = lastOutDateEnd
- "AND DATE(IFNULL(dpor.RequiredDeliveryDate, do.estimatedArrivalDate)) < :lastOutDateEnd"
+ val formattedDate = lastOutDateEnd.replace("/", "-")
+ args["lastOutDateEnd"] = formattedDate
+ "AND DATE(IFNULL(dpor.RequiredDeliveryDate, do.estimatedArrivalDate)) <= DATE(:lastOutDateEnd)"
} else ""
val sql = """
@@ -319,13 +321,15 @@ return result
}
val lastOutDateStartSql = if (!lastOutDateStart.isNullOrBlank()) {
- args["lastOutDateStart"] = lastOutDateStart
- "AND DATE(IFNULL(dpor.RequiredDeliveryDate, do.estimatedArrivalDate)) >= :lastOutDateStart"
+ val formattedDate = lastOutDateStart.replace("/", "-")
+ args["lastOutDateStart"] = formattedDate
+ "AND DATE(IFNULL(dpor.RequiredDeliveryDate, do.estimatedArrivalDate)) >= DATE(:lastOutDateStart)"
} else ""
val lastOutDateEndSql = if (!lastOutDateEnd.isNullOrBlank()) {
- args["lastOutDateEnd"] = lastOutDateEnd
- "AND DATE(IFNULL(dpor.RequiredDeliveryDate, do.estimatedArrivalDate)) < :lastOutDateEnd"
+ val formattedDate = lastOutDateEnd.replace("/", "-")
+ args["lastOutDateEnd"] = formattedDate
+ "AND DATE(IFNULL(dpor.RequiredDeliveryDate, do.estimatedArrivalDate)) <= DATE(:lastOutDateEnd)"
} else ""
val sql = """
@@ -510,15 +514,17 @@ fun searchMaterialStockOutTraceabilityReport(
}
val lastOutDateStartSql = if (!lastOutDateStart.isNullOrBlank()) {
- args["lastOutDateStart"] = lastOutDateStart
- "AND DATE(sol.endTime) >= :lastOutDateStart"
+ val formattedDate = lastOutDateStart.replace("/", "-")
+ args["lastOutDateStart"] = formattedDate
+ "AND DATE(sol.endTime) >= DATE(:lastOutDateStart)"
} else {
""
}
val lastOutDateEndSql = if (!lastOutDateEnd.isNullOrBlank()) {
- args["lastOutDateEnd"] = lastOutDateEnd
- "AND DATE(sol.endTime) < :lastOutDateEnd"
+ val formattedDate = lastOutDateEnd.replace("/", "-")
+ args["lastOutDateEnd"] = formattedDate
+ "AND DATE(sol.endTime) <= DATE(:lastOutDateEnd)"
} else {
""
}
@@ -703,13 +709,15 @@ fun searchMaterialStockOutTraceabilityReport(
val itemCodeSql = buildMultiValueLikeClause(itemCode, "it.code", "itemCode", args)
val lastInDateStartSql = if (!lastInDateStart.isNullOrBlank()) {
- args["lastInDateStart"] = lastInDateStart
- "AND sil.receiptDate >= :lastInDateStart"
+ val formattedDate = lastInDateStart.replace("/", "-")
+ args["lastInDateStart"] = formattedDate
+ "AND DATE(sil.receiptDate) >= DATE(:lastInDateStart)"
} else ""
val lastInDateEndSql = if (!lastInDateEnd.isNullOrBlank()) {
- args["lastInDateEnd"] = lastInDateEnd
- "AND sil.receiptDate < :lastInDateEnd"
+ val formattedDate = lastInDateEnd.replace("/", "-")
+ args["lastInDateEnd"] = formattedDate
+ "AND DATE(sil.receiptDate) <= DATE(:lastInDateEnd)"
} else ""
val sql = """
@@ -798,19 +806,19 @@ fun searchMaterialStockOutTraceabilityReport(
COALESCE(uc.code, '') as unitOfMeasure,
COALESCE(il.lotNo, sil.lotNo, '') as lotNo,
COALESCE(DATE_FORMAT(COALESCE(il.expiryDate, sil.expiryDate), '%Y-%m-%d'), '') as expiryDate,
- CAST(ROUND(COALESCE(opening_bal.openingBalance, 0), 0) AS CHAR) as openingBalance,
- CAST(ROUND(COALESCE(cum_in.cumStockIn, 0), 0) AS CHAR) as cumStockIn,
- CAST(ROUND(COALESCE(cum_out.cumStockOut, 0), 0) AS CHAR) as cumStockOut,
- CAST(ROUND(COALESCE(opening_bal.openingBalance, 0) + COALESCE(cum_in.cumStockIn, 0) - COALESCE(cum_out.cumStockOut, 0), 0) AS CHAR) as currentBalance,
+ FORMAT(ROUND(COALESCE(opening_bal.openingBalance, 0), 0), 0) as openingBalance,
+ FORMAT(ROUND(COALESCE(cum_in.cumStockIn, 0), 0), 0) as cumStockIn,
+ FORMAT(ROUND(COALESCE(cum_out.cumStockOut, 0), 0), 0) as cumStockOut,
+ FORMAT(ROUND(COALESCE(opening_bal.openingBalance, 0) + COALESCE(cum_in.cumStockIn, 0) - COALESCE(cum_out.cumStockOut, 0), 0), 0) as currentBalance,
'' as reOrderLevel,
'' as reOrderQty,
COALESCE(GROUP_CONCAT(DISTINCT wh.code ORDER BY wh.code SEPARATOR ', '), '') as storeLocation,
COALESCE(DATE_FORMAT(cum_in.lastInDate, '%Y-%m-%d'), '') as lastInDate,
COALESCE(DATE_FORMAT(cum_out.lastOutDate, '%Y-%m-%d'), '') as lastOutDate,
- CAST(ROUND(SUM(COALESCE(opening_bal.openingBalance, 0)) OVER (PARTITION BY it.code), 0) AS CHAR) as totalOpeningBalance,
- CAST(ROUND(SUM(COALESCE(cum_in.cumStockIn, 0)) OVER (PARTITION BY it.code), 0) AS CHAR) as totalCumStockIn,
- CAST(ROUND(SUM(COALESCE(cum_out.cumStockOut, 0)) OVER (PARTITION BY it.code), 0) AS CHAR) as totalCumStockOut,
- CAST(ROUND(SUM(COALESCE(opening_bal.openingBalance, 0) + COALESCE(cum_in.cumStockIn, 0) - COALESCE(cum_out.cumStockOut, 0)) OVER (PARTITION BY it.code), 0) AS CHAR) as totalCurrentBalance
+ FORMAT(ROUND(SUM(COALESCE(opening_bal.openingBalance, 0)) OVER (PARTITION BY it.code), 0), 0) as totalOpeningBalance,
+ FORMAT(ROUND(SUM(COALESCE(cum_in.cumStockIn, 0)) OVER (PARTITION BY it.code), 0), 0) as totalCumStockIn,
+ FORMAT(ROUND(SUM(COALESCE(cum_out.cumStockOut, 0)) OVER (PARTITION BY it.code), 0), 0) as totalCumStockOut,
+ FORMAT(ROUND(SUM(COALESCE(opening_bal.openingBalance, 0) + COALESCE(cum_in.cumStockIn, 0) - COALESCE(cum_out.cumStockOut, 0)) OVER (PARTITION BY it.code), 0), 0) as totalCurrentBalance
FROM inventory_lot il
LEFT JOIN items it ON il.itemId = it.id AND it.deleted = false
LEFT JOIN stock_in_line sil ON il.stockInLineId = sil.id AND sil.deleted = false
@@ -877,23 +885,27 @@ fun searchMaterialStockOutTraceabilityReport(
}
if (!lastInDateStart.isNullOrBlank()) {
- args["lastInDateStart"] = lastInDateStart
- havingConditions.add("(cum_in.lastInDate IS NULL OR cum_in.lastInDate >= :lastInDateStart)")
+ val formattedDate = lastInDateStart.replace("/", "-")
+ args["lastInDateStart"] = formattedDate
+ havingConditions.add("(cum_in.lastInDate IS NOT NULL AND DATE(cum_in.lastInDate) >= DATE(:lastInDateStart))")
}
if (!lastInDateEnd.isNullOrBlank()) {
- args["lastInDateEnd"] = lastInDateEnd
- havingConditions.add("(cum_in.lastInDate IS NULL OR cum_in.lastInDate < :lastInDateEnd)")
+ val formattedDate = lastInDateEnd.replace("/", "-")
+ args["lastInDateEnd"] = formattedDate
+ havingConditions.add("(cum_in.lastInDate IS NOT NULL AND DATE(cum_in.lastInDate) <= DATE(:lastInDateEnd))")
}
if (!lastOutDateStart.isNullOrBlank()) {
- args["lastOutDateStart"] = lastOutDateStart
- havingConditions.add("(cum_out.lastOutDate IS NULL OR cum_out.lastOutDate >= :lastOutDateStart)")
+ val formattedDate = lastOutDateStart.replace("/", "-")
+ args["lastOutDateStart"] = formattedDate
+ havingConditions.add("(cum_out.lastOutDate IS NOT NULL AND DATE(cum_out.lastOutDate) >= DATE(:lastOutDateStart))")
}
if (!lastOutDateEnd.isNullOrBlank()) {
- args["lastOutDateEnd"] = lastOutDateEnd
- havingConditions.add("(cum_out.lastOutDate IS NULL OR cum_out.lastOutDate < :lastOutDateEnd)")
+ val formattedDate = lastOutDateEnd.replace("/", "-")
+ args["lastOutDateEnd"] = formattedDate
+ havingConditions.add("(cum_out.lastOutDate IS NOT NULL AND DATE(cum_out.lastOutDate) <= DATE(:lastOutDateEnd))")
}
val finalSql = if (havingConditions.isNotEmpty()) {
diff --git a/src/main/java/com/ffii/fpsms/modules/report/service/SemiFGProductionAnalysisReportService.kt b/src/main/java/com/ffii/fpsms/modules/report/service/SemiFGProductionAnalysisReportService.kt
index 3053ca5..da7dd3f 100644
--- a/src/main/java/com/ffii/fpsms/modules/report/service/SemiFGProductionAnalysisReportService.kt
+++ b/src/main/java/com/ffii/fpsms/modules/report/service/SemiFGProductionAnalysisReportService.kt
@@ -107,13 +107,15 @@ class SemiFGProductionAnalysisReportService(
}
val lastOutDateStartSql = if (!lastOutDateStart.isNullOrBlank()) {
- args["lastOutDateStart"] = lastOutDateStart
- "AND DATE(sl.modified) >= :lastOutDateStart"
+ val formattedDate = lastOutDateStart.replace("/", "-")
+ args["lastOutDateStart"] = formattedDate
+ "AND DATE(sl.modified) >= DATE(:lastOutDateStart)"
} else ""
val lastOutDateEndSql = if (!lastOutDateEnd.isNullOrBlank()) {
- args["lastOutDateEnd"] = lastOutDateEnd
- "AND DATE(sl.modified) < :lastOutDateEnd"
+ val formattedDate = lastOutDateEnd.replace("/", "-")
+ args["lastOutDateEnd"] = formattedDate
+ "AND DATE(sl.modified) <= DATE(:lastOutDateEnd)"
} else ""
val sql = """
diff --git a/src/main/java/com/ffii/fpsms/modules/report/service/StockItemConsumptionTrendReportService.kt b/src/main/java/com/ffii/fpsms/modules/report/service/StockItemConsumptionTrendReportService.kt
index 42a6354..867e47c 100644
--- a/src/main/java/com/ffii/fpsms/modules/report/service/StockItemConsumptionTrendReportService.kt
+++ b/src/main/java/com/ffii/fpsms/modules/report/service/StockItemConsumptionTrendReportService.kt
@@ -122,13 +122,15 @@ class StockItemConsumptionTrendReportService(
}
val lastOutDateStartSql = if (!lastOutDateStart.isNullOrBlank()) {
- args["lastOutDateStart"] = lastOutDateStart
- "AND DATE(sl.modified) >= :lastOutDateStart"
+ val formattedDate = lastOutDateStart.replace("/", "-")
+ args["lastOutDateStart"] = formattedDate
+ "AND DATE(sl.modified) >= DATE(:lastOutDateStart)"
} else ""
val lastOutDateEndSql = if (!lastOutDateEnd.isNullOrBlank()) {
- args["lastOutDateEnd"] = lastOutDateEnd
- "AND DATE(sl.modified) < :lastOutDateEnd"
+ val formattedDate = lastOutDateEnd.replace("/", "-")
+ args["lastOutDateEnd"] = formattedDate
+ "AND DATE(sl.modified) <= DATE(:lastOutDateEnd)"
} else ""
val sql = """
diff --git a/src/main/resources/jasper/ItemQCReport.jrxml b/src/main/resources/jasper/ItemQCReport.jrxml
index d94d7ea..c9d2fc6 100644
--- a/src/main/resources/jasper/ItemQCReport.jrxml
+++ b/src/main/resources/jasper/ItemQCReport.jrxml
@@ -52,77 +52,45 @@
-
-
+
-
+
-
+
-
-
+
+
-
+
-
+
+
-
-
+
+
-
+
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
-
+
@@ -130,10 +98,10 @@
-
+
-
+
@@ -141,10 +109,10 @@
-
+
-
+
@@ -152,10 +120,10 @@
-
+
-
+
@@ -163,10 +131,10 @@
-
+
-
+
@@ -174,10 +142,10 @@
-
+
-
+
@@ -185,43 +153,39 @@
-
+
-
-
-
+
+
-
-
+
-
-
-
-
-
+
+
+
+
-
+
-
-
-
-
-
+
+
+
+
-
+
-
-
+
+
-
+
@@ -229,10 +193,10 @@
-
+
-
+
@@ -240,13 +204,8 @@
-
+
-
-
-
-
-
@@ -268,25 +227,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -327,17 +268,12 @@
-
-
-
-
-
-
+
-
+
@@ -380,105 +316,44 @@
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
+
-
+
-
+
-
-
+
-
+
-
-
-
+
-
+
@@ -486,72 +361,58 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
diff --git a/src/main/resources/jasper/StockBalanceReport.jrxml b/src/main/resources/jasper/StockBalanceReport.jrxml
index 2a3d263..9a96a3e 100644
--- a/src/main/resources/jasper/StockBalanceReport.jrxml
+++ b/src/main/resources/jasper/StockBalanceReport.jrxml
@@ -90,7 +90,7 @@
-
+
@@ -161,7 +161,7 @@
-
+
@@ -273,7 +273,7 @@
-
+
@@ -315,7 +315,7 @@
-
+
@@ -356,17 +356,12 @@
-
+
-
-
-
-
-
-
+
@@ -414,81 +409,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
+
-
+
-
+
-
-
+
-
+
-
-
-
+
-
+
@@ -505,7 +458,7 @@
-
+
@@ -560,21 +513,21 @@
-
+
-
+
-
+
diff --git a/src/main/resources/jasper/StockInTraceabilityReport.jrxml b/src/main/resources/jasper/StockInTraceabilityReport.jrxml
index 0c4a6cc..5b433a1 100644
--- a/src/main/resources/jasper/StockInTraceabilityReport.jrxml
+++ b/src/main/resources/jasper/StockInTraceabilityReport.jrxml
@@ -141,7 +141,7 @@
-
+
@@ -271,7 +271,7 @@
-
+
@@ -282,7 +282,7 @@
-
+
@@ -291,7 +291,7 @@
-
+
@@ -300,7 +300,7 @@
-
+
@@ -504,7 +504,7 @@
-
+
@@ -528,7 +528,7 @@
-
+
diff --git a/src/main/resources/jasper/StockLedgarReport.jrxml b/src/main/resources/jasper/StockLedgarReport.jrxml
index 988ae7b..cbea2be 100644
--- a/src/main/resources/jasper/StockLedgarReport.jrxml
+++ b/src/main/resources/jasper/StockLedgarReport.jrxml
@@ -73,94 +73,78 @@
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
+
-
+
+
-
-
+
+
-
+
-
+
+
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
+
+
+
+
+
-
+
-
+
-
-
+
+
-
+
-
-
+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