add vendor module

This commit is contained in:
arsalan 2024-02-21 17:22:45 +05:30
parent 338f86a5f5
commit 9a60105ed3
10 changed files with 299 additions and 120 deletions

7
.gitignore vendored
View File

@ -44,3 +44,10 @@ application.yaml
initial-data.sql
app.yaml
*.env.json
### API Logs ###
api.log
api.2024*
### Excel FIles ###
./excel

BIN
excel/Pos.xls Normal file

Binary file not shown.

BIN
excel/Products.xls Normal file

Binary file not shown.

BIN
excel/Quotes.xls Normal file

Binary file not shown.

BIN
excel/VendorList.xls Normal file

Binary file not shown.

View File

@ -119,6 +119,7 @@ fun main(args: Array<String>) {
get("quotes/{id}", VendorCtrl::getQuotes, Roles(Role.Explicit("ROLE_QUOTE_VIEW", "ROLE_QUOTE_CREATE", "ROLE_VENDOR_VIEW")))
get("pos/{id}", VendorCtrl::getPos, Roles(Role.Explicit("ROLE_PO_VIEW", "ROLE_PO_CREATE`")))
put("/rate/{id}/{rating}", VendorCtrl::rate, Roles(Role.Explicit("ROLE_VENDOR_CREATE")))
put("/{id}", VendorCtrl::update, Roles(Role.Explicit("ROLE_VENDOR_CREATE")))
}
path("/po") {
get("/next", PurchaseOrderCtrl::getNextNum, Roles(Role.Explicit("ROLE_PO_CREATE")))
@ -126,6 +127,7 @@ fun main(args: Array<String>) {
post("/batch", PurchaseOrderCtrl::createBatch, Roles(Role.Explicit("ROLE_PO_CREATE")))
post("/getAll", PurchaseOrderCtrl::getAll, Roles(Role.Explicit("ROLE_PO_CREATE", "ROLE_PO_VIEW", "ROLE_VENDOR_CREATE")))
get("/{id}", PurchaseOrderCtrl::get, Roles(Role.Explicit("ROLE_PO_CREATE", "ROLE_PO_VIEW", "ROLE_QUOTE_CREATE")))
put("/{id}", PurchaseOrderCtrl::update, Roles(Role.Explicit("ROLE_PO_CREATE")))
put("/approve/{id}", PurchaseOrderCtrl::approve, Roles(Role.Explicit()))
put("/reject/{id}", PurchaseOrderCtrl::reject, Roles(Role.Explicit()))
get("/refQuote/{id}", PurchaseOrderCtrl::quoteReference, Roles(Role.Explicit("ROLE_PO_CREATE")))
@ -136,6 +138,7 @@ fun main(args: Array<String>) {
post("/batch", QuotationCtrl::createBatch, Roles(Role.Explicit("ROLE_QUOTE_CREATE")))
post("/getAll", QuotationCtrl::getAll, Roles(Role.Explicit("ROLE_QUOTE_CREATE", "ROLE_QUOTE_VIEW")))
get("/{id}", QuotationCtrl::get, Roles(Role.Explicit("ROLE_QUOTE_VIEW", "ROLE_QUOTE_CREATE")))
put("/{id}", QuotationCtrl::update, Roles(Role.Explicit("ROLE_QUOTE_CREATE")))
delete("/{id}", QuotationCtrl::delete, Roles(Role.Explicit("ROLE_QUOTE_CREATE")))
}
path("/product") {

View File

@ -14,6 +14,7 @@ import io.ebean.CallableSql
import io.ebean.RawSqlBuilder
import io.javalin.http.*
import org.slf4j.LoggerFactory
import java.io.FileInputStream
import java.sql.Types
import java.time.LocalDate
import java.time.LocalDateTime
@ -396,8 +397,15 @@ object PurchaseOrderCtrl {
fun getAll(ctx: Context) {
val filters = ctx.bodyAsClass<PF>()
val pos = searchPos(filters.common, filters.poFilters)
val excel = ctx.queryParam("excel")
if(excel != null){
exportPos(pos)
val inputStream = FileInputStream("./excel/Pos.xls")
ctx.result(inputStream).status(HttpStatus.OK)
}else{
ctx.json(pos).status(HttpStatus.OK)
}
}
fun create(ctx: Context) {
val po = ctx.bodyAsClass<PurchaseOrder>()
@ -450,13 +458,16 @@ object PurchaseOrderCtrl {
?: throw NotFoundResponse("reference quotation not found for po $id")
ctx.json(quote)
}
fun update(ctx: Context) {
val id = ctx.pathParam("id")
val id = ctx.pathParam("id").toLong()
val po = database.find(PurchaseOrder::class.java, id) ?: throw NotFoundResponse("po not found for $id")
val updatedPo = ctx.bodyAsClass<PurchaseOrder>()
po.patchValues(updatedPo)
po.update()
ctx.json(po).status(HttpStatus.OK)
}
fun delete(ctx: Context) {
val id = ctx.pathParam("id")
val po = database.find(PurchaseOrder::class.java, id) ?: throw NotFoundResponse("no po found with id $id")
@ -487,21 +498,30 @@ object ProductCtrl {
val productList = Session.database.find(Product::class.java)
.findList()
.sortedBy { it.name }
val excel = ctx.queryParam("excel")
if(excel != null){
exportProds(productList)
val inputStream = FileInputStream("./excel/Products.xls")
ctx.result(inputStream).status(HttpStatus.OK)
}else{
ctx.json(productList)
}
}
fun create(ctx: Context) {
val product = ctx.bodyAsClass<Product>()
database.save(product)
ctx.json(product).status(HttpStatus.CREATED)
}
fun delete(ctx: Context) {
val id = ctx.pathParam("id")
val prod = database.find(Product::class.java, id) ?: throw NotFoundResponse("no product found with id $id")
database.delete(prod)
ctx.status(HttpStatus.OK)
}
fun patch(ctx: Context) {
val id = ctx.pathParam("id")
val patchValues = ctx.bodyAsClass<Map<String, Any>>()
@ -520,11 +540,12 @@ object ProductCtrl {
}
fun update(ctx: Context) {
val id = ctx.pathParam("id")
val id = ctx.pathParam("id").toLong()
val product = database.find(Product::class.java, id) ?: throw NotFoundResponse("product not found for $id")
val updatedProduct = ctx.bodyAsClass<Product>()
product.patchValues(updatedProduct)
product.update()
ctx.json(product).status(HttpStatus.OK)
}
@ -573,9 +594,16 @@ object QuotationCtrl {
fun getAll(ctx: Context) {
val filters = ctx.bodyAsClass<QF>()
val excel: String? = ctx.queryParam("excel")
val quotes = searchQuotes(filters.common, filters.quoteFilters)
if (excel != null) {
exportQuotations(quotes)
val inputStream = FileInputStream("./excel/Quotes.xls")
ctx.result(inputStream).status(HttpStatus.OK)
} else {
ctx.json(quotes).status(HttpStatus.OK)
}
}
fun create(ctx: Context) {
val quote = ctx.bodyAsClass<Quotation>()
@ -599,18 +627,21 @@ object QuotationCtrl {
}
ctx.result("Quotes batch created").status(HttpStatus.CREATED)
}
fun delete(ctx: Context) {
val id = ctx.pathParam("id")
val quote = database.find(Quotation::class.java, id) ?: throw NotFoundResponse("no quote found with id $id")
database.delete(quote)
ctx.status(HttpStatus.OK)
}
fun update(ctx: Context) {
val id = ctx.pathParam("id")
val id = ctx.pathParam("id").toLong()
val quote = database.find(Quotation::class.java, id) ?: throw NotFoundResponse("quote not found for $id")
val updatedQuote = ctx.bodyAsClass<Quotation>()
quote.patchValues(updatedQuote)
quote.update()
ctx.json(quote).status(HttpStatus.OK)
}
}
@ -632,12 +663,14 @@ object DocumentCtrl {
fun print(ctx: Context) {
//would be handled in the frontend ??
}
fun delete(ctx: Context) {
val id = ctx.pathParam("id")
val doc = database.find(Document::class.java, id) ?: throw NotFoundResponse("no document found with id $id")
database.delete(doc)
ctx.status(HttpStatus.OK)
}
fun getWithRefId(ctx: Context) {
//fetches a particular doc (po, quote) with ref id
val refId = ctx.pathParam("refId")
@ -655,7 +688,7 @@ object DocumentCtrl {
object VendorCtrl {
val logger = LoggerFactory.getLogger("Vendor")
fun get(ctx: Context) {
val id = ctx.pathParam("id")
val id = ctx.pathParam("id").toLong()
val vendor = database.find(Vendor::class.java, id) ?: throw NotFoundResponse("no vendor found with id $id")
ctx.status(HttpStatus.OK)
ctx.json(vendor)
@ -666,9 +699,15 @@ object VendorCtrl {
fun getAll(ctx: Context) {
val filters = ctx.bodyAsClass<VF>()
logger.info("filters = {}", filters)
val pos = searchVendors(filters.common, filters.vendorFilters)
ctx.status(HttpStatus.OK)
ctx.json(pos)
val excel: String? = ctx.queryParam("excel")
val vendors = searchVendors(filters.common, filters.vendorFilters)
if (excel !== null) {
exportVendors(vendors)
val inputStream = FileInputStream("./excel/VendorList.xls")
ctx.result(inputStream).status(HttpStatus.OK)
} else {
ctx.json(vendors).status(HttpStatus.OK)
}
}
fun createBatch(ctx: Context) {
@ -684,12 +723,14 @@ object VendorCtrl {
}
fun update(ctx: Context) {
val id = ctx.pathParam("id")
val id = ctx.pathParam("id").toLong()
val vendor = database.find(Vendor::class.java, id) ?: throw NotFoundResponse("vendor not found for $id")
val updatedVendor = ctx.bodyAsClass<Vendor>()
vendor.patchValues(updatedVendor)
vendor.update()
ctx.json(vendor).status(HttpStatus.OK)
}
fun delete(ctx: Context) {
val id = ctx.pathParam("id")
val vendor = database.find(Vendor::class.java, id) ?: throw NotFoundResponse("no vendor found with id $id")

View File

@ -1,4 +1,5 @@
package com.restapi.controllers
import com.google.gson.Gson
import com.restapi.domain.*
import com.restapi.domain.Document
@ -40,6 +41,7 @@ fun createHeaderRow(cols :List<String>, sh :HSSFSheet, wb: Workbook) {
}
}
}
fun String.parseDate(format: String): Date? {
val locale = Locale.getDefault()
return try {
@ -48,6 +50,7 @@ fun String.parseDate(format: String): Date? {
null
}
}
fun dateFromCellHelper(cell: Cell): LocalDate? {
val date = when (cell.cellType) {
CellType.STRING -> cell.stringCellValue.parseDate("yyyy-MM-dd")
@ -58,10 +61,12 @@ fun dateFromCellHelper(cell: Cell): LocalDate?{
null
}
}
else -> null
}
return date?.toInstant()?.atZone(ZoneId.systemDefault())?.toLocalDate()
}
fun stringFromCellHelper(cell: Cell): String {
val string = when (cell.cellType) {
CellType.NUMERIC -> cell.numericCellValue.toString()
@ -70,6 +75,7 @@ fun stringFromCellHelper(cell: Cell): String {
}
return string
}
fun doubleFromCellHelper(cell: Cell): Double {
val double = when (cell.cellType) {
CellType.NUMERIC -> cell.numericCellValue
@ -87,71 +93,130 @@ fun longIntFromCellHelper(cell : Cell) :Long {
}
return long
}
enum class FileType {
QUOTES, POS, VENDORS, PRODS, DOCS
}
enum class EnumFor {
UOM, DocType
}
fun saveExcelFileLocally(fileName: String, wb: Workbook) {
val out = FileOutputStream(fileName)
val path = "./excel/"
val out = FileOutputStream(path + fileName)
wb.use {
it.write(out)
}
out.close()
}
fun TemplateExcelFile(fileType: FileType) {
when (fileType) {
FileType.QUOTES -> {
val headers : List<String> = listOf("Quotation Number", "Date", "Open Till", "Product Id", "Product Name", "Product Unit Price", "Quantity", "Vendor Name", "Vendor Address", "RFQ Number", "Total Amount", "Terms and Conditions")
val headers: List<String> = listOf(
"Quotation Number",
"Date",
"Open Till",
"Product Id",
"Product Name",
"Product Unit Price",
"Quantity",
"Vendor Name",
"Vendor Address",
"RFQ Number",
"Total Amount",
"Terms and Conditions"
)
val wb = HSSFWorkbook()
val sh = wb.createSheet()
createHeaderRow(headers, sh, wb)
saveExcelFileLocally("Quotes_Template.xls", wb)
}
FileType.POS -> {
val headers : List<String> = listOf("Number", "Date", "Open Till", "Reference Quotation Number", "Vendor Name", "Vendor Address", "Product Id", "Product Name", "Unit Price", "Quantity", "Total Amount", "Terms and Conditions")
val headers: List<String> = listOf(
"Number",
"Date",
"Open Till",
"Reference Quotation Number",
"Vendor Name",
"Vendor Address",
"Product Id",
"Product Name",
"Unit Price",
"Quantity",
"Total Amount",
"Terms and Conditions"
)
val wb = HSSFWorkbook()
val sh = wb.createSheet()
createHeaderRow(headers, sh, wb)
saveExcelFileLocally("Purchase_Order_Template.xls", wb)
}
FileType.VENDORS -> {
val headers : List<String> = listOf("Name", "MSME", "GST Number", "Address", "Rating", "Contact Name", "Contact Email", "Contact Mobile")
val headers: List<String> = listOf(
"Name",
"MSME",
"GST Number",
"Address",
"Rating",
"Contact Name",
"Contact Email",
"Contact Mobile"
)
val wb = HSSFWorkbook()
val sh = wb.createSheet()
createHeaderRow(headers, sh, wb)
saveExcelFileLocally("Vendors_Template.xls", wb)
}
FileType.PRODS -> {
val headers: List<String> = listOf("Id", "Name", "Description", "HSN Code", "UOM")
val wb = HSSFWorkbook()
val sh = wb.createSheet()
createHeaderRow(headers, sh, wb)
val r0 = CellRangeAddressList(0, 1000, 4, 4)
val dv0 = HSSFDataValidation(r0, DVConstraint.createExplicitListConstraint(arrayOf("LTR", "MTR", "NOS", "ALL"))).apply {
val dv0 = HSSFDataValidation(
r0,
DVConstraint.createExplicitListConstraint(arrayOf("LTR", "MTR", "NOS", "ALL"))
).apply {
suppressDropDownArrow = true
}
sh.addValidationData(dv0)
saveExcelFileLocally("Products_Template.xls", wb)
}
FileType.DOCS -> {
}
}
}
fun ExportQuotations(quotes :List<Quotation>) {
fun exportQuotations(quotes: List<Quotation>) {
val wb = HSSFWorkbook()
val sh = wb.createSheet()
val headers : List<String> = listOf("Quotation Number", "Date", "Open Till", "Product Id", "Product Name", "Product Unit Price", "Quantity", "Vendor Name", "Vendor Address", "RFQ Number", "Total AMount", "Terms and Conditions")
val headers: List<String> = listOf(
"Quotation Number",
"Date",
"Open Till",
"Product Id",
"Product Name",
"Product Unit Price",
"Quantity",
"Vendor Name",
"Vendor Address",
"RFQ Number",
"Total AMount",
"Terms and Conditions"
)
createHeaderRow(headers, sh, wb)
val totalCols = headers.size
var rowCnt = 1
for (quote in quotes) {
val prodCnt = quote.products.size
for (j in 0..prodCnt - 1){
for (j in 0..<prodCnt) {
val row = sh.createRow(rowCnt++)
var i = 0;
row.createCell(i++).setCellValue(quote.quoteNum)
@ -172,13 +237,15 @@ fun ExportQuotations(quotes :List<Quotation>) {
row.createCell(i++).setCellValue(quote.tnc?.joinToString(";"))
}
}
saveExcelFileLocally("Quotes.xls", wb)
}
fun ExportVendors(vendors :List<Vendor>){
fun exportVendors(vendors: List<Vendor>) {
val wb = HSSFWorkbook()
val sh = wb.createSheet()
val headers : List<String> = listOf("Name", "MSME", "GST Number", "Address", "Rating", "Contact Name", "Contact Email", "Contact Mobile")
val headers: List<String> =
listOf("No.", "Name", "MSME", "GST Number", "Address", "Rating", "Contact Name", "Contact Email", "Contact Mobile")
createHeaderRow(headers, sh, wb)
val totalCols = headers.size
@ -186,9 +253,11 @@ fun ExportVendors(vendors :List<Vendor>){
for (vendor in vendors) {
val contactCnt = vendor.contacts.size
for (j in 0..contactCnt - 1){
for (j in 0..<contactCnt) {
val row = sh.createRow(rowCnt++)
var i = 0
row.createCell(i++).setCellValue((rowCnt - 1).toString())
row.createCell(i++).setCellValue(vendor.name)
row.createCell(i++).setCellValue(vendor.msme)
row.createCell(i++).setCellValue(vendor.gstNumber)
row.createCell(i++).setCellValue(vendor.address)
@ -198,16 +267,16 @@ fun ExportVendors(vendors :List<Vendor>){
row.createCell(i++).setCellValue(vendor.contacts[j].mobile)
}
}
saveExcelFileLocally("VendorList.xls", wb)
}
fun ExportProds(prods :List<Product>){
fun exportProds(prods: List<Product>) {
val wb = HSSFWorkbook()
val sh = wb.createSheet()
val headers: List<String> = listOf("Id", "Name", "Description", "HSN Code", "UOM")
createHeaderRow(headers, sh, wb)
val totalCols = headers.size
var rowCnt = 1
for (prod in prods) {
@ -219,20 +288,34 @@ fun ExportProds(prods :List<Product>){
row.createCell(i++).setCellValue(prod.hsnCode)
row.createCell(i++).setCellValue(prod.uom?.name)
}
saveExcelFileLocally("Products.xls", wb)
}
fun ExportPos(pos :List<PurchaseOrder>){
fun exportPos(pos: List<PurchaseOrder>) {
val wb = HSSFWorkbook()
val sh = wb.createSheet()
val headers : List<String> = listOf("Number", "Date", "Open Till", "Reference Quotation Number", "Vendor Name", "Vendor Address", "Product Id", "Product Name", "Unit Price", "Quantity", "Total Amount", "Terms and Conditions")
val headers: List<String> = listOf(
"Number",
"Date",
"Open Till",
"Reference Quotation Number",
"Vendor Name",
"Vendor Address",
"Product Id",
"Product Name",
"Unit Price",
"Quantity",
"Total Amount",
"Terms and Conditions"
)
createHeaderRow(headers, sh, wb)
val totalCols = headers.size
var rowCnt = 1
for (po in pos) {
val prodCnt = po.products.size
for (j in 0..prodCnt - 1){
for (j in 0..<prodCnt) {
val row = sh.createRow(rowCnt++)
var i = 0
row.createCell(i++).setCellValue(po.poNum)
@ -252,7 +335,9 @@ fun ExportPos(pos :List<PurchaseOrder>){
row.createCell(i++).setCellValue(po.tnc?.joinToString(";"))
}
}
saveExcelFileLocally("Pos.xls", wb)
}
fun main() {
//ImportFromExcel(FileType.QUOTES, "C:\\Users\\arsalan\\Downloads\\Book.xlsx")
TemplateExcelFile(FileType.PRODS)
@ -315,6 +400,7 @@ fun ImportFromExcel(fileType: FileType, filePath : String) {
// println("$v")
// }
}
FileType.POS -> {
//poNum, poDate, validTill, refQuoteNum, prodName, prodQuantity, totalAmount, products, vendorName, vendorGst, vendorAddress, tnc[]. docs[]
val PoMap: MutableMap<String, PurchaseOrder> = mutableMapOf()
@ -350,6 +436,7 @@ fun ImportFromExcel(fileType: FileType, filePath : String) {
}
}
}
FileType.VENDORS -> {
sh.rowIterator().forEach { row ->
//name, msme, gstNum, addresss, rating, contacts
@ -369,6 +456,7 @@ fun ImportFromExcel(fileType: FileType, filePath : String) {
vendor.rating = rating
}
}
FileType.PRODS -> {
sh.rowIterator().forEach { row ->
if (row == null) return@forEach
@ -393,6 +481,7 @@ fun ImportFromExcel(fileType: FileType, filePath : String) {
}
}
}
FileType.DOCS -> {
sh.rowIterator().forEach { row ->
//Document Name, Document Type, RefID, url

View File

@ -14,8 +14,8 @@ const val RATING_MIN = 0.0
//common filters would be used by most of the handlers
//require a list of vendor ids to be passed
data class CommonFilters(
val fromDate: LocalDate = baseDate,
val toDate: LocalDate = maxDate,
val from: LocalDate = baseDate,
val to: LocalDate = maxDate,
val vendor: List<Long>? = null,
val sortAsc: Boolean = true,
val sortBy: String = IGNORE
@ -97,14 +97,14 @@ fun <T> applyCommonFilters(q: io.ebean.ExpressionList<T>, commonFilters: CommonF
fun searchQuotes(commonFilters: CommonFilters, quoteFilters: QuoteFilters): List<Quotation> {
val q = database.find(Quotation::class.java)
.where()
.ge("quoteDate", commonFilters.fromDate)
.le("quoteDate", commonFilters.toDate)
.ge("quoteDate", commonFilters.from)
.le("quoteDate", commonFilters.to)
.ge("validTill", quoteFilters.validAfter)
.le("validTill", quoteFilters.validBefore)
.ge("totalAmount", quoteFilters.totalAmountExceeds)
.le("totalAmount", quoteFilters.totalAmountLessThan)
.ilike("quoteNum", "%" + quoteFilters.quoteNumLike + "%")
applyFromToHelper(q, commonFilters.fromDate, commonFilters.toDate, "quoteDate")
applyFromToHelper(q, commonFilters.from, commonFilters.to, "quoteDate")
applyVendorHelper(q, commonFilters.vendor)
applySortHelper(q, commonFilters.sortBy, commonFilters.sortAsc)
return q.findList()
@ -123,6 +123,18 @@ fun searchVendors(commonFilters: CommonFilters, vendorFilters: VendorFilters): L
return q.findList()
}
fun searchProducts(commonFilters: CommonFilters, productFilters: ProductFilters) : List<Product> {
val q = database.find(Product::class.java)
.where()
.ilike("name", "%" + productFilters.nameLike + "%")
.ilike("hsnCode", "%" + productFilters.hsnLike + "%")
if(productFilters.uom != UOM.ALL){
q.eq("uom", productFilters.uom)
}
applySortHelper(q, commonFilters.sortBy, commonFilters.sortAsc)
return q.findList()
}
fun searchDocs(commonFilters: CommonFilters, documentFilters: DocumentFilters): List<Document> {
val q = database.find(Document::class.java)
.where()
@ -147,7 +159,7 @@ fun searchPos(commonFilters: CommonFilters, poFilters: POFilters?): List<Purchas
.le("validTill", poFilters.validBefore)
.ilike("poNum", "%" + poFilters.poNumLike + "%")
.ilike("referenceQuotation", "%" + poFilters.refQuotation + "%")
applyFromToHelper(q, commonFilters.fromDate, commonFilters.toDate, "poDate")
applyFromToHelper(q, commonFilters.from, commonFilters.to, "poDate")
applyVendorHelper(q, commonFilters.vendor)
applySortHelper(q, commonFilters.sortBy, commonFilters.sortAsc)
return q.findList()

View File

@ -12,7 +12,13 @@ import java.time.LocalDateTime
import javax.persistence.*
data class Comments(val text: String = "", val by: String = "", val at: LocalDateTime = LocalDateTime.now())
data class POProducts(val productId: String = "", val productName: String = "", val unitPrice: Double = 0.0, val quantity: Double = 0.0, val description: String = "")
data class POProducts(
val productId: String = "",
val productName: String = "",
val unitPrice: Double = 0.0,
val quantity: Double = 0.0,
val description: String = ""
)
enum class ApprovalStatus {
@ -247,8 +253,14 @@ data class ContactPerson(val name: String = "", val email: String = "", val mobi
@Entity
open class Vendor : BaseTenantModel() {
fun patchValues(updatedVendor: Vendor) {
this.name = updatedVendor.name
this.msme = updatedVendor.msme
this.gstNumber = updatedVendor.gstNumber
this.address = updatedVendor.address
this.rating = updatedVendor.rating
this.contacts = updatedVendor.contacts
}
var name: String = ""
var msme: String = ""
var gstNumber: String = ""
@ -262,8 +274,15 @@ open class Vendor : BaseTenantModel() {
@Entity
open class PurchaseOrder : BaseTenantModel() {
fun patchValues(updatedPo: PurchaseOrder) {
this.poDate = updatedPo.poDate
this.validTill = updatedPo.validTill
this.tnc = updatedPo.tnc
this.products = updatedPo.products
this.vendor = updatedPo.vendor
this.documents = updatedPo.documents
this.totalAmount = updatedPo.totalAmount
}
@DbJsonB
var products: MutableList<POProducts> = mutableListOf()
@ -307,7 +326,15 @@ open class Product : BaseTenantModel() {
@Entity
open class Quotation : BaseTenantModel() {
fun patchValues(updatedQuote: Quotation) {
this.quoteDate = updatedQuote.quoteDate
this.vendorQuoteNum = updatedQuote.vendorQuoteNum
this.validTill = updatedQuote.validTill
this.reqForQuoteNum = updatedQuote.reqForQuoteNum
this.tnc = updatedQuote.tnc
this.products = updatedQuote.products
this.vendor = updatedQuote.vendor
this.documents = updatedQuote.documents
this.totalAmount = updatedQuote.totalAmount
}
@DbJsonB