add vendor po fix and edits
This commit is contained in:
parent
444648178a
commit
a9961027d1
@ -27,7 +27,7 @@ data class CommonFilters(
|
|||||||
interface CustomFilters {}
|
interface CustomFilters {}
|
||||||
|
|
||||||
data class POFilters(
|
data class POFilters(
|
||||||
val poNumLike: String = IGNORE,
|
val poNumLike: String = "",
|
||||||
val totalAmountExceeds: Long = Long.MIN_VALUE,
|
val totalAmountExceeds: Long = Long.MIN_VALUE,
|
||||||
val totalAmountLessThan: Long = Long.MAX_VALUE,
|
val totalAmountLessThan: Long = Long.MAX_VALUE,
|
||||||
val validAfter: LocalDate = baseDate,
|
val validAfter: LocalDate = baseDate,
|
||||||
@ -134,7 +134,7 @@ fun <T> applySortHelper(q: io.ebean.ExpressionList<T>, sortBy: String, asc: Bool
|
|||||||
|
|
||||||
fun <T> applyFromToHelper(q: io.ebean.ExpressionList<T>, fromDate: LocalDate, toDate: LocalDate, colName: String) {
|
fun <T> applyFromToHelper(q: io.ebean.ExpressionList<T>, fromDate: LocalDate, toDate: LocalDate, colName: String) {
|
||||||
q.ge(colName, fromDate)
|
q.ge(colName, fromDate)
|
||||||
.le(colName, toDate)
|
.lt(colName, toDate.plusDays(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T> applyCommonFilters(q: io.ebean.ExpressionList<T>, commonFilters: CommonFilters) {
|
fun <T> applyCommonFilters(q: io.ebean.ExpressionList<T>, commonFilters: CommonFilters) {
|
||||||
@ -161,12 +161,8 @@ fun searchQuotes(commonFilters: CommonFilters, quoteFilters: QuoteFilters): List
|
|||||||
fun searchVendors(commonFilters: CommonFilters, vendorFilters: VendorFilters): List<Vendor> {
|
fun searchVendors(commonFilters: CommonFilters, vendorFilters: VendorFilters): List<Vendor> {
|
||||||
val q = database.find(Vendor::class.java)
|
val q = database.find(Vendor::class.java)
|
||||||
.where()
|
.where()
|
||||||
.ge("rating", vendorFilters.ratingExceeds)
|
|
||||||
.le("rating", vendorFilters.ratingLessThan)
|
|
||||||
.ilike("name", "%" + vendorFilters.nameLike + "%")
|
.ilike("name", "%" + vendorFilters.nameLike + "%")
|
||||||
.ilike("msme", "%" + vendorFilters.msmeLike + "%")
|
|
||||||
.ilike("gstNumber", "%" + vendorFilters.gstNumLike + "%")
|
.ilike("gstNumber", "%" + vendorFilters.gstNumLike + "%")
|
||||||
.ilike("address", "%" + vendorFilters.addressLike + "%")
|
|
||||||
applySortHelper(q, commonFilters.sortBy, commonFilters.sortAsc)
|
applySortHelper(q, commonFilters.sortBy, commonFilters.sortAsc)
|
||||||
return q.findList()
|
return q.findList()
|
||||||
}
|
}
|
||||||
@ -208,8 +204,11 @@ fun searchPos(commonFilters: CommonFilters, poFilters0: POFilters?): List<Purcha
|
|||||||
val poFilters = poFilters0 ?: POFilters()
|
val poFilters = poFilters0 ?: POFilters()
|
||||||
val q = database.find(PurchaseOrder::class.java)
|
val q = database.find(PurchaseOrder::class.java)
|
||||||
.where()
|
.where()
|
||||||
.ilike("poNum", "%" + poFilters.poNumLike + "%")
|
.apply {
|
||||||
.ilike("referenceQuotation", "%" + poFilters.refQuotation + "%")
|
if (poFilters.poNumLike.isNotEmpty()) {
|
||||||
|
ilike("poNum", "%" + poFilters.poNumLike + "%")
|
||||||
|
}
|
||||||
|
}
|
||||||
applyFromToHelper(q, commonFilters.from, commonFilters.to, "poDate")
|
applyFromToHelper(q, commonFilters.from, commonFilters.to, "poDate")
|
||||||
applyVendorHelper(q, commonFilters.vendor)
|
applyVendorHelper(q, commonFilters.vendor)
|
||||||
applySortHelper(q, commonFilters.sortBy, commonFilters.sortAsc)
|
applySortHelper(q, commonFilters.sortBy, commonFilters.sortAsc)
|
||||||
|
|||||||
@ -66,11 +66,14 @@ open class PurchaseOrder : BaseTenantModel() {
|
|||||||
this.vendor = updatedPo.vendor
|
this.vendor = updatedPo.vendor
|
||||||
this.documents = updatedPo.documents
|
this.documents = updatedPo.documents
|
||||||
this.totalAmount = updatedPo.totalAmount
|
this.totalAmount = updatedPo.totalAmount
|
||||||
|
this.allLoadingSite = updatedPo.allLoadingSite
|
||||||
|
this.allUnloadingSite = updatedPo.allUnloadingSite
|
||||||
|
this.unloadingPlantId = updatedPo.unloadingPlantId
|
||||||
|
this.loadingSiteId = updatedPo.loadingSiteId
|
||||||
}
|
}
|
||||||
|
|
||||||
@DbJsonB
|
@DbJsonB
|
||||||
var products: MutableList<POProducts> = mutableListOf()
|
var products: MutableList<POProducts> = mutableListOf()
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
var vendor: Vendor? = null
|
var vendor: Vendor? = null
|
||||||
var referenceQuotation: String? = ""
|
var referenceQuotation: String? = ""
|
||||||
@ -79,6 +82,12 @@ open class PurchaseOrder : BaseTenantModel() {
|
|||||||
var poDate: LocalDate? = null
|
var poDate: LocalDate? = null
|
||||||
var validTill: LocalDate? = null
|
var validTill: LocalDate? = null
|
||||||
|
|
||||||
|
var allLoadingSite: Boolean = true
|
||||||
|
var allUnloadingSite: Boolean = true
|
||||||
|
|
||||||
|
var unloadingPlantId: String? = null
|
||||||
|
var loadingSiteId: UUID? = null
|
||||||
|
|
||||||
@DbArray
|
@DbArray
|
||||||
var tnc: List<String>? = arrayListOf()
|
var tnc: List<String>? = arrayListOf()
|
||||||
|
|
||||||
|
|||||||
5
src/main/resources/dbmigration/1.33.sql
Normal file
5
src/main/resources/dbmigration/1.33.sql
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
-- apply alter tables
|
||||||
|
alter table purchase_order add column if not exists all_loading_site boolean default true not null;
|
||||||
|
alter table purchase_order add column if not exists all_unloading_site boolean default true not null;
|
||||||
|
alter table purchase_order add column if not exists unloading_plant_id varchar(255);
|
||||||
|
alter table purchase_order add column if not exists loading_site_id uuid;
|
||||||
11
src/main/resources/dbmigration/model/1.33.model.xml
Normal file
11
src/main/resources/dbmigration/model/1.33.model.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<migration xmlns="http://ebean-orm.github.io/xml/ns/dbmigration">
|
||||||
|
<changeSet type="apply">
|
||||||
|
<addColumn tableName="purchase_order">
|
||||||
|
<column name="all_loading_site" type="boolean" defaultValue="true" notnull="true"/>
|
||||||
|
<column name="all_unloading_site" type="boolean" defaultValue="true" notnull="true"/>
|
||||||
|
<column name="unloading_plant_id" type="varchar"/>
|
||||||
|
<column name="loading_site_id" type="uuid"/>
|
||||||
|
</addColumn>
|
||||||
|
</changeSet>
|
||||||
|
</migration>
|
||||||
@ -21,7 +21,7 @@
|
|||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!-- SQL and bind values -->
|
<!-- SQL and bind values -->
|
||||||
<logger name="io.ebean.SQL" level="INFO"/>
|
<logger name="io.ebean.SQL" level="DEBUG"/>
|
||||||
<logger name="org.apache.http.client.protocol.ResponseProcessCookies" level="ERROR"/>
|
<logger name="org.apache.http.client.protocol.ResponseProcessCookies" level="ERROR"/>
|
||||||
|
|
||||||
<!-- Transaction Commit and Rollback events -->
|
<!-- Transaction Commit and Rollback events -->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user