123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700 |
- var _pagesize = 20;
- var pageIndex = 0;
- var subtotal = 0;
- var outbyvalue = 0;
- var reconciledata = [];
- var Bizgaze;
- (function (Bizgaze) {
- let Apps;
- (function (Apps) {
- let Transact;
- (function (Transact) {
- let Components;
- (function (Components) {
- class FindandMatch extends Unibase.Platform.Core.BaseComponent {
- constructor() {
- super(...arguments);
- this._idscount = 0;
- this._oldId = "";
- this._Unchkidscount = 0;
- this._checkidscount = 0;
- this._ContainerId = "";
- }
- cssFiles() {
- return ['tenants/themes/compact/css/coupons.css'];
- }
- jsFiles() {
- return ["platform/tag/managers/tagmanager.js",
- "platform/apps/managers/appmanager.js",
- "apps/transact/components/bankreconciliation/findandmatchreconciliation.js",
- "platform/analytics/components/reportviewer/reportviewer.js",
- "platform/analytics/components/templateviewer/templateviewer.js",
- "platform/analytics/components/reportviewer/linkreport.js"];
- }
- html(recdetailsid, containerid) {
- const instance = this;
- const ledgerCard = $(`#bankLedgerCard_${recdetailsid}`);
- const id = +ledgerCard.find('#hf_brsjournalid').val();
- instance.journalId = id;
- instance.ledgerid = +ledgerCard.find('#hf_brsledgerid').val();
- instance.bankamount = +ledgerCard.find('#hf_brsbankbalid').val();
- instance.ledgeramount = +ledgerCard.find('#hf_brsledgerbalid').val();
- instance.journalno = ledgerCard.find('#hf_brsjournalnumberid').val();
- instance.bankReconcileId = +ledgerCard.find('#hf_brsbankrecid').val();
- instance.reconciliationDetailsId = +ledgerCard.find('#hf_brsrecdetailsid').val();
- instance.accountname = ledgerCard.find('#hf_brsaccountname').val();
- instance.journaldate = ledgerCard.find('#hf_brsjournaldate').val();
- instance.action = ledgerCard.find('#hf_brsledgeractions').val();
- instance.recdetailsid = recdetailsid;
- subtotal = 0;
- outbyvalue = 0;
- reconciledata = [];
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._ContainerId = containerid;
- if (instance.action == "spent") {
- instance.bankamount = -1 * Number(instance.bankamount);
- }
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._Bankamount = instance.bankamount;
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/widgets/managers/interfaces/iwidgetmanager.js", null);
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/widgets/managers/widgetmanager.js", null);
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/core/helpers/propertyhelper/propertyhelper.js", null);
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/core/helpers/token/tokenhelper.js", null);
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/analytics/components/reportviewer/reportviewer.js", null);
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/analytics/components/reportviewer/_reportviewer.js", null);
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("tenants/themes/compact/js/navigation/navigationhelper.js", null);
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadCssFile("tenants/themes/compact/css/coupons.css", null);
- let html = `<div class="bg-white modal-header find-match-header pa-10 model_find_and_match_div"><strong class="text-dark">Find & Match</strong>
- </div>
- <div data-simplebar class="simple-scroll-bar modal-body find-match-body" id="CardViewer_modal_` + id + `">
- <span class="findandmatch_errormsg text-danger text-center" id="findandmatch_errormsg" ></span>
- <div class="row">
- <div class="cardbody rounded-4 col-6">
- <div class="div_TransactionReconciliation_` + id + `" id="div_TransactionReconciliation_` + id + `">
- <div id="div_TransactionReconciliation_details_` + id + `" class="card shadow-hover mb-0">
- <div class="card-header card-header-action border-bottom-0 px-20">
- <strong>
- <span class="biz-highlight-bg-color" id="hf-div_TransactionReconciliation_details_` + id + `">Transaction To Reconcile</span>
- </strong>
- </div>
- <div class="card-body py-0">
- <div class="row">
- <div class="col-md-12">
- <ul class="list-group list-group-flush px-0" id="div_TransactionReconciliation_details_` + id + `_col1">
- <li class="Twocolumn-listgroup-1-item Twocolumn-listgroup-1-addeditem li-0 px-0 py-2 detailProperty_` + id + ` widget_details_item` + id + `_col1" style="border-top: 1px solid rgb(243, 243, 243); font-size: 14px;">
- <div class="d-flex justify-content-between align-items-center">
- <span class="col-5 pl-0">` + instance.journalno + `</span>
- <span class="text-overflow text-right d-none d-md-block" title="ledgeramount">` + instance.ledgeramount + `</span>
- </div>
- </li>
- <li class="Twocolumn-listgroup-1-item Twocolumn-listgroup-1-addeditem li-1 px-0 py-2 detailProperty_` + id + ` widget_details_item` + id + `_col1" style="border-top: 1px solid rgb(243, 243, 243); font-size: 14px;">
- <div class="d-flex justify-content-between align-items-center">
- <span class="col-5 pl-0">` + instance.accountname + `</span>
- <span class="text-overflow text-right text-danger d-none d-md-block" title="Spent">` + instance.action + `</span>
- </div>
- </li>
- <li class="Twocolumn-listgroup-1-item Twocolumn-listgroup-1-addeditem li-1 px-0 py-2 detailProperty_` + id + ` widget_details_item` + id + `_col1" style="border-top: 1px solid rgb(243, 243, 243); font-size: 14px;">
- <div class="d-flex justify-content-between align-items-center">
- <span class="col-5 pl-0">` + instance.journaldate + `</span>
- <span class="text-overflow text-right text-danger d-none d-md-block" title="journaldate"></span>
- </div>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="cardbody rounded-4 col-6">
- <div class="div_SelectedTransaction_` + id + `" id="div_SelectedTransaction_` + id + `">
- <div id="div_details_SelectedTransaction_` + id + `" class="card shadow-hover mb-0">
- <div class="card-header card-header-action border-bottom-0 px-20">
- <strong>
- <span class="biz-highlight-bg-color" id="hf-SelectedTransaction_` + id + `">Selected Transaction</span>
- </strong>
- </div>
- <div class="card-body py-0">
- <div class="row">
- <div class="col-md-12">
- <ul class="list-group list-group-flush px-0" id="div_details_` + id + `_col1">
- <li class="Twocolumn-listgroup-1-item Twocolumn-listgroup-1-addeditem li-0 px-0 py-2 detailProperty_` + id + ` widget_details_item` + id + `_col1" style="border-top: 1px solid rgb(243, 243, 243); font-size: 14px;">
- <div class="d-flex justify-content-between align-items-center">
- <span class="col-5 pl-0">SubTotal</span>
- <span class="text-overflow text-right d-none d-md-block subtotal-Value" title="subtotal-Value" id="subtotal_` + id + `">` + 0 + `</span>
- </div>
- </li>
- <li class="Twocolumn-listgroup-1-item Twocolumn-listgroup-1-addeditem li-1 px-0 py-2 detailProperty_` + id + ` widget_details_item` + id + `_col1" style="border-top: 1px solid rgb(243, 243, 243); font-size: 14px;">
- <div class="d-flex justify-content-between align-items-center">
- <span class="col-5 pl-0">As Per Bank Statement</span>
- <span class="text-overflow text-right d-none d-md-block" title="Personnel Costs">` + instance.bankamount + `</span>
- </div>
- </li>
- <li class="Twocolumn-listgroup-1-item Twocolumn-listgroup-1-addeditem li-1 px-0 py-2 detailProperty_` + id + ` widget_details_item` + id + `_col1" style="border-top: 1px solid rgb(243, 243, 243); font-size: 14px;">
- <div class="d-flex justify-content-between align-items-center">
- <span class="col-5 pl-0">Total Is Out By</span>
- <span class="text-overflow text-right text-danger d-none d-md-block outbyvalue_amount" title="Personnel Costs" id="outbyvalue_` + id + `"></span>
- </div>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </br>
- <span class="spn_bankrecon_errormsg text-danger text-center" id="spn_cpnaprl_errormsg" ></span>
- <div class="card">
- <input type="text" id="txt_accountname_refno_Org_search" class="form-control text-control required" style="width:100%;" placeholder = "Search" data-placeholder="Search"/>
- <input type="hidden" id="hf_Coupon_Org_search" class="hf_txt_CouponSubmission_Org_search' form-control value-control" data-isdynamic="true"/>
- </div>
- <div class="card">
- <div class="table-wrap card simple-scroll-bar bg-white-s bg-white-removed templateviewer-body" style="height:100% !important">
- <div class="table-responsive tableFixHead dropdown-menu-scrollbar">
- <table class="table table-hover table-bordered mb-0 tblreconciledata" id="tblreconciledata">
- <thead>
- <tr>
- <th>Date</th>
- <th>Name</th>
- <th>Reference</th>
- <th>ChequeNo</th>
- <th>Spent</th>
- <th>Received</th>
- </tr>
- </thead>
- <tbody id="tblReconcile">
- <tr class="ReconciliationDetails-list-items"> </tr>
- </tbody>
- </table>
- </div>
- <div class="d-flex justify-content-center">
- <button class="btn btn-sm btn-outline-primary mt-15 mb-15 text-center btn_reconciliationlist_load_more__modal_bizgaze_BRS" id="btn_reconciliationlist_load_more__modal_bizgaze_BRS"><u>View All</u></button>
- </div>
- </div>
- </div></div>
- <div class="bg-white modal-footer find-match-footer pa-10">
- <a class="btn btn-light btn-sm btn-center mr-auto" id="btnClose">Close</a>
- <a class="btn btn-primary btn-center btn-sm text-white" id="btnSave">Save</a>
- <input type="hidden"id="bankreconciliationfromdate" />
- <input type="hidden"id="bankreconciliationtodate" />
- </div>`;
- return html;
- }
- load(recdetailsid, containerid, callback) {
- const instance = this;
- pageIndex = 0;
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._oldId = "";
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._idscount = 0;
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._Unchkidscount = 0;
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._checkidscount = 0;
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/ledgers/ledgermanager.js", function () {
- Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().getBankReconcileById(instance.bankReconcileId).then(function (response) {
- if (response.result != null) {
- $("#bankreconciliationfromdate").val(response.result.FromDate);
- $("#bankreconciliationtodate").val(response.result.ToDate);
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance().BankRecFromDate = response.result.FromDate;
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance().BankRecToDate = response.result.ToDate;
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance().getLedgerJournalEntryDetails(instance.ledgerid, 0, Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._Bankamount, instance.ledgeramount, null, containerid, instance.bankReconcileId, recdetailsid);
- }
- });
- });
- $('#btn_reconciliationlist_load_more__modal_bizgaze_BRS').click(function () {
- pageIndex++;
- var term = $("#txt_accountname_refno_Org_search").val();
- if (term == "" || term == null || term == undefined) {
- term = "null";
- }
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance().getLedgerJournalEntryDetails(instance.ledgerid, pageIndex, Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._Bankamount, instance.ledgeramount, term, containerid, instance.bankReconcileId, recdetailsid, true);
- });
- $("#btnClose").click(function () {
- instance.navigationHelper.closePopUp();
- });
- $("#txt_accountname_refno_Org_search").on("input", function () {
- var term = $(this).val();
- if (term == "" || term == null || term == undefined) {
- term = "null";
- }
- pageIndex = 0;
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._oldId = "";
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._idscount = 0;
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._Unchkidscount = 0;
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._checkidscount = 0;
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance().getLedgerJournalEntryDetails(instance.ledgerid, pageIndex, instance.bankamount, instance.ledgeramount, term, containerid, instance.bankReconcileId, recdetailsid);
- });
- $("#btnSave").click(function () {
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance().saveAllselectedReconcilition(containerid, instance.journalId, Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._Bankamount, reconciledata, instance.ledgerid);
- });
- }
- init() {
- }
- getFindAndMatchDetails(id) {
- var html = '';
- }
- getLedgerJournalEntryDetails(ledgerid, page, BankAmount, journalAmount, term, containerid, BankReconcileId, ReconciliationDetailsId, isViewAll) {
- if (ledgerid != 0) {
- var fromDate = "";
- var toDate = "";
- var cf_fromDate = Unibase.Platform.Helpers.NavigationHelper.commonFilter_FromDate;
- var cf_toDate = Unibase.Platform.Helpers.NavigationHelper.commonFilter_ToDate;
- let row = 0;
- if (cf_fromDate != null && cf_toDate != null) {
- fromDate = cf_fromDate.toString();
- toDate = cf_toDate.toString();
- }
- else {
- fromDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(new Date(Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate()), "YYYY/MM/DD");
- toDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(new Date(Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate()), "YYYY/MM/DD");
- }
- $(".ReconciliationDetails-list-items").remove();
- if (term !== "" && term !== "null") {
- $(".ReconciliationDetails-item-active").remove();
- }
- var Fdate = moment(fromDate).format("YYYY-MM-DD");
- var Tdate = moment(toDate).format("YYYY-MM-DD");
- var BRCFromDate = moment(Bizgaze.Apps.Transact.Components.FindandMatch.Instance().BankRecFromDate).format("YYYY-MM-DD");
- var BRCToDate = moment(Bizgaze.Apps.Transact.Components.FindandMatch.Instance().BankRecToDate).format("YYYY-MM-DD");
- BankAmount = BankAmount;
- journalAmount = journalAmount;
- var UpdateAmount = Number(journalAmount);
- var showPortalGroupWise = true;
- if (page == 0) {
- row = 5;
- }
- else {
- row = 0;
- }
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/ledgers/ledgermanager.js", function () {
- Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().getReconciliationData(ledgerid, BRCFromDate, BRCToDate, showPortalGroupWise, page, term, row).then(function (response) {
- if (page == 0) {
- $("#checkAll").prop('checked', false);
- }
- $("#btn_reconciliationlist_load_more__modal_bizgaze_BRS").addClass("hidden");
- var totalRecords = 0;
- $('._btnreconciliation_div').addClass('hidden');
- if (response.result._rows.length != 0) {
- $("#btn_reconciliationlist_load_more__modal_bizgaze_BRS").removeClass("hidden");
- var _datetimehelper = Unibase.Platform.Helpers.DateTimeHelper.Instance();
- var Stagestatusname = '';
- var finalhtml = '';
- totalRecords = response.result._totalRecords;
- if (row <= 5 && Number(totalRecords) <= 5) {
- $("#btn_reconciliationlist_load_more__modal_bizgaze_BRS").addClass("hidden");
- }
- if (row == 0 && Number(totalRecords) == 0) {
- $("#btn_reconciliationlist_load_more__modal_bizgaze_BRS").addClass("hidden");
- }
- for (var i = 0; i < response.result._rows.length; i++) {
- var data = response.result._rows[i];
- var JournalId = Number(data.Cells[0]);
- var JournalNo = data.Cells[1];
- var JournalDate = moment(data.Cells[2], "DD-MM-YYYY").format("DD/MM/YYYY");
- if (JournalDate == "Invalid date") {
- JournalDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().serverDateformat(data.Cells[2]);
- }
- var ChequeNo = data.Cells[3];
- var Credit = data.Cells[4];
- var Debit = data.Cells[5];
- var AccountName = "";
- var JournalStatusId = data.Cells[7];
- var LedgerID = Number(data.Cells[13]);
- var FirstLedgerID = Number(data.Cells[20]);
- var SecLedgerID = Number(data.Cells[21]);
- if (LedgerID == FirstLedgerID) {
- AccountName = data.Cells[14];
- }
- else if (LedgerID == SecLedgerID) {
- AccountName = data.Cells[9];
- }
- var JournalEntryID = data.Cells[19];
- var html = '';
- var index = Number(i);
- var j = Number(JournalId);
- html += '<tr class="ReconciliationDetails-list-items ReconciliationDetails-item-active value-row li-' + j + '">' +
- '<input type="hidden"id="recledgerid" value="' + JournalId + '" />' +
- '<input type="hidden"id="bankreconcileid" value="' + BankReconcileId + '" />' +
- '<input type="hidden"id="bankreconciliationdetailsid" value="' + ReconciliationDetailsId + '" />' +
- '<input type="hidden"id="JournalEntryId" value="' + JournalEntryID + '" />' +
- '<input type="hidden"id="bankbalanceamount" value="' + BankAmount + '" />' +
- '<input type="hidden"id="ledgerid" value="' + LedgerID + '" />';
- if (j == 0) {
- html += '<td id="JournalDate_"><div class="" > <input type="checkbox" id = "transactionDate_checkbox_" name = "transactionRadio" class="chkReconciliaionStatus " checked="checked" > <label class="custom-control-label" for= "transactionDate_checkbox_">' + JournalDate + '</label></div></td>';
- }
- else {
- html += '<td id="JournalDate_' + JournalId + '"><div class="" > <input type="checkbox" id = "transactionDate_checkbox_' + JournalId + '" name = "transactionRadio" class="chkReconciliaionStatus " > <label class="custom-control-label" for= "transactionDate_checkbox_' + JournalId + '" value=>' + JournalDate + '</label></div></td>';
- }
- html += '<td id="AccountName_' + JournalId + '">' + AccountName + '</td>' +
- '<td id="JournalNo_' + JournalId + '">' + JournalNo + '</td>' +
- '<td id="ChequeNo_' + JournalId + '">' + ChequeNo + '</td>' +
- '<td id="Credit_' + JournalId + '">' + Credit + '</td>' +
- '<input type="hidden"id="spentamount" value="' + Credit + '" />' +
- '<input type="hidden"id="receivedamount" value="' + Debit + '" />' +
- '<td id="Debit_' + JournalId + '">' + Debit + '</td>';
- html += '</tr>';
- $("#tblreconciledata tbody").append(html);
- }
- }
- if (isViewAll) {
- $("#btn_reconciliationlist_load_more__modal_bizgaze_BRS").addClass("hidden");
- }
- $('input:checkbox').click(function () {
- var id = $(this).attr('id');
- var element = $(this).closest("tr");
- var jid = $(element).find("#recledgerid").val();
- var isselected = $(element).find('.chkReconciliaionStatus').is(':checked');
- if (isselected == false) {
- $("#subtotal_" + Number(jid)).text("0");
- subtotal = 0;
- }
- var jId = $(element).find("#recledgerid").val();
- var LId = $(element).find("#ledgerid").val();
- var amount = 0;
- var Sp_amount = 0;
- var Rd_amount = 0;
- var spentamount = $(element).find("#spentamount").val();
- if (Number(spentamount) != 0) {
- var Credit = $("#Credit_" + jId).text();
- amount = -1 * Number(Credit);
- Sp_amount = amount;
- }
- var receivedamount = $(element).find("#receivedamount").val();
- if (Number(receivedamount) != 0) {
- var Debit = $("#Debit_" + jId).text();
- amount = Number(Debit);
- Rd_amount = Number(Debit);
- }
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance().savereconcile($(this).closest("tr"), amount, containerid, Number(Sp_amount), Number(Rd_amount));
- });
- });
- });
- }
- }
- savereconcile(element, selectedamount, containerid, SP_Amt, Rd_amt) {
- var Reconcile = new Array();
- var isSelected = $(element).find('.chkReconciliaionStatus').is(':checked');
- var reconcileno = 0;
- var journalId = $(element).find("#recledgerid").val();
- var LedgerId = $(element).find("#ledgerid").val();
- var bankreconcileid = $(element).find("#bankreconcileid").val();
- var bankreconciliationdetailsid = $(element).find("#bankreconciliationdetailsid").val();
- var bankamount = Number($(element).find("#bankbalanceamount").val());
- var JournalEntryId = $(element).find("#JournalEntryId").val();
- var todayDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate();
- var serverdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerLocalDate(todayDate, "DD/MM/YYYY");
- subtotal = Number(subtotal);
- if (isSelected) {
- reconcileno = 1;
- if (Number(SP_Amt) != 0) {
- subtotal = Number(subtotal) - (Number(selectedamount));
- bankamount = -1 * bankamount;
- }
- else if (Number(Rd_amt) != 0) {
- subtotal = Number(subtotal) + Number(selectedamount);
- bankamount = 1 * bankamount;
- }
- if (Number(bankamount) == Number(subtotal)) {
- $(".subtotal-Value").text(subtotal);
- outbyvalue = bankamount - subtotal;
- if (Number(outbyvalue == 0) && Number(SP_Amt) != 0) {
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._Bankamount = -1 * Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._Bankamount;
- }
- $(".outbyvalue_amount").text(outbyvalue);
- reconciledata.push({
- JournalId: journalId,
- ReconcileNo: reconcileno,
- ReconcileDate: serverdate,
- LedgerId: LedgerId,
- ReconciliationDetailsId: bankreconciliationdetailsid,
- BankReconcileId: bankreconcileid,
- JournalEntryId: JournalEntryId
- });
- }
- else {
- subtotal = 0;
- outbyvalue = 0;
- $(".subtotal-Value").text(subtotal);
- $(".outbyvalue_amount").text(outbyvalue);
- $("#subtotal_" + journalId).text(subtotal);
- $("#outbyvalue_" + journalId).text(outbyvalue);
- MessageHelper.Instance().showError('Please selected valid amount', 'findandmatch_errormsg');
- $(".chkReconciliaionStatus").prop('checked', false);
- $("#transactionDate_checkbox_" + journalId).prop('checked', false);
- if (Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._oldId != "") {
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._idscount = 1;
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._checkidscount = 0;
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance()._Unchkidscount = 0;
- }
- }
- }
- var postData = reconciledata;
- }
- confirmreconcile(id, containerid, ledgerid, bankamount, ledgeramount, journalno, accountname, journaldate, BankReconcileId, JournalentryId, ReconcileDetailsId) {
- if (Number(id) != 0 && Number(bankamount) == Number(ledgeramount)) {
- var journalId = Number(id);
- var LedgerId = Number(ledgerid);
- var bankreconciliationdetailsid = Number(ReconcileDetailsId);
- var bankreconcileid = Number(BankReconcileId);
- var JEntryId = Number(JournalentryId);
- var todayDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate();
- var serverdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerLocalDate(todayDate, "DD/MM/YYYY");
- var Reconcile = new Array();
- var reconcileno = 1;
- Reconcile.push({
- JournalId: journalId,
- ReconcileNo: reconcileno,
- ReconcileDate: serverdate,
- LedgerId: LedgerId,
- ReconciliationDetailsId: bankreconciliationdetailsid,
- BankReconcileId: bankreconcileid,
- JournalEntryId: JEntryId
- });
- var postData = Reconcile;
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/ledgers/ledgermanager.js", function () {
- Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().saveReconcile(postData).then(function (response) {
- if (response.result != null) {
- MessageHelper.Instance().showSuccess(response.message, '');
- $(`#reportRefreshBtn_${containerid}`).trigger('click');
- }
- else {
- MessageHelper.Instance().showError(response.message, 'findandmatch_errormsg');
- }
- });
- });
- }
- else {
- MessageHelper.Instance().showError("selected amount is (Bank Amount:" + Number(bankamount) + " Ledger Amount :" + Number(ledgeramount) + ") not matched go through the find and match or create new record", 'reconcile_errormsg');
- }
- }
- RefreshReportsAndWidgets(Portletwidgetid, cid, ledgerid) {
- Unibase.Platform.Widgets.Managers.WidgetManager.Instance().getPortletWidget(Portletwidgetid).then(function (widresponse) {
- if (widresponse.result != null) {
- var WidgetID = Number(widresponse.result.WidgetId);
- var portletwidgetid = Number(widresponse.result.PortletWidgetId);
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance().linkReport(WidgetID, portletwidgetid, cid, ledgerid);
- }
- });
- }
- confirm_And_Action_Hide_and_Show(id, containerid, ledgerid, bankamount, ledgeramount, journalno, accountname, journaldate, BankFormatId, action, Value) {
- if (Value.trim() == 'actions') {
- $(".div_subdata_" + id).removeClass("hidden");
- }
- else {
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance().confirmreconcile(id, containerid, ledgerid, bankamount, ledgeramount, journalno, accountname, journaldate, BankFormatId, 0, 0);
- }
- }
- linkReport(widgetid, portletwidgetid, cid, ledgerid) {
- var instance = this;
- Unibase.Platform.Widgets.Managers.WidgetManager.Instance().getKPIWidget(widgetid).then(function (response) {
- var res = response.result;
- if (res != null) {
- let containerid = cid;
- var rv_obj = Unibase.Platform.Analytics.Components.ReportViewer.Instance();
- let ReplaceText = [];
- ReplaceText.push({
- Key: "ledgerid",
- Value: String(ledgerid),
- ExpOp: Unibase.Platform.Core.Enums.ExpressionOperator.Equals,
- });
- instance.inputParameters = ReplaceText;
- var rv_obj = Unibase.Platform.Analytics.Components.ReportViewer.Instance();
- rv_obj.inputParameters = instance.inputParameters;
- Unibase.Platform.Analytics.Components.ReportViewer.Instance().getReportData(res.LinkReportId, containerid, null, null);
- }
- });
- }
- saveAllselectedReconcilition(containerid, journalId, bankamount, postData, LedgerId) {
- const instance = this;
- if (Number(bankamount) >= Number(subtotal)) {
- if (Number(bankamount) == Number(subtotal)) {
- $("#div_brs_" + journalId).addClass("hidden");
- MessageHelper.Instance().showSuccess("amount matched sucessfully", 'findandmatch_errormsg');
- subtotal = 0;
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/ledgers/ledgermanager.js", function () {
- Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().saveReconcile(postData).then(function (response) {
- if (response.result != null) {
- instance.navigationHelper.closePopUp();
- MessageHelper.Instance().showSuccess(response.message, '');
- const reconcileContainerId = instance.navigationHelper.getLastContainerId();
- $(`#reportRefreshBtn_${reconcileContainerId}`).trigger('click');
- }
- else {
- MessageHelper.Instance().showError(response.message, 'findandmatch_errormsg');
- }
- });
- });
- }
- else {
- alert("Amount Not Matched");
- }
- }
- else {
- MessageHelper.Instance().showError("Amount is greater than the bank amount", 'findandmatch_errormsg');
- }
- }
- _dynaminReportClose() {
- var detail_instance = Unibase.Themes.Compact.Components.Details.Instance();
- var containerid = $("._bizgaze_detail_container:visible").attr("id");
- var _installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
- var portletid = detail_instance.unibase_core_activeportletid;
- detail_instance.loadWidgets(_installedAppId, portletid, "#" + containerid + "");
- }
- ledgerreconcile(id, containerid, ledgerid, ledgeramount, journalno) {
- if (Number(id) != 0) {
- var journalId = Number(id);
- var LedgerId = Number(ledgerid);
- var ReconcileDate = $("#txt_RecconileDate_" + journalId).val();
- var JDate = $("#txt_JournalDate_" + journalId).val();
- var JournalDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerDate(JDate);
- var todayDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate();
- var serverdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerDate(ReconcileDate);
- var Reconcile = new Array();
- var reconcileno = 1;
- Reconcile.push({
- JournalId: journalId,
- ReconcileNo: reconcileno,
- ReconcileDate: serverdate,
- LedgerId: LedgerId,
- JournalEntryId: 0,
- JournalNo: journalno,
- JournalDate: JournalDate
- });
- var postData = Reconcile;
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/ledgers/ledgermanager.js", function () {
- Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().saveLedgerReconcile(postData).then(function (response) {
- if (response.result != null) {
- MessageHelper.Instance().showSuccess(response.message, 'findandmatch_errormsg');
- var cid = $('.' + containerid).attr("id");
- var _ReportUniqueid = "Reportid_" + cid;
- var _Reportid = $("#" + _ReportUniqueid).text();
- Unibase.Platform.Analytics.Managers.ReportManager.Instance().getReportById(Number(_Reportid)).then(function (refresponse) {
- if (refresponse.result != null) {
- Unibase.Platform.Analytics.Components.ReportViewer.Instance().getReportData(refresponse.result.ReportId, containerid, null, null);
- }
- });
- }
- else {
- MessageHelper.Instance().showError(response.message, 'findandmatch_errormsg');
- }
- });
- });
- }
- }
- getDateDetails(e, id) {
- e.stopPropagation();
- $("#txt_RecconileDate_" + id).daterangepicker({
- locale: {
- format: 'DD/MM/YYYY',
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- maxDate: new Date(2050, 11, 31)
- });
- }
- AutoReconcileByAllMatchedData() {
- var MatchedDate = [];
- $(".btn_BrsRecActions:not(#btn_Bankconfirm_0):visible").each(function (i, e) {
- MatchedDate.push($(e));
- });
- if (MatchedDate.length >= 1) {
- bootbox.confirm("Are you sure ! You want to reconcile all matched data ? ", function (result) {
- if (result) {
- var Reconcile = new Array();
- for (var i = 0; i < MatchedDate.length; i++) {
- var confirmdata = MatchedDate[i];
- var journalId = Number($(confirmdata).find('#hf_brsjournalid').val());
- var cId = $(confirmdata).find('#hf_brscid').val();
- var LedgerId = Number($(confirmdata).find('#hf_brsledgerid').val());
- var bankreconciliationdetailsid = Number($(confirmdata).find('#hf_brsrecdetailsid').val());
- var bankreconcileid = Number($(confirmdata).find('#hf_brsbankrecid').val());
- var bankamount = Number($(confirmdata).find('#hf_brsbankbalid').val());
- var ledgeramount = Number($(confirmdata).find('#hf_brsledgerbalid').val());
- var JEntryId = Number(0);
- var todayDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate();
- var serverdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerLocalDate(todayDate, "DD/MM/YYYY");
- var reconcileno = 1;
- if (Number(journalId) != 0 && Number(bankamount) == Number(ledgeramount)) {
- Reconcile.push({
- JournalId: journalId,
- ReconcileNo: reconcileno,
- ReconcileDate: serverdate,
- LedgerId: LedgerId,
- ReconciliationDetailsId: bankreconciliationdetailsid,
- BankReconcileId: bankreconcileid,
- JournalEntryId: JEntryId
- });
- }
- }
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/ledgers/ledgermanager.js", function () {
- Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().saveReconcile(Reconcile).then(function (response) {
- if (response.result != null) {
- MessageHelper.Instance().showSuccess(response.message, 'findandmatch_errormsg');
- var cid = $('.' + cId).attr("id");
- var number = cid.match(/\d+/);
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance().RefreshReportsAndWidgets(Number(number[0]), cid, LedgerId);
- }
- else {
- const containerId = $('._bizgaze_popup_container:visible').attr('id');
- $(`#div_errors_reportviewer_${containerId}`).addClass('form-error-message');
- MessageHelper.Instance().showError(response.message, `div_errors_reportviewer_${containerId}`);
- }
- });
- });
- }
- });
- }
- else {
- const containerId = $('._bizgaze_popup_container:visible').attr('id');
- $(`#div_errors_reportviewer_${containerId}`).addClass('form-error-message');
- MessageHelper.Instance().showError('matched records not found', `div_errors_reportviewer_${containerId}`);
- }
- }
- unReconcile(id, containerid, ledgerid, bankamount, ledgeramount, journalno, accountname, journaldate, BankReconcileId, JournalentryId, ReconcileDetailsId) {
- if (Number(JournalentryId) != 0) {
- var journalId = Number(id);
- var LedgerId = Number(ledgerid);
- var bankreconciliationdetailsid = Number(ReconcileDetailsId);
- var bankreconcileid = Number(BankReconcileId);
- var JEntryId = Number(JournalentryId);
- var todayDate = "0001-01-01 00:00:00";
- var serverdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerLocalDate(todayDate, "DD/MM/YYYY");
- var Reconcile = new Array();
- var reconcileno = 0;
- Reconcile.push({
- JournalId: journalId,
- ReconcileNo: reconcileno,
- ReconcileDate: serverdate,
- LedgerId: LedgerId,
- ReconciliationDetailsId: bankreconciliationdetailsid,
- BankReconcileId: bankreconcileid,
- JournalEntryId: JEntryId
- });
- var postData = Reconcile;
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/ledgers/ledgermanager.js", function () {
- Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().saveReconcile(postData).then(function (response) {
- if (response.result != null) {
- MessageHelper.Instance().showSuccess(response.message, 'findandmatch_errormsg');
- var cid = $('.' + containerid).attr("id");
- var number = cid.match(/\d+/);
- Bizgaze.Apps.Transact.Components.FindandMatch.Instance().RefreshReportsAndWidgets(Number(number[0]), cid, LedgerId);
- }
- else {
- MessageHelper.Instance().showError(response.message, 'findandmatch_errormsg');
- }
- });
- });
- }
- else {
- MessageHelper.Instance().showError("selected amount is (Bank Amount:" + Number(bankamount) + " Ledger Amount :" + Number(ledgeramount) + ") not matched go through the find and match or create new record", 'reconcile_errormsg');
- }
- }
- static Instance() {
- if (this._instance === undefined)
- this._instance = new FindandMatch();
- return this._instance;
- }
- }
- Components.FindandMatch = FindandMatch;
- })(Components = Transact.Components || (Transact.Components = {}));
- })(Transact = Apps.Transact || (Apps.Transact = {}));
- })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
- })(Bizgaze || (Bizgaze = {}));
|