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.

invoiceamount.component.js 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. var Bizgaze;
  2. (function (Bizgaze) {
  3. let Apps;
  4. (function (Apps) {
  5. let Transact;
  6. (function (Transact) {
  7. let Controls;
  8. (function (Controls) {
  9. class InvoiceAmount extends Unibase.Platform.Core.BaseComponent {
  10. init(formpropertyid, prop, callback) {
  11. var instance = InvoiceAmount.Instance();
  12. instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
  13. instance.loadPropertySettings(prop.PropertySettings, prop.FormPropertyId);
  14. }
  15. loadControl(containerid, prop) {
  16. var html = "<div class='col-xs-2 text-right hidden'><strong><span id='grosstotal' class='text-primary'>0.00</span></strong></div><div class='row form-group'><div class='col-sm-6'><span class='pull-left'>Total Qty</span><span class='pull-right' id='totalinvoiceqty'>0.00</span></div><div class='col-sm-6'><span class='pull-left'>Sub Total</span><span class='pull-right' id='subtotal'>0.00</span></div></div> <div class='row form-group'><div class='col-sm-6'> <span class='pull-left'> Discount On Items</span><span class='pull-right' id='totalItemDiscount'>0.00</span></div> <div class='col-sm-6'> <span class='pull-left'>Tax</span><span class='pull-right' id='totalTax'>0.00</span></div></div> <div class='row col-sm-12 form-group hidden'><div class='col-sm-6'></div><div class='col-sm-4 pull-left col-xs-6'>TDS</div><div class='col-sm-2 col-xs-6'><span class='pull-right'>0.00</span></div></div> <div class=''><div class='netdiscount-row hidden'></div><div class='expense-row hidden'></div></div> <div class='row py-2'><div class='col-sm-6'><a id='addNetDiscount' class='btn btn-outline-primary mb-2' title='Add Discount'><span class='px-1'><i class='la la-plus'></i></span><span>Add Coupon</span></a><span> </span><a id='addExpense' class='btn btn-outline-primary mb-2' title='Add Expense'><span class='px-1'><i class='la la-plus'></i></span><span>Add Expense</span></a></div><div class='col-sm-4 col-xs-6 hidden'>Expenses</div><div class='col-sm-2 col-xs-6 hidden'><span class='pull-right'>0.00</span></div></div> <div class='row'><div class='col-sm-3 div_IsAutoAdjustment mt-30'><input type='checkbox' id='chk_AutoAdjustment' class='css-checkbox'><label for='chk_AutoAdjustment' class='css-label text-sm pa-10'>Adjustment</label></div><div class='col-sm-6 col-lg-5 div_AdjustmentAccount '><div class='floating-label-form-group-with-value'><label id='lbl_AdjustmentAccountId' for='lbl_AdjustmentAccountId'>Account Name<span class='span_AdjustmentAccountName text-danger'> *</span></label><div class='input-group'><select id='txt_AdjustmentAccountName' class='form-control text-control select2-hidden-accessible txt_Account' style='width: 100%;' data-placeholder='Select' data-label='Account Name' placeholder='Select'><option value='0'></option></select><input type='hidden' id='hf_AdjustmentAccountId' value='0'></div></div></div><div class='col-sm-3 col-lg-4 mt-20'><div class='col-sm-8 floating-label-form-group input-group pull-left'><input type='text' placeholder='0.00' id='txt_Adjustment' class='form-control floating-label-control text-center text-right' value='0.00' /></div><div class='pt-10 pull-right'><span class=' mt-10' id='span_Adjustment'>0.00</span></div></div></div><div class='row col-sm-12 divWalletAmountContainer hidden'><a id='txt_Wallet' title='Wallet Details' class='default pull-left' href='' data-toggle='modal' data-original-title='Wallet'><span class='pull-left' style='text-decoration:underline;color:cornflowerblue' id='btn_Wallet'>Wallet- <strong><small id='WalletAmount'></small></strong></span></a></div> <div class='col-sm-12 WalletItems mt-10 collapse' style='border: 1px;border-style:groove;'><div id='tbl_WalletItems' class='col-sm-12'></div></div>";
  17. $("#" + containerid).html(html);
  18. $('#txt_Adjustment').prop("disabled", false);
  19. $('#txt_Adjustment').keypress(function (event) {
  20. if ((event.which > 47 && event.which < 58) || (event.which == 46 || event.which == 8) || (event.which == 45)) {
  21. }
  22. else {
  23. event.preventDefault();
  24. }
  25. }).on('paste', function (event) {
  26. event.preventDefault();
  27. });
  28. $('#txt_Adjustment').blur(function () {
  29. if ($('#chk_AutoAdjustment').prop("checked") == false) {
  30. $('.hdn_adjustment').val($('#txt_Adjustment').val());
  31. if (Number($('#txt_Adjustment').val()) != 0) {
  32. $('.span_AdjustmentAccountName').removeClass('hidden');
  33. }
  34. else {
  35. $('.span_AdjustmentAccountName').addClass('hidden');
  36. }
  37. Controls.InvoiceItem.Instance().update_total();
  38. Controls.InvoiceItem.Instance().TotalAdjustment();
  39. }
  40. });
  41. var instance = this;
  42. instance.loadAccounts();
  43. $('#chk_AutoAdjustment').prop("checked", true);
  44. $(".hdn_autoadjustment").val("true");
  45. $('#txt_Adjustment').prop("disabled", true);
  46. $('#chk_AutoAdjustment').change(function () {
  47. if ($('#chk_AutoAdjustment').is(':checked')) {
  48. $('.span_AdjustmentAccountName').removeClass('hidden');
  49. $('#txt_Adjustment').prop("disabled", true);
  50. Controls.InvoiceItem.Instance().update_total();
  51. Controls.InvoiceItem.Instance().TotalAdjustment();
  52. $(".hdn_autoadjustment").val("true");
  53. }
  54. else {
  55. $("#txt_Adjustment").val(0);
  56. $("#txt_Adjustment").blur();
  57. $(".hdn_adjustment").val(0);
  58. $('.span_AdjustmentAccountName').addClass('hidden');
  59. $('#txt_Adjustment').prop("disabled", false);
  60. $(".hdn_autoadjustment").val("false");
  61. }
  62. });
  63. $("#addNetDiscount").off().click(function () {
  64. let lobid = $(".hfAutoCompleteId_lobid").val();
  65. if (lobid == undefined || lobid == "" || lobid == "0") {
  66. MessageHelper.Instance().showError("Please Select LoB", $("#form-container-" + $("#hf_FormId").val()).find(".bizgaze_FormErrorMessages").attr('id'));
  67. return false;
  68. }
  69. else {
  70. Controls.InvoiceItem.Instance().addNetDiscountRow();
  71. $(".netdiscount-row:last").find(".netdiscount-name").find("input:text").focus();
  72. }
  73. });
  74. $("#addExpense").off().click(function () {
  75. ;
  76. let lobid = $(".hfAutoCompleteId_lobid").val();
  77. if (lobid == undefined || lobid == "" || lobid == "0") {
  78. MessageHelper.Instance().showError("Please Select LoB", $("#form-container-" + $("#hf_FormId").val()).find(".bizgaze_FormErrorMessages").attr('id'));
  79. return false;
  80. }
  81. else {
  82. Controls.InvoiceItem.Instance().addExpenseRow(null, "", "", true);
  83. $(".expense-row:last").find(".expense-name").find("input:text").focus();
  84. }
  85. });
  86. if ($(".hdn_invoicetypeid").val() == "3" || $(".hdn_invoicetypeid").val() == "4" || $(".hdn_invoicetypeid").val() == "6" || $(".hdn_invoicetypeid").val() == "7") {
  87. $("#addNetDiscount").addClass("hidden");
  88. }
  89. }
  90. loadControlSettings(controlsettingjson, formpropertyid) {
  91. return null;
  92. }
  93. loadPropertySettings(propertysettings, formpropertyid) {
  94. if (propertysettings != null) {
  95. for (var i = 0; i < propertysettings.length; i++) {
  96. var data = propertysettings[i];
  97. if (data.ControlPropertyName == "MaxLength") {
  98. $("#txt_" + formpropertyid).attr("MaxLength", data.ControlPropertyValue);
  99. }
  100. }
  101. }
  102. }
  103. bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
  104. throw new Error("Method not implemented.");
  105. }
  106. loadAccounts() {
  107. var instance = this;
  108. var url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/ledgers/ledgerautocomplete';
  109. AutoCompleteHelper.getHelper().Create("#txt_AdjustmentAccountName", "#hf_AdjustmentAccountId", url, null);
  110. $("#txt_AdjustmentAccountName").on('select2:select', function (e) {
  111. instance.LedgerAccountChange();
  112. });
  113. }
  114. LedgerAccountChange() {
  115. var instance = this;
  116. var url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/ledgers/ledgerautocomplete';
  117. AutoCompleteHelper.getHelper().Create("#txt_AdjustmentAccountName", "#hf_AdjustmentAccountId", url, function (response) {
  118. debugger;
  119. var accountId = 0;
  120. var accountName = "";
  121. var controlId = "";
  122. var hiddenFieldControlId = "";
  123. accountId = Number(response.id);
  124. accountName = response.text;
  125. controlId = "#txt_AdjustmentAccountName";
  126. hiddenFieldControlId = "#hf_AdjustmentAccountId";
  127. if (accountId == 0)
  128. accountName = "Select Account";
  129. if (accountId == 1 || accountId == -1)
  130. accountName = "Create New";
  131. if (accountName == "Create New") {
  132. $("#txt_AdjustmentAccountName").val(null).trigger("change");
  133. var FormUniqueId = "Bizgaze_Extension_Transact_Ledgers_App_Ledgers_CreateForm";
  134. var AppConfigurationUnique = "Bizgaze_Extension_Transact_Ledgers_AppConfiguration_CreateLedgers";
  135. Unibase.Platform.Forms.Managers.FormManager.Instance().getFormbyUniqueId(FormUniqueId).then(function (response) {
  136. var obj = {
  137. controlid: controlId,
  138. hiddenid: hiddenFieldControlId
  139. };
  140. var successobj = {
  141. CallBack: function (id, obj) {
  142. Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().getLedgerById(id).then(function (response) {
  143. var createdLedger = new Option(response.result.LedgerName, response.result.LedgerId, true);
  144. $(obj.controlid + " option").remove();
  145. $(obj.controlid).append(createdLedger).trigger('change');
  146. $(obj.hiddenid).val(response.result.LedgerId);
  147. });
  148. },
  149. Parameters: obj,
  150. };
  151. var formviewerObj = {
  152. FormId: response.result.FormId,
  153. AppConfigurationId: 0,
  154. Pk_Value: 0,
  155. PortletWidgetId: 0,
  156. OnSuccess: successobj,
  157. OnFail: null,
  158. OnLoad: null,
  159. };
  160. instance.fileCacheHelper.loadJsFile("apps/transact/managers/ledgers/ledgermanager.js", function () {
  161. instance.fileCacheHelper.loadJsFile("platform/forms/components/formviewer/formviewer.js", function () {
  162. Unibase.Platform.Forms.Components.FormViewer.instance.init(formviewerObj);
  163. setTimeout(function () {
  164. $("#btn_CloseForm_" + response.result.FormId).click(function () {
  165. $("#txt_AdjustmentAccountName").val(null).trigger("change");
  166. });
  167. }, 1000);
  168. });
  169. });
  170. });
  171. }
  172. });
  173. }
  174. static Instance() {
  175. if (this.instance === undefined) {
  176. this.instance = new InvoiceAmount();
  177. }
  178. return this.instance;
  179. }
  180. }
  181. Controls.InvoiceAmount = InvoiceAmount;
  182. })(Controls = Transact.Controls || (Transact.Controls = {}));
  183. })(Transact = Apps.Transact || (Apps.Transact = {}));
  184. })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
  185. })(Bizgaze || (Bizgaze = {}));