Compare commits
1 Commits
master
...
393db71413
Author | SHA1 | Date | |
---|---|---|---|
393db71413 |
26
package.json
26
package.json
@@ -21,29 +21,29 @@
|
|||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@design.estate/dees-catalog": "^1.10.10",
|
"@design.estate/dees-catalog": "^1.4.1",
|
||||||
"@design.estate/dees-domtools": "^2.3.3",
|
"@design.estate/dees-domtools": "^2.3.2",
|
||||||
"@design.estate/dees-element": "^2.1.2",
|
"@design.estate/dees-element": "^2.0.39",
|
||||||
"@design.estate/dees-wcctools": "^1.1.1",
|
"@design.estate/dees-wcctools": "^1.0.90",
|
||||||
"@git.zone/tsrun": "^1.3.3",
|
"@git.zone/tsrun": "^1.3.3",
|
||||||
"@push.rocks/smartfile": "^11.2.5",
|
"@push.rocks/smartfile": "^11.2.0",
|
||||||
"@push.rocks/smartjson": "^5.0.20",
|
"@push.rocks/smartjson": "^5.0.20",
|
||||||
"@push.rocks/smartpath": "^5.0.18",
|
"@push.rocks/smartpath": "^5.0.18",
|
||||||
"@push.rocks/smartpdf": "^3.2.2",
|
"@push.rocks/smartpdf": "^3.2.2",
|
||||||
"@push.rocks/smarttime": "^4.1.1",
|
"@push.rocks/smarttime": "^4.1.1",
|
||||||
"@tsclass/tsclass": "^9.2.0",
|
"@tsclass/tsclass": "^8.0.3",
|
||||||
"@types/node": "^24.1.0",
|
"@types/node": "^22.13.13",
|
||||||
"@types/qrcode": "^1.5.5",
|
"@types/qrcode": "^1.5.5",
|
||||||
"puppeteer": "^24.15.0",
|
"puppeteer": "^24.4.0",
|
||||||
"qrcode": "^1.5.4"
|
"qrcode": "^1.5.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@git.zone/tsbuild": "^2.6.4",
|
"@git.zone/tsbuild": "^2.3.2",
|
||||||
"@git.zone/tsbundle": "^2.5.1",
|
"@git.zone/tsbundle": "^2.2.5",
|
||||||
"@git.zone/tstest": "^2.3.2",
|
"@git.zone/tstest": "^1.0.96",
|
||||||
"@git.zone/tswatch": "^2.1.2",
|
"@git.zone/tswatch": "^2.1.0",
|
||||||
"@push.rocks/projectinfo": "^5.0.2",
|
"@push.rocks/projectinfo": "^5.0.2",
|
||||||
"@push.rocks/tapbundle": "^6.0.3"
|
"@push.rocks/tapbundle": "^5.6.0"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
|
4091
pnpm-lock.yaml
generated
4091
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
import * as plugins from "./plugins.js";
|
import * as plugins from './plugins.js';
|
||||||
import * as helpers from "./helpers.js";
|
import * as helpers from './helpers.js';
|
||||||
|
|
||||||
export interface IPdfServiceConstructorOptions {}
|
export interface IPdfServiceConstructorOptions {}
|
||||||
|
|
||||||
@@ -8,9 +8,7 @@ export interface IPdfServiceConstructorOptions {}
|
|||||||
*/
|
*/
|
||||||
export class PdfService {
|
export class PdfService {
|
||||||
// STATIC
|
// STATIC
|
||||||
public static async createAndStart(
|
public static async createAndStart(optionsArg: IPdfServiceConstructorOptions) {
|
||||||
optionsArg: IPdfServiceConstructorOptions
|
|
||||||
) {
|
|
||||||
const pdfService = new PdfService(optionsArg);
|
const pdfService = new PdfService(optionsArg);
|
||||||
await pdfService.start();
|
await pdfService.start();
|
||||||
return pdfService;
|
return pdfService;
|
||||||
@@ -44,23 +42,17 @@ export class PdfService {
|
|||||||
* creates an letter
|
* creates an letter
|
||||||
*/
|
*/
|
||||||
public async createPdfFromLetterObject(optionsArg: {
|
public async createPdfFromLetterObject(optionsArg: {
|
||||||
letterData: plugins.tsclass.business.TLetter;
|
letterData: plugins.tsclass.business.ILetter;
|
||||||
documentSettings: plugins.shared.interfaces.IDocumentSettings;
|
documentSettings: plugins.shared.interfaces.IDocumentSettings;
|
||||||
}): Promise<plugins.smartpdf.IPdf> {
|
}) {
|
||||||
const html = `
|
const html = `
|
||||||
<script type="module">
|
<script type="module">
|
||||||
${await helpers.getBundleAsString()}
|
${await helpers.getBundleAsString()}
|
||||||
</script>
|
</script>
|
||||||
<dedocument-dedocument printMode documentSettings="${plugins.smartjson.stringifyBase64(
|
<dedocument-dedocument printMode documentSettings="${plugins.smartjson.stringifyBase64(optionsArg.documentSettings)}" letterData="${plugins.smartjson.stringifyBase64(optionsArg.letterData)}"></dedocument-dedocument>
|
||||||
optionsArg.documentSettings
|
|
||||||
)}" letterData="${plugins.smartjson.stringifyBase64(
|
|
||||||
optionsArg.letterData
|
|
||||||
)}"></dedocument-dedocument>
|
|
||||||
`;
|
`;
|
||||||
// console.log(html);
|
// console.log(html);
|
||||||
const pdfResult = await this.smartpdfInstance.getA4PdfResultForHtmlString(
|
const pdfResult = await this.smartpdfInstance.getA4PdfResultForHtmlString(html);
|
||||||
html
|
|
||||||
);
|
|
||||||
return pdfResult;
|
return pdfResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -50,10 +50,7 @@ const toContact: plugins.tsclass.business.TContact = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const demoLetter: plugins.tsclass.finance.TInvoice = {
|
export const demoLetter: plugins.tsclass.finance.TInvoice = {
|
||||||
type: "accounting-doc",
|
type: "invoice",
|
||||||
accountingDocType: "invoice",
|
|
||||||
accountingDocId: "LL-INV-48765",
|
|
||||||
accountingDocStatus: "draft",
|
|
||||||
id: "LL-INV-48765",
|
id: "LL-INV-48765",
|
||||||
versionInfo: {
|
versionInfo: {
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
@@ -62,6 +59,7 @@ export const demoLetter: plugins.tsclass.finance.TInvoice = {
|
|||||||
language: "de",
|
language: "de",
|
||||||
date: Date.now(),
|
date: Date.now(),
|
||||||
incidenceId: "LL-INV-48765",
|
incidenceId: "LL-INV-48765",
|
||||||
|
invoiceId: "LL-INV-48765",
|
||||||
subject: "LL-INV-48765",
|
subject: "LL-INV-48765",
|
||||||
reverseCharge: true,
|
reverseCharge: true,
|
||||||
dueInDays: 30,
|
dueInDays: 30,
|
||||||
@@ -76,6 +74,7 @@ export const demoLetter: plugins.tsclass.finance.TInvoice = {
|
|||||||
printResult: null,
|
printResult: null,
|
||||||
currency: "EUR",
|
currency: "EUR",
|
||||||
notes: [],
|
notes: [],
|
||||||
|
invoiceType: "debitnote",
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
name: "Item with 19% VAT",
|
name: "Item with 19% VAT",
|
||||||
|
@@ -148,10 +148,82 @@ export const DE_translations: Dictionary = {
|
|||||||
vat: "Umsatzsteuer",
|
vat: "Umsatzsteuer",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Define Spanish translations
|
||||||
|
// export const ES_translations: TTranslationImplementation = {
|
||||||
|
// address: "Dirección",
|
||||||
|
// bankConnection: "Conexión bancaria",
|
||||||
|
// contactInfo: "Información de contacto",
|
||||||
|
// description: "Descripción",
|
||||||
|
// invoice: "Factura",
|
||||||
|
// itemPos: "Pos.",
|
||||||
|
// quantity: "Cantidad",
|
||||||
|
// registrationInfo: "Información de registro",
|
||||||
|
// reverseVatNote:
|
||||||
|
// "El IVA se aplica por inversión del sujeto pasivo y debe ser pagado por el cliente.",
|
||||||
|
// totalNetPrice: "Precio total neto",
|
||||||
|
// unitNetPrice: "Precio unitario neto",
|
||||||
|
// unitType: "Tipo de unidad",
|
||||||
|
// yourCustomerId: "Su número de cliente:",
|
||||||
|
// yourVatId: "Su ID de IVA:",
|
||||||
|
// continuesOnPage: "Continúa en la página",
|
||||||
|
// finalPageStatement: "Esta es la última página de este documento.",
|
||||||
|
// page: "Página",
|
||||||
|
// vatShort: "IVA",
|
||||||
|
// };
|
||||||
|
|
||||||
|
// Define French translations
|
||||||
|
// export const FR_translations: TTranslationImplementation = {
|
||||||
|
// address: "Adresse",
|
||||||
|
// bankConnection: "Coordonnées bancaires",
|
||||||
|
// contactInfo: "Informations de contact",
|
||||||
|
// description: "Description",
|
||||||
|
// invoice: "Facture",
|
||||||
|
// itemPos: "Position",
|
||||||
|
// quantity: "Quantité",
|
||||||
|
// registrationInfo: "Informations d'enregistrement",
|
||||||
|
// reverseVatNote:
|
||||||
|
// "La TVA s'applique selon le mécanisme d'autoliquidation et est à payer par le client.",
|
||||||
|
// totalNetPrice: "Prix net total",
|
||||||
|
// unitNetPrice: "Prix unitaire net",
|
||||||
|
// unitType: "Type d'unité",
|
||||||
|
// yourCustomerId: "Votre numéro de client :",
|
||||||
|
// yourVatId: "Votre numéro de TVA :",
|
||||||
|
// continuesOnPage: "Continue sur la page",
|
||||||
|
// finalPageStatement: "Ceci est la dernière page de ce document.",
|
||||||
|
// page: "Page",
|
||||||
|
// vatShort: "TVA",
|
||||||
|
// };
|
||||||
|
|
||||||
|
// Define Italian translations
|
||||||
|
// export const IT_translations: TTranslationImplementation = {
|
||||||
|
// address: "Indirizzo",
|
||||||
|
// bankConnection: "Coordinate bancarie",
|
||||||
|
// contactInfo: "Informazioni di contatto",
|
||||||
|
// description: "Descrizione",
|
||||||
|
// invoice: "Fattura",
|
||||||
|
// itemPos: "Pos.",
|
||||||
|
// quantity: "Quantità",
|
||||||
|
// registrationInfo: "Informazioni di registrazione",
|
||||||
|
// reverseVatNote:
|
||||||
|
// "L'IVA è applicata con inversione contabile ed è a carico del cliente.",
|
||||||
|
// totalNetPrice: "Prezzo netto totale",
|
||||||
|
// unitNetPrice: "Prezzo netto unitario",
|
||||||
|
// unitType: "Tipo di unità",
|
||||||
|
// yourCustomerId: "Il tuo numero cliente:",
|
||||||
|
// yourVatId: "Il tuo numero di partita IVA:",
|
||||||
|
// continuesOnPage: "Continua alla pagina",
|
||||||
|
// finalPageStatement: "Questa è l'ultima pagina di questo documento.",
|
||||||
|
// page: "Pagina",
|
||||||
|
// vatShort: "IVA",
|
||||||
|
// };
|
||||||
|
|
||||||
// Language Code Map
|
// Language Code Map
|
||||||
export const languageCodeMap: Record<string, Dictionary> = {
|
export const languageCodeMap: Record<string, Dictionary> = {
|
||||||
EN: EN_translations,
|
EN: EN_translations,
|
||||||
DE: DE_translations,
|
DE: DE_translations,
|
||||||
|
// ES: ES_translations,
|
||||||
|
// FR: FR_translations,
|
||||||
|
// IT: IT_translations,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Language Code Type
|
// Language Code Type
|
||||||
|
@@ -26,6 +26,7 @@ import { DeContentInvoice } from "./contentinvoice.js";
|
|||||||
|
|
||||||
import { demoFunc } from "./document.demo.js";
|
import { demoFunc } from "./document.demo.js";
|
||||||
import { dedocumentSharedStyle } from "../style.js";
|
import { dedocumentSharedStyle } from "../style.js";
|
||||||
|
import type { TInvoice } from "@tsclass/tsclass/dist_ts/finance/invoice.js";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
@@ -158,8 +159,7 @@ export class DeDocument extends DeesElement {
|
|||||||
// lets append the content
|
// lets append the content
|
||||||
const content: DeContentInvoice = new DeContentInvoice();
|
const content: DeContentInvoice = new DeContentInvoice();
|
||||||
cleanUpStoreCurrentRender.push(content);
|
cleanUpStoreCurrentRender.push(content);
|
||||||
content.letterData = this
|
content.letterData = this.letterData as unknown as TInvoice;
|
||||||
.letterData as unknown as plugins.tsclass.finance.TInvoice;
|
|
||||||
content.documentSettings = this.documentSettings;
|
content.documentSettings = this.documentSettings;
|
||||||
document.body.appendChild(content);
|
document.body.appendChild(content);
|
||||||
|
|
||||||
|
@@ -101,7 +101,7 @@ export class DeLetterHeader extends DeesElement {
|
|||||||
];
|
];
|
||||||
|
|
||||||
private renderDeliveryDate(from: Date, to: Date): TemplateResult {
|
private renderDeliveryDate(from: Date, to: Date): TemplateResult {
|
||||||
if (this.letterData.accountingDocType !== "invoice") return null;
|
if (this.letterData.type !== "invoice") return null;
|
||||||
const dateFormat = new Intl.DateTimeFormat(
|
const dateFormat = new Intl.DateTimeFormat(
|
||||||
this.documentSettings.languageCode,
|
this.documentSettings.languageCode,
|
||||||
{ dateStyle: this.documentSettings.dateStyle }
|
{ dateStyle: this.documentSettings.dateStyle }
|
||||||
@@ -174,7 +174,7 @@ export class DeLetterHeader extends DeesElement {
|
|||||||
${this.letterData.to.registrationDetails.vatId || "not provided"}
|
${this.letterData.to.registrationDetails.vatId || "not provided"}
|
||||||
|
|
||||||
<!-- TODO: Make use of components -->
|
<!-- TODO: Make use of components -->
|
||||||
${this.letterData.accountingDocType === "invoice"
|
${this.letterData.type === "invoice"
|
||||||
? html` <div class="label">
|
? html` <div class="label">
|
||||||
${plugins.shared.translation.translate(
|
${plugins.shared.translation.translate(
|
||||||
this.documentSettings.languageCode,
|
this.documentSettings.languageCode,
|
||||||
|
Reference in New Issue
Block a user