remove log

This commit is contained in:
gowthaman 2024-06-17 16:19:37 +05:30
parent 954c9088e3
commit 0025d50677

View File

@ -1,6 +1,8 @@
package com.restapi.controllers
import com.restapi.domain.*
import com.restapi.domain.Session.currentUserPlants
import com.restapi.domain.Session.database
import org.apache.poi.hssf.usermodel.DVConstraint
import org.apache.poi.hssf.usermodel.HSSFDataValidation
import org.apache.poi.hssf.usermodel.HSSFSheet
@ -13,6 +15,7 @@ import java.text.SimpleDateFormat
import java.time.LocalDate
import java.time.ZoneId
import java.util.*
import java.util.concurrent.ConcurrentHashMap
fun createHeaderRow(cols: List<String>, sh: HSSFSheet, wb: Workbook) {
val boldFont = wb.createFont()
@ -288,17 +291,20 @@ fun exportPos(pos: List<PurchaseOrder>) {
"Open Till",
"Reference Quotation Number",
"Vendor Name",
"Vendor Address",
"Product Id",
"Product Name",
"Unit Price",
"Quantity",
"Loading Site",
"Unloading Plant",
"Total Amount",
"Terms and Conditions"
)
createHeaderRow(headers, sh, wb)
var rowCnt = 1
val vmap = ConcurrentHashMap<Long, Vendor>()
val plants = currentUserPlants()
for (po in pos) {
val prodCnt = po.products.size
@ -309,8 +315,11 @@ fun exportPos(pos: List<PurchaseOrder>) {
row.createCell(i++).setCellValue(po.poDate)
row.createCell(i++).setCellValue(po.validTill)
row.createCell(i++).setCellValue(po.referenceQuotation)
row.createCell(i++).setCellValue(po.vendor?.name)
row.createCell(i++).setCellValue(po.vendor?.address)
val vendorId = po.vendor!!.sysPk
val vendor = vmap.computeIfAbsent(vendorId) {
database.find(Vendor::class.java, vendorId)!!
}
row.createCell(i++).setCellValue(vendor.name)
//6 would be repeated
row.createCell(i++).setCellValue(po.products[j].productId.toString())
@ -318,8 +327,24 @@ fun exportPos(pos: List<PurchaseOrder>) {
row.createCell(i++).setCellValue(po.products[j].unitPrice)
row.createCell(i++).setCellValue(po.products[j].quantity)
if (po.allLoadingSite) {
row.createCell(i++).setCellValue("All Site")
} else {
row.createCell(i++).setCellValue(po.loadingSiteId?.toString())
}
if (po.allUnloadingSite) {
row.createCell(i++).setCellValue("All Plants")
} else {
row.createCell(i++)
.setCellValue(po.unloadingPlantId)
}
row.createCell(i++).setCellValue(po.totalAmount)
row.createCell(i++).setCellValue(po.tnc?.joinToString(";"))
row.createCell(i).setCellValue(po.tnc?.joinToString(";"))
}
}
saveExcelFileLocally("Pos.xls", wb)
@ -338,6 +363,7 @@ fun exportIncomingInventory(tickets: List<IncomingInventory>) {
"Vehicle No",
"Loading Site",
"Unloading Site",
"PO Num",
"Product Name",
"Unit Price",
"Quantity",
@ -361,9 +387,16 @@ 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 prod = ticket.products!![j]
val po = if(prod.poId != null && prod.poId > 0){
database.find(PurchaseOrder::class.java, prod.poId)?.poNum
} else {
""
}
row.createCell(i++).setCellValue(po)
row.createCell(i++).setCellValue(prod.productName)
row.createCell(i++).setCellValue(prod.unitPrice)
row.createCell(i).setCellValue(prod.quantity)
}
}