Merge branch 'development' of ssh://git.eigen.co.id:2222/eigen/pos-be into development
continuous-integration/drone/tag Build is passing
Details
continuous-integration/drone/tag Build is passing
Details
commit
b9927da0c4
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 504 KiB |
|
@ -32,7 +32,6 @@ export class PaymentTransactionHandler
|
||||||
const current_data = event.data.data;
|
const current_data = event.data.data;
|
||||||
const data_id = current_data.transaction_id ?? event.data.id;
|
const data_id = current_data.transaction_id ?? event.data.id;
|
||||||
const from_refund = event.data.module == TABLE_NAME.REFUND;
|
const from_refund = event.data.module == TABLE_NAME.REFUND;
|
||||||
console.log('payment handlet', { data_id });
|
|
||||||
|
|
||||||
const payments = await this.paymentService.getManyByOptions({
|
const payments = await this.paymentService.getManyByOptions({
|
||||||
where: {
|
where: {
|
||||||
|
@ -106,6 +105,15 @@ export class PaymentTransactionHandler
|
||||||
`;
|
`;
|
||||||
})}
|
})}
|
||||||
</ul>`,
|
</ul>`,
|
||||||
|
|
||||||
|
refund_items_data: transaction?.['refund']?.refund_items
|
||||||
|
?.filter((item) => Number(item.qty_refund) > 0)
|
||||||
|
.map((item) => {
|
||||||
|
return {
|
||||||
|
qty_refund: item.qty_refund,
|
||||||
|
item_name: item.transaction_item.item_name,
|
||||||
|
};
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ export async function sendEmail(receivers, invoiceType, attachment?) {
|
||||||
for (const receiver of receivers) {
|
for (const receiver of receivers) {
|
||||||
try {
|
try {
|
||||||
const templateName = getTemplate(receiver.payment_type, invoiceType);
|
const templateName = getTemplate(receiver.payment_type, invoiceType);
|
||||||
const templatePath = `./assets/email-template/${templateName}.html`;
|
const templatePath = `./assets/email-template/redesign/${templateName}.html`;
|
||||||
const templateSource = fs.readFileSync(templatePath, 'utf8');
|
const templateSource = fs.readFileSync(templatePath, 'utf8');
|
||||||
|
|
||||||
const template = handlebars.compile(templateSource);
|
const template = handlebars.compile(templateSource);
|
||||||
|
|
|
@ -0,0 +1,340 @@
|
||||||
|
import {
|
||||||
|
DATA_FORMAT,
|
||||||
|
DATA_TYPE,
|
||||||
|
FILTER_FIELD_TYPE,
|
||||||
|
FILTER_TYPE,
|
||||||
|
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_per_item_master`,
|
||||||
|
label: 'Pendapatan Per Item Master',
|
||||||
|
table_schema: `transactions main
|
||||||
|
LEFT JOIN transaction_items tr_item ON tr_item.transaction_id::text = main.id::text
|
||||||
|
LEFT JOIN transaction_item_breakdowns tr_item_bundling ON tr_item_bundling.transaction_item_id::text = tr_item.id::text
|
||||||
|
LEFT JOIN refunds refund ON refund.transaction_id = main.id
|
||||||
|
LEFT JOIN items item ON item.id::text = tr_item.item_id::text
|
||||||
|
LEFT JOIN users tenant ON tenant.id::text = item.tenant_id::text
|
||||||
|
LEFT JOIN refund_items refund_item ON refund_item.refund_item_id::text = tr_item.item_id::text`,
|
||||||
|
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: {
|
||||||
|
hidden: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
column_configs: [
|
||||||
|
{
|
||||||
|
column: 'main__settlement_date',
|
||||||
|
query: 'main.settlement_date',
|
||||||
|
label: 'Tanggal Pendapatan',
|
||||||
|
type: DATA_TYPE.DIMENSION,
|
||||||
|
format: DATA_FORMAT.DATE_TIMESTAMP,
|
||||||
|
date_format: 'DD/MM/YYYY',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
column: 'item_owner',
|
||||||
|
query: `CASE WHEN tenant.name is not null THEN tenant.name ELSE 'Company' END`,
|
||||||
|
label: 'Kepemilikan',
|
||||||
|
type: DATA_TYPE.DIMENSION,
|
||||||
|
format: DATA_FORMAT.TEXT,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
column: 'main__type',
|
||||||
|
query: 'main.type',
|
||||||
|
label: 'Sumber',
|
||||||
|
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: 'tr_item__item_category_name',
|
||||||
|
query: 'tr_item.item_category_name',
|
||||||
|
label: 'Kategori Item',
|
||||||
|
type: DATA_TYPE.DIMENSION,
|
||||||
|
format: DATA_FORMAT.TEXT,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
column: 'tr_item__item_name',
|
||||||
|
query: 'tr_item.item_name',
|
||||||
|
label: 'Nama Item',
|
||||||
|
type: DATA_TYPE.DIMENSION,
|
||||||
|
format: DATA_FORMAT.TEXT,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
column: 'tr_item__breakdown_bundling',
|
||||||
|
query: 'tr_item.breakdown_bundling',
|
||||||
|
label: 'Breakdown Bundling',
|
||||||
|
type: DATA_TYPE.DIMENSION,
|
||||||
|
format: DATA_FORMAT.BOOLEAN,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
column: 'tr_item_bundling__item_name',
|
||||||
|
query: 'tr_item_bundling.item_name',
|
||||||
|
label: 'Nama Item Bundling',
|
||||||
|
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: 'tr_item__qty',
|
||||||
|
query: 'tr_item.qty',
|
||||||
|
label: 'Qty',
|
||||||
|
type: DATA_TYPE.DIMENSION,
|
||||||
|
format: DATA_FORMAT.NUMBER,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
column: 'tr_item__total_hpp',
|
||||||
|
query: 'tr_item.total_hpp',
|
||||||
|
label: 'Total HPP',
|
||||||
|
type: DATA_TYPE.MEASURE,
|
||||||
|
format: DATA_FORMAT.CURRENCY,
|
||||||
|
},
|
||||||
|
// TODO => tambahkan total dpp per item
|
||||||
|
// TODO => tambahkan total tax
|
||||||
|
{
|
||||||
|
column: 'tr_item__total_price',
|
||||||
|
query: 'tr_item.total_price',
|
||||||
|
label: 'Total Penjualan',
|
||||||
|
type: DATA_TYPE.MEASURE,
|
||||||
|
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_item__qty_refund',
|
||||||
|
query: 'refund_item.qty_refund',
|
||||||
|
label: 'Qty Pengembalian',
|
||||||
|
type: DATA_TYPE.DIMENSION,
|
||||||
|
format: DATA_FORMAT.NUMBER,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
column: 'refund_item__refund_total',
|
||||||
|
query: '(refund_item.refund_total * -1)',
|
||||||
|
label: 'Total Pengembalian',
|
||||||
|
type: DATA_TYPE.MEASURE,
|
||||||
|
format: DATA_FORMAT.CURRENCY,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
column: 'transaction_balance',
|
||||||
|
query: `CASE WHEN refund.id is null THEN tr_item.total_price ELSE tr_item.total_price - refund_item.refund_total END`,
|
||||||
|
label: 'Balance',
|
||||||
|
type: DATA_TYPE.MEASURE,
|
||||||
|
format: DATA_FORMAT.CURRENCY,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
column: 'tr_item__item_tenant_share_margin',
|
||||||
|
query: 'tr_item.item_tenant_share_margin',
|
||||||
|
label: 'Profile Share (IDR)',
|
||||||
|
type: DATA_TYPE.MEASURE,
|
||||||
|
format: DATA_FORMAT.CURRENCY,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
column: 'tenant_income',
|
||||||
|
query: 'tr_item.total_price - tr_item.item_tenant_share_margin',
|
||||||
|
label: 'Pendapatan Tenant',
|
||||||
|
type: DATA_TYPE.DIMENSION,
|
||||||
|
format: DATA_FORMAT.CURRENCY,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
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__creator_name',
|
||||||
|
query: 'main.creator_name',
|
||||||
|
label: 'Dibuat Oleh',
|
||||||
|
type: DATA_TYPE.DIMENSION,
|
||||||
|
format: DATA_FORMAT.TEXT,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
whereCondition(filterModel) {
|
||||||
|
const queryFilter = [];
|
||||||
|
const breakdown = filterModel.tr_item__breakdown_bundling;
|
||||||
|
if (breakdown) {
|
||||||
|
const value = breakdown.filter.map((item) => {
|
||||||
|
return item === 'Yes' ? true : false;
|
||||||
|
});
|
||||||
|
|
||||||
|
queryFilter.push(`tr_item.breakdown_bundling in (${value.join()})`);
|
||||||
|
}
|
||||||
|
return queryFilter;
|
||||||
|
},
|
||||||
|
ignore_filter_keys: ['tr_item__breakdown_bundling'],
|
||||||
|
filter_configs: [
|
||||||
|
{
|
||||||
|
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: 'Kepemilikan',
|
||||||
|
filter_column: 'item_owner',
|
||||||
|
field_type: FILTER_FIELD_TYPE.input_tag,
|
||||||
|
filter_type: FILTER_TYPE.TEXT_MULTIPLE_CONTAINS,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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: '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: 'Kategori Item',
|
||||||
|
filter_column: 'tr_item__item_category_name',
|
||||||
|
field_type: FILTER_FIELD_TYPE.input_tag,
|
||||||
|
filter_type: FILTER_TYPE.TEXT_MULTIPLE_CONTAINS,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filed_label: 'Nama Item',
|
||||||
|
filter_column: 'tr_item__item_name',
|
||||||
|
field_type: FILTER_FIELD_TYPE.input_tag,
|
||||||
|
filter_type: FILTER_TYPE.TEXT_MULTIPLE_CONTAINS,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filed_label: 'Breakdown Item',
|
||||||
|
filter_column: 'tr_item__breakdown_bundling',
|
||||||
|
field_type: FILTER_FIELD_TYPE.select,
|
||||||
|
filter_type: FILTER_TYPE.TEXT_MULTIPLE_CONTAINS,
|
||||||
|
select_custom_options: ['Yes', 'No'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filed_label: 'Nama Item Bundling',
|
||||||
|
filter_column: 'tr_item_bundling__item_name',
|
||||||
|
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: '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,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filed_label: 'Dibuat Oleh',
|
||||||
|
filter_column: 'main__creator_name',
|
||||||
|
field_type: FILTER_FIELD_TYPE.input_tag,
|
||||||
|
filter_type: FILTER_TYPE.TEXT_MULTIPLE_CONTAINS,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
|
@ -2,6 +2,7 @@ import { ReportConfigEntity } from '../../entities/report-config.entity';
|
||||||
|
|
||||||
import IncomeReport from './configs/income';
|
import IncomeReport from './configs/income';
|
||||||
import IncomeReportPerItem from './configs/income-per-item';
|
import IncomeReportPerItem from './configs/income-per-item';
|
||||||
|
import IncomeReportPerItemMaster from './configs/income-per-item-master';
|
||||||
import GivingDiscount from './configs/giving-discounts';
|
import GivingDiscount from './configs/giving-discounts';
|
||||||
import VisitorsPerRideReport from './configs/visitors-per-ride';
|
import VisitorsPerRideReport from './configs/visitors-per-ride';
|
||||||
import TimePerRideReport from './configs/time-per-ride';
|
import TimePerRideReport from './configs/time-per-ride';
|
||||||
|
@ -14,6 +15,7 @@ import ReconciliationReport from './configs/reconciliation';
|
||||||
export const TransactionReportConfig: ReportConfigEntity[] = [
|
export const TransactionReportConfig: ReportConfigEntity[] = [
|
||||||
IncomeReport,
|
IncomeReport,
|
||||||
IncomeReportPerItem,
|
IncomeReportPerItem,
|
||||||
|
IncomeReportPerItemMaster,
|
||||||
GivingDiscount,
|
GivingDiscount,
|
||||||
// VisitorsPerRideReport,
|
// VisitorsPerRideReport,
|
||||||
// TimePerRideReport,
|
// TimePerRideReport,
|
||||||
|
|
|
@ -24,7 +24,13 @@ export class CreatePaymentMethodManager extends BaseCreateManager<PaymentMethodE
|
||||||
}
|
}
|
||||||
|
|
||||||
get uniqueColumns(): columnUniques[] {
|
get uniqueColumns(): columnUniques[] {
|
||||||
return [{ column: 'account_number' }, { column: 'account_name' }];
|
// return [{ column: 'account_number' }, { column: 'account_name' }];
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
column: 'account_number',
|
||||||
|
query: { account_name: this.data.account_name, type: this.data.type },
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
get eventTopics(): EventTopics[] {
|
get eventTopics(): EventTopics[] {
|
||||||
|
|
|
@ -28,7 +28,13 @@ export class UpdatePaymentMethodManager extends BaseUpdateManager<PaymentMethodE
|
||||||
}
|
}
|
||||||
|
|
||||||
get uniqueColumns(): columnUniques[] {
|
get uniqueColumns(): columnUniques[] {
|
||||||
return [{ column: 'account_number' }, { column: 'account_name' }];
|
// return [{ column: 'account_number' }, { column: 'account_name' }];
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
column: 'account_number',
|
||||||
|
query: { account_name: this.data.account_name, type: this.data.type },
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
get entityTarget(): any {
|
get entityTarget(): any {
|
||||||
|
|
Loading…
Reference in New Issue