123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- var Bizgaze;
- (function (Bizgaze) {
- let Apps;
- (function (Apps) {
- let Transact;
- (function (Transact) {
- let Components;
- (function (Components) {
- let Invoices;
- (function (Invoices) {
- class printpd extends Unibase.Platform.Core.BaseComponent {
- jsFiles() {
- return ["apps/transact/Components/Invoices/printpd.js", "platform/core/helpers/autocomplete/autocompletehelper.js", 'libs/parsley/parsley.min.js', , 'tenants/themes/compact/components/details/details.js'];
- }
- cssFiles() {
- return [];
- }
- html(id, containerid) {
- let formid = 0;
- var html = '<div class="section_Description card Section" id="div_section' + formid + '" ' +
- 'data - sectionname="Description" data - toggle="collapse">' +
- '<div class="card-header d-flex align-items-center" id = "section_' + formid + '"><h6 class="py-3"> Bulk Print </h6><div class="bulk_print_error w-75 ml-4" id="bulk_print_error"></div></div>' +
- ' <div class=" card-body "id = "collapseSections_' + formid + '"> <div class="row form-group"> ' +
- '<div class="col-sm-2"><div class="floating-label-form-group m-b floating-label-form-group-with-value" style="border:0px"><span class="h6"> From Date<span class="text-danger">*</span></span><input class="form-control value-control text-dark invoicefromdate" data-placeholder="dd/mm/yyyy" type="text" value=""></div></div>' +
- '<div class="col-sm-2"><div class="floating-label-form-group m-b floating-label-form-group-with-value" style="border:0px"><span class="h6">To Date<span class="text-danger">*</span></span><input class="form-control value-control text-dark invoicetodate" data-placeholder="dd/mm/yyyy" type="text" value=""></div></div>' +
- '<div class="col-sm-2"><div class="floating-label-form-group" style="border:0"><span class="h6">Salesperson </span><input type="hidden" id="hf_salespersontId_ " class="hfsalespersonid" value="0" /><select id="txt_SalesPersonName" class="form-control txt_salespersonId" style="width:100%;" data-placeholder="Select" data-label="Sales Person Name" placeholder="Select"><option value="0"></option></select><input type="hidden" id="hf_SalesPersonId" value="0"/></div></div>' +
- '<div class="col-sm-2"><div class="floating-label-form-group" style="border:0"><span class="h6">Organization </span><input type="hidden" id="hf_OraganizationId_ " class="hfOraganizationid" value="0" /><select id="txt_OraganizationName" class="form-control txt_OraganizationId" style="width:100%;" data-placeholder="Select" data-label="Sales Oraganization Name" placeholder="Select"><option value="0"></option></select><input type="hidden" id="hf_OraganizationId" value="0"/></div></div>' +
- '<div class="col-sm-2"><div class="floating-label-form-group" style="border:0"><span class="h6">Invoice Type<span class="text-danger">*</span> </span><input type="hidden" id="hf_InvoicetypeId_ " class="hfInvoicetypeid" value="0" /><select id="txt_InvoicetypeName" class="form-control txt_OraganizationId" style="width:100%;" data-placeholder="Select" data-label="Invoice type Name" placeholder="Select"> <option value="1"> Sales </option>' +
- ' <option value = "2"> Purchase </option></select><input type="hidden" id="hf_InvoicetypeId" value="0"/></div></div>' +
- '<div class="col-sm-2 d-flex align-items-center justify-content-center"> <a class="btn btn-sm btn-primary btn_Bulkprint">Invoice Print</a></div>' + '</div></div> </div> ';
- $("." + containerid).html(html);
- return "";
- }
- load(formId, containerid, callback) {
- var instance = this;
- }
- loadForm(FormId, Pk_Value, AppConfigurationId, Callback, ElementId) {
- var instance = this;
- var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
- }
- init(containerid) {
- var instance = this;
- instance.getbulkinvoices(containerid);
- }
- getbulkinvoices(containerid) {
- var instance = this;
- instance.html("", containerid);
- Bizgaze.Apps.Transact.Components.Invoices.printpd.Instance().SalesperonGroupAutoComplete(0);
- Bizgaze.Apps.Transact.Components.Invoices.printpd.Instance().OrganizationAutoComplete(0);
- $(".invoicefromdate").daterangepicker({
- locale: {
- format: 'DD/MM/YYYY',
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- maxDate: new Date(2050, 11, 31)
- });
- $(".invoicefromdate").parents(".floating-label-form-group").addClass("floating-label-form-group-with-value");
- $(".invoicetodate").daterangepicker({
- locale: {
- format: 'DD/MM/YYYY',
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- maxDate: new Date(2050, 11, 31)
- });
- $(".invoicetodate").parents(".floating-label-form-group").addClass("floating-label-form-group-with-value");
- $(".btn_Bulkprint").click(function () {
- debugger;
- var fromdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerDate($('.invoicefromdate').val());
- var todate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerDate($('.invoicetodate').val());
- var salesperson = $('#hf_AutocompleteId').val();
- var organization = $('#hf_OraganizationId').val();
- var invoicetype = $('#txt_InvoicetypeName').val();
- if (fromdate != "Invalid date" && todate != "Invalid date" && invoicetype != 0) {
- instance.getInvoicePrint(fromdate, todate, salesperson, organization, invoicetype);
- }
- else {
- MessageHelper.Instance().showError('From Date and To date are mandatory ', 'bulk_print_error');
- }
- });
- $(".invoicefromdate").change(function (e) {
- if (new Date(($(".invoicefromdate").val()).toString().split("/").reverse().join("/")) > new Date(($(".invoicetodate").val()).toString().split("/").reverse().join("/"))) {
- setTimeout(function () {
- $(".invoicefromdate").val("").trigger("change");
- $(".invoicefromdate").attr("placeholder", "dd/mm/yyyy");
- }, 200);
- MessageHelper.Instance().showError('From Date should not be greater than To Date ', 'bulk_print_error');
- e.preventDefault();
- }
- });
- $(".invoicetodate").change(function (e) {
- if (new Date(($(".invoicefromdate").val()).toString().split("/").reverse().join("/")) > new Date(($(".invoicetodate").val()).toString().split("/").reverse().join("/"))) {
- setTimeout(function () {
- $(".invoicetodate").val("").trigger("change");
- $(".invoicetodate").attr("placeholder", "dd/mm/yyyy");
- }, 200);
- MessageHelper.Instance().showError('ToDate should be greater than From Date', 'bulk_print_error');
- e.preventDefault();
- }
- });
- }
- SalesperonGroupAutoComplete(salespersonId) {
- var instance = this;
- AutoCompleteHelper.getHelper().Create("#txt_SalesPersonName", "#hf_SalesPersonId", _appsettings.server_url() + "/apis/v4/bizgaze/crm/contacts/getautotextemp", function (result) { });
- }
- OrganizationAutoComplete(OrganiztionId) {
- var instance = this;
- AutoCompleteHelper.getHelper().Create("#txt_OraganizationName", "#hf_OraganizationId", _appsettings.server_url() + "/apis/v4/bizgaze/crm/organization/organizationautocompleteasync", function (result) { });
- }
- getInvoicePrint(fromdate, todate, salesperson, organization, invoicetype) {
- var instance = this;
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/invoicemanager.js", function () {
- Bizgaze.Apps.Transact.Managers.InvoiceManager.Instance().getbulkprint(fromdate, todate, salesperson, organization, invoicetype).then(function (response) {
- var info = response.result;
- if (info != null) {
- var _path = _appsettings.asset_url() + info;
- }
- else {
- MessageHelper.Instance().showError(response.message, 'invoicebulkprint_errormsg');
- }
- });
- });
- }
- static Instance() {
- if (this._instance === undefined) {
- this._instance = new printpd();
- }
- return this._instance;
- }
- }
- Invoices.printpd = printpd;
- })(Invoices = Components.Invoices || (Components.Invoices = {}));
- })(Components = Transact.Components || (Transact.Components = {}));
- })(Transact = Apps.Transact || (Apps.Transact = {}));
- })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
- })(Bizgaze || (Bizgaze = {}));
|