ztechno_core 0.0.123 → 0.0.126

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.
@@ -88,6 +88,7 @@ class ZMailService {
88
88
  const mailDetails = {
89
89
  from: mailOpts.from || this.opt.mailSender,
90
90
  to: mailOpts.recipient,
91
+ cc: mailOpts.cc || undefined,
91
92
  subject: mailOpts.subject,
92
93
  text: mailOpts.body || undefined,
93
94
  html: mailOpts.html || undefined,
@@ -50,6 +50,7 @@ export type MailOptionsBase = {
50
50
  recipient: string;
51
51
  subject: string;
52
52
  from?: string;
53
+ cc?: string | string[];
53
54
  priority?: 'high' | 'normal' | 'low';
54
55
  dkim?: SingleDKIMKeyOptions;
55
56
  attachments?: MailAttachment[];
@@ -144,7 +144,7 @@ class InvoicesOrm extends orm_1.ZOrm {
144
144
  await this.sqlService.query(/*SQL*/ `
145
145
  CREATE TABLE IF NOT EXISTS \`${this.alias}\` (
146
146
  id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
147
- invoice_number VARCHAR(32) NOT NULL,
147
+ invoice_number VARCHAR(44) NOT NULL,
148
148
  customer_id BIGINT UNSIGNED NOT NULL,
149
149
  subscription_id BIGINT UNSIGNED NULL,
150
150
  subscription_period_start DATETIME,
@@ -96,6 +96,7 @@ export declare class InvoiceService {
96
96
  recipient?: string,
97
97
  opt?: {
98
98
  mode?: 'invoice' | 'receipt';
99
+ ccOwner?: boolean;
99
100
  },
100
101
  ): Promise<{
101
102
  invoice_number: string;
@@ -571,8 +571,8 @@ class InvoiceService {
571
571
  subscription_period_end: (0, orm_1.formatDatetime)(periodEnd),
572
572
  });
573
573
  }
574
- if (subscription && mappedStatus === 'paid' && (!hadInvoice || previousStatus !== 'paid')) {
575
- await this.sendInvoiceEmail(invoice.id, undefined, { mode: 'receipt' });
574
+ if (mappedStatus === 'paid' && (!hadInvoice || previousStatus !== 'paid')) {
575
+ await this.sendInvoiceEmail(invoice.id, undefined, { mode: 'receipt', ccOwner: true });
576
576
  }
577
577
  if (
578
578
  subscription &&
@@ -782,20 +782,20 @@ class InvoiceService {
782
782
  P.rule().skip(10);
783
783
  // === TOTALS (Dutch law: subtotal, VAT breakdown per rate, subtotal incl. VAT) ===
784
784
  P.size(10);
785
- P.row('Subtotaal excl. BTW:', 370, this.formatMoney(subtotal, invoice.currency), col5);
785
+ P.row('Subtotaal excl. BTW:', 290, this.formatMoney(subtotal, invoice.currency), col5);
786
786
  let totalVat = 0;
787
787
  for (const [rate, { vat }] of Object.entries(vatByRate)) {
788
788
  totalVat += vat;
789
- P.row(`BTW ${rate}%`, 370, this.formatMoney(vat, invoice.currency), col5);
789
+ P.row(`BTW ${rate}%`, 290, this.formatMoney(vat, invoice.currency), col5);
790
790
  }
791
791
  const serviceTotalIncVat = subtotal + totalVat;
792
792
  // === SUBSIDY SECTION (shown before grand total when subsidies are present) ===
793
793
  let subsidyTotal = 0;
794
794
  if (subsidyItems.length > 0) {
795
795
  P.bold().size(10);
796
- P.row('Totaal incl. BTW:', 370, this.formatMoney(serviceTotalIncVat, invoice.currency), col5)
796
+ P.row('Totaal incl. BTW:', 290, this.formatMoney(serviceTotalIncVat, invoice.currency), col5)
797
797
  .skip(4)
798
- .dashedRule(370, 560)
798
+ .dashedRule(290, 560)
799
799
  .skip(8);
800
800
  P.bold().size(9);
801
801
  P.text('Geschatte Subsidie', 50, { width: 300 }, 12);
@@ -807,7 +807,7 @@ class InvoiceService {
807
807
  doc.text(`- ${this.formatMoney(Math.abs(subsidyAmount), invoice.currency)}`, col5, P.y);
808
808
  P.skip(14);
809
809
  }
810
- P.dashedRule(370, 560).skip(8);
810
+ P.dashedRule(290, 560).skip(8);
811
811
  }
812
812
  const grandTotal = serviceTotalIncVat + subsidyTotal; // subsidyTotal is negative
813
813
  P.size(10);
@@ -816,7 +816,7 @@ class InvoiceService {
816
816
  P.row('Uw Totale Investering incl. Subsidie:', 290, this.formatMoney(grandTotal, invoice.currency), col5, 20);
817
817
  } else {
818
818
  P.bold();
819
- P.row('Totaal incl. BTW:', 370, this.formatMoney(grandTotal, invoice.currency), col5, 20);
819
+ P.row('Totaal incl. BTW:', 290, this.formatMoney(grandTotal, invoice.currency), col5, 20);
820
820
  P.normal();
821
821
  }
822
822
  // === TWO-COLUMN FOOTER: Description & Terms (left) | Bank details (right) ===
@@ -874,9 +874,11 @@ class InvoiceService {
874
874
  const content = isReceipt
875
875
  ? `<br>Beste ${customer.name},<br><br>We hebben uw betaling ontvangen. De factuur vindt u in de bijlage.<br><br>Dank u wel, ${cfg.company.companyShort}<br>`
876
876
  : `<br>Beste ${customer.name},<br><br>U vindt uw factuur in de bijlage.<br><br><a href="${pay?.payUrl}" style="display:inline-block;padding:10px 16px;background:#0d6efd;color:#fff;text-decoration:none;border-radius:6px;">Betaal nu</a><br><br>Dank u wel, ${cfg.company.companyShort}<br>`;
877
+ const cc = isReceipt ? undefined : opt?.ccOwner ? cfg.contact.contactQuote : undefined;
877
878
  await this.mailService.sendAdvanced({
878
879
  from: `${cfg.company.company} <${cfg.contact.contact}>`,
879
880
  recipient: to,
881
+ cc,
880
882
  subject,
881
883
  template: 'template.html',
882
884
  inject: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztechno_core",
3
- "version": "0.0.123",
3
+ "version": "0.0.126",
4
4
  "description": "Core files for ztechno framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",