����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 74.208.127.88 / Your IP : 18.191.154.2 Web Server : Apache/2.4.41 (Ubuntu) System : Linux ubuntu 5.4.0-163-generic #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/app6/application/sales2/ |
Upload File : |
$(document).ready( function () { $('#txtsalesdate,#txtfirstperiod,#txtlastperiod,#txtfirstperiodc,#txtlastperiodc,#txtfirstperiodc_pend,#txtlastperiodc_pend').datepicker({ format: 'dd-mm-yyyy', }); function reposition() { var modal = $(this), dialog = modal.find('.modal-dialog'); modal.css('display', 'block'); dialog.css("margin-top", Math.max(0, ($(window).height() - dialog.height()) / 2)); } $('.modal').on('show.bs.modal', reposition); $(window).on('resize', function() { $('.modal:visible').each(reposition); }); $( "#modaleditparam" ).find( ".modal-footer" ).remove(); $( "#modaleditparam4" ).find( ".modal-footer" ).remove(); $( "#modalpayment" ).find( ".modal-footer" ).remove(); decimal(); money(); init_data(); init_data2(); init_data4(); //actualizacion 04/2021 init_dataA(); $(document).ready(function(){ $("#txtsearchitem2").keypress(function(e) { if(e.which == 13) { var trx = $("#txtsearchitem2").val(); var qty = 1; var separador = "&"; var arrayDeCadenas = trx.split(separador); if(trx.indexOf(separador) != -1 ) { trx = arrayDeCadenas[0]; qty = arrayDeCadenas[1]; temptabel2(trx,qty); }else{ temptabel2(trx,qty); } } }); }); $(document).ready(function(){ $("#txtsearchitem3").keypress(function(e) { //deshabilitamos el input de cantidad if(e.which == 13) { var trx = $("#txtsearchitem3").val(); var qty = 1; var separador = "&"; var arrayDeCadenas = trx.split(separador); if(trx.indexOf(separador) != -1 ) { trx = arrayDeCadenas[0]; qty = arrayDeCadenas[1]; temptabelBascula(trx,qty); }else{ temptabelBascula(trx,qty); } } }); }); $(document).ready(function(){ $("#txtsearchitem4").keypress(function(e) { if(e.which == 13) { var trx = $("#txtsearchitem4").val(); var qty = 1; var separador = "&"; var arrayDeCadenas = trx.split(separador); if(trx.indexOf(separador) != -1 ) { trx = arrayDeCadenas[0]; qty = arrayDeCadenas[1]; temptabel4(trx,qty); }else{ temptabel4(trx,qty); } } }); }); $( "#txtsearchitem4" ).autocomplete({ search : function(){$(this).addClass('working');}, open : function(){$(this).removeClass('working');}, source: function(request, response) { $.getJSON("autocomplete_item.php", { term: $('#txtsearchitem4').val() }, response); }, minLength:1, select:function(event, ui){ var qty = 1; temptabel4(ui.item.barcode, qty); } }).autocomplete( "instance" )._renderItem = function( ul, item ) { return $( "<li>" ) .append( "<dl><dt>"+item.label + "</dt>"+item.price+item.note+ "</dl>" ) .appendTo( ul ); }; $(document).on("click",'#btnExistenciaCodigo',function(){ var trx = $("#txtItem").val(); var qty = 10; temptabel3(trx,qty); }); $( "#txtsearchitem" ).autocomplete({ search : function(){$(this).addClass('working');}, open : function(){$(this).removeClass('working');}, source: function(request, response) { $.getJSON("autocomplete_item.php", { term: $('#txtsearchitem').val() }, response); }, minLength:1, select:function(event, ui){ temptabel(ui.item.id_item); } }).autocomplete( "instance" )._renderItem = function( ul, item ) { return $( "<li>" ) .append( "<dl><dt>"+item.label + "</dt>"+item.price+item.note+ "</dl>" ) .appendTo( ul ); }; $( "#txtclient" ).autocomplete({ search : function(){$(this).addClass('working');}, open : function(){$(this).removeClass('working');}, source: function(request, response) { $.getJSON("autocomplete_client.php", { term: $('#txtclient').val() }, response); }, minLength:1, select:function(event, ui){ $("#client_id").val(ui.item.id_client); $("#cliente").val(ui.item.value); $("#credito").val(ui.item.credito); } }).autocomplete( "instance" )._renderItem = function( ul, item ) { return $( "<li>" ) .append( "<dl><dt>"+item.id + "</dt>"+item.name+item.rfc+ "</dl>" ) .appendTo( ul ); }; $( "#txtvendedor" ).autocomplete({ search : function(){$(this).addClass('working');}, open : function(){$(this).removeClass('working');}, source: function(request, response) { $.getJSON("autocomplete_client.php", { term: $('#txtvendedor').val() }, response); }, minLength:1, select:function(event, ui){ $("#client_id").val(ui.item.id_client); $("#ClienteIdS").val(ui.item.value); $("#ClienteId").val(ui.item.credito); } }).autocomplete( "instance" )._renderItem = function( ul, item ) { return $( "<li>" ) .append( "<dl><dt>"+item.id + "</dt>"+item.name+item.rfc+ "</dl>" ) .appendTo( ul ); }; $("#txtmoneypay").keydown(function(event){ var total = parseFloat(cleanString($("#txttotal").html())); var paid = parseFloat(cleanString($(this).val())); var paid2 = parseFloat(cleanString($("#txtmoneypay2").val())); if(paid < total) { var returnchange = total - paid; $("#txtmoneypay2").val(returnchange); } }); }); $(document).ready(function(){ $("#selector-forma").load('../model/select.php'); }); $(document).ready(function(){ $("#selector-forma2").load('../model/select2.php'); }); $(document).ready(function(){ $("#selector-seller").load('../model/select_seller.php'); }); $(document).ready(function(){ $("#stock_id").load('../model/stock_id.php'); }); $(document).on("blur","#selector-seller",function (){ var valor = document.getElementById('selector-seller').value ; document.getElementById('id_seller').innerHTML = valor; document.getElementById('id_seller_ok').value = valor; }); $(document).on("click",'#btncheckpass',function(){ var trx = $("#txthiddentrans").val(); var id_sales = $("#txthidetrxid").val(); if(id_sales == '' || id_sales == null) { $.notify({ message: "No hay trasacciones" },{ type: 'warning', delay: 5000, }); return; } var pass=$("#txtpass").val(); var value = { pass : pass, method : "check_password" }; $.ajax( { url : "../model/check_password.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.auth == true) { $("#passwordmodal").modal("hide"); $("#txtpass").val(""); delete_trans(id_sales); }else{ $.notify({ message: "Password does not match" },{ type: 'danger', delay: 10000, }); set_focus("#txtpass"); return; } }, error: function(jqXHR, textStatus, errorThrown) { loading_stop(); } }); }); $(document).on("click",'#btncheckpass_OC',function(){ var trx = $("#txthiddentrans_OC").val(); var id_sales = $("#txthidetrxid_OC").val(); if(id_sales == '' || id_sales == null) { $.notify({ message: "No hay trasacciones" },{ type: 'warning', delay: 5000, }); return; } var pass=$("#txtpass_OC").val(); var value = { pass : pass, id_sales : id_sales, method : "check_password" }; $.ajax( { url : "../model/check_password.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.auth == true) { $("#modal_BuscarOC").modal('hide'); $("#passwordmodal_OC").modal('hide'); var xid_sales = 20; setTimeout(function() { $.redirect("http://localhost/pos36/pos11/index.php?view=byreceive&id="+ xid_sales,{ id_sales: xid_sales,duplikasi:0},'POST','_blank'); }, 500); // After 420 ms }else{ $.notify({ message: "Contraseña Incorrecta" },{ type: 'danger', delay: 1000, }); set_focus("#txtpass_OC"); return; } }, error: function(jqXHR, textStatus, errorThrown) { loading_stop(); } }); }); function delete_trans(sale_id) { var value = { sale_id : sale_id, method : "delete_trans" }; loading_start(); $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result == true) { $("#btnfiltersale").click(); }else{ $.notify({ message: "Error al borrar transaccion , Error : "+data.error },{ type: 'danger', delay: 10000, }); } loading_stop(); }, error: function(jqXHR, textStatus, errorThrown) { loading_stop(); } }); } $(document).on("click",".btndeletesale",function(){ $("#passwordmodal").modal("show"); $("#txthidetrxid").val($(this).attr("sale_id")); $("#txthiddentrans").val("D"); $("#notepassword").html("Por Favor Ingrese contraseña para continuar!"); set_focus("#txtpass"); }); $(document).on("click",".btnPedir",function(){ var barcode=$(this).attr("val"); var trx = barcode; var qty = 10; temptabel4(trx,qty); }); $(document).on("click","#btn-search-report",function(){ var xid_sales = "J210928001"; var mapForm = document.createElement("form"); mapForm.target = "Map"; mapForm.method = "POST"; // or "post" if appropriate mapForm.action = "struck.php"; var mapInput = document.createElement("input"); mapInput.type = "hidden"; mapInput.name = "id_sales"; mapInput.value = xid_sales; mapInput.visibility = true; mapForm.appendChild(mapInput); document.body.appendChild(mapForm); map = window.open("", "Map", "status=0,title=0,height=600,width=800,scrollbars=1"); if (map) { mapForm.submit(); } else { $.notify({ message: " Falla de Ventana Reporte a Sistemas " },{ type: 'Debes permitir ventanas emergentes para que puedas imprimir ticket', delay: 5000, }); } }); $(document).on("click","#btnpayment",function(){ var id_trans = $("#txtidsales").val(); var tgl_trans = $("#txtsalesdate").val(); var id_seller = $("#id_seller_ok").val(); var ClienteIdS = $("#ClienteIdS").val(); var Cliente = $("#txtclient").val(); if(Cliente == '' || Cliente == null) { getClient(); } if(id_seller == '' || id_seller == null){ $.notify({ message: "Selecciona Vendedor para continuar!" },{ type: 'warning', delay: 3000, }); return; set_focus("#txtclient"); } if(ClienteIdS == '' || ClienteIdS == null){ $.notify({ message: "Debe Seleccionar mostrador o cliente!" },{ type: 'warning', delay: 1000, }); return; } if(id_trans == '' || id_trans == null){ $.notify({ message: "Sin Id de Venta/transaccion!" },{ type: 'warning', delay: 10000, }); return; } if(tgl_trans == '' || tgl_trans == null){ $.notify({ message: "Revise Fecha de Venta!" },{ type: 'warning', delay: 10000, }); return; } var value = { method : "check_tempsale" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.tempsale == false) { $.notify({ message: "No hay registros agregados!" },{ type: 'warning', delay: 1000, }); set_focus("#txtsearchitem"); return; }else { var total = parseFloat(cleanString($("#txttotal").html())); $("#txtinfoidtrans").val($("#txtidsales").val()); $("#txtinfodatetrans").val($("#txtsalesdate").val()); $("#txtgrandtotal").val(addCommas(total)); $("#txtmoneypay").val(addCommas(total)); $("#txtoddmoney").val(0); $("#modalpayment").modal("show"); set_focus("#txtmoneypay"); } }, error: function(jqXHR, textStatus, errorThrown) { } }); }) $(document).on("click","#btnpayment2",function(){ var id_trans = $("#txtidsales").val(); var tgl_trans = $("#txtsalesdate").val(); $("#txtclient1").val($("#txtclient").val()); if(id_trans == '' || id_trans == null){ $.notify({ message: "por favor ingrese id de la transaccion!" },{ type: 'warning', delay: 1000, }); return; } if(tgl_trans == '' || tgl_trans == null){ $.notify({ message: "por favor ingrese una fecha!" },{ type: 'warning', delay: 1000, }); return; } var value = { method : "check_tempsale" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.tempsale == false) { $.notify({ message: "No hya registros en la venta!" },{ type: 'warning', delay: 1000, }); set_focus("#txtsearchitem"); return; }else { var total = parseInt(cleanString($("#txttotal").html())); $("#txtinfoidtrans").val($("#txtidsales").val()); $("#txtinfodatetrans").val($("#txtsalesdate").val()); $("#txtgrandtotal2").val(addCommas(total)); $("#txtmoneypay2").val(addCommas(total)); $("#txtoddmoney2").val(0); $("#modalpayment2").modal("show"); set_focus("#txtmoneypay2"); } }, error: function(jqXHR, textStatus, errorThrown) { } }); }) $(document).on("click","#btn-search-oc",function(){ $('#modal_BuscarOC').modal('show'); }) $(document).on("click","#btn-modal-serach-oc",function(){ let oc=document.getElementById('input-oc').value; }) $(document).on("click","#btntotalizarOC",function(){ var id_trans = $("#txtidsales0C").val(); var tgl_trans = $("#txtsalesdate").val(); if(id_trans == '' || id_trans == null){ $.notify({ message: "Sin Id de /transaccion!" },{ type: 'warning', delay: 1000, }); return; } if(tgl_trans == '' || tgl_trans == null){ $.notify({ message: "Revise Fecha!" },{ type: 'warning', delay: 1000, }); return; } var value = { method : "check_tempsale4" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.tempsale == false) { $.notify({ message: "No hay registros agregados!" },{ type: 'warning', delay: 1000, }); set_focus("#txtsearchitem"); return; }else { $("#modalpayment").modal("show"); set_focus("#txtprovider"); } }, error: function(jqXHR, textStatus, errorThrown) { alert("Error Ordenes de compra"); } }); }) $(document).on("click","#btncotizar",function(){ var id_trans = $("#txtidsales").val(); var tgl_trans = $("#txtsalesdate").val(); $("#txtclient1").val($("#txtclient").val()); if(id_trans == '' || id_trans == null){ $.notify({ message: "Sin Id de Cotizacion/transaccion!" },{ type: 'warning', delay: 5000, }); return; } if(tgl_trans == '' || tgl_trans == null){ $.notify({ message: "Revise Fecha de Cotizacion!" },{ type: 'warning', delay: 5000, }); return; } var value = { method : "check_tempsale" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.tempsale == false) { $.notify({ message: "No se han seleccionado artículos en la lista del carrito de compras.!" },{ type: 'warning', delay: 5000, }); set_focus("#txtsearchitem2"); return; }else { var total = parseFloat(cleanString($("#txttotal").html())); $("#txtinfoidtrans3").val($("#txtidsales").val()); $("#txtinfodatetrans3").val($("#txtsalesdate").val()); $("#txtgrandtotal3").val(addCommas(total)); $("#txtmoneypay").val(addCommas(total)); $("#txtoddmoney3").val(0); $("#modalpayment3").modal("show"); set_focus("#txtmoneypay3"); } }, error: function(jqXHR, textStatus, errorThrown) { } }); }) $(document).on("blur","#txtmoneypay",function (){ set_focus("#btnsavetrans"); var total = parseFloat(cleanString($("#txttotal").html())); var paid = parseFloat(cleanString($(this).val())); var returnchange = paid - total; if(isNaN(returnchange)) { returnchange = 0; $("#txtmoneypay").val(addCommas(total)); }else{ if(paid < total){ $("#txtoddmoney").val(0); $.notify({ message: "SE REGISTRA FORMA DE PAGO 2" },{ type: 'info', delay: 5000, }); }else{ returnchange.toLocaleString('es-MX'); $("#txtmoneypay2").val(0); $("#txtoddmoney").val(addCommas(returnchange.toFixed(2))); } } }); $(document).on("blur","#txtmoneypay3",function (){ var total = parseFloat(cleanString($("#txttotal").html())); var paid = parseFloat(cleanString($(this).val())); var returnchange = total - paid; if(isNaN(returnchange)) { returnchange = 0; $("#txtmoneypay3").val(addCommas(total)); } if(paid < total){ returnchange.toLocaleString('es-MX'); $("#txtoddmoney3").val(addCommas(returnchange)); }else{ $("#txtmoneypay3").val(addCommas(total)); $("#txtoddmoney3").val(0); } }); $(document).on("click","#btnsavetrans",function() { $("#btnsavetrans").prop('disabled', true); var sale_id = $("#txtidsales").val(); var client_id = $("#client_id").val(); $("#ClienteIdS").val(client_id); $("#ClienteId").val(client_id); var sale_date = $("#txtsalesdate").val(); var paid = parseFloat(cleanString($("#txtmoneypay").val())); var total = parseFloat(cleanString($("#txtgrandtotal").val())); var disc_prcn = parseFloat(cleanString($("#txttotaldiscprc").val())); var disc_rp = parseFloat(cleanString($("#txttotaldiscrp").val())); var f_pago1 =$("#selector-forma").val(); var f_pago2 =$("#selector-forma2").val(); var id_seller_ok =$("#id_seller_ok").val(); var note= $("#txtnote").val(); $("#btnsavetrans").prop('disabled', true); proccess_waiting("#infoproccesspayment"); var value = { sale_id : sale_id, client_id : client_id, sale_date : sale_date, total : total, paid : paid, disc_prcn : disc_prcn, disc_rp : disc_rp, note : note, f_pago1 : f_pago1, f_pago2 : f_pago2, id_seller_ok : id_seller_ok, method : "save_trans" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { $("#btnsavetrans").prop('disabled', false); var data = jQuery.parseJSON(data); console.log(data.result); if(data.result == false){ $.notify({ message: " Revisar Tabla " },{ type: 'danger', delay: 5000, }); return; } if(data.result == true){ var xid_sales = data.xsale_id; $("#modalpayment").modal('hide'); var mapForm = document.createElement("form"); mapForm.target = "Map"; mapForm.method = "POST"; // or "post" if appropriate mapForm.action = "nota_jual.php"; var mapInput = document.createElement("input"); mapInput.type = "hidden"; mapInput.name = "id_sales"; mapInput.value = xid_sales; mapInput.visibility = true; mapForm.appendChild(mapInput); document.body.appendChild(mapForm); map = window.open("", "Map", "status=0,title=0,height=600,width=800,scrollbars=1"); if (map) { mapForm.submit(); } else { $.notify({ message: " Revisar Tabla " },{ type: 'Debes permitir ventanas emergentes para que puedas imprimir ticket', delay: 5000, }); } //window.open("http://localhost/pos36/application/sales/v_pos.php"); $.notify({ message: " Venta Registrada " },{ type: 'info', delay: 1000, }); reset_data(); }else{ $.notify({ message: "Error save transaction, error :"+data.error },{ type: 'danger', delay: 10000, }); } }, error: function(jqXHR, textStatus, errorThrown) { $("#infoproccesspayment").html(""); $("#btnsavetrans").prop('disabled', false); } }); }) $(document).on("click","#btnsavetrans3",function() { var sale_id = $("#txtidsales").val(); var sale_date = $("#txtsalesdate").val(); var paid = parseFloat(cleanString($("#txtmoneypay3").val())); var total = parseFloat(cleanString($("#txtgrandtotal3").val())); var disc_prcn = parseFloat(cleanString($("#txttotaldiscprc").val())); var disc_rp = parseFloat(cleanString($("#txttotaldiscrp").val())); var note= $("#txtnote3").val(); var credito = $("#credito").val(); var id_client = $("#client_id").val(); var credit_amount = parseFloat(cleanString($("#txtoddmoney3").val())); swal({ title: "Cotizacion", text: "Guardar Cotizacion?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Guardar", closeOnConfirm: true }, function(){ $("#btnsavetrans3").prop('disabled', true); proccess_waiting("#infoproccesspayment3"); var value = { sale_id : sale_id, sale_date : sale_date, total : total, paid : paid, id_client : id_client, disc_prcn : disc_prcn, disc_rp : disc_rp, note : note, credit_amount : credit_amount, method : "save_trans3" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { $("#btnsavetrans3").prop('disabled', false); $("#infoproccesspayment3").html(""); var data = jQuery.parseJSON(data); if(data.result == true){ var xid_sales = data.xsale_id; $("#modalpayment3").modal('hide'); setTimeout(function() { $.redirect("http://localhost/pos36/pos11/index.php?view=cotizations&id="+ xid_sales,{ id_sales: xid_sales,duplikasi:0},'POST','_blank'); }, 500); // After 420 ms $.notify({ message: "Cotizacion Registrada Exitosamente!" },{ type: 'success', delay: 1000, }); reset_data(); }else{ $.notify({ message: "Error save transaction, error :"+data.error },{ type: 'danger', delay: 10000, }); } }, error: function(jqXHR, textStatus, errorThrown) { $("#infoproccesspayment3").html(""); $("#btnsavetrans3").prop('disabled', false); } }); }); }) $(document).on("click","#btnsavetrans4",function() { var sale_id = $("#txtidsales0C").val(); var sale_date = $("#txtsalesdate").val(); var paid = parseFloat(cleanString($("#txtmoneypayOC").val())); var total = parseFloat(cleanString($("#txttotalOC2").val())); var disc_prcn = parseFloat(cleanString($("#txttotaldiscprcOC").val())); var note= $("#txtnoteOC").val(); var credit_amount = parseFloat(cleanString($("#txtoddmoneyOC").val())); var id_client = $("#txtprovider").val(); var disc_rp = $("#txtprovider").val(); swal({ title: "Orden de Compra", text: "Recibir Orden de Compra?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Guardar", closeOnConfirm: true }, function(){ $("#btnsavetrans4").prop('disabled', true); var value = { sale_id : sale_id, sale_date : sale_date, total : total, paid : paid, id_client : id_client, disc_prcn : disc_prcn, disc_rp : disc_rp, note : note, credit_amount : credit_amount, method : "save_trans4" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { $("#btnsavetrans4").prop('disabled', false); var data = jQuery.parseJSON(data); if(data.result == true){ $.notify({ message: " Registro Exitosamente, Mercancia ingresada al inventario!" },{ type: 'success', delay: 1000, }); var xid_sales = sale_id; $("#modalpayment").modal('hide'); setTimeout(function() { $.redirect("./pos11/index.php?view=res2&id="+ xid_sales,{ id_sales: xid_sales,duplikasi:0},'POST','_blank'); }, 500); // After 420 ms //application/sales/v_pos.php reset_dataOC(); }else{ $.notify({ message: "Error al guardar orden, error :"+data.error },{ type: 'danger', delay: 1000, }); } }, error: function(jqXHR, textStatus, errorThrown) { $("#btnsavetrans4").prop('disabled', false); } }); }); }) $(document).on("click","#btnsaveOC",function() { var sale_id = $("#txtidsales0C").val(); var sale_date = $("#txtsalesdate").val(); var paid = parseFloat(cleanString($("#txtmoneypayOC").val())); var total = parseFloat(cleanString($("#txttotalOC2").val())); var disc_prcn = parseFloat(cleanString($("#txttotaldiscprcOC").val())); var note= $("#txtnoteOC").val(); var credit_amount = parseFloat(cleanString($("#txtoddmoneyOC").val())); var id_client = $("#txtprovider").val(); var disc_rp = $("#txtprovider").val(); swal({ title: "Orden de Compra", text: "Guardar Orden de Compra Pendiente?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Guardar", closeOnConfirm: true }, function(){ $("#btnsaveOC").prop('disabled', true); var value = { sale_id : sale_id, sale_date : sale_date, total : total, paid : paid, id_client : id_client, disc_prcn : disc_prcn, disc_rp : disc_rp, note : note, credit_amount : credit_amount, method : "save_trans5" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { $("#btnsavetrans4").prop('disabled', false); var data = jQuery.parseJSON(data); if(data.result == true){ $.notify({ message: "Se Guardo Orden de Compra!" },{ type: 'success', delay: 5000, }); var xid_sales = sale_id; $("#ConfOCmodal").modal('hide'); reset_dataOC(); }else{ $.notify({ message: "Error OC GUARDADA, # :"+data.error },{ type: 'danger', delay: 1000, }); } }, error: function(jqXHR, textStatus, errorThrown) { $("#btnsavetrans4").prop('disabled', false); } }); }); }) //guardamos ahora si la salida de mercancia a venta por repartidor 27/09/21 $(document).on("click","#btnsaveOC2",function() { var sale_id = $("#txtidsales0C").val(); var sale_date = $("#txtsalesdate").val(); var paid = parseFloat(cleanString($("#txtmoneypayOC").val())); var total = parseFloat(cleanString($("#txttotalOC2").val())); var disc_prcn = parseFloat(cleanString($("#txttotaldiscprcOC").val())); var note= $("#txtnoteOC").val(); var credit_amount = parseFloat(cleanString($("#txtoddmoneyOC").val())); var id_client = $("#id_seller").val(); var disc_rp = $("#txtprovider").val(); swal({ title: "Orden de Salida", text: "Guardar Orden de Salda a Venta?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Guardar", closeOnConfirm: true }, function(){ $("#btnsaveOC2").prop('disabled', true); $("#ConfOCmodal").modal('hide'); var value = { sale_id : sale_id, sale_date : sale_date, total : total, paid : paid, id_client : id_client, disc_prcn : disc_prcn, disc_rp : disc_rp, note : note, credit_amount : credit_amount, method : "save_trans5" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { $("#btnsavetrans4").prop('disabled', false); var data = jQuery.parseJSON(data); if(data.result == true){ $.notify({ message: "Se Guardo Orden de Salida!" },{ type: 'success', delay: 5000, }); var xid_sales = sale_id; $("#ConfOCmodal").modal('hide'); reset_dataOC(); }else{ $.notify({ message: "Error OS GUARDADA, # :"+data.error },{ type: 'danger', delay: 1000, }); } }, error: function(jqXHR, textStatus, errorThrown) { $("#btnsavetrans4").prop('disabled', false); } }); }); }) $(document).on("click",".btnCargarOC_pend",function(){ $("#passwordmodal_OC").modal("show"); $("#txthidetrxid_OC").val($(this).attr("sale_id")); $("#txthiddentrans_OC").val("D"); $("#notepassword").html("Por Favor Ingrese contraseña para continuar!"); set_focus("#txtpass_OC"); }); $(document).on("click",".btndiscprc",function (e){ e.preventDefault(); $("#txttotaldiscprc").prop('disabled', false); $("#txttotaldiscrp").prop('disabled', true); $("#txttotaldiscprc").focus(); }); $(document).on("click",".btndiscrp",function (e){ e.preventDefault(); $("#txttotaldiscrp").prop('disabled', false); $("#txttotaldiscprc").prop('disabled', true); $("#txttotaldiscrp").focus(); }); $(document).on("blur","#txttotaldiscprc",function(){ if (isNaN($(this).val())) { $(this).val(0); } if($(this).val() > 100 || $(this).val() < 0 ){ $(this).val(0); var prcn = 0; }else{ var prcn = parseFloat($(this).val()); } var subtotal = parseFloat(cleanString($("#txtsubtotal").val())); var discrp = subtotal * (prcn/100); var total = subtotal - discrp; $("#txttotaldiscrp").val(addCommas(discrp)); $("#txttotal").html(addCommas(total)); }); $(document).on("blur","#txttotaldiscrp",function(){ var subtotal = parseFloat(cleanString($("#txtsubtotal").val())); if(parseFloat(cleanString($(this).val())) > subtotal || parseFloat(cleanString($(this).val())) < 0 ){ $(this).val(0); var discrp = 0; }else{ var discrp = parseFloat(cleanString($(this).val())); } var prcn = (discrp/subtotal) * 100; if(isNaN(prcn)){ prcn = 0; } if(isNaN(discrp)){ discrp = 0; } var total = subtotal - discrp; $("#txttotaldiscprc").val(prcn.toFixed(2)); $("#txttotal").html(addCommas(total)); }); $(document).on("click",".btndelete",function(){ var id_item = $(this).attr("id_item"); var value = { id_item: id_item, method : "deletedetail" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var table = $('#table_transaction').DataTable(); table.ajax.reload( null, false ); refresh_total(); }else{ $.notify({ message: "Error delete list item , error :"+data.error },{ type: 'danger', delay: 10000, }); } }, error: function(jqXHR, textStatus, errorThrown) { } }); }); $(document).on("click",".btndelete2",function(){ var id_item = $(this).attr("id_item"); var value = { id_item: id_item, method : "deletedetail2" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var table = $('#table_last_transactionEx').DataTable(); table.ajax.reload( null, false ); refresh_total(); }else{ $.notify({ message: "Error delete list item , error :"+data.error },{ type: 'danger', delay: 1000, }); } }, error: function(jqXHR, textStatus, errorThrown) { } }); }); $(document).on("click",".btndelete4",function(){ var id_item = $(this).attr("id_item"); var value = { id_item: id_item, method : "deletedetail4" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var table = $('#table_transactionP').DataTable(); table.ajax.reload( null, false ); refresh_total(); }else{ $.notify({ message: "Error delete list item , error :"+data.error },{ type: 'danger', delay: 10000, }); } }, error: function(jqXHR, textStatus, errorThrown) { } }); }); $(document).on("click",".editparam",function(){ var dataparam=$(this).attr("dataparam"); var datatitle=$(this).attr("datatitle"); var val=$(this).attr("val"); $("#txtvalue").val(val); var key = $(this).attr("key"); $("#txtkey").val(key) $( "#modaleditparam" ).find( ".modal-title" ).html(datatitle); $("#txtdataparam").val(dataparam); $("#modaleditparam").modal("show"); set_focus("#txtvalue"); }) $(document).on("click","#btnubahedit",function(){ var nilai = cleanString($("#txtvalue").val()); var jenis = $("#txtdataparam").val(); var key = $("#txtkey").val(); var value = { nilai: nilai, jenis:jenis, key:key, method : "updatedetail" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var table = $('#table_transaction').DataTable(); table.ajax.reload( null, false ); $( "#modaleditparam" ).modal("hide"); refresh_total(); }else{ $.notify({ message: "Error edit , error :"+data.error },{ type: 'danger', delay: 10000, }); } }, error: function(jqXHR, textStatus, errorThrown) { } }); }); $(document).on("click","#btnubahedit4",function(){ var nilai = cleanString($("#txtvalueP").val()); var jenis = $("#txtdataparamP").val(); var key = $("#txtkeyP").val(); var value = { nilai: nilai, jenis:jenis, key:key, method : "updatedetail4" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var table = $('#table_transactionP').DataTable(); table.ajax.reload( null, false ); $( "#modaleditparamPurchase" ).modal("hide"); refresh_totalOC(); }else{ $.notify({ message: "Error edit , error :"+data.error },{ type: 'danger', delay: 10000, }); } }, error: function(jqXHR, textStatus, errorThrown) { } }); }); $(document).on("click",".btnnota",function(){ var idjual = $(this).attr("id_sales"); var jnsjual = $(this).attr("jns_jual"); if(jnsjual == 1) { $.redirect("nota_jual.php",{ id_sales: idjual,duplikasi:1},'POST','_blank'); }else{ $.redirect("nota_tempo.php",{ id_sales: idjual,duplikasi:1},'POST','_blank'); } }); $(document).on("click","#btncancel",function(){ swal({ title: "Reset", text: "Eliminar Operacion Actual?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Reset", closeOnConfirm: true }, function(){ reset_data(); }); }); $(document).on("click","#btncancelOC",function(){ swal({ title: "Reset", text: "Eliminar Operacion Actual?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Reset", closeOnConfirm: true }, function(){ reset_dataOC(); }); }); function temptabel(idbrg){ var value = { id_item: idbrg, method : "save_temptable" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result == 1){ if(data.msg == "mal"){ $.notify({ message: " Error de Precio $0.00" },{ type: 'warning', delay: 2000, }); }else{ var table = $('#table_transaction').DataTable(); table.ajax.reload( null, false ); $("#txtsearchitem").val(""); refresh_total(); set_focus("#txtsearchitem"); $("#txtsearchitem").val(""); var promox = data.promo; $.notify({ message: " Aplica Promocion: " + promox },{ type: 'info', delay: 1000, }); } }else{ $.notify({ message: "Error Producto Verifique" },{ type: 'danger', delay: 1000, }); $("#txtsearchitem2").val(""); } }, error: function(jqXHR, textStatus, errorThrown) { $.notify({ message: "Error Producto/Tabla" },{ type: 'danger', delay: 1000, }); $("#txtsearchitem2").val(""); } }); } function temptabel2(idbrg,qty){ var value = { id_item: idbrg, qty: qty, method : "save_temptable2" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var table = $('#table_transaction').DataTable(); table.ajax.reload( null, false ); $("#txtsearchitem").val(""); refresh_total(); set_focus("#txtsearchitem2"); $("#txtsearchitem2").val(""); var promox = data.promo; $.notify({ message: " Aplica Promocion: " + promox },{ type: 'info', delay: 5000, }); }else{ if(data.msg == "mal"){ $.notify({ message: "Error de Producto, Verifique Codigo/Precio" },{ type: 'danger', delay: 5000, }); $("#txtsearchitem2").val(""); } if(data.msg == "bien"){ $.notify({ message: "Error Producto!! , Code error : 1_Codigo_Barras " },{ type: 'danger', delay: 5000, }); $("#txtsearchitem2").val(""); } } }, error: function(jqXHR, textStatus, errorThrown) { } }); } function temptabel3(idbrg,qty){ var value = { id_item: idbrg, qty: qty, method : "save_temptable3" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); $.notify({ message: "Procesando Datos Espere...." },{ type: 'info', delay: 1000, }); if(data.result ==1){ var table = $('#table_last_transactionEx').DataTable(); table.ajax.reload( null, false ); $("#txtItem").val(""); set_focus("#txtItem"); }else{ $.notify({ message: "Error Producto!! , Code error : Modulo_Existencias " },{ type: 'danger', delay: 2000, }); } }, error: function(jqXHR, textStatus, errorThrown) { $.notify({ message: "Error Registro tabla Ventas " },{ type: 'danger', delay: 2000, }); } }); } function temptabel4(idbrg,qty){ var value = { id_item: idbrg, qty: qty, method : "save_temptable4" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var table = $('#table_transactionP').DataTable(); table.ajax.reload( null, false ); $("#txtsearchitem4").val(""); set_focus("#txtsearchitem4"); var data1 = data.data; $("#txtidsales0C").val(data1); refresh_totalOC(); }else{ $.notify({ message: "Error Producto!! , Code error : Modulo_Pedidos " },{ type: 'danger', delay: 1000, }); } }, error: function(jqXHR, textStatus, errorThrown) { } }); } function refresh_total(){ var value = { method : "get_subtotal" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); var subtotal = data.subtotal; $("#txtsubtotal").val(addCommas(subtotal)); $("#txttotaldiscprc").blur(); var discrp = cleanString($("#txttotaldiscrp").val()); var total =addCommas(subtotal - discrp); $("#txttotal").html(ddCommas(subtotal)); }, error: function(jqXHR, textStatus, errorThrown) { $.notify({ message: "Error : "+ data.error },{ type: 'danger', delay: 1000, }); } }); } function refresh_totalOC(){ var value = { method : "get_subtotalOC" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); var subtotal = data.total; var data1 = data.data; $("#txttotalOC").html(addCommas(subtotal)); $("#txttotalOC2").val(addCommas(subtotal)); $("#txtmoneypayOC").val(addCommas(subtotal)); $("#txtidsales0C").val(data1); if(subtotal>0){ $.notify({ message: "Subtotal O.C.: "+ subtotal },{ type: 'success', delay: 1000, }); $.notifyDefaults({ url_target: "_self" }); $.notify({ message: "Clic Aqui para Ver Ayuda!", url: "https://www.youtube.com/watch?v=jqiqsdu4t6c&list=LLcuskh7GrX1jFEahFHKdZPA&index=1" }); } }, error: function(jqXHR, textStatus, errorThrown) { $.notify({ message: "Error : "+ data.error },{ type: 'danger', delay: 1000, }); } }); } $(document).bind('keydown', 'f9', function(){ $("#btnpayment").click(); }); $(document).bind('keydown', 'f7', function(){ $("#btnExistencias").click(); }); $(document).on("click","#btnExistencias",function(){ $("#modalExistencias").modal("show"); }); $(document).on("click","#btnPedido",function(){ window.open("purchase.php" , "ventana1" , "width=800,height=600,scrollbars=NO") }); $(document).on("click","#home",function(){ window.open('application/sales/v_pos.php') }); $(document).on("blur","#txtsalesdate",function(){ newkdtrans(); }); function newkdtrans(){ var tgl = $("#txtsalesdate").val(); var thn = tgl.substr(8, 4); var bln = tgl.substr(3, 2); var dy = tgl.substr(0, 2); var _first = 'J'; $("#txtidsales").val(_first+thn+bln+dy+'###'); } function reset_data(){ var value = { method : "reset_table" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var table = $('#table_transaction').DataTable(); table.ajax.reload( null, false ); $("#txttotaldiscprc").val(0); $("#txttotaldiscrp").val(0); $("#txtsubtotal").val(0); $("#txttotal").html("0"); $("#txtnote").val(""); $("#txtclient").val(""); $("#txtsearchitem2").val(""); refresh_total(); set_focus("#txtsearchitem2"); }else{ $.notify({ message: "No se Puede Borrar, error :"+data.error },{ type: 'danger', delay: 10000, }); } }, error: function(jqXHR, textStatus, errorThrown) { } }); } function reset_dataOC(){ var value = { method : "reset_tableOC" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var table = $('#table_transactionP').DataTable(); table.ajax.reload( null, false ); $("#txttotalOC").html("0"); $("#txtnoteOC").val(""); $("#txtprovider").val(""); $("#txtsearchitem4").val(""); refresh_total(); set_focus("#txtsearchitem4"); }else{ $.notify({ message: "No se Puede Borrar, error :"+data.error },{ type: 'danger', delay: 1000, }); } }, error: function(jqXHR, textStatus, errorThrown) { } }); } $(document).on("click","#btnopentransaction",function(){ $("#modallasttrans").modal("show"); $("#table_last_transaction tbody").html(""); }); $(document).on("click","#btnfiltersale",function(){ var first = $("#txtfirstperiod").val(); var last = $("#txtlastperiod").val(); var value = { first : first, last : last, method : "get_trans_sale" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); $("#table_last_transaction tbody").html(data.hasil); var total = data.total; total.toLocaleString('es-MX'); $("#txtsubtotalCorte").val(addCommas(total)); }, error: function(jqXHR, textStatus, errorThrown) { } }); }); $(document).on("click","#btnprocotiza",function(){ $("#modalcotizacions").modal("show"); $("#table_last_transactionC tbody").html(""); }); $(document).on("click","#btnfiltercot",function(){ var first = $("#txtfirstperiodc").val(); var last = $("#txtlastperiodc").val(); var value = { first : first, last : last, method : "get_trans_cot" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); $("#table_last_transactionC tbody").html(data.hasil); var total = data.total; total.toLocaleString('es-MX'); $("#txtsubtotalCot").val(addCommas(total)); }, error: function(jqXHR, textStatus, errorThrown) { } }); }); function init_data(){ var value = { method : "getdata" }; $('#table_transaction').DataTable({ "paging": false, "lengthChange": false, "searching": false, "ordering": false, "info": false, "responsive": true, "autoWidth": true, "pageLength": 50, "dom": '<"top"f>rtip', "columnDefs": [ { className: "textright", "targets": [ 3,4,5,6 ] } ], "ajax": { "url": "c_pos.php", "type": "POST", "data":value, }, "columns": [ { "data": "urutan" }, { "data": "id_item" }, { "data": "barcode" }, { "data": "item_name" }, { "data": "price" }, { "data": "prices" }, { "data": "qty" }, { "data": "discprc" }, { "data": "subtotal" }, { "data": "button" }, ] }); $("#txttotaldiscprc").val(0); $("#txttotaldiscrp").val(0); $("#txtsubtotal").val(0); $("#txttotal").html("0"); refresh_total(); set_focus("#txtsearchitem"); newkdtrans(); } function init_data4(){ var value = { method : "getdata4" }; $('#table_transactionP').DataTable({ "paging": false, "lengthChange": false, "searching": false, "ordering": false, "info": false, "responsive": true, "autoWidth": true, "pageLength": 50, "dom": '<"top"f>rtip', "columnDefs": [ { className: "textright", "targets": [ 3,4,5,6 ] } ], "ajax": { "url": "c_pos.php", "type": "POST", "data":value, }, "columns": [ { "data": "urutan" }, { "data": "id_item" }, { "data": "barcode" }, { "data": "item_name" }, { "data": "price" }, { "data": "discprc" }, { "data": "prices" }, { "data": "qty" }, { "data": "subtotal" }, { "data": "button" }, ] }); set_focus("#txtsearchitem4"); newkdtrans(); refresh_totalOC(); } function init_data2(){ var value = { method : "getdata2" }; $('#table_last_transactionEx').DataTable({ "paging": false, "lengthChange": true, "searching": false, "ordering": false, "info": false, "responsive": true, "autoWidth": true, "pageLength": 60, "dom": '<"top"f>rtip', "columnDefs": [ { className: "textright", "targets": [ 3,4,5,6 ] } ], "ajax": { "url": "c_pos.php", "type": "POST", "data":value, }, "columns": [ { "data": "barcode" }, { "data": "item_name" }, { "data": "price" }, { "data": "prices" }, { "data": "qty" }, { "data": "discprc" }, { "data": "subtotal" }, { "data": "merma" }, { "data": "button" }, ] }); } function getClient(){ var value = { method : "get_mostrador" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var ClienteFrecuente = data.ClienteNombre; var ClienteFrecuenteId = data.ClienteId; $("#ClienteId").val(ClienteFrecuenteId); $("#ClienteIdS").val(ClienteFrecuenteId); $("#txtclient").val(ClienteFrecuente); $("#client_id").val(ClienteFrecuenteId); $("#cliente").val(ClienteFrecuente); set_focus("#txtsearchitem"); }else{ $.notify({ message: "Cliente Frecuente/Mostrador No Encontrado" },{ type: 'danger', delay: 1000, }); $("#ClienteIdS").val(""); } }, error: function(jqXHR, textStatus, errorThrown) { } }); } $(document).on("click",".btnprices",function(){ var dataparam=$(this).attr("dataparam"); var datatitle=$(this).attr("datatitle"); var key = $(this).attr("key"); $("#txtkey2").val(key) $( "#modaleditparam2" ).find( ".modal-title" ).html(datatitle); $("#txtdataparam2").val(dataparam); var barcode=$(this).attr("val"); $("#txtbarcode").val(barcode); get_price(barcode); $("#modaleditparam2").modal("show"); }); $(document).on("click",".editparam4",function(){ var dataparam=$(this).attr("dataparam4"); var datatitle=$(this).attr("datatitle"); var val=$(this).attr("val"); $("#txtvalueP").val(val); var key = $(this).attr("key"); $("#txtkeyP").val(key) $( "#modaleditparamPurchase" ).find( ".modal-title" ).html(datatitle); $("#txtdataparamP").val(dataparam); $("#modaleditparamPurchase").modal("show"); set_focus("#txtvalueP"); }) $(document).on("click",".btnpricesUtilidad",function(){ var dataparam=$(this).attr("dataparam4"); var datatitle=$(this).attr("datatitle"); var val=$(this).attr("val"); $("#txtvalue4").val(val); var val2=$(this).attr("val2"); val2.toLocaleString('es-MX'); $("#txtvalue5").val(addCommas(val2)); var utility=$(this).attr("val3"); utility.toLocaleString('es-MX'); $("#txtvalue6").val(addCommas(utility)); var key = $(this).attr("key"); $("#txtkey4").val(key) $( "#modaleditparam4" ).find( ".modal-title" ).html(datatitle); $("#txtdataparam4").val(dataparam); var barcode=$(this).attr("val"); $("#txtbarcode").val(barcode); get_utility(barcode); $("#modaleditparam4").modal("show"); }); function get_utility(barcode) { var var_1 = barcode, var_4 = 'd'; $.post('buscar_utility.php', { "var_1": var_1, "var_4": var_4 },function(data) { $('#precios').html(data); console.log('procesamiento finalizado precios', data); }); } function get_price(barcode) { var var_1 = barcode, var_4 = 'd'; $.post('buscar_precios.php', { "var_1": var_1, "var_4": var_4 },function(data) { $('#precios').html(data); console.log('procesamiento finalizado precios', data); }); } $(document).on("click","#btnprice_min",function(){ var nilai = cleanString($("#price_min").val()); var jenis = $("#txtdataparam2").val(); var key = $("#txtkey2").val(); var value = { nilai: nilai, jenis:jenis, key:key, method : "updatedetail" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var table = $('#table_transaction').DataTable(); table.ajax.reload( null, false ); $( "#modaleditparam2" ).modal("hide"); refresh_total(); }else{ $.notify({ message: "Error edit , error :"+data.error },{ type: 'danger', delay: 10000, }); } }, error: function(jqXHR, textStatus, errorThrown) { } }); }); $(document).on("click","#btnprice_1",function(){ var nilai = cleanString($("#price_1").val()); var jenis = $("#txtdataparam2").val(); var key = $("#txtkey2").val(); var value = { nilai: nilai, jenis:jenis, key:key, method : "updatedetail" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var table = $('#table_transaction').DataTable(); table.ajax.reload( null, false ); $( "#modaleditparam2" ).modal("hide"); refresh_total(); }else{ $.notify({ message: "Error edit , error :"+data.error },{ type: 'danger', delay: 10000, }); } }, error: function(jqXHR, textStatus, errorThrown) { } }); }); $(document).on("click","#btnprice_2",function(){ var nilai = cleanString($("#price_2").val()); var jenis = $("#txtdataparam2").val(); var key = $("#txtkey2").val(); var value = { nilai: nilai, jenis:jenis, key:key, method : "updatedetail" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var table = $('#table_transaction').DataTable(); table.ajax.reload( null, false ); $( "#modaleditparam2" ).modal("hide"); refresh_total(); }else{ $.notify({ message: "Error edit , error :"+data.error },{ type: 'danger', delay: 10000, }); } }, error: function(jqXHR, textStatus, errorThrown) { } }); }); $(document).on("click","#btnprice_3",function(){ var nilai = cleanString($("#price_3").val()); var jenis = $("#txtdataparam2").val(); var key = $("#txtkey2").val(); var value = { nilai: nilai, jenis:jenis, key:key, method : "updatedetail" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var table = $('#table_transaction').DataTable(); table.ajax.reload( null, false ); $( "#modaleditparam2" ).modal("hide"); refresh_total(); }else{ $.notify({ message: "Error edit , error :"+data.error },{ type: 'danger', delay: 10000, }); } }, error: function(jqXHR, textStatus, errorThrown) { $.notify({ message: "Error edit , error :"+data.error },{ type: 'danger', delay: 1000, }); } }); }); $(document).on("click","#btnfilterOC_pend",function(){ var first = $("#txtfirstperiodc_pend").val(); var last = $("#txtlastperiodc_pend").val(); var value = { first : first, last : last, method : "get_trans_OC_pend" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); $("#table_last_transaction0C_Pend tbody").html(data.hasil); var total = data.total; $("#txtsubtotalOC_pend").val(addCommas(total)); $.notify({ message: "Procesando... "+ data.prueba },{ type: 'info', delay: 1000, }); }, error: function(jqXHR, textStatus, errorThrown) { $.notify({ message: "Error Consulta OC Pendiente: # "+ data.hasil },{ type: 'danger', delay: 10000, }); } }); }); $(document).on("click","#btntotalizarOC_save",function(){ var value = { method : "get_subtotalOC" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); var subtotal = data.total; var data1 = data.data; $("#txttotalOC").html(addCommas(subtotal)); $("#txttotalOC2").val(addCommas(subtotal)); $("#txtmoneypayOC").val(addCommas(subtotal)); $("#txtidsales0C").val(data1); swal({ title: "Guardar", text: "Guardar Operacion Actual de Salida?", type: "warning", showCancelButton: true, confirmButtonColor: "#55dd57", confirmButtonText: "Guardar", closeOnConfirm: true }, function(){ $("#ConfOCmodal").modal("show"); $("#notepassword").html("Por Favor Ingrese Nombre de la orden de compra para continuar!"); set_focus("#NombreOC"); }); if(subtotal < 1) { $.notify({ message: "No hay registros agregados!" },{ type: 'warning', delay: 1000, }); return; } }, error: function(jqXHR, textStatus, errorThrown) { $.notify({ message: "Error OS X: "+ data.error },{ type: 'danger', delay: 3000, }); } }); }); $(document).on("click","#btntotalizarOC_save2",function(){ var value = { method : "get_subtotalOC" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); var subtotal = data.total; var data1 = data.data; $("#txttotalOC").html(addCommas(subtotal)); $("#txttotalOC2").val(addCommas(subtotal)); $("#txtmoneypayOC").val(addCommas(subtotal)); $("#txtidsales0C").val(data1); swal({ title: "Guardar", text: "Guardar Operacion Actual de Salida?", type: "warning", showCancelButton: true, confirmButtonColor: "#55dd57", confirmButtonText: "Guardar", closeOnConfirm: true }, function(){ $("#ConfOCmodal").modal("show"); $( "#modalpayment" ).modal("hide"); $("#notepassword").html("Por Favor Ingrese Nombre de la orden de compra para continuar!"); set_focus("#NombreOC"); }); if(subtotal < 1) { $.notify({ message: "No hay registros agregados!" },{ type: 'warning', delay: 1000, }); return; } }, error: function(jqXHR, textStatus, errorThrown) { $.notify({ message: "Error OS X: "+ data.error },{ type: 'danger', delay: 3000, }); } }); }); $(document).on("click","#btnprice_4",function(){ var nilai = cleanString($("#price_4").val()); var jenis = $("#txtdataparam2").val(); var key = $("#txtkey2").val(); var value = { nilai: nilai, jenis:jenis, key:key, method : "updatedetail" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var table = $('#table_transaction').DataTable(); table.ajax.reload( null, false ); $( "#modaleditparam2" ).modal("hide"); refresh_total(); }else{ $.notify({ message: "Error edit , error :"+data.error },{ type: 'danger', delay: 10000, }); } }, error: function(jqXHR, textStatus, errorThrown) { } }); }); //Actualizaciones al 20/04/2021 $(document).ready(function(){ $("#txtsearchitem2A").keypress(function(e) { if(e.which == 13) { var trx = $("#txtsearchitem2A").val(); var qty = 1; var separador = "&"; var arrayDeCadenas = trx.split(separador); if(trx.indexOf(separador) != -1 ) { trx = arrayDeCadenas[0]; qty = arrayDeCadenas[1]; temptabel2A(trx,qty); }else{ temptabel2A(trx,qty); } } }); }); function temptabel2A(idbrg,qty){ var value = { id_item: idbrg, qty: qty, method : "save_temptable2" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var table = $('#table_transaction').DataTable(); table.ajax.reload( null, false ); $("#txtsearchitem").val(""); refresh_total(); set_focus("#txtsearchitem2"); $("#txtsearchitem2").val(""); var promox = data.promo; $.notify({ message: " Aplica Promocion: " + promox },{ type: 'info', delay: 5000, }); }else{ if(data.msg == "mal"){ $.notify({ message: "Error de Producto, Verifique Codigo/Precio" },{ type: 'danger', delay: 5000, }); $("#txtsearchitem2").val(""); } if(data.msg == "bien"){ $.notify({ message: "Error Producto!! , Code error : 1_Codigo_Barras " },{ type: 'danger', delay: 5000, }); $("#txtsearchitem2").val(""); } } }, error: function(jqXHR, textStatus, errorThrown) { } }); } function init_dataA(){ var value = { method : "getdataA" }; $('#table_transactionA').DataTable({ "paging": false, "lengthChange": false, "searching": false, "ordering": false, "info": false, "responsive": true, "autoWidth": true, "pageLength": 50, "dom": '<"top"f>rtip', "columnDefs": [ { className: "textright", "targets": [ 3,4,5,6 ] } ], "ajax": { "url": "c_pos.php", "type": "POST", "data":value, }, "columns": [ { "data": "urutan" }, { "data": "id_item" }, { "data": "barcode" }, { "data": "item_name" }, { "data": "price" }, { "data": "prices" }, { "data": "qty" }, { "data": "discprc" }, { "data": "subtotal" }, { "data": "button" }, ] }); set_focus("#txtsearchitemA"); } $(document).on("click","#btnNewItem",function(){ $("#modalmasteritem").modal("show"); }); //ajustes 25 abril 2021 Basculas codigo desglosado function temptabelBascula(idbrg,qty){ var value = { id_item: idbrg, qty: qty, method : "save_temptableBacula" }; $.ajax( { url : "c_pos.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); if(data.result ==1){ var table = $('#table_transaction').DataTable(); table.ajax.reload( null, false ); $("#txtsearchitem3").val(""); refresh_total(); set_focus("#txtsearchitem3"); $("#txtsearchitem3").val(""); var promox = data.promo; $.notify({ message: " Aplica Promocion: " + promox },{ type: 'info', delay: 5000, }); }else{ if(data.msg == "mal"){ $.notify({ message: "Error de Producto, Verifique Codigo/Precio" },{ type: 'danger', delay: 5000, }); $("#txtsearchitem3").val(""); } if(data.msg == "bien"){ $.notify({ message: "Error Producto!! , Code error : 1_Codigo_Barras " },{ type: 'danger', delay: 5000, }); $("#txtsearchitem3").val(""); } } }, error: function(jqXHR, textStatus, errorThrown) { } }); } //28/09/21 $(document).on("keyup keydown","#txtsearchitem_Bitacora",function(){ var searchitem = $("#txtsearchitem_Bitacora").val(); value={ term : searchitem, } $.ajax( { url : "c_search_item.php", type: "POST", data : value, success: function(data, textStatus, jqXHR) { var data = jQuery.parseJSON(data); $("#table_inventary tbody").html(data.data) }, error: function(jqXHR, textStatus, errorThrown) { $.notify({ message: "Error al Buscar Producto , # :"+ data.error },{ type: 'danger', delay: 1000, }); } }); });