You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
14 KiB
1 lines
14 KiB
!function (e, n, t) { "use strict"; n.fnKeyUnit = function (e) { e.value = e.value.toUpperCase() }, n.fnSGMod = function (n) { var t = n || e(".shjy-box"); "SG" !== parent.OrgID && t.remove() }, n.fnUpdateBillInfo = function (e, n, t) { var i = { Guid: n }; t && (i.BillNO = t), g_api.ConnectLite(e, "UpdateBillInfo", i, function (e) { e.RESULT && console.log(e) }) }, n.fnDeleteBillInfo = function (e) { var n = { BillNO: e }; g_api.ConnectLite("Exhibition", "DeleteBillInfo", n, function (e) { e.RESULT && console.log(e) }) }, n.getSelectedValues = function (e) { let n = []; return document.querySelectorAll(e + " option").forEach(function (e) { e.selected && n.push(e.value) }), n }, n.fnCheckBillEffective = function (n) { var t = []; return n && n.length > 0 && (t = e.grep(n, function (e) { return "6" !== e.AuditVal })), t.length > 0 }, n.fnCheckRtnBillEffective = function (n) { var t = []; return n && n.length > 0 && e.grep(n, function (n) { n.Bills && n.Bills.length > 0 && t.push(e.grep(n.Bills, function (e) { return "6" !== e.AuditVal })) }), t.length > 0 }, n.fnStarFeeItems = function (n) { n = n || {}; var t = [], i = [], a = function (e) { return CallAjax(ComFn.W_Com, ComFn.GetList, { Type: "", Params: { profiles: { ProfileType: "FeeClass", OrgID: parent.OrgID, UserID: parent.UserID }, sort: { SN: "asc" } } }, function (n) { n.d && (i = JSON.parse(n.d), e.html(createOptions(i, "SN", "ProfileName"))) }) }; getHtmlTmp("/Page/Pop/ProfileFees.html").done(function (l) { layer.open({ type: 1, title: i18next.t("common.ProfileFees"), shadeClose: !1, shade: .1, maxmin: !0, area: ["600px", "500px"], content: l, success: function (n, l) { var o = n.find("#lstLeft"), r = n.find("#lstRight"); a(n.find("#ProfileClass")), fnSetArgDrop([{ ArgClassID: "FeeClass", Select: o, ShowId: !0, CallBack: function (e) { t = e } }]).done(function () { o.find("option:first").remove(), optionListSearch(o, r, n.find("#ProfileFilter")) }), n.find("#ProfileClass").on("change", function () { var a = this.value, l = []; if (a) { var c = e.grep(i, function (e) { return e.SN.toString() === a })[0]; l = JSON.parse(c.ProfileSet || "[]"), n.find("#ProfileName").val(c.ProfileName) } else n.find("#ProfileName").val(""); r.html(""), o.html(createOptions(t, "id", "text", !0)).find("option:first").remove(), n.find("#lstLeft option").each(function () { var n = e(this).val(); l.indexOf(n) > -1 && e(this).appendTo(r) }) }), n.find(".cusclass-add").on("click", function () { !function (n) { var t = {}; if (t.OrgID = parent.OrgID, t.UserID = parent.UserID, t.ProfileType = "FeeClass", t.ProfileName = n.find("#ProfileName").val(), t.ProfileSet = [], n.find("#lstRight option").each(function () { t.ProfileSet.push(this.value) }), t.ProfileSet = JSON.stringify(t.ProfileSet), !(t = packParams(t)).ProfileName) return showMsg(i18next.t("message.ProfileFeesClassName_Required")), !1; CallAjax(ComFn.W_Com, ComFn.GetAdd, { Params: { profiles: t } }, function (i) { i.d > 0 ? (a(n.find("#ProfileClass")).done(function () { n.find("#ProfileClass option").each(function () { if (e(this).text() === t.ProfileName) return n.find("#ProfileClass").val(this.value), !1 }) }), showMsg(i18next.t("message.Save_Success"), "success")) : showMsg(i18next.t("message.Save_Failed"), "error") }, function () { showMsg(i18next.t("message.Save_Failed"), "error") }) }(n) }), n.find(".cusclass-upd").on("click", function () { !function (e) { var n = {}, t = e.find("#ProfileClass").val(); if (n.ProfileName = e.find("#ProfileName").val(), n.ProfileSet = [], e.find("#lstRight option").each(function () { n.ProfileSet.push(this.value) }), n.ProfileSet = JSON.stringify(n.ProfileSet), !(n = packParams(n, "upd")).ProfileName) return showMsg(i18next.t("message.ProfileFeesClassName_Required")), !1; CallAjax(ComFn.W_Com, ComFn.GetUpd, { Params: { profiles: { values: n, keys: { SN: t } } } }, function (n) { n.d > 0 ? (a(e.find("#ProfileClass")).done(function () { e.find("#ProfileClass").val(t) }), showMsg(i18next.t("message.Modify_Success"), "success")) : showMsg(i18next.t("message.Modify_Failed"), "error") }, function () { showMsg(i18next.t("message.Modify_Failed"), "error") }) }(n) }), n.find(".cusclass-del").on("click", function () { !function (e) { var n = e.find("#ProfileClass").val(); if (!n) return showMsg(i18next.t("message.DeleteItem_Required")), !1; CallAjax(ComFn.W_Com, ComFn.GetDel, { Params: { profiles: { SN: n } } }, function (n) { n.d > 0 ? (a(e.find("#ProfileClass")), e.find("#ProfileName").val(""), e.find("#lstRight").html(""), e.find("#lstLeft").html(createOptions(t, "id", "text", !0)), e.find("#lstLeft").find("option:first").remove(), showMsg(i18next.t("message.Delete_Success"), "success")) : showMsg(i18next.t("message.Delete_Failed"), "error") }, function () { showMsg(i18next.t("message.Delete_Failed"), "error") }) }(n) }), n.find("#btnToRight").on("click", function () { optionListMove(o, r) }), n.find("#btnToLeft").on("click", function () { optionListMove(r, o) }), n.find("#btnToUp").on("click", function () { optionListOrder(r, !0) }), n.find("#btnToDown").on("click", function () { optionListOrder(r, !1) }), transLang(n) }, btn: [i18next.t("common.Confirm"), i18next.t("common.Cancel")], yes: function (t, i) { var a = []; i.find("#lstRight option").each(function () { e(this).val(); a.push({ guid: guid(), FinancialCode: e(this).val(), FinancialCostStatement: e(this).text(), Memo: "", FinancialCurrency: "NTD", FinancialUnitPrice: "0", FinancialNumber: "", FinancialUnit: "", FinancialAmount: "0", FinancialExchangeRate: "1", FinancialTWAmount: "0", FinancialTaxRate: "0", FinancialTax: "0", CreateUser: parent.UserID, CreateDate: newDate() }) }), "function" == typeof n.Callback && n.Callback(a), layer.close(t) }, cancel: function () { "function" == typeof n.CancelCallback && n.CancelCallback() } }) }) }, n.fnCopyFee = function (n) { n = n || {}; var t = null, i = null, a = [], l = [], o = function (n, l, r) { return g_api.ConnectLite(Service.opm, "GetBillInfos", { ExhibitionNO: n || "", BillNO: l || "" }, function (n) { if (n.RESULT) { var l = n.DATA.rel; if (a = l.length > 0 ? JSON.parse(l[0].FeeItems) : [], r) if (l.length > 0) { var c = ""; e.each(l, function (e, n) { c += (0 === e ? '<li class="active">' : "<li>") + n.BillNO + "</li>" }), i.html(c).find("li").click(function () { i.find("li").removeClass("active"); var n = e(this).addClass("active").text(), t = e("#ExhibitionName").val(); o(t, n, !1) }) } else i.html(""); t.jsGrid("loadData") } }) }; layer.open({ type: 1, title: i18next.t("common.CopyFeeItems"), shadeClose: !1, shade: .1, maxmin: !0, area: ["800px", "500px"], content: '<style>.select2-container--open { z-index: 1000000001;}.jsgrid-header-cell{padding:0 0;}</style> <div class="row popsrow"> <label class="col-sm-2 control-label wright" for="input-Default"><span data-i18n="common.ExhibitionName">展覽名稱</span>:</label> <div class="col-sm-4"> <select class="form-control" id="ExhibitionName"></select> </div> <label class="col-sm-1 control-label wright" for="input-Default"><span data-i18n="common.BillNO">帳單號碼</span>:</label> <div class="col-sm-4"> <input type="text" class="form-control w100p" id="BillNO" maxlength="50"> </div> </div> <div class="row popsrow"> <div class="col-sm-2"> <div class="bill-box slimscroll"> <ul class="bill-list"> </ul> </div> </div> <div class="col-sm-10"> <div id="jsGrid_Fees"></div> </div> <div class="col-sm-2"></div> </div>', success: function (n, o) { fnSetEpoDrop({ Select: e("#ExhibitionName"), Select2: !0 }), i = n.find(".bill-list"), t = e("#jsGrid_Fees").jsGrid({ width: "100%", height: "320px", autoload: !0, filtering: !1, pageLoading: !0, pageIndex: 1, pageSize: 1e4, fields: [{ name: "OrderBy", title: "#", width: 30, align: "center" }, { width: 50, sorting: !1, align: "center", headerTemplate: function () { return [e("<input>", { id: "SelectAll", type: "checkbox", click: function () { this.checked ? (e("#jsGrid_Fees").find("[type=checkbox]").each(function () { this.checked = !0 }), l = clone(a)) : (e("#jsGrid_Fees").find("[type=checkbox]").each(function () { this.checked = !1 }), l = []) } }), e("<label />", { for: "SelectAll", "data-i18n": "common.SelectAll" })] }, itemTemplate: function (n, t) { return e("<input>", { type: "checkbox", click: function (n) { if (n.stopPropagation(), this.checked) l.push(t); else { var i = []; e.each(l, function (e, n) { t.guid !== n.guid && i.push(n) }), l = i, e("#jsGrid_Fees").find("#SelectAll")[0].checked = !1 } } }) } }, { name: "FinancialCode", title: "common.Financial_Code", width: 70, type: "text" }, { name: "FinancialCostStatement", title: "common.Financial_CostStatement", width: 150, type: "text", itemTemplate: function (e, n) { return "" === e ? n.Memo : e } }, { name: "FinancialCurrency", title: "common.Financial_Currency", width: 60, type: "text", align: "center" }, { name: "FinancialUnitPrice", title: "common.Financial_UnitPrice", width: 80, align: "right", type: "text", itemTemplate: function (e, n) { return fMoney(e || 0, 2) } }, { name: "FinancialNumber", title: "common.Financial_Number", width: 80, type: "text", align: "right" }, { name: "FinancialUnit", title: "common.Financial_Unit", width: 80, type: "text" }, { name: "FinancialAmount", title: "common.Financial_Amount", width: 80, type: "text", align: "right", itemTemplate: function (e, n) { return fMoney(e || 0, 2) } }, { name: "FinancialExchangeRate", title: "common.ExchangeRate", width: 60, type: "text", align: "center" }, { name: "FinancialTWAmount", title: "common.Financial_TWAmount", width: 80, align: "right", type: "text", itemTemplate: function (e, n) { return fMoney(e || 0, 2) } }, { name: "FinancialTaxRate", title: "common.Financial_TaxRate", width: 60, align: "center", type: "text" }, { name: "FinancialTax", title: "common.Financial_Tax", width: 80, align: "right", type: "text", itemTemplate: function (e, n) { return fMoney(e || 0, 2) } }], controller: { loadData: function (e) { return { data: a, itemsCount: a.length } } } }), n.find(".layui-layer-btn1").css({ "border-color": "#4898d5", "background-color": "#1E9FFF", color: "#fff" }) }, btn: [i18next.t("common.Toolbar_Qry"), i18next.t("common.Confirm"), i18next.t("common.Cancel")], yes: function (e, n) { var t = n.find("#ExhibitionName").val(), i = n.find("#BillNO ").val(); o(t, i, !0) }, btn2: function (e, t) { "function" == typeof n.Callback && n.Callback(l), layer.close(e) } }) }, n.fnGetCurrencyByYear = function (e) { return g_api.ConnectLite("CurrencySetup_Qry", "GetCurrencyByYear", { year: e.Year }, function (n) { if (n.RESULT) { var t = n.DATA.rel; e.CallBack && "function" == typeof e.CallBack && e.CallBack(t) } }, {}, !1) }, n.roundDecimal = function (e, n) { return Math.round(Math.round(e * Math.pow(10, (n || 0) + 1)) / 10) / Math.pow(10, n || 0) }, n.ExhibitionBillAuthorize = function (e) { var n = parent.SysSet.BillAutherizedList.toLowerCase().indexOf(parent.UserID) > -1, t = !1, i = parent.UserID, a = e.ResponsiblePerson === i || e.CreateUser === i; if (!a && !n) { var l = { RuleID: "Account,Admin", ResponsiblePerson: e.ResponsiblePerson }; g_api.ConnectLite(Service.opm, "GetExhibitionBillAuthorize", l, function (e) { t = !!e.RESULT && e.DATA.rel.indexOf(parent.UserID) > -1 }, {}, !1) } return a || t || n }, n.fnOpenAccountingArea = function (e, n) { (n.indexOf("Admin") > -1 || n.indexOf("Account") > -1 && e.length > 0) && (e.find("input").removeAttr("disabled"), e.find("select").removeAttr("disabled")) }, n.fnCalcuQuotationFee = function (n, t, i, a) { let l = "NTD" === i ? 0 : 2; e.each(t, function (t, i) { var o = n[t]; "TG,TE".indexOf(parent.OrgID) > -1 && (l = 0); let r = 0; e(o).find(".prepay").val() && (r = roundDecimal(parseFloat(e(o).find(".prepay").val().replaceAll(",", "")) * a, l)); let c = roundDecimal(parseFloat(e(o).find(".subtotal").val().replaceAll(",", "")) * a, l), s = roundDecimal(parseFloat(e(o).find(".taxtotal").val().replaceAll(",", "")) * a, l), f = c + s - r; e(i).find(".mprepay ").val(fMoney(r, l, "")), e(i).find(".msubtotal").val(fMoney(c, l, "")), e(i).find(".mtaxtotal").val(fMoney(s, l, "")), e(i).find(".mboxtotal").val(fMoney(f, l, "")) }) }, n.fnCalcuBillsFee = function (n, t, i, a, l) { let o = "NTD" === a ? 0 : 2; "TG,TE".indexOf(parent.OrgID) > -1 && (o = 0); let r = n.find(t), c = roundDecimal(parseFloat(e(r).find(".prepay").val().replaceAll(",", "")) * l, o), s = roundDecimal(parseFloat(e(r).find(".subtotal").val().replaceAll(",", "")) * l, o), f = roundDecimal(parseFloat(e(r).find(".taxtotal").val().replaceAll(",", "")) * l, o), d = s + f, u = d - c; n.find(i + " .mprepay").val(fMoney(c, o, "")), n.find(i + " .msubtotal").val(fMoney(s, o, "")), n.find(i + " .mtaxtotal").val(fMoney(f, o, "")), n.find(i + " .mboxtotal").val(fMoney(d, o, "")), n.find(i + " .mpaytotal").val(fMoney(u, o, "")) }, n.SetBillPrepayEvent = function (e, n) { e.find('[data-id="Advance"]').on("keyup blur", function (t) { var i = n.ExchangeRate || 1, a = parseFloat(("" === this.value ? "0" : this.value).replaceAll(",", "")), l = n.AmountTaxSum, o = l - a; e.find(".paytotal").val(fMoney(o, 2, n.Currency)), n.Advance = a, n.TotalReceivable = o; var r = a * i, c = l * i; e.find('[data-id="mAdvance"]').val(fMoney(r, 0, "NTD")), e.find(".mpaytotal").val(fMoney(c - r, 0, "NTD")) }), e.find('[data-id="mAdvance"]').on("keyup blur", function (t) { var i = n.ExchangeRate || 1, a = parseFloat(("" === this.value ? "0" : this.value).replaceAll(",", "")), l = parseFloat((n.AmountTaxSum || 0) * i); e.find(".mpaytotal").val(fMoney(l - a, 0, "NTD")); var o = a / i, r = n.AmountTaxSum - o; e.find('[data-id="Advance"]').val(fMoney(o, 2, n.Currency)), e.find(".paytotal").val(fMoney(r, 2, n.Currency)), n.Advance = o, n.TotalReceivable = r }) }, n.fnCheckMainOrForeignCurrency = function (e) { var n = !1; switch ("TE,TG".indexOf(parent.OrgID) > -1) { case !0: "NTD" === e && (n = !0); break; case !1: "CNY" !== e && "RMB" !== e || (n = !0) }return n } }(jQuery, window, document);
|