diff --git a/Modals/DbTableClass.cs b/Modals/DbTableClass.cs index 9c79a7e3..a1b66116 100644 --- a/Modals/DbTableClass.cs +++ b/Modals/DbTableClass.cs @@ -57,7 +57,8 @@ public class DbTableClass public string invoice_uid { get; set; } = ""; public string quotation_uid { get; set; } = ""; public string invoice_name { get; set; } = ""; - public string invoice_month { get; set; } = ""; + public int invoice_year { get; set; } = 2024; + public int invoice_month { get; set; } = 1; public int invoice_noTaxMoney { get; set; } = 0; public string invoice_revoke { get; set; } = "N"; public int invoice_version { get; set; } = 1; @@ -76,6 +77,7 @@ public class DbTableClass public string payment_uid { get; set; } = ""; public string quotation_uid { get; set; } = ""; public string payment_method { get; set; } = ""; + public string payment_methodname { get; set; } = ""; public string payment_descript { get; set; } = ""; public string payment_revoke { get; set; } = "N"; public int payment_version { get; set; } = 1; diff --git a/Views/Home/ProjectList.cshtml b/Views/Home/ProjectList.cshtml index a496e92f..c78efee3 100644 --- a/Views/Home/ProjectList.cshtml +++ b/Views/Home/ProjectList.cshtml @@ -57,6 +57,8 @@ + + } @@ -402,10 +404,48 @@
- +
+ +
+ +
+ +
+
付款方式
+
+ +
    +
+
+ + +
+
+
+ +
+ +
+ +
+
發票開立品項
+
+ +
    +
+
+ + +
+
+
+ + + + +
+ +
+ + + +
+
\ No newline at end of file diff --git a/wwwroot/assets/javascript/custom/projectlist.js b/wwwroot/assets/javascript/custom/projectlist.js index 5fb01816..7f66d1ea 100644 --- a/wwwroot/assets/javascript/custom/projectlist.js +++ b/wwwroot/assets/javascript/custom/projectlist.js @@ -10,6 +10,8 @@ var quotation_total; var deledMainItems = []; var deledSubItems = []; +var deledPayments = []; +var deledInvoices = []; var preSubItem_name = ''; var hasBind = 'N'; @@ -18,6 +20,7 @@ $(document).ready(function () { companyList(); loadyearmonth(); loadQuotationTable(); + initInvoiceSelectItem(); var actualDate = new Date(); // convert to actual date var prevDate = new Date(actualDate.getFullYear(), actualDate.getMonth() - 13, actualDate.getDate()); @@ -49,8 +52,21 @@ $(document).ready(function () { ] }); - fpStart.setDate(new Date(startTxt + '/1')) - fpEnd.setDate(new Date(endTxt + '/1')) + const fpInvoiceDate = flatpickr("#invoice_date", { + "locale": "zh_tw", + "plugins": [ + new monthSelectPlugin({ + shorthand: true, //defaults to false + dateFormat: "Y/m", //defaults to "F Y" + altFormat: "Y M", //defaults to "F Y" + theme: "light" // defaults to "light" + }) + ] + }); + + fpStart.setDate(new Date(startTxt + '/1')); + fpEnd.setDate(new Date(endTxt + '/1')); + fpInvoiceDate.setDate(new Date(endTxt + '/1')); $("#quotation_range").flatpickr({ mode: 'range', @@ -243,6 +259,10 @@ $(document).ready(function () { $('#modelItem_div').html(htmlCode); + $.each(obj.modelMainItemDetails, function (i, item) { + $('#nest_' + item.modelMainItem_uid).nestable(); + }); + updateGrandTotal(); } else { alert(data.message); @@ -373,7 +393,7 @@ $(document).ready(function () { var datauid = Math.floor(Math.random() * 999999999); var htmlCode = ''; - htmlCode += '
  • '; + htmlCode += '
  • '; htmlCode += ' '; htmlCode += ' '; htmlCode += ' '; @@ -421,9 +441,21 @@ $(document).ready(function () { var htmlObj = $('#modelItem_div').find('[data-uid="' + parent_data_uid + '"]').find('ol'); + + //var htmlObj = $('#' + parent_data_uid).find('ol'); htmlObj.append(htmlCode); + var li_count = 0; + + htmlObj.find('li').each(function (i, item) { + li_count++; + }); + + if (li_count == 1) { + $('#nest_' + parent_data_uid).nestable(); + } + $('#modelSubItemModal').modal('toggle'); } @@ -486,11 +518,12 @@ $(document).ready(function () { htmlCode += ' '; htmlCode += ' '; htmlCode += ' '; + htmlCode += '
    '; htmlCode += ' '; htmlCode += '
      '; htmlCode += ' '; htmlCode += '
    '; - htmlCode += ' '; + htmlCode += '
    '; htmlCode += ' '; htmlCode += '
  • \n'; + htmlCode += ' '; + htmlCode += ' '; + htmlCode += ' '; + htmlCode += ' \n'; + htmlCode += '
    ' + payment_display + '
    \n'; + htmlCode += '
    \n'; + htmlCode += ' \n'; + htmlCode += '
    \n'; + htmlCode += '
  • \n'; + + $('#payment_group').find('ol').append(htmlCode); + + $('#paymentModal').modal('toggle'); + }); + + //新增發票項目 + $('#addInvoiceBtn').on('click', function () { + $('#invoice_name').typeahead('destroy'); + + initInvoiceSelectItem(); + + fpInvoiceDate.setDate(new Date(endTxt + '/1')); + $('#invoice_method').val('add'); + $('#invoiceModal').modal('toggle'); + }); + + //儲存發票項目 + $('#invoiceModalDialogSaveBtn').on('click', function () { + var invoice_method = $('#invoice_method').val(); + var invoice_name = $("#invoice_name").val(); + var invoice_date = $('#invoice_date').val(); + var invoice_noTaxMoney = $('#invoice_noTaxMoney').val(); + + if (invoice_noTaxMoney.isNumber() == false || invoice_noTaxMoney == '') { + alert('發票金額得為純數字!'); + return; + } + + if (invoice_name == '') { + alert('請輸入品項名稱!'); + return; + } + + if (invoice_date == '') { + alert('請輸入發票月份!'); + return; + } + + var invoice_display = "開立品項: " + invoice_name + ", 開立月份: " + invoice_date + ", 金額(未稅): " + AppendComma(invoice_noTaxMoney); + + var htmlCode = ''; + + htmlCode += '
  • \n'; + htmlCode += ' '; + htmlCode += ' '; + htmlCode += ' '; + htmlCode += ' \n'; + htmlCode += ' ' + "開立品項: " + invoice_name + ' \n'; + htmlCode += ' ' + "開立月份: " + invoice_date + ' \n'; + htmlCode += ' '; + htmlCode += '
    \n'; + htmlCode += ' \n'; + htmlCode += '
    \n'; + htmlCode += '
  • \n'; + + $('#invoice_group').find('ol').append(htmlCode); + + $('#invoiceModal').modal('toggle'); + }); }); function loadContactPersion() { @@ -1097,6 +1260,7 @@ function mainItemHtml(obj) { htmlCode += ' '; htmlCode += ' '; htmlCode += ' '; + htmlCode += '
    '; htmlCode += ' '; htmlCode += '
      '; @@ -1106,7 +1270,7 @@ function mainItemHtml(obj) { htmlCode += ' '; htmlCode += '
    '; - htmlCode += ' '; + htmlCode += '
    '; htmlCode += ' '; htmlCode += '