fix(SPG-750) Ketika sales di PoS di cancel, pada rekondiliasi - recap, valuenya tidak berkurang

fix/data
Aswin Ashar Abdullah 2024-08-02 17:53:29 +07:00
parent 8eee99fce5
commit 0bec3c6590
1 changed files with 20 additions and 19 deletions

View File

@ -35,27 +35,24 @@ export class RecapReconciliationManager extends BaseCustomManager<TransactionEnt
const transactions = await this.dataService.getManyByOptions({
where: {
is_recap_transaction: false,
type: TransactionType.COUNTER,
paymnet_type: TransactionType.COUNTER,
status: STATUS.SETTLED,
created_at: Between(this.startOfDay, this.endOfDay),
},
});
const payCounserTransactions = await this.dataService.getManyByOptions({
where: {
is_recap_transaction: false,
payment_code: ILike('%SLS%'),
status: STATUS.SETTLED,
created_at: Between(this.startOfDay, this.endOfDay),
},
});
transactions.push(...payCounserTransactions);
for (const transaction of transactions) {
const { creator_counter_no, payment_type, payment_type_method_id } =
transaction;
const {
creator_counter_no,
payment_type_counter,
payment_type_method_id,
} = transaction;
const group_by =
creator_counter_no + '-' + payment_type + '-' + payment_type_method_id;
creator_counter_no +
'-' +
payment_type_counter +
'-' +
payment_type_method_id;
if (!this.recapTransactions[group_by]) {
this.recapTransactions[group_by] = [];
}
@ -69,17 +66,20 @@ export class RecapReconciliationManager extends BaseCustomManager<TransactionEnt
const total_recap = Object.keys(this.recapTransactions);
for (const recap of total_recap) {
const first_transaction = this.recapTransactions[recap][0];
const { creator_counter_no, payment_type, payment_type_method_id } =
first_transaction;
const {
creator_counter_no,
payment_type_counter,
payment_type_method_id,
} = first_transaction;
let query = {
is_recap_transaction: true,
created_at: Between(this.startOfDay, this.endOfDay),
creator_counter_no: creator_counter_no,
payment_type: payment_type,
payment_type: payment_type_counter,
};
if (payment_type != 'cash')
if (payment_type_counter != 'cash')
query['payment_type_method_id'] = payment_type_method_id ?? EMPTY_UUID;
const exist = await this.dataService.getOneByOptions({
@ -110,7 +110,8 @@ export class RecapReconciliationManager extends BaseCustomManager<TransactionEnt
booking_date: new Date(),
payment_date: new Date(),
creator_counter_no: first_transaction.creator_counter_no,
payment_type: first_transaction.payment_type,
payment_type: first_transaction.payment_type_counter,
payment_type_counter: first_transaction.payment_type_counter,
payment_type_method_id: first_transaction.payment_type_method_id,
payment_type_method_number:
first_transaction.payment_type_method_number,