add sell price percentage
This commit is contained in:
23
src/model/item_price.ts
Normal file
23
src/model/item_price.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { SelectQueryBuilder } from "typeorm";
|
||||
import CommonHelper from "../helpers/common";
|
||||
import { OrmHelper } from "../helpers/orm";
|
||||
import { ItemPrice } from "entity";
|
||||
|
||||
export class ItemPriceModel {
|
||||
static async list(filter = {}): Promise<SelectQueryBuilder<any>> {
|
||||
const repo = OrmHelper.DB.getRepository(ItemPrice);
|
||||
let whereAttr: string[] = [];
|
||||
let whereVal: any = {};
|
||||
if (filter && Object.keys(filter).length > 0) {
|
||||
whereAttr = [...whereAttr, ...CommonHelper.handleQueryFilter(filter, "item_price").whereAttr];
|
||||
whereVal = { ...whereVal, ...CommonHelper.handleQueryFilter(filter, "item_price").whereVal };
|
||||
}
|
||||
|
||||
var query = repo.createQueryBuilder("item_price").leftJoinAndSelect("item_price.item_master", "item_master");
|
||||
if (whereAttr.length != 0) {
|
||||
query = query.where(whereAttr.join(" and "), whereVal);
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
}
|
||||
25
src/model/selling_price_percentage.ts
Normal file
25
src/model/selling_price_percentage.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { SelectQueryBuilder } from "typeorm";
|
||||
import CommonHelper from "../helpers/common";
|
||||
import { OrmHelper } from "../helpers/orm";
|
||||
import { SellingPricePercentage } from "entity";
|
||||
|
||||
export class SellingPricePercentageModel {
|
||||
static async list(filter = {}): Promise<SelectQueryBuilder<any>> {
|
||||
const repo = OrmHelper.DB.getRepository(SellingPricePercentage);
|
||||
let whereAttr: string[] = [];
|
||||
let whereVal: any = {};
|
||||
if (filter && Object.keys(filter).length > 0) {
|
||||
whereAttr = [...whereAttr, ...CommonHelper.handleQueryFilter(filter, "selling_price_percentage").whereAttr];
|
||||
whereVal = { ...whereVal, ...CommonHelper.handleQueryFilter(filter, "selling_price_percentage").whereVal };
|
||||
}
|
||||
|
||||
var query = repo.createQueryBuilder("selling_price_percentage")
|
||||
.leftJoinAndSelect("selling_price_percentage.item_master", "item_master")
|
||||
.leftJoinAndSelect("selling_price_percentage.item_origin", "item_origin");
|
||||
if (whereAttr.length != 0) {
|
||||
query = query.where(whereAttr.join(" and "), whereVal);
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user