diff options
Diffstat (limited to 'internal/reports/pdf.go')
-rw-r--r-- | internal/reports/pdf.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/internal/reports/pdf.go b/internal/reports/pdf.go index 8434f07..b83436f 100644 --- a/internal/reports/pdf.go +++ b/internal/reports/pdf.go @@ -9,8 +9,8 @@ import ( "path/filepath" "time" - "punchcard/internal/queries" - "punchcard/templates" + "git.tjp.lol/punchcard/internal/queries" + "git.tjp.lol/punchcard/templates" ) // RecordInvoice records the invoice in the database after successful generation @@ -229,16 +229,16 @@ type UnifiedJSONData struct { ContractorName string `json:"contractor_name"` ContractorLabel string `json:"contractor_label"` ContractorEmail string `json:"contractor_email"` - + // Invoice-specific fields InvoiceNumber string `json:"invoice_number"` LineItems []LineItem `json:"line_items"` TotalAmount float64 `json:"total_amount"` - + // Timesheet-specific fields - Entries []TimesheetEntry `json:"entries"` - Timezone string `json:"timezone"` - + Entries []TimesheetEntry `json:"entries"` + Timezone string `json:"timezone"` + // Shared field with same value TotalHours float64 `json:"total_hours"` } @@ -268,7 +268,7 @@ func GenerateUnifiedPDF(unifiedData *UnifiedReportData, outputPath string) error ContractorLabel: unifiedData.InvoiceData.ContractorLabel, ContractorEmail: unifiedData.InvoiceData.ContractorEmail, TotalHours: unifiedData.InvoiceData.TotalHours, // Should match timesheet total - + // Invoice-specific fields InvoiceNumber: fmt.Sprintf("%04d-%02d-%03d", unifiedData.InvoiceData.DateRange.Start.Year(), @@ -277,7 +277,7 @@ func GenerateUnifiedPDF(unifiedData *UnifiedReportData, outputPath string) error ), LineItems: unifiedData.InvoiceData.LineItems, TotalAmount: unifiedData.InvoiceData.TotalAmount, - + // Timesheet-specific fields Entries: unifiedData.TimesheetData.Entries, Timezone: unifiedData.TimesheetData.Timezone, @@ -296,7 +296,7 @@ func GenerateUnifiedPDF(unifiedData *UnifiedReportData, outputPath string) error // Create unified template by combining invoice and timesheet templates unifiedTemplate := templates.InvoiceTemplate + "\n\n#pagebreak()\n\n" + templates.TimesheetTemplate - + // Write Typst template file typstFile := filepath.Join(tempDir, "unified.typ") if err := os.WriteFile(typstFile, []byte(unifiedTemplate), 0o644); err != nil { |