var Bizgaze; (function (Bizgaze) { let Apps; (function (Apps) { let Transact; (function (Transact) { let Controls; (function (Controls) { class DcEditMrp extends Unibase.Platform.Core.BaseComponent { constructor() { super(...arguments); this.LoBId = 0; this.DcTypeId = 0; this.BranchId = 0; this.InventorySetting = 0; this.Ids = [0]; this.Type = ""; this.DcItemList = []; this.MrpSettingValue = ""; } init(formpropertyid, prop, callback) { var instance = this; instance.DcItemList = []; instance.Ids = [0]; instance.LoBId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_lobid").Value); instance.DcTypeId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_dctypeid").Value); instance.BranchId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_shipfromaddressid").Value); if (instance.DcTypeId == 1 || instance.DcTypeId == 3) { instance.BranchId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_shiptoaddressid").Value); } instance.fileCacheHelper.loadJsFile("apps/transact/managers/inventory/dcmanager.js", function () { instance.fileCacheHelper.loadJsFile("apps/transact/enums/enum.js", function () { instance.fileCacheHelper.loadJsFile("apps/transact/controls/pricelist/mrp.js", function () { instance.fileCacheHelper.loadJsFile("apps/transact/enums/enum.js", function () { instance.fileCacheHelper.loadJsFile("apps/transact/controls/inventory/dcitem.component.js", function () { instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId); }); }); }); }); }); } loadControl(containerid, prop) { let html = '
' + '
' + '
' + '
' + '' + '
' + '
' + '' + '
' + '
' + '
' + '
'; html += ''; $("#" + containerid).html(html); } loadControlSettings(controlsettingjson, formpropertyid) { var instance = this; instance.getLobSettings(instance.LoBId, instance.BranchId); $("#Splitchk_SplitPieces").on("click", function () { var Class = "Mrp-row"; if (DcEditMrp.instance.Type == "Batch") { Class = "Batch-row Batch-addedrow"; } var packs = Number(($("#hf_packs").val() == undefined) ? 0 : $("#hf_packs").val()); var pieces = Number(($("#hf_pieces").val() == undefined) ? 0 : $("#hf_pieces").val()); if ($("#Splitchk_SplitPieces").is(":checked")) { $("#hdr_value").text("Cartons/Pieces"); var html2 = '
' + '
' + '
' + '
'; } else { $("#hdr_value").text("Cartons"); var html2 = '
' + '
' + "" + '' + "" + '
'; } $('.SpiltCarton_Pieces_class_').html(html2); $('.SpiltCarton_Pieces_class_').find(".quantity_plus").unbind().click(function () { Bizgaze.Apps.Transact.Controls.DcEditMrp.Instance().plus($('.SpiltCarton_Pieces_class_')); }); $('.SpiltCarton_Pieces_class_').find(".quantity_minus").unbind().click(function () { Bizgaze.Apps.Transact.Controls.DcEditMrp.Instance().minus($('.SpiltCarton_Pieces_class_')); }); $('.SpiltCarton_Pieces_class_').find(".txtDC_PieceCount").unbind().click(function () { $("#hf_packs_onclick").val("0"); $("#hf_Pieces_onclick").val("1"); }); $('.SpiltCarton_Pieces_class_').find(".txtDC_CartonsCount").unbind().click(function () { $("#hf_packs_onclick").val("1"); $("#hf_Pieces_onclick").val("0"); }); }); $("#SplitchkEnableQuantity").on("click", function () { var Class = "Mrp-row"; if (DcEditMrp.instance.Type == "Batch") { Class = "Batch-row"; } var packs = Number(($("#hf_packs").val() == undefined) ? 0 : $("#hf_packs").val()); var pieces = Number(($("#hf_pieces").val() == undefined) ? 0 : $("#hf_pieces").val()); var Quantity = (Number($("#hf_PackCount").val()) * Number($("#hf_PackSize").val()) * packs) + (pieces * Number($("#hf_PackSize").val())); var html2 = '
' + '
' + '
' + ""; if ($("#SplitchkEnableQuantity").is(":checked")) { html2 += ''; } else { var Quantity = Number($("#txt_Quantity").val()); packs = (Quantity / (Number($("#hf_PackCount").val()) * Number($("#hf_PackSize").val()))); packs = packs == undefined ? 0 : packs; html2 += ''; } html2 += "" + '
'; $('.SpiltCarton_Pieces_class_').html(html2); if (Bizgaze.Apps.Transact.Controls.DcItem.Instance().IsWidget) { $("#txt_Cartons").prop('disabled', true); $("#txt_Quantity").prop('disabled', true); $("#txt_plus").addClass('hidden'); $("#txt_minus").addClass('hidden'); } $('.SpiltCarton_Pieces_class_').find(".quantity_plus").unbind().click(function () { Bizgaze.Apps.Transact.Controls.DcEditMrp.Instance().plus($('.SpiltCarton_Pieces_class_')); }); $('.SpiltCarton_Pieces_class_').find(".quantity_minus").unbind().click(function () { Bizgaze.Apps.Transact.Controls.DcEditMrp.Instance().minus($('.SpiltCarton_Pieces_class_')); }); }); var model = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1]; $("#" + model).find(".btn_Save_Form").click(function () { var MrpId = Number($("#select_" + instance.Type).val()); if (MrpId == 0) { MessageHelper.Instance().showError("Please Select MRP", 'div_ErrorMessage_' + Unibase.Platform.Forms.Components.FormViewer.instance.FormId); } }); } loadPropertySettings(propertysettings, formpropertyid, DocPropertyName) { return null; } bindEditFormDetails(formpropertyid, propval, DocPropertyName) { return null; } GetDcItem(DcItemId) { Bizgaze.Apps.Transact.Managers.DCManager.Instance().getDcItemsbyId(DcItemId).then(function (responce) { var dataRow = { ItemId: responce.result.ItemId, ItemName: responce.result.ItemName, PendingQty: 0, DcItemId: responce.result.DcItemId, DeliveredQty: responce.result.in_DeliveredQty, MrpId: responce.result.MrpId, Mrp: responce.result.Mrp, BatchId: responce.result.BatchId, BatchNo: responce.result.BatchNo, SKU: 0, OrderItemId: responce.result.OrderItemId, OldMRPId: 0, OldMRP: 0, Cartons: responce.result.Packs, Pieces: responce.result.Pieces, Quantity: responce.result.Quantity, DamagedQty: responce.result.DamagedQty, EnableMRP: responce.result.EnableMRP, EnableBatch: responce.result.EnableBatch, PackCount: responce.result.PackCount, PackSize: responce.result.PackSize, ParentId: responce.result.ParentId }; Bizgaze.Apps.Transact.Controls.DcEditMrp.instance.AddBatchMrpRow(dataRow); }); } AddBatchMrpRow(row) { var instance = this; var Class = ""; var MRP_hidden = "hidden"; Class = "Mrp-row Mrp-addedrow"; MRP_hidden = "hidden"; instance.Type = "MRP"; $("#ItemEnableType").text("MRP(Qnty)"); if (row.EnableBatch == true && instance.MrpSettingValue == "Batch/MRP") { Class = "Batch-row Batch-addedrow"; $("#ItemEnableType").text("Batch(Quantity)"); instance.Type = "Batch"; MRP_hidden = ""; } var html = '
' + '
  • ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '' + '' + '
    ' + '
    ' + '
    ' + '
    ' + '
    ' + '' + '
    ' + '
    ' + '
    ' + '
    ' + '
    '; if (Bizgaze.Apps.Transact.Controls.DcItem.Instance().IsWidget == true) { html += '
    More Info'; } html += '
  • '; $(".MRP-row:last").after(html); var Class = "Mrp-row"; if (DcEditMrp.instance.Type == "Batch") { Class = "Batch-row Batch-addedrow"; } var packs_val = Number(($("#hf_packs").val() == undefined) ? 0 : $("#hf_packs").val()); var pieces_val = Number(($("#hf_pieces").val() == undefined) ? 0 : $("#hf_pieces").val()); $("#hdr_value").text("Cartons/Pieces"); var html2 = '
    ' + '
    ' + '
    ' + '
    '; $('.SpiltCarton_Pieces_class1_').html(html2); $('.SpiltCarton_Pieces_class1_').find(".quantity_plus").unbind().click(function () { Bizgaze.Apps.Transact.Controls.DcEditMrp.Instance().plus($('.SpiltCarton_Pieces_class1_')); }); $('.SpiltCarton_Pieces_class1_').find(".quantity_minus").unbind().click(function () { Bizgaze.Apps.Transact.Controls.DcEditMrp.Instance().minus($('.SpiltCarton_Pieces_class1_')); }); $('.SpiltCarton_Pieces_class1_').find(".txtDC_PieceCount").unbind().click(function () { $("#hf_packs_onclick").val("0"); $("#hf_Pieces_onclick").val("1"); }); $('.SpiltCarton_Pieces_class1_').find(".txtDC_CartonsCount").unbind().click(function () { $("#hf_packs_onclick").val("1"); $("#hf_Pieces_onclick").val("0"); }); var Class = "Mrp-row"; if (DcEditMrp.instance.Type == "Batch") { Class = "Batch-row"; } var packs_val = Number(($("#hf_packs").val() == undefined) ? 0 : $("#hf_packs").val()); var pieces_val = Number(($("#hf_pieces").val() == undefined) ? 0 : $("#hf_pieces").val()); var Quantity_val = (Number($("#hf_PackCount").val()) * Number($("#hf_PackSize").val()) * packs_val) + (pieces_val * Number($("#hf_PackSize").val())); var html2 = '
    ' + '
    ' + '
    ' + ""; html2 += ''; html2 += "" + '
    '; $('.SpiltCarton_Pieces_class2_').html(html2); if (Bizgaze.Apps.Transact.Controls.DcItem.Instance().IsWidget) { $("#txt_Cartons").prop('disabled', true); $("#txt_Quantity").prop('disabled', true); $("#txt_plus").addClass('hidden'); $("#txt_minus").addClass('hidden'); } $('.SpiltCarton_Pieces_class2_').find(".quantity_plus").unbind().click(function () { Bizgaze.Apps.Transact.Controls.DcEditMrp.Instance().plus($('.SpiltCarton_Pieces_class2_')); }); $('.SpiltCarton_Pieces_class2_').find(".quantity_minus").unbind().click(function () { Bizgaze.Apps.Transact.Controls.DcEditMrp.Instance().minus($('.SpiltCarton_Pieces_class2_')); }); $(".SpiltCarton_Pieces_class2_").addClass("hidden"); $(".pieces_chck").click(function () { $(".SpiltCarton_Pieces_class2_").addClass("hidden"); $(".SpiltCarton_Pieces_class1_").removeClass("hidden"); }); $(".qnty_chck").click(function () { $(".SpiltCarton_Pieces_class2_").removeClass("hidden"); $(".SpiltCarton_Pieces_class1_").addClass("hidden"); }); var element = $("." + instance.Type + "-row:last"); Bizgaze.Apps.Transact.Controls.DcEditMrp.instance.LoadBatchandMrp(element, instance.Type, row.ItemId); $("#select_" + instance.Type).on("change", function () { let obj = []; obj.push({ ItemId: row.ItemId, element: null, }); if ($("#select_" + instance.Type + " option:selected").text() == 'Create MRP') { var itemobj = Bizgaze.Apps.Transact.Controls.MRP.Instance(); itemobj.DcEditMrp = true; Unibase.Platform.Helpers.NavigationHelper.Instance().popup(obj, "", itemobj, null, Unibase.Platform.Helpers.Size.DockLeft); } else if ($("#select_" + instance.Type + " option:selected").text() == 'Create Batch') { var item = Bizgaze.Apps.Transact.Controls.Batch.Instance(); Unibase.Platform.Helpers.NavigationHelper.Instance().popup(row.ItemId, "", item, null, Unibase.Platform.Helpers.Size.DockLeft); } }); var hiddenclass = ""; var disabled = ""; if (Bizgaze.Apps.Transact.Controls.DcItem.Instance().IsWidget == true) { hiddenclass = "hidden"; disabled = "disabled"; } if ($("#Splitchk_SplitPieces").is(":checked") || (row.Cartons != 0 && row.Pieces != 0 && instance.InventorySetting != Bizgaze.Apps.Transact.Enums.InventoryApplyType.Pieces)) { if (row.Pieces == "0") row.Pieces = ""; $("#Splitchk_SplitPieces").prop("checked", true); var html2 = '
    ' + '
    ' + '' + '
    ' + '
    ' + '' + '
    '; } else { var html2 = '
    ' + '
    ' + '
    ' + ""; if ($("#SplitchkEnableQuantity").is(":checked") == true || instance.InventorySetting == Bizgaze.Apps.Transact.Enums.InventoryApplyType.Quantity) { html2 += ''; html2 += ''; } else if (instance.InventorySetting == Bizgaze.Apps.Transact.Enums.InventoryApplyType.Pieces) { html2 += ''; html2 += ''; } else { html2 += ''; html2 += ''; } html2 += "" + '
    '; } if (instance.Type == "MRP" || (row.DcItemId != 0 && instance.Type == "")) { if (row.MrpId != 0 || row.DcItemId != 0) { $("#select_" + instance.Type).empty(); $('.hf_' + instance.Type + '_Id').val(row.MrpId); DcEditMrp.instance.Ids.push(row.MrpId); DcEditMrp.instance.getMrpQty('', row.MrpId, row.ItemId, DcEditMrp.instance.BranchId); DcEditMrp.instance.GetBatchandMRPQty(row.MrpId, row.Mrp, 0, instance.Type, row.ItemId); } } else if (instance.Type == "Batch" || row.DcItemId != 0) { if (row.BatchId != 0) { element.find(".select_" + instance.Type + "").empty(); element.find('.hf_' + instance.Type + '_Id').val(row.BatchId); element.find(".Batch_Mrp").val(row.Mrp); element.find(".hf_MRPId").val(row.MrpId); DcEditMrp.instance.Ids.push(row.BatchId); Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/controls/pricelist/managers/pricelistmanager.js", function () { Bizgaze.Apps.Transact.Managers.PriceListManager.Instance().getbatch(row.BatchId).then(function (result) { DcEditMrp.instance.GetBatchandMRPQty(row.MrpId, row.Mrp, 0, instance.Type, row.ItemId); }); }); } } $('.SpiltCarton_Pieces_class_').html(html2); $('.SpiltCarton_Pieces_class_').find("#txt_Cartons").blur(function () { }); $('.SpiltCarton_Pieces_class_').find("#txt_Quantity").blur(function () { }); var quantityelement = $('.SpiltCarton_Pieces_class_' + ':last'); $('.SpiltCarton_Pieces_class_').find(".quantity_minus").unbind().click(function () { Bizgaze.Apps.Transact.Controls.DcEditMrp.Instance().minus(quantityelement); }); $('.SpiltCarton_Pieces_class_').find(".quantity_plus").unbind().click(function () { Bizgaze.Apps.Transact.Controls.DcEditMrp.Instance().plus(quantityelement); }); if (row.ParentId != 0) { $("#txt_Quantity").attr('disabled', "true"); $("#txt_Pieces").attr('disabled', "true"); $("#txt_Cartons").attr('disabled', "true"); $("#span_minus").addClass("hidden"); $("#span_plus").addClass("hidden"); } } LoadBatchandMrp(element, Type, ItemId) { var instance = DcEditMrp.Instance(); var AutoText = $("#select_" + Type); var hdnAutoId = $(".hf_" + Type + "_Id"); var isClaim = false; if (instance.DcTypeId == Bizgaze.Apps.Transact.Enums.DcType.ClaimInward || instance.DcTypeId == Bizgaze.Apps.Transact.Enums.DcType.ClaimOutward) isClaim = true; var BranchId = instance.BranchId; var OrderType = "Sales"; var dctype = instance.DcTypeId; if (instance.DcTypeId == Bizgaze.Apps.Transact.Enums.DcType.Inward) { var OrderType = "Purchase"; } if ($("#hf_Exchange").val() == "true") { if (dctype == 1) dctype = 2; else if (dctype == 2) dctype = 1; if (OrderType == "Purchase") OrderType = "Sales"; else if (OrderType == "Sales") OrderType = "Purchase"; } var url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/pricelists/MrpsAutoComplete/itemid/' + ItemId + '/mrpids/' + DcEditMrp.instance.Ids.toString() + '/invoicetype/' + OrderType + '/dctype/' + dctype + '/branchid/' + BranchId + '/isinvoice/false'; if (Type == "Batch") { url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/pricelists/BatchAutoComplete/itemid/' + ItemId + '/ids/' + DcEditMrp.instance.Ids.toString() + '/invoicetype/' + OrderType + '/dctype/' + dctype + '/branchid/' + BranchId + '/isinvoice/false'; } var id = 0; AutoCompleteHelper.getHelper().Create(AutoText, hdnAutoId, url, function (response) { if (id != response.id) { id = response.id; if ($("#hfold_" + Type).val() != "") DcEditMrp.instance.Ids.splice(DcEditMrp.instance.Ids.findIndex(m => m == $("#hfold_" + Type).val()), 1); DcEditMrp.instance.Ids.push(id); $("#hfold_" + Type).val(response.id); $("#hf_" + Type + "_Id_").val(response.id); if (response.id != 0 && Type == "Batch") { DcEditMrp.instance.getMrp(response.id); } else { DcEditMrp.instance.getMrpQty(element, id, ItemId, BranchId); } } }); } getMrp(batchId) { Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/controls/pricelist/managers/pricelistmanager.js", function () { Bizgaze.Apps.Transact.Managers.PriceListManager.Instance().getbatch(batchId).then(function (result) { $(".Batch_Mrp").val(result.result.Mrp); $(".hf_MRPId").val(result.result.MrpId); }); }); } getMrpQty(element, id, ItemId, BranchId) { Bizgaze.Apps.Transact.Managers.DCManager.Instance().getMrpDcQty(ItemId, BranchId, id, false).then(function (responce) { $("#MRP_Qty").val(responce.result); }); } getDcItems() { var instance = this; instance.DcItemList = []; var MrpId = 0; var Mrp = 0; var BatchId = 0; var BatchNo = 0; if (instance.Type == "MRP") { MrpId = Number($("#select_" + instance.Type).val()); if (MrpId == 0) { MessageHelper.Instance().showError("Please Select MRP", 'div_ErrorMessage_' + Unibase.Platform.Forms.Components.FormViewer.instance.FormId); return false; } if (MrpId == -1) MrpId = 0; } else if (instance.Type == "Batch") { BatchId = Number($("#select_" + instance.Type).val()); BatchNo = $("#select_" + instance.Type + " option:selected").text(); Mrp = $(".Batch_Mrp").val(); MrpId = Number($(".hf_MRPId").val()); if (MrpId == -1) MrpId = 0; } var PackSize = Number($("#hf_PackSize").val()); var PackCount = Number($("#hf_PackCount").val()); var packs = Number($(".SpiltCarton_Pieces_class_").find("#txt_Cartons").val() == undefined ? 0 : $("#txt_Cartons").val()); var pieces = Number(($(".SpiltCarton_Pieces_class_").find("#txt_Pieces").val() == undefined) ? 0 : $("#txt_Pieces").val()); var Qty = (Number(PackCount) * Number(PackSize) * packs) + (pieces * Number(PackSize)); if (window.innerWidth < 992) { packs = Number($(".SpiltCarton_Pieces_class1_").find("#txt_Cartons").val() == undefined ? 0 : $(".SpiltCarton_Pieces_class1_").find("#txt_Cartons").val()); pieces = Number(($(".SpiltCarton_Pieces_class1_").find("#txt_Pieces").val() == undefined) ? 0 : $(".SpiltCarton_Pieces_class1_").find("#txt_Pieces").val()); Qty = (Number(PackCount) * Number(PackSize) * packs) + (pieces * Number(PackSize)); } if ($("#SplitchkEnableQuantity").is(":checked") || instance.InventorySetting == Bizgaze.Apps.Transact.Enums.InventoryApplyType.Quantity) { packs = (Number($(".SpiltCarton_Pieces_class_").find("#txt_Quantity").val()) / (Number(PackCount) * Number(PackSize))); pieces = Number(Number($(".SpiltCarton_Pieces_class_").find("#txt_Quantity").val()) - packs * Number(PackCount) * Number(PackSize)) / Number(PackSize); Qty = Number($("#txt_Quantity").val()); } if ($("#SplitchkEnableQuantity1").is(":checked") || instance.InventorySetting == Bizgaze.Apps.Transact.Enums.InventoryApplyType.Quantity) { if (window.innerWidth < 992) { packs = (Number($(".SpiltCarton_Pieces_class2_").find("#txt_Quantity").val()) / (Number(PackCount) * Number(PackSize))); pieces = Number(Number($(".SpiltCarton_Pieces_class2_").find("#txt_Quantity").val()) - packs * Number(PackCount) * Number(PackSize)) / Number(PackSize); Qty = Number($(".SpiltCarton_Pieces_class2_").find("#txt_Quantity").val()); } } instance.DcItemList.push({ DcId: Unibase.Themes.Providers.DetailHelper.recordId, DcItemId: Number($("#hf_DcItemId").val()), Packs: packs, Pieces: pieces, BatchId: BatchId, BatchNo: BatchNo, ItemId: Number($("#hf_ItemId").val()), DeliveredQty: Qty, OrderItemId: Number($("#hf_OrderItemId").val()), OrderId: Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_orderid").Value), OldDcItemId: 0, MrpId: MrpId, Quantity: Qty, Cartons: packs, AutoMRPAllocation: false, ExchangeDC: false, OldBranchId: instance.BranchId }); return instance.DcItemList; } plus(element) { if ($("#hf_packs_onclick").val() == "1" && $("#hf_Pieces_onclick").val() == "0") { var qtycount = Number(element.find(".txtDC_CartonsCount").val()); element.find(".txtDC_CartonsCount").val(qtycount + 1); } else if ($("#hf_packs_onclick").val() == "0" && $("#hf_Pieces_onclick").val() == "1") { var qtyPiece = Number(element.find(".txtDC_PieceCount").val()); element.find(".txtDC_PieceCount").val(qtyPiece + 1); } } minus(element) { if ($("#hf_packs_onclick").val() == "1" && $("#hf_Pieces_onclick").val() == "0") { var qtycount = Number(element.find(".txtDC_CartonsCount").val()); if (qtycount != 0) element.find(".txtDC_CartonsCount").val(qtycount - 1); } else if ($("#hf_packs_onclick").val() == "0" && $("#hf_Pieces_onclick").val() == "1") { var qtyPiece = Number(element.find(".txtDC_PieceCount").val()); if (qtyPiece != 0) element.find(".txtDC_PieceCount").val(qtyPiece - 1); } } GetBatchandMRPQty(MrpId, name, BatchId, Type, ItemId) { var url = 'apis/v4/bizgaze/transact/items/getitemavailability/itemid/' + ItemId + '/branchid/' + DcEditMrp.instance.BranchId + '/mrpid/' + MrpId; Bizgaze.Apps.Transact.Managers.DCManager.Instance().GetBatchandMRPQty(url).then(function (response) { var _name = ""; if (Type == "MRP" || Type == "") { _name = (response.result.Mrp) + ' (' + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(Number($("#MRP_Qty").val()), 2) + ')'; $("#select_" + Type).empty(); if (MrpId == 0) MrpId = -1; $("#select_" + Type).append(new Option(_name, MrpId)); $("#select_" + Type).val(MrpId).trigger("change"); $("#select_" + Type).val(MrpId); } else if (Type == "Batch") { _name = 'Batch No.(' + name + ')Qty' + '(' + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(Number(response.result.Quantity), 2) + ')'; $("#select_" + Type).append(new Option(_name, BatchId, true)); } }); } bindDetails(response) { var data = JSON.parse(response.result); if (DcEditMrp.instance.Type == "MRP") { $("#select_" + DcEditMrp.instance.Type).empty(); $("#select_" + DcEditMrp.instance.Type).append(new Option(data.Mrp + '(0)', data.MrpId, true)); $('.hf_Id' + DcEditMrp.instance.Type + '_Id').val(data.MrpId); } else if (DcEditMrp.instance.Type == "Batch") { $("#select_" + DcEditMrp.instance.Type).empty(); $("#select_" + DcEditMrp.instance.Type).append(new Option(data.BatchNo + '(0)', data.BatchId, true)); $('.hf_Id' + DcEditMrp.instance.Type + '_Id').val(data.BatchId); $(".Batch_Mrp").val(data.Mrp); $(".hf_MRPId").val(data.MrpId); } } getLobSettings(LobId, BranchId) { var _instance = this; Bizgaze.Apps.Transact.Managers.DCManager.Instance().getLobSettings(LobId, BranchId, _instance.DcTypeId).then(function (responce) { if (responce.result != null) { if (responce.result.InventoryApplyType != null && responce.result.InventoryApplyType != undefined) { _instance.InventorySetting = responce.result.InventoryApplyType; if (_instance.InventorySetting == Bizgaze.Apps.Transact.Enums.InventoryApplyType.Quantity) { $(".div_SplitchkPieces").addClass("hidden"); $(".div_SplitchkQuantity").addClass("hidden"); } else if (_instance.InventorySetting == Bizgaze.Apps.Transact.Enums.InventoryApplyType.Pieces) { $(".div_SplitchkPieces").addClass("hidden"); $(".div_chkPacks").removeClass("hidden"); } else { $(".div_SplitchkPieces").removeClass("hidden"); $(".div_SplitchkQuantity").removeClass("hidden"); } } _instance.MrpSettingValue = responce.result.ItemType; _instance.GetDcItem($("#hf_pk_value").val()); } }); } static Instance() { if (this.instance === undefined) { this.instance = new DcEditMrp(); } return this.instance; } } Controls.DcEditMrp = DcEditMrp; })(Controls = Transact.Controls || (Transact.Controls = {})); })(Transact = Apps.Transact || (Apps.Transact = {})); })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {})); })(Bizgaze || (Bizgaze = {}));