diff --git a/.gitignore b/.gitignore index 770d796..9455f0a 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,5 @@ tmp.pdf *.env *templ.txt token.json -.aider* \ No newline at end of file +.aider* +output.html \ No newline at end of file diff --git a/assets/html/invoice.html b/assets/html/invoice.html index 2f4990c..744913c 100644 --- a/assets/html/invoice.html +++ b/assets/html/invoice.html @@ -1,288 +1,288 @@ - - + + - + - -
- -
- {{ .Host.Name }}
- {{ .Host.Address }}
- {{ .Host.ZipCode }} {{ .Host.City }}
- Tel: {{ .Host.Phone }}
- Mail: {{ .Host.Email }}
-
+ +
+ +
+ {{ .Host.Name }}
+ {{ .Host.Address }}
+ {{ .Host.ZipCode }} {{ .Host.City }}
+ Tel : {{ .Host.Phone }}
+ Mail : {{ .Host.Email }}
-
-
- + +
+
+
- + - - - + + + - - - + + + - - - + + + - + -
{{ .Name }}
Tel:
Tel : {{ .PhoneNumber }}
Voyageurs:
Client : {{ .CustomersNumber }}
Plateforme:
Plateforme : {{ .Platform }}
- +
+ - - + + - - - + + + - - - + + + - - - + + + - + -
Nº de facture:
Nº de facture : {{ .ID }}
Du:
Du : {{ .From }}
Au:
Au : {{ .To }}
Montant Total:
Montant Total : {{ .Total }}
-
-
-
- +
+
+
+
+ - + - + - {{ range .Lines }} - + {{ range .Lines }} + - - {{ end }} + + {{ end }} -
Objet Quantité Prix (€) Total (€)
{{ .Name }} {{ .Quantity }} {{ .Price }} {{ .Total }}
-
+ +
-
-

Historique des Paiements

- +
+

Historique des Paiements

+
- + - + - {{ range .Payments }} - + {{ range .Payments }} + - - {{ end }} + + {{ end }} -
Date Mode de Paiement Montant (€)
{{ .Date }} {{ .Method }} {{ .Amount }}
-
+ +
-
- +
+
- - + + - - - + + + - - - + + + - + -
Montant Total:
Montant Total : {{ .Total }}
Montant Payé:
Montant Payé : {{ .AmountPaid }}
Solde Restant:
Solde Restant : {{ .BalanceDue }}
-
-
-
-
- Notes
- TVA non applicable, art. 293 B du CGI
+ +
+
+
+
+ Notes
+ TVA non applicable, art. 293 B du CGI
Dispensé d’immatriculation au registre du commerce et des sociétés (RCS) - et au répertoire des métiers.
+ et au répertoire des métiers.
Conditions de paiement : paiement à réception de facture. Aucun escompte consenti pour règlement anticipé ou désistement. Tout incident de paiement est passible d'intérêts de retard. Le montant des pénalités résulte de l'application aux sommes restant dues d'un taux d'intérêt - légal en vigueur au moment de l'incident.
-
+ légal en vigueur au moment de l'incident.
-
-
-
+
+
+
+
Total
{{ .Total }}
-
- +
+ diff --git a/cmd/pdf/main.go b/cmd/pdf/main.go index 83f34f3..75e5a61 100644 --- a/cmd/pdf/main.go +++ b/cmd/pdf/main.go @@ -7,6 +7,8 @@ import ( "os" ) +const invoiceTemplate = "assets/html/invoice.html" + func main() { // Define the invoice data structure type Invoice struct { @@ -42,7 +44,7 @@ func main() { } // Read the template file - tmpl, err := template.ParseFiles("assets/html/invoice.html") + tmpl, err := template.ParseFiles(invoiceTemplate) if err != nil { log.Fatalf("Error parsing template: %v", err) } @@ -64,8 +66,8 @@ func main() { Phone: "+590 690 44 15 30", Email: "location.villafleurie@gmail.com", }, - Name: "VillaFleurie", - PhoneNumber: "+590 690 44 15 30", + Name: "Michel Le Corre", + //PhoneNumber: "+590 690 44 15 30", CustomersNumber: 2, Platform: "Privée", ID: "VFNI0332", @@ -107,7 +109,6 @@ func main() { // Create a buffer to store the rendered HTML var buf bytes.Buffer - // Execute the template with the invoice data if err := tmpl.Execute(&buf, invoice); err != nil { log.Fatalf("Error executing template: %v", err) diff --git a/output.html b/output.html deleted file mode 100644 index 6f0c951..0000000 --- a/output.html +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - -
- -
- VillaFleurie
- 4 rue Gerty Archimede
- 97190 Le Gosier
- Tel: +590 690 44 15 30
- Mail: location.villafleurie@gmail.com
-
-
-
-
- - - - - - - - - - - - - - - - - - -
VillaFleurie
Tel:+590 690 44 15 30
Voyageurs:2
Plateforme:Privée
- - - - - - - - - - - - - - - - - - - -
Nº de facture:VFNI0332
Du:15 Janvier 2025
Au:15 Mars 2025
Montant Total:2065.00
-
-
-
- - - - - - - - - - - - - - - - - - - -
ObjetQuantitéPrixTotal
T25935.002065.00
-
-
- - - - - - - - - - - - - - - -
Montant Total:2065.00
Montant Payé:1565.00
Solde Restant:500.00
-
-
-

Historique des Paiements

- - - - - - - - - - - - - - - - - - - - - - - -
DateMode de PaiementMontant
Espèces500.00
Cheque1565.00
-
-
-
-
- Notes
- TVA non applicable, art. 293 B du CGI
- Dispensé d’immatriculation au registre du commerce et des sociétés (RCS) - et au répertoire des métiers.
- Conditions de paiement : paiement à réception de facture. Aucun escompte - consenti pour règlement anticipé ou désistement. Tout incident de - paiement est passible d'intérêts de retard. Le montant des pénalités - résulte de l'application aux sommes restant dues d'un taux d'intérêt - légal en vigueur au moment de l'incident.
-
-
-
-
-
-
Total
-
2065.00
-
-
- -