add vendor po fix and edits
This commit is contained in:
@@ -27,7 +27,7 @@ data class CommonFilters(
|
||||
interface CustomFilters {}
|
||||
|
||||
data class POFilters(
|
||||
val poNumLike: String = IGNORE,
|
||||
val poNumLike: String = "",
|
||||
val totalAmountExceeds: Long = Long.MIN_VALUE,
|
||||
val totalAmountLessThan: Long = Long.MAX_VALUE,
|
||||
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) {
|
||||
q.ge(colName, fromDate)
|
||||
.le(colName, toDate)
|
||||
.lt(colName, toDate.plusDays(1))
|
||||
}
|
||||
|
||||
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> {
|
||||
val q = database.find(Vendor::class.java)
|
||||
.where()
|
||||
.ge("rating", vendorFilters.ratingExceeds)
|
||||
.le("rating", vendorFilters.ratingLessThan)
|
||||
.ilike("name", "%" + vendorFilters.nameLike + "%")
|
||||
.ilike("msme", "%" + vendorFilters.msmeLike + "%")
|
||||
.ilike("gstNumber", "%" + vendorFilters.gstNumLike + "%")
|
||||
.ilike("address", "%" + vendorFilters.addressLike + "%")
|
||||
applySortHelper(q, commonFilters.sortBy, commonFilters.sortAsc)
|
||||
return q.findList()
|
||||
}
|
||||
@@ -208,8 +204,11 @@ fun searchPos(commonFilters: CommonFilters, poFilters0: POFilters?): List<Purcha
|
||||
val poFilters = poFilters0 ?: POFilters()
|
||||
val q = database.find(PurchaseOrder::class.java)
|
||||
.where()
|
||||
.ilike("poNum", "%" + poFilters.poNumLike + "%")
|
||||
.ilike("referenceQuotation", "%" + poFilters.refQuotation + "%")
|
||||
.apply {
|
||||
if (poFilters.poNumLike.isNotEmpty()) {
|
||||
ilike("poNum", "%" + poFilters.poNumLike + "%")
|
||||
}
|
||||
}
|
||||
applyFromToHelper(q, commonFilters.from, commonFilters.to, "poDate")
|
||||
applyVendorHelper(q, commonFilters.vendor)
|
||||
applySortHelper(q, commonFilters.sortBy, commonFilters.sortAsc)
|
||||
|
||||
@@ -66,11 +66,14 @@ open class PurchaseOrder : BaseTenantModel() {
|
||||
this.vendor = updatedPo.vendor
|
||||
this.documents = updatedPo.documents
|
||||
this.totalAmount = updatedPo.totalAmount
|
||||
this.allLoadingSite = updatedPo.allLoadingSite
|
||||
this.allUnloadingSite = updatedPo.allUnloadingSite
|
||||
this.unloadingPlantId = updatedPo.unloadingPlantId
|
||||
this.loadingSiteId = updatedPo.loadingSiteId
|
||||
}
|
||||
|
||||
@DbJsonB
|
||||
var products: MutableList<POProducts> = mutableListOf()
|
||||
|
||||
@ManyToOne
|
||||
var vendor: Vendor? = null
|
||||
var referenceQuotation: String? = ""
|
||||
@@ -79,6 +82,12 @@ open class PurchaseOrder : BaseTenantModel() {
|
||||
var poDate: LocalDate? = null
|
||||
var validTill: LocalDate? = null
|
||||
|
||||
var allLoadingSite: Boolean = true
|
||||
var allUnloadingSite: Boolean = true
|
||||
|
||||
var unloadingPlantId: String? = null
|
||||
var loadingSiteId: UUID? = null
|
||||
|
||||
@DbArray
|
||||
var tnc: List<String>? = arrayListOf()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user