update formula 1
parent
e5e3ec4f38
commit
53827fd32b
|
|
@ -22,6 +22,7 @@ using System.Web;
|
||||||
using NPOI.SS.Util;
|
using NPOI.SS.Util;
|
||||||
using NPOI.XSSF.Streaming;
|
using NPOI.XSSF.Streaming;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace QuotationMaker.Controllers
|
namespace QuotationMaker.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -382,7 +383,7 @@ namespace QuotationMaker.Controllers
|
||||||
greyStyle2.FillForegroundColor = 0;
|
greyStyle2.FillForegroundColor = 0;
|
||||||
((XSSFColor)greyStyle2.FillForegroundColorColor).SetRgb(new byte[] { r, g, b });
|
((XSSFColor)greyStyle2.FillForegroundColorColor).SetRgb(new byte[] { r, g, b });
|
||||||
greyStyle2.FillPattern = FillPattern.SolidForeground;
|
greyStyle2.FillPattern = FillPattern.SolidForeground;
|
||||||
|
|
||||||
row.Cells[0].CellStyle = greyStyle1;
|
row.Cells[0].CellStyle = greyStyle1;
|
||||||
row.Cells[1].CellStyle = greyStyle2;
|
row.Cells[1].CellStyle = greyStyle2;
|
||||||
|
|
||||||
|
|
@ -392,6 +393,10 @@ namespace QuotationMaker.Controllers
|
||||||
int acTotal = 0;
|
int acTotal = 0;
|
||||||
|
|
||||||
int subItemNum = 0;
|
int subItemNum = 0;
|
||||||
|
|
||||||
|
int rangeSubStart = editIndex + 1;
|
||||||
|
int rangeSubEnd = editIndex + 1;
|
||||||
|
int[] acRowIndArr = new int[0];
|
||||||
//合併子項目row
|
//合併子項目row
|
||||||
foreach (quotationSubItem objSub in objMain.quotationSubItems)
|
foreach (quotationSubItem objSub in objMain.quotationSubItems)
|
||||||
{
|
{
|
||||||
|
|
@ -406,7 +411,17 @@ namespace QuotationMaker.Controllers
|
||||||
descript = descript + " (此項不加AC)";
|
descript = descript + " (此項不加AC)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
editIndex++;
|
editIndex++;
|
||||||
|
rangeSubEnd = editIndex;
|
||||||
|
|
||||||
|
if (objSub.quotationSubItem_hasAC == "Y" && objMain.quotationMainItem_ac > 0)
|
||||||
|
{
|
||||||
|
acRowIndArr.ToList().Append(editIndex);
|
||||||
|
}
|
||||||
|
|
||||||
row = (XSSFRow)sheet.GetRow(editIndex);
|
row = (XSSFRow)sheet.GetRow(editIndex);
|
||||||
row.Height = -1;
|
row.Height = -1;
|
||||||
row.Cells[0].SetCellValue(subItemNumberTxt);
|
row.Cells[0].SetCellValue(subItemNumberTxt);
|
||||||
|
|
@ -485,9 +500,13 @@ namespace QuotationMaker.Controllers
|
||||||
|
|
||||||
row = (XSSFRow)sheet.GetRow(editIndex);
|
row = (XSSFRow)sheet.GetRow(editIndex);
|
||||||
//row.Cells[6].SetCellValue("NTD " + (objMain.quotationMainItem_subTotal - acTotal).ToString("###,###"));
|
//row.Cells[6].SetCellValue("NTD " + (objMain.quotationMainItem_subTotal - acTotal).ToString("###,###"));
|
||||||
row.Cells[6].SetCellType(CellType.Numeric);
|
// 20250103 先刪除測試公式 row.Cells[6].SetCellType(CellType.Numeric);
|
||||||
row.Cells[6].SetCellValue((objMain.quotationMainItem_subTotal - acTotal));
|
// 20250103 先刪除測試公式 row.Cells[6].SetCellValue((objMain.quotationMainItem_subTotal - acTotal));
|
||||||
|
row.Cells[6].SetCellType(CellType.Formula);
|
||||||
|
string tmpForm1 = "SUM(G" + (rangeSubStart + 1).ToString() + ":G" + (rangeSubEnd + 1).ToString() + ")";
|
||||||
|
row.Cells[6].SetCellFormula(tmpForm1);
|
||||||
row.Cells[6].CellStyle = copyTempCellStyleRight;
|
row.Cells[6].CellStyle = copyTempCellStyleRight;
|
||||||
|
row.Cells[6].SetCellType(CellType.Formula);
|
||||||
|
|
||||||
rowCount++;
|
rowCount++;
|
||||||
|
|
||||||
|
|
@ -678,6 +697,8 @@ namespace QuotationMaker.Controllers
|
||||||
//row = (XSSFRow)sheet.GetRow(saRowIndex + 2);
|
//row = (XSSFRow)sheet.GetRow(saRowIndex + 2);
|
||||||
//row.Height = 8000;
|
//row.Height = 8000;
|
||||||
|
|
||||||
|
XSSFFormulaEvaluator.EvaluateAllFormulaCells(workbook);
|
||||||
|
|
||||||
MemoryStream ms = new MemoryStream();
|
MemoryStream ms = new MemoryStream();
|
||||||
workbook.Write(ms);
|
workbook.Write(ms);
|
||||||
ms.Flush();
|
ms.Flush();
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,20 @@ public static class GlobalClass
|
||||||
return Uri.IsWellFormedUriString(url, UriKind.Absolute);
|
return Uri.IsWellFormedUriString(url, UriKind.Absolute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string indexToEng(int Number)
|
||||||
|
{
|
||||||
|
string allChar = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
|
||||||
|
string[] allCharArray = allChar.Split(',');
|
||||||
|
|
||||||
|
if (Number > 25)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return allCharArray[Number];
|
||||||
|
}
|
||||||
|
}
|
||||||
public static string GetIP(this HttpContext context)
|
public static string GetIP(this HttpContext context)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue