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