1
0
Fork 0

增加ac 公式

master
dk96 2025-01-03 18:31:38 +08:00
parent 53827fd32b
commit 26ea1e0883
1 changed files with 22 additions and 2 deletions

View File

@ -419,7 +419,7 @@ namespace QuotationMaker.Controllers
if (objSub.quotationSubItem_hasAC == "Y" && objMain.quotationMainItem_ac > 0)
{
acRowIndArr.ToList().Append(editIndex);
acRowIndArr = acRowIndArr.ToList().Append(editIndex).ToArray();
}
row = (XSSFRow)sheet.GetRow(editIndex);
@ -506,7 +506,6 @@ namespace QuotationMaker.Controllers
string tmpForm1 = "SUM(G" + (rangeSubStart + 1).ToString() + ":G" + (rangeSubEnd + 1).ToString() + ")";
row.Cells[6].SetCellFormula(tmpForm1);
row.Cells[6].CellStyle = copyTempCellStyleRight;
row.Cells[6].SetCellType(CellType.Formula);
rowCount++;
@ -523,6 +522,27 @@ namespace QuotationMaker.Controllers
row.Cells[6].CellStyle = copyTempCellStyleRight;
row.Cells[0].SetCellValue(row.Cells[0].StringCellValue.Replace("{quotationMainItem_ac}", objMain.quotationMainItem_ac.ToString()));
//如果有AC用公式取代0
if (objMain.quotationMainItem_ac > 0) {
if (acRowIndArr.Length > 0) {
row.Cells[6].SetCellType(CellType.Formula);
string tmpForm2 = "";
foreach (int acRowIndex in acRowIndArr) {
if (tmpForm2 != "") {
tmpForm2 = tmpForm2 + " + ";
}
tmpForm2 += " ROUND((D" + (acRowIndex + 1).ToString() + " * E" + (acRowIndex + 1).ToString() + ") * " + (objMain.quotationMainItem_ac / 100) + ", 0) ";
}
row.Cells[6].SetCellFormula(tmpForm2);
}
}
rowCount++;
editIndex++;