| | |
| | | return moreValueArr |
| | | } |
| | | |
| | | func FillMoreUnitToExcel(amount decimal.Decimal, units []models.UnitItems, startIndex int, column int, f *excelize.File) { |
| | | columnStr := strconv.Itoa(column) |
| | | func FillMoreUnitToExcel(units []models.UnitItems, startIndex int, row int, unitIndexMap map[string]int, f *excelize.File) { |
| | | rowStr := strconv.Itoa(row) |
| | | for _, v := range units { |
| | | switch v.Unit { |
| | | case "匹": |
| | | f.SetCellValue("Sheet1", getColumnAlphabet(startIndex)+columnStr, v.Amount.Mul(amount)) |
| | | case "米": |
| | | f.SetCellValue("Sheet1", getColumnAlphabet(startIndex+1)+columnStr, v.Amount.Mul(amount)) |
| | | case "重量": |
| | | f.SetCellValue("Sheet1", getColumnAlphabet(startIndex+2)+columnStr, v.Amount.Mul(amount)) |
| | | } |
| | | f.SetCellValue("Sheet1", getColumnAlphabet(startIndex+unitIndexMap[v.Unit])+rowStr, v.Amount) |
| | | } |
| | | return |
| | | } |