|
|
|
@ -6,13 +6,30 @@ import {
|
|
|
|
|
REPORT_GROUP,
|
|
|
|
|
} from '../../../constant';
|
|
|
|
|
import { ReportConfigEntity } from '../../../entities/report-config.entity';
|
|
|
|
|
import { TransactionType } from 'src/modules/transaction/transaction/constants';
|
|
|
|
|
import { STATUS } from 'src/core/strings/constants/base.constants';
|
|
|
|
|
|
|
|
|
|
export default <ReportConfigEntity>{
|
|
|
|
|
group_name: REPORT_GROUP.transaction_report,
|
|
|
|
|
unique_name: `${REPORT_GROUP.transaction_report}__income`,
|
|
|
|
|
label: 'Pendapatan',
|
|
|
|
|
table_schema: 'season_types main',
|
|
|
|
|
table_schema: `transactions main
|
|
|
|
|
LEFT JOIN season_types s_period_type ON s_period_type.id::text = main.season_period_type_id
|
|
|
|
|
LEFT JOIN refunds refund ON refund.transaction_id = main.id and refund.status != 'cancel'
|
|
|
|
|
LEFT JOIN vip_codes vip ON vip.id::text = main.discount_code_id::text
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
select item.transaction_id, sum(item.total_hpp) AS total_hpp_item
|
|
|
|
|
from transaction_items item
|
|
|
|
|
group by item.transaction_id
|
|
|
|
|
) item ON item.transaction_id = main.id`,
|
|
|
|
|
main_table_alias: 'main',
|
|
|
|
|
whereDefaultConditions: [
|
|
|
|
|
{
|
|
|
|
|
column: 'main.status',
|
|
|
|
|
filter_type: FILTER_TYPE.TEXT_IN_MEMBER,
|
|
|
|
|
values: [STATUS.SETTLED, STATUS.REFUNDED, STATUS.PROCESS_REFUND],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
defaultOrderBy: [],
|
|
|
|
|
lowLevelOrderBy: [],
|
|
|
|
|
filter_period_config: {
|
|
|
|
@ -21,47 +38,291 @@ export default <ReportConfigEntity>{
|
|
|
|
|
|
|
|
|
|
column_configs: [
|
|
|
|
|
{
|
|
|
|
|
column: 'main__created_at',
|
|
|
|
|
query: 'main.created_at',
|
|
|
|
|
label: 'Created Date',
|
|
|
|
|
column: 'main__settlement_date',
|
|
|
|
|
query: 'main.settlement_date',
|
|
|
|
|
label: 'Tanggal Pendapatan',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.DATE_EPOCH,
|
|
|
|
|
format: DATA_FORMAT.DATE_TIMESTAMP,
|
|
|
|
|
date_format: 'DD/MM/YYYY',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__updated_at',
|
|
|
|
|
query: 'main.updated_at',
|
|
|
|
|
label: 'Updated Date',
|
|
|
|
|
column: 'main__type',
|
|
|
|
|
query: 'main.type',
|
|
|
|
|
label: 'Sumber',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.DATE_EPOCH,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__name',
|
|
|
|
|
query: 'main.name',
|
|
|
|
|
label: 'Name',
|
|
|
|
|
column: 's_period_type__name',
|
|
|
|
|
query: 's_period_type.name',
|
|
|
|
|
label: 'Tipe Rate',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__invoice_code',
|
|
|
|
|
query: 'main.invoice_code',
|
|
|
|
|
label: 'Kode Booking',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__payment_code',
|
|
|
|
|
query: 'main.payment_code',
|
|
|
|
|
label: 'Kode Pembayaran',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__customer_type',
|
|
|
|
|
query: 'main.customer_type',
|
|
|
|
|
label: 'Tipe Pelanggan',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__creator_counter_no',
|
|
|
|
|
query: 'main.creator_counter_no',
|
|
|
|
|
label: 'No.PoS',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__no_of_group',
|
|
|
|
|
query: 'main.no_of_group',
|
|
|
|
|
label: '#Visitor',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'item__total_hpp_item',
|
|
|
|
|
query: 'item.total_hpp_item',
|
|
|
|
|
label: 'Total HPP',
|
|
|
|
|
type: DATA_TYPE.MEASURE,
|
|
|
|
|
format: DATA_FORMAT.CURRENCY,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__reconciliation_mdr',
|
|
|
|
|
query: 'main.reconciliation_mdr',
|
|
|
|
|
label: 'MDR',
|
|
|
|
|
type: DATA_TYPE.MEASURE,
|
|
|
|
|
format: DATA_FORMAT.CURRENCY,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__payment_total_dpp',
|
|
|
|
|
query: 'main.payment_total_dpp',
|
|
|
|
|
label: 'DPP',
|
|
|
|
|
type: DATA_TYPE.MEASURE,
|
|
|
|
|
format: DATA_FORMAT.CURRENCY,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__payment_total_tax',
|
|
|
|
|
query: 'main.payment_total_tax',
|
|
|
|
|
label: 'Total Pajak',
|
|
|
|
|
type: DATA_TYPE.MEASURE,
|
|
|
|
|
format: DATA_FORMAT.CURRENCY,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__discount_percentage',
|
|
|
|
|
query: 'main.discount_percentage',
|
|
|
|
|
label: 'Diskon (%)',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.NUMBER,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__discount_value',
|
|
|
|
|
query: 'main.discount_value',
|
|
|
|
|
label: 'Diskon (IDR)',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.CURRENCY,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__payment_total',
|
|
|
|
|
query: 'main.payment_total',
|
|
|
|
|
label: 'Total Penjualan',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.CURRENCY,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'refund__refund_date',
|
|
|
|
|
query: 'refund.refund_date',
|
|
|
|
|
label: 'Tanggal Pengembalian',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.DATE_TIMESTAMP,
|
|
|
|
|
date_format: 'DD/MM/YYYY',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'refund__status',
|
|
|
|
|
query: 'refund.status',
|
|
|
|
|
label: 'Status Pengembalian',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'refund__code',
|
|
|
|
|
query: 'refund.code',
|
|
|
|
|
label: 'Kode Pengembalian',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'refund__refund_total',
|
|
|
|
|
query: '(refund.refund_total * -1)',
|
|
|
|
|
label: 'Total Pengembalian',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.CURRENCY,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'transaction_balance',
|
|
|
|
|
query: `CASE WHEN refund.id is null THEN main.payment_total ELSE main.payment_total - refund.refund_total END`,
|
|
|
|
|
label: 'Balance',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.CURRENCY,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__discount_code',
|
|
|
|
|
query: 'main.discount_code',
|
|
|
|
|
label: 'Kode Diskon',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'vip__creator_name',
|
|
|
|
|
query: 'vip.creator_name',
|
|
|
|
|
label: 'Diberikan Oleh',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__customer_name',
|
|
|
|
|
query: 'main.customer_name',
|
|
|
|
|
label: 'Nama Pelanggan',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__customer_description',
|
|
|
|
|
query: 'main.customer_description',
|
|
|
|
|
label: 'Deskripsi',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__customer_phone',
|
|
|
|
|
query: 'main.customer_phone',
|
|
|
|
|
label: 'Telepon',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__payment_type_method_name',
|
|
|
|
|
query: 'main.payment_type_method_name',
|
|
|
|
|
label: 'Bank/Issuer',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__payment_card_information',
|
|
|
|
|
query: 'main.payment_card_information',
|
|
|
|
|
label: 'Information',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__creator_name',
|
|
|
|
|
query: 'main.creator_name',
|
|
|
|
|
label: 'Penjualan Dibuat Oleh',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__reconciliation_confirm_by',
|
|
|
|
|
query: 'main.reconciliation_confirm_by',
|
|
|
|
|
label: 'Direkonsiliasi Oleh',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
column: 'main__creator_name',
|
|
|
|
|
query: 'main.creator_name',
|
|
|
|
|
label: 'Pengembalian Dibuat Oleh',
|
|
|
|
|
type: DATA_TYPE.DIMENSION,
|
|
|
|
|
format: DATA_FORMAT.TEXT,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
filter_configs: [
|
|
|
|
|
{
|
|
|
|
|
filed_label: 'Name',
|
|
|
|
|
filter_column: 'main__name',
|
|
|
|
|
field_type: FILTER_FIELD_TYPE.select,
|
|
|
|
|
filter_type: FILTER_TYPE.TEXT_IN_MEMBER,
|
|
|
|
|
select_data_source_url: '/v1/season-types',
|
|
|
|
|
select_custom_options: [],
|
|
|
|
|
select_label_key: 'name',
|
|
|
|
|
select_value_key: 'name',
|
|
|
|
|
filed_label: 'Tanggal Pendapatan',
|
|
|
|
|
filter_column: 'main__settlement_date',
|
|
|
|
|
field_type: FILTER_FIELD_TYPE.date_range_picker,
|
|
|
|
|
filter_type: FILTER_TYPE.DATE_IN_RANGE_TIMESTAMP,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
filed_label: 'Status',
|
|
|
|
|
filter_column: 'main__status',
|
|
|
|
|
field_type: FILTER_FIELD_TYPE.input_text,
|
|
|
|
|
filter_type: FILTER_TYPE.TEXT_EQUAL,
|
|
|
|
|
// select_data_source_url: '/v1/season-types',
|
|
|
|
|
// select_custom_options: [],
|
|
|
|
|
// select_label_key: 'code',
|
|
|
|
|
// select_value_key: 'code',
|
|
|
|
|
filed_label: 'Sumber',
|
|
|
|
|
filter_column: 'main__type',
|
|
|
|
|
field_type: FILTER_FIELD_TYPE.select,
|
|
|
|
|
filter_type: FILTER_TYPE.TEXT_IN_MEMBER,
|
|
|
|
|
select_custom_options: [...Object.values(TransactionType)],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
filed_label: 'Tipe Rate',
|
|
|
|
|
filter_column: 's_period_type__name',
|
|
|
|
|
field_type: FILTER_FIELD_TYPE.input_tag,
|
|
|
|
|
filter_type: FILTER_TYPE.TEXT_MULTIPLE_CONTAINS,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
filed_label: 'Kode Booking',
|
|
|
|
|
filter_column: 'main__invoice_code',
|
|
|
|
|
field_type: FILTER_FIELD_TYPE.input_tag,
|
|
|
|
|
filter_type: FILTER_TYPE.TEXT_MULTIPLE_CONTAINS,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
filed_label: 'Kode Pembayaran',
|
|
|
|
|
filter_column: 'main__payment_code',
|
|
|
|
|
field_type: FILTER_FIELD_TYPE.input_tag,
|
|
|
|
|
filter_type: FILTER_TYPE.TEXT_MULTIPLE_CONTAINS,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
filed_label: 'Tipe Pelanggan',
|
|
|
|
|
filter_column: 'main__customer_type',
|
|
|
|
|
field_type: FILTER_FIELD_TYPE.input_tag,
|
|
|
|
|
filter_type: FILTER_TYPE.TEXT_MULTIPLE_CONTAINS,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
filed_label: 'No. PoS',
|
|
|
|
|
filter_column: 'main__creator_counter_no',
|
|
|
|
|
field_type: FILTER_FIELD_TYPE.input_tag,
|
|
|
|
|
filter_type: FILTER_TYPE.TEXT_MULTIPLE_CONTAINS,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
filed_label: 'Tanggal Pengembalian',
|
|
|
|
|
filter_column: 'refund__refund_date',
|
|
|
|
|
field_type: FILTER_FIELD_TYPE.date_range_picker,
|
|
|
|
|
filter_type: FILTER_TYPE.DATE_IN_RANGE_TIMESTAMP,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
filed_label: 'Kode Pengembalian',
|
|
|
|
|
filter_column: 'refund__code',
|
|
|
|
|
field_type: FILTER_FIELD_TYPE.input_tag,
|
|
|
|
|
filter_type: FILTER_TYPE.TEXT_MULTIPLE_CONTAINS,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
filed_label: 'Kode Diskon',
|
|
|
|
|
filter_column: 'main__discount_code',
|
|
|
|
|
field_type: FILTER_FIELD_TYPE.input_tag,
|
|
|
|
|
filter_type: FILTER_TYPE.TEXT_MULTIPLE_CONTAINS,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
filed_label: 'Nama Pelanggan',
|
|
|
|
|
filter_column: 'main__customer_name',
|
|
|
|
|
field_type: FILTER_FIELD_TYPE.input_tag,
|
|
|
|
|
filter_type: FILTER_TYPE.TEXT_MULTIPLE_CONTAINS,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
filed_label: 'Bank/Issuer',
|
|
|
|
|
filter_column: 'main__payment_type_method_name',
|
|
|
|
|
field_type: FILTER_FIELD_TYPE.input_tag,
|
|
|
|
|
filter_type: FILTER_TYPE.TEXT_MULTIPLE_CONTAINS,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|