123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128 |
- var Bizgaze;
- (function (Bizgaze) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class Tax extends Unibase.Platform.Core.BaseComponent {
- constructor() {
- super(...arguments);
- this.BranchIds = [];
- this.Branchlist = [];
- this.taxcode = new Array();
- this.editbranches = "";
- this.selectedids = "";
- this.CodeIds = [0];
- this.branchidsarray = [];
- this.selectData = [];
- this.txt_EditLedgerName = "";
- this.txt_EditLedgerId = 0;
- }
- init(formpropertyid, prop, callback) {
- var instance = this;
- if (callback != null) {
- callback();
- }
- }
- loadControl(container, prop) {
- var html = '<div class="panel panel-default"><input type="hidden" id="taxcodes" value="" data-isdynamic="true" data-propdoctypename="" />' +
- '<input type="hidden" id="hdn_customcontrol" class="value-control" value="Bizgaze.Forms.Controls.Tax.Instance().getTaxes();">' +
- '<div id="divtaxdetails"><div class="item-row" ></div></div></div>' +
- '<div class="" style="padding-bottom:33px"> <div class="col-sm-12 ">' +
- '<div class="row lineheight wrapper-sm" style="border-bottom: 2px solid grey;"><div class="col-sm-4 min-padding">' +
- '<strong class="">Tax Code</strong></div>' +
- '<div class="col-sm-3 min-padding"><strong>Rate</strong></div>' +
- '<div class="col-sm-2 min-padding"><strong>Display Text</strong></div>' +
- '<div class="col-sm-3 min-padding"><strong>Display Percent</strong></div></div ></div></div>' +
- '<div class="panel-body "><div class="item-row added-row "></div></div></div>' +
- '<a href="javascript:;" class="default pull-left" title="Add Item" data-original-title="Add New Tax"><span class="pull-right btn" style="text-decoration:underline;color:deepskyblue"' +
- 'id = "btnTax" onclick="Bizgaze.Forms.Controls.Tax.Instance().AddTaxCodes();">Add Tax Codes</span></a><input type="hidden" id="hidden_selectedTaxCode"><input type="hidden" id="hidden_selectedAccountName"><input type="hidden" id="hidden_selected_AccountName">';
- $("#" + container).html(html);
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- }
- loadPropertySettings(propertysettings, formpropertyid, DocPropertyName) {
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- var instance = this;
- var taxid = Number(propval);
- instance.getTaxesDetails(taxid);
- }
- getTaxesDetails(id) {
- var instance = this;
- instance.fileCacheHelper.loadJsFile("apps/transact/managers/taxmanager/taxmanager.js", function () {
- Unibase.Apps.Transact.Managers.TaxManager.Instance().getTaxes(id).then(function (response) {
- instance.taxcode = [];
- var result = response.result;
- if (result.length != 0) {
- var parenttaxcodes = new Array();
- for (var i = 0; i < result.length; i++) {
- parenttaxcodes.push({ TaxCodeName: result[i].TaxCodeName, TaxId: result[i].TaxId, TaxCodeId: result[i].TaxCodeId });
- }
- for (var i = 0; i < result.length; i++) {
- var rowid = moment().valueOf();
- var data = result[i];
- instance.taxcode.push({
- taxid: data.TaxId,
- rate: data.Rate,
- displaytext: data.DisplayText,
- displaypercent: data.DisplayPercent,
- taxcodeid: data.TaxCodeId,
- taxcodename: data.TaxCodeName,
- applion: data.AmountPercent,
- parentid: data.ParentId,
- parentname: data.Parentname,
- ratetypeid: data.TaxRateTypeId,
- branchlist: instance.branchs,
- Accledgerid: data.LedgerId,
- Accledgername: data.LedgerName,
- isbranchwiseledger: data.IsBranchWiseLedger,
- TCSPANNoAvail: data.TCSPANNoAvail,
- FromDate: data.FromDate,
- ToDate: data.ToDate
- });
- instance.addtaxcode = instance.taxcode[i];
- instance.AddRow(instance.addtaxcode, rowid);
- instance.getTax(data.TaxId, i, rowid);
- if (parenttaxcodes != null) {
- var cmbparent = $('#ddl_Parent' + rowid);
- for (var j = 0; j < parenttaxcodes.length; j++) {
- if (parenttaxcodes[j].TaxId != result[i].TaxId)
- $('<option>').val(parenttaxcodes[j].TaxId).text(parenttaxcodes[j].TaxCodeName).appendTo(cmbparent);
- }
- $("#ddl_Parent" + rowid + " option[value='" + data.ParentId + "']").attr("selected", "selected");
- }
- }
- }
- });
- });
- }
- getTax(TaxId, index, rowid) {
- var instance = this;
- var branchledger = new Array();
- var branchdata;
- var items = [];
- instance.fileCacheHelper.loadJsFile("apps/transact/managers/taxmanager/taxmanager.js", function () {
- Unibase.Apps.Transact.Managers.TaxManager.Instance().getBranch(TaxId).then(function (response) {
- var res = response.result;
- for (var i = 0; i < res.length; i++) {
- var data = res[i];
- branchledger.push({
- branchwiseledgerid: data.BranchWiseLedgerId,
- branchid: data.BranchId,
- ledgerid: data.LedgerId,
- taxid: data.TaxId,
- branchname: data.BranchName,
- ledgername: data.LedgerName,
- updateguid: data.UpdateGuid
- });
- branchdata = branchledger[i];
- if (items.length != 0 && items.find(x => x.ledgerid == branchdata.ledgerid) != undefined) {
- var multipleExist = items.find(x => x.ledgerid == branchdata.ledgerid);
- multipleExist.branchname += '|' + branchdata.branchname;
- multipleExist.branchid += '|' + branchdata.branchid;
- multipleExist.branchwiseledgerid += '|' + branchdata.branchwiseledgerid;
- }
- else {
- items.push(branchdata);
- }
- }
- if (data != null)
- if (data.BranchId == 0) {
- instance.taxcode[index].Accledgersid = data.LedgerId;
- instance.taxcode[index].Accledgersname = data.LedgerName;
- $(".AccountName").val(data.LedgerId);
- $("#hf_branchwiseledger" + rowid).val(data.BranchWiseLedgerId);
- $("#hf_updateguid" + rowid).val(data.UpdateGuid);
- var AutocompleteaAC = new Option(data.LedgerName, data.LedgerId.toString(), true);
- $("#txt_AccountName" + rowid).append(AutocompleteaAC);
- $('#chK_PortalWiseLedger' + rowid).prop('checked', false);
- $(".PortalAccountName" + rowid).addClass('hidden');
- $('.portalacc' + rowid).addClass('hidden');
- $(".li_branches" + rowid).addClass('hidden');
- $("#txt_AccountName" + rowid).prop('disabled', false);
- $('#txt_AccountName' + rowid).addClass('required');
- }
- else {
- instance.AddPortalAccName(null, items, rowid);
- $('#chK_PortalWiseLedger' + rowid).prop('checked', true);
- $('#txt_AccountName' + rowid).removeClass('required');
- $(".PortalAccountName" + rowid).removeClass('hidden');
- $('.portalacc' + rowid).removeClass('hidden');
- $("#txt_AccountName" + rowid).prop('disabled', true);
- $(".li_branches" + rowid).removeClass('hidden');
- }
- });
- });
- }
- AddTaxCodes() {
- var instance = this;
- var rowid = moment().valueOf();
- var emptyRow = {
- taxid: 0,
- rate: "",
- displaytext: "",
- taxcodename: "",
- displaypercent: "",
- taxcodeid: 0,
- applion: "",
- parentid: 0,
- parentname: "",
- ratetypeid: 0,
- Accledgerid: 0,
- Accledgername: "",
- };
- $(".moreoptions").addClass("hidden");
- instance.AddRow(emptyRow, rowid);
- }
- AddRow(row, rowid) {
- var instance = this;
- var len = $('.item-row').length;
- var html = "";
- var lilen = $("#ul_brancheslist" + rowid).children().length;
- var fromdate = moment(row.FromDate).format('DD/MM/YYYY');
- var todate = moment(row.toDate).format('DD/MM/YYYY');
- html = '<div class="item-row divtax_' + rowid + ' added-row"id="div_' + rowid + '" style = "padding-bottom:10px">' +
- '<div class="row">' +
- '<input type="hidden" id="hf_taxid" class"taxesid' + rowid + '" value="' + row.taxid + '"/>' +
- '<div class="col-sm-4 min-padding input-group">' +
- '<span id="hf_taxgroupid' + rowid + '"></span>' +
- '<div class="no-border row bg-white">' +
- '<a class="closeTax h6 delete text-danger" id="CloseTax ' + rowid + '" href="javascript:;">' +
- '<i class="fa fa-trash-o delete" style="color:red" aria-hidden="true" id="CloseTax ' + rowid + '"></i></a>' +
- '</div>' +
- '<div class="col-sm-12 ml-10 mb-mt-4 taxess" style="border-bottom:0;" id="div_TaxCode">' +
- '<select style="width:100%" id="txt_TaxCode' + rowid + '" class="form-control selectedTaxCode floating-label-control required" data-isdynamic="false" placeholder="Tax Code" data-placeholder="Output CGST" data-label="Tax Code"></select>' +
- '<input type="hidden" id="hf_TaxCode' + rowid + '" class="taxgrouptaxcode" value="' + row.taxcodeid + '"/>' +
- '<label for="Validation" id="lblValidation_TaxCode"></label><input class="selectedTaxId" value="0" type="hidden"><input type="hidden" id="hfFormPropertyId"/>' +
- '<input type="hidden" id="hf_len" value="' + rowid + '">' +
- '<input type="hidden" id="hf_codelen" value="' + rowid + '">' +
- '<input type="hidden" id="OldCodeId' + rowid + '" value="' + row.taxcodeid + '">' +
- '</div>' +
- '</div>' +
- '<div class="col-sm-3 min-padding">' +
- '<div class="floating-label-form-group taxrate" id="div_Rate' + rowid + '">' +
- '<div class="input-group">' +
- '<input type="text" id="txt_Rate' + rowid + '" value="' + row.rate + '"class="form-control required taxRate floating-label-control" data-isdynamic="false" placeholder="Rate *" data-placeholder="Enter Rate" data-label="Rate *" />' +
- '<input type="hidden" id="hf_Rate" value=""><label for="Validation" id="lblValidation_Rate"></label><input type="hidden" id="hfFormPropertyId" />' +
- '<input type="hidden" id="hf_taxid" class"taxesid' + rowid + '" value = "' + row.taxid + '"/> ' +
- '</div></div></div>' +
- '<div class="col-sm-2 min-padding">' +
- '<div class="floating-label-form-group diplaytext" id="div_DisplayTextTwo">' +
- '<div class="input-group">' +
- '<input type="text" id="txt_DisplayTextTwo' + rowid + '" value= "' + row.displaytext + '" class="form-control txtDisplayTextTwo floating-label-control" data-isdynamic="false" placeholder="Display Text" data-placeholder="Enter Display Text" data-label="Display Text" /><input type="hidden" id="hfFormPropertyId" />' +
- '</div></div></div>' +
- '<div class="col-sm-3 text-right min-padding">' +
- '<div class="floating-label-form-group displaypercent" id="div_DisplayPercentTwo">' +
- '<div class="input-group">' +
- '<input type="text" id="txt_DisplayPercentTwo' + rowid + ' "value="' + row.displaypercent + '" class="form-control txtDisplayPercentTwo floating-label-control" data-isdynamic="false" placeholder="Display Percent" data-placeholder="Enter Display Percent" data-label="Display Percent" />' +
- '<input type="hidden" id="hf_DisplayPercentTwo" value=""><label for="Validation" id="lblValidation_DisplayPercentTwo"></label><input type="hidden" id="hfFormPropertyId" />' +
- '</div></div></div></div>' +
- '<div class="hidden moreoptions bg-light" id="div_moreoptions' + rowid + '">' +
- '<div class="row">' +
- '<div class="col-sm-4 ">' +
- '<div class="floating-label-form-group floating-label-form-group-with-value" id="div_AppliedOnPercent">' +
- '<label for="txt_AppliedOnPercent" id="lbl_AppliedOnPercent">Applied On %</label><div class="input-group">' +
- '<input type="text" id="txt_AppliedOnPercent' + rowid + '"value="' + 100 + '" class="form-control txtAppliedOnPercent floating-label-control" data-isdynamic="false" placeholder="Applied On %" data-placeholder="Applied On" data-label="Applied On %" /><input type="hidden" id="hf_AppliedOnPercent" value="">' +
- '<label for="Validation" id="lblValidation_AppliedOnPercent"></label>' +
- '<input type="hidden" id="hfFormPropertyId" />' +
- '</div></div></div>' +
- '<div class="col-sm-4 ">' +
- '<div class="floating-label-form-group floating-label-form-group-with-value focus" id="div_Parent">' +
- '<label for="ddl_Parent" id="lbl_Parent">Parent</label>' +
- '<select class="form-control ddlParent no-border" id="ddl_Parent' + rowid + '"">' +
- '<option value="">Select Parent Tax Code</option>' +
- '<option value="0">None</option>' +
- '</select > ' +
- '</div></div>' +
- '<div class="col-sm-4">' +
- '<div class="floating-label-form-group floating-label-form-group-with-value focus" id="div_RateType">' +
- '<label for="ddl_RateType" id="lbl_RateType">Rate Type</label>' +
- '<select class="form-control ddlRateType no-border" id="ddl_RateType' + rowid + '" value="' + row.ratetypeid + '">' +
- '<option value="1">Percent</option>' +
- '<option value="2">Flat</option></select>' +
- '</div></div></div>' +
- '<div class="" style="padding-bottom:10px"></div>' +
- '<div class="row">' +
- '<div class="control-group col-sm-4 "><div id="div_FromDate" class="CancelBtnFloating floating-label-form-group"><label for="eTax_txt_FromDate" id="lbl_FromDate">From Date</label>' +
- '<div class="input-group"><input type="text" id = "eTax_txt_FromDate' + rowid + '" class="dateselect_1 form-control value-control datepicker-input hasDatepicker floating-label-control" placeholder="From Date " data-placeholder="dd/mm/yyyy" data-label="From Date ">' +
- '<span class="input-group-addon mt-10"><i class="fa fa-calendar"></i></span><input type="hidden" id="hfId" value="">' +
- '<label for="Validation" id="lblValidation_FromDate"></label>' +
- '</div></div></div>' +
- '<div class="control-group col-sm-4 "><div id="div_ToDate" class="CancelBtnFloating floating-label-form-group"><label for="eTax_txt_ToDate" id="lbl_ToDate">To Date</label>' +
- '<div class="input-group"><input type="text" id = "eTax_txt_ToDate' + rowid + '" class="dateselect_1 form-control value-control datepicker-input hasDatepicker floating-label-control" placeholder="To Date " data-placeholder="dd/mm/yyyy" data-label="To Date ">' +
- '<span class="input-group-addon mt-10"><i class="fa fa-calendar"></i></span><input type="hidden" id="hfId" value="">' +
- '<label for="Validation" id="lblValidation_ToDate"></label>' +
- '</div></div></div>' +
- '<div class="col-sm-4" >' +
- '<label>PAN No.Available ? <span class="control-label" > </span></label >' +
- '<div class="input-group" >' +
- '<label class="switch" >' +
- '<input class="negativestock" id = "rbtntcspancust' + rowid + '" type = "checkbox" >' +
- '<span></span></label></div></div>' +
- '</div>' +
- '<div class="row">' +
- '<div class="col-sm-4">' +
- '<div class="floating-label" style="border-bottom:0;" id="div_AccountName">' +
- '<label for="txt_AccountName" id="lbl_AccountName">Account Name<span class="text-danger"> *</span></label>' +
- '<select style="width:100%" id="txt_AccountName' + rowid + '" value="' + row.Accledgername + '" class="form-control selectedAccountName floating-label-control" data-isdynamic="false" placeholder="Account Name *" data-placeholder="Select Account Name" data-label="Select Account Name" />' +
- '<input type="hidden" id="hf_AccountName' + rowid + '" class="AccountName" value="' + row.Accledgersid + '"/>' +
- '<label for="Validation" id="lblValidation_AccountName"></label>' +
- '<input type="hidden" id="hfFormPropertyId" />' +
- '</div>' +
- '</div>' +
- '<div class="col-sm-4">' +
- '<div class="div_PortalWiseLedger' + rowid + ' checkbox-primary" style="padding-top:40px;">' +
- '<input type="checkbox" class="css-checkbox" id="chK_PortalWiseLedger' + rowid + '">' +
- '<span class="" for="PortalwiseLedger"> Branch Wise Ledgers</span>' +
- '</div>' +
- '</div>' +
- '</div >' +
- '<input type="hidden" id="hf_branchlen' + rowid + '" value = "' + lilen + '"/> ' +
- '<div class="row PortalAccountName' + rowid + '" id="div_PortalAccountName' + rowid + '">' +
- '<div class=" col-sm-6 floating-label-form-group-with-value tax-manager-branch" id="PortalAccountName' + rowid + '">' +
- '<label for="txt_PortalNames">Branch Names</label>' +
- '<select style="width:100%" id="txt_PortalNames' + rowid + '"value="" class="no-border form-control txtPortalNames' + rowid + ' " IsTagSelect="false" multiple="multiple" placeholder="Branch Name" data-placeholder="Select Branch Name" data-label="Select Branch Name"></select>' +
- '<input type="hidden" id="hfPortalNames' + rowid + '" value = "0" class="form-control hf_BranchNames" />' +
- '</div>' +
- '<div class="col-sm-4">' +
- '<div class="floating-label" style="border-bottom:0;" id="divAccountName">' +
- '<label for="txtAccountName" id="lblAccountName">Account Name</label>' +
- '<select style="width:100%" id="txtAccountName' + rowid + '"value="" class="form-control selected_AccountName floating-label-control" data-isdynamic="false" placeholder="Account Name" data-placeholder="Select Account Name" data-label="Select Account Name" />' +
- '<input type="hidden" id="hfAccountName' + rowid + '" class="Account_Name"/>' +
- '<label for="Validation" id="lblValidation_AccountName"></label>' +
- '<input type="hidden" id="hfFormPropertyId' + rowid + '" />' +
- '<input type="hidden" id="hf_taxid" class="taxesid' + rowid + '" value = "' + row.taxid + '"/> ' +
- '<input type="hidden" id="hf_branchwiseledger' + rowid + '" class="branchwiseledgerid' + rowid + '" value = "' + row.branchwiseledgerid + '"/> ' +
- '<input type="hidden" id="hf_updateguid' + rowid + '" class="updateguid' + rowid + '" value = "' + row.updateguid + '"/> ' +
- '</div>' +
- '</div>' +
- '<div>' +
- '<div class="btn-group text-center text-white btn-group-justified mt-20">' +
- '<a class="btn btn-primary btn-block mt-15 ml-15" id="btnAddPortalWiseLedger' + rowid + '" onclick="Bizgaze.Forms.Controls.Tax.Instance().AddEmptyBranchrow(' + rowid + ',' + lilen + ')">+</a>' +
- '</div>' +
- '</div>' +
- '</div>' +
- '<div class="" style="padding-bottom:10px"></div>' +
- '<div class=div_branchlist' + rowid + '>' +
- '<ul id="ul_brancheslist' + rowid + '"class="list-group list-group no-radius BranchesList' + rowid + '">' +
- '<li id="li_portalacc' + rowid + '"class="list-group-item list-group-item-row taxportalacc portalacc' + rowid + ' col-sm-12 clear">' +
- '<span class="col-sm-5 pull-left pl-5">Branch Name</span>' +
- '<span class="col-sm-5 text-center pl-5">Account Name</span>' +
- '<span class="col-sm-1 pull-right" ></span>' +
- '</li>' +
- '</ul>' +
- '</div>' +
- '</div>' +
- '</div ></div > ';
- $(".item-row:last").after(html);
- $('.taxRate').keypress(function (event) {
- if ((event.which > 47 && event.which < 58) || (event.which == 37 || event.which == 124) || (event.which == 46)) {
- }
- else {
- event.preventDefault();
- }
- }).on('paste', function (event) {
- event.preventDefault();
- });
- $(".dateselect_1").daterangepicker({
- locale: {
- format: 'DD/MM/YYYY',
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- maxDate: new Date(2050, 11, 31)
- });
- $(".dateselect_1").parents(".floating-label-form-group").addClass("floating-label-form-group-with-value");
- var _fromdt = row.FromDate;
- if (row.FromDate == undefined) {
- _fromdt = Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate();
- }
- var _todt = row.ToDate;
- if (row.ToDate == undefined) {
- _todt = Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate();
- }
- var reffromdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(_fromdt, "DD/MM/YYYY");
- var reftodate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(_todt, "DD/MM/YYYY");
- $('#eTax_txt_FromDate' + rowid).val(reffromdate);
- $('#eTax_txt_ToDate' + rowid).val(reftodate);
- $('.txtAppliedOnPercent').keypress(function (event) {
- if ((event.which > 47 && event.which < 58) || (event.which == 37 || event.which == 124)) {
- }
- else {
- event.preventDefault();
- }
- }).on('paste', function (event) {
- event.preventDefault();
- });
- var element = $(".item-row:last");
- if (row.taxid > 0) {
- $("#txt_AppliedOnPercent" + rowid).text(100);
- $("#txt_AppliedOnPercent" + rowid).prop('disabled', true);
- $(".closeTax").addClass('hidden');
- var Autocompletetaxcode = new Option(row.taxcodename, row.taxcodeid.toString(), true);
- element.find("#txt_TaxCode" + rowid).append(Autocompletetaxcode);
- var AutocompleteledgrName = new Option(row.Accledgername, row.Accledgerid.toString(), true);
- $("#txt_AccountName" + rowid).append(AutocompleteledgrName);
- if (row.isbranchwiseledger == false) {
- $('#chK_PortalWiseLedger' + rowid).prop('checked', false);
- $("#div_PortalAccountName" + rowid).addClass('hidden');
- $(".div_branchlist" + rowid).addClass('hidden');
- }
- if (row.TCSPANNoAvail == true) {
- $('#rbtntcspancust' + rowid).prop('checked', true);
- }
- $("#ddl_RateType" + rowid + " option[value='" + row.ratetypeid + "']").attr("selected", "selected");
- $("#chK_PortalWiseLedger" + rowid).change(function () {
- if ($("#chK_PortalWiseLedger" + rowid).prop('checked') == true) {
- $("#div_PortalAccountName" + rowid).removeClass('hidden');
- $('.portalacc' + rowid).removeClass('hidden');
- $('#txt_AccountName' + rowid).removeClass('required');
- $("#txt_AccountName" + rowid).prop('disabled', true);
- $("#txt_AccountName" + rowid).text("");
- $(".li_branches" + rowid).removeClass('hidden');
- $("#txt_PortalNames" + rowid).addClass('required');
- }
- else {
- $("#div_PortalAccountName" + rowid).addClass('hidden');
- $('.portalacc' + rowid).addClass('hidden');
- $("#txt_AccountName" + rowid).prop('disabled', false);
- $(".li_branches" + rowid).addClass('hidden');
- $("#txt_AccountName" + rowid).text("");
- $("#txt_PortalNames" + rowid).removeClass('required');
- $('#txt_AccountName' + rowid).addClass('required');
- $(".li_branches" + rowid).text('');
- $(".li_branches" + rowid).val(0);
- $(".li_branches" + rowid).remove();
- }
- });
- }
- element.find(".taxRate").on('click', function () {
- if ($("#div_moreoptions" + rowid).hasClass("hidden")) {
- $("#div_moreoptions" + rowid).removeClass('hidden');
- }
- else {
- $("#div_moreoptions" + rowid).addClass('hidden');
- }
- });
- if (row.taxid == 0) {
- $("#txt_AppliedOnPercent" + rowid).text(100);
- $("#txt_AppliedOnPercent" + rowid).prop('disabled', true);
- $('#div_PortalAccountName' + rowid).addClass('hidden');
- $('.portalacc' + rowid).addClass('hidden');
- $('#txt_AccountName' + rowid).addClass('required');
- $("#chK_PortalWiseLedger" + rowid).change(function () {
- if ($("#chK_PortalWiseLedger" + rowid).prop('checked') == true) {
- $("#div_PortalAccountName" + rowid).removeClass('hidden');
- $('.portalacc' + rowid).removeClass('hidden');
- $('#txt_AccountName' + rowid).removeClass('required');
- $("#txt_AccountName" + rowid).prop('disabled', true);
- $("#txt_AccountName" + rowid).text("");
- $(".li_branches" + rowid).removeClass('hidden');
- $('#txtAccountName' + rowid).addClass('required');
- $("#txt_PortalNames" + rowid).addClass('required');
- }
- else {
- $("#div_PortalAccountName" + rowid).addClass('hidden');
- $('.portalacc' + rowid).addClass('hidden');
- $("#txt_AccountName" + rowid).prop('disabled', false);
- $('#txt_AccountName' + rowid).addClass('required');
- $(".li_branches" + rowid).addClass('hidden');
- $('#txtAccountName' + rowid).removeClass('required');
- $("#txt_PortalNames" + rowid).removeClass('required');
- $(".li_branches" + rowid).text('');
- $(".li_branches" + rowid).val(0);
- $(".li_branches" + rowid).remove();
- }
- });
- }
- instance.taxcodeautocomplete(element, rowid);
- instance.ledgerautocomplete(element, rowid);
- instance.ledgersautocomplete(element, rowid);
- instance.bind(element);
- instance.getbranches("", rowid);
- }
- getbranches(branchids, rowid) {
- var instance = this;
- var PostData = null;
- PostData = {
- bindedData: branchids,
- };
- if ($("#txt_Rate" + rowid).val() == 0 || $("#txt_Rate" + rowid).val() == "") {
- $("#hf_branchlen" + rowid).val("");
- var selectedids = "";
- }
- var userinfo = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
- var session = Unibase.Platform.Membership.Infos.Identity.getCurrentUser().sessionId;
- instance.fileCacheHelper.loadJsFile("apps/transact/managers/taxmanager/taxmanager.js", function () {
- Unibase.Apps.Transact.Managers.TaxManager.Instance().getAssignedBranches(PostData).then(function (response) {
- var Branches = [];
- var Ids = [];
- if (response.result[0].DisplayText != "No item found") {
- for (var i = 0; i < response.result.length; i++) {
- var lob = response.result[i];
- Branches.push({ id: lob.Value, text: lob.DisplayText });
- Ids.push(lob.Value);
- }
- }
- $("#txt_PortalNames" + rowid).select2({
- allowClear: true,
- placeholder: "Select Branch",
- data: Branches,
- ajax: {
- url: function (request) {
- var reqUrl = _appsettings.server_url() + "/apis/v4/bizgaze/crm/companies/branchautocomplete/";
- var term = request.term;
- reqUrl = reqUrl.replace('#', '');
- return reqUrl;
- },
- type: "POST",
- contentType: 'application/json',
- dataType: 'json',
- data: function (params) {
- var Participants = "";
- var ParticipantsCount = new Array();
- var Participant = $("#txt_PortalNames" + rowid).val().toString();
- if (Participant != "") {
- ParticipantsCount = Participant.split(',');
- for (var i = 0; i < ParticipantsCount.length; i++) {
- Participants += "|" + ParticipantsCount[i];
- }
- if (Participants != "")
- Participants += "|";
- }
- var branchesLength = $(".li_branches" + rowid).length;
- if (branchesLength > 0) {
- for (i = 1; i <= branchesLength; i++) {
- Participant = $(".li_branches" + rowid).find("#BrachId" + i).val().toString();
- if (Participant != "") {
- ParticipantsCount = Participant.split(',');
- for (var j = 0; j < ParticipantsCount.length; j++) {
- Participants += "|" + ParticipantsCount[j];
- }
- if (Participants != "")
- Participants += "|";
- }
- }
- }
- var Term = params.term != undefined ? params.term : "";
- var sessionid = session.replace('#', '');
- if ($("#txt_Rate" + rowid).val() != 0 || $("#txt_Rate" + rowid).val() != "") {
- if (instance.selectedids == "") {
- instance.selectedids = $("#hf_branchlen" + rowid).val().toString();
- }
- else {
- instance.selectedids = selectedids + ',' + $("#hf_branchlen" + rowid).val();
- }
- }
- var TaxId = $(".taxesid" + rowid).val();
- if (TaxId > 0) {
- Unibase.Apps.Transact.Managers.TaxManager.Instance().getBranch(TaxId).then(function (response) {
- var res = response[i].result;
- var editbranche = '';
- for (var i = 0; i < res.length; i++) {
- editbranche += res[i].BranchId + ',';
- }
- instance.editbranches = editbranche.slice(0, -1);
- });
- if (selectedids != "" && selectedids != undefined) {
- selectedids = selectedids.replace(/\|/g, ",");
- instance.editbranches += ',' + selectedids;
- }
- else {
- instance.editbranches;
- }
- }
- var ColumnNames = '';
- if ($(".taxesid" + rowid).val() == 0) {
- ColumnNames = selectedids;
- }
- else {
- ColumnNames = instance.editbranches;
- }
- var postDataObj = {
- DocPropertyId: 0,
- ColumnName: ColumnNames,
- FormPropertyId: 0,
- Value: "",
- bindedData: Participants,
- authToken: sessionid,
- term: Term,
- };
- return JSON.stringify(postDataObj);
- },
- beforeSend: function (xhr) {
- if (userinfo !== undefined && userinfo !== null) {
- xhr.setRequestHeader("Authorization", "Basic " + userinfo.sessionId);
- xhr.setRequestHeader('geoposition', userinfo.latd + ':' + userinfo.lgId);
- }
- },
- processResults: function (data) {
- if (data.result != null)
- data.result = JSON.parse(data.result);
- if (document.getElementsByClassName('li_branches' + rowid).length > 0) {
- $(".txtPortalNames" + rowid).removeClass('Active');
- }
- return {
- results: jQuery.map(data.result, function (item) {
- return {
- id: item.Value,
- text: item.DisplayText,
- addlInfo: item.addlData
- };
- })
- };
- },
- },
- escapeMarkup: function (m) {
- return m;
- },
- templateResult: function (item) { return item.text; },
- templateSelection: function (item) { return item.text; },
- });
- $("#txt_PortalNames" + rowid).on("select2:unselect", function (e) {
- var result = e.params.data;
- if (document.getElementsByClassName("Active").length <= 0) {
- if (Number(result.id) != 0) {
- instance.selectData.push({
- text: result.text,
- id: result.id
- });
- var Participants = "";
- var Participant = "";
- var ParticipantsCount = new Array();
- $(".txtPortalNames" + rowid).addClass('Active');
- var branchesLength = $(".li_branches" + rowid).length;
- if (branchesLength > 0) {
- for (i = 1; i <= branchesLength; i++) {
- Participant = $(".li_branches" + rowid).find("#BrachId" + i).val().toString();
- if (Participant != "") {
- ParticipantsCount = Participant.split(',');
- for (var j = 0; j < ParticipantsCount.length; j++) {
- if (result.id != ParticipantsCount[j])
- Participants += "," + ParticipantsCount[j];
- }
- if (Participants != "")
- Participants += ",";
- $(".li_branches" + rowid).find("#BrachId" + i).val(Participants);
- }
- }
- }
- }
- }
- });
- jQuery("#txt_PortalNames" + rowid).val(Ids).trigger('change');
- });
- });
- }
- AddEmptyBranchrow(rowid, lilen) {
- var instance = this;
- var updateguid;
- $(".div_branchlist" + rowid).removeClass('hidden');
- $(".txtPortalNames" + rowid).removeClass('Active');
- var branchid = $("#txt_PortalNames" + rowid).val().toString();
- var ledgerid = $("#hfAccountName" + rowid).val();
- if ((branchid == "" || branchid == "0" || branchid == "undefined" || branchid == null) && (ledgerid == "" || ledgerid == "0" || ledgerid == "undefined" || ledgerid == null)) {
- var errormsg = $(".bizgaze_FormErrorMessages").attr('id');
- $("#txt_PortalNames" + rowid).addClass('required');
- $('#txtAccountName' + rowid).addClass('required');
- MessageHelper.Instance().showError("Branch Name and Account Name cannot be empty", errormsg);
- return false;
- }
- if (branchid == "" || branchid == "0" || branchid == "undefined" || branchid == null) {
- var errormsg = $(".bizgaze_FormErrorMessages").attr('id');
- $("#txt_PortalNames" + rowid).addClass('required');
- MessageHelper.Instance().showError("Branch Name cannot be empty", errormsg);
- return false;
- }
- if (ledgerid == "" || ledgerid == "0" || ledgerid == "undefined" || ledgerid == null) {
- var errormsg = $(".bizgaze_FormErrorMessages").attr('id');
- $('#txtAccountName' + rowid).addClass('required');
- MessageHelper.Instance().showError("Account Name cannot be empty", errormsg);
- return false;
- }
- if (document.getElementsByClassName('li_branches' + rowid + ' Last_Checked ').length > 0) {
- if ($('.li_branches' + rowid).hasClass('Last_Checked')) {
- updateguid = $('#hf_updateguid' + rowid).val();
- }
- else {
- updateguid;
- }
- var branchid = $('#txt_PortalNames' + rowid).val().toString();
- var portalname = $.map($('#txt_PortalNames' + rowid + ' option:selected'), function (el, i) {
- return $(el).text();
- });
- var portals = $('.txtPortalNames' + rowid).text(portalname.join("|"));
- var Branchnames = portals[0].innerHTML;
- $("#hfAccountName" + rowid).val();
- var accountno = $("#txtAccountName" + rowid).val();
- var accountname = $('#txtAccountName' + rowid + ' option:selected').text();
- var a = document.getElementsByClassName('Last_Checked')[0].id;
- if ($(".taxesid" + rowid).val() == 0) {
- this.selectedids += ',' + branchid;
- }
- else {
- this.editbranches += ',' + branchid;
- }
- if (branchid != "" && accountno != 0) {
- $('#' + a).find(".Brachid").val(branchid);
- $('#' + a).find(".LedgerId").val(accountno);
- $('#' + a).find(".div_branchnames").text(Branchnames);
- $('#' + a).find(".div_ledgernames").text(accountname);
- }
- else {
- var errormsg = $(".bizgaze_FormErrorMessages").attr('id');
- MessageHelper.Instance().showError("Mandatory Fields are Missing", errormsg);
- return false;
- }
- $("#txt_PortalNames" + rowid).text('');
- $("#txtAccountName" + rowid).text('');
- $("#txt_PortalNames" + rowid).val(0);
- $("#txtAccountName" + rowid).val(0);
- $('#hf_updateguid' + rowid).val(updateguid);
- $('#' + a).removeClass('Last_Checked');
- }
- else {
- let lilen = $("#ul_brancheslist" + rowid).children().length;
- var emptyBranchRow = {
- taxid: 0,
- ledgerid: 0,
- ledgername: "",
- branchid: 0,
- branchname: "",
- branchwiseledgerid: 0,
- updateguid: ""
- };
- instance.AddPortalAccName(lilen, emptyBranchRow, rowid);
- }
- }
- AddPortalAccName(lilen, row, rowid) {
- $(".txtPortalNames" + rowid).removeClass('Active');
- var Html = "";
- if (row.taxid == 0) {
- row.branchid = $("#txt_PortalNames" + rowid).val().toString();
- row.ledgerid = $("#hfAccountName" + rowid).val();
- var portalname = $.map($('#txt_PortalNames' + rowid + ' option:selected'), function (el, i) {
- return $(el).text();
- });
- var portals = $('.txtPortalNames' + rowid).text(portalname.join("|"));
- if (row.branchid != "") {
- var Branchnames = portals[0].innerHTML;
- }
- var branchid = row.branchid;
- row.branchname = Branchnames;
- row.ledgername = $('#txtAccountName' + rowid + ' option:selected').text();
- row.branchwiseledgerid = $('#hf_branchwiseledger' + lilen).val();
- row.taxid = $('#hf_taxid').val();
- row.updateguid = $('#hf_updateguid' + rowid).val();
- Html = '<li class="list-group-item list-group-item-row li_branches' + rowid + '" id="li_branchledger_' + lilen + '_' + rowid + '">' +
- '<input type="hidden" id="hf_branchlen' + rowid + '" value = "' + branchid + '"/> ' +
- '<div class="row" id="div_Branchledger' + rowid + '" >' +
- '<input type="hidden" id="hf_row" value="' + rowid + '">' +
- '<input type="hidden" id="hf_taxid" class="taxesid' + rowid + '" value = "' + row.taxid + '"/> ' +
- '<input type="hidden" id="hf_updateguid ' + rowid + '" class="updateguid' + rowid + '" value = "' + row.updateguid + '"/> ' +
- '<input type="hidden" id="hf_branchwiseledger' + lilen + '" class="branchwiseledgerid' + lilen + '" value = "' + row.branchwiseledgerid + '"/> ' +
- '<input type="hidden" id="BrachId' + lilen + '" class="Brachid" value="' + row.branchid + '">' +
- '<input type="hidden" id="LedgerId' + lilen + '" class="LedgerId" value="' + row.ledgerid + '">' +
- '<div id="div_branchnames' + lilen + '"class="col-sm-5 pull-left div_branchnames branchnames' + rowid + 'div_branch' + lilen + '">' + row.branchname + '</div>' +
- '<div id="div_ledgernames' + lilen + '"class="col-sm-5 pull-right div_ledgernames ledgernames' + rowid + ' div_ledgernames' + lilen + '">' + row.ledgername + '</div>' +
- '<a id="liEdit" class="pl-10" style="text-decoration: underline;list-style: none; cursor: pointer; float: right; color: Blue;" onclick="Bizgaze.Forms.Controls.Tax.Instance().BranchWiseLedgerEdit(' + lilen + ',' + rowid + ',' + '\'' + row.updateguid + '\'' + ');">Edit</a>' +
- '</div></li>';
- $("#hf_branchlen" + rowid).val(branchid);
- if (row.ledgerid == "" || row.branchid == "") {
- var errormsg = $(".bizgaze_FormErrorMessages").attr('id');
- $('#txtAccountName' + rowid).addClass('required');
- $("#txt_PortalNames" + rowid).addClass('required');
- MessageHelper.Instance().showError("Mandatory Fields are Missing", errormsg);
- return false;
- }
- else {
- $(".txtPortalNames" + rowid).text("");
- $(".selected_AccountName").text("");
- $('.BranchesList' + rowid).append(Html);
- $('#txtAccountName' + rowid).removeClass('required');
- $("#txt_PortalNames" + rowid).removeClass('required');
- }
- }
- else {
- for (var i = 0; i < row.length; i++) {
- let lilen = $("#ul_brancheslist" + rowid).children().length;
- Html = '<li class="list-group-item list-group-item-row li_branches' + rowid + '" id="li_branchledger_' + lilen + '_' + rowid + '">' +
- '<input type="hidden" id="hf_branchlen' + rowid + '" value = "' + row[i].branchid + '"/> ' +
- '<div class="row" id="div_Branchledger' + rowid + '">' +
- '<input type="hidden" id="hf_row" value="' + rowid + '">' +
- '<input type="hidden" id="hf_taxid" class="taxesid' + rowid + '" value = "' + row[i].taxid + '"/> ' +
- '<input type="hidden" id="hf_updateguid' + rowid + '" class="updateguid' + rowid + '" value = "' + row[i].updateguid + '"/> ' +
- '<input type="hidden" id="hf_branchwiseledger' + lilen + '" class"branchwiseledgerid' + lilen + '" value = "' + row[i].branchwiseledgerid + '"/> ' +
- '<input type="hidden" id="BrachId' + lilen + '" class="Brachid" value="' + row[i].branchid + '">' +
- '<input type="hidden" id="LedgerId' + lilen + '" class="LedgerId" value="' + row[i].ledgerid + '">' +
- '<div id="div_branchnames' + lilen + '"class="col-sm-5 pull-left div_branchnames branchnames' + rowid + 'div_branch' + lilen + '">' + row[i].branchname + '</div>' +
- '<div id="div_ledgernames' + lilen + '"class="col-sm-5 pull-right div_ledgernames ledgernames' + rowid + ' div_ledgernames' + lilen + '">' + row[i].ledgername + '</div>' +
- '<a id="liEdit" class="pl-10" style="text-decoration: underline;list-style: none; cursor: pointer; float: right; color: Blue;" onclick="Bizgaze.Forms.Controls.Tax.Instance().BranchWiseLedgerEdit(' + lilen + ',' + rowid + ',' + '\'' + row[i].updateguid + '\'' + ');">Edit</a>' +
- '</div></li>';
- $("#hf_branchlen" + rowid).val(row[i].branchid);
- $("#hf_branchwiseledger" + lilen).val(row[i].branchwiseledgerid);
- if (row[i].branchid == "" || row[i].ledgerid == "") {
- var errormsg = $(".bizgaze_FormErrorMessages").attr('id');
- $(".txtPortalNames" + rowid).text();
- $(".selected_AccountName").text();
- $('.BranchesList' + rowid).append('');
- $('#txtAccountName' + rowid).addClass('required');
- $("#txt_PortalNames" + rowid).addClass('required');
- MessageHelper.Instance().showError("Mandatory Fields are Missing", errormsg);
- return false;
- }
- else {
- $(".txtPortalNames" + rowid).text("");
- $(".selected_AccountName").text("");
- $('.BranchesList' + rowid).append(Html);
- $('#txtAccountName' + rowid).removeClass('required');
- $("#txt_PortalNames" + rowid).removeClass('required');
- }
- }
- }
- this.BranchIds.push(row.branchid);
- }
- BranchWiseLedgerEdit(lilen, rowid, row) {
- var instance = this;
- var branchwiseledgerid = $('.branchwiseledgerid' + rowid).val();
- var updateguid = row;
- var ledgername;
- var ledgerid;
- var branchids;
- var branchnames;
- var editbranchwiseledgers;
- $('.Last_Checked').removeClass('Last_Checked');
- $('#li_branchledger_' + lilen + '_' + rowid).addClass("Last_Checked");
- if (updateguid != "undefined" || updateguid != 0) {
- ledgername = document.getElementsByClassName("ledgernames" + rowid + " div_ledgernames" + lilen + "")[0].textContent;
- }
- else {
- ledgername = $('#div_ledgernames' + lilen).text();
- }
- branchnames = document.getElementsByClassName("branchnames" + rowid + "div_branch" + lilen + "")[0].textContent;
- ledgerid = $('#LedgerId' + lilen).val();
- branchids = $('#li_branchledger_' + lilen + '_' + rowid).find("#BrachId" + lilen).val();
- editbranchwiseledgers = $('#li_branchledger_' + lilen + '_' + rowid).find("#hf_branchwiseledgerid" + lilen).val();
- var branchid = branchids.toString().replace(/,/g, '|');
- var Autocompleteledger = new Option(ledgername, ledgerid.toString(), true);
- if ($("#txtAccountName" + rowid + " option[value = '" + ledgerid.toString() + "']").length > 0) {
- }
- else
- $('#txtAccountName' + rowid).append(Autocompleteledger);
- $('#txtAccountName' + rowid).val(ledgerid).change();
- instance.branchids1 = branchid;
- instance.getbranches(branchid, rowid);
- }
- getTaxes() {
- var instance = this;
- var taxList = new Array();
- var lilen = 0;
- var isbranchchecked = 0;
- $(".item-row").each(function () {
- if ($(this).find(".taxgrouptaxcode").val() != undefined) {
- var errormsg = $(".bizgaze_FormErrorMessages").attr('id');
- var length = $(this).find("#hf_len").val();
- lilen = $("#ul_brancheslist" + length).children().length;
- if (($("#chK_PortalWiseLedger" + length).prop('checked') == true) && lilen < 2) {
- isbranchchecked = 1;
- MessageHelper.Instance().showError("Branch Name and Account Name is not added", errormsg);
- return false;
- }
- var brach = new Array();
- brach.push({
- BranchId: 0,
- LedgerId: 0,
- UpdateGuid: "",
- });
- var isbranchwiseledger = false;
- var tcspannoavail = false;
- var _datetimehelper = Unibase.Platform.Helpers.DateTimeHelper.Instance();
- var _fromdate = _datetimehelper.formatServerDate($("#eTax_txt_FromDate" + length).val());
- var _todate = _datetimehelper.formatServerDate($("#eTax_txt_ToDate" + length).val());
- if ($("#rbtntcspancust" + length).prop('checked') == true) {
- tcspannoavail = true;
- }
- if ($("#chK_PortalWiseLedger" + length).prop('checked') == true) {
- var ledgerid = $("#hfAccountName" + length).val();
- var ledgernames = $(".selected_AccountName" + length).text();
- brach = instance.BranchArraySave($(this), length);
- isbranchwiseledger = true;
- }
- else {
- var id1 = $(this).find('.AccountName').val();
- var ledgernames = $(this).find('.selectedAccountName').text();
- branchwiseledgerid = Number($(this).find('#hf_branchwiseledger' + length).val());
- updateguid = $(this).find('#hf_updateguid' + length).val();
- }
- var taxId = Number($(this).find("#hf_taxid").val());
- var Rate = Number($(this).find(".taxRate").val());
- var TaxCodeId = Number($(this).find(".taxgrouptaxcode").val());
- var taxCodeName = $(this).find(".selectedTaxCode").text();
- var DisplayText = $(this).find(".txtDisplayTextTwo").val();
- var DisplayPercent = $(this).find(".txtDisplayPercentTwo").val();
- var AmountPercent = Number($(this).find(".txtAppliedOnPercent").val());
- var Amountpercent = 100;
- var parentId = Number($(this).find(".ddlParent").val());
- var TaxRateType = Number($(this).find('.ddlRateType').val());
- var LedgerId = Number($(this).find('.AccountName').val());
- var branchwiseledgerid = $(this).find('#hf_branchwiseledger' + length).val();
- if (branchwiseledgerid == "undefined" || branchwiseledgerid == NaN) {
- branchwiseledgerid = 0;
- }
- else {
- branchwiseledgerid = Number(branchwiseledgerid);
- }
- var updateguid = $(this).find('#hf_updateguid' + length).val();
- if (taxCodeName != null) {
- taxList.push({
- TaxId: taxId, ParentId: parentId, TaxCodeId: TaxCodeId, TaxRateTypeId: TaxRateType,
- Rate: Rate, DisplayText: DisplayText, DisplayPercent: DisplayPercent, AmountPercent: Amountpercent,
- BranchList: brach,
- LedgerId: LedgerId,
- LedgerName: ledgernames,
- BranchWiseLedgerId: branchwiseledgerid,
- UpdateGuid: updateguid,
- IsBranchWiseLedger: isbranchwiseledger,
- TCSPANNoAvail: tcspannoavail,
- _FromDate: _fromdate,
- _ToDate: _todate,
- });
- }
- }
- });
- if (isbranchchecked == 1 && lilen < 2) {
- return false;
- }
- else
- return taxList;
- }
- BranchArraySave(element, len) {
- var BranchList = new Array();
- $('.div_branchlist' + len).each(function () {
- var line = 1;
- $(this).find('li').each(function () {
- var row = $("#hf_row").val();
- var Branches = $(this).find('.Brachid').val();
- if (Branches != undefined) {
- Branches = Branches.toString().replace(/\|/g, ",");
- Branches = Branches.toString().split(",");
- var branchwiseledgerid = $(this).find('#hf_branchwiseledger' + line).val();
- var Branchewiseledgers = branchwiseledgerid.toString().split("|");
- if (branchwiseledgerid == "undefined" || branchwiseledgerid == NaN || branchwiseledgerid == undefined) {
- branchwiseledgerid = 0;
- }
- for (var i = 0; i < Branches.length; i++) {
- if (Branchewiseledgers[i] == "undefined" || Number(Branchewiseledgers[i]) == NaN || Branchewiseledgers[i] == undefined) {
- Branchewiseledgers[i] = "0";
- }
- var BranchItem = {
- BranchId: Number(Branches[i]),
- LedgerId: Number($(this).find('.LedgerId').val()),
- UpdateGuid: $(this).find('#hf_updateguid' + len).val(),
- BranchWiseLedgerId: Number(Branchewiseledgers[i])
- };
- BranchList.push(BranchItem);
- }
- ;
- line += 1;
- }
- });
- });
- return BranchList;
- }
- bind(element) {
- var instance = this;
- element.find(".delete").on('click', function () {
- $(this).parents('.item-row:last').remove();
- instance.refreshtax();
- });
- }
- refreshtax() {
- var instance = this;
- var rowid = $('.item-row').length;
- var count = 0;
- $(".item-row").each(function () {
- if (count <= rowid) {
- $(instance).find('.taxs-row').text('Tax -' + count);
- $(instance).find("#div_moreoptions").attr('id', 'div_moreoptions' + count);
- $(instance).find(".a_ShowMore").attr('id', 'moreOptions' + count);
- $(instance).find(".ShowMore").attr('id', 'ShowMore_' + count);
- $(instance).find(".taxRate").attr('id', 'hf_Rate' + count);
- $(instance).find(".selectedTaxCode").attr('id', 'txt_TaxCode' + count);
- $(instance).find(".taxgrouptaxcode").attr('id', 'hf_TaxCode' + count);
- $(instance).find('.selectedAccountName').attr('id', 'txtAccountName' + count);
- $(instance).find('.AccountName').attr('id', 'hfAccountName' + count);
- $(instance).find('.selected_AccountName').attr('id', 'txt_AccountName' + count);
- $(instance).find('.Account_Name').attr('id', 'hf_AccountName' + count);
- $(instance).find('#txt_PortalNames').attr('id', 'txtPortalNames' + count);
- count += 1;
- }
- var element = $(instance);
- instance.taxcodeautocomplete(element, '');
- instance.ledgerautocomplete(element, '');
- instance.ledgersautocomplete(element, '');
- });
- }
- taxcodeautocomplete(element, len) {
- var instance = this;
- var txtTaxCode = element.find(".selectedTaxCode").attr('id');
- var hfTaxCode = element.find(".taxgrouptaxcode").attr('id');
- var id = 0;
- var url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/tax/gettaxcodesbystatusid';
- AutoCompleteHelper.getHelper().Create("#" + txtTaxCode, "#" + hfTaxCode, url, function (response) {
- var data = response;
- if (data.id == "0")
- data.text = "Select Tax Code";
- if (data.id == "-1" || data.id == -1)
- data.text = "Create New";
- if (data.text == "Create New") {
- $('#hidden_selectedTaxCode').val(txtTaxCode);
- var FormUniqueId = 'Bizgaze_Extension_Transact_Tax Code_App_Tax Code_CreateForm';
- var AppConfigurationUniqueId = 'Bizgaze_Extension_Transact_TaxCode_AppConfiguration_CreateTaxCode';
- var taxCodeId = 0;
- var taxCodeName = '';
- instance.length = len;
- $("#" + txtTaxCode).text('');
- $("#" + hfTaxCode).val(0);
- var successobj = {
- CallBack: function (id) {
- Unibase.Apps.Transact.Managers.TaxManager.Instance().getTaxCodeById(id).then(function (response) {
- var rowid = Bizgaze.Forms.Controls.Tax.Instance().length;
- Bizgaze.Forms.Controls.Tax.Instance().bindTaxCode(rowid, response.result.TaxCodeId, response.result.TaxCodeName);
- });
- },
- Parameters: null,
- };
- Unibase.Platform.Forms.Managers.FormManager.Instance().getFormbyUniqueId(FormUniqueId).then(function (response) {
- var FormId = response.result.FormId;
- var formviewerObj = {
- FormId: FormId,
- AppConfigurationId: 0,
- Pk_Value: 0,
- PortletWidgetId: 0,
- OnSuccess: successobj,
- OnFail: null,
- OnLoad: null,
- };
- Unibase.Platform.Forms.Components.FormViewer.instance.init(formviewerObj);
- });
- }
- });
- }
- bindTaxCode(rowid, taxcodeid, taxcodename) {
- var selectedOptions = new Option(taxcodename, taxcodeid, true);
- $("#txt_TaxCode" + rowid).append(selectedOptions).trigger('change');
- $("#txt_TaxCode" + rowid).val(taxcodeid);
- }
- bindLedger(rowid, ledgerid, ledgername) {
- var selectedOptions = new Option(ledgername, ledgerid, true);
- $("#txt_AccountName" + rowid).append(selectedOptions).trigger('change');
- $("#txt_AccountName" + rowid).val(ledgerid);
- }
- bindLedgers(rowid, ledgerid, ledgername) {
- var selectedOptions = new Option(ledgername, ledgerid, true);
- $("#txtAccountName" + rowid).append(selectedOptions).trigger('change');
- $("#txtAccountName" + rowid).val(ledgerid);
- }
- ledgerautocomplete(element, len) {
- var instance = this;
- var txtAccountName = element.find(".selectedAccountName").attr('id');
- var hfAccountName = element.find(".AccountName").attr('id');
- var url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/ledgers/ledgerautocomplete';
- AutoCompleteHelper.getHelper().Create("#" + txtAccountName, "#" + hfAccountName, url, function (response) {
- if (response.id == "-1" || response.id == -1)
- response.text = "Create New";
- if (response.text == "Create New") {
- $('#hidden_selectedAccountName').val(txtAccountName);
- var FormUniqueId = "Bizgaze_Extension_Transact_Ledgers_App_Ledgers_CreateForm";
- var AppConfigurationUnique = "Bizgaze_Extension_Transact_Ledgers_AppConfiguration_CreateLedgers";
- instance.length = len;
- $("#" + txtAccountName).text('');
- $("#" + hfAccountName).val(0);
- Unibase.Platform.Forms.Managers.FormManager.Instance().getFormbyUniqueId(FormUniqueId).then(function (response) {
- var FormId = response.result.FormId;
- var successobj = {
- CallBack: function (id) {
- Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().getLedgerById(id).then(function (response) {
- var rowid = Bizgaze.Forms.Controls.Tax.Instance().length;
- Bizgaze.Forms.Controls.Tax.Instance().bindLedger(rowid, response.result.LedgerId, response.result.LedgerName);
- });
- },
- Parameters: null,
- };
- instance.fileCacheHelper.loadJsFile("apps/transact/managers/ledgers/ledgermanager.js", function () {
- var formviewerObj = {
- FormId: response.result.FormId,
- AppConfigurationId: 0,
- Pk_Value: 0,
- PortletWidgetId: 0,
- OnSuccess: successobj,
- OnFail: null,
- OnLoad: null,
- };
- Unibase.Platform.Forms.Components.FormViewer.instance.init(formviewerObj);
- });
- });
- }
- });
- }
- ledgersautocomplete(element, len) {
- var instance = this;
- var id = 0;
- var txt_AccountName = element.find(".selected_AccountName").attr('id');
- var hf_AccountName = element.find(".Account_Name").attr('id');
- var txtTaxCode = element.find(".selectedTaxCode").attr('id');
- var hfTaxCode = element.find(".taxgrouptaxcode").attr('id');
- var url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/ledgers/ledgerautocomplete';
- AutoCompleteHelper.getHelper().Create("#" + txt_AccountName, "#" + hf_AccountName, url, function (response) {
- var data = response;
- if (data.id == "0")
- data.text = "Select Account Name";
- if (data.id == "-1" || data.id == -1)
- data.text = "Create New";
- if (data.text == "Create New") {
- $('#hidden_selectedTaxCode').val(txt_AccountName);
- var FormUniqueId = "Bizgaze_Extension_Transact_Ledgers_App_Ledgers_CreateForm";
- var AppConfigurationUnique = "Bizgaze_Extension_Transact_Ledgers_AppConfiguration_CreateLedgers";
- instance.length = len;
- $("#" + txt_AccountName).text('');
- $("#" + hf_AccountName).val(0);
- Unibase.Platform.Forms.Managers.FormManager.Instance().getFormbyUniqueId(FormUniqueId).then(function (response) {
- var FormId = response.result.FormId;
- var successobj = {
- CallBack: function (id) {
- Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().getLedgerById(id).then(function (response) {
- var rowid = Bizgaze.Forms.Controls.Tax.Instance().length;
- Bizgaze.Forms.Controls.Tax.Instance().bindLedgers(rowid, response.result.LedgerId, response.result.LedgerName);
- });
- },
- Parameters: null,
- };
- instance.fileCacheHelper.loadJsFile("apps/transact/managers/ledgers/ledgermanager.js", function () {
- var formviewerObj = {
- FormId: response.result.FormId,
- AppConfigurationId: 0,
- Pk_Value: 0,
- PortletWidgetId: 0,
- OnSuccess: successobj,
- OnFail: null,
- OnLoad: null,
- };
- Unibase.Platform.Forms.Components.FormViewer.instance.init(formviewerObj);
- });
- });
- }
- });
- }
- static Instance() {
- if (this._instance === undefined)
- this._instance = new Tax();
- return this._instance;
- }
- }
- Controls.Tax = Tax;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Bizgaze.Forms || (Bizgaze.Forms = {}));
- })(Bizgaze || (Bizgaze = {}));
|