add vendor address list
This commit is contained in:
parent
4d7f5ccdfb
commit
ae11f05aba
@ -431,7 +431,17 @@ fun exportInvoices(invoices: List<Invoice>) {
|
|||||||
val sh = wb.createSheet()
|
val sh = wb.createSheet()
|
||||||
|
|
||||||
val headers: List<String> = listOf(
|
val headers: List<String> = listOf(
|
||||||
"Number", "Date", "Reference PO", "Status", "Vendor Name", "Vendor Address", "Product Id", "Product Name", "Unit Price", "Quantity", "Total Amount"
|
"Number",
|
||||||
|
"Date",
|
||||||
|
"Reference PO",
|
||||||
|
"Status",
|
||||||
|
"Vendor Name",
|
||||||
|
"Vendor Address",
|
||||||
|
"Product Id",
|
||||||
|
"Product Name",
|
||||||
|
"Unit Price",
|
||||||
|
"Quantity",
|
||||||
|
"Total Amount"
|
||||||
)
|
)
|
||||||
createHeaderRow(headers, sh, wb)
|
createHeaderRow(headers, sh, wb)
|
||||||
|
|
||||||
@ -571,7 +581,7 @@ fun ImportFromExcel(fileType: FileType, filePath: String) {
|
|||||||
|
|
||||||
FileType.POS -> {
|
FileType.POS -> {
|
||||||
//poNum, poDate, validTill, refQuoteNum, prodName, prodQuantity, totalAmount, products, vendorName, vendorGst, vendorAddress, tnc[]. docs[]
|
//poNum, poDate, validTill, refQuoteNum, prodName, prodQuantity, totalAmount, products, vendorName, vendorGst, vendorAddress, tnc[]. docs[]
|
||||||
val PoMap: MutableMap<String, PurchaseOrder> = mutableMapOf()
|
val poMap: MutableMap<String, PurchaseOrder> = mutableMapOf()
|
||||||
sh.rowIterator().forEach { row ->
|
sh.rowIterator().forEach { row ->
|
||||||
if (row == null) return@forEach
|
if (row == null) return@forEach
|
||||||
val poNum = stringFromCellHelper(row.getCell(0))
|
val poNum = stringFromCellHelper(row.getCell(0))
|
||||||
@ -586,10 +596,21 @@ fun ImportFromExcel(fileType: FileType, filePath: String) {
|
|||||||
val totalPoAmount = doubleFromCellHelper(row.getCell(9))
|
val totalPoAmount = doubleFromCellHelper(row.getCell(9))
|
||||||
//tncs, docs
|
//tncs, docs
|
||||||
|
|
||||||
val prod = POProducts("", prodName, 0.0, prodQuantity, "")
|
val prod = POProducts(
|
||||||
if (PoMap.containsKey(poNum)) {
|
productId = "",
|
||||||
|
productName = prodName,
|
||||||
|
unitPrice = 0.0,
|
||||||
|
quantity = prodQuantity,
|
||||||
|
billQty = prodQuantity,
|
||||||
|
gstPct = 0.0,
|
||||||
|
taxableValue = 0.0,
|
||||||
|
totalValue = 0.0,
|
||||||
|
description = "",
|
||||||
|
uom = ""
|
||||||
|
)
|
||||||
|
if (poMap.containsKey(poNum)) {
|
||||||
//repeated row
|
//repeated row
|
||||||
PoMap.get(poNum)?.products?.add(prod)
|
poMap.get(poNum)?.products?.add(prod)
|
||||||
} else {
|
} else {
|
||||||
val vendor = Vendor()
|
val vendor = Vendor()
|
||||||
vendor.name = vendorName
|
vendor.name = vendorName
|
||||||
@ -600,7 +621,7 @@ fun ImportFromExcel(fileType: FileType, filePath: String) {
|
|||||||
po.poDate = poDate
|
po.poDate = poDate
|
||||||
po.referenceQuotation = refQuoteNum
|
po.referenceQuotation = refQuoteNum
|
||||||
po.validTill = poValidTill
|
po.validTill = poValidTill
|
||||||
PoMap.put(poNum, po)
|
poMap[poNum] = po
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -251,8 +251,13 @@ class SafeStringDeserializer : JsonDeserializer<String>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum class AddressType {
|
||||||
|
BILLING, SHIPPING
|
||||||
|
}
|
||||||
data class ContactPerson(val name: String = "", val email: String = "", val mobile: String = "")
|
data class ContactPerson(val name: String = "", val email: String = "", val mobile: String = "")
|
||||||
|
data class Address(val type: AddressType = AddressType.BILLING,
|
||||||
|
val address: String = "",
|
||||||
|
val pincode: String = "")
|
||||||
@Entity
|
@Entity
|
||||||
open class Vendor : BaseTenantModel() {
|
open class Vendor : BaseTenantModel() {
|
||||||
fun patchValues(updatedVendor: Vendor) {
|
fun patchValues(updatedVendor: Vendor) {
|
||||||
@ -264,6 +269,7 @@ open class Vendor : BaseTenantModel() {
|
|||||||
this.contacts = updatedVendor.contacts
|
this.contacts = updatedVendor.contacts
|
||||||
this.outstanding = updatedVendor.outstanding
|
this.outstanding = updatedVendor.outstanding
|
||||||
this.asOnWhichDate = updatedVendor.asOnWhichDate
|
this.asOnWhichDate = updatedVendor.asOnWhichDate
|
||||||
|
this.addressList = updatedVendor.addressList
|
||||||
}
|
}
|
||||||
|
|
||||||
var name: String = ""
|
var name: String = ""
|
||||||
@ -274,6 +280,8 @@ open class Vendor : BaseTenantModel() {
|
|||||||
var outstanding: Double? = 0.0
|
var outstanding: Double? = 0.0
|
||||||
var asOnWhichDate: LocalDate? = null
|
var asOnWhichDate: LocalDate? = null
|
||||||
|
|
||||||
|
@DbJsonB
|
||||||
|
var addressList: List<Address>? = mutableListOf()
|
||||||
@DbJsonB
|
@DbJsonB
|
||||||
var contacts: List<ContactPerson> = mutableListOf()
|
var contacts: List<ContactPerson> = mutableListOf()
|
||||||
|
|
||||||
|
|||||||
2
src/main/resources/dbmigration/1.27.sql
Normal file
2
src/main/resources/dbmigration/1.27.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
-- apply alter tables
|
||||||
|
alter table vendor add column if not exists address_list jsonb;
|
||||||
8
src/main/resources/dbmigration/model/1.27.model.xml
Normal file
8
src/main/resources/dbmigration/model/1.27.model.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<migration xmlns="http://ebean-orm.github.io/xml/ns/dbmigration">
|
||||||
|
<changeSet type="apply">
|
||||||
|
<addColumn tableName="vendor">
|
||||||
|
<column name="address_list" type="jsonb"/>
|
||||||
|
</addColumn>
|
||||||
|
</changeSet>
|
||||||
|
</migration>
|
||||||
Loading…
x
Reference in New Issue
Block a user