Bläddra i källkod

fix price unit && local time

animeic 2 år sedan
förälder
incheckning
6945805ed1

+ 1 - 1
boxcost/api/bill-produce-excel.go

@@ -97,7 +97,7 @@ func (b *ProduceBillExcel) drawSubTitles() error {
 
 	//第二行
 	drawLeft(row+1, "供应商名称:"+b.Content.Supplier)
-	timeformat := b.Content.CreateTime.Format("2006年01月02号 15:04:05")
+	timeformat := b.Content.CreateTime.Local().Format("2006年01月02号 15:04:05")
 	drawRight(row+1, "下单时间:"+timeformat)
 	b.Excel.SetRowHeight(b.SheetName, row+1, 21)
 

+ 13 - 2
boxcost/api/bill-purchase-excel.go

@@ -96,7 +96,7 @@ func (b *PurchaseBillExcel) drawSubTitles() error {
 
 	//第二行
 	drawLeft(row+1, "供应商名称:"+b.Content.Supplier)
-	timeformat := b.Content.CreateTime.Format("2006年01月02号 15:04:05")
+	timeformat := b.Content.CreateTime.Local().Format("2006年01月02号 15:04:05")
 	drawRight(row+1, "下单时间:"+timeformat)
 	b.Excel.SetRowHeight(b.SheetName, row+1, 21)
 
@@ -170,7 +170,18 @@ func (b *PurchaseBillExcel) drawTableTitle() error {
 
 	drawCol2("C", "D", "尺寸(mm)", "长", "宽")
 	drawCol2("C", "D", "尺寸(mm)", "长", "宽")
-	drawCol2("F", "G", "单价", "元/张", "元/吨")
+	unit1 := "元/张"
+	unit2 := "元/吨"
+	if len(b.Content.Paper) > 0 {
+		if b.Content.Paper[0].PriceUnit != "" {
+			unit1 = b.Content.Paper[0].PriceUnit
+		}
+		if b.Content.Paper[0].Price2Unit != "" {
+			unit2 = b.Content.Paper[0].Price2Unit
+		}
+	}
+
+	drawCol2("F", "G", "单价", unit1, unit2)
 
 	return nil
 }

+ 5 - 1
boxcost/api/test_print.go

@@ -1,6 +1,8 @@
 package api
 
 import (
+	"time"
+
 	"github.com/gin-gonic/gin"
 )
 
@@ -8,6 +10,8 @@ func Printr(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 
 	// id, _ := primitive.ObjectIDFromHex("638edc9ac3242a12b462efce")
 	// return searchBillTypeById(apictx, repo.CollectionBillProduce, id)
-	return generateSerial(apictx, "纸张类")
+	// return generateSerial(apictx, "纸张类")
+	now := time.Now()
+	return now.Local().Format("2006年01月02号 15:04:05"), nil
 
 }

+ 4 - 2
boxcost/db/model/bill.go

@@ -19,8 +19,10 @@ type PaperBill struct {
 	//长
 	Height string `bson:"height,omitempty" json:"height"`
 
-	Price  string `bson:"price,omitempty" json:"price"`
-	Price2 string `bson:"price2,omitempty" json:"price2"`
+	Price      string `bson:"price,omitempty" json:"price"`
+	Price2     string `bson:"price2,omitempty" json:"price2"`
+	PriceUnit  string `bson:"priceUnit,omitempty" json:"priceUnit"`
+	Price2Unit string `bson:"price2Unit,omitempty" json:"price2Unit"`
 
 	//数量
 	Count int `bson:"count,omitempty" json:"count"`