final 3
parent
fd39f359c9
commit
10b79312b7
|
|
@ -127,24 +127,44 @@ namespace QuotationMaker.Controllers
|
||||||
row = (XSSFRow)sheet.GetRow(5);
|
row = (XSSFRow)sheet.GetRow(5);
|
||||||
row.Cells[0].SetCellValue(row.Cells[0].StringCellValue.Replace("{date_range}", startDateStr + " 至 " + endDateStr));
|
row.Cells[0].SetCellValue(row.Cells[0].StringCellValue.Replace("{date_range}", startDateStr + " 至 " + endDateStr));
|
||||||
|
|
||||||
|
// Copy style from old cell and apply to new cell
|
||||||
|
XSSFCellStyle copyTempCellStyle = (XSSFCellStyle)workbook.CreateCellStyle();
|
||||||
|
|
||||||
|
|
||||||
//估價單總價項目
|
//估價單總價項目
|
||||||
row = (XSSFRow)sheet.GetRow(11);
|
row = (XSSFRow)sheet.GetRow(11);
|
||||||
row.Cells[6].SetCellValue(row.Cells[6].StringCellValue.Replace("{quotation_noTaxTotal}", objDetail.quotation_noTaxTotal.ToString("###,###")));
|
copyTempCellStyle.CloneStyleFrom(row.Cells[6].CellStyle);
|
||||||
|
copyTempCellStyle.DataFormat = workbook.CreateDataFormat().GetFormat("\"NTD \"#,##0");
|
||||||
|
row.Cells[6].SetCellType(CellType.Numeric);
|
||||||
|
row.Cells[6].SetCellValue(objDetail.quotation_noTaxTotal);
|
||||||
|
row.Cells[6].CellStyle = copyTempCellStyle;
|
||||||
|
|
||||||
row = (XSSFRow)sheet.GetRow(12);
|
row = (XSSFRow)sheet.GetRow(12);
|
||||||
|
|
||||||
string quotation_specTotal = "";
|
//string quotation_specTotal = "";
|
||||||
|
|
||||||
if (objDetail.quotation_specTotal > 0) {
|
if (objDetail.quotation_specTotal > 0) {
|
||||||
quotation_specTotal = objDetail.quotation_specTotal.ToString("###,###");
|
row.Cells[6].SetCellType(CellType.Numeric);
|
||||||
|
row.Cells[6].SetCellValue(objDetail.quotation_specTotal);
|
||||||
|
row.Cells[6].CellStyle = copyTempCellStyle;
|
||||||
|
} else {
|
||||||
|
row.Cells[6].SetCellValue("");
|
||||||
}
|
}
|
||||||
|
|
||||||
row.Cells[6].SetCellValue(row.Cells[6].StringCellValue.Replace("{quotation_specTotal}", quotation_specTotal));
|
|
||||||
|
//row.Cells[6].SetCellValue(row.Cells[6].StringCellValue.Replace("{quotation_specTotal}", quotation_specTotal));
|
||||||
|
|
||||||
row = (XSSFRow)sheet.GetRow(13);
|
row = (XSSFRow)sheet.GetRow(13);
|
||||||
row.Cells[6].SetCellValue(row.Cells[6].StringCellValue.Replace("{quotation_tax}", objDetail.quotation_tax.ToString("###,###")));
|
//row.Cells[6].SetCellValue(row.Cells[6].StringCellValue.Replace("{quotation_tax}", objDetail.quotation_tax.ToString("###,###")));
|
||||||
|
row.Cells[6].SetCellType(CellType.Numeric);
|
||||||
|
row.Cells[6].SetCellValue(objDetail.quotation_tax);
|
||||||
|
row.Cells[6].CellStyle = copyTempCellStyle;
|
||||||
|
|
||||||
row = (XSSFRow)sheet.GetRow(14);
|
row = (XSSFRow)sheet.GetRow(14);
|
||||||
row.Cells[6].SetCellValue(row.Cells[6].StringCellValue.Replace("{quotation_grandTotal}", objDetail.quotation_grandTotal.ToString("###,###")));
|
//row.Cells[6].SetCellValue(row.Cells[6].StringCellValue.Replace("{quotation_grandTotal}", objDetail.quotation_grandTotal.ToString("###,###")));
|
||||||
|
row.Cells[6].SetCellType(CellType.Numeric);
|
||||||
|
row.Cells[6].SetCellValue(objDetail.quotation_grandTotal);
|
||||||
|
row.Cells[6].CellStyle = copyTempCellStyle;
|
||||||
|
|
||||||
//服務協議
|
//服務協議
|
||||||
string services_aggrement = objDetail.quotation_sa;
|
string services_aggrement = objDetail.quotation_sa;
|
||||||
|
|
@ -200,7 +220,10 @@ namespace QuotationMaker.Controllers
|
||||||
|
|
||||||
row.Cells[3].SetCellValue(objDetail.invoices[i - 1].invoice_name);
|
row.Cells[3].SetCellValue(objDetail.invoices[i - 1].invoice_name);
|
||||||
row.Cells[4].SetCellValue(objDetail.invoices[i - 1].invoice_year.ToString() + "/" + objDetail.invoices[i - 1].invoice_month.ToString().PadLeft(2, '0'));
|
row.Cells[4].SetCellValue(objDetail.invoices[i - 1].invoice_year.ToString() + "/" + objDetail.invoices[i - 1].invoice_month.ToString().PadLeft(2, '0'));
|
||||||
row.Cells[6].SetCellValue("$NT" + objDetail.invoices[i - 1].invoice_noTaxMoney.ToString("###,###"));
|
//row.Cells[6].SetCellValue("$NT" + objDetail.invoices[i - 1].invoice_noTaxMoney.ToString("###,###"));
|
||||||
|
row.Cells[6].SetCellType(CellType.Numeric);
|
||||||
|
row.Cells[6].SetCellValue(objDetail.invoices[i - 1].invoice_noTaxMoney);
|
||||||
|
row.Cells[6].CellStyle = copyTempCellStyle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -279,10 +302,26 @@ namespace QuotationMaker.Controllers
|
||||||
row.Height = -1;
|
row.Height = -1;
|
||||||
row.Cells[1].SetCellValue(objSub.quotationSubItem_name);
|
row.Cells[1].SetCellValue(objSub.quotationSubItem_name);
|
||||||
row.Cells[2].SetCellValue(descript);
|
row.Cells[2].SetCellValue(descript);
|
||||||
row.Cells[3].SetCellValue("NTD " + objSub.quotationSubItem_price.ToString("###,###"));
|
|
||||||
row.Cells[4].SetCellValue(objSub.quotationSubItem_number.ToString("###,###"));
|
row.Cells[3].SetCellType(CellType.Numeric);
|
||||||
|
row.Cells[3].SetCellValue(objSub.quotationSubItem_price);
|
||||||
|
row.Cells[3].CellStyle = copyTempCellStyle;
|
||||||
|
|
||||||
|
row.Cells[4].SetCellType(CellType.Numeric);
|
||||||
|
row.Cells[4].SetCellValue(objSub.quotationSubItem_number);
|
||||||
|
row.Cells[4].CellStyle = copyTempCellStyle;
|
||||||
|
|
||||||
row.Cells[5].SetCellValue(objSub.quotationSubItem_unitType);
|
row.Cells[5].SetCellValue(objSub.quotationSubItem_unitType);
|
||||||
|
|
||||||
|
|
||||||
|
row.Cells[6].SetCellType(CellType.Numeric);
|
||||||
row.Cells[6].SetCellValue(objSub.quotationSubItem_subTotal);
|
row.Cells[6].SetCellValue(objSub.quotationSubItem_subTotal);
|
||||||
|
row.Cells[6].CellStyle = copyTempCellStyle;
|
||||||
|
|
||||||
|
//row.Cells[3].SetCellValue("NTD " + objSub.quotationSubItem_price.ToString("###,###"));
|
||||||
|
//row.Cells[4].SetCellValue(objSub.quotationSubItem_number.ToString("###,###"));
|
||||||
|
//row.Cells[5].SetCellValue(objSub.quotationSubItem_unitType);
|
||||||
|
//row.Cells[6].SetCellValue(objSub.quotationSubItem_subTotal);
|
||||||
|
|
||||||
if (objSub.quotationSubItem_hasAC == "Y") {
|
if (objSub.quotationSubItem_hasAC == "Y") {
|
||||||
acTotal += (int)Math.Round((objSub.quotationSubItem_price * objSub.quotationSubItem_number) * (objMain.quotationMainItem_ac / 100));
|
acTotal += (int)Math.Round((objSub.quotationSubItem_price * objSub.quotationSubItem_number) * (objMain.quotationMainItem_ac / 100));
|
||||||
|
|
@ -304,8 +343,10 @@ namespace QuotationMaker.Controllers
|
||||||
CopyRow((XSSFWorkbook)workbook, (XSSFSheet)sheet, subTotalIndex, editIndex);
|
CopyRow((XSSFWorkbook)workbook, (XSSFSheet)sheet, subTotalIndex, editIndex);
|
||||||
|
|
||||||
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);
|
||||||
|
row.Cells[6].SetCellValue((objMain.quotationMainItem_subTotal - acTotal));
|
||||||
|
row.Cells[6].CellStyle = copyTempCellStyle;
|
||||||
|
|
||||||
rowCount++;
|
rowCount++;
|
||||||
|
|
||||||
|
|
@ -315,7 +356,10 @@ namespace QuotationMaker.Controllers
|
||||||
CopyRow((XSSFWorkbook)workbook, (XSSFSheet)sheet, acIndex, editIndex);
|
CopyRow((XSSFWorkbook)workbook, (XSSFSheet)sheet, acIndex, editIndex);
|
||||||
|
|
||||||
row = (XSSFRow)sheet.GetRow(editIndex);
|
row = (XSSFRow)sheet.GetRow(editIndex);
|
||||||
row.Cells[6].SetCellValue("NTD " + acTotal.ToString("###,###"));
|
//row.Cells[6].SetCellValue("NTD " + acTotal.ToString("###,###"));
|
||||||
|
row.Cells[6].SetCellType(CellType.Numeric);
|
||||||
|
row.Cells[6].SetCellValue(acTotal);
|
||||||
|
row.Cells[6].CellStyle = copyTempCellStyle;
|
||||||
row.Cells[0].SetCellValue(row.Cells[0].StringCellValue.Replace("{quotationMainItem_ac}", objMain.quotationMainItem_ac.ToString()));
|
row.Cells[0].SetCellValue(row.Cells[0].StringCellValue.Replace("{quotationMainItem_ac}", objMain.quotationMainItem_ac.ToString()));
|
||||||
|
|
||||||
rowCount++;
|
rowCount++;
|
||||||
|
|
@ -325,8 +369,10 @@ namespace QuotationMaker.Controllers
|
||||||
//複製此項目總金額欄
|
//複製此項目總金額欄
|
||||||
CopyRow((XSSFWorkbook)workbook, (XSSFSheet)sheet, sutTotalAcIndex, editIndex);
|
CopyRow((XSSFWorkbook)workbook, (XSSFSheet)sheet, sutTotalAcIndex, editIndex);
|
||||||
row = (XSSFRow)sheet.GetRow(editIndex);
|
row = (XSSFRow)sheet.GetRow(editIndex);
|
||||||
row.Cells[6].SetCellValue("NTD " + (objMain.quotationMainItem_subTotal).ToString("###,###"));
|
//row.Cells[6].SetCellValue("NTD " + (objMain.quotationMainItem_subTotal).ToString("###,###"));
|
||||||
|
row.Cells[6].SetCellType(CellType.Numeric);
|
||||||
|
row.Cells[6].SetCellValue(objMain.quotationMainItem_subTotal);
|
||||||
|
row.Cells[6].CellStyle = copyTempCellStyle;
|
||||||
rowCount++;
|
rowCount++;
|
||||||
editRowIndex++;
|
editRowIndex++;
|
||||||
//break;
|
//break;
|
||||||
|
|
@ -384,7 +430,7 @@ namespace QuotationMaker.Controllers
|
||||||
row.Height = 8190;
|
row.Height = 8190;
|
||||||
|
|
||||||
row = (XSSFRow)sheet.GetRow(saRowIndex + 2);
|
row = (XSSFRow)sheet.GetRow(saRowIndex + 2);
|
||||||
row.Height = 4000;
|
row.Height = 8000;
|
||||||
|
|
||||||
MemoryStream ms = new MemoryStream();
|
MemoryStream ms = new MemoryStream();
|
||||||
workbook.Write(ms);
|
workbook.Write(ms);
|
||||||
|
|
@ -398,10 +444,10 @@ namespace QuotationMaker.Controllers
|
||||||
|
|
||||||
string agent = Request.Headers["User-Agent"].ToString();
|
string agent = Request.Headers["User-Agent"].ToString();
|
||||||
|
|
||||||
if (agent.Contains("Macintosh"))
|
//if (agent.Contains("Macintosh"))
|
||||||
{
|
//{
|
||||||
downloadName = HttpUtility.UrlEncode(downloadName, Encoding.UTF8);
|
// downloadName = HttpUtility.UrlEncode(downloadName, Encoding.UTF8);
|
||||||
}
|
//}
|
||||||
|
|
||||||
return File(newStream, "application/vnd.ms-excel", downloadName + ".xlsx");
|
return File(newStream, "application/vnd.ms-excel", downloadName + ".xlsx");
|
||||||
|
|
||||||
|
|
@ -460,7 +506,7 @@ namespace QuotationMaker.Controllers
|
||||||
|
|
||||||
// Copy style from old cell and apply to new cell
|
// Copy style from old cell and apply to new cell
|
||||||
XSSFCellStyle newCellStyle = (XSSFCellStyle)workbook.CreateCellStyle();
|
XSSFCellStyle newCellStyle = (XSSFCellStyle)workbook.CreateCellStyle();
|
||||||
newCellStyle.CloneStyleFrom(oldCell.CellStyle); ;
|
newCellStyle.CloneStyleFrom(oldCell.CellStyle);
|
||||||
newCell.CellStyle = newCellStyle;
|
newCell.CellStyle = newCellStyle;
|
||||||
|
|
||||||
// If there is a cell comment, copy
|
// If there is a cell comment, copy
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue