feat(SPG-997): add report vip code
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
f2c409fc35
commit
e2a6878e71
|
@ -0,0 +1,98 @@
|
|||
import {
|
||||
DATA_FORMAT,
|
||||
DATA_TYPE,
|
||||
FILTER_FIELD_TYPE,
|
||||
FILTER_TYPE,
|
||||
REPORT_GROUP,
|
||||
} from '../../../constant';
|
||||
import { ReportConfigEntity } from '../../../entities/report-config.entity';
|
||||
|
||||
export default <ReportConfigEntity>{
|
||||
group_name: REPORT_GROUP.transaction_report,
|
||||
unique_name: `${REPORT_GROUP.transaction_report}__vid_code`,
|
||||
label: 'Kode VIP',
|
||||
table_schema: `vip_codes main
|
||||
LEFT JOIN (
|
||||
select
|
||||
tr.discount_code_id AS vip_code_id,
|
||||
COUNT(tr.discount_code_id) AS total_transaction
|
||||
from transactions tr
|
||||
where tr.discount_code_id is not null
|
||||
group by tr.discount_code_id
|
||||
) voucher_used ON voucher_used.vip_code_id::uuid = main.id`,
|
||||
main_table_alias: 'main',
|
||||
whereDefaultConditions: [],
|
||||
defaultOrderBy: [],
|
||||
lowLevelOrderBy: [],
|
||||
filter_period_config: {
|
||||
hidden: true,
|
||||
},
|
||||
|
||||
column_configs: [
|
||||
{
|
||||
column: 'main__code',
|
||||
query: 'main.code',
|
||||
label: 'Kode Voucher',
|
||||
type: DATA_TYPE.DIMENSION,
|
||||
format: DATA_FORMAT.TEXT,
|
||||
},
|
||||
{
|
||||
column: 'main__discount',
|
||||
query: 'CASE WHEN main.discount > 0 THEN main.discount ELSE null END',
|
||||
label: 'Diskon (%)',
|
||||
type: DATA_TYPE.DIMENSION,
|
||||
format: DATA_FORMAT.TEXT,
|
||||
},
|
||||
{
|
||||
column: 'main__discount_value',
|
||||
query:
|
||||
'CASE WHEN main.discount_value > 0 THEN main.discount_value ELSE null END',
|
||||
label: 'Diskon (Rp)',
|
||||
type: DATA_TYPE.DIMENSION,
|
||||
format: DATA_FORMAT.CURRENCY,
|
||||
},
|
||||
{
|
||||
column: 'voucher_used__total_transaction',
|
||||
query: 'voucher_used.total_transaction',
|
||||
label: 'Jumlah Transaksi',
|
||||
type: DATA_TYPE.MEASURE,
|
||||
format: DATA_FORMAT.TEXT,
|
||||
},
|
||||
{
|
||||
column: 'main__created_at',
|
||||
query: 'main.created_at',
|
||||
label: 'Tgl. Dibuat',
|
||||
type: DATA_TYPE.DIMENSION,
|
||||
format: DATA_FORMAT.DATE_EPOCH,
|
||||
date_format: 'DD-MM-YYYY',
|
||||
},
|
||||
{
|
||||
column: 'main__creator_name',
|
||||
query: 'main.creator_name',
|
||||
label: 'Dibuat Oleh',
|
||||
type: DATA_TYPE.DIMENSION,
|
||||
format: DATA_FORMAT.TEXT,
|
||||
},
|
||||
],
|
||||
filter_configs: [
|
||||
{
|
||||
filed_label: 'Kode Voucher',
|
||||
filter_column: 'main__code',
|
||||
field_type: FILTER_FIELD_TYPE.input_tag,
|
||||
filter_type: FILTER_TYPE.TEXT_MULTIPLE_CONTAINS,
|
||||
},
|
||||
{
|
||||
filed_label: 'Dibuat Oleh',
|
||||
filter_column: 'main__creator_name',
|
||||
field_type: FILTER_FIELD_TYPE.input_tag,
|
||||
filter_type: FILTER_TYPE.TEXT_MULTIPLE_CONTAINS,
|
||||
},
|
||||
|
||||
{
|
||||
filed_label: 'Tgl. Dibuat',
|
||||
filter_column: 'main__created_at',
|
||||
field_type: FILTER_FIELD_TYPE.date_range_picker,
|
||||
filter_type: FILTER_TYPE.DATE_IN_RANGE_EPOCH,
|
||||
},
|
||||
],
|
||||
};
|
|
@ -12,6 +12,7 @@ import CashWithdrawalsReport from './configs/cash-withdrawals';
|
|||
import ReconciliationReport from './configs/reconciliation';
|
||||
import TaxReport from './configs/tax';
|
||||
import DemographyReport from './configs/demography';
|
||||
import VipCodeReport from './configs/vip_code';
|
||||
|
||||
export const TransactionReportConfig: ReportConfigEntity[] = [
|
||||
IncomeReport,
|
||||
|
@ -26,4 +27,5 @@ export const TransactionReportConfig: ReportConfigEntity[] = [
|
|||
ReconciliationReport,
|
||||
TaxReport,
|
||||
DemographyReport,
|
||||
VipCodeReport,
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue