123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408 |
- var Bizgaze;
- (function (Bizgaze) {
- let Apps;
- (function (Apps) {
- let Integrations;
- (function (Integrations) {
- let GST;
- (function (GST) {
- let Components;
- (function (Components) {
- class GSTSubmission extends Unibase.Platform.Core.BaseComponent {
- jsFiles() {
- return ['apps/integrations/gst/managers/gstmanager.js'];
- }
- cssFiles() {
- return [];
- }
- html() {
- const html = `<div id="gst_Otp" class="modal fade hide"><div class="modal-dialog"><div class="modal-content"><div class="modal-header mt-2 mb-2"><h5 class="modal-title pull-left">OTP</h5><button type="button" class="close pull-right" data-dismiss="modal" aria-hidden="true">×</button></div><div class="modal-body" id="div_modalbody"><div class="mb-10"><p class="lbl_Otp">Please Enter The OTP</p></div><div class="floating-label-form-group mb-2"><input class="form-control" id="txt_Otp" placeholder="Enter OTP" type="text"></div></div><div class="modal-footer mb-2" style="display:block"><button type="button" onclick="" class="btn btn-primary pull-right" id="btn_VerifyOtp">Ok</button></div></div></div></div>`;
- $("#_bizgaze_modal").append(html);
- $(".bootbox-input").keypress(function (e) {
- if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
- MessageHelper.Instance().showSuccess("Numbers only allowed", 'div_validationsummary');
- return false;
- }
- });
- return html;
- }
- load() {
- }
- saveHSNGSTRtoGSTPortal(taxclassificationId, gstNo, InvoiceTypeId) {
- var instance = this;
- let containerId = "#" + Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1];
- let b2bCheckboxes = $(containerId).find('input.b2binvoices');
- var invoiceids = $(containerId).find('.b2binvoices:checkbox:checked').map(function () {
- return $(this).val();
- }).get();
- console.log(invoiceids);
- $(containerId).find("#selectedinvoices_check").click(function () {
- var checkBoxes = b2bCheckboxes.find('input.b2binvoices');
- checkBoxes.prop("checked", !checkBoxes.prop("checked"));
- });
- b2bCheckboxes.click(function () {
- if (!$(this).is(':checked')) {
- $("#selectedinvoices_check").prop('checked', false);
- }
- else if (b2bCheckboxes.is(":checked")) {
- $("#selectedinvoices_check").prop('checked', true);
- }
- });
- bootbox.prompt("Please Enter OTP", function (result) {
- if (result) {
- instance._saveHSNGSTRtoGSTPortal(taxclassificationId, result, gstNo, InvoiceTypeId);
- $(".bootbox-input").keypress(function (e) {
- if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
- MessageHelper.Instance().showSuccess("Numbers Only Allowed", 'div_validationsummary');
- return false;
- }
- });
- }
- });
- }
- _saveHSNGSTRtoGSTPortal(taxclassificationId, otp, gstNo, InvoiceTypeId) {
- var gstIntegratorId = 0;
- var instance = this;
- var integratorId = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_gstintegratorid").Value;
- var returnPeriod = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_returnperiod").Value;
- var fromDate = moment(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_fromdate").Value).format("YYYY-MM-DD");
- var toDate = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_todate").Value;
- var formattedfromDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerDate(toDate);
- toDate = moment(formattedfromDate).format("YYYY-MM-DD");
- var gstNo = [];
- $('.invoiceschk_selected:checked').each(function () {
- var isChecked = $(this).prop("checked");
- if (isChecked) {
- gstNo.push($(this).parents('.body-tr').find(".fromgstno").text());
- }
- });
- gstNo = gstNo.filter((value, index) => gstNo.indexOf(value) == index).toString();
- var rdmNo = moment.utc(new Date()).local().format("YYYYMMDDHHmmss");
- const rates = $('.invoiceschk_selected:checkbox:checked').map(function () {
- return $(this).closest('.body-tr').find('.gst-rate').text();
- }).get();
- const supplytype = $('.invoiceschk_selected:checkbox:checked').map(function () {
- return $(this).closest('.body-tr').find('.gst-supplytype').text();
- }).get();
- const pos = $('.invoiceschk_selected:checkbox:checked').map(function () {
- return $(this).closest('.body-tr').find('.gst-pos').text();
- }).get();
- const hsnCodes = $('.invoiceschk_selected:checkbox:checked').map(function () {
- return $(this).closest('.body-tr').find('.gst-hsncodes').text();
- }).get();
- const Uom = $('.invoiceschk_selected:checkbox:checked').map(function () {
- return $(this).closest('.body-tr').find('.gst-uom').text();
- }).get();
- var dynamicfilters = [{}];
- var OTP = otp.replace(' ', '');
- var taxClassificationData = [{
- TaxclassificationId: taxclassificationId,
- InvoiceId: [0],
- Rates: rates,
- SupplyType: supplytype,
- Pos: pos,
- HSNCodes: hsnCodes,
- InvoiceTypeId: InvoiceTypeId,
- UoM: Uom
- }];
- var postData = {
- TaxClassificationData: taxClassificationData,
- RtPeriod: returnPeriod,
- GSTIntegratorId: integratorId,
- ToDate: toDate,
- FromDate: fromDate,
- InvoiceTypeId: 1,
- GstNo: gstNo,
- Otp: OTP
- };
- instance.fileCacheHelper.loadJsFile("apps/integrations/gst/managers/gstmanager.js", function () {
- Bizgaze.Apps.Integrations.GST.Managers.GSTManager.Instance().saveGSTRToPortal(postData).then(function (response) {
- if (response.errors != null) {
- MessageHelper.Instance().showError(response.message, "Unibase_ValidationSummary");
- return false;
- }
- else {
- alert(response.message);
- var obj = Unibase.Themes.Compact.Components.Details.Instance();
- obj._recordId = Unibase.Themes.Compact.Components.Details.Instance()._recordId;
- obj._installedAppId = Unibase.Themes.Compact.Components.Details.Instance()._installedAppId;
- obj.loadPortlets(obj);
- Unibase.Platform.Helpers.NavigationHelper.IsListRefresh = true;
- }
- });
- });
- }
- saveGSTRtoGSTPortal(taxclassificationId, gstNo, InvoiceTypeId) {
- var instance = this;
- let containerId = $("#" + instance.navigationHelper.getLastContainerId());
- if (!$('input.invoiceschk_selected').is(':checked')) {
- const errId = $('.gst-error-msg').last().attr('id');
- MessageHelper.Instance().showError("Please Select One or More Records", errId);
- return null;
- }
- let b2bCheckboxes = containerId.find('input.invoiceschk_selected');
- var invoiceids = containerId.find('.invoiceschk_selected:checkbox:checked').map(function () {
- return $(this).val();
- }).get();
- gstNo = $(containerId).find('.fromgstno').first().text() || $(containerId).find('.fromgstno').first().val();
- console.log(invoiceids);
- containerId.find("#selectedinvoices_check").click(function () {
- var checkBoxes = b2bCheckboxes.find('input.invoiceschk_selected');
- checkBoxes.prop("checked", !checkBoxes.prop("checked"));
- });
- b2bCheckboxes.click(function () {
- if (!$(this).is(':checked')) {
- $("#selectedinvoices_check").prop('checked', false);
- }
- else if (b2bCheckboxes.is(":checked")) {
- $("#selectedinvoices_check").prop('checked', true);
- }
- });
- bootbox.prompt("Please Enter OTP", function (result) {
- if (result) {
- instance._saveGSTRtoGSTPortal(taxclassificationId, result, gstNo, InvoiceTypeId);
- $(".bootbox-input").keypress(function (e) {
- if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
- MessageHelper.Instance().showSuccess("Numbers only allowed", 'div_validationsummary');
- return false;
- }
- });
- }
- });
- }
- DeleteGstrToGSTPortal(taxclassificationId, InvoiceTypeId) {
- var instance = this;
- let containerId = "#" + Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1];
- let b2bCheckboxes = $(containerId).find('input.invoiceschk_selected');
- var invoiceids = $(containerId).find('.invoiceschk_selected:checkbox:checked').map(function () {
- return $(this).val();
- }).get();
- $(containerId).find("#selectedinvoices_check").click(function () {
- var checkBoxes = b2bCheckboxes.find('input.invoiceschk_selected');
- checkBoxes.prop("checked", !checkBoxes.prop("checked"));
- });
- b2bCheckboxes.click(function () {
- if (!$(this).is(':checked')) {
- $("#selectedinvoices_check").prop('checked', false);
- }
- else if (b2bCheckboxes.is(":checked")) {
- $("#selectedinvoices_check").prop('checked', true);
- }
- });
- bootbox.confirm("Are you sure you want to delete", function (result) {
- if (result) {
- instance._deleteGSTRtoGSTPortal(taxclassificationId, result, InvoiceTypeId);
- }
- });
- }
- getSelectedInvoices() {
- $(".invoices_check");
- }
- generateOtp(gstNo) {
- var gstIntegratorId = 0;
- var instance = this;
- instance.fileCacheHelper.loadJsFile("apps/integrations/gst/components/gstsubmission.js", null);
- instance.fileCacheHelper.loadJsFile("apps/integrations/gst/managers/gstmanager.js", null);
- bootbox.confirm("Are you sure, you want to continue", function (result) {
- if (result == true) {
- if (gstNo == undefined || gstNo == "") {
- alert("Please select Gst No");
- return false;
- }
- Bizgaze.Apps.Integrations.GST.Managers.GSTManager.Instance().getGstDetails(gstNo).then(function (response) {
- if (response.status == Unibase.Data.Status.Success) {
- var result = response.result[0];
- var returnPeriod = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_returnperiod").Value;
- var rdmNo = moment.utc(new Date()).local().format("YYYYMMDDHHmmss");
- var postData = {
- username: result.gstusername,
- requestid: "Biz-" + rdmNo,
- gstin: gstNo,
- retperiod: returnPeriod
- };
- Bizgaze.Apps.Integrations.GST.Managers.GSTManager.Instance().generateOtp(postData).then(function (response) {
- if (response.errors != null) {
- instance.showGSTErrorMsg(response.message);
- return false;
- }
- else {
- alert(response.message);
- }
- });
- }
- else
- MessageHelper.Instance().showSuccess(response.message, '');
- });
- }
- });
- }
- _gstShowLog(taxclassificationId) {
- var instance = this;
- var gstNo;
- var returnPeriod = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_returnperiod").Value;
- var gstr1type = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_gstr1type").Value;
- var gstintegratorId = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_gstintegratorid").Value;
- var invoiceid = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_invoiceid").Value;
- var invoiceno = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_invoiceno").Value;
- gstNo = Unibase.Platform.Analytics.Viewers.TableViewer.Instance().Filter.find(x => x.ParameterName == "fromgstno");
- if (gstNo == undefined || gstNo == "")
- gstNo = Unibase.Platform.Analytics.Viewers.TemplateViewer.Instance().Filter.find(x => x.ParameterName == "fromgstno");
- if (gstNo == undefined || gstNo == "") {
- alert("Please select Gst No");
- return false;
- }
- gstNo = gstNo.ParameterValue;
- var Selectedinvoiceno = [];
- Selectedinvoiceno.push("Invoiceno", Selectedinvoiceno);
- var taxClassificationData = [];
- taxClassificationData.push("TaxclassificationId", taxclassificationId);
- taxClassificationData.push("InvoiceId", Selectedinvoiceno);
- var postData = {
- TaxClassificationData: taxClassificationData,
- Invoiceid: invoiceid,
- Invoiceno: invoiceno,
- RtPeriod: returnPeriod,
- GSTIntegratorid: gstintegratorId,
- GSTR1type: gstr1type,
- FromGSTNo: gstNo,
- InvoiceTypeId: 1,
- Selectedinvoiceno: invoiceno
- };
- instance.fileCacheHelper.loadJsFile("apps/integrations/gst/managers/gstShowLog.js", function () {
- });
- }
- _saveGSTRtoGSTPortal(taxclassificationId, otp, gstNo, InvoiceTypeId) {
- var gstIntegratorId = 0;
- var instance = this;
- var integratorId = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_gstintegratorid").Value;
- var returnPeriod = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_returnperiod").Value;
- var fromDate = moment(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_fromdate").Value).format("YYYY-MM-DD");
- var toDate = moment(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_todate").Value).format("YYYY-MM-DD");
- var formattedfromDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerDate(toDate);
- var rdmNo = moment.utc(new Date()).local().format("YYYYMMDDHHmmss");
- var invoiceids = $('.invoiceschk_selected:checkbox:checked').map(function () {
- var instance = this;
- return Number(instance.value);
- }).get();
- if (isNaN(invoiceids.length))
- invoiceids;
- if (isNaN(invoiceids.length))
- invoiceids.length = 0;
- if (invoiceids.length == null) {
- invoiceids.length = 0;
- }
- const rates = $('.invoiceschk_selected:checkbox:checked').map(function () {
- return $(this).closest('.body-tr').find('.gst-rate').text();
- }).get();
- const supplytype = $('.invoiceschk_selected:checkbox:checked').map(function () {
- return $(this).closest('.body-tr').find('.gst-supplytype').text();
- }).get();
- const pos = $('.invoiceschk_selected:checkbox:checked').map(function () {
- return $(this).closest('.body-tr').find('.gst-pos').text();
- }).get();
- const hsnCodes = $('.invoiceschk_selected:checkbox:checked').map(function () {
- return $(this).closest('.body-tr').find('.gst-hsncodes').text();
- }).get();
- var dynamicfilters = [{}];
- var OTP = otp.replace(' ', '');
- var taxClassificationData = [{
- TaxclassificationId: taxclassificationId,
- InvoiceId: invoiceids,
- Rates: rates,
- SupplyType: supplytype,
- Pos: pos,
- HSNCodes: hsnCodes,
- InvoiceTypeId: 1
- }];
- var postData = {
- TaxClassificationData: taxClassificationData,
- RtPeriod: returnPeriod,
- GSTIntegratorId: integratorId,
- ToDate: toDate,
- FromDate: fromDate,
- InvoiceTypeId: 1,
- GstNo: gstNo,
- Otp: OTP
- };
- instance.fileCacheHelper.loadJsFile("apps/integrations/gst/managers/gstmanager.js", function () {
- Bizgaze.Apps.Integrations.GST.Managers.GSTManager.Instance().saveGSTRToPortal(postData).then(function (response) {
- if (response.errors != null) {
- instance.showGSTErrorMsg(response.message);
- return false;
- }
- else {
- MessageHelper.Instance().showSuccess(response.message, "");
- var obj = Unibase.Themes.Compact.Components.Details.Instance();
- obj._recordId = Unibase.Themes.Compact.Components.Details.Instance()._recordId;
- obj._installedAppId = Unibase.Themes.Compact.Components.Details.Instance()._installedAppId;
- obj.loadPortlets(obj);
- Unibase.Platform.Helpers.NavigationHelper.IsListRefresh = true;
- }
- });
- });
- }
- _deleteGSTRtoGSTPortal(taxclassificationId, otp, InvoiceTypeId) {
- var gstIntegratorId = 0;
- var instance = this;
- var integratorId = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_gstintegratorid").Value;
- var returnPeriod = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_returnperiod").Value;
- var fromDate = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_fromdate").Value;
- var toDate = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_todate").Value;
- var gstNo = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_gstinno").Value;
- var rdmNo = moment.utc(new Date()).local().format("YYYYMMDDHHmmss");
- var invoiceids = $('.invoiceschk_selected:checkbox:checked').map(function () {
- var instance = this;
- return Number(instance.value);
- }).get();
- var DeletedInvoicesData = {
- DeletedInvoiceIds: invoiceids
- };
- var taxClassificationData = [{
- TaxclassificationId: taxclassificationId,
- InvoiceTypeId: InvoiceTypeId,
- DeleteInvoices: DeletedInvoicesData
- }];
- var postData = {
- TaxClassificationData: taxClassificationData,
- RtPeriod: returnPeriod,
- GSTIntegratorId: integratorId,
- ToDate: "'2022/08/01'",
- FromDate: "'2022/08/01'",
- InvoiceTypeId: 1,
- GstNo: gstNo,
- Otp: "575757"
- };
- instance.fileCacheHelper.loadJsFile("apps/integrations/gst/managers/gstmanager.js", function () {
- Bizgaze.Apps.Integrations.GST.Managers.GSTManager.Instance().saveGSTRToPortal(postData).then(function (response) {
- if (response.errors != null) {
- instance.showGSTErrorMsg(response.message);
- return false;
- }
- else {
- MessageHelper.Instance().showSuccess(response.message, "");
- var obj = Unibase.Themes.Compact.Components.Details.Instance();
- obj._recordId = Unibase.Themes.Compact.Components.Details.Instance()._recordId;
- obj._installedAppId = Unibase.Themes.Compact.Components.Details.Instance()._installedAppId;
- obj.loadPortlets(obj);
- Unibase.Platform.Helpers.NavigationHelper.IsListRefresh = true;
- }
- });
- });
- }
- showGSTErrorMsg(message) {
- const errId = $('.gst-error-msg').last().attr('id');
- MessageHelper.Instance().showError(message, errId);
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new GSTSubmission();
- }
- return this.instance;
- }
- }
- Components.GSTSubmission = GSTSubmission;
- })(Components = GST.Components || (GST.Components = {}));
- })(GST = Integrations.GST || (Integrations.GST = {}));
- })(Integrations = Apps.Integrations || (Apps.Integrations = {}));
- })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
- })(Bizgaze || (Bizgaze = {}));
|