fix: error image and typo
continuous-integration/drone/tag Build is passing Details

pull/53/head devel_20.1.0
shancheas 2024-08-05 14:43:42 +07:00
parent ebfcbb85fe
commit 8999ed1bf0
6 changed files with 43 additions and 45 deletions

View File

@ -1,9 +1,9 @@
import { InvoiceTempalte } from '../invoice.template';
const PdfPrinter = require('pdfmake');
const { PassThrough } = require('stream');
import { InvoiceTemplate } from '../invoice.template';
import * as PdfPrinter from 'pdfmake';
import { PassThrough } from 'stream';
export async function GeneratePdf(transaction, invoiceType, banks) {
var fonts = {
const fonts = {
Roboto: {
normal: './fonts/Roboto-Regular.ttf',
bold: './fonts/Roboto-Medium.ttf',
@ -14,7 +14,7 @@ export async function GeneratePdf(transaction, invoiceType, banks) {
const printer = new PdfPrinter(fonts);
const docDefinition = InvoiceTempalte(transaction, invoiceType, banks);
const docDefinition = InvoiceTemplate(transaction, invoiceType, banks);
const createPdfBuffer = (docDefinition) => {
return new Promise((resolve, reject) => {

View File

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

View File

@ -11,7 +11,7 @@ import { InvoiceType } from '../../constants';
import { PaymentMethodEntity } from 'src/modules/transaction/payment-method/domain/entities/payment-method.entity';
import * as fs from 'fs';
export function InvoiceTempalte(
export function InvoiceTemplate(
transaction: TransactionEntity,
invoiceType: InvoiceType,
banks: PaymentMethodEntity[],
@ -52,37 +52,37 @@ export function InvoiceTempalte(
{
layout: {
defaultBorder: false,
hLineWidth: function (i, node) {
hLineWidth: function () {
return 1;
},
vLineWidth: function (i, node) {
vLineWidth: function () {
return 1;
},
hLineColor: function (i, node) {
hLineColor: function (i) {
return i === 0 ? '#000000' : '#eaeaea';
},
vLineColor: function (i, node) {
vLineColor: function () {
return '#eaeaea';
},
hLineStyle: function (i, node) {
hLineStyle: function () {
// if (i === 0 || i === node.table.body.length) {
return null;
//}
},
// vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; },
paddingLeft: function (i, node) {
paddingLeft: function () {
return 10;
},
paddingRight: function (i, node) {
paddingRight: function () {
return 10;
},
paddingTop: function (i, node) {
paddingTop: function () {
return 3;
},
paddingBottom: function (i, node) {
paddingBottom: function () {
return 3;
},
fillColor: function (rowIndex, node, columnIndex) {
fillColor: function () {
return '#fff';
},
},
@ -95,37 +95,37 @@ export function InvoiceTempalte(
{
layout: {
defaultBorder: false,
hLineWidth: function (i, node) {
hLineWidth: function () {
return 1;
},
vLineWidth: function (i, node) {
vLineWidth: function () {
return 1;
},
hLineColor: function (i, node) {
hLineColor: function (i) {
return i === 3 ? '#000000' : '#eaeaea';
},
vLineColor: function (i, node) {
vLineColor: function () {
return '#eaeaea';
},
hLineStyle: function (i, node) {
hLineStyle: function () {
// if (i === 0 || i === node.table.body.length) {
return null;
//}
},
// vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; },
paddingLeft: function (i, node) {
// vLineStyle: function () { return {dash: { length: 10, space: 4 }}; },
paddingLeft: function () {
return 10;
},
paddingRight: function (i, node) {
paddingRight: function () {
return 10;
},
paddingTop: function (i, node) {
paddingTop: function () {
return 3;
},
paddingBottom: function (i, node) {
paddingBottom: function (i) {
return i === 2 ? 20 : 3;
},
fillColor: function (rowIndex, node, columnIndex) {
fillColor: function () {
return '#fff';
},
},
@ -145,37 +145,37 @@ export function InvoiceTempalte(
{
layout: {
defaultBorder: false,
hLineWidth: function (i, node) {
hLineWidth: function () {
return 1;
},
vLineWidth: function (i, node) {
vLineWidth: function () {
return 1;
},
hLineColor: function (i, node) {
hLineColor: function (i) {
return i === 0 ? '#000000' : '#eaeaea';
},
vLineColor: function (i, node) {
vLineColor: function () {
return '#eaeaea';
},
hLineStyle: function (i, node) {
hLineStyle: function () {
// if (i === 0 || i === node.table.body.length) {
return null;
//}
},
// vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; },
paddingLeft: function (i, node) {
// vLineStyle: function () { return {dash: { length: 10, space: 4 }}; },
paddingLeft: function () {
return 10;
},
paddingRight: function (i, node) {
paddingRight: function () {
return 10;
},
paddingTop: function (i, node) {
paddingTop: function () {
return 20;
},
paddingBottom: function (i, node) {
paddingBottom: function () {
return 3;
},
fillColor: function (rowIndex, node, columnIndex) {
fillColor: function () {
return '#fff';
},
},

View File

@ -44,7 +44,7 @@ export async function sendEmail(receivers, invoiceType, attachment?) {
await new Promise((f) => setTimeout(f, 2000));
smtpTransport.sendMail(emailContext, function (err, data) {
smtpTransport.sendMail(emailContext, function (err) {
if (err) {
console.log(err, `Error occurs on send to ${receiver.email}`);
} else {

View File

@ -9,8 +9,6 @@ import * as fs from 'fs';
@Public()
@Injectable()
export class MailTemplateController {
constructor() {}
getTemplate(templateName) {
const templatePath = path.join(
__dirname,
@ -52,6 +50,6 @@ export class MailTemplateController {
@Get('refund-request')
async getRefundRequest() {
return this.getTemplate('refunr-request');
return this.getTemplate('refund-request');
}
}

View File

@ -4,7 +4,7 @@ import { EventTopics } from 'src/core/strings/constants/interface.constants';
import { TransactionType } from 'src/modules/transaction/transaction/constants';
import { TransactionModel } from 'src/modules/transaction/transaction/data/models/transaction.model';
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 moment from 'moment';
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({
where: {
is_recap_transaction: false,
paymnet_type: TransactionType.COUNTER,
payment_type: TransactionType.COUNTER,
status: STATUS.SETTLED,
created_at: Between(this.startOfDay, this.endOfDay),
},
@ -72,7 +72,7 @@ export class RecapReconciliationManager extends BaseCustomManager<TransactionEnt
payment_type_method_id,
} = first_transaction;
let query = {
const query = {
is_recap_transaction: true,
created_at: Between(this.startOfDay, this.endOfDay),
creator_counter_no: creator_counter_no,