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.

balancesheetindexing.js 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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 BalanceSheetIndexing extends Unibase.Platform.Core.BaseComponent {
  10. cssFiles() {
  11. return [];
  12. }
  13. jsFiles() {
  14. return ["apps/transact/controls/ledgers/balancesheetindexing.js"];
  15. }
  16. html(id, containerid) {
  17. var instance = this;
  18. let formid = 0, configrationid = 0;
  19. var _installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
  20. Unibase.Platform.Apps.Managers.AppManager.Instance().getFormAppConfigurations(Number(_installedAppId)).then(function (response) {
  21. if (response.result != null) {
  22. var d = response.result;
  23. }
  24. });
  25. let html = '<div class="bg-white modal-header BalanceSheetHeader"><strong class="text-dark titlename"> Balance Sheets <strong id="sg_item"></strong></strong>' +
  26. '<span class="Balancesheet_errormsg text-danger text-center" id = "Balancesheet_errormsg">' +
  27. '</span>' +
  28. '</div> ' +
  29. '<div data-simplebar class="simple-scroll-bar modal-body BalanceSheetBody"><form id="form_balancesheetindexing"><div class="BalanceSheetAutocompleteContainer row align-items-center mx-0">' +
  30. '<div class="BalanceSheetAutocomplete2 col-sm-5 pl-sm-0 d-flex align-items-center">' +
  31. '<span class="col-sm-12 pl-0 pr-0"><select type="text" id="txt_Ledgertype_TRN2' + formid + '" style="width:100%" class="LedgertypeName required form-control floating-label-control" data-isdynamic="false" placeholder="Ledgertype" data-placeholder="Select type" data-label="Ledger Type"></select></span>' +
  32. '<input type="hidden" id="hf_ledgertype_TRN' + formid + '" class="hf_LedgertypeIdSelected form-control" data-isdynamic="true"/><input type="hidden" class="hf_LedgerTypeId" /> <input type="hidden" class="hf_LedgertypeId" /><label for="Validation" id="lblValidation_LedgertypeName"></label><input type="hidden" id="hfFormPropertyId" />' +
  33. '</div>' +
  34. '<div class="BalanceSheetAutocomplete1 col-sm-5 d-flex align-items-center">' +
  35. '<span class="col-sm-12 pl-0 pr-0"><select type="text" id="txt_Groups_TRN' + formid + '" style="width:100%" class="GroupName required form-control floating-label-control" data-isdynamic="false" placeholder="Group" data-placeholder="Select Group" data-label="Account"></select></span>' +
  36. '<input type="hidden" id="hf_LedgerGroupIdSelected_TRN' + formid + '" class="hf_LedgerGroupIdSelected form-control" data-isdynamic="true"/><input type="hidden" class="hf_GroupId" /> <input type="hidden" class="hf_GroupId" /><label for="Validation" id="lblValidation_GroupName"></label><input type="hidden" id="hfFormPropertyId" />' +
  37. '</div>' +
  38. '<a class="col-sm-2 btn btn-sm btn-primary btn_AddBalSheetS">Add</a>' +
  39. '</div></form>' +
  40. '<div class="balance_indexing"></div></div>' +
  41. '<div class="bg-white modal-footer BalanceSheetFooter"><a href="javascript:;" class="btn btn-light btn-sm mr-auto btn_BalanceSheetClose">Close</a><span class="mr-auto" id="spn_Quantity"></span > <a href="javascript:;" class="btn btn-primary btn-sm btn_BalSheetSave" id ="btn_BalSheetSave">Save</a></div>';
  42. return html;
  43. }
  44. load(id, containerid, callback) {
  45. var instance = this;
  46. instance.fileCacheHelper.loadJsFile('apps/transact/managers/ledgers/ledgermanager.js', function () {
  47. var _installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
  48. var reporttypeid = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + _installedAppId + "_reporttypeid").Value);
  49. Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().AllBalanceSheetIndexes(reporttypeid).then(function (response) {
  50. var reporttypeid = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + _installedAppId + "_reporttypeid").Value);
  51. instance.loadlist(response);
  52. });
  53. });
  54. instance.navigationHelper.popup("", "", Bizgaze.Apps.Transact.Controls.BalanceSheetIndexing.Instance(), function () {
  55. }, Unibase.Platform.Helpers.Size.Large);
  56. }
  57. init() {
  58. var instance = this;
  59. instance.load(0, "", null);
  60. }
  61. loadlist(response) {
  62. var html1 = '<ul class="list-group gutter list-group-lg list-group-sp sortable biz-custom-scrollbar" id="ul_BalanceSheets">';
  63. for (var i = 0; i < response.result.length; i++) {
  64. var data = response.result[i];
  65. html1 += '<li class="list-group-item box-shadow status-item group-item_' + data.balsheetid + '" id="group-item_' + data.balsheetid + '" data-id=' + i + '>' +
  66. '<input type="hidden" id="hfBalSheetId" value=' + data.balsheetid + '>' +
  67. '<span class="pull-left media-xs balindex" val=' + data.index + '><i class="fa fa-sort text-muted fa m-r-sm"></i> <strong class="mr-10 BS_Index">' + data.index + '</strong> </span>' +
  68. '<div class="clear">' +
  69. '<div class="stageheading">' +
  70. '<a href="#stage-' + data.balsheetid + '" data-parent="#togglestage" data-toggle="collapse" class="d-flex justify-content-between align-items-center accordion-toggle collapsed"> ' +
  71. ' <label class="" id="hfBalGroupName">' + data.groupname + ' </label>' +
  72. '</a></div></div>' +
  73. '<div class="panel-collapse collapse" id="stage-' + data.balsheetid + '" style="height:0px;">' +
  74. '<div id="CreateStageDiv_' + data.balsheetid + '" class="bg-white m-t-sm CreateStageDiv">' +
  75. '</div>' +
  76. '</div>'
  77. + '</div></li>';
  78. }
  79. html1 += '</ul>';
  80. var instance = this;
  81. $('.balance_indexing').append(html1);
  82. var _installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
  83. Bizgaze.Apps.Transact.Controls.BalanceSheetIndexing.Instance().ledgertypeAutoComplete(0);
  84. $('#txt_Ledgertype_TRN20').change(function () {
  85. Bizgaze.Apps.Transact.Controls.BalanceSheetIndexing.Instance().ledgerGroupAutoComplete(0);
  86. $("#txt_Groups_TRN0").text("");
  87. });
  88. $(".btn_BalanceSheetClose").click(function () {
  89. instance.navigationHelper.closePopUp();
  90. });
  91. $('#ul_BalanceSheets').sortable({
  92. update: function (event, ui) {
  93. $("#ul_BalanceSheets").each(function () {
  94. let ul = $("#ul_BalanceSheets li");
  95. for (var i = 0; i < ul.length; i++) {
  96. let id = $(ul[i]).attr("id");
  97. $("#" + id + " .BS_Index").text(i + 1);
  98. $("#" + id).attr("data-id", i + 1);
  99. }
  100. });
  101. }
  102. });
  103. $(".btn_AddBalSheetS").off().click(function () {
  104. for (var inc = 1; inc <= 1; inc++) {
  105. $('#form_balancesheetindexing select').each(function (i, e) {
  106. let controlId = $(e).attr('id');
  107. let result = Unibase.Platform.Forms.Components.FormViewer.Instance().requiredFieldValidation(controlId);
  108. if (result == false) {
  109. return false;
  110. }
  111. });
  112. var balsheetids = [];
  113. var i = $("#ul_BalanceSheets").find(".list-group-item").length + 1;
  114. var groupid = $('#txt_Groups_TRN0').val();
  115. var typeid = $('#txt_Ledgertype_TRN20').val();
  116. var _installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
  117. var identity = "";
  118. var reporttypeid = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + _installedAppId + "_reporttypeid").Value.toString();
  119. if (groupid == null && typeid == null) {
  120. MessageHelper.Instance().showError('Group and Type are mandatory ', 'Balancesheet_errormsg');
  121. }
  122. else {
  123. balsheetids.push({
  124. Groupid: groupid,
  125. Typeid: typeid,
  126. reportypeid: reporttypeid,
  127. index: i.toString(),
  128. installedappid: _installedAppId,
  129. identity: identity
  130. });
  131. if (groupid != null && typeid != null) {
  132. Bizgaze.Apps.Transact.Controls.BalanceSheetIndexing.Instance().SaveBalSheetIndex(balsheetids);
  133. $('#txt_Groups_TRN0').text(null);
  134. $('#txt_Groups_TRN0').val(null);
  135. $('#txt_Ledgertype_TRN20').val(null);
  136. $('#txt_Ledgertype_TRN20').text(null);
  137. $('#txtsheetidentity').val(null);
  138. }
  139. }
  140. }
  141. });
  142. $(".btn_BalSheetSave").click(function () {
  143. var balsheetids = [];
  144. $("#ul_BalanceSheets").find(".list-group-item").each(function () {
  145. var balsheetid = $(this).find("#hfBalSheetId").val();
  146. if (balsheetid != 0) {
  147. balsheetids.push(balsheetid);
  148. }
  149. });
  150. var postdata = {
  151. Ids: balsheetids
  152. };
  153. instance.UpdateBalSheetIndex(postdata);
  154. });
  155. let BalanceSheetHeaderHeight = $(".BalanceSheetHeader").outerHeight(true);
  156. let BalanceSheetFooterHeight = $(".BalanceSheetFooter").outerHeight(true);
  157. let BalanceSheetBodyPaddingHeight = parseInt($('.BalanceSheetBody').css('padding-top')) + parseInt($('.BalanceSheetBody').css('padding-bottom'));
  158. let BalanceSheetFormHeight = $('#form_balancesheetindexing').outerHeight(true);
  159. let totalBalanceSheetsHeight = BalanceSheetHeaderHeight + BalanceSheetFooterHeight + BalanceSheetBodyPaddingHeight + BalanceSheetFormHeight;
  160. $("#ul_BalanceSheets").css({ 'height': `${$(window).innerHeight() - totalBalanceSheetsHeight}px`, 'overflow-y': 'overlay' }).attr('data-deductheight', `${totalBalanceSheetsHeight}`);
  161. }
  162. SaveBalSheetIndex(postdata) {
  163. var instance = this;
  164. instance.fileCacheHelper.loadJsFile('apps/transact/managers/ledgers/ledgermanager.js', function () {
  165. Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().SaveBalSheetIndex(postdata).then(function (response) {
  166. var info = response.result;
  167. if (info != null) {
  168. $('.balance_indexing').empty();
  169. Bizgaze.Apps.Transact.Controls.BalanceSheetIndexing.Instance().loadlist(response);
  170. }
  171. else {
  172. MessageHelper.Instance().showError(response.message, 'Balancesheet_errormsg');
  173. }
  174. });
  175. });
  176. }
  177. UpdateBalSheetIndex(postdata) {
  178. var instance = this;
  179. instance.fileCacheHelper.loadJsFile('apps/transact/managers/ledgers/ledgermanager.js', function () {
  180. Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().UpdateBalanceSheetIndexes(postdata).then(function (response) {
  181. Unibase.Platform.Helpers.NavigationHelper.Instance().closePopUp();
  182. var detail_instance = Unibase.Themes.Compact.Components.Details.Instance();
  183. var containerid = $("._bizgaze_detail_container:visible").attr("id");
  184. var _installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
  185. var portletid = detail_instance.unibase_core_activeportletid;
  186. detail_instance.loadWidgets(_installedAppId, portletid, "#" + containerid + "");
  187. MessageHelper.Instance().showSuccess(response.message, '');
  188. });
  189. });
  190. }
  191. ledgerGroupAutoComplete(LedgerGroupId) {
  192. var ledgertypeid = Number($('#txt_Ledgertype_TRN20').val());
  193. var url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/ledgers/ledgergroupautocomplete/ledgertypeid/' + ledgertypeid;
  194. AutoCompleteHelper.getHelper().Create("#txt_Groups_TRN0", "#hf_LedgerGroupIdSelected_TRN0", url, function (response) {
  195. var data = response;
  196. });
  197. }
  198. ledgertypeAutoComplete(LedgertypeId) {
  199. var url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/ledgers/ledgertypeautocomplete';
  200. AutoCompleteHelper.getHelper().Create("#txt_Ledgertype_TRN20", "#hf_LedgerGroupIdSelected_TRN0", url, function (response) {
  201. var data = response;
  202. });
  203. }
  204. static Instance() {
  205. if (this.instance === undefined) {
  206. this.instance = new BalanceSheetIndexing();
  207. }
  208. return this.instance;
  209. }
  210. }
  211. Controls.BalanceSheetIndexing = BalanceSheetIndexing;
  212. })(Controls = Transact.Controls || (Transact.Controls = {}));
  213. })(Transact = Apps.Transact || (Apps.Transact = {}));
  214. })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
  215. })(Bizgaze || (Bizgaze = {}));