!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 ? '
  • ' : "
  • ") + n.BillNO + "
  • " }), 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: '
    ', 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("", { 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("