diff --git a/wwwroot/assets/javascript/custom/projectlist.js b/wwwroot/assets/javascript/custom/projectlist.js
index c8449b0f..5d20a3d9 100644
--- a/wwwroot/assets/javascript/custom/projectlist.js
+++ b/wwwroot/assets/javascript/custom/projectlist.js
@@ -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,27 +630,39 @@ $(document).ready(function () {
}
}
+
+
var payment_display = payment_methodname;
if (payment_descript != '') {
payment_display = payment_display + ': ' + payment_descript;
}
- var htmlCode = '';
+ if (data_method == 'add') {
+ var htmlCode = '';
- htmlCode += '
\n';
- htmlCode += ' ';
- htmlCode += ' ';
- htmlCode += ' ';
- htmlCode += ' ';
- htmlCode += ' \n';
- htmlCode += ' ' + payment_display + '
\n';
- htmlCode += ' \n';
- htmlCode += ' \n';
- htmlCode += '
\n';
- htmlCode += ' \n';
+ htmlCode += ' \n';
+ htmlCode += ' ';
+ htmlCode += ' ';
+ htmlCode += ' ';
+ htmlCode += ' ';
+ htmlCode += ' \n';
+ htmlCode += ' ' + payment_display + '
\n';
+ htmlCode += ' \n';
+ htmlCode += ' ';
+ htmlCode += ' \n';
+ htmlCode += '
\n';
+ htmlCode += ' \n';
- $('#payment_group').find('ol').append(htmlCode);
+ $('#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,39 +715,70 @@ $(document).ready(function () {
}
}
- var invoice_display = "開立品項: " + invoice_name + ", 開立月份: " + invoice_date + ", 金額(未稅): " + AppendComma(invoice_noTaxMoney);
+ if (invoice_method == 'add') {
+ var invoice_display = "開立品項: " + invoice_name + ", 開立月份: " + invoice_date + ", 金額(未稅): " + AppendComma(invoice_noTaxMoney);
- if (invoice_type == 'text') {
- invoice_display = "開立品項: " + invoice_name + ", 開立月份: " + invoice_text + ", 金額(未稅): " + AppendComma(invoice_noTaxMoney);
+ if (invoice_type == 'text') {
+ invoice_display = "開立品項: " + invoice_name + ", 開立月份: " + invoice_text + ", 金額(未稅): " + AppendComma(invoice_noTaxMoney);
+ }
+
+ var htmlCode = '';
+
+ htmlCode += ' \n';
+ htmlCode += ' ';
+ htmlCode += ' ';
+ htmlCode += ' ';
+ htmlCode += ' ';
+ htmlCode += ' ';
+ htmlCode += ' ';
+ htmlCode += ' \n';
+ htmlCode += ' ' + "開立品項: " + invoice_name + ' \n';
+
+ if (invoice_type == 'date') {
+ htmlCode += ' ' + "開立月份: " + invoice_date + ' \n';
+ } else {
+ htmlCode += ' ' + "開立月份: " + invoice_text + ' \n';
+ }
+
+
+ htmlCode += ' ' + "金額(未稅): " + AppendComma(invoice_noTaxMoney) + ' \n';
+ htmlCode += ' ';
+ htmlCode += ' \n';
+ htmlCode += ' ';
+ htmlCode += ' \n';
+ htmlCode += '
\n';
+ htmlCode += ' \n';
+
+ $('#invoice_group').find('ol').append(htmlCode);
}
- var htmlCode = '';
+ if (invoice_method == 'edit') {
- htmlCode += ' \n';
- htmlCode += ' ';
- htmlCode += ' ';
- htmlCode += ' ';
- htmlCode += ' ';
- htmlCode += ' ';
- htmlCode += ' ';
- htmlCode += ' \n';
- htmlCode += ' ' + "開立品項: " + invoice_name + ' \n';
+ var invoice_display = "開立品項: " + invoice_name + ", 開立月份: " + invoice_date + ", 金額(未稅): " + AppendComma(invoice_noTaxMoney);
- if (invoice_type == 'date') {
- htmlCode += ' ' + "開立月份: " + invoice_date + ' ' + "開立月份: " + invoice_text + ' ' + "金額(未稅): " + AppendComma(invoice_noTaxMoney) + ' \n';
- htmlCode += ' ';
- htmlCode += ' \n';
- htmlCode += ' \n';
- htmlCode += '
\n';
- htmlCode += ' \n';
-
- $('#invoice_group').find('ol').append(htmlCode);
$('#invoiceModal').modal('toggle');
});
@@ -972,13 +1020,28 @@ $(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,
@@ -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 += ' \n';
htmlCode += ' ';
htmlCode += ' ';
+ htmlCode += ' ';
htmlCode += ' ';
+ htmlCode += ' ';
htmlCode += ' ';
+ htmlCode += ' ';
+
htmlCode += ' \n';
- htmlCode += ' ' + payment_display + '
\n';
+ htmlCode += ' ' + payment_display + '
\n';
htmlCode += ' \n';
- htmlCode += ' \n';
+ htmlCode += ' ';
+ htmlCode += ' \n';
htmlCode += '
\n';
htmlCode += ' \n';
@@ -1942,24 +2037,30 @@ function makeInvoiceHtml(obj) {
htmlCode += ' \n';
htmlCode += ' ';
htmlCode += ' ';
+ htmlCode += ' ';
htmlCode += ' ';
+ htmlCode += ' ';
htmlCode += ' ';
+ htmlCode += ' ';
htmlCode += ' ';
+ htmlCode += ' ';
htmlCode += ' ';
+ htmlCode += ' ';
htmlCode += ' \n';
- htmlCode += ' ' + "開立品項: " + obj.invoice_name + ' \n';
+ htmlCode += ' ' + "開立品項: " + obj.invoice_name + ' \n';
if (invoice_type == 'date') {
- htmlCode += ' ' + "開立月份: " + invoice_date + ' ' + "開立月份: " + invoice_date + ' \n';
} else {
- htmlCode += ' ' + "開立月份: " + invoice_text + ' ' + "開立月份: " + invoice_text + ' \n';
}
- htmlCode += ' ' + "金額(未稅): " + AppendComma(obj.invoice_noTaxMoney) + ' \n';
- htmlCode += ' ';
+ htmlCode += ' ' + "金額(未稅): " + AppendComma(obj.invoice_noTaxMoney) + ' \n';
+ htmlCode += ' ';
htmlCode += ' \n';
- htmlCode += ' \n';
+ htmlCode += ' ';
+ htmlCode += ' \n';
htmlCode += '
\n';
htmlCode += ' \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 = [];
@@ -3319,4 +3438,34 @@ 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');
+
}
\ No newline at end of file