var Bizgaze; (function (Bizgaze) { let Apps; (function (Apps) { let Transact; (function (Transact) { let Components; (function (Components) { let Invoices; (function (Invoices) { class InvoiceItemDetails extends Unibase.Platform.Core.BaseComponent { jsFiles() { return ['apps/transact/managers/invoicemanager.js', 'tenants/themes/compact/components/details/details.js', 'platform/core/helpers/numberhelper/numberhelper.js']; } cssFiles() { return []; } html() { let html = '
MRP
Qty
Unit Price
Disc.
Total
'; return html; } load(id, container) { $("#btn_InvoiceItemDetails_Close").click(function () { InvoiceItemDetails.Instance().navigationHelper.closePopUp(); }); } InvoiceItemDetails(InvoiceId, ItemId) { Bizgaze.Apps.Transact.Managers.InvoiceManager.Instance().getinvoiceitems(InvoiceId, ItemId).then(function (response) { if (response.result != null) { $(".InvoiceItemName").text(response.result[0].ItemName + " - " + response.result[0].ItemSKU); for (var i = 0; i < response.result.length; i++) { var row = response.result[i]; var activeDiscText = ""; var discValue = 0; var activeDiscPercent = ""; var activeDiscVal = ""; if (row.DiscountPercent > 0) { discValue = row.DiscountPercent; activeDiscPercent = "active"; activeDiscText = "%"; } else { discValue = row.DiscountAmount; activeDiscVal = "active"; activeDiscText = "Val"; } var html = '
' + '
' + '
' + '
' + '
' + '' + '
' + '
' + '
' + '' + '
' + '
' + '
' + '' + '
' + '
' + '
' + '
' + '' + '' + '
' + '' + '
' + '
' + '
' + '

' + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(row.RowTotal, 2) + '

'; $(".div_InvoiceItem_Details:last").after(html); let element = $(".div_InvoiceItem_Details:last"); element.find(".btn_item_DiscType option[value='" + activeDiscText + "']").prop("selected", true); if (row.BatchId != 0) { Bizgaze.Apps.Transact.Managers.InvoiceManager.Instance().getBatchByBatchId(row.BatchId).then(function (res) { if (res.result != null) { element.find('.txt_Mrp').val(res.result.Mrp); } }); } else if (row.MrpId != 0) { Bizgaze.Apps.Transact.Managers.InvoiceManager.Instance().getMrpById(row.MrpId).then(function (res) { if (res.result != null) { element.find('.txt_Mrp').val(res.result.Mrp); } }); } } } }); } static Instance() { if (this.instance === undefined) { this.instance = new Bizgaze.Apps.Transact.Components.Invoices.InvoiceItemDetails(); } return this.instance; } } Invoices.InvoiceItemDetails = InvoiceItemDetails; })(Invoices = Components.Invoices || (Components.Invoices = {})); })(Components = Transact.Components || (Transact.Components = {})); })(Transact = Apps.Transact || (Apps.Transact = {})); })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {})); })(Bizgaze || (Bizgaze = {}));