add: transaction billing

This commit is contained in:
ilham
2022-05-03 19:09:12 +07:00
parent 49e22932b6
commit 52839223e6
5 changed files with 198 additions and 2 deletions

View File

@@ -124,6 +124,7 @@ export class ProductService {
status: it[5] == 'active' ? 'ACTIVE' : 'NOT ACTIVE',
sub_categories: subCategories,
supplier: supplierData,
type: it[7] == 'postpaid' ? 'postpaid' : 'prepaid',
});
return await this.productHistoryPrice.insert({
@@ -355,12 +356,13 @@ export class ProductService {
};
}
async findOne(code: string) {
async findOne(code: string, type: string) {
try {
return await this.productRepository.findOneOrFail({
relations: ['supplier'],
where: {
code: code,
type: type,
},
});
} catch (e) {
@@ -436,7 +438,7 @@ export class ProductService {
code: string,
updatePriceProductDto: UpdatePriceProductDto,
) {
const product = await this.findOne(code);
const product = await this.findOne(code, updatePriceProductDto.productType);
await this.productHistoryPrice.insert({
product: product,