fix(SPG-750) Ketika sales di PoS di cancel, pada rekondiliasi - recap, valuenya tidak berkurang
parent
8eee99fce5
commit
0bec3c6590
|
@ -35,27 +35,24 @@ export class RecapReconciliationManager extends BaseCustomManager<TransactionEnt
|
||||||
const transactions = await this.dataService.getManyByOptions({
|
const transactions = await this.dataService.getManyByOptions({
|
||||||
where: {
|
where: {
|
||||||
is_recap_transaction: false,
|
is_recap_transaction: false,
|
||||||
type: TransactionType.COUNTER,
|
paymnet_type: TransactionType.COUNTER,
|
||||||
status: STATUS.SETTLED,
|
status: STATUS.SETTLED,
|
||||||
created_at: Between(this.startOfDay, this.endOfDay),
|
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) {
|
for (const transaction of transactions) {
|
||||||
const { creator_counter_no, payment_type, payment_type_method_id } =
|
const {
|
||||||
transaction;
|
creator_counter_no,
|
||||||
|
payment_type_counter,
|
||||||
|
payment_type_method_id,
|
||||||
|
} = transaction;
|
||||||
const group_by =
|
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]) {
|
if (!this.recapTransactions[group_by]) {
|
||||||
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);
|
const total_recap = Object.keys(this.recapTransactions);
|
||||||
for (const recap of total_recap) {
|
for (const recap of total_recap) {
|
||||||
const first_transaction = this.recapTransactions[recap][0];
|
const first_transaction = this.recapTransactions[recap][0];
|
||||||
const { creator_counter_no, payment_type, payment_type_method_id } =
|
const {
|
||||||
first_transaction;
|
creator_counter_no,
|
||||||
|
payment_type_counter,
|
||||||
|
payment_type_method_id,
|
||||||
|
} = first_transaction;
|
||||||
|
|
||||||
let query = {
|
let query = {
|
||||||
is_recap_transaction: true,
|
is_recap_transaction: true,
|
||||||
created_at: Between(this.startOfDay, this.endOfDay),
|
created_at: Between(this.startOfDay, this.endOfDay),
|
||||||
creator_counter_no: creator_counter_no,
|
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;
|
query['payment_type_method_id'] = payment_type_method_id ?? EMPTY_UUID;
|
||||||
|
|
||||||
const exist = await this.dataService.getOneByOptions({
|
const exist = await this.dataService.getOneByOptions({
|
||||||
|
@ -110,7 +110,8 @@ export class RecapReconciliationManager extends BaseCustomManager<TransactionEnt
|
||||||
booking_date: new Date(),
|
booking_date: new Date(),
|
||||||
payment_date: new Date(),
|
payment_date: new Date(),
|
||||||
creator_counter_no: first_transaction.creator_counter_no,
|
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_id: first_transaction.payment_type_method_id,
|
||||||
payment_type_method_number:
|
payment_type_method_number:
|
||||||
first_transaction.payment_type_method_number,
|
first_transaction.payment_type_method_number,
|
||||||
|
|
Loading…
Reference in New Issue