fix: error image and typo
continuous-integration/drone/tag Build is passing
Details
continuous-integration/drone/tag Build is passing
Details
parent
ebfcbb85fe
commit
8999ed1bf0
|
@ -1,9 +1,9 @@
|
||||||
import { InvoiceTempalte } from '../invoice.template';
|
import { InvoiceTemplate } from '../invoice.template';
|
||||||
const PdfPrinter = require('pdfmake');
|
import * as PdfPrinter from 'pdfmake';
|
||||||
const { PassThrough } = require('stream');
|
import { PassThrough } from 'stream';
|
||||||
|
|
||||||
export async function GeneratePdf(transaction, invoiceType, banks) {
|
export async function GeneratePdf(transaction, invoiceType, banks) {
|
||||||
var fonts = {
|
const fonts = {
|
||||||
Roboto: {
|
Roboto: {
|
||||||
normal: './fonts/Roboto-Regular.ttf',
|
normal: './fonts/Roboto-Regular.ttf',
|
||||||
bold: './fonts/Roboto-Medium.ttf',
|
bold: './fonts/Roboto-Medium.ttf',
|
||||||
|
@ -14,7 +14,7 @@ export async function GeneratePdf(transaction, invoiceType, banks) {
|
||||||
|
|
||||||
const printer = new PdfPrinter(fonts);
|
const printer = new PdfPrinter(fonts);
|
||||||
|
|
||||||
const docDefinition = InvoiceTempalte(transaction, invoiceType, banks);
|
const docDefinition = InvoiceTemplate(transaction, invoiceType, banks);
|
||||||
|
|
||||||
const createPdfBuffer = (docDefinition) => {
|
const createPdfBuffer = (docDefinition) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
|
@ -11,7 +11,7 @@ import { InvoiceType } from '../../constants';
|
||||||
import { PaymentMethodEntity } from 'src/modules/transaction/payment-method/domain/entities/payment-method.entity';
|
import { PaymentMethodEntity } from 'src/modules/transaction/payment-method/domain/entities/payment-method.entity';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
export function InvoiceTempalte(
|
export function InvoiceTemplate(
|
||||||
transaction: TransactionEntity,
|
transaction: TransactionEntity,
|
||||||
invoiceType: InvoiceType,
|
invoiceType: InvoiceType,
|
||||||
banks: PaymentMethodEntity[],
|
banks: PaymentMethodEntity[],
|
||||||
|
@ -52,37 +52,37 @@ export function InvoiceTempalte(
|
||||||
{
|
{
|
||||||
layout: {
|
layout: {
|
||||||
defaultBorder: false,
|
defaultBorder: false,
|
||||||
hLineWidth: function (i, node) {
|
hLineWidth: function () {
|
||||||
return 1;
|
return 1;
|
||||||
},
|
},
|
||||||
vLineWidth: function (i, node) {
|
vLineWidth: function () {
|
||||||
return 1;
|
return 1;
|
||||||
},
|
},
|
||||||
hLineColor: function (i, node) {
|
hLineColor: function (i) {
|
||||||
return i === 0 ? '#000000' : '#eaeaea';
|
return i === 0 ? '#000000' : '#eaeaea';
|
||||||
},
|
},
|
||||||
vLineColor: function (i, node) {
|
vLineColor: function () {
|
||||||
return '#eaeaea';
|
return '#eaeaea';
|
||||||
},
|
},
|
||||||
hLineStyle: function (i, node) {
|
hLineStyle: function () {
|
||||||
// if (i === 0 || i === node.table.body.length) {
|
// if (i === 0 || i === node.table.body.length) {
|
||||||
return null;
|
return null;
|
||||||
//}
|
//}
|
||||||
},
|
},
|
||||||
// vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; },
|
// vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; },
|
||||||
paddingLeft: function (i, node) {
|
paddingLeft: function () {
|
||||||
return 10;
|
return 10;
|
||||||
},
|
},
|
||||||
paddingRight: function (i, node) {
|
paddingRight: function () {
|
||||||
return 10;
|
return 10;
|
||||||
},
|
},
|
||||||
paddingTop: function (i, node) {
|
paddingTop: function () {
|
||||||
return 3;
|
return 3;
|
||||||
},
|
},
|
||||||
paddingBottom: function (i, node) {
|
paddingBottom: function () {
|
||||||
return 3;
|
return 3;
|
||||||
},
|
},
|
||||||
fillColor: function (rowIndex, node, columnIndex) {
|
fillColor: function () {
|
||||||
return '#fff';
|
return '#fff';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -95,37 +95,37 @@ export function InvoiceTempalte(
|
||||||
{
|
{
|
||||||
layout: {
|
layout: {
|
||||||
defaultBorder: false,
|
defaultBorder: false,
|
||||||
hLineWidth: function (i, node) {
|
hLineWidth: function () {
|
||||||
return 1;
|
return 1;
|
||||||
},
|
},
|
||||||
vLineWidth: function (i, node) {
|
vLineWidth: function () {
|
||||||
return 1;
|
return 1;
|
||||||
},
|
},
|
||||||
hLineColor: function (i, node) {
|
hLineColor: function (i) {
|
||||||
return i === 3 ? '#000000' : '#eaeaea';
|
return i === 3 ? '#000000' : '#eaeaea';
|
||||||
},
|
},
|
||||||
vLineColor: function (i, node) {
|
vLineColor: function () {
|
||||||
return '#eaeaea';
|
return '#eaeaea';
|
||||||
},
|
},
|
||||||
hLineStyle: function (i, node) {
|
hLineStyle: function () {
|
||||||
// if (i === 0 || i === node.table.body.length) {
|
// if (i === 0 || i === node.table.body.length) {
|
||||||
return null;
|
return null;
|
||||||
//}
|
//}
|
||||||
},
|
},
|
||||||
// vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; },
|
// vLineStyle: function () { return {dash: { length: 10, space: 4 }}; },
|
||||||
paddingLeft: function (i, node) {
|
paddingLeft: function () {
|
||||||
return 10;
|
return 10;
|
||||||
},
|
},
|
||||||
paddingRight: function (i, node) {
|
paddingRight: function () {
|
||||||
return 10;
|
return 10;
|
||||||
},
|
},
|
||||||
paddingTop: function (i, node) {
|
paddingTop: function () {
|
||||||
return 3;
|
return 3;
|
||||||
},
|
},
|
||||||
paddingBottom: function (i, node) {
|
paddingBottom: function (i) {
|
||||||
return i === 2 ? 20 : 3;
|
return i === 2 ? 20 : 3;
|
||||||
},
|
},
|
||||||
fillColor: function (rowIndex, node, columnIndex) {
|
fillColor: function () {
|
||||||
return '#fff';
|
return '#fff';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -145,37 +145,37 @@ export function InvoiceTempalte(
|
||||||
{
|
{
|
||||||
layout: {
|
layout: {
|
||||||
defaultBorder: false,
|
defaultBorder: false,
|
||||||
hLineWidth: function (i, node) {
|
hLineWidth: function () {
|
||||||
return 1;
|
return 1;
|
||||||
},
|
},
|
||||||
vLineWidth: function (i, node) {
|
vLineWidth: function () {
|
||||||
return 1;
|
return 1;
|
||||||
},
|
},
|
||||||
hLineColor: function (i, node) {
|
hLineColor: function (i) {
|
||||||
return i === 0 ? '#000000' : '#eaeaea';
|
return i === 0 ? '#000000' : '#eaeaea';
|
||||||
},
|
},
|
||||||
vLineColor: function (i, node) {
|
vLineColor: function () {
|
||||||
return '#eaeaea';
|
return '#eaeaea';
|
||||||
},
|
},
|
||||||
hLineStyle: function (i, node) {
|
hLineStyle: function () {
|
||||||
// if (i === 0 || i === node.table.body.length) {
|
// if (i === 0 || i === node.table.body.length) {
|
||||||
return null;
|
return null;
|
||||||
//}
|
//}
|
||||||
},
|
},
|
||||||
// vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; },
|
// vLineStyle: function () { return {dash: { length: 10, space: 4 }}; },
|
||||||
paddingLeft: function (i, node) {
|
paddingLeft: function () {
|
||||||
return 10;
|
return 10;
|
||||||
},
|
},
|
||||||
paddingRight: function (i, node) {
|
paddingRight: function () {
|
||||||
return 10;
|
return 10;
|
||||||
},
|
},
|
||||||
paddingTop: function (i, node) {
|
paddingTop: function () {
|
||||||
return 20;
|
return 20;
|
||||||
},
|
},
|
||||||
paddingBottom: function (i, node) {
|
paddingBottom: function () {
|
||||||
return 3;
|
return 3;
|
||||||
},
|
},
|
||||||
fillColor: function (rowIndex, node, columnIndex) {
|
fillColor: function () {
|
||||||
return '#fff';
|
return '#fff';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -44,7 +44,7 @@ export async function sendEmail(receivers, invoiceType, attachment?) {
|
||||||
|
|
||||||
await new Promise((f) => setTimeout(f, 2000));
|
await new Promise((f) => setTimeout(f, 2000));
|
||||||
|
|
||||||
smtpTransport.sendMail(emailContext, function (err, data) {
|
smtpTransport.sendMail(emailContext, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err, `Error occurs on send to ${receiver.email}`);
|
console.log(err, `Error occurs on send to ${receiver.email}`);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -9,8 +9,6 @@ import * as fs from 'fs';
|
||||||
@Public()
|
@Public()
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MailTemplateController {
|
export class MailTemplateController {
|
||||||
constructor() {}
|
|
||||||
|
|
||||||
getTemplate(templateName) {
|
getTemplate(templateName) {
|
||||||
const templatePath = path.join(
|
const templatePath = path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
|
@ -52,6 +50,6 @@ export class MailTemplateController {
|
||||||
|
|
||||||
@Get('refund-request')
|
@Get('refund-request')
|
||||||
async getRefundRequest() {
|
async getRefundRequest() {
|
||||||
return this.getTemplate('refunr-request');
|
return this.getTemplate('refund-request');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { EventTopics } from 'src/core/strings/constants/interface.constants';
|
||||||
import { TransactionType } from 'src/modules/transaction/transaction/constants';
|
import { TransactionType } from 'src/modules/transaction/transaction/constants';
|
||||||
import { TransactionModel } from 'src/modules/transaction/transaction/data/models/transaction.model';
|
import { TransactionModel } from 'src/modules/transaction/transaction/data/models/transaction.model';
|
||||||
import { TransactionEntity } from 'src/modules/transaction/transaction/domain/entities/transaction.entity';
|
import { TransactionEntity } from 'src/modules/transaction/transaction/domain/entities/transaction.entity';
|
||||||
import { Between, ILike } from 'typeorm';
|
import { Between } from 'typeorm';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { EMPTY_UUID, STATUS } from 'src/core/strings/constants/base.constants';
|
import { EMPTY_UUID, STATUS } from 'src/core/strings/constants/base.constants';
|
||||||
|
@ -35,7 +35,7 @@ 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,
|
||||||
paymnet_type: TransactionType.COUNTER,
|
payment_type: TransactionType.COUNTER,
|
||||||
status: STATUS.SETTLED,
|
status: STATUS.SETTLED,
|
||||||
created_at: Between(this.startOfDay, this.endOfDay),
|
created_at: Between(this.startOfDay, this.endOfDay),
|
||||||
},
|
},
|
||||||
|
@ -72,7 +72,7 @@ export class RecapReconciliationManager extends BaseCustomManager<TransactionEnt
|
||||||
payment_type_method_id,
|
payment_type_method_id,
|
||||||
} = first_transaction;
|
} = first_transaction;
|
||||||
|
|
||||||
let query = {
|
const 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,
|
||||||
|
|
Loading…
Reference in New Issue