Compare commits

...

2 Commits

Author SHA1 Message Date
嘉祥 詹 8ffc3397af updates 2024-10-15 13:48:34 +08:00
嘉祥 詹 2855e4b5ce updates 2024-10-15 12:41:16 +08:00
5 changed files with 230 additions and 66 deletions

View File

@ -140,14 +140,21 @@ namespace QuotationMaker.Controllers
// Copy style from old cell and apply to new cell
XSSFCellStyle copyTempCellFloatStyle = (XSSFCellStyle)workbook.CreateCellStyle();
XSSFCellStyle copyTempCellStyleRight = (XSSFCellStyle)workbook.CreateCellStyle();
XSSFCellStyle copyTempCellFloatStyleRight = (XSSFCellStyle)workbook.CreateCellStyle();
//估價單總價項目
row = (XSSFRow)sheet.GetRow(11);
copyTempCellStyle.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");
copyTempCellFloatStyle.DataFormat = workbook.CreateDataFormat().GetFormat("#,##0.#");
copyTempCellStyleRight.DataFormat = workbook.CreateDataFormat().GetFormat("#,##0");
copyTempCellFloatStyleRight.DataFormat = workbook.CreateDataFormat().GetFormat("#,##0.#");
copyTempCellStyle.BorderTop = BorderStyle.Thin;
copyTempCellStyle.BorderRight = BorderStyle.Thin;
copyTempCellStyle.BorderBottom = BorderStyle.Thin;
@ -156,6 +163,14 @@ namespace QuotationMaker.Controllers
copyTempCellFloatStyle.BorderRight = BorderStyle.Thin;
copyTempCellFloatStyle.BorderBottom = 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;
@ -163,10 +178,10 @@ namespace QuotationMaker.Controllers
row.Cells[6].SetCellValue(objDetail.quotation_noTaxTotal);
if (objDetail.quotation_noTaxTotal.ToString().IndexOf('.') >= 0)
{
row.Cells[6].CellStyle = copyTempCellFloatStyle;
row.Cells[6].CellStyle = copyTempCellFloatStyleRight;
}
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 {
row.Cells[6].SetCellValue("");
}
@ -197,11 +212,11 @@ namespace QuotationMaker.Controllers
if (objDetail.quotation_tax.ToString().IndexOf('.') >= 0)
{
row.Cells[6].CellStyle = copyTempCellFloatStyle;
row.Cells[6].CellStyle = copyTempCellFloatStyleRight;
}
else
{
row.Cells[6].CellStyle = copyTempCellStyle;
row.Cells[6].CellStyle = copyTempCellStyleRight;
}
//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].SetCellType(CellType.Numeric);
row.Cells[6].SetCellValue(objDetail.quotation_grandTotal);
row.Cells[6].CellStyle = copyTempCellStyle;
row.Cells[6].CellStyle = copyTempCellStyleRight;
//服務協議
string services_aggrement = objDetail.quotation_sa;
@ -223,13 +238,13 @@ namespace QuotationMaker.Controllers
//付款方式與發票
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.Cells[0].SetCellValue(quotation_grandTotalStr);
//簽章欄
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;
@ -279,7 +294,7 @@ namespace QuotationMaker.Controllers
//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;
row.Cells[6].CellStyle = copyTempCellStyleRight;
}
}
@ -406,11 +421,11 @@ namespace QuotationMaker.Controllers
if (objSub.quotationSubItem_subTotal.ToString().IndexOf('.') >= 0)
{
row.Cells[6].CellStyle = copyTempCellFloatStyle;
row.Cells[6].CellStyle = copyTempCellFloatStyleRight;
}
else
{
row.Cells[6].CellStyle = copyTempCellStyle;
row.Cells[6].CellStyle = copyTempCellStyleRight;
}
//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].SetCellType(CellType.Numeric);
row.Cells[6].SetCellValue((objMain.quotationMainItem_subTotal - acTotal));
row.Cells[6].CellStyle = copyTempCellStyle;
row.Cells[6].CellStyle = copyTempCellStyleRight;
rowCount++;
@ -458,7 +473,7 @@ namespace QuotationMaker.Controllers
//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[6].CellStyle = copyTempCellStyleRight;
row.Cells[0].SetCellValue(row.Cells[0].StringCellValue.Replace("{quotationMainItem_ac}", objMain.quotationMainItem_ac.ToString()));
rowCount++;
@ -479,7 +494,7 @@ namespace QuotationMaker.Controllers
//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;
row.Cells[6].CellStyle = copyTempCellStyleRight;
row.ZeroHeight = true;
rowCount++;
editRowIndex++;

View File

@ -407,7 +407,7 @@
<!-- .form-group -->
<div class="form-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" />
</div>
</div><!-- /.form-group -->

View File

@ -20,6 +20,10 @@ var deledInvoices = [];
var preSubItem_name = '';
var hasBind = 'N';
var tmpInvoiceItem;
var tmpPaymentItem;
$(document).ready(function () {
deptList();
companyList();
@ -612,6 +616,7 @@ $(document).ready(function () {
//付款方式儲存鈕
$('#paymentModalDialogSaveBtn').on('click', function () {
var data_method = $('#payment_method').val();
var payment_method = $('#paymentMethod_select').val();
var payment_methodname = $("#paymentMethod_select option:selected").text();
var payment_descript = $('#payment_descript').val();
@ -625,12 +630,15 @@ $(document).ready(function () {
}
}
var payment_display = payment_methodname;
if (payment_descript != '') {
payment_display = payment_display + ': ' + payment_descript;
}
if (data_method == 'add') {
var htmlCode = '';
htmlCode += ' <li class="list-group-item align-items-center drag-handle">\n';
@ -639,13 +647,22 @@ $(document).ready(function () {
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 data-name="payment_display"> ' + 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 += ' <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);
}
$('#paymentModal').modal('toggle');
});
@ -657,8 +674,8 @@ $(document).ready(function () {
initInvoiceSelectItem();
fpInvoiceDate.setDate(new Date(endTxt + '/1'));
$('#invoice_type').val('date');
$('#invoice_type_text').hide();
$('#invoice_type').val('date').trigger('change');
//$('#invoice_type_text').hide();
$('#invoice_method').val('add');
$('#invoiceModal').modal('toggle');
});
@ -698,6 +715,7 @@ $(document).ready(function () {
}
}
if (invoice_method == 'add') {
var invoice_display = "開立品項: " + invoice_name + ", 開立月份: " + invoice_date + ", 金額(未稅): " + AppendComma(invoice_noTaxMoney);
if (invoice_type == 'text') {
@ -714,23 +732,53 @@ $(document).ready(function () {
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';
htmlCode += ' <span style="width: 25%;" data-name="invoice_name_span"> ' + "開立品項: " + invoice_name + ' </span>\n';
if (invoice_type == 'date') {
htmlCode += ' <span style="width: 15%;"> ' + "開立月份: " + invoice_date + ' </span\n';
htmlCode += ' <span style="width: 25%;" data-name="invoice_date_span"> ' + "開立月份: " + invoice_date + ' </span>\n';
} else {
htmlCode += ' <span style="width: 15%;"> ' + "開立月份: " + invoice_text + ' </span\n';
htmlCode += ' <span style="width: 25%;" data-name="invoice_date_span"> ' + "開立月份: " + invoice_text + ' </span>\n';
}
htmlCode += ' <span style="width: 20%;">' + "金額(未稅): " + AppendComma(invoice_noTaxMoney) + ' </span>\n';
htmlCode += ' <span style="width: 50%;"></span>';
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 class="btn btn-sm btn-secondary" data-method="add" onclick="delInvoiceItem(this);"><i class="far fa-trash-alt"></i></button>\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 invoice_display = "開立品項: " + invoice_name + ", 開立月份: " + invoice_date + ", 金額(未稅): " + AppendComma(invoice_noTaxMoney);
if (invoice_type == 'text') {
invoice_display = "開立品項: " + invoice_name + ", 開立月份: " + invoice_text + ", 金額(未稅): " + AppendComma(invoice_noTaxMoney);
}
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));
}
$('#invoiceModal').modal('toggle');
});
@ -972,14 +1020,29 @@ $(document).ready(function () {
$('#payment_div').find('ol li').each(function (i, item) {
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_old = $(item).find('[data-name="payment_methodname_old"]').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();
if (quotation_method == 'edit' && data_method == 'add') {
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 = {
payment_method: payment_method,
payment_methodname: payment_methodname,
@ -993,16 +1056,43 @@ $(document).ready(function () {
$('#invoice_div').find('ol li').each(function (i, item) {
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_old = $(item).find('[data-name="invoice_type_old"]').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_old = $(item).find('[data-name="invoice_text_old"]').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();
if (quotation_method == 'edit' && data_method == 'add') {
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 = {
invoice_name: invoice_name,
invoice_type: invoice_type,
@ -1920,12 +2010,17 @@ function makePaymentHtml(obj) {
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="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_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_old">' + obj.payment_descript + '</textarea>';
htmlCode += ' <span class="drag-indicator"></span>\n';
htmlCode += ' <div> ' + payment_display + ' </div>\n';
htmlCode += ' <div data-name="payment_display"> ' + payment_display + ' </div>\n';
htmlCode += ' <div class="btn-group ml-auto">\n';
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 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';
@ -1942,24 +2037,30 @@ function makeInvoiceHtml(obj) {
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="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_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_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_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_old">' + obj.invoice_noTaxMoney + '</textarea>';
htmlCode += ' <span class="drag-indicator"></span>\n';
htmlCode += ' <span style="width: 15%;"> ' + "開立品項: " + obj.invoice_name + ' </span>\n';
htmlCode += ' <span style="width: 25%;" data-name="invoice_name_span" > ' + "開立品項: " + obj.invoice_name + ' </span>\n';
if (invoice_type == 'date') {
htmlCode += ' <span style="width: 15%;"> ' + "開立月份: " + invoice_date + ' </span\n';
htmlCode += ' <span style="width: 25%;" data-name="invoice_date_span" > ' + "開立月份: " + invoice_date + ' </span>\n';
} else {
htmlCode += ' <span style="width: 15%;"> ' + "開立月份: " + invoice_text + ' </span\n';
htmlCode += ' <span style="width: 25%;" data-name="invoice_date_span"> ' + "開立月份: " + invoice_text + ' </span>\n';
}
htmlCode += ' <span style="width: 20%;">' + "金額(未稅): " + AppendComma(obj.invoice_noTaxMoney) + ' </span>\n';
htmlCode += ' <span style="width: 50%;"></span>';
htmlCode += ' <span style="width: 20%;" data-name="invoice_noTaxMoney_span">' + "金額(未稅): " + AppendComma(obj.invoice_noTaxMoney) + ' </span>\n';
htmlCode += ' <span style="width: 30%;"></span>';
htmlCode += ' <div class="btn-group ml-auto">\n';
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 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';
@ -3260,6 +3361,24 @@ 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() {
var items = [];
@ -3320,3 +3439,33 @@ function delInvoiceItem(obj) {
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.