This commit is contained in:
@@ -113,6 +113,7 @@ func (rc *printController) PrintHandler(c *gin.Context) {
|
||||
}
|
||||
|
||||
var printJobs []models.PrintJob
|
||||
priceTotal := 0.0
|
||||
for idx := range variantIds {
|
||||
variant, err := repositories.ShopItems.GetVariantById(variantIds[idx])
|
||||
|
||||
@@ -160,13 +161,7 @@ func (rc *printController) PrintHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
printJob.CalculatePrintCosts()
|
||||
printJob, err = repositories.PrintJobs.Create(printJob)
|
||||
|
||||
if err != nil {
|
||||
c.HTML(http.StatusBadRequest, "error.html", gin.H{"data": gin.H{"error": err}})
|
||||
return
|
||||
}
|
||||
|
||||
priceTotal += printJob.PriceTotal
|
||||
printJobs = append(printJobs, printJob)
|
||||
}
|
||||
|
||||
@@ -174,6 +169,7 @@ func (rc *printController) PrintHandler(c *gin.Context) {
|
||||
PrintJobs: printJobs,
|
||||
PricePerClick: 0.002604,
|
||||
PartCosts: 0.0067,
|
||||
PriceTotal: priceTotal,
|
||||
}
|
||||
invoice, err := repositories.Invoices.Create(invoice)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user