@tomei/finance 0.11.8-dev.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/document/document.js +165 -165
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -426,31 +426,31 @@ class Document extends account_system_entity_1.AccountSystemEntity {
|
|
|
426
426
|
}, imgTag);
|
|
427
427
|
const currentDate = date.toLocaleDateString('en-GB');
|
|
428
428
|
const invoiceNo = this.DocNo;
|
|
429
|
-
const invoiceTitleInfo = `
|
|
430
|
-
<div class="tm_invoice_seperator tm_gray_bg"></div>
|
|
431
|
-
<div class="tm_invoice_info_list">
|
|
432
|
-
<p class="tm_invoice_number tm_m0">
|
|
433
|
-
Invoice No: <b class="tm_primary_color">${invoiceNo}</b>
|
|
434
|
-
</p>
|
|
435
|
-
<p class="tm_invoice_date tm_m0">
|
|
436
|
-
Date: <b class="tm_primary_color">${currentDate}</b>
|
|
437
|
-
</p>
|
|
438
|
-
</div>
|
|
429
|
+
const invoiceTitleInfo = `
|
|
430
|
+
<div class="tm_invoice_seperator tm_gray_bg"></div>
|
|
431
|
+
<div class="tm_invoice_info_list">
|
|
432
|
+
<p class="tm_invoice_number tm_m0">
|
|
433
|
+
Invoice No: <b class="tm_primary_color">${invoiceNo}</b>
|
|
434
|
+
</p>
|
|
435
|
+
<p class="tm_invoice_date tm_m0">
|
|
436
|
+
Date: <b class="tm_primary_color">${currentDate}</b>
|
|
437
|
+
</p>
|
|
438
|
+
</div>
|
|
439
439
|
`;
|
|
440
440
|
const invoiceTitleInfoHandle = await page.$('.tm_invoice_info');
|
|
441
441
|
await invoiceTitleInfoHandle.evaluate((invoice, invoiceTitleInfo) => {
|
|
442
442
|
invoice.innerHTML = invoiceTitleInfo;
|
|
443
443
|
}, invoiceTitleInfo);
|
|
444
|
-
const invoiceCustomerContent = `
|
|
445
|
-
<p class="tm_mb2">
|
|
446
|
-
<b class="tm_primary_color">Invoice To:</b>
|
|
447
|
-
</p>
|
|
448
|
-
<p>
|
|
449
|
-
${customer.FullName} <br />
|
|
450
|
-
${customer.DefaultAddress.AddressLine1}, ${customer.DefaultAddress.City} <br />
|
|
451
|
-
${customer.DefaultAddress.Country} <br />
|
|
452
|
-
${customer.Email}
|
|
453
|
-
</p>
|
|
444
|
+
const invoiceCustomerContent = `
|
|
445
|
+
<p class="tm_mb2">
|
|
446
|
+
<b class="tm_primary_color">Invoice To:</b>
|
|
447
|
+
</p>
|
|
448
|
+
<p>
|
|
449
|
+
${customer.FullName} <br />
|
|
450
|
+
${customer.DefaultAddress.AddressLine1}, ${customer.DefaultAddress.City} <br />
|
|
451
|
+
${customer.DefaultAddress.Country} <br />
|
|
452
|
+
${customer.Email}
|
|
453
|
+
</p>
|
|
454
454
|
`;
|
|
455
455
|
const invoiceCustomerHandle = await page.$('.tm_customer_detail');
|
|
456
456
|
await invoiceCustomerHandle.evaluate((invoice, invoiceCustomerContent) => {
|
|
@@ -468,64 +468,64 @@ class Document extends account_system_entity_1.AccountSystemEntity {
|
|
|
468
468
|
}, invoicePaymentInfoContent);
|
|
469
469
|
const invoiceSubtotal = +this.Amount;
|
|
470
470
|
const invoiceTax = 0;
|
|
471
|
-
const invoiceRightFooterContent = `
|
|
472
|
-
<table>
|
|
473
|
-
<tbody>
|
|
474
|
-
<tr>
|
|
475
|
-
<td
|
|
476
|
-
class="tm_width_3 tm_primary_color tm_border_none tm_bold"
|
|
477
|
-
>
|
|
478
|
-
Subtotal
|
|
479
|
-
</td>
|
|
480
|
-
<td
|
|
481
|
-
class="tm_width_3 tm_primary_color tm_text_right tm_border_none tm_bold"
|
|
482
|
-
>
|
|
483
|
-
${this.Currency} ${invoiceSubtotal.toFixed(2)}
|
|
484
|
-
</td>
|
|
485
|
-
</tr>
|
|
486
|
-
<tr>
|
|
487
|
-
<td
|
|
488
|
-
class="tm_width_3 tm_primary_color tm_border_none tm_pt0"
|
|
489
|
-
>
|
|
490
|
-
Tax <span class="tm_ternary_color">(0%)</span>
|
|
491
|
-
</td>
|
|
492
|
-
<td
|
|
493
|
-
class="tm_width_3 tm_primary_color tm_text_right tm_border_none tm_pt0"
|
|
494
|
-
>
|
|
495
|
-
${this.Currency} ${invoiceTax.toFixed(2)}
|
|
496
|
-
</td>
|
|
497
|
-
</tr>
|
|
498
|
-
<tr class="tm_border_top tm_border_bottom">
|
|
499
|
-
<td
|
|
500
|
-
class="tm_width_3 tm_border_top_0 tm_bold tm_f16 tm_primary_color"
|
|
501
|
-
>
|
|
502
|
-
Grand Total
|
|
503
|
-
</td>
|
|
504
|
-
<td
|
|
505
|
-
class="tm_width_3 tm_border_top_0 tm_bold tm_f16 tm_primary_color tm_text_right"
|
|
506
|
-
>
|
|
507
|
-
${this.Currency} ${(invoiceSubtotal + invoiceTax).toFixed(2)}
|
|
508
|
-
</td>
|
|
509
|
-
</tr>
|
|
510
|
-
</tbody>
|
|
511
|
-
</table>
|
|
471
|
+
const invoiceRightFooterContent = `
|
|
472
|
+
<table>
|
|
473
|
+
<tbody>
|
|
474
|
+
<tr>
|
|
475
|
+
<td
|
|
476
|
+
class="tm_width_3 tm_primary_color tm_border_none tm_bold"
|
|
477
|
+
>
|
|
478
|
+
Subtotal
|
|
479
|
+
</td>
|
|
480
|
+
<td
|
|
481
|
+
class="tm_width_3 tm_primary_color tm_text_right tm_border_none tm_bold"
|
|
482
|
+
>
|
|
483
|
+
${this.Currency} ${invoiceSubtotal.toFixed(2)}
|
|
484
|
+
</td>
|
|
485
|
+
</tr>
|
|
486
|
+
<tr>
|
|
487
|
+
<td
|
|
488
|
+
class="tm_width_3 tm_primary_color tm_border_none tm_pt0"
|
|
489
|
+
>
|
|
490
|
+
Tax <span class="tm_ternary_color">(0%)</span>
|
|
491
|
+
</td>
|
|
492
|
+
<td
|
|
493
|
+
class="tm_width_3 tm_primary_color tm_text_right tm_border_none tm_pt0"
|
|
494
|
+
>
|
|
495
|
+
${this.Currency} ${invoiceTax.toFixed(2)}
|
|
496
|
+
</td>
|
|
497
|
+
</tr>
|
|
498
|
+
<tr class="tm_border_top tm_border_bottom">
|
|
499
|
+
<td
|
|
500
|
+
class="tm_width_3 tm_border_top_0 tm_bold tm_f16 tm_primary_color"
|
|
501
|
+
>
|
|
502
|
+
Grand Total
|
|
503
|
+
</td>
|
|
504
|
+
<td
|
|
505
|
+
class="tm_width_3 tm_border_top_0 tm_bold tm_f16 tm_primary_color tm_text_right"
|
|
506
|
+
>
|
|
507
|
+
${this.Currency} ${(invoiceSubtotal + invoiceTax).toFixed(2)}
|
|
508
|
+
</td>
|
|
509
|
+
</tr>
|
|
510
|
+
</tbody>
|
|
511
|
+
</table>
|
|
512
512
|
`;
|
|
513
513
|
const invoiceRightFooterHandle = await page.$('.tm_item_total_section');
|
|
514
514
|
await invoiceRightFooterHandle.evaluate((invoice, invoiceRightFooterContent) => {
|
|
515
515
|
invoice.innerHTML = invoiceRightFooterContent;
|
|
516
516
|
}, invoiceRightFooterContent);
|
|
517
|
-
const invoiceTNCContent = `
|
|
518
|
-
<li>
|
|
519
|
-
All payment must be made to:
|
|
520
|
-
<ul>
|
|
521
|
-
<li>Bank: <b>RHB BANK BHD</b></li>
|
|
522
|
-
<li>Account Name: <b>TXG Financial Solutions Sdn Bhd</b></li>
|
|
523
|
-
<li>Account No.: <b>2142 13000 17954</b></li>
|
|
524
|
-
</ul>
|
|
525
|
-
</li>
|
|
526
|
-
<li>
|
|
527
|
-
Once payment has been made, please email your transaction confirmation slip to <i>payment@ezcash.com.my</i>
|
|
528
|
-
</li>
|
|
517
|
+
const invoiceTNCContent = `
|
|
518
|
+
<li>
|
|
519
|
+
All payment must be made to:
|
|
520
|
+
<ul>
|
|
521
|
+
<li>Bank: <b>RHB BANK BHD</b></li>
|
|
522
|
+
<li>Account Name: <b>TXG Financial Solutions Sdn Bhd</b></li>
|
|
523
|
+
<li>Account No.: <b>2142 13000 17954</b></li>
|
|
524
|
+
</ul>
|
|
525
|
+
</li>
|
|
526
|
+
<li>
|
|
527
|
+
Once payment has been made, please email your transaction confirmation slip to <i>payment@ezcash.com.my</i>
|
|
528
|
+
</li>
|
|
529
529
|
`;
|
|
530
530
|
const invoiceTNCHandle = await page.$('.tm_tnc_content');
|
|
531
531
|
await invoiceTNCHandle.evaluate((invoice, invoiceTNCContent) => {
|
|
@@ -534,16 +534,16 @@ class Document extends account_system_entity_1.AccountSystemEntity {
|
|
|
534
534
|
const invoiceDocumentItems = await this.DocumentItems;
|
|
535
535
|
let invoiceItemContent = ``;
|
|
536
536
|
invoiceDocumentItems.forEach((documentItem, i) => {
|
|
537
|
-
invoiceItemContent += `
|
|
538
|
-
<tr>
|
|
539
|
-
<td class="tm_width_3">${i + 1}. ${documentItem.Name}</td>
|
|
540
|
-
<td class="tm_width_4">
|
|
541
|
-
${documentItem.Description}
|
|
542
|
-
</td>
|
|
543
|
-
<td class="tm_width_2">${documentItem.Currency} ${documentItem.UnitPrice}</td>
|
|
544
|
-
<td class="tm_width_1">${documentItem.Quantity}</td>
|
|
545
|
-
<td class="tm_width_2 tm_text_right">${documentItem.Currency} ${(+documentItem.UnitPrice * +documentItem.Quantity).toFixed(2)}</td>
|
|
546
|
-
</tr>
|
|
537
|
+
invoiceItemContent += `
|
|
538
|
+
<tr>
|
|
539
|
+
<td class="tm_width_3">${i + 1}. ${documentItem.Name}</td>
|
|
540
|
+
<td class="tm_width_4">
|
|
541
|
+
${documentItem.Description}
|
|
542
|
+
</td>
|
|
543
|
+
<td class="tm_width_2">${documentItem.Currency} ${documentItem.UnitPrice}</td>
|
|
544
|
+
<td class="tm_width_1">${documentItem.Quantity}</td>
|
|
545
|
+
<td class="tm_width_2 tm_text_right">${documentItem.Currency} ${(+documentItem.UnitPrice * +documentItem.Quantity).toFixed(2)}</td>
|
|
546
|
+
</tr>
|
|
547
547
|
`;
|
|
548
548
|
});
|
|
549
549
|
const invoiceDocumentItemHandle = await page.$('.tm_items_content');
|
|
@@ -599,40 +599,40 @@ class Document extends account_system_entity_1.AccountSystemEntity {
|
|
|
599
599
|
}, imgTag);
|
|
600
600
|
const currentDate = date.toLocaleDateString('en-GB');
|
|
601
601
|
const receiptNo = this.DocNo;
|
|
602
|
-
const receiptTitle = `
|
|
603
|
-
<div class="tm_primary_color tm_f50 tm_text_uppercase">
|
|
604
|
-
Receipt
|
|
605
|
-
</div>
|
|
602
|
+
const receiptTitle = `
|
|
603
|
+
<div class="tm_primary_color tm_f50 tm_text_uppercase">
|
|
604
|
+
Receipt
|
|
605
|
+
</div>
|
|
606
606
|
`;
|
|
607
607
|
const receiptTitleHandle = await page.$('.tm_invoice_title');
|
|
608
608
|
await receiptTitleHandle.evaluate((receipt, receiptTitle) => {
|
|
609
609
|
receipt.innerHTML = receiptTitle;
|
|
610
610
|
}, receiptTitle);
|
|
611
|
-
const receiptTitleInfo = `
|
|
612
|
-
<div class="tm_invoice_seperator tm_gray_bg"></div>
|
|
613
|
-
<div class="tm_invoice_info_list">
|
|
614
|
-
<p class="tm_invoice_number tm_m0">
|
|
615
|
-
Receipt No: <b class="tm_primary_color">${receiptNo}</b>
|
|
616
|
-
</p>
|
|
617
|
-
<p class="tm_invoice_date tm_m0">
|
|
618
|
-
Date: <b class="tm_primary_color">${currentDate}</b>
|
|
619
|
-
</p>
|
|
620
|
-
</div>
|
|
611
|
+
const receiptTitleInfo = `
|
|
612
|
+
<div class="tm_invoice_seperator tm_gray_bg"></div>
|
|
613
|
+
<div class="tm_invoice_info_list">
|
|
614
|
+
<p class="tm_invoice_number tm_m0">
|
|
615
|
+
Receipt No: <b class="tm_primary_color">${receiptNo}</b>
|
|
616
|
+
</p>
|
|
617
|
+
<p class="tm_invoice_date tm_m0">
|
|
618
|
+
Date: <b class="tm_primary_color">${currentDate}</b>
|
|
619
|
+
</p>
|
|
620
|
+
</div>
|
|
621
621
|
`;
|
|
622
622
|
const receiptTitleInfoHandle = await page.$('.tm_invoice_info');
|
|
623
623
|
await receiptTitleInfoHandle.evaluate((receipt, receiptTitleInfo) => {
|
|
624
624
|
receipt.innerHTML = receiptTitleInfo;
|
|
625
625
|
}, receiptTitleInfo);
|
|
626
|
-
const receiptCustomerContent = `
|
|
627
|
-
<p class="tm_mb2">
|
|
628
|
-
<b class="tm_primary_color">Issued To:</b>
|
|
629
|
-
</p>
|
|
630
|
-
<p>
|
|
631
|
-
${customer.FullName} <br />
|
|
632
|
-
${customer.DefaultAddress.AddressLine1}, ${customer.DefaultAddress.City} <br />
|
|
633
|
-
${customer.DefaultAddress.Country} <br />
|
|
634
|
-
${customer.Email}
|
|
635
|
-
</p>
|
|
626
|
+
const receiptCustomerContent = `
|
|
627
|
+
<p class="tm_mb2">
|
|
628
|
+
<b class="tm_primary_color">Issued To:</b>
|
|
629
|
+
</p>
|
|
630
|
+
<p>
|
|
631
|
+
${customer.FullName} <br />
|
|
632
|
+
${customer.DefaultAddress.AddressLine1}, ${customer.DefaultAddress.City} <br />
|
|
633
|
+
${customer.DefaultAddress.Country} <br />
|
|
634
|
+
${customer.Email}
|
|
635
|
+
</p>
|
|
636
636
|
`;
|
|
637
637
|
const receiptCustomerHandle = await page.$('.tm_customer_detail');
|
|
638
638
|
await receiptCustomerHandle.evaluate((receipt, receiptCustomerContent) => {
|
|
@@ -650,47 +650,47 @@ class Document extends account_system_entity_1.AccountSystemEntity {
|
|
|
650
650
|
}, receiptPaymentInfoContent);
|
|
651
651
|
const receiptSubtotal = +this.Amount;
|
|
652
652
|
const receiptTax = 0;
|
|
653
|
-
const receiptRightFooterContent = `
|
|
654
|
-
<table>
|
|
655
|
-
<tbody>
|
|
656
|
-
<tr>
|
|
657
|
-
<td
|
|
658
|
-
class="tm_width_3 tm_primary_color tm_border_none tm_bold"
|
|
659
|
-
>
|
|
660
|
-
Subtotal
|
|
661
|
-
</td>
|
|
662
|
-
<td
|
|
663
|
-
class="tm_width_3 tm_primary_color tm_text_right tm_border_none tm_bold"
|
|
664
|
-
>
|
|
665
|
-
${this.Currency} ${receiptSubtotal}
|
|
666
|
-
</td>
|
|
667
|
-
</tr>
|
|
668
|
-
<tr>
|
|
669
|
-
<td
|
|
670
|
-
class="tm_width_3 tm_primary_color tm_border_none tm_pt0"
|
|
671
|
-
>
|
|
672
|
-
Tax <span class="tm_ternary_color">(0%)</span>
|
|
673
|
-
</td>
|
|
674
|
-
<td
|
|
675
|
-
class="tm_width_3 tm_primary_color tm_text_right tm_border_none tm_pt0"
|
|
676
|
-
>
|
|
677
|
-
${this.Currency} ${receiptTax}
|
|
678
|
-
</td>
|
|
679
|
-
</tr>
|
|
680
|
-
<tr class="tm_border_top tm_border_bottom">
|
|
681
|
-
<td
|
|
682
|
-
class="tm_width_3 tm_border_top_0 tm_bold tm_f16 tm_primary_color"
|
|
683
|
-
>
|
|
684
|
-
Grand Total
|
|
685
|
-
</td>
|
|
686
|
-
<td
|
|
687
|
-
class="tm_width_3 tm_border_top_0 tm_bold tm_f16 tm_primary_color tm_text_right"
|
|
688
|
-
>
|
|
689
|
-
${this.Currency} ${receiptSubtotal + receiptTax}
|
|
690
|
-
</td>
|
|
691
|
-
</tr>
|
|
692
|
-
</tbody>
|
|
693
|
-
</table>
|
|
653
|
+
const receiptRightFooterContent = `
|
|
654
|
+
<table>
|
|
655
|
+
<tbody>
|
|
656
|
+
<tr>
|
|
657
|
+
<td
|
|
658
|
+
class="tm_width_3 tm_primary_color tm_border_none tm_bold"
|
|
659
|
+
>
|
|
660
|
+
Subtotal
|
|
661
|
+
</td>
|
|
662
|
+
<td
|
|
663
|
+
class="tm_width_3 tm_primary_color tm_text_right tm_border_none tm_bold"
|
|
664
|
+
>
|
|
665
|
+
${this.Currency} ${receiptSubtotal}
|
|
666
|
+
</td>
|
|
667
|
+
</tr>
|
|
668
|
+
<tr>
|
|
669
|
+
<td
|
|
670
|
+
class="tm_width_3 tm_primary_color tm_border_none tm_pt0"
|
|
671
|
+
>
|
|
672
|
+
Tax <span class="tm_ternary_color">(0%)</span>
|
|
673
|
+
</td>
|
|
674
|
+
<td
|
|
675
|
+
class="tm_width_3 tm_primary_color tm_text_right tm_border_none tm_pt0"
|
|
676
|
+
>
|
|
677
|
+
${this.Currency} ${receiptTax}
|
|
678
|
+
</td>
|
|
679
|
+
</tr>
|
|
680
|
+
<tr class="tm_border_top tm_border_bottom">
|
|
681
|
+
<td
|
|
682
|
+
class="tm_width_3 tm_border_top_0 tm_bold tm_f16 tm_primary_color"
|
|
683
|
+
>
|
|
684
|
+
Grand Total
|
|
685
|
+
</td>
|
|
686
|
+
<td
|
|
687
|
+
class="tm_width_3 tm_border_top_0 tm_bold tm_f16 tm_primary_color tm_text_right"
|
|
688
|
+
>
|
|
689
|
+
${this.Currency} ${receiptSubtotal + receiptTax}
|
|
690
|
+
</td>
|
|
691
|
+
</tr>
|
|
692
|
+
</tbody>
|
|
693
|
+
</table>
|
|
694
694
|
`;
|
|
695
695
|
const receiptRightFooterHandle = await page.$('.tm_item_total_section');
|
|
696
696
|
await receiptRightFooterHandle.evaluate((receipt, receiptRightFooterContent) => {
|
|
@@ -699,29 +699,29 @@ class Document extends account_system_entity_1.AccountSystemEntity {
|
|
|
699
699
|
const receiptDocumentItems = await this.DocumentItems;
|
|
700
700
|
let receiptItemContent = ``;
|
|
701
701
|
receiptDocumentItems.forEach((documentItem, i) => {
|
|
702
|
-
receiptItemContent += `
|
|
703
|
-
<tr>
|
|
704
|
-
<td class="tm_width_3">${i + 1}. ${documentItem.Name}</td>
|
|
705
|
-
<td class="tm_width_4">
|
|
706
|
-
${documentItem.Description}
|
|
707
|
-
</td>
|
|
708
|
-
<td class="tm_width_2">${documentItem.Currency} ${documentItem.UnitPrice}</td>
|
|
709
|
-
<td class="tm_width_1">${documentItem.Quantity}</td>
|
|
710
|
-
<td class="tm_width_2 tm_text_right">${documentItem.Currency} ${+documentItem.UnitPrice * +documentItem.Quantity}</td>
|
|
711
|
-
</tr>
|
|
702
|
+
receiptItemContent += `
|
|
703
|
+
<tr>
|
|
704
|
+
<td class="tm_width_3">${i + 1}. ${documentItem.Name}</td>
|
|
705
|
+
<td class="tm_width_4">
|
|
706
|
+
${documentItem.Description}
|
|
707
|
+
</td>
|
|
708
|
+
<td class="tm_width_2">${documentItem.Currency} ${documentItem.UnitPrice}</td>
|
|
709
|
+
<td class="tm_width_1">${documentItem.Quantity}</td>
|
|
710
|
+
<td class="tm_width_2 tm_text_right">${documentItem.Currency} ${+documentItem.UnitPrice * +documentItem.Quantity}</td>
|
|
711
|
+
</tr>
|
|
712
712
|
`;
|
|
713
713
|
});
|
|
714
714
|
const receiptDocumentItemHandle = await page.$('.tm_items_content');
|
|
715
715
|
await receiptDocumentItemHandle.evaluate((receipt, receiptItemContent) => {
|
|
716
716
|
receipt.innerHTML = receiptItemContent;
|
|
717
717
|
}, receiptItemContent);
|
|
718
|
-
const receiptFooterContent = `
|
|
719
|
-
<p class="tm_mb5 tm_text_center tm_f11">
|
|
720
|
-
<i>
|
|
721
|
-
Thank you for your payment. This is computer generated receipt
|
|
722
|
-
- no signature is required.
|
|
723
|
-
</i>
|
|
724
|
-
</p>
|
|
718
|
+
const receiptFooterContent = `
|
|
719
|
+
<p class="tm_mb5 tm_text_center tm_f11">
|
|
720
|
+
<i>
|
|
721
|
+
Thank you for your payment. This is computer generated receipt
|
|
722
|
+
- no signature is required.
|
|
723
|
+
</i>
|
|
724
|
+
</p>
|
|
725
725
|
`;
|
|
726
726
|
const receiptFooterHandle = await page.$('.tm_footer_section');
|
|
727
727
|
await receiptFooterHandle.evaluate((receipt, receiptFooterContent) => {
|