master
嘉祥 詹 2024-10-15 13:48:34 +08:00
parent 2855e4b5ce
commit 8ffc3397af
4 changed files with 32 additions and 17 deletions

View File

@ -139,15 +139,22 @@ namespace QuotationMaker.Controllers
XSSFCellStyle copyTempCellStyle = (XSSFCellStyle)workbook.CreateCellStyle(); XSSFCellStyle copyTempCellStyle = (XSSFCellStyle)workbook.CreateCellStyle();
// Copy style from old cell and apply to new cell // Copy style from old cell and apply to new cell
XSSFCellStyle copyTempCellFloatStyle = (XSSFCellStyle)workbook.CreateCellStyle(); XSSFCellStyle copyTempCellFloatStyle = (XSSFCellStyle)workbook.CreateCellStyle();
XSSFCellStyle copyTempCellStyleRight = (XSSFCellStyle)workbook.CreateCellStyle();
XSSFCellStyle copyTempCellFloatStyleRight = (XSSFCellStyle)workbook.CreateCellStyle();
//估價單總價項目 //估價單總價項目
row = (XSSFRow)sheet.GetRow(11); row = (XSSFRow)sheet.GetRow(11);
copyTempCellStyle.CloneStyleFrom(row.Cells[6].CellStyle); copyTempCellStyle.CloneStyleFrom(row.Cells[6].CellStyle);
copyTempCellFloatStyle.CloneStyleFrom(row.Cells[6].CellStyle); copyTempCellFloatStyle.CloneStyleFrom(row.Cells[6].CellStyle);
copyTempCellStyleRight.CloneStyleFrom(row.Cells[6].CellStyle);
copyTempCellFloatStyleRight.CloneStyleFrom(row.Cells[6].CellStyle);
copyTempCellStyle.DataFormat = workbook.CreateDataFormat().GetFormat("#,##0"); copyTempCellStyle.DataFormat = workbook.CreateDataFormat().GetFormat("#,##0");
copyTempCellFloatStyle.DataFormat = workbook.CreateDataFormat().GetFormat("#,##0.#"); copyTempCellFloatStyle.DataFormat = workbook.CreateDataFormat().GetFormat("#,##0.#");
copyTempCellStyleRight.DataFormat = workbook.CreateDataFormat().GetFormat("#,##0");
copyTempCellFloatStyleRight.DataFormat = workbook.CreateDataFormat().GetFormat("#,##0.#");
copyTempCellStyle.BorderTop = BorderStyle.Thin; copyTempCellStyle.BorderTop = BorderStyle.Thin;
copyTempCellStyle.BorderRight = BorderStyle.Thin; copyTempCellStyle.BorderRight = BorderStyle.Thin;
copyTempCellStyle.BorderBottom = BorderStyle.Thin; copyTempCellStyle.BorderBottom = BorderStyle.Thin;
@ -156,6 +163,14 @@ namespace QuotationMaker.Controllers
copyTempCellFloatStyle.BorderRight = BorderStyle.Thin; copyTempCellFloatStyle.BorderRight = BorderStyle.Thin;
copyTempCellFloatStyle.BorderBottom = BorderStyle.Thin; copyTempCellFloatStyle.BorderBottom = BorderStyle.Thin;
copyTempCellFloatStyle.BorderLeft = BorderStyle.Thin; copyTempCellFloatStyle.BorderLeft = BorderStyle.Thin;
copyTempCellStyleRight.BorderTop = BorderStyle.Thin;
copyTempCellStyleRight.BorderRight = BorderStyle.Medium;
copyTempCellStyleRight.BorderBottom = BorderStyle.Thin;
copyTempCellStyleRight.BorderLeft = BorderStyle.Thin;
copyTempCellFloatStyleRight.BorderTop = BorderStyle.Thin;
copyTempCellFloatStyleRight.BorderRight = BorderStyle.Medium;
copyTempCellFloatStyleRight.BorderBottom = BorderStyle.Thin;
copyTempCellFloatStyleRight.BorderLeft = BorderStyle.Thin;
//copyTempCellFloatStyle.BorderDiagonalLineStyle= BorderStyle.None; //copyTempCellFloatStyle.BorderDiagonalLineStyle= BorderStyle.None;
@ -163,10 +178,10 @@ namespace QuotationMaker.Controllers
row.Cells[6].SetCellValue(objDetail.quotation_noTaxTotal); row.Cells[6].SetCellValue(objDetail.quotation_noTaxTotal);
if (objDetail.quotation_noTaxTotal.ToString().IndexOf('.') >= 0) if (objDetail.quotation_noTaxTotal.ToString().IndexOf('.') >= 0)
{ {
row.Cells[6].CellStyle = copyTempCellFloatStyle; row.Cells[6].CellStyle = copyTempCellFloatStyleRight;
} }
else { else {
row.Cells[6].CellStyle = copyTempCellStyle; row.Cells[6].CellStyle = copyTempCellStyleRight;
} }
@ -182,7 +197,7 @@ namespace QuotationMaker.Controllers
row.Cells[6].CellStyle = copyTempCellStyle; row.Cells[6].CellStyle = copyTempCellStyleRight;
} else { } else {
row.Cells[6].SetCellValue(""); row.Cells[6].SetCellValue("");
} }
@ -197,11 +212,11 @@ namespace QuotationMaker.Controllers
if (objDetail.quotation_tax.ToString().IndexOf('.') >= 0) if (objDetail.quotation_tax.ToString().IndexOf('.') >= 0)
{ {
row.Cells[6].CellStyle = copyTempCellFloatStyle; row.Cells[6].CellStyle = copyTempCellFloatStyleRight;
} }
else else
{ {
row.Cells[6].CellStyle = copyTempCellStyle; row.Cells[6].CellStyle = copyTempCellStyleRight;
} }
//row.Cells[6].CellStyle = copyTempCellStyle; //row.Cells[6].CellStyle = copyTempCellStyle;
@ -210,7 +225,7 @@ namespace QuotationMaker.Controllers
//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].SetCellType(CellType.Numeric);
row.Cells[6].SetCellValue(objDetail.quotation_grandTotal); row.Cells[6].SetCellValue(objDetail.quotation_grandTotal);
row.Cells[6].CellStyle = copyTempCellStyle; row.Cells[6].CellStyle = copyTempCellStyleRight;
//服務協議 //服務協議
string services_aggrement = objDetail.quotation_sa; string services_aggrement = objDetail.quotation_sa;
@ -223,13 +238,13 @@ namespace QuotationMaker.Controllers
//付款方式與發票 //付款方式與發票
string quotation_grandTotal = ChtNumConverter.ToChtNum((long)objDetail.quotation_grandTotal); string quotation_grandTotal = ChtNumConverter.ToChtNum((long)objDetail.quotation_grandTotal);
string quotation_grandTotalStr = "本專案費用總計新台幣"+ quotation_grandTotal + "圓整 (即NTD" + objDetail.quotation_grandTotal.ToString("###,###") + "含稅)"; string quotation_grandTotalStr = "本專案費用總計新台幣"+ quotation_grandTotal + "元整 (即NTD $" + objDetail.quotation_grandTotal.ToString("###,###") + "整,含稅)";
row = (XSSFRow)sheet.GetRow(20); row = (XSSFRow)sheet.GetRow(20);
row.Cells[0].SetCellValue(quotation_grandTotalStr); row.Cells[0].SetCellValue(quotation_grandTotalStr);
//簽章欄 //簽章欄
row = (XSSFRow)sheet.GetRow(27); row = (XSSFRow)sheet.GetRow(27);
row.Cells[0].SetCellValue(row.Cells[0].StringCellValue.Replace("{user_name}", objDetail.user.user_name)); row.Cells[3].SetCellValue(row.Cells[3].StringCellValue.Replace("{user_name}", objDetail.user.user_name));
//匯款項目與發票 //匯款項目與發票
int payment_count = objDetail.payments.Count; int payment_count = objDetail.payments.Count;
@ -279,7 +294,7 @@ namespace QuotationMaker.Controllers
//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].SetCellType(CellType.Numeric);
row.Cells[6].SetCellValue(objDetail.invoices[i - 1].invoice_noTaxMoney); row.Cells[6].SetCellValue(objDetail.invoices[i - 1].invoice_noTaxMoney);
row.Cells[6].CellStyle = copyTempCellStyle; row.Cells[6].CellStyle = copyTempCellStyleRight;
} }
} }
@ -406,11 +421,11 @@ namespace QuotationMaker.Controllers
if (objSub.quotationSubItem_subTotal.ToString().IndexOf('.') >= 0) if (objSub.quotationSubItem_subTotal.ToString().IndexOf('.') >= 0)
{ {
row.Cells[6].CellStyle = copyTempCellFloatStyle; row.Cells[6].CellStyle = copyTempCellFloatStyleRight;
} }
else else
{ {
row.Cells[6].CellStyle = copyTempCellStyle; row.Cells[6].CellStyle = copyTempCellStyleRight;
} }
//row.Cells[6].CellStyle = copyTempCellStyle; //row.Cells[6].CellStyle = copyTempCellStyle;
@ -444,7 +459,7 @@ namespace QuotationMaker.Controllers
//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].SetCellType(CellType.Numeric);
row.Cells[6].SetCellValue((objMain.quotationMainItem_subTotal - acTotal)); row.Cells[6].SetCellValue((objMain.quotationMainItem_subTotal - acTotal));
row.Cells[6].CellStyle = copyTempCellStyle; row.Cells[6].CellStyle = copyTempCellStyleRight;
rowCount++; rowCount++;
@ -458,7 +473,7 @@ namespace QuotationMaker.Controllers
//row.Cells[6].SetCellValue("NTD " + acTotal.ToString("###,###")); //row.Cells[6].SetCellValue("NTD " + acTotal.ToString("###,###"));
row.Cells[6].SetCellType(CellType.Numeric); row.Cells[6].SetCellType(CellType.Numeric);
row.Cells[6].SetCellValue(acTotal); row.Cells[6].SetCellValue(acTotal);
row.Cells[6].CellStyle = copyTempCellStyle; row.Cells[6].CellStyle = copyTempCellStyleRight;
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++;
@ -479,7 +494,7 @@ namespace QuotationMaker.Controllers
//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].SetCellType(CellType.Numeric);
row.Cells[6].SetCellValue(objMain.quotationMainItem_subTotal); row.Cells[6].SetCellValue(objMain.quotationMainItem_subTotal);
row.Cells[6].CellStyle = copyTempCellStyle; row.Cells[6].CellStyle = copyTempCellStyleRight;
row.ZeroHeight = true; row.ZeroHeight = true;
rowCount++; rowCount++;
editRowIndex++; editRowIndex++;

View File

@ -407,7 +407,7 @@
<!-- .form-group --> <!-- .form-group -->
<div class="form-group"> <div class="form-group">
<div class="form-label-group"> <div class="form-label-group">
<input type="text" id="quotation_name" class="form-control" value="" placeholder="報價單名稱" maxlength="50" required=""> <label for="quotation_name">報價單名稱</label> <input type="text" id="quotation_name" class="form-control" value="" placeholder="報價單名稱" maxlength="85" required=""> <label for="quotation_name">報價單名稱</label>
<input type="hidden" id="quotation_name_old" /> <input type="hidden" id="quotation_name_old" />
</div> </div>
</div><!-- /.form-group --> </div><!-- /.form-group -->

Binary file not shown.

Binary file not shown.