add po to download of inward and fix date format
This commit is contained in:
@@ -14,6 +14,7 @@ import java.io.FileOutputStream
|
||||
import java.text.SimpleDateFormat
|
||||
import java.time.LocalDate
|
||||
import java.time.ZoneId
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.util.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
@@ -367,18 +368,21 @@ fun exportIncomingInventory(tickets: List<IncomingInventory>) {
|
||||
"Product Name",
|
||||
"Unit Price",
|
||||
"Quantity",
|
||||
"PO Number",
|
||||
"PO Date",
|
||||
)
|
||||
createHeaderRow(headers, sh, wb)
|
||||
|
||||
var rowCnt = 1
|
||||
for (ticket in tickets) {
|
||||
val prodCnt = ticket.products?.size
|
||||
val products = ticket.products ?: continue
|
||||
val prodCnt = products.size
|
||||
|
||||
for (j in 0..<prodCnt!!) {
|
||||
for (j in 0..<prodCnt) {
|
||||
val row = sh.createRow(rowCnt++)
|
||||
var i = 0
|
||||
row.createCell(i++).setCellValue(ticket.mrn)
|
||||
row.createCell(i++).setCellValue(ticket.date)
|
||||
row.createCell(i++).setCellValue(ticket.date?.format(DateTimeFormatter.ofPattern("dd/MM/yyyy ")) ?: "")
|
||||
row.createCell(i++).setCellValue(ticket.vendor?.name)
|
||||
row.createCell(i++).setCellValue(ticket.vendorBillNum)
|
||||
row.createCell(i++).setCellValue(ticket.vendorBillAmount)
|
||||
@@ -387,10 +391,19 @@ fun exportIncomingInventory(tickets: List<IncomingInventory>) {
|
||||
row.createCell(i++).setCellValue(ticket.unloading)
|
||||
|
||||
//6 would be repeated
|
||||
row.createCell(i++).setCellValue(ticket.products!![j].productName)
|
||||
row.createCell(i++).setCellValue(ticket.products!![j].unitPrice)
|
||||
row.createCell(i++).setCellValue(ticket.products!![j].quantity)
|
||||
val poProduct = products[j]
|
||||
row.createCell(i++).setCellValue(poProduct.productName)
|
||||
row.createCell(i++).setCellValue(poProduct.unitPrice)
|
||||
row.createCell(i++).setCellValue(poProduct.quantity)
|
||||
if (poProduct.poId != null) {
|
||||
val po = database.find(PurchaseOrder::class.java, poProduct.poId)
|
||||
row.createCell(i++).setCellValue(po?.poNum ?: "")
|
||||
row.createCell(i++).setCellValue(po?.poDate?.format(DateTimeFormatter.ofPattern("dd/MM/yyyy")) ?: "")
|
||||
} else {
|
||||
row.createCell(i++).setCellValue("")
|
||||
row.createCell(i++).setCellValue("")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
saveExcelFileLocally("IncomingInventory.xls", wb)
|
||||
|
||||
Reference in New Issue
Block a user