Explorar el Código

Stock Lot Ledger UI fix

fix負數倉
Harry Groves hace 12 horas
padre
commit
57c0bda9e1
Se han modificado 2 ficheros con 22 adiciones y 0 borrados
  1. +16
    -0
      src/main/java/com/ffii/fpsms/modules/report/service/StockLotLedgerReportService.kt
  2. +6
    -0
      src/main/java/com/ffii/fpsms/modules/report/web/StockLotLedgerReportController.kt

+ 16
- 0
src/main/java/com/ffii/fpsms/modules/report/service/StockLotLedgerReportService.kt Ver fichero

@@ -46,6 +46,22 @@ open class StockLotLedgerReportService(
return LedgerPeriod(start = startParsed.withDayOfMonth(1), end = end)
}

/** First day of the earliest month that has a stock_ledger row. */
fun earliestLedgerMonth(): LocalDate {
val row = jdbcDao.queryForList(
"""
SELECT DATE_FORMAT(MIN(sl.date), '%Y-%m-%d') AS firstDate
FROM stock_ledger sl
WHERE sl.deleted = 0
""".trimIndent(),
emptyMap<String, Any>(),
).firstOrNull()
val raw = row?.get("firstDate")?.toString()?.trim().orEmpty()
val parsed = raw.takeIf { it.isNotEmpty() && !it.equals("null", ignoreCase = true) }
?.let { runCatching { LocalDate.parse(it.take(10)) }.getOrNull() }
return (parsed ?: LocalDate.now()).withDayOfMonth(1)
}

fun searchStockLotLedgerReport(
itemCode: String?,
reportPeriodStart: String?,


+ 6
- 0
src/main/java/com/ffii/fpsms/modules/report/web/StockLotLedgerReportController.kt Ver fichero

@@ -47,6 +47,12 @@ class StockLotLedgerReportController(
val dash: CellStyle,
)

@GetMapping("/stock-lot-ledger-earliest")
fun earliestLedgerMonth(): Map<String, String> {
val earliest = stockLotLedgerReportService.earliestLedgerMonth()
return mapOf("earliest" to earliest.format(DateTimeFormatter.ISO_LOCAL_DATE))
}

@GetMapping("/print-stock-lot-ledger-excel")
fun exportStockLotLedgerReportExcel(
@RequestParam(required = false) itemCode: String?,


Cargando…
Cancelar
Guardar