add invoice view
All checks were successful
Go / build (push) Successful in 12m14s

This commit is contained in:
2025-07-01 15:30:06 +02:00
parent 992b9c17c3
commit 7025f526c1
11 changed files with 257 additions and 83 deletions

View File

@@ -32,6 +32,7 @@ type Invoice struct {
PrintJobs []PrintJob
PricePerClick float64
PartCosts float64
PriceTotal float64
}
type PrintJob struct {
@@ -45,6 +46,8 @@ type PrintJob struct {
CoverPaperTypeId *uint
CoverPaperType *Paper `gorm:"foreignKey:CoverPaperTypeId"`
Amount uint
PricePerPiece float64
PriceTotal float64
InvoiceID uint
}
@@ -134,6 +137,7 @@ func (p *PrintJob) CalculatePrintCosts() (float64, error) {
//Get actual pagecount depending on printmode
actualPageCount := pageCount
fmt.Println("PagCount: ", actualPageCount)
if printMode == CreateBooklet {
dividedCount := float64(pageCount) / 4.0
@@ -156,5 +160,7 @@ func (p *PrintJob) CalculatePrintCosts() (float64, error) {
fmt.Printf("Printing Costs per Zine: %v\n", printingCosts)
fmt.Printf("Printing Costs Total: %v\n", printingCosts*float64(p.Amount))
p.PricePerPiece = printingCosts
p.PriceTotal = printingCosts * float64(p.Amount)
return printingCosts, nil
}