feat: add column pos name
continuous-integration/drone/push Build is passing Details

pull/87/head
Firman Ramdhani 2024-09-11 12:38:16 +07:00
parent 07d1cc78e2
commit 9709c4719b
11 changed files with 46 additions and 2 deletions

View File

@ -0,0 +1,21 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class AddPosNameColumn1726033041774 implements MigrationInterface {
name = 'AddPosNameColumn1726033041774';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "transactions" ADD "creator_counter_name" character varying`,
);
await queryRunner.query(
`ALTER TABLE "logs_pos" ADD "pos_name" character varying`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "logs_pos" DROP COLUMN "pos_name"`);
await queryRunner.query(
`ALTER TABLE "transactions" DROP COLUMN "creator_counter_name"`,
);
}
}

View File

@ -14,6 +14,9 @@ export class PosLogModel
@Column('bigint', { name: 'pos_number', nullable: true })
pos_number: number;
@Column('varchar', { name: 'pos_name', nullable: true })
pos_name: string;
@Column('decimal', { name: 'total_balance', nullable: true })
total_balance: number;

View File

@ -3,6 +3,7 @@ import { BaseCoreEntity } from 'src/core/modules/domain/entities/base-core.entit
export interface PosLogEntity extends BaseCoreEntity {
type: PosLogType;
pos_number: number;
pos_name: string;
total_balance: number;
created_at: number;
creator_name: string;

View File

@ -26,6 +26,7 @@ export class RecordPosLogHandler implements IEventHandler<ChangeDocEvent> {
type: PosLogType[data.type],
total_balance: data.withdrawal_cash ?? data.opening_cash_balance,
pos_number: data.pos_number,
pos_name: data.pos_name,
creator_id: data.pos_admin?.id,
creator_name: data.pos_admin?.name ?? data.pos_admin?.username,
drawn_by_id: data.withdraw_user?.id,

View File

@ -47,6 +47,7 @@ export class IndexReconciliationManager extends BaseIndexManager<TransactionEnti
`${this.tableName}.customer_name`,
`${this.tableName}.creator_counter_no`,
`${this.tableName}.creator_counter_name`,
`${this.tableName}.invoice_code`,
`${this.tableName}.booking_date`,
@ -111,11 +112,20 @@ export class IndexReconciliationManager extends BaseIndexManager<TransactionEnti
});
}
if (this.filterParam.couner_no) {
if (this.filterParam.counter_no) {
queryBuilder.andWhere(
`${this.tableName}.creator_counter_no In (:...counters)`,
{
counters: [this.filterParam.couner_no],
counters: [this.filterParam.counter_no],
},
);
}
if (this.filterParam.counter_name) {
queryBuilder.andWhere(
`${this.tableName}.creator_counter_name In (:...counters)`,
{
counters: [this.filterParam.counter_name],
},
);
}

View File

@ -146,6 +146,7 @@ export class RecapReconciliationManager extends BaseCustomManager<TransactionEnt
booking_date: payment_date,
payment_date: payment_date,
creator_counter_no: first_transaction.creator_counter_no,
creator_counter_name: first_transaction.creator_counter_name,
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,

View File

@ -36,6 +36,9 @@ export class TransactionModel
@Column('int', { name: 'creator_counter_no', nullable: true })
creator_counter_no: number;
@Column('varchar', { name: 'creator_counter_name', nullable: true })
creator_counter_name: string;
// season data
@Column('varchar', { name: 'season_period_id', nullable: true })
season_period_id: string;

View File

@ -13,6 +13,7 @@ export interface TransactionEntity extends BaseStatusEntity {
type: TransactionType;
invoice_code: string;
creator_counter_no: number; // nomor pos transaksi dibuat
creator_counter_name: string; // name pos transaksi dibuat
// season data
season_period_id: string;

View File

@ -42,6 +42,7 @@ export class DetailTransactionManager extends BaseDetailManager<TransactionEntit
return [
`${this.tableName}.id`,
`${this.tableName}.creator_counter_no`,
`${this.tableName}.creator_counter_name`,
`${this.tableName}.creator_name`,
`${this.tableName}.created_at`,
`${this.tableName}.updated_at`,

View File

@ -118,6 +118,7 @@ export function mappingRevertTransaction(data, type) {
Object.assign(data, {
id: data.booking_id ?? data._id,
creator_counter_no: Number(data.pos_number),
creator_counter_name: data.pos_name,
settlement_date: new Date(data.created_at),
payment_date: isCancel ? null : new Date(data.created_at),
invoice_date: new Date(data.created_at),

View File

@ -55,6 +55,7 @@ export class IndexTransactionManager extends BaseIndexManager<TransactionEntity>
`${this.tableName}.status`,
`${this.tableName}.invoice_code`,
`${this.tableName}.creator_counter_no`,
`${this.tableName}.creator_counter_name`,
`${this.tableName}.booking_date`,
`${this.tableName}.no_of_group`,
`${this.tableName}.type`,