Built files from Bizgaze WebServer
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

printpd.js 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. var Bizgaze;
  2. (function (Bizgaze) {
  3. let Apps;
  4. (function (Apps) {
  5. let Transact;
  6. (function (Transact) {
  7. let Components;
  8. (function (Components) {
  9. let Invoices;
  10. (function (Invoices) {
  11. class printpd extends Unibase.Platform.Core.BaseComponent {
  12. jsFiles() {
  13. 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'];
  14. }
  15. cssFiles() {
  16. return [];
  17. }
  18. html(id, containerid) {
  19. let formid = 0;
  20. var html = '<div class="section_Description card Section" id="div_section' + formid + '" ' +
  21. 'data - sectionname="Description" data - toggle="collapse">' +
  22. '<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>' +
  23. ' <div class=" card-body "id = "collapseSections_' + formid + '"> <div class="row form-group"> ' +
  24. '<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>' +
  25. '<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>' +
  26. '<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>' +
  27. '<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>' +
  28. '<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>' +
  29. ' <option value = "2"> Purchase </option></select><input type="hidden" id="hf_InvoicetypeId" value="0"/></div></div>' +
  30. '<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> ';
  31. $("." + containerid).html(html);
  32. return "";
  33. }
  34. load(formId, containerid, callback) {
  35. var instance = this;
  36. }
  37. loadForm(FormId, Pk_Value, AppConfigurationId, Callback, ElementId) {
  38. var instance = this;
  39. var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
  40. }
  41. init(containerid) {
  42. var instance = this;
  43. instance.getbulkinvoices(containerid);
  44. }
  45. getbulkinvoices(containerid) {
  46. var instance = this;
  47. instance.html("", containerid);
  48. Bizgaze.Apps.Transact.Components.Invoices.printpd.Instance().SalesperonGroupAutoComplete(0);
  49. Bizgaze.Apps.Transact.Components.Invoices.printpd.Instance().OrganizationAutoComplete(0);
  50. $(".invoicefromdate").daterangepicker({
  51. locale: {
  52. format: 'DD/MM/YYYY',
  53. },
  54. singleDatePicker: true,
  55. showDropdowns: true,
  56. minYear: 1901,
  57. maxDate: new Date(2050, 11, 31)
  58. });
  59. $(".invoicefromdate").parents(".floating-label-form-group").addClass("floating-label-form-group-with-value");
  60. $(".invoicetodate").daterangepicker({
  61. locale: {
  62. format: 'DD/MM/YYYY',
  63. },
  64. singleDatePicker: true,
  65. showDropdowns: true,
  66. minYear: 1901,
  67. maxDate: new Date(2050, 11, 31)
  68. });
  69. $(".invoicetodate").parents(".floating-label-form-group").addClass("floating-label-form-group-with-value");
  70. $(".btn_Bulkprint").click(function () {
  71. debugger;
  72. var fromdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerDate($('.invoicefromdate').val());
  73. var todate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerDate($('.invoicetodate').val());
  74. var salesperson = $('#hf_AutocompleteId').val();
  75. var organization = $('#hf_OraganizationId').val();
  76. var invoicetype = $('#txt_InvoicetypeName').val();
  77. if (fromdate != "Invalid date" && todate != "Invalid date" && invoicetype != 0) {
  78. instance.getInvoicePrint(fromdate, todate, salesperson, organization, invoicetype);
  79. }
  80. else {
  81. MessageHelper.Instance().showError('From Date and To date are mandatory ', 'bulk_print_error');
  82. }
  83. });
  84. $(".invoicefromdate").change(function (e) {
  85. if (new Date(($(".invoicefromdate").val()).toString().split("/").reverse().join("/")) > new Date(($(".invoicetodate").val()).toString().split("/").reverse().join("/"))) {
  86. setTimeout(function () {
  87. $(".invoicefromdate").val("").trigger("change");
  88. $(".invoicefromdate").attr("placeholder", "dd/mm/yyyy");
  89. }, 200);
  90. MessageHelper.Instance().showError('From Date should not be greater than To Date ', 'bulk_print_error');
  91. e.preventDefault();
  92. }
  93. });
  94. $(".invoicetodate").change(function (e) {
  95. if (new Date(($(".invoicefromdate").val()).toString().split("/").reverse().join("/")) > new Date(($(".invoicetodate").val()).toString().split("/").reverse().join("/"))) {
  96. setTimeout(function () {
  97. $(".invoicetodate").val("").trigger("change");
  98. $(".invoicetodate").attr("placeholder", "dd/mm/yyyy");
  99. }, 200);
  100. MessageHelper.Instance().showError('ToDate should be greater than From Date', 'bulk_print_error');
  101. e.preventDefault();
  102. }
  103. });
  104. }
  105. SalesperonGroupAutoComplete(salespersonId) {
  106. var instance = this;
  107. AutoCompleteHelper.getHelper().Create("#txt_SalesPersonName", "#hf_SalesPersonId", _appsettings.server_url() + "/apis/v4/bizgaze/crm/contacts/getautotextemp", function (result) { });
  108. }
  109. OrganizationAutoComplete(OrganiztionId) {
  110. var instance = this;
  111. AutoCompleteHelper.getHelper().Create("#txt_OraganizationName", "#hf_OraganizationId", _appsettings.server_url() + "/apis/v4/bizgaze/crm/organization/organizationautocompleteasync", function (result) { });
  112. }
  113. getInvoicePrint(fromdate, todate, salesperson, organization, invoicetype) {
  114. var instance = this;
  115. Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/invoicemanager.js", function () {
  116. Bizgaze.Apps.Transact.Managers.InvoiceManager.Instance().getbulkprint(fromdate, todate, salesperson, organization, invoicetype).then(function (response) {
  117. var info = response.result;
  118. if (info != null) {
  119. var _path = _appsettings.asset_url() + info;
  120. }
  121. else {
  122. MessageHelper.Instance().showError(response.message, 'invoicebulkprint_errormsg');
  123. }
  124. });
  125. });
  126. }
  127. static Instance() {
  128. if (this._instance === undefined) {
  129. this._instance = new printpd();
  130. }
  131. return this._instance;
  132. }
  133. }
  134. Invoices.printpd = printpd;
  135. })(Invoices = Components.Invoices || (Components.Invoices = {}));
  136. })(Components = Transact.Components || (Transact.Components = {}));
  137. })(Transact = Apps.Transact || (Apps.Transact = {}));
  138. })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
  139. })(Bizgaze || (Bizgaze = {}));