123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- var Bizgaze;
- (function (Bizgaze) {
- let Apps;
- (function (Apps) {
- let Transact;
- (function (Transact) {
- let Controls;
- (function (Controls) {
- class InvoiceAmount extends Unibase.Platform.Core.BaseComponent {
- init(formpropertyid, prop, callback) {
- var instance = InvoiceAmount.Instance();
- instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
- instance.loadPropertySettings(prop.PropertySettings, prop.FormPropertyId);
- }
- loadControl(containerid, prop) {
- var html = "<div class='col-xs-2 text-right hidden'><strong><span id='grosstotal' class='text-primary'>0.00</span></strong></div><div class='row form-group'><div class='col-sm-6'><span class='pull-left'>Total Qty</span><span class='pull-right' id='totalinvoiceqty'>0.00</span></div><div class='col-sm-6'><span class='pull-left'>Sub Total</span><span class='pull-right' id='subtotal'>0.00</span></div></div> <div class='row form-group'><div class='col-sm-6'> <span class='pull-left'> Discount On Items</span><span class='pull-right' id='totalItemDiscount'>0.00</span></div> <div class='col-sm-6'> <span class='pull-left'>Tax</span><span class='pull-right' id='totalTax'>0.00</span></div></div> <div class='row col-sm-12 form-group hidden'><div class='col-sm-6'></div><div class='col-sm-4 pull-left col-xs-6'>TDS</div><div class='col-sm-2 col-xs-6'><span class='pull-right'>0.00</span></div></div> <div class=''><div class='netdiscount-row hidden'></div><div class='expense-row hidden'></div></div> <div class='row py-2'><div class='col-sm-6'><a id='addNetDiscount' class='btn btn-outline-primary mb-2' title='Add Discount'><span class='px-1'><i class='la la-plus'></i></span><span>Add Coupon</span></a><span> </span><a id='addExpense' class='btn btn-outline-primary mb-2' title='Add Expense'><span class='px-1'><i class='la la-plus'></i></span><span>Add Expense</span></a></div><div class='col-sm-4 col-xs-6 hidden'>Expenses</div><div class='col-sm-2 col-xs-6 hidden'><span class='pull-right'>0.00</span></div></div> <div class='row'><div class='col-sm-3 div_IsAutoAdjustment mt-30'><input type='checkbox' id='chk_AutoAdjustment' class='css-checkbox'><label for='chk_AutoAdjustment' class='css-label text-sm pa-10'>Adjustment</label></div><div class='col-sm-6 col-lg-5 div_AdjustmentAccount '><div class='floating-label-form-group-with-value'><label id='lbl_AdjustmentAccountId' for='lbl_AdjustmentAccountId'>Account Name<span class='span_AdjustmentAccountName text-danger'> *</span></label><div class='input-group'><select id='txt_AdjustmentAccountName' class='form-control text-control select2-hidden-accessible txt_Account' style='width: 100%;' data-placeholder='Select' data-label='Account Name' placeholder='Select'><option value='0'></option></select><input type='hidden' id='hf_AdjustmentAccountId' value='0'></div></div></div><div class='col-sm-3 col-lg-4 mt-20'><div class='col-sm-8 floating-label-form-group input-group pull-left'><input type='text' placeholder='0.00' id='txt_Adjustment' class='form-control floating-label-control text-center text-right' value='0.00' /></div><div class='pt-10 pull-right'><span class=' mt-10' id='span_Adjustment'>0.00</span></div></div></div><div class='row col-sm-12 divWalletAmountContainer hidden'><a id='txt_Wallet' title='Wallet Details' class='default pull-left' href='' data-toggle='modal' data-original-title='Wallet'><span class='pull-left' style='text-decoration:underline;color:cornflowerblue' id='btn_Wallet'>Wallet- <strong><small id='WalletAmount'></small></strong></span></a></div> <div class='col-sm-12 WalletItems mt-10 collapse' style='border: 1px;border-style:groove;'><div id='tbl_WalletItems' class='col-sm-12'></div></div>";
- $("#" + containerid).html(html);
- $('#txt_Adjustment').prop("disabled", false);
- $('#txt_Adjustment').keypress(function (event) {
- if ((event.which > 47 && event.which < 58) || (event.which == 46 || event.which == 8) || (event.which == 45)) {
- }
- else {
- event.preventDefault();
- }
- }).on('paste', function (event) {
- event.preventDefault();
- });
- $('#txt_Adjustment').blur(function () {
- if ($('#chk_AutoAdjustment').prop("checked") == false) {
- $('.hdn_adjustment').val($('#txt_Adjustment').val());
- if (Number($('#txt_Adjustment').val()) != 0) {
- $('.span_AdjustmentAccountName').removeClass('hidden');
- }
- else {
- $('.span_AdjustmentAccountName').addClass('hidden');
- }
- Controls.InvoiceItem.Instance().update_total();
- Controls.InvoiceItem.Instance().TotalAdjustment();
- }
- });
- var instance = this;
- instance.loadAccounts();
- $('#chk_AutoAdjustment').prop("checked", true);
- $(".hdn_autoadjustment").val("true");
- $('#txt_Adjustment').prop("disabled", true);
- $('#chk_AutoAdjustment').change(function () {
- if ($('#chk_AutoAdjustment').is(':checked')) {
- $('.span_AdjustmentAccountName').removeClass('hidden');
- $('#txt_Adjustment').prop("disabled", true);
- Controls.InvoiceItem.Instance().update_total();
- Controls.InvoiceItem.Instance().TotalAdjustment();
- $(".hdn_autoadjustment").val("true");
- }
- else {
- $("#txt_Adjustment").val(0);
- $("#txt_Adjustment").blur();
- $(".hdn_adjustment").val(0);
- $('.span_AdjustmentAccountName').addClass('hidden');
- $('#txt_Adjustment').prop("disabled", false);
- $(".hdn_autoadjustment").val("false");
- }
- });
- $("#addNetDiscount").off().click(function () {
- let lobid = $(".hfAutoCompleteId_lobid").val();
- if (lobid == undefined || lobid == "" || lobid == "0") {
- MessageHelper.Instance().showError("Please Select LoB", $("#form-container-" + $("#hf_FormId").val()).find(".bizgaze_FormErrorMessages").attr('id'));
- return false;
- }
- else {
- Controls.InvoiceItem.Instance().addNetDiscountRow();
- $(".netdiscount-row:last").find(".netdiscount-name").find("input:text").focus();
- }
- });
- $("#addExpense").off().click(function () {
- ;
- let lobid = $(".hfAutoCompleteId_lobid").val();
- if (lobid == undefined || lobid == "" || lobid == "0") {
- MessageHelper.Instance().showError("Please Select LoB", $("#form-container-" + $("#hf_FormId").val()).find(".bizgaze_FormErrorMessages").attr('id'));
- return false;
- }
- else {
- Controls.InvoiceItem.Instance().addExpenseRow(null, "", "", true);
- $(".expense-row:last").find(".expense-name").find("input:text").focus();
- }
- });
- if ($(".hdn_invoicetypeid").val() == "3" || $(".hdn_invoicetypeid").val() == "4" || $(".hdn_invoicetypeid").val() == "6" || $(".hdn_invoicetypeid").val() == "7") {
- $("#addNetDiscount").addClass("hidden");
- }
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return null;
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- if (propertysettings != null) {
- for (var i = 0; i < propertysettings.length; i++) {
- var data = propertysettings[i];
- if (data.ControlPropertyName == "MaxLength") {
- $("#txt_" + formpropertyid).attr("MaxLength", data.ControlPropertyValue);
- }
- }
- }
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- throw new Error("Method not implemented.");
- }
- loadAccounts() {
- var instance = this;
- var url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/ledgers/ledgerautocomplete';
- AutoCompleteHelper.getHelper().Create("#txt_AdjustmentAccountName", "#hf_AdjustmentAccountId", url, null);
- $("#txt_AdjustmentAccountName").on('select2:select', function (e) {
- instance.LedgerAccountChange();
- });
- }
- LedgerAccountChange() {
- var instance = this;
- var url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/ledgers/ledgerautocomplete';
- AutoCompleteHelper.getHelper().Create("#txt_AdjustmentAccountName", "#hf_AdjustmentAccountId", url, function (response) {
- debugger;
- var accountId = 0;
- var accountName = "";
- var controlId = "";
- var hiddenFieldControlId = "";
- accountId = Number(response.id);
- accountName = response.text;
- controlId = "#txt_AdjustmentAccountName";
- hiddenFieldControlId = "#hf_AdjustmentAccountId";
- if (accountId == 0)
- accountName = "Select Account";
- if (accountId == 1 || accountId == -1)
- accountName = "Create New";
- if (accountName == "Create New") {
- $("#txt_AdjustmentAccountName").val(null).trigger("change");
- var FormUniqueId = "Bizgaze_Extension_Transact_Ledgers_App_Ledgers_CreateForm";
- var AppConfigurationUnique = "Bizgaze_Extension_Transact_Ledgers_AppConfiguration_CreateLedgers";
- Unibase.Platform.Forms.Managers.FormManager.Instance().getFormbyUniqueId(FormUniqueId).then(function (response) {
- var obj = {
- controlid: controlId,
- hiddenid: hiddenFieldControlId
- };
- var successobj = {
- CallBack: function (id, obj) {
- Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().getLedgerById(id).then(function (response) {
- var createdLedger = new Option(response.result.LedgerName, response.result.LedgerId, true);
- $(obj.controlid + " option").remove();
- $(obj.controlid).append(createdLedger).trigger('change');
- $(obj.hiddenid).val(response.result.LedgerId);
- });
- },
- Parameters: obj,
- };
- var formviewerObj = {
- FormId: response.result.FormId,
- AppConfigurationId: 0,
- Pk_Value: 0,
- PortletWidgetId: 0,
- OnSuccess: successobj,
- OnFail: null,
- OnLoad: null,
- };
- instance.fileCacheHelper.loadJsFile("apps/transact/managers/ledgers/ledgermanager.js", function () {
- instance.fileCacheHelper.loadJsFile("platform/forms/components/formviewer/formviewer.js", function () {
- Unibase.Platform.Forms.Components.FormViewer.instance.init(formviewerObj);
- setTimeout(function () {
- $("#btn_CloseForm_" + response.result.FormId).click(function () {
- $("#txt_AdjustmentAccountName").val(null).trigger("change");
- });
- }, 1000);
- });
- });
- });
- }
- });
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new InvoiceAmount();
- }
- return this.instance;
- }
- }
- Controls.InvoiceAmount = InvoiceAmount;
- })(Controls = Transact.Controls || (Transact.Controls = {}));
- })(Transact = Apps.Transact || (Apps.Transact = {}));
- })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
- })(Bizgaze || (Bizgaze = {}));
|