Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44d389201c | ||
|
|
3106aaf314 | ||
|
|
90e797b8fa | ||
|
|
1f7362c8af |
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "app-ts",
|
"name": "app-ts",
|
||||||
"version": "1.4.8",
|
"version": "1.5.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "app-ts",
|
"name": "app-ts",
|
||||||
"version": "1.4.8",
|
"version": "1.5.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dnd-kit/core": "^6.3.1",
|
"@dnd-kit/core": "^6.3.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "app-ts",
|
"name": "app-ts",
|
||||||
"version": "1.4.8",
|
"version": "1.5.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/server.js",
|
"main": "dist/server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -495,14 +495,14 @@ export default async function invoicesPdfRoutes(
|
|||||||
<style>
|
<style>
|
||||||
@page {
|
@page {
|
||||||
size: A4;
|
size: A4;
|
||||||
margin: 12mm 15mm 15mm 15mm;
|
margin: 8mm 12mm 10mm 12mm;
|
||||||
}
|
}
|
||||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||||
html, body {
|
html, body {
|
||||||
font-family: "Segoe UI", Tahoma, Arial, sans-serif;
|
font-family: "Segoe UI", Tahoma, Arial, sans-serif;
|
||||||
font-size: 10pt;
|
font-size: 10pt;
|
||||||
color: #1a1a1a;
|
color: #1a1a1a;
|
||||||
width: 180mm;
|
width: 186mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
.invoice-page {
|
.invoice-page {
|
||||||
@@ -513,8 +513,6 @@ export default async function invoicesPdfRoutes(
|
|||||||
.invoice-content { flex: 1 1 auto; }
|
.invoice-content { flex: 1 1 auto; }
|
||||||
.invoice-footer {
|
.invoice-footer {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
page-break-inside: avoid;
|
|
||||||
break-inside: avoid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.accent { color: #de3a3a; }
|
.accent { color: #de3a3a; }
|
||||||
@@ -524,8 +522,8 @@ export default async function invoicesPdfRoutes(
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 3mm;
|
margin-bottom: 1mm;
|
||||||
padding-bottom: 3mm;
|
padding-bottom: 1mm;
|
||||||
border-bottom: 2pt solid #de3a3a;
|
border-bottom: 2pt solid #de3a3a;
|
||||||
}
|
}
|
||||||
.invoice-header .left {
|
.invoice-header .left {
|
||||||
@@ -557,10 +555,10 @@ export default async function invoicesPdfRoutes(
|
|||||||
border: 0.5pt solid #d0d0d0;
|
border: 0.5pt solid #d0d0d0;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-bottom: 3mm;
|
margin-bottom: 1mm;
|
||||||
}
|
}
|
||||||
.header-grid td {
|
.header-grid td {
|
||||||
padding: 3mm 4mm;
|
padding: 2mm 3mm;
|
||||||
border: 0.5pt solid #d0d0d0;
|
border: 0.5pt solid #d0d0d0;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
width: 50%;
|
width: 50%;
|
||||||
@@ -643,20 +641,18 @@ export default async function invoicesPdfRoutes(
|
|||||||
margin-bottom: 2mm;
|
margin-bottom: 2mm;
|
||||||
}
|
}
|
||||||
table.items thead th {
|
table.items thead th {
|
||||||
font-size: 9pt;
|
font-size: 8.5pt;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #646464;
|
color: #646464;
|
||||||
padding: 6px 8px;
|
padding: 4px 4px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
letter-spacing: 0.02em;
|
|
||||||
text-transform: uppercase;
|
|
||||||
border-bottom: 0.5pt solid #d0d0d0;
|
border-bottom: 0.5pt solid #d0d0d0;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
table.items thead th.center { text-align: center; }
|
table.items thead th.center { text-align: center; }
|
||||||
table.items thead th.right { text-align: right; }
|
table.items thead th.right { text-align: right; }
|
||||||
table.items tbody td {
|
table.items tbody td {
|
||||||
padding: 5px 8px;
|
padding: 4px 4px;
|
||||||
border-bottom: 0.5pt solid #e0e0e0;
|
border-bottom: 0.5pt solid #e0e0e0;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
color: #1a1a1a;
|
color: #1a1a1a;
|
||||||
@@ -1012,6 +1008,7 @@ ${indentCSS}
|
|||||||
? new Date(invoice.issue_date)
|
? new Date(invoice.issue_date)
|
||||||
: new Date();
|
: new Date();
|
||||||
const saveMode = query.save === "1";
|
const saveMode = query.save === "1";
|
||||||
|
nasFinancialsManager.cleanIssuedInvoice(invoice.invoice_number!);
|
||||||
const pdfPromise = htmlToPdf(html)
|
const pdfPromise = htmlToPdf(html)
|
||||||
.then((pdfBuffer) => {
|
.then((pdfBuffer) => {
|
||||||
nasFinancialsManager.saveIssuedInvoicePdf(
|
nasFinancialsManager.saveIssuedInvoicePdf(
|
||||||
|
|||||||
@@ -30,6 +30,28 @@ class NasFinancialsManager {
|
|||||||
|
|
||||||
// ── Created (issued) invoices ────────────────────────────────────
|
// ── Created (issued) invoices ────────────────────────────────────
|
||||||
|
|
||||||
|
/** Remove any existing PDF for this invoice number across all year/month folders */
|
||||||
|
cleanIssuedInvoice(invoiceNumber: string): void {
|
||||||
|
if (!this.basePath) return;
|
||||||
|
const safeName = this.sanitizeFilename(invoiceNumber) + ".pdf";
|
||||||
|
const issuedDir = path.join(this.basePath, DIR_ISSUED);
|
||||||
|
try {
|
||||||
|
if (!fs.existsSync(issuedDir)) return;
|
||||||
|
for (const yearDir of fs.readdirSync(issuedDir)) {
|
||||||
|
const yearPath = path.join(issuedDir, yearDir);
|
||||||
|
if (!fs.statSync(yearPath).isDirectory()) continue;
|
||||||
|
for (const monthDir of fs.readdirSync(yearPath)) {
|
||||||
|
const filePath = path.join(yearPath, monthDir, safeName);
|
||||||
|
if (fs.existsSync(filePath)) {
|
||||||
|
fs.unlinkSync(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// best effort
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
saveIssuedInvoicePdf(
|
saveIssuedInvoicePdf(
|
||||||
invoiceNumber: string,
|
invoiceNumber: string,
|
||||||
year: number,
|
year: number,
|
||||||
|
|||||||
Reference in New Issue
Block a user