diff --git a/Controllers/ApiController.cs b/Controllers/ApiController.cs index 9b880847..ff1fb51f 100644 --- a/Controllers/ApiController.cs +++ b/Controllers/ApiController.cs @@ -21,6 +21,7 @@ using System.Text; using System.Web; using NPOI.SS.Util; using NPOI.XSSF.Streaming; +using System.IO; namespace QuotationMaker.Controllers { @@ -109,7 +110,7 @@ namespace QuotationMaker.Controllers row = (XSSFRow)sheet.GetRow(2); row.Cells[0].SetCellValue(row.Cells[0].StringCellValue.Replace("{contactPerson_name}", objDetail.contactPerson.contactPerson_name)); row.Cells[2].SetCellValue(row.Cells[2].StringCellValue.Replace("{company_name}", objDetail.company.company_name)); - row.Cells[3].SetCellValue(row.Cells[3].StringCellValue.Replace("{user_name}", objDetail.user.user_name)); + row.Cells[3].SetCellValue(row.Cells[3].StringCellValue.Replace("{user_name}", objDetail.user.user_name + " " + objDetail.user.user_engName)); row = (XSSFRow)sheet.GetRow(3); row.Cells[0].SetCellValue(row.Cells[0].StringCellValue.Replace("{contactPerson_email}", objDetail.contactPerson.contactPerson_email)); @@ -118,7 +119,14 @@ namespace QuotationMaker.Controllers row = (XSSFRow)sheet.GetRow(4); row.Cells[0].SetCellValue(row.Cells[0].StringCellValue.Replace("{company_serialNo}", objDetail.company.company_serialNo)); - row.Cells[2].SetCellValue(row.Cells[2].StringCellValue.Replace("{contactPerson_tel}", objDetail.contactPerson.contactPerson_tel)); + + string fax_string = ""; + + if (objDetail.contactPerson.contactPerson_fax != "") { + fax_string = " FAX:" + objDetail.contactPerson.contactPerson_fax; + } + + row.Cells[2].SetCellValue(row.Cells[2].StringCellValue.Replace("{contactPerson_tel}", objDetail.contactPerson.contactPerson_tel + fax_string)); //估價單契約有效期限 UpperConvert upcov = new UpperConvert(); @@ -219,7 +227,16 @@ namespace QuotationMaker.Controllers row = (XSSFRow)sheet.GetRow(rowIndex); row.Cells[3].SetCellValue(objDetail.invoices[i - 1].invoice_name); - row.Cells[4].SetCellValue(objDetail.invoices[i - 1].invoice_year.ToString() + "/" + objDetail.invoices[i - 1].invoice_month.ToString().PadLeft(2, '0')); + + if (objDetail.invoices[i - 1].invoice_type == "date") + { + row.Cells[4].SetCellValue(objDetail.invoices[i - 1].invoice_year.ToString() + "/" + objDetail.invoices[i - 1].invoice_month.ToString().PadLeft(2, '0')); + } + else { + row.Cells[4].SetCellValue(objDetail.invoices[i - 1].invoice_text); + } + + //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); @@ -1277,13 +1294,26 @@ namespace QuotationMaker.Controllers newItem.invoice_uid = "inv_" + GlobalClass.CreateRandomCode(20); newItem.quotation_uid = quotation_uid; newItem.invoice_name = item.invoice_name; + newItem.invoice_type = item.invoice_type; - string yearmonth = item.invoice_date; - string strYear = yearmonth.Split('/')[0]; - string strMonth = yearmonth.Split("/")[1]; + if (newItem.invoice_type == "date") + { + string yearmonth = item.invoice_date; + string strYear = yearmonth.Split('/')[0]; + string strMonth = yearmonth.Split("/")[1]; - newItem.invoice_year = int.Parse(strYear); - newItem.invoice_month = int.Parse(strMonth); + newItem.invoice_year = int.Parse(strYear); + newItem.invoice_month = int.Parse(strMonth); + newItem.invoice_text = ""; + } + else { + newItem.invoice_year = 0; + newItem.invoice_month = 0; + newItem.invoice_text = item.invoice_text; + } + + + newItem.invoice_noTaxMoney = int.Parse((string)item.invoice_noTaxMoney); newItem.invoice_revoke = "N"; newItem.invoice_version = int.Parse((string)quotation_version); @@ -1459,12 +1489,23 @@ namespace QuotationMaker.Controllers newItem.quotation_uid = quotation_uid; newItem.invoice_name = item.invoice_name; - string yearmonth = item.invoice_date; - string strYear = yearmonth.Split('/')[0]; - string strMonth = yearmonth.Split("/")[1]; + if (newItem.invoice_type == "date") + { + string yearmonth = item.invoice_date; + string strYear = yearmonth.Split('/')[0]; + string strMonth = yearmonth.Split("/")[1]; + + newItem.invoice_year = int.Parse(strYear); + newItem.invoice_month = int.Parse(strMonth); + newItem.invoice_text = ""; + } + else + { + newItem.invoice_year = 0; + newItem.invoice_month = 0; + newItem.invoice_text = item.invoice_text; + } - newItem.invoice_year = int.Parse(strYear); - newItem.invoice_month = int.Parse(strMonth); newItem.invoice_noTaxMoney = int.Parse((string)item.invoice_noTaxMoney); newItem.invoice_revoke = "N"; newItem.invoice_version = int.Parse((string)quotation_version); diff --git a/Controllers/AuthApiController.cs b/Controllers/AuthApiController.cs index 166609f8..297574d2 100644 --- a/Controllers/AuthApiController.cs +++ b/Controllers/AuthApiController.cs @@ -1500,6 +1500,7 @@ namespace QuotationMaker.Controllers if (user_type == "N") { string user_id = obj["user_elabName"].ToString(); + string user_engName = obj["user_engName"].ToString(); user newUser = conn.QueryFirstOrDefault("select * from users where user_id = @user_id ", new { user_id = user_id }); @@ -1540,6 +1541,7 @@ namespace QuotationMaker.Controllers newUser = new user(); newUser.user_uid = user_uid; newUser.user_name = elabUser.username; + newUser.user_engName = user_engName; newUser.user_id = elabUser.userid; newUser.user_email = elabUser.mail; newUser.user_type = user_type; @@ -1578,6 +1580,7 @@ namespace QuotationMaker.Controllers string user_uid = GlobalClass.CreateRandomCode(12); string user_name = obj["user_name"].ToString(); string user_email = obj["user_email"].ToString(); + string user_engName = obj["user_engName"].ToString(); if (user_id == "") @@ -1638,6 +1641,7 @@ namespace QuotationMaker.Controllers newUser.user_uid = user_uid; newUser.user_id = user_id; newUser.user_name = user_name; + newUser.user_engName = user_engName; newUser.user_pwd = user_pwd; newUser.user_email = user_email; newUser.user_type = user_type; @@ -1672,6 +1676,7 @@ namespace QuotationMaker.Controllers string user_uid = obj["user_uid"].ToString(); string user_perm = obj["user_perm"].ToString(); string user_depts = obj["user_depts"].ToString().Trim(','); + string user_engName = obj["user_engName"].ToString(); string[] depts = user_depts.Split(","); @@ -1713,12 +1718,14 @@ namespace QuotationMaker.Controllers if (user_type == "N") { editUser.user_perm = user_perm; + editUser.user_engName = user_engName; } else { string user_pwd = obj["user_pwd"].ToString(); string user_name = obj["user_name"].ToString(); string user_email = obj["user_email"].ToString(); + editUser.user_perm = user_perm; @@ -1745,6 +1752,7 @@ namespace QuotationMaker.Controllers editUser.user_name = user_name; editUser.user_email = user_email; + editUser.user_engName = user_engName; } conn.Update(editUser); @@ -1943,6 +1951,7 @@ namespace QuotationMaker.Controllers adminToken.user_uid = GlobalClass.appsettings("Admin:uid"); adminToken.user_id = GlobalClass.appsettings("Admin:id"); + adminToken.token_isremember = input_isRemember; adminToken.token_key = token_key; adminToken.token_createdate = DateTime.Now; diff --git a/Modals/DbTableClass.cs b/Modals/DbTableClass.cs index 17285a98..7c6ed104 100644 --- a/Modals/DbTableClass.cs +++ b/Modals/DbTableClass.cs @@ -57,6 +57,9 @@ public class DbTableClass public string invoice_uid { get; set; } = ""; public string quotation_uid { get; set; } = ""; public string invoice_name { get; set; } = ""; + + public string invoice_type { get; set; } = ""; + public string invoice_text { get; set; } = ""; public int invoice_year { get; set; } = 2024; public int invoice_month { get; set; } = 1; public int invoice_noTaxMoney { get; set; } = 0; @@ -447,6 +450,8 @@ public class DbTableClass public string user_name { get; set; } = ""; + public string user_engName { get; set; } = ""; + public string user_email { get; set; } = ""; public string user_onjob { get; set; } = "N"; diff --git a/Views/Home/CompanyList.cshtml b/Views/Home/CompanyList.cshtml index 23436495..b9256bef 100644 --- a/Views/Home/CompanyList.cshtml +++ b/Views/Home/CompanyList.cshtml @@ -94,13 +94,13 @@ -
+ -
+
- +
diff --git a/Views/Home/ProjectList.cshtml b/Views/Home/ProjectList.cshtml index ebdb97e7..3f89f8a9 100644 --- a/Views/Home/ProjectList.cshtml +++ b/Views/Home/ProjectList.cshtml @@ -593,7 +593,7 @@
- +
@@ -685,10 +685,22 @@
+ +
+ +
+ +
+ +
+
diff --git a/Views/Home/UserList.cshtml b/Views/Home/UserList.cshtml index 250a8d64..f0993f31 100644 --- a/Views/Home/UserList.cshtml +++ b/Views/Home/UserList.cshtml @@ -111,6 +111,13 @@
+ +
+
+ +
+
+
diff --git a/wwwroot/assets/javascript/custom/projectlist.js b/wwwroot/assets/javascript/custom/projectlist.js index 60df3a00..c8449b0f 100644 --- a/wwwroot/assets/javascript/custom/projectlist.js +++ b/wwwroot/assets/javascript/custom/projectlist.js @@ -176,6 +176,16 @@ $(document).ready(function () { $('#clientModelQuotationModal').modal("toggle"); }); + $('#invoice_type').on('change', function () { + if ($('#invoice_type').val() == "date") { + $('#invoice_type_date').show(); + $('#invoice_type_text').hide(); + } else { + $('#invoice_type_date').hide(); + $('#invoice_type_text').show(); + } + }); + $('#dept_select').on('change', function () { $('#dt-responsive').DataTable().ajax.reload(); }); @@ -647,6 +657,8 @@ $(document).ready(function () { initInvoiceSelectItem(); fpInvoiceDate.setDate(new Date(endTxt + '/1')); + $('#invoice_type').val('date'); + $('#invoice_type_text').hide(); $('#invoice_method').val('add'); $('#invoiceModal').modal('toggle'); }); @@ -656,7 +668,11 @@ $(document).ready(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(); + var invoice_type = $('#invoice_type').val(); + var invoice_text = $('#invoice_text').val(); + var invoice_noTaxMoney = $('#invoice_noTaxMoney').val().replace(/,/g, ""); + + if (invoice_noTaxMoney.isNumber() == false || invoice_noTaxMoney == '') { alert('發票金額得為純數字!'); @@ -668,23 +684,45 @@ $(document).ready(function () { return; } - if (invoice_date == '') { - alert('請輸入發票月份!'); - return; + if (invoice_type == 'date') { + if (invoice_date == '') { + alert('請輸入發票月份!'); + return; + } + } + + if (invoice_type == 'text') { + if (invoice_text == '') { + alert('請輸入發票開立時間說明!'); + return; + } } var invoice_display = "開立品項: " + invoice_name + ", 開立月份: " + invoice_date + ", 金額(未稅): " + 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'; - htmlCode += ' ' + "開立月份: " + invoice_date + ' \n'; htmlCode += ' '; htmlCode += '
    \n'; @@ -955,17 +993,21 @@ $(document).ready(function () { $('#invoice_div').find('ol li').each(function (i, item) { var invoice_name = $(item).find('[data-name="invoice_name"]').val(); + var invoice_type = $(item).find('[data-name="invoice_type"]').val(); var invoice_date = $(item).find('[data-name="invoice_date"]').val(); + var invoice_text = $(item).find('[data-name="invoice_text"]').val(); var invoice_noTaxMoney = $(item).find('[data-name="invoice_noTaxMoney"]').val(); var data_method = $(item).find('[data-name="data_method"]').val(); if (quotation_method == 'edit' && data_method == 'add') { - quotation_log += '發票品項增加了 [' + invoice_name + ' (' + invoice_date + ') ' + AppendComma(invoice_noTaxMoney) + ']\n'; + quotation_log += '發票品項增加了 [' + invoice_name + ' (' + invoice_date + invoice_text + ') ' + AppendComma(invoice_noTaxMoney) + ']\n'; } var invoiceFormData = { invoice_name: invoice_name, + invoice_type: invoice_type, invoice_date: invoice_date, + invoice_text: invoice_text, invoice_noTaxMoney: invoice_noTaxMoney } @@ -1893,16 +1935,27 @@ function makePaymentHtml(obj) { function makeInvoiceHtml(obj) { var invoice_display = "開立品項: " + obj.invoice_name + ", 開立月份: " + obj.invoice_date + ", 金額(未稅): " + AppendComma(obj.invoice_noTaxMoney); var invoice_date = obj.invoice_year + "/" + String(obj.invoice_month).padStart(2, "0"); + var invoice_text = obj.invoice_text; + var invoice_type = obj.invoice_type; var htmlCode = ''; htmlCode += '
  • \n'; htmlCode += ' '; htmlCode += ' '; + htmlCode += ' '; htmlCode += ' '; + htmlCode += ' '; htmlCode += ' '; htmlCode += ' \n'; htmlCode += ' ' + "開立品項: " + obj.invoice_name + ' \n'; - htmlCode += ' ' + "開立月份: " + invoice_date + ' \n'; htmlCode += ' '; htmlCode += '
    \n'; diff --git a/wwwroot/assets/javascript/custom/userlist.js b/wwwroot/assets/javascript/custom/userlist.js index 77fffba4..80425870 100644 --- a/wwwroot/assets/javascript/custom/userlist.js +++ b/wwwroot/assets/javascript/custom/userlist.js @@ -140,7 +140,7 @@ function buttonClick(obj) { $("#user_uid").val(obj.user_uid); $("#user_type").val(obj.user_type).trigger('change'); $("#user_perm").val(obj.user_perm).trigger('change'); - + $("#user_engName").val(obj.user_engName).trigger('change'); if (obj.user_type == "N") { $("#user_elabName").val(obj.user_id).trigger('change'); @@ -233,6 +233,7 @@ $(document).ready(function () { var user_id = $("#user_id").val(); var user_elabName = $("#user_elabName").val(); var user_name = $("#user_name").val(); + var user_engName = $("#user_engName").val(); var user_pwd = $("#user_pwd").val(); var user_chkpwd = $("#user_chkpwd").val(); var user_email = $("#user_email").val(); @@ -299,6 +300,7 @@ $(document).ready(function () { user_id: user_id, user_elabName: user_elabName, user_name: user_name, + user_engName: user_engName, user_email: user_email, user_pwd: user_pwd, user_perm: user_perm, @@ -358,6 +360,7 @@ $(document).ready(function () { if (user_type == "Y") { $("#user_elab_div").hide(); $("#user_name_div").show(); + $("#user_engname_div").show(); $("#user_id_div").show(); $("#user_pwd_div").show(); $("#user_chkpwd_div").show(); @@ -365,6 +368,7 @@ $(document).ready(function () { } else { $("#user_elab_div").show(); $("#user_name_div").hide(); + $("#user_engname_div").show(); $("#user_id_div").hide(); $("#user_pwd_div").hide(); $("#user_chkpwd_div").hide(); diff --git a/wwwroot/logo/bremen_temp.xlsx b/wwwroot/logo/bremen_temp.xlsx index d149a887..74fa13eb 100644 Binary files a/wwwroot/logo/bremen_temp.xlsx and b/wwwroot/logo/bremen_temp.xlsx differ diff --git a/wwwroot/logo/journeys_temp.xlsx b/wwwroot/logo/journeys_temp.xlsx index 8b56cdbf..923eea48 100644 Binary files a/wwwroot/logo/journeys_temp.xlsx and b/wwwroot/logo/journeys_temp.xlsx differ