feat: add column check bill
This commit is contained in:
parent
feda138732
commit
6bc9c72df8
|
@ -16,6 +16,11 @@ export class Transactions extends BaseModel {
|
||||||
@Column()
|
@Column()
|
||||||
type: typeTransaction;
|
type: typeTransaction;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
check_bill: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
type: 'uuid',
|
type: 'uuid',
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
|
|
@ -50,7 +50,7 @@ export class TransactionService {
|
||||||
private commissionService: CommissionService,
|
private commissionService: CommissionService,
|
||||||
private supplierService: SupplierService,
|
private supplierService: SupplierService,
|
||||||
private connection: Connection,
|
private connection: Connection,
|
||||||
) {}
|
) { }
|
||||||
|
|
||||||
async addSupplierSaldo(addSaldoSupplier: AddSaldoSupplier, currentUser: any) {
|
async addSupplierSaldo(addSaldoSupplier: AddSaldoSupplier, currentUser: any) {
|
||||||
const supplier = await this.supplierService.findByCode(
|
const supplier = await this.supplierService.findByCode(
|
||||||
|
@ -481,7 +481,29 @@ export class TransactionService {
|
||||||
`${coaType[coaType.SALES]}-SYSTEM`,
|
`${coaType[coaType.SALES]}-SYSTEM`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (orderTransactionDto.bill_trx_id !== null) {
|
||||||
|
try {
|
||||||
|
const billId = await this.checkBillHistoryRepository.findOneOrFail({
|
||||||
|
where: {
|
||||||
|
id: orderTransactionDto.bill_trx_id
|
||||||
|
},
|
||||||
|
});
|
||||||
|
product_price.price = billId.amount
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof EntityNotFoundError) {
|
||||||
|
throw new HttpException(
|
||||||
|
{
|
||||||
|
statusCode: HttpStatus.NOT_FOUND,
|
||||||
|
error: 'Build not found',
|
||||||
|
},
|
||||||
|
HttpStatus.NOT_FOUND,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (coaAccount.amount < product_price.mark_up_price + product_price.price) {
|
if (coaAccount.amount < product_price.mark_up_price + product_price.price) {
|
||||||
throw new HttpException(
|
throw new HttpException(
|
||||||
|
@ -570,6 +592,7 @@ export class TransactionService {
|
||||||
transactionData.destination = orderTransactionDto.destination;
|
transactionData.destination = orderTransactionDto.destination;
|
||||||
transactionData.partner_trx_id = orderTransactionDto.trx_id;
|
transactionData.partner_trx_id = orderTransactionDto.trx_id;
|
||||||
transactionData.supplier_trx_id = trxId;
|
transactionData.supplier_trx_id = trxId;
|
||||||
|
transactionData.check_bill = orderTransactionDto.bill_trx_id;
|
||||||
|
|
||||||
if (!hitSupplier.success) {
|
if (!hitSupplier.success) {
|
||||||
transactionData.status = statusTransaction.FAILED;
|
transactionData.status = statusTransaction.FAILED;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user