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