|
@@ -1305,6 +1305,10 @@ func (rg *RegisterController) InvoiceExport(c *gin.Context) {
|
|
|
resp.FailData("参数解析失败", err.Translate(global.Trans), c)
|
|
|
return
|
|
|
}
|
|
|
+ listName := "开票"
|
|
|
+ if req.InvoiceType == fms.ContractInvoiceTypePay {
|
|
|
+ listName = "到款"
|
|
|
+ }
|
|
|
|
|
|
cond := `invoice_type = ?`
|
|
|
pars := make([]interface{}, 0)
|
|
@@ -1335,7 +1339,7 @@ func (rg *RegisterController) InvoiceExport(c *gin.Context) {
|
|
|
orderRule := `invoice_time DESC`
|
|
|
list, e := cr.List(cond, pars, orderRule)
|
|
|
if e != nil {
|
|
|
- resp.FailData("获取开票/到款列表失败", "Err:"+e.Error(), c)
|
|
|
+ resp.FailData(fmt.Sprintf("获取%s列表失败", listName), "Err:"+e.Error(), c)
|
|
|
return
|
|
|
}
|
|
|
if len(list) == 0 {
|
|
@@ -1354,7 +1358,7 @@ func (rg *RegisterController) InvoiceExport(c *gin.Context) {
|
|
|
style.Alignment = alignment
|
|
|
style.ApplyAlignment = true
|
|
|
|
|
|
- sheet, err := xlsxFile.AddSheet("开票列表")
|
|
|
+ sheet, err := xlsxFile.AddSheet(fmt.Sprintf("%s列表", listName))
|
|
|
if err != nil {
|
|
|
resp.FailData("新增Sheet失败", "Err:"+err.Error(), c)
|
|
|
return
|
|
@@ -1367,10 +1371,10 @@ func (rg *RegisterController) InvoiceExport(c *gin.Context) {
|
|
|
cell1.SetValue("合同编号")
|
|
|
cell1.SetStyle(style)
|
|
|
cell2 := titleRow.AddCell()
|
|
|
- cell2.SetValue("开票金额")
|
|
|
+ cell2.SetValue(fmt.Sprintf("%s金额", listName))
|
|
|
cell2.SetStyle(style)
|
|
|
cell3 := titleRow.AddCell()
|
|
|
- cell3.SetValue("开票日期")
|
|
|
+ cell3.SetValue(fmt.Sprintf("%s日期", listName))
|
|
|
cell3.SetStyle(style)
|
|
|
|
|
|
for _, v := range list {
|
|
@@ -1386,7 +1390,7 @@ func (rg *RegisterController) InvoiceExport(c *gin.Context) {
|
|
|
_ = xlsxFile.Write(&buffer)
|
|
|
content := bytes.NewReader(buffer.Bytes())
|
|
|
randStr := time.Now().Format(utils.FormatDateTimeUnSpace)
|
|
|
- fileName := "开票列表_" + randStr + ".xlsx"
|
|
|
+ fileName := fmt.Sprintf("%s列表_%s.xlsx", listName, randStr)
|
|
|
|
|
|
c.Writer.Header().Add("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"`, fileName))
|
|
|
c.Writer.Header().Add("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|