forked from dk96/QuotationMaker
增加ac 公式
parent
53827fd32b
commit
26ea1e0883
|
|
@ -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++;
|
||||
|
|
|
|||
Loading…
Reference in New Issue