Compare commits

..

No commits in common. "8ffc3397afcbe40e7196c7500b1954acd59ca7ba" and "3a8252c3a24e66c2174f60498e610948e521ea19" have entirely different histories.

5 changed files with 66 additions and 230 deletions

View File

@ -140,21 +140,14 @@ namespace QuotationMaker.Controllers
// 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;
@ -163,14 +156,6 @@ 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;
@ -178,10 +163,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 = copyTempCellFloatStyleRight; row.Cells[6].CellStyle = copyTempCellFloatStyle;
} }
else { else {
row.Cells[6].CellStyle = copyTempCellStyleRight; row.Cells[6].CellStyle = copyTempCellStyle;
} }
@ -197,7 +182,7 @@ namespace QuotationMaker.Controllers
row.Cells[6].CellStyle = copyTempCellStyleRight; row.Cells[6].CellStyle = copyTempCellStyle;
} else { } else {
row.Cells[6].SetCellValue(""); row.Cells[6].SetCellValue("");
} }
@ -212,11 +197,11 @@ namespace QuotationMaker.Controllers
if (objDetail.quotation_tax.ToString().IndexOf('.') >= 0) if (objDetail.quotation_tax.ToString().IndexOf('.') >= 0)
{ {
row.Cells[6].CellStyle = copyTempCellFloatStyleRight; row.Cells[6].CellStyle = copyTempCellFloatStyle;
} }
else else
{ {
row.Cells[6].CellStyle = copyTempCellStyleRight; row.Cells[6].CellStyle = copyTempCellStyle;
} }
//row.Cells[6].CellStyle = copyTempCellStyle; //row.Cells[6].CellStyle = copyTempCellStyle;
@ -225,7 +210,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 = copyTempCellStyleRight; row.Cells[6].CellStyle = copyTempCellStyle;
//服務協議 //服務協議
string services_aggrement = objDetail.quotation_sa; string services_aggrement = objDetail.quotation_sa;
@ -238,13 +223,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[3].SetCellValue(row.Cells[3].StringCellValue.Replace("{user_name}", objDetail.user.user_name)); row.Cells[0].SetCellValue(row.Cells[0].StringCellValue.Replace("{user_name}", objDetail.user.user_name));
//匯款項目與發票 //匯款項目與發票
int payment_count = objDetail.payments.Count; int payment_count = objDetail.payments.Count;
@ -294,7 +279,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 = copyTempCellStyleRight; row.Cells[6].CellStyle = copyTempCellStyle;
} }
} }
@ -421,11 +406,11 @@ namespace QuotationMaker.Controllers
if (objSub.quotationSubItem_subTotal.ToString().IndexOf('.') >= 0) if (objSub.quotationSubItem_subTotal.ToString().IndexOf('.') >= 0)
{ {
row.Cells[6].CellStyle = copyTempCellFloatStyleRight; row.Cells[6].CellStyle = copyTempCellFloatStyle;
} }
else else
{ {
row.Cells[6].CellStyle = copyTempCellStyleRight; row.Cells[6].CellStyle = copyTempCellStyle;
} }
//row.Cells[6].CellStyle = copyTempCellStyle; //row.Cells[6].CellStyle = copyTempCellStyle;
@ -459,7 +444,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 = copyTempCellStyleRight; row.Cells[6].CellStyle = copyTempCellStyle;
rowCount++; rowCount++;
@ -473,7 +458,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 = copyTempCellStyleRight; 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++;
@ -494,7 +479,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 = copyTempCellStyleRight; row.Cells[6].CellStyle = copyTempCellStyle;
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="85" required=""> <label for="quotation_name">報價單名稱</label> <input type="text" id="quotation_name" class="form-control" value="" placeholder="報價單名稱" maxlength="50" 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 -->

View File

@ -20,10 +20,6 @@ var deledInvoices = [];
var preSubItem_name = ''; var preSubItem_name = '';
var hasBind = 'N'; var hasBind = 'N';
var tmpInvoiceItem;
var tmpPaymentItem;
$(document).ready(function () { $(document).ready(function () {
deptList(); deptList();
companyList(); companyList();
@ -616,7 +612,6 @@ $(document).ready(function () {
//付款方式儲存鈕 //付款方式儲存鈕
$('#paymentModalDialogSaveBtn').on('click', function () { $('#paymentModalDialogSaveBtn').on('click', function () {
var data_method = $('#payment_method').val();
var payment_method = $('#paymentMethod_select').val(); var payment_method = $('#paymentMethod_select').val();
var payment_methodname = $("#paymentMethod_select option:selected").text(); var payment_methodname = $("#paymentMethod_select option:selected").text();
var payment_descript = $('#payment_descript').val(); var payment_descript = $('#payment_descript').val();
@ -630,39 +625,27 @@ $(document).ready(function () {
} }
} }
var payment_display = payment_methodname; var payment_display = payment_methodname;
if (payment_descript != '') { if (payment_descript != '') {
payment_display = payment_display + ': ' + payment_descript; payment_display = payment_display + ': ' + payment_descript;
} }
if (data_method == 'add') { var htmlCode = '';
var htmlCode = '';
htmlCode += ' <li class="list-group-item align-items-center drag-handle">\n';
htmlCode += ' <textarea style="display:none;" data-name="data_method">add</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="payment_method">' + payment_method + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="payment_methodname">' + payment_methodname + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="payment_descript">' + payment_descript + '</textarea>';
htmlCode += ' <span class="drag-indicator"></span>\n';
htmlCode += ' <div data-name="payment_display"> ' + payment_display + ' </div>\n';
htmlCode += ' <div class="btn-group ml-auto">\n';
htmlCode += ' <button data-method="edit" onclick="editPaymentItem(this);" class="btn btn-sm btn-secondary">Edit</button> ';
htmlCode += ' <button class="btn btn-sm btn-secondary" data-method="del" onclick="delPaymentItem(this);"><i class="far fa-trash-alt"></i></button>\n';
htmlCode += ' </div>\n';
htmlCode += ' </li>\n';
$('#payment_group').find('ol').append(htmlCode);
} else {
tmpPaymentItem.find("[data-name='payment_method']").val(payment_method);
tmpPaymentItem.find("[data-name='payment_methodname']").val(payment_methodname);
tmpPaymentItem.find("[data-name='payment_descript']").val(payment_descript);
tmpPaymentItem.find("[data-name='payment_display']").text(payment_display);
}
htmlCode += ' <li class="list-group-item align-items-center drag-handle">\n';
htmlCode += ' <textarea style="display:none;" data-name="data_method">add</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="payment_method">' + payment_method + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="payment_methodname">' + payment_methodname + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="payment_descript">' + payment_descript + '</textarea>';
htmlCode += ' <span class="drag-indicator"></span>\n';
htmlCode += ' <div> ' + payment_display + ' </div>\n';
htmlCode += ' <div class="btn-group ml-auto">\n';
htmlCode += ' <button class="btn btn-sm btn-secondary" data-method="add" onclick="delPaymentItem(this);"><i class="far fa-trash-alt"></i></button>\n';
htmlCode += ' </div>\n';
htmlCode += ' </li>\n';
$('#payment_group').find('ol').append(htmlCode);
$('#paymentModal').modal('toggle'); $('#paymentModal').modal('toggle');
}); });
@ -674,8 +657,8 @@ $(document).ready(function () {
initInvoiceSelectItem(); initInvoiceSelectItem();
fpInvoiceDate.setDate(new Date(endTxt + '/1')); fpInvoiceDate.setDate(new Date(endTxt + '/1'));
$('#invoice_type').val('date').trigger('change'); $('#invoice_type').val('date');
//$('#invoice_type_text').hide(); $('#invoice_type_text').hide();
$('#invoice_method').val('add'); $('#invoice_method').val('add');
$('#invoiceModal').modal('toggle'); $('#invoiceModal').modal('toggle');
}); });
@ -715,71 +698,40 @@ $(document).ready(function () {
} }
} }
if (invoice_method == 'add') { var invoice_display = "開立品項: " + invoice_name + ", 開立月份: " + invoice_date + ", 金額(未稅): " + AppendComma(invoice_noTaxMoney);
var invoice_display = "開立品項: " + invoice_name + ", 開立月份: " + invoice_date + ", 金額(未稅): " + AppendComma(invoice_noTaxMoney);
if (invoice_type == 'text') { if (invoice_type == 'text') {
invoice_display = "開立品項: " + invoice_name + ", 開立月份: " + invoice_text + ", 金額(未稅): " + AppendComma(invoice_noTaxMoney); invoice_display = "開立品項: " + invoice_name + ", 開立月份: " + invoice_text + ", 金額(未稅): " + AppendComma(invoice_noTaxMoney);
}
var htmlCode = '';
htmlCode += ' <li class="list-group-item align-items-center drag-handle">\n';
htmlCode += ' <textarea style="display:none;" data-name="data_method">add</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_name">' + invoice_name + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_type">' + invoice_type + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_date">' + invoice_date + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_text">' + invoice_text + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_noTaxMoney">' + invoice_noTaxMoney + '</textarea>';
htmlCode += ' <span class="drag-indicator"></span>\n';
htmlCode += ' <span style="width: 25%;" data-name="invoice_name_span"> ' + "開立品項: " + invoice_name + ' </span>\n';
if (invoice_type == 'date') {
htmlCode += ' <span style="width: 25%;" data-name="invoice_date_span"> ' + "開立月份: " + invoice_date + ' </span>\n';
} else {
htmlCode += ' <span style="width: 25%;" data-name="invoice_date_span"> ' + "開立月份: " + invoice_text + ' </span>\n';
}
htmlCode += ' <span style="width: 20%;" data-name="invoice_noTaxMoney_span">' + "金額(未稅): " + AppendComma(invoice_noTaxMoney) + ' </span>\n';
htmlCode += ' <span style="width: 30%;"></span>';
htmlCode += ' <div class="btn-group ml-auto">\n';
htmlCode += ' <button data-method="edit" onclick="editInvoiceItem(this);" class="btn btn-sm btn-secondary">Edit</button> ';
htmlCode += ' <button class="btn btn-sm btn-secondary" data-method="del" onclick="delInvoiceItem(this);"><i class="far fa-trash-alt"></i></button>\n';
htmlCode += ' </div>\n';
htmlCode += ' </li>\n';
$('#invoice_group').find('ol').append(htmlCode);
} }
if (invoice_method == 'edit') { var htmlCode = '';
var invoice_display = "開立品項: " + invoice_name + ", 開立月份: " + invoice_date + ", 金額(未稅): " + AppendComma(invoice_noTaxMoney); htmlCode += ' <li class="list-group-item align-items-center drag-handle">\n';
htmlCode += ' <textarea style="display:none;" data-name="data_method">add</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_name">' + invoice_name + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_type">' + invoice_type + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_date">' + invoice_date + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_text">' + invoice_text + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_noTaxMoney">' + invoice_noTaxMoney + '</textarea>';
htmlCode += ' <span class="drag-indicator"></span>\n';
htmlCode += ' <span style="width: 15%;"> ' + "開立品項: " + invoice_name + ' </span>\n';
if (invoice_type == 'text') { if (invoice_type == 'date') {
invoice_display = "開立品項: " + invoice_name + ", 開立月份: " + invoice_text + ", 金額(未稅): " + AppendComma(invoice_noTaxMoney); htmlCode += ' <span style="width: 15%;"> ' + "開立月份: " + invoice_date + ' </span\n';
} } else {
htmlCode += ' <span style="width: 15%;"> ' + "開立月份: " + invoice_text + ' </span\n';
tmpInvoiceItem.find("[data-name='invoice_name']").val(invoice_name);
tmpInvoiceItem.find("[data-name='invoice_type']").val(invoice_type);
tmpInvoiceItem.find("[data-name='invoice_date']").val(invoice_date);
tmpInvoiceItem.find("[data-name='invoice_text']").val(invoice_text);
tmpInvoiceItem.find("[data-name='invoice_noTaxMoney']").val(invoice_noTaxMoney);
tmpInvoiceItem.find("[data-name='invoice_name_span']").text(invoice_name);
if (invoice_type == 'date') {
tmpInvoiceItem.find("[data-name='invoice_date_span']").text('開立月份: ' + invoice_date);
} else {
tmpInvoiceItem.find("[data-name='invoice_date_span']").text('開立月份: ' + invoice_text);
}
tmpInvoiceItem.find("[data-name='invoice_noTaxMoney_span']").text('金額(未稅): ' + AppendComma(invoice_noTaxMoney));
} }
htmlCode += ' <span style="width: 20%;">' + "金額(未稅): " + AppendComma(invoice_noTaxMoney) + ' </span>\n';
htmlCode += ' <span style="width: 50%;"></span>';
htmlCode += ' <div class="btn-group ml-auto">\n';
htmlCode += ' <button class="btn btn-sm btn-secondary" data-method="add" onclick="delInvoiceItem(this);"><i class="far fa-trash-alt"></i></button>\n';
htmlCode += ' </div>\n';
htmlCode += ' </li>\n';
$('#invoice_group').find('ol').append(htmlCode);
$('#invoiceModal').modal('toggle'); $('#invoiceModal').modal('toggle');
}); });
@ -1020,29 +972,14 @@ $(document).ready(function () {
$('#payment_div').find('ol li').each(function (i, item) { $('#payment_div').find('ol li').each(function (i, item) {
var payment_method = $(item).find('[data-name="payment_method"]').val(); var payment_method = $(item).find('[data-name="payment_method"]').val();
var payment_method_old = $(item).find('[data-name="payment_method_old"]').val();
var payment_methodname = $(item).find('[data-name="payment_methodname"]').val(); var payment_methodname = $(item).find('[data-name="payment_methodname"]').val();
var payment_methodname_old = $(item).find('[data-name="payment_methodname_old"]').val();
var payment_descript = $(item).find('[data-name="payment_descript"]').val(); var payment_descript = $(item).find('[data-name="payment_descript"]').val();
var payment_descript_old = $(item).find('[data-name="payment_descript_old"]').val();
var data_method = $(item).find('[data-name="data_method"]').val(); var data_method = $(item).find('[data-name="data_method"]').val();
if (quotation_method == 'edit' && data_method == 'add') { if (quotation_method == 'edit' && data_method == 'add') {
quotation_log += '付款方式增加了 [' + payment_methodname + ' - ' + payment_descript + ']\n'; quotation_log += '付款方式增加了 [' + payment_methodname + ' - ' + payment_descript + ']\n';
} }
if (quotation_method == 'edit' && data_method == 'edit') {
if (payment_method != payment_method_old) {
quotation_log += '付款方式由 [' + payment_methodname_old + '] 更改為 [' + payment_methodname + ']\n';
}
if (payment_descript != payment_descript_old) {
quotation_log += '付款方式說明由 [' + payment_descript_old + '] 更改為 [' + payment_descript + ']\n';
}
}
var paymentFormData = { var paymentFormData = {
payment_method: payment_method, payment_method: payment_method,
payment_methodname: payment_methodname, payment_methodname: payment_methodname,
@ -1056,43 +993,16 @@ $(document).ready(function () {
$('#invoice_div').find('ol li').each(function (i, item) { $('#invoice_div').find('ol li').each(function (i, item) {
var invoice_name = $(item).find('[data-name="invoice_name"]').val(); var invoice_name = $(item).find('[data-name="invoice_name"]').val();
var invoice_name_old = $(item).find('[data-name="invoice_name_old"]').val();
var invoice_type = $(item).find('[data-name="invoice_type"]').val(); var invoice_type = $(item).find('[data-name="invoice_type"]').val();
var invoice_type_old = $(item).find('[data-name="invoice_type_old"]').val();
var invoice_date = $(item).find('[data-name="invoice_date"]').val(); var invoice_date = $(item).find('[data-name="invoice_date"]').val();
var invoice_date_old = $(item).find('[data-name="invoice_date_old"]').val();
var invoice_text = $(item).find('[data-name="invoice_text"]').val(); var invoice_text = $(item).find('[data-name="invoice_text"]').val();
var invoice_text_old = $(item).find('[data-name="invoice_text_old"]').val();
var invoice_noTaxMoney = $(item).find('[data-name="invoice_noTaxMoney"]').val(); var invoice_noTaxMoney = $(item).find('[data-name="invoice_noTaxMoney"]').val();
var invoice_noTaxMoney_old = $(item).find('[data-name="invoice_noTaxMoney_old"]').val();
var data_method = $(item).find('[data-name="data_method"]').val(); var data_method = $(item).find('[data-name="data_method"]').val();
if (quotation_method == 'edit' && data_method == 'add') { if (quotation_method == 'edit' && data_method == 'add') {
quotation_log += '發票品項增加了 [' + invoice_name + ' (' + invoice_date + invoice_text + ') ' + AppendComma(invoice_noTaxMoney) + ']\n'; quotation_log += '發票品項增加了 [' + invoice_name + ' (' + invoice_date + invoice_text + ') ' + AppendComma(invoice_noTaxMoney) + ']\n';
} }
if (quotation_method == 'edit' && data_method == 'edit') {
if (invoice_name != invoice_name_old) {
quotation_log += '發票品項由 [' + invoice_name_old +'] 更改為 [' + invoice_name + ']\n';
}
if (invoice_type != invoice_type_old) {
quotation_log += '發票月份樣式由 [' + invoice_type_old + '] 更改為 [' + invoice_type + ']\n';
}
if (invoice_date != invoice_date_old) {
quotation_log += '發票月份(date)由 [' + invoice_date_old + '] 更改為 [' + invoice_date + ']\n';
}
if (invoice_text != invoice_text_old) {
quotation_log += '發票月份(text)由 [' + invoice_text_old + '] 更改為 [' + invoice_text + ']\n';
}
if (invoice_noTaxMoney != invoice_noTaxMoney_old) {
quotation_log += '發票未稅金額由 [' + invoice_noTaxMoney_old + '] 更改為 [' + invoice_noTaxMoney + ']\n';
}
}
var invoiceFormData = { var invoiceFormData = {
invoice_name: invoice_name, invoice_name: invoice_name,
invoice_type: invoice_type, invoice_type: invoice_type,
@ -2010,17 +1920,12 @@ function makePaymentHtml(obj) {
htmlCode += ' <li class="list-group-item align-items-center drag-handle">\n'; htmlCode += ' <li class="list-group-item align-items-center drag-handle">\n';
htmlCode += ' <textarea style="display:none;" data-name="data_method">edit</textarea>'; htmlCode += ' <textarea style="display:none;" data-name="data_method">edit</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="payment_method">' + obj.payment_method + '</textarea>'; htmlCode += ' <textarea style="display:none;" data-name="payment_method">' + obj.payment_method + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="payment_method_old">' + obj.payment_method + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="payment_methodname">' + obj.payment_methodname + '</textarea>'; htmlCode += ' <textarea style="display:none;" data-name="payment_methodname">' + obj.payment_methodname + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="payment_methodname_old">' + obj.payment_methodname + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="payment_descript">' + obj.payment_descript + '</textarea>'; htmlCode += ' <textarea style="display:none;" data-name="payment_descript">' + obj.payment_descript + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="payment_descript_old">' + obj.payment_descript + '</textarea>';
htmlCode += ' <span class="drag-indicator"></span>\n'; htmlCode += ' <span class="drag-indicator"></span>\n';
htmlCode += ' <div data-name="payment_display"> ' + payment_display + ' </div>\n'; htmlCode += ' <div> ' + payment_display + ' </div>\n';
htmlCode += ' <div class="btn-group ml-auto">\n'; htmlCode += ' <div class="btn-group ml-auto">\n';
htmlCode += ' <button data-method="edit" onclick="editPaymentItem(this);" class="btn btn-sm btn-secondary">Edit</button> '; htmlCode += ' <button class="btn btn-sm btn-secondary" data-method="edit" onclick="delPaymentItem(this);"><i class="far fa-trash-alt"></i></button>\n';
htmlCode += ' <button class="btn btn-sm btn-secondary" data-method="del" onclick="delPaymentItem(this);"><i class="far fa-trash-alt"></i></button>\n';
htmlCode += ' </div>\n'; htmlCode += ' </div>\n';
htmlCode += ' </li>\n'; htmlCode += ' </li>\n';
@ -2037,30 +1942,24 @@ function makeInvoiceHtml(obj) {
htmlCode += ' <li class="list-group-item align-items-center drag-handle">\n'; htmlCode += ' <li class="list-group-item align-items-center drag-handle">\n';
htmlCode += ' <textarea style="display:none;" data-name="data_method">edit</textarea>'; htmlCode += ' <textarea style="display:none;" data-name="data_method">edit</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_name">' + obj.invoice_name + '</textarea>'; htmlCode += ' <textarea style="display:none;" data-name="invoice_name">' + obj.invoice_name + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_name_old">' + obj.invoice_name + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_type">' + obj.invoice_type + '</textarea>'; htmlCode += ' <textarea style="display:none;" data-name="invoice_type">' + obj.invoice_type + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_type_old">' + obj.invoice_type + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_date">' + invoice_date + '</textarea>'; htmlCode += ' <textarea style="display:none;" data-name="invoice_date">' + invoice_date + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_date_old">' + invoice_date + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_text">' + invoice_text + '</textarea>'; htmlCode += ' <textarea style="display:none;" data-name="invoice_text">' + invoice_text + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_text_old">' + invoice_text + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_noTaxMoney">' + obj.invoice_noTaxMoney + '</textarea>'; htmlCode += ' <textarea style="display:none;" data-name="invoice_noTaxMoney">' + obj.invoice_noTaxMoney + '</textarea>';
htmlCode += ' <textarea style="display:none;" data-name="invoice_noTaxMoney_old">' + obj.invoice_noTaxMoney + '</textarea>';
htmlCode += ' <span class="drag-indicator"></span>\n'; htmlCode += ' <span class="drag-indicator"></span>\n';
htmlCode += ' <span style="width: 25%;" data-name="invoice_name_span" > ' + "開立品項: " + obj.invoice_name + ' </span>\n'; htmlCode += ' <span style="width: 15%;"> ' + "開立品項: " + obj.invoice_name + ' </span>\n';
if (invoice_type == 'date') { if (invoice_type == 'date') {
htmlCode += ' <span style="width: 25%;" data-name="invoice_date_span" > ' + "開立月份: " + invoice_date + ' </span>\n'; htmlCode += ' <span style="width: 15%;"> ' + "開立月份: " + invoice_date + ' </span\n';
} else { } else {
htmlCode += ' <span style="width: 25%;" data-name="invoice_date_span"> ' + "開立月份: " + invoice_text + ' </span>\n'; htmlCode += ' <span style="width: 15%;"> ' + "開立月份: " + invoice_text + ' </span\n';
} }
htmlCode += ' <span style="width: 20%;" data-name="invoice_noTaxMoney_span">' + "金額(未稅): " + AppendComma(obj.invoice_noTaxMoney) + ' </span>\n'; htmlCode += ' <span style="width: 20%;">' + "金額(未稅): " + AppendComma(obj.invoice_noTaxMoney) + ' </span>\n';
htmlCode += ' <span style="width: 30%;"></span>'; htmlCode += ' <span style="width: 50%;"></span>';
htmlCode += ' <div class="btn-group ml-auto">\n'; htmlCode += ' <div class="btn-group ml-auto">\n';
htmlCode += ' <button data-method="edit" onclick="editInvoiceItem(this);" class="btn btn-sm btn-secondary">Edit</button> '; htmlCode += ' <button class="btn btn-sm btn-secondary" data-method="edit" onclick="delInvoiceItem(this);"><i class="far fa-trash-alt"></i></button>\n';
htmlCode += ' <button class="btn btn-sm btn-secondary" data-method="del" onclick="delInvoiceItem(this);"><i class="far fa-trash-alt"></i></button>\n';
htmlCode += ' </div>\n'; htmlCode += ' </div>\n';
htmlCode += ' </li>\n'; htmlCode += ' </li>\n';
@ -3361,24 +3260,6 @@ function delPaymentItem(obj) {
} }
} }
//編輯付款方式
function editPaymentItem(obj) {
var data_type = $(obj).attr("data-method");
var payment = $(obj).parent().parent();
tmpPaymentItem = payment;
var payment_method = payment.find("[data-name='payment_method']").val();
var payment_methodname = payment.find("[data-name='payment_methodname']").val();
var payment_descript = payment.find("[data-name='payment_descript']").val();
$("#payment_method").val('edit');
$("#paymentMethod_select").val(payment_method).trigger('change');
$("#payment_descript").val(payment_descript).trigger('change');
$('#paymentModal').modal('toggle');
}
function initInvoiceSelectItem() { function initInvoiceSelectItem() {
var items = []; var items = [];
@ -3439,33 +3320,3 @@ function delInvoiceItem(obj) {
invoice.remove(); invoice.remove();
} }
} }
//編輯發票品項
function editInvoiceItem(obj) {
var data_type = $(obj).attr("data-method");
var invoice = $(obj).parent().parent();
tmpInvoiceItem = invoice;
var invoice_name = invoice.find("[data-name='invoice_name']").val();
var invoice_date = invoice.find("[data-name='invoice_date']").val();
var invoice_noTaxMoney = invoice.find("[data-name='invoice_noTaxMoney']").val().replace(/,/g, "");
var invoice_type = invoice.find("[data-name='invoice_type']").val();
var invoice_text = invoice.find("[data-name='invoice_text']").val();
$('#invoice_method').val('edit');
$('#invoice_name').val(invoice_name).trigger('change');
$('#invoice_type').val(invoice_type).trigger('change');
if (invoice_type == 'date') {
fpInvoiceDate.setDate(new Date(invoice_date + '/1'));
//$('#invoice_date').val(invoice_date).trigger('change');
} else {
$('#invoice_text').val(invoice_text).trigger('change');
}
$('#invoice_noTaxMoney').val(invoice_noTaxMoney).trigger('change');
$('#invoiceModal').modal('toggle');
}

Binary file not shown.

Binary file not shown.