You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1030 lines
52 KiB

4 years ago
  1. (function ($) {
  2. "use strict";
  3. /*==================================================================
  4. [ Focus input ]*/
  5. $('.input100').each(function(){
  6. $(this).on('blur', function(){
  7. if($(this).val().trim() != "") {
  8. $(this).addClass('has-val');
  9. }
  10. else {
  11. $(this).removeClass('has-val');
  12. }
  13. })
  14. })
  15. /*==================================================================
  16. [ Validate ]*/
  17. var input = $('.validate-input .input100');
  18. $('.validate-form').on('submit',function(){
  19. var check = true;
  20. for(var i=0; i<input.length; i++) {
  21. if(validate(input[i]) == false){
  22. showValidate(input[i]);
  23. check=false;
  24. }
  25. }
  26. return check;
  27. });
  28. $('.validate-form .input100').each(function(){
  29. $(this).focus(function(){
  30. hideValidate(this);
  31. });
  32. });
  33. function validate (input) {
  34. if($(input).attr('type') == 'email' || $(input).attr('name') == 'email') {
  35. if($(input).val().trim().match(/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{1,5}|[0-9]{1,3})(\]?)$/) == null) {
  36. return false;
  37. }
  38. }
  39. else {
  40. if($(input).val().trim() == ''){
  41. return false;
  42. }
  43. }
  44. }
  45. function showValidate(input) {
  46. var thisAlert = $(input).parent();
  47. $(thisAlert).addClass('alert-validate');
  48. }
  49. function hideValidate(input) {
  50. var thisAlert = $(input).parent();
  51. $(thisAlert).removeClass('alert-validate');
  52. }
  53. /*==================================================================
  54. [ Show pass ]*/
  55. var showPass = 0;
  56. $('.btn-show-pass').on('click', function(){
  57. if(showPass == 0) {
  58. $(this).next('input').attr('type','text');
  59. $(this).addClass('active');
  60. showPass = 1;
  61. }
  62. else {
  63. $(this).next('input').attr('type','password');
  64. $(this).removeClass('active');
  65. showPass = 0;
  66. }
  67. });
  68. })(jQuery);
  69. /* VARIABLES GLOBALES PARA FUNCIONAMIENTO DE SCRIPT*************************************************************************/
  70. var lista_de_piletas = [];
  71. var lista_de_detalles_de_piletas;
  72. var lista_de_resultados;
  73. /* PATH PARA USAR AJAX EN EL SCRIPT***************************************************/
  74. //var path_piletas = "../ejemplo.json";
  75. var path_piletas = "../prgdmug/saldos.php";
  76. //var path_totales = "../totales.json";
  77. var path_totales = "../prgdmug/totales.php";
  78. //var path_detalles = "../detalles.json";
  79. var path_detalles = "../prgdmug/detalles.php";
  80. //var path_busqueda_por_totales= "../ejemplo.json";
  81. var path_busqueda_por_totales = "../prgdmug/productos.php";
  82. var path_busqueda = "../prgdmug/busqueda.php";
  83. var path_stocks = "../prgdmug/stocks.php";
  84. /* MOVIMIENTO DE BARRA PILETAS*************************************************************************/
  85. /*function move(id2,valor) {
  86. var elem = document.getElementById(id2);
  87. var height = 0;
  88. var alturaABAJO = valor;
  89. var alturaARRIBA = 100-alturaABAJO;
  90. var id = setInterval(frame, 10);
  91. function frame() {
  92. if (height >= alturaARRIBA) {
  93. clearInterval(id);
  94. elem.innerHTML = (100-height) * 1 + '%';
  95. } else {
  96. height++;
  97. elem.style.height = height + '%';
  98. elem.innerHTML = (100-height) * 1 + '%';
  99. }
  100. }
  101. }*/
  102. function move(id2,valor) {
  103. var elem = document.getElementById(id2);
  104. var height = 101; /*altura total del div*/
  105. if(valor > 100){
  106. valor = 100;
  107. }
  108. var alturaARRIBA = 100-valor; /*altura a la que debe quedar el div*/
  109. var id = setInterval(frame, 10);
  110. function frame() {
  111. if(height <= alturaARRIBA){
  112. clearInterval(id);
  113. elem.innerHTML = (100-height) * 1 + '%';
  114. } else {
  115. height--;
  116. elem.style.height = height + '%';
  117. elem.innerHTML = (100-height) * 1 + '%';
  118. }
  119. }
  120. }
  121. /* FORMATO PARA NUMEROS*************************************************************************/
  122. function number_format(amount, decimals) {
  123. amount += ''; // por si pasan un numero en vez de un string
  124. amount = parseFloat(amount.replace(/[^0-9\.]/g, '')); // elimino cualquier cosa que no sea numero o punto
  125. decimals = decimals || 0; // por si la variable no fue fue pasada
  126. // si no es un numero o es igual a cero retorno el mismo cero
  127. if (isNaN(amount) || amount === 0)
  128. return parseFloat(0).toFixed(decimals);
  129. // si es mayor o menor que cero retorno el valor formateado como numero
  130. amount = '' + amount.toFixed(decimals);
  131. var amount_parts = amount.split('.'),
  132. regexp = /(\d+)(\d{3})/;
  133. while (regexp.test(amount_parts[0]))
  134. amount_parts[0] = amount_parts[0].replace(regexp, '$1' + '.' + '$2');
  135. return amount_parts.join('.');
  136. }
  137. /* DESPLEGAR RESULTADO DE BUSQUEDA DE PILETAS*************************************************************************/
  138. function buscar_lista_de_piletas(datos){
  139. //menues
  140. $("#piletasOption").hide();$("#totalesOption").show();$("#buscarPiletas").show();
  141. //loader
  142. $(".container-login100").addClass(".altoTotal");
  143. $("#myContent").empty();
  144. $(".wrap-login100").hide();
  145. $("#myPreContent").show();
  146. //console.log(datos);
  147. $.ajax({url: path_busqueda_por_totales,
  148. type: 'POST',
  149. data: datos,
  150. dataType: 'json',
  151. success: function(response){
  152. lista_de_piletas = response.pileta;
  153. //console.log("El tag pileta es array: "+Array.isArray(response.pileta));
  154. //console.log("La cantidad de piletas es: "+response.pileta.length);
  155. //alert(response.pileta[0].desc);
  156. // alert(lista_de_piletas[0].desc);
  157. var valor =[];
  158. var miKey =[];
  159. $(".wrap-login100").show();
  160. $("#myPreContent").hide();
  161. $(".container-login100").removeClass(".altoTotal");
  162. if(Array.isArray(response.pileta)){
  163. for (var i = 0; i < response.pileta.length ; i++){
  164. var headerList = '<div class="row myItem entrar" id="item-'+response.pileta[i].id+'"><div class="col-2 myProgress"><div class="myBar" id="myBar'+i+'"></div></div><div class="col-10"> <div class=" row"> <h5 class=" col-10 myItem-title">'+response.pileta[i].desc+'</h5> <h4 class=" col-2 myItem-title">'+response.pileta[i].id+'</h4>';
  165. headerList +='<div class="col-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;" >saldo:</small><small class=" col-12 text-left text-nowrap "><b>'+number_format(response.pileta[i].saldo, 0)+'</b></small></div></div>';
  166. headerList +='<div class="col-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;" >azucar:</small><small class=" col-12 text-left">'+response.pileta[i].azucar+'</small></div></div>';
  167. headerList +='<div class="col-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;" >alcohol:</small><small class=" col-12 text-left">'+response.pileta[i].alcohol+'</small></div></div>';
  168. headerList +='<div class="col-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;" >acvol:</small><small class=" col-12 text-left">'+response.pileta[i].acvol+'</small></div></div>';
  169. $("#myContent").append(headerList);
  170. valor[i] = (response.pileta[i].saldo*100)/response.pileta[i].cap;
  171. miKey[i] = 'myBar'+i;
  172. }
  173. for(var i = 0; i < response.pileta.length ; i++){
  174. move(miKey[i],valor[i]);
  175. }
  176. }else{
  177. var headerList = '<div class="row myItem entrar" id="item-'+response.pileta.id+'"><div class="col-2 myProgress"><div class="myBar" id="myBar0"></div></div><div class="col-10"> <div class=" row"> <h5 class=" col-10 myItem-title">'+response.pileta.desc+'</h5> <h4 class=" col-2 myItem-title">'+response.pileta.id+'</h4>';
  178. headerList +='<div class="col-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;">saldo:</small><small class=" col-12 text-left text-nowrap "><b>'+number_format(response.pileta.saldo, 0)+'</b></small></div></div>';
  179. headerList +='<div class="col-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;">azucar:</small><small class=" col-12 text-left">'+response.pileta.azucar+'</small></div></div>';
  180. headerList +='<div class="col-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;">alcohol:</small><small class=" col-12 text-left">'+response.pileta.alcohol+'</small></div></div>';
  181. headerList +='<div class="col-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;">acvol:</small><small class=" col-12 text-left">'+response.pileta.acvol+'</small></div></div>';
  182. $("#myContent").append(headerList);
  183. valor[0] = (response.pileta.saldo*100)/response.pileta.cap;
  184. miKey[0] = 'myBar0';
  185. move(miKey[0],valor[0]);
  186. }
  187. $(".myItem").click(function(){
  188. var oID = $(this).attr("id");
  189. var res = oID.split("-");
  190. if(!document.getElementById( "details-"+res[1])){
  191. var parametros = {
  192. "pileta" : res[1]
  193. };
  194. crear_detalles_de_pileta(parametros, $(this));
  195. }
  196. });
  197. }});
  198. }
  199. function menuTogle(){
  200. $("#myMenuIcon").toggleClass("menuIcon");
  201. $("#myMenuIcon").toggleClass("cancelIcon");
  202. $("#myNavy").toggle();
  203. $("#myMenuDiv").toggleClass("backBlack");
  204. }
  205. $("#myMenuDiv").click(function(){
  206. menuTogle();
  207. });
  208. $(".nav-item").click(function(){
  209. menuTogle();
  210. });
  211. /* DESPLEGAR TOTALES*************************************************************************/
  212. function crear_lista_de_totales(){
  213. $("#totalesOption").hide();$("#piletasOption").show();$("#buscarPiletas").hide();
  214. //loader
  215. $(".container-login100").addClass(".altoTotal");
  216. $("#myContent").empty();
  217. $(".wrap-login100").hide();
  218. $("#myPreContent").show();
  219. var total_de_mosto, total_de_vino, lista_de_totales, nodo_aux;
  220. var lista_de_mosto= '';
  221. var lista_de_vino= '';
  222. $.ajax({url: path_totales,
  223. type: 'POST',
  224. dataType: 'json',
  225. success: function(response){
  226. lista_de_totales = response.total;
  227. /* quito efecto del loader y muestro container*/
  228. $(".container-login100").removeClass(".altoTotal");
  229. $("#myPreContent").hide();;
  230. $(".wrap-login100").show();
  231. for (let i = 0; i < response.total.length; i++) {
  232. nodo_aux = '<div class="row myTotalItem entrar totalItemContainer" id="'+response.total[i].codtipo+'|'+response.total[i].codcateg+'">';
  233. if (response.total[i].tipo === 'Mosto') {
  234. if(response.total[i].categ === 'TODO'){
  235. nodo_aux += '<h5 class=" col-12 " style="height: 40px; background-color: #339933; color: white; border-top-right-radius: 15px; padding-top:5px;">Totales de '+response.total[i].tipo+' - '+response.total[i].categ+'</h5>';
  236. }else{
  237. nodo_aux += '<h5 class=" col-12 " style="height: 40px; background-color: #9fdf9f; border-top-right-radius: 15px; padding-top:5px;">Totales de '+response.total[i].tipo+' - '+response.total[i].categ+'</h5>';
  238. }
  239. }
  240. if (response.total[i].tipo === 'Vino') {
  241. if(response.total[i].categ === 'TODO'){
  242. nodo_aux += '<h5 class=" col-12 " style="height: 40px; background-color: #0033cc; color: white; border-top-right-radius: 15px; padding-top:5px;">Totales de '+response.total[i].tipo+' - '+response.total[i].categ+'</h5>';
  243. }else{
  244. nodo_aux += '<h5 class=" col-12 " style="height: 40px; background-color: #99b3ff; border-top-right-radius: 15px; padding-top:5px;">Totales de '+response.total[i].tipo+' - '+response.total[i].categ+'</h5>';
  245. }
  246. }
  247. nodo_aux += '<div class="col-12 col-sm-12 totalItem" style="color: #6c757d; height:30px;" >';
  248. nodo_aux += '<small class="" style="">cantidad:&nbsp;&nbsp;&nbsp;</small>';
  249. nodo_aux += '<small class=" valueSmall" style="position: relative;">'+number_format((parseFloat(response.total[i].cant)/100), 0)+'</small></div>';
  250. nodo_aux += '<div class="col-6 col-sm-3 totalItem" style="color: #6c757d; height:30px;" >';
  251. nodo_aux += '<small>azucar:&nbsp;</small>';
  252. nodo_aux += '<small class="valueSmall">'+response.total[i].azucar+'</small></div>';
  253. nodo_aux += '<div class="col-6 col-sm-3 totalItem" style="color: #6c757d; height:30px;" >';
  254. nodo_aux += '<small>alco:&nbsp;</small>';
  255. nodo_aux += '<small class="valueSmall">'+response.total[i].alco+'</small></div>';
  256. nodo_aux += '<div class="col-6 col-sm-3 totalItem" style="color: #6c757d; height:30px;" >';
  257. nodo_aux += '<small>acidez:&nbsp;</small>';
  258. nodo_aux += '<small class="valueSmall">'+response.total[i].acidez+'</small></div>';
  259. nodo_aux += '<div class="col-6 col-sm-3 totalItem" style="color: #6c757d; height:30px;" >';
  260. nodo_aux += '<small>ph:&nbsp;</small>';
  261. nodo_aux += '<small class="valueSmall">'+response.total[i].ph+'</small></div>';
  262. nodo_aux += '<div class="col-6 col-sm-3 totalItem" style="color: #6c757d; height:30px;" >';
  263. nodo_aux += '<small>acvol:&nbsp;</small>';
  264. nodo_aux += '<small class="valueSmall">'+response.total[i].acvol+'</small></div>';
  265. nodo_aux += '<div class="col-6 col-sm-3 totalItem" style="color: #6c757d; height:30px;" >';
  266. nodo_aux += '<small>so2l:&nbsp;</small>';
  267. nodo_aux += '<small class="valueSmall">'+response.total[i].so2l+'</small></div>';
  268. nodo_aux += '<div class="col-6 col-sm-3 totalItem" style="color: #6c757d; height:30px;" >';
  269. nodo_aux += '<small>so2t:&nbsp;</small>';
  270. nodo_aux += '<small class="valueSmall">'+response.total[i].so2t+'</small></div>';
  271. nodo_aux += '<div class="col-6 col-sm-3 totalItem" style="color: #6c757d; height:30px;" >';
  272. nodo_aux += '<small>col420:&nbsp;</small>';
  273. nodo_aux += '<small class="valueSmall">'+response.total[i].col420+'</small></div>';
  274. nodo_aux += '<div class="col-6 col-sm-3 totalItem" style="color: #6c757d; height:30px;" >';
  275. nodo_aux += '<small>col520:&nbsp;</small>';
  276. nodo_aux += '<small class="valueSmall">'+response.total[i].col520+'</small></div>';
  277. nodo_aux += '<div class="col-6 col-sm-3 totalItem" style="color: #6c757d; height:30px;" >';
  278. nodo_aux += '<small>colsum:&nbsp;</small>';
  279. nodo_aux += '<small class="valueSmall">'+response.total[i].colsum+'</small></div>';
  280. nodo_aux += '<div class="col-6 col-sm-3 totalItem" style="color: #6c757d; height:30px;" >';
  281. nodo_aux += '<small>colmat:&nbsp;</small>';
  282. nodo_aux += '<small class="valueSmall">'+response.total[i].colmat+'</small></div>';
  283. nodo_aux += '<div class="col-6 col-sm-3 totalItem" style="color: #6c757d; height:30px;" >';
  284. nodo_aux += '<small>colind:&nbsp;</small>';
  285. nodo_aux += '<small class="valueSmall">'+response.total[i].colind+'</small></div>';
  286. nodo_aux += '</div>';
  287. if (response.total[i].tipo === 'Mosto') {
  288. if(response.total[i].categ === 'TODO'){
  289. total_de_mosto = nodo_aux;
  290. }else{
  291. lista_de_mosto += nodo_aux;
  292. }
  293. }
  294. if (response.total[i].tipo === 'Vino') {
  295. if(response.total[i].categ === 'TODO'){
  296. total_de_vino += nodo_aux;
  297. }else{
  298. lista_de_vino += nodo_aux;
  299. }
  300. }
  301. }
  302. $("#myContent").append(lista_de_mosto);
  303. $("#myContent").append(total_de_mosto);
  304. $("#myContent").append(lista_de_vino);
  305. $("#myContent").append(total_de_vino);
  306. $(".myTotalItem").click(function(){
  307. var oID = $(this).attr("id");
  308. var res = oID.split("|");
  309. var parametros = {
  310. "codtipo" : res[0],
  311. "codcateg" : res[1]
  312. };
  313. buscar_lista_de_piletas(parametros);
  314. });
  315. }
  316. });
  317. }
  318. /* DESPLEGAR DETALLES DE PILETAS*************************************************************************/
  319. function crear_detalles_de_pileta(nro,ido){
  320. $.ajax({url: path_detalles,
  321. type: 'POST',
  322. data: nro,
  323. dataType: 'json',
  324. success: function(response){
  325. //console.log(response.detalle);
  326. var nodos = document.getElementsByClassName("salir");
  327. if(nodos.length>0){
  328. for(var i = 0 ; i < nodos.length ; i++){
  329. nodos[i].remove();
  330. }
  331. }
  332. /*ARMO PANTALLA*/
  333. var detallesList = '<div class="col-12 myItem-details salir" style="" id="details-'+nro+'">';
  334. detallesList += '<div class="row myItem-details-row">';
  335. detallesList += '<div class="col-6 col-sm-4">';
  336. detallesList += '<small style="color: #6c757d;">cap:&nbsp;&nbsp;&nbsp;</small>';
  337. var cap_number = parseInt(response.detalle.cap, 10);
  338. detallesList += '<small class="valueSmall2">'+number_format(cap_number, 0)+'</small></div>';
  339. detallesList += '<div class="col-6 col-sm-4">';
  340. detallesList += '<small style="color: #6c757d;">saldo:&nbsp;&nbsp;&nbsp;</small>';
  341. var saldo_number = parseInt(response.detalle.saldo, 10);
  342. detallesList += '<small class="valueSmall2"><b>'+(number_format(saldo_number, 0))+'</b></small></div>';
  343. detallesList += '<div class="col-6 col-sm-4">';
  344. detallesList += '<small style="color: #6c757d;">alco:&nbsp;</small>';
  345. detallesList += '<small class="valueSmall2">'+response.detalle.alco+'</small></div>';
  346. detallesList += '<div class="col-6 col-sm-4">';
  347. detallesList += '<small style="color: #6c757d;">azucar:&nbsp;</small>';
  348. detallesList += '<small class="valueSmall2">'+response.detalle.azucar+'</small></div>';
  349. detallesList += '<div class="col-6 col-sm-4">';
  350. detallesList += '<small style="color: #6c757d;">acidez:&nbsp;</small>';
  351. detallesList += '<small class="valueSmall2">'+response.detalle.acidez+'</small></div>';
  352. detallesList += '<div class="col-6 col-sm-4">';
  353. detallesList += '<small style="color: #6c757d;">ph:&nbsp;</small>';
  354. detallesList += '<small class="valueSmall2">'+response.detalle.ph+'</small></div>';
  355. detallesList += '<div class="col-6 col-sm-4">';
  356. detallesList += '<small style="color: #6c757d;">acvol:&nbsp;</small>';
  357. detallesList += '<small class="valueSmall2">'+response.detalle.acvol+'</small></div>';
  358. detallesList += '<div class="col-6 col-sm-4">';
  359. detallesList += '<small style="color: #6c757d;">so2l:&nbsp;</small>';
  360. detallesList += '<small class="valueSmall2">'+response.detalle.so2l+'</small></div>';
  361. detallesList += '<div class="col-6 col-sm-4">';
  362. detallesList += '<small style="color: #6c757d;">so2t:&nbsp;</small>';
  363. detallesList += '<small class="valueSmall2">'+response.detalle.so2t+'</small></div>';
  364. detallesList += '<div class="col-6 col-sm-4">';
  365. detallesList += '<small style="color: #6c757d;">col420:&nbsp;</small>';
  366. detallesList += '<small class="valueSmall2">'+response.detalle.col420+'</small></div>';
  367. detallesList += '<div class="col-6 col-sm-4">';
  368. detallesList += '<small style="color: #6c757d;">col520:&nbsp;</small>';
  369. detallesList += '<small class="valueSmall2">'+response.detalle.col520+'</small></div>';
  370. detallesList += '<div class="col-6 col-sm-4">';
  371. detallesList += '<small style="color: #6c757d;">colsum:&nbsp;</small>';
  372. detallesList += '<small class="valueSmall2">'+response.detalle.colsum+'</small></div>';
  373. detallesList += '<div class="col-6 col-sm-4">';
  374. detallesList += '<small style="color: #6c757d;">colmat:&nbsp;</small>';
  375. detallesList += '<small class="valueSmall2">'+response.detalle.colmat+'</small></div>';
  376. detallesList += '<div class="col-6 col-sm-4">';
  377. detallesList += '<small style="color: #6c757d;">colind:&nbsp;</small>';
  378. detallesList += '<small class="valueSmall2">'+response.detalle.colind+'</small></div>';
  379. detallesList += '</div></div>';
  380. ido.after(detallesList);
  381. $(".myItem-details").click(function(){
  382. $(this).remove();
  383. });
  384. }
  385. });
  386. }
  387. /* DESPLEGAR LISTA DE PILETAS
  388. *************************************************************************/
  389. function crear_lista_de_piletas(){
  390. $("#piletasOption").hide();$("#totalesOption").show();
  391. $("#buscarPiletas").show();
  392. //loader
  393. $(".container-login100").addClass(".altoTotal");
  394. $("#myContent").empty();
  395. $(".wrap-login100").hide();
  396. $("#myPreContent").show();
  397. $.ajax({url: path_piletas,
  398. type: 'POST',
  399. dataType: 'json',
  400. success: function(response){
  401. lista_de_piletas = response.pileta;
  402. //console.log(response);
  403. var valor =[];
  404. var miKey =[];
  405. $(".container-login100").removeClass(".altoTotal");
  406. $("#myPreContent").hide();;
  407. $(".wrap-login100").show();
  408. for (var i = 0; i < response.pileta.length ; i++){
  409. var headerList = '<div class="row myItem entrar" id="item-'+response.pileta[i].id+'">';
  410. headerList +='<div class="col-2 myProgress">';
  411. headerList +='<div class="myBar" id="myBar'+i+'"></div></div>';
  412. headerList +='<div class="col-10"> <div class=" row"> <h5 class=" col-10 myItem-title">'+response.pileta[i].desc+'</h5> <h4 class=" col-2 myItem-title">'+response.pileta[i].id+'</h4>';
  413. headerList +='<div class="col-4 col-sm-2 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;">saldo:</small><small class=" col-12 text-left text-nowrap "><b>'+number_format(response.pileta[i].saldo, 0)+'</b></small></div></div>';
  414. headerList +='<div class="col-4 col-sm-2 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;">azucar:</small><small class=" col-12 text-left">'+response.pileta[i].azucar+'</small></div></div>';
  415. headerList +='<div class="col-4 col-sm-2 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;">alcohol:</small><small class=" col-12 text-left">'+response.pileta[i].alcohol+'</small></div></div>';
  416. headerList +='<div class="col-6 col-sm-2 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;">acvol:</small><small class=" col-12 text-left">'+response.pileta[i].acvol+'</small></div></div>';
  417. headerList +='<div class="col-6 col-sm-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;">ulmov.:</small><small class=" col-12 text-left">'+response.pileta[i].ulmov+'</small></div></div>';
  418. $("#myContent").append(headerList);
  419. valor[i] = (response.pileta[i].saldo*100)/response.pileta[i].cap;
  420. miKey[i] = 'myBar'+i;
  421. }
  422. for(var i = 0; i < response.pileta.length ; i++){
  423. move(miKey[i],valor[i]);
  424. }
  425. $(".myItem").click(function(){
  426. var oID = $(this).attr("id");
  427. var res = oID.split("-");
  428. if(!document.getElementById( "details-"+res[1])){
  429. var parametros = {
  430. "pileta" : res[1]
  431. };
  432. crear_detalles_de_pileta(parametros, $(this));
  433. }
  434. });
  435. }});
  436. }
  437. $("#buscarPiletas").click(function(){
  438. //$("#myQuest").toggleClass("invisible");
  439. $("#myQuest").toggle();
  440. });
  441. $("#cerrarQuest").click(function(){
  442. //$("#myQuest").toggleClass("invisible");
  443. $("#myQuest").toggle();
  444. });
  445. /* ELEMENTOS DEL FORMULARIO BUSQUEDA
  446. ***********************************************************************************/
  447. function agreagar_options_quest(obj){
  448. while (obj.hasChildNodes()) {
  449. obj.removeChild(obj.firstChild);
  450. }
  451. var nombres = []; var agregar_item=" ";
  452. var misCampos = document.getElementsByClassName("selectColection");
  453. for (i = 0; i < misCampos.length; i++) {
  454. //console.log(misCampos[i].value) ;
  455. nombres.push (misCampos[i].value);
  456. }
  457. if (nombres.indexOf("alcohol") < 0) {
  458. agregar_item += '<option value="alcohol">Alcohol</option>';}
  459. if (nombres.indexOf("azucar") < 0) {
  460. agregar_item += '<option value="azucar">Az&uacute;car</option>';}
  461. if (nombres.indexOf("acidez") < 0) {
  462. agregar_item += '<option value="acidez">Acidez</option>';}
  463. if (nombres.indexOf("ph") < 0) {
  464. agregar_item += '<option value="ph">Ph</option>';}
  465. if (nombres.indexOf("acvol") < 0) {
  466. agregar_item += '<option value="acvol">Volatil</option>';}
  467. if (nombres.indexOf("so2l") < 0) {
  468. agregar_item += '<option value="so2l">So2l</option>';}
  469. if (nombres.indexOf("so2t") < 0) {
  470. agregar_item += '<option value="so2t">So2t</option>';}
  471. if (nombres.indexOf("colsum") < 0) {
  472. agregar_item += '<option value="colsum">Colsum</option>';}
  473. if (nombres.indexOf("colmat") < 0) {
  474. agregar_item += '<option value="colmat">Colmat</option>';}
  475. if (nombres.indexOf("colin") < 0) {
  476. agregar_item += '<option value="colin">Colind</option>';
  477. }
  478. $(obj).append(agregar_item);
  479. }
  480. function agregar_item_quest(cant_item){
  481. cant_item=cant_item+1;
  482. var agregar_item = '<form class="myFormQuest row" id="mySubFormQuest-'+cant_item+'">';
  483. // agregar_item += '<select class=" form-control form-control-sm col-3 selectColection" id="myItemQuest-'+cant_item+'-1" name="campo" onclick="agreagar_options_quest(this)">';
  484. agregar_item += '<select class=" form-control form-control-sm col-3 selectColection" id="myItemQuest-'+cant_item+'-1" name="campo" >';
  485. var misCampos = document.getElementsByClassName("selectColection");
  486. var nombres = [];
  487. for (i = 0; i < misCampos.length; i++) {
  488. //console.log(misCampos[i].value) ;
  489. nombres.push (misCampos[i].value);
  490. }
  491. if (nombres.indexOf("alcohol") < 0) {
  492. agregar_item += '<option value="alcohol">Alcohol</option>';}
  493. if (nombres.indexOf("azucar") < 0) {
  494. agregar_item += '<option value="azucar">Az&uacute;car</option>';}
  495. if (nombres.indexOf("acidez") < 0) {
  496. agregar_item += '<option value="acidez">Acidez</option>';}
  497. if (nombres.indexOf("ph") < 0) {
  498. agregar_item += '<option value="ph">Ph</option>';}
  499. if (nombres.indexOf("acvol") < 0) {
  500. agregar_item += '<option value="acvol">Volatil</option>';}
  501. if (nombres.indexOf("so2l") < 0) {
  502. agregar_item += '<option value="so2l">So2l</option>';}
  503. if (nombres.indexOf("so2t") < 0) {
  504. agregar_item += '<option value="so2t">So2t</option>';}
  505. if (nombres.indexOf("colsum") < 0) {
  506. agregar_item += '<option value="colsum">Colsum</option>';}
  507. if (nombres.indexOf("colmat") < 0) {
  508. agregar_item += '<option value="colmat">Colmat</option>';}
  509. if (nombres.indexOf("colin") < 0) {
  510. agregar_item += '<option value="colin">Colind</option>';
  511. }
  512. /* agregar_item += '<option value="alcohol">Alcohol</option>';
  513. agregar_item += '<option value="azucar">Az&uacute;car</option>';
  514. agregar_item += '<option value="acidez">Acidez</option>';
  515. agregar_item += '<option value="ph">Ph</option>';
  516. agregar_item += '<option value="acvol">Volatil</option>';
  517. agregar_item += '<option value="so2l">So2l</option>';
  518. agregar_item += '<option value="so2t">So2t</option>';
  519. agregar_item += '<option value="colsum">Colsum</option>';
  520. agregar_item += '<option value="colmat">Colmat</option>';
  521. agregar_item += '<option value="colin">Colind</option>';
  522. */
  523. agregar_item += '</select>';
  524. agregar_item += '<select class="form-control form-control-sm col-4" id="myItemQuest-'+cant_item+'-2" name="operador">';
  525. agregar_item += '<optionvalue="0">igual que</option><option value="2">mayor que</option><option value="4">menor que</option><option value="1">distinto que</option></select>';
  526. agregar_item += '<input type="text" class="form-control form-control-sm col-3 col-sm-4" id="myItemQuest-'+cant_item+'-3" name="valor" placeholder="000.00">';
  527. agregar_item += '<div class=" col-1 quitarFiltro" id="myItemQuest-'+cant_item+'-3" onclick="quitar_item_quest(this)">&nbsp;&nbsp;-</div></form>';
  528. $("#questingThings").append(agregar_item);
  529. return cant_item;
  530. }
  531. function quitar_item_quest(obj){
  532. var oID = obj.attributes[1].value;
  533. var res = oID.split("-");
  534. var parent = document.getElementById("questingThings");
  535. var child = document.getElementById("mySubFormQuest-"+res[1]);
  536. parent.removeChild(child);
  537. }
  538. function validar_input_isNum(){
  539. var elems = document.body.getElementsByTagName("input");
  540. var flag = true;
  541. for(i = 0; i < elems.length; i++) {
  542. var valor = elems[i].value;
  543. var res = valor.match(/^[0-9]+([.][0-9]+)?$/);
  544. if(!res) {
  545. flag = false;
  546. }
  547. }
  548. if(flag==false)
  549. alert("Los campos de entrada solo pueden tener números con el formato (000.00) y no deben estar vacíos");
  550. return flag;
  551. }
  552. function busqueda_de_filtros(){
  553. var elems = document.body.getElementsByTagName("form");
  554. var parametros = "{";
  555. for(i = 0; i < elems.length; i++) {
  556. var aux = (elems[i].id).split("-");
  557. var campoi = document.getElementById("myItemQuest-"+aux[1]+"-1").value;
  558. var operator = document.getElementById("myItemQuest-"+aux[1]+"-2").value;
  559. var values = document.getElementById("myItemQuest-"+aux[1]+"-3").value;
  560. var myObj = {campo: campoi, operador: operator, valor: values};
  561. if (i==0) {
  562. parametros += '"'+i+'":'+JSON.stringify(myObj);
  563. }else{
  564. parametros += ',"'+i+'":'+JSON.stringify(myObj);
  565. }
  566. //console.log(parametros);
  567. }
  568. parametros += "}";
  569. parametros2 = JSON.parse(parametros);
  570. /*
  571. var parametros = new Object();
  572. for(i = 0; i < elems.length; i++) {
  573. var aux = (elems[i].id).split("-");
  574. var campoi = document.getElementById("myItemQuest-"+aux[1]+"-1").value;
  575. var operator = document.getElementById("myItemQuest-"+aux[1]+"-2").value;
  576. var values = document.getElementById("myItemQuest-"+aux[1]+"-3").value;
  577. var myObj = {campo: campoi, operador: operator, valor: values};
  578. parametros.i= myObj;
  579. } */
  580. /* var parametros= {
  581. "codtipo" : res[0],
  582. "codcateg" : res[1]
  583. };
  584. */
  585. // console.log(parametros2);
  586. //loader
  587. $(".container-login100").addClass(".altoTotal");
  588. $("#myContent").empty();
  589. $(".wrap-login100").hide();
  590. $("#myPreContent").show();
  591. $("#myQuest").hide();
  592. $.ajax({url: path_busqueda,
  593. type: 'POST',
  594. data: parametros2,
  595. dataType: 'json',
  596. success: function(response){
  597. lista_de_piletas = response.pileta;
  598. // console.log(lista_de_piletas);
  599. var valor =[];
  600. var miKey =[];
  601. $(".wrap-login100").show();
  602. $("#myPreContent").hide();
  603. $(".container-login100").removeClass(".altoTotal");
  604. if(Array.isArray(response.pileta)){
  605. for (var i = 0; i < response.pileta.length ; i++){
  606. var headerList = '<div class="row myItem entrar" id="item-'+response.pileta[i].id+'"><div class="col-2 myProgress"><div class="myBar" id="myBar'+i+'"></div></div><div class="col-10"> <div class=" row"> <h5 class=" col-10 myItem-title">'+response.pileta[i].desc+'</h5> <h4 class=" col-2 myItem-title">'+response.pileta[i].id+'</h4>';
  607. headerList +='<div class="col-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;" >saldo:</small><small class=" col-12 text-left text-nowrap "><b>'+number_format(response.pileta[i].saldo, 0)+'</b></small></div></div>';
  608. headerList +='<div class="col-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;" >azucar:</small><small class=" col-12 text-left">'+response.pileta[i].azucar+'</small></div></div>';
  609. headerList +='<div class="col-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;" >alcohol:</small><small class=" col-12 text-left">'+response.pileta[i].alcohol+'</small></div></div>';
  610. headerList +='<div class="col-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;" >acvol:</small><small class=" col-12 text-left">'+response.pileta[i].acvol+'</small></div></div>';
  611. $("#myContent").append(headerList);
  612. valor[i] = (response.pileta[i].saldo*100)/response.pileta[i].cap;
  613. miKey[i] = 'myBar'+i;
  614. }
  615. for(var i = 0; i < response.pileta.length ; i++){
  616. move(miKey[i],valor[i]);
  617. }
  618. }else{
  619. var headerList = '<div class="row myItem entrar" id="item-'+response.pileta.id+'"><div class="col-2 myProgress"><div class="myBar" id="myBar0"></div></div><div class="col-10"> <div class=" row"> <h5 class=" col-10 myItem-title">'+response.pileta.desc+'</h5> <h4 class=" col-2 myItem-title">'+response.pileta.id+'</h4>';
  620. headerList +='<div class="col-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;">saldo:</small><small class=" col-12 text-left text-nowrap "><b>'+number_format(response.pileta.saldo, 0)+'</b></small></div></div>';
  621. headerList +='<div class="col-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;">azucar:</small><small class=" col-12 text-left">'+response.pileta.azucar+'</small></div></div>';
  622. headerList +='<div class="col-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;">alcohol:</small><small class=" col-12 text-left">'+response.pileta.alcohol+'</small></div></div>';
  623. headerList +='<div class="col-3 myItem-element"> <div class="row"><small class="col-12 " style="color: #6c757d;">acvol:</small><small class=" col-12 text-left">'+response.pileta.acvol+'</small></div></div>';
  624. $("#myContent").append(headerList);
  625. valor[0] = (response.pileta.saldo*100)/response.pileta.cap;
  626. miKey[0] = 'myBar0';
  627. move(miKey[0],valor[0]);
  628. }
  629. $(".myItem").click(function(){
  630. var oID = $(this).attr("id");
  631. var res = oID.split("-");
  632. if(!document.getElementById( "details-"+res[1])){
  633. var parametros = {
  634. "pileta" : res[1]
  635. };
  636. crear_detalles_de_pileta(parametros, $(this));
  637. }
  638. });
  639. }});
  640. }
  641. function openStock(evt, stockName) {
  642. // Declare all variables
  643. var i, tabcontent, tablinks, aux;
  644. if (document.getElementById(stockName).style.display==="block") {
  645. aux=1;
  646. }
  647. // Get all elements with class="tabcontent" and hide them
  648. tabcontent = document.getElementsByClassName("tabcontent");
  649. for (i = 0; i < tabcontent.length; i++) {
  650. tabcontent[i].style.display = "none";
  651. }
  652. // Get all elements with class="tablinks" and remove the class "active"
  653. tablinks = document.getElementsByClassName("tablinks");
  654. for (i = 0; i < tablinks.length; i++) {
  655. tablinks[i].className = tablinks[i].className.replace(" active", "");
  656. }
  657. // Show the current tab, and add an "active" class to the button that opened the tab
  658. if (aux==1) {
  659. document.getElementById(stockName).style.display = "none";
  660. }else{
  661. document.getElementById(stockName).style.display = "block";
  662. evt.currentTarget.className += " active";
  663. }
  664. // console.log("igualdad es= "+document.getElementById(stockName).style.display);
  665. }
  666. function formatNumber(num) {
  667. if (!num || num == 'NaN') return '-';
  668. if (num == 'Infinity') return '&#x221e;';
  669. num = num.toString().replace(/\$|\,/g, '');
  670. if (isNaN(num))
  671. num = "0";
  672. sign = (num == (num = Math.abs(num)));
  673. num = Math.floor(num * 100 + 0.50000000001);
  674. cents = num % 100;
  675. num = Math.floor(num / 100).toString();
  676. if (cents < 10)
  677. cents = "0" + cents;
  678. for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3) ; i++)
  679. num = num.substring(0, num.length - (4 * i + 3)) + '.' + num.substring(num.length - (4 * i + 3));
  680. return (((sign) ? '' : '-') + num + ',' + cents);
  681. }
  682. function verStocks(){
  683. $("#piletasOption").show();
  684. $("#totalesOption").show();
  685. $("#buscarPiletas").hide();
  686. $("#myQuest").hide();
  687. //loader
  688. $(".container-login100").addClass(".altoTotal");
  689. $("#myContent").empty();
  690. $(".wrap-login100").hide();
  691. $("#myPreContent").show();
  692. $.ajax({url: path_stocks,
  693. type: 'POST',
  694. dataType: 'json',
  695. success: function(response){
  696. //lista_de_stocks = response.salsto;
  697. //console.log(lista_de_stocks.estado);
  698. var lista_de_stocks = response.salsto;
  699. //console.log(lista_de_stocks[1]);
  700. console.log(lista_de_stocks);
  701. $(".container-login100").removeClass(".altoTotal");
  702. $("#myPreContent").hide();;
  703. $(".wrap-login100").show();
  704. var aux= '';
  705. var headerList = '<div class="tab">';
  706. headerList += '<button class="tablinks col-6 active" onclick="openStock(event, \'Insumos\')">Insumos</button>';
  707. headerList += '<button class="tablinks col-6" onclick="openStock(event, \'Planchadas\')">Planchadas</button></div>';
  708. headerList += '<div id="Insumos" class="tabcontent" style="display: block;">';
  709. for (i = 0; i < lista_de_stocks.length; i++) {
  710. if (lista_de_stocks[i].estado=="STKMP") {
  711. headerList += '<div class="row myItem" style="height:60px; font-size: 0.8rem;">';
  712. headerList += '<div class="col-12" style="height:30px; padding-top: 5px;">'+lista_de_stocks[i].descprod+'</div>';
  713. headerList += '<div class="col-4" style="height:30px;"><small style="color: #6c757d;">Cod.:&nbsp;&nbsp;</small>'+lista_de_stocks[i].producto+' '+lista_de_stocks[i].umed+'</div>';
  714. headerList += '<div class="col-4" style="height:30px;"><small style="color: #6c757d;">Cant.:&nbsp;&nbsp;</small>'+number_format((lista_de_stocks[i].cant/100), 0)+'</div>';
  715. headerList += '<div class="col-4" style="height:30px;"><small style="color: #6c757d;">Ult-mov.:&nbsp;&nbsp;</small>'+lista_de_stocks[i].ulfec+'</div>';
  716. headerList += '</div>';
  717. }else{
  718. aux += '<div class="row myItem" style="height:60px; font-size: 0.8rem;">';
  719. aux += '<div class="col-12" style="height:30px; padding-top: 5px;">'+lista_de_stocks[i].descprod+'</div>';
  720. aux += '<div class="col-4" style="height:30px;"><small style="color: #6c757d;">Cod.:&nbsp;&nbsp;</small>'+lista_de_stocks[i].producto+' '+lista_de_stocks[i].umed+'</div>';
  721. aux += '<div class="col-4" style="height:30px;"><small style="color: #6c757d;">Cant.:&nbsp;&nbsp;</small>'+number_format((lista_de_stocks[i].cant/100), 0)+'</div>';
  722. aux += '<div class="col-4" style="height:30px;"><small style="color: #6c757d;">Ult-mov.:&nbsp;&nbsp;</small>'+lista_de_stocks[i].ulfec+'</div>';
  723. aux += '</div>';
  724. }
  725. }
  726. headerList += '</div>';
  727. headerList += '<div id="Planchadas" class="tabcontent">';
  728. headerList += aux;
  729. headerList += '</div>';
  730. $("#myContent").append(headerList);
  731. }
  732. });
  733. }
  734. function verStocks(){
  735. //buttoms
  736. $("#piletasOption").show();
  737. $("#totalesOption").show();
  738. $("#buscarPiletas").hide();
  739. $("#myQuest").hide();
  740. //loader
  741. $(".container-login100").addClass(".altoTotal");
  742. $("#myContent").empty();
  743. $(".wrap-login100").hide();
  744. $("#myPreContent").show();
  745. $.ajax({url: path_stocks,
  746. type: 'POST',
  747. dataType: 'json',
  748. success: function(response){
  749. var lista_de_stocks = response.salsto;
  750. console.log(lista_de_stocks);
  751. $(".container-login100").removeClass(".altoTotal");
  752. $("#myPreContent").hide();;
  753. $(".wrap-login100").show();
  754. var headerList = '<div class="tab row" style="margin-top:16px;">';
  755. headerList += '<button class="tablinks col-12" id="tablink_planch" onclick="openStock(event, \'planch_id\')">Planchadas</button>';
  756. headerList += '<button class="tablinks col-12 active" style="border-top: 1px solid gray;" id="tablink_ven" onclick="openStock(event, \'ven_id\')">Insumos Venta</button>';
  757. headerList += '<button class="tablinks col-12" style="border-top: 1px solid gray;" id="tablink_bode" onclick="openStock(event, \'bode_id\')">Insumos Bodega</button>';
  758. headerList += '<button class="tablinks col-12" style="border-top: 1px solid gray;" id="tablink_frac" onclick="openStock(event, \'frac_id\')">Insumos Fraccionamiento</button>';
  759. headerList += '<button class="tablinks col-12" style="border-top: 1px solid gray;" id="tablink_gral" onclick="openStock(event, \'gral_id\')">Insumos General</button>';
  760. headerList += '</div>';
  761. var divs_planchadas = '<div id="planch_id" class="tabcontent">';
  762. var divs_ventas = '<div id="ven_id" class="tabcontent">';
  763. var divs_frac = '<div id="frac_id" class="tabcontent">';
  764. var divs_bode = '<div id="bode_id" class="tabcontent">';
  765. var divs_gral = '<div id="gral_id" class="tabcontent">';
  766. for (i = 0; i < lista_de_stocks.length; i++) {
  767. var fecha = lista_de_stocks[i].ulfec;
  768. if (lista_de_stocks[i].estado=="STKMP") {
  769. if(lista_de_stocks[i].uso=="FRAC"){
  770. divs_frac += '<div class="row myItem" style="height:60px; font-size: 0.8rem;">';
  771. divs_frac += '<div class="col-md-12 col-7" style="height:30px; padding-top: 5px; text-align: left;">'+lista_de_stocks[i].descprod+'</div>';
  772. divs_frac += '<div class="col-md-4 col-5" style="height:30px; text-align: left;"><small style="color: #6c757d; text-align: left;">Cod.:&nbsp;&nbsp;</small>'+lista_de_stocks[i].producto+'</div>';
  773. divs_frac += '<div class="col-md-4 col-6" style="height:30px; text-align: left;"><small style="color: #6c757d; text-align: left;">Cant.:&nbsp;&nbsp;</small>'+number_format((lista_de_stocks[i].cant/100), 0)+' '+lista_de_stocks[i].umed+'</div>';
  774. divs_frac += '<div class="col-md-4 col-6" style="height:30px;"><small style="color: #6c757d;">Ult-mov.:&nbsp;&nbsp;</small>'+fecha+'</div>';
  775. divs_frac += '</div>';
  776. }else if (lista_de_stocks[i].uso=="BODE") {
  777. divs_bode +='<div class="row myItem" style="height:60px; font-size: 0.8rem;">';
  778. divs_bode += '<div class="col-md-12 col-7" style="height:30px; padding-top: 5px; text-align: left;">'+lista_de_stocks[i].descprod+'</div>';
  779. divs_bode += '<div class="col-md-4 col-5" style="height:30px; text-align: left;"><small style="color: #6c757d; text-align: left;">Cod.:&nbsp;&nbsp;</small>'+lista_de_stocks[i].producto+'</div>';
  780. divs_bode += '<div class="col-md-4 col-6" style="height:30px; text-align: left;"><small style="color: #6c757d; text-align: left;">Cant.:&nbsp;&nbsp;</small>'+number_format((lista_de_stocks[i].cant/100), 0)+' '+lista_de_stocks[i].umed+'</div>';
  781. divs_bode += '<div class="col-md-4 col-6" style="height:30px;"><small style="color: #6c757d;">Ult-mov.:&nbsp;&nbsp;</small>'+fecha+'</div>';
  782. divs_bode += '</div>';
  783. }else if (lista_de_stocks[i].uso=="VENTA") {
  784. divs_ventas += '<div class="row myItem" style="height:60px; font-size: 0.8rem;">';
  785. divs_ventas += '<div class="col-md-12 col-7" style="height:30px; padding-top: 5px; text-align: left;">'+lista_de_stocks[i].descprod+'</div>';
  786. divs_ventas += '<div class="col-md-4 col-5" style="height:30px; text-align: left;"><small style="color: #6c757d; text-align: left;">Cod.:&nbsp;&nbsp;</small>'+lista_de_stocks[i].producto+'</div>';
  787. divs_ventas += '<div class="col-md-4 col-6" style="height:30px; text-align: left;"><small style="color: #6c757d; text-align: left;">Cant.:&nbsp;&nbsp;</small>'+number_format((lista_de_stocks[i].cant/100), 0)+' '+lista_de_stocks[i].umed+'</div>';
  788. divs_ventas += '<div class="col-md-4 col-6" style="height:30px;"><small style="color: #6c757d;">Ult-mov.:&nbsp;&nbsp;</small>'+fecha+'</div>';
  789. divs_ventas += '</div>';
  790. }else{
  791. divs_gral += '<div class="row myItem" style="height:60px; font-size: 0.8rem;">';
  792. divs_gral += '<div class="col-md-12 col-7" style="height:30px; padding-top: 5px; text-align: left;">'+lista_de_stocks[i].descprod+'</div>';
  793. divs_gral += '<div class="col-md-4 col-5" style="height:30px; text-align: left;"><small style="color: #6c757d; text-align: left;">Cod.:&nbsp;&nbsp;</small>'+lista_de_stocks[i].producto+'</div>';
  794. divs_gral += '<div class="col-md-4 col-6" style="height:30px; text-align: left;"><small style="color: #6c757d; text-align: left;">Cant.:&nbsp;&nbsp;</small>'+number_format((lista_de_stocks[i].cant/100), 0)+' '+lista_de_stocks[i].umed+'</div>';
  795. divs_gral += '<div class="col-md-4 col-6" style="height:30px;"><small style="color: #6c757d;">Ult-mov.:&nbsp;&nbsp;</small>'+fecha+'</div>';
  796. divs_gral += '</div>';
  797. }
  798. }else{
  799. divs_planchadas += '<div class="row myItem" style="height:60px; font-size: 0.8rem;">';
  800. divs_planchadas += '<div class="col-md-12 col-7" style="height:30px; padding-top: 5px; text-align: left;">'+lista_de_stocks[i].descprod+'</div>';
  801. divs_planchadas += '<div class="col-md-4 col-5" style="height:30px; text-align: left;"><small style="color: #6c757d; text-align: left;">Cod.:&nbsp;&nbsp;</small>'+lista_de_stocks[i].producto+'</div>';
  802. divs_planchadas += '<div class="col-md-4 col-6" style="height:30px; text-align: left;"><small style="color: #6c757d; text-align: left;">Cant.:&nbsp;&nbsp;</small>'+number_format((lista_de_stocks[i].cant/100), 0)+' '+lista_de_stocks[i].umed+'</div>';
  803. divs_planchadas += '<div class="col-md-4 col-6" style="height:30px;"><small style="color: #6c757d;">Ult-mov.:&nbsp;&nbsp;</small>'+fecha+'</div>';
  804. divs_planchadas += '</div>';
  805. }
  806. }
  807. divs_planchadas += '</div>';
  808. divs_ventas += '</div>';
  809. divs_frac += '</div>';
  810. divs_bode += '</div>';
  811. divs_gral += '</div>';
  812. $("#myContent").append(headerList);
  813. $("#tablink_planch").append(divs_planchadas);
  814. $("#tablink_ven").append(divs_ventas);
  815. $("#tablink_bode").append(divs_bode);
  816. $("#tablink_frac").append(divs_frac);
  817. $("#tablink_gral").append(divs_gral);
  818. }
  819. });
  820. }
  821. function topFunction() {
  822. document.body.scrollTop = 0; // For Safari
  823. document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
  824. }
  825. /* COMIENZA LA CARGA DE COMPORTAMIENTO DE PAGINA ***************************************************************************************/
  826. var cant_item= 1;
  827. $( document ).ready(function() {
  828. $("#myNavy").removeClass("invisible");
  829. $("#myNavy").hide();
  830. $("#myQuest").removeClass("invisible");
  831. $("#myQuest").hide();
  832. $("#totalesOption").hide();
  833. $(".wrap-login100").removeClass("invisible");
  834. $(".wrap-login100").hide();
  835. $("#piletasOption").click(function(){
  836. crear_lista_de_piletas();
  837. });
  838. $("#totalesOption").click(function(){
  839. crear_lista_de_totales();
  840. $("#buscarPiletas").hide();
  841. });
  842. $("#stocksOption").click(function(){
  843. verStocks();
  844. // getStocks();
  845. });
  846. $(".botonAgregar").click(function(){
  847. cant_item= agregar_item_quest(cant_item);
  848. });
  849. $(".botonBuscar").click(function(){
  850. var isOk= validar_input_isNum();
  851. if (isOk==true)
  852. busqueda_de_filtros();
  853. });
  854. $("#myMenuIcon2").hide();
  855. crear_lista_de_totales();
  856. $(window).scroll(function(){
  857. if ($(this).scrollTop() > 250) {
  858. $('#boton-top').fadeIn();
  859. } else {
  860. $('#boton-top').fadeOut();
  861. }
  862. });
  863. });