Quote largely working
This commit is contained in:
parent
846fd36c9f
commit
9becb1c5c9
|
|
@ -108,18 +108,27 @@ func (g *HTMLDocumentGenerator) BuildInvoiceHTML(data *InvoicePDFData, totalPage
|
|||
}
|
||||
|
||||
// Parse and execute template
|
||||
// Try multiple possible paths to find the template
|
||||
possiblePaths := []string{
|
||||
filepath.Join("internal", "cmc", "pdf", "templates", "invoice.html"),
|
||||
filepath.Join("go", "internal", "cmc", "pdf", "templates", "invoice.html"),
|
||||
"/app/go/internal/cmc/pdf/templates/invoice.html",
|
||||
// Try multiple possible path sets to find the invoice and shared header templates together
|
||||
possiblePathSets := [][]string{
|
||||
{
|
||||
filepath.Join("internal", "cmc", "pdf", "templates", "invoice.html"),
|
||||
filepath.Join("internal", "cmc", "pdf", "templates", "header.html"),
|
||||
},
|
||||
{
|
||||
filepath.Join("go", "internal", "cmc", "pdf", "templates", "invoice.html"),
|
||||
filepath.Join("go", "internal", "cmc", "pdf", "templates", "header.html"),
|
||||
},
|
||||
{
|
||||
"/app/go/internal/cmc/pdf/templates/invoice.html",
|
||||
"/app/go/internal/cmc/pdf/templates/header.html",
|
||||
},
|
||||
}
|
||||
|
||||
var tmpl *template.Template
|
||||
var err error
|
||||
|
||||
for _, tmplPath := range possiblePaths {
|
||||
tmpl, err = template.New("invoice.html").Funcs(funcMap).ParseFiles(tmplPath)
|
||||
for _, pathSet := range possiblePathSets {
|
||||
tmpl, err = template.New("invoice.html").Funcs(funcMap).ParseFiles(pathSet...)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,18 +158,27 @@ func (g *HTMLDocumentGenerator) BuildQuoteHTML(data *QuotePDFData, totalPages in
|
|||
}
|
||||
|
||||
// Parse and execute template
|
||||
// Try multiple possible paths to find the template
|
||||
possiblePaths := []string{
|
||||
filepath.Join("internal", "cmc", "pdf", "templates", "quote.html"),
|
||||
filepath.Join("go", "internal", "cmc", "pdf", "templates", "quote.html"),
|
||||
"/app/go/internal/cmc/pdf/templates/quote.html",
|
||||
// Try multiple possible path sets to find the quote and shared header templates together
|
||||
possiblePathSets := [][]string{
|
||||
{
|
||||
filepath.Join("internal", "cmc", "pdf", "templates", "quote.html"),
|
||||
filepath.Join("internal", "cmc", "pdf", "templates", "header.html"),
|
||||
},
|
||||
{
|
||||
filepath.Join("go", "internal", "cmc", "pdf", "templates", "quote.html"),
|
||||
filepath.Join("go", "internal", "cmc", "pdf", "templates", "header.html"),
|
||||
},
|
||||
{
|
||||
"/app/go/internal/cmc/pdf/templates/quote.html",
|
||||
"/app/go/internal/cmc/pdf/templates/header.html",
|
||||
},
|
||||
}
|
||||
|
||||
var tmpl *template.Template
|
||||
var err error
|
||||
|
||||
for _, tmplPath := range possiblePaths {
|
||||
tmpl, err = template.New("quote.html").Funcs(funcMap).ParseFiles(tmplPath)
|
||||
for _, pathSet := range possiblePathSets {
|
||||
tmpl, err = template.New("quote.html").Funcs(funcMap).ParseFiles(pathSet...)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
|
|
|
|||
26
go/internal/cmc/pdf/templates/header.html
Normal file
26
go/internal/cmc/pdf/templates/header.html
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{{define "CompanyHeader"}}
|
||||
<!-- Company Header with Logo and Centered Title -->
|
||||
<div style="display: flex; align-items: flex-start; gap: 2mm; margin-bottom: 0;">
|
||||
<img src="{{.LogoDataURI}}" class="logo" alt="CMC Logo" style="width: 40mm; height: auto; display: block; padding-right: 5mm;">
|
||||
<div style="flex: 1;">
|
||||
<div style="border-bottom: 2px solid #000; padding-bottom: 0mm; text-align: center;">
|
||||
<h1 style="font-size: 32pt; color: #003399; margin: 0 0 -1mm 0;">CMC TECHNOLOGIES</h1>
|
||||
<p style="margin: 0mm 0 1mm 0; font-size: 10pt;">PTY LIMITED ACN: 085 991 224 ABN: 47 085 991 224</p>
|
||||
</div>
|
||||
<!-- Contact Details Below Line -->
|
||||
<div style="display: flex; justify-content: space-between; margin: 2mm 2mm 2mm 2mm; font-size: 10pt;">
|
||||
<div>
|
||||
<strong>Phone:</strong> +61 2 9669 4000<br>
|
||||
<strong>Fax:</strong> +61 2 9669 4111<br>
|
||||
<strong>Email:</strong> <a href="mailto:sales@cmctechnologies.com.au" style="color: #0000FF; text-decoration: underline;">sales@cmctechnologies.com.au</a><br>
|
||||
<strong>Web Site:</strong> <a href="http://www.cmctechnologies.net.au" style="color: #0000FF; text-decoration: underline;">www.cmctechnologies.net.au</a>
|
||||
</div>
|
||||
<div style="text-align: right;">
|
||||
Unit 19, 77 Bourke Rd<br>
|
||||
Alexandria NSW 2015<br>
|
||||
AUSTRALIA
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
|
@ -308,30 +308,7 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Company Header with Logo and Centered Title -->
|
||||
<div style="display: flex; align-items: flex-start; gap: 2mm; margin-bottom: 0;">
|
||||
<img src="{{.LogoDataURI}}" class="logo" alt="CMC Logo" style="width: 40mm; height: auto; display: block; padding-right: 5mm;">
|
||||
<div style="flex: 1;">
|
||||
<div style="border-bottom: 2px solid #000; padding-bottom: 0mm; text-align: center;">
|
||||
<h1 style="font-size: 32pt; color: #003399; margin: 0 0 -1mm 0;">CMC TECHNOLOGIES</h1>
|
||||
<p style="margin: 0mm 0 1mm 0; font-size: 10pt;">PTY LIMITED ACN: 085 991 224 ABN: 47 085 991 224</p>
|
||||
</div>
|
||||
<!-- Contact Details Below Line -->
|
||||
<div style="display: flex; justify-content: space-between; margin: 2mm 2mm 2mm 2mm; font-size: 10pt;">
|
||||
<div>
|
||||
<strong>Phone:</strong> +61 2 9669 4000<br>
|
||||
<strong>Fax:</strong> +61 2 9669 4111<br>
|
||||
<strong>Email:</strong> <a href="mailto:sales@cmctechnologies.com.au" style="color: #0000FF; text-decoration: underline;">sales@cmctechnologies.com.au</a><br>
|
||||
<strong>Web Site:</strong> <a href="http://www.cmctechnologies.net.au" style="color: #0000FF; text-decoration: underline;">www.cmctechnologies.net.au</a>
|
||||
</div>
|
||||
<div style="text-align: right;">
|
||||
Unit 19, 77 Bourke Rd<br>
|
||||
Alexandria NSW 2015<br>
|
||||
AUSTRALIA
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "CompanyHeader" .}}
|
||||
|
||||
<!-- TAX INVOICE Section with Invoice Number and Date -->
|
||||
<div style="display: flex; justify-content: space-between; align-items: center; margin: 2mm 0 3mm 0;">
|
||||
|
|
|
|||
|
|
@ -8,29 +8,7 @@
|
|||
size: A4;
|
||||
margin: 15mm;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
font-size: 9pt;
|
||||
line-height: 1.4;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0000FF;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.company-info {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10mm;
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
|
||||
.logo {
|
||||
width: 40mm;
|
||||
height: auto;
|
||||
|
|
@ -328,36 +306,7 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Company Header -->
|
||||
<div class="company-info">
|
||||
{{if .LogoDataURI}}
|
||||
<img src="{{.LogoDataURI}}" class="logo" alt="CMC Technologies Logo">
|
||||
{{end}}
|
||||
<div class="company-header">
|
||||
<h1>CMC TECHNOLOGIES</h1>
|
||||
<p>PTY LIMITED ACN: 085 991 224 ABN: 47 085 991 224</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="header-separator"></div>
|
||||
|
||||
<!-- Contact Details Section -->
|
||||
<div class="contact-section">
|
||||
<div class="engineering-col">
|
||||
<div>Engineering &</div>
|
||||
<div>Industrial</div>
|
||||
<div>Instrumentation</div>
|
||||
</div>
|
||||
<div class="contact-col">
|
||||
<div><strong>Phone:</strong> +61 2 9669 4000</div>
|
||||
<div><strong>Fax:</strong> +61 2 9669 4111</div>
|
||||
<div><strong>Email:</strong> sales@cmctechnologies.com.au</div>
|
||||
<div><strong>Web Site:</strong> www.cmctechnologies.net.au</div>
|
||||
<div style="margin-top: 3mm;">Unit 19, 77 Bourke Rd</div>
|
||||
<div>Alexandria NSW 2015</div>
|
||||
<div>AUSTRALIA</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "CompanyHeader" .}}
|
||||
|
||||
<!-- Quote Details Box -->
|
||||
<table class="details-box">
|
||||
|
|
|
|||
Loading…
Reference in a new issue