<?php
session_start();
//ini_set('display_errors', 1);
//ini_set('display_startup_errors', 1);
//error_reporting(E_ALL);
include("DMMYSQLG.php");
require_once('DFJSISCI.inc');
require_once('DF80000.php');
include('JQUERY.inc');
$dt_parame = mysqli_fetch_array(mysqli_query($con ,"SELECT * from dgparame"));
?>
<?php
$_GET['cont'];
$_GET['pos'];
$_GET['ms'];

@$dt_invent = mysqli_query($con ,"SELECT * FROM dgcatven WHERE   usuario ='".$_SESSION['num_usu']."'");
				
                //Se verifica si ya ha sido cargado este producto en venta e inicializa $canPed
                //echo mysqli_error($con);
                if (mysqli_num_rows($dt_invent) > 0) {
					
                   $display="";
                } else {
                 $display="display:none";
                }



if ($_GET['pos'] != "") {
    $bus = mysqli_query($con ,"select fol_ven,no_hab from fpos where nparte1=" . $_GET['pos'] . " and mesa=" . $_GET['ms'] . " and status=1 order by id desc limit 1");

    $resul = mysqli_fetch_array($bus);
    $resul['fol_ven'];

    $folio = $resul['fol_ven'];
$folnew= $resul['fol_ven'];
 $_SESSION['idpos']=$_GET['pos'];
$_SESSION['foli']=$folnew;
$_SESSION['folio']=$folnew;
} 
if(isset($_GET['directo'])){
 $msr = mysqli_fetch_array(mysqli_query($con ,"select nparte1 from ctmeser where codigo='" . $_GET['mesero'] . "'"));
           
 $varfec = date('Y-m-d');
 $ssql = "insert into fcomhues  (no_pers,no_hab,folio,nombre,comentarios,cvmesa,cvpunto,cvarea,cvmesero,acc_fec,usuario,status) values ('2','0','0','','','" . $_GET['ms'] . "','" . $_GET['pt'] . "','" . $_GET['ar'] . "','".  $msr['nparte1']."','" . $varfec . "','" . $_SESSION['num_usu'] . "',1 )";
 
mysqli_query($con ,$ssql);
echo mysqli_error($con);

$sql_fcom=mysqli_query($con ,"select fol_comd from fcomanda  order by fol_comd desc limit 1");
    $regf=mysqli_fetch_array($sql_fcom);
    $cmk=$regf['fol_comd']+1;

$_GET['comand']= $cmk;
 $_SESSION['comand'] =$cmk;
}

 @$dats = mysqli_fetch_array(mysqli_query($con ,"select * from fcomhues where cvmesa='" .$_GET['ms'] . "' and status=1"));
 $pos = mysqli_query($con ,"select fol_ven,no_hab from fpos where nparte1=" . $_GET['pos'] . " and mesa=" . $_GET['ms'] . " and status=1 order by id desc limit 1");

  $_SESSION['hsp'] = $dats['nparte1'];
  	$sq_p=mysqli_query($con ,"select * from  ptventa where nparte1='".$_GET['pt']."'");
		$regmp1=mysqli_fetch_array($sq_p);
		 $porSer=$regmp1['servicio'];
		 echo "<script>var porser='".$porSer."'</script>";
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="CMD2_PR.css?e" type="text/css"/>
<script type="text/javascript" language="javascript" src="DSSCRIPT.js?r"></script>
<script type="text/javascript" language="javascript" src="CMD0_PR.js?t"></script>
<title>PUNTO DE VENTA</title>
<script>/*<![CDATA[*/var data;function getCajero(a){$.ajax({url:"ws_cajero.php?clave="+a,type:"get",beforeSend:function(){},success:function(b){if(b.trim()=="0"){$(".ui-dialog-title").html("ERROR EN LA CLAVE");$(".ui-dialog-title").css("color","red");$("#Clave").val("");$("#Clave").css("border","1px solid red")}else{$(".ui-dialog-title").html("CARGANDO INFO");$(".ui-dialog-title").css("color","#000");if(b.trim()=="ok"){data+="&cajero="+a;window.open(data,"mainFrame","Keypad");console.log(data)}else{$(".ui-dialog-title").html("ERROR EN LA CLAV0E--"+b);$(".ui-dialog-title").css("color","red")}}}});return false}/*]]>*/</script>
<script type='text/javascript'>function abrirCAJ(a){data=a; data+="&cajero="+a;window.open(data,"mainFrame","Keypad");}</script>


<script language="javascript">/*<![CDATA[*/function abrir(){var c;c=prompt("INTRODUCE EL MOTIVO DE CANCELACION: ","");if((c!="")&&(c!=null)){$.fancybox.open({href:"CAL10000.php?tpo=13&pos=<?php echo $_GET['pos']; ?>&pt=<?php echo $_GET['pt'] ?>&ar=<?php echo $_GET['ar']; ?>&ms=<?php echo $_GET['ms']; ?>&cont=<?php echo $_GET['cont']; ?>&mesero=<?php echo $_GET['mesero']; ?>&fol=<?php echo $folio; ?>&tm="+c,type:"iframe",padding:5,width:310,height:310,})}}
    function abrir2popup(d,c){ 
        b=window.open("TIKET0011_imp.php?bot=<?php echo $_SESSION['foli']; ?>&but=val2","","scrollbars=yes, resizable=no, width=300,height=auto, top=85, left=140");
        a=window.open("TIKET0012_imp.php?bot=<?php echo $_SESSION['foli']; ?>&but=val2","","scrollbars=yes, resizable=no, width=300,height=auto, top=185, left=240")};/*]]>*/
            </script>
   
                                                       
</head>
<body onload="getDetVen()">
    <?php if (($contr >= 1) || ($_GET['btu'] == 2)) {?>
        <style type="text/css">
                                                                    .delprod {
                                                                            display:none;
                                                                    }
                                                                     .btnchan{
                                                                        display:none;
                                                                    }
                                                                </style>
    <?php } ?>
    <form name="mainForm" id="mainForm" method="post" action="" target="_self" onsubmit="return false">
<div id="foliooo" style="display:none">
<input type="text" name="bot" id="bot" value="<?php
                if (isset($_GET['fol'])) {
                    echo $folio = $_GET['fol'];
                    $_SESSION['folioimp'] = $folio;
                } else if (isset($folio)) {
                    echo $folio;
                    $_SESSION['folioimp'] = $folio;
                }
                ?>">
<input type="text" name="comand" id="comand" value="<?php echo $_GET['comand']; ?>"/>
onv<input type="text" name="posnv" id="ponsv" value="<?php echo $_GET['posn']; ?>">
pms<input type="text" name="posmesa" id="posmesa" value="<?php echo $_GET['pms'];  ?>">
<?php
                            if ($_GET['comand'] != "") {
                                echo '<input type="text" name="but" id="but" value="0">';
                                $_SESSION['butimp'] = 0;
                            } else {
                                $valor = $_GET['btu'];
                                $valor = 2;
                                $_SESSION['butimp'] = $_GET['btu'];
                                echo '<input type="text" name="but" id="but" value="' . $valor . '">';
                            } 
                            ?>
</div>
<div id="cambios" style="display:none">
camb<input type="text" name="cambio" id="cambio" value="">
</div>
<?php
                            if ($_GET['btu'] == 2) {
                                $_GET['btu'];
                                $qry_b = mysqli_fetch_array(mysqli_query($con ,"select num_imp from fimpresion where mesa='" . $_GET['ms'] . "' and fol_ven='" . $folio . "' order by nparte1"));
                                $qry_b['num_imp'];
                                if ($qry_b['num_imp'] != '')
                                    $contr = $qry_b['num_imp'];
                                else
                                    $contr = 0;

//Consulta Datos Empresa
                                $dt_empres = mysqli_fetch_array(mysqli_query($con ,"SELECT * FROM dxempres where cla_emp = '" . $_SESSION['empresa'] . "'"));

                                //aviso de que ya se imprimio 
                                if ($qry_b['num_imp'] >= 1) {
                                    $contador = $qry_b['num_imp'] + 1;
                                    $query = mysqli_query($con ,"INSERT INTO fimpresion (mesa,fol_ven,num_imp,acc_fec,acc_hor,usuario) VALUES ('" . $_GET['ms'] . "','" . $folio . "','" . $contador . "','" . $dt_empres['fec_alta'] . "', '" . date('H:i:s') . "','" . $_SESSION['num_usu'] . "')");
                                } else if ($contr != 1) {
                                    $contador = $qry_b['num_imp'];
                                    $query = mysqli_query($con ,"INSERT INTO fimpresion (mesa,fol_ven,num_imp,acc_fec,acc_hor,usuario) VALUES ('" . $_GET['ms'] . "','" . $folio . "','1','" . $dt_empres['fec_alta'] . "', '" . date('H:i:s') . "','" . $_SESSION['num_usu'] . "')");
                                }
                                
                            }
                            $contr;
                            $_GET['btu'];

                            if (isset($folio)) {
                                $_SESSION['foli'] = $folio;
                                @$fol = mysqli_fetch_array(mysqli_query($con ,"select fol_ven,con_ven as folio from dgpemema where fol_ven='" . $folio . "'"));
                                $fol['fol_ven'];
                                $fol['folio'];
                            } else if (!isset($_GET['fol'])) {
                                @$fol = mysqli_fetch_array(mysqli_query($con ,"select fol_ven,con_ven as folio from dgpemema order by con_ven desc limit 1"));
                                $_SESSION['foli'] = $fol['fol_ven'] + 1;
                                $fol['folio'] + 1;
                            } else {
                                $_SESSION['foli'] = $_GET['fol'];
                                @$fol = mysqli_fetch_array(mysqli_query($con ,"select fol_ven,con_ven as folio from dgpemema where fol_ven='" . $_GET['fol'] . "'"));
                                $fol['folio'];
                            }
                            $_GET['fol'];
                            ?>
<input type="hidden" name="bat" id="bat" value="2">
<input type="hidden" name="idDetSel" id="idDetSel" value="">
<input type="hidden" name="virtualKey_focus" id="virtualKey_focus" value="NO_FOCUS">
<div class="pv tablepv">
<div class="botoneramenu" colspan="2">
<?php
                                                if (!isset($_GET['btu'])) {
                                                    if (!isset($_GET['comand'])) {

                                                        $qry_b = mysqli_fetch_array(mysqli_query($con ,"select num_imp from fimpresion where mesa='" . $_GET['ms'] . "' and fol_ven='" . $folio . "'  and status=1 and clave='' order by nparte1"));

                                                        if ($qry_b['num_imp'] != '') {
                                                            $contr = $qry_b['num_imp'];
                                                        }

                                                        if ($qry_b['num_imp'] == '') {
                                                            $_SESSION['comand'] = "0";
//al boton de comanda quitarle el parametro de folio para hacer la comanda manual 
                                                            ?>
<input name="comand2" type="submit" onclick="javascript:window.open('CAL10000.php?tpo=4&pos=<?php echo $_GET['pos']; ?>&pt=<?php echo $_GET['pt'] ?>&ar=<?php echo $_GET['ar']; ?>&ms=<?php echo $_GET['ms']; ?>&cont=<?php echo $_GET['cont']; ?>&mesero=<?php echo $_GET['mesero']; ?>&folio=<?php echo $_SESSION['foli']; ?>','VENTANA','width=280,height=260,scrollbars=NO,minimize=0')" value="Comanda"/>
<?php
                                                            $_SESSION['foli'];
                                                        }else{
                                                           ?>
                                                             <style type="text/css">
                                                                    .delprod {
                                                                            display:none;
                                                                    }
                                                                    .btnchan{
                                                                        display:none;
                                                                    }
                                                                </style>
                                                          <?php 
                                                        } 
                                                    }  
                                                    if (isset($_GET['comand'])) {
                                                        ?>
<input name="termina" type="submit" onclick="nuevoPedido();abrir2popup('<?php echo $_POST['bot']; ?>','<?php echo $_POST['but']; ?>');envia2('MESA5000_PR.php?pos=<?php echo $_GET['cont']; ?>&mesero=<?php echo $_GET['mesero']; ?>&pt=<?php echo $_GET['pt'] ?>&ar=<?php echo $_GET['ar']; ?>&ms=<?php echo $_GET['ms']; ?>','_self','mainForm')" value="Imp. Comanda" />
<?php
                                                           }
                                                       }
                                                       ?>
<input name="regresa" type="button" onclick="if(document.mainForm.idDetSel.value.length!=''){javascript:alert('DEBE ENVIAR LA COMANDA ! ! ');}else{envia2('MESA5000_PR.php?pos=<?php echo $_GET['cont']; ?>&mesero=<?php echo $_GET['mesero']; ?>&pt=<?php echo $_GET['pt'] ?>&ar=<?php echo $_GET['ar']; ?>&ms=<?php echo $_GET['ms']; ?>','_self','mainForm');}" value="Regresar"/>
<?php
                                                if (isset($folio)) {
                                                    if (!isset($_GET['comand'])) {
                                                        ?>
<input name="pagar" type="submit" <?php echo $display;?> onclick="<?php if (($contr != 0) || ($_GET['btu'] == 2)) { ?>
var desc=$('#des_ven').val();
if(document.mainForm.cambio.value.length==''){javascript:abrirCAJ('CAJA2.php?pos=<?php echo $_GET['pos']; ?>&pt=<?php echo $_GET['pt'] ?>&ar=<?php echo $_GET['ar']; ?>&ms=<?php echo $_GET['ms']; ?>&cont=<?php echo $_GET['cont']; ?>&mesero=<?php echo $_GET['mesero']; ?>&desc='+desc);<?php //	}else if ($_REQUEST['cambio']==1){ ?>}else{javascript:alert('SE REALIZARON CAMBIOS, DEBE IMPRIMIR LA CUENTA!!');}
<?php
                                                            //} 
                                                        } else {
                                                            ?>
javascript:alert('DEBE IMPRIMIR LA CUENTA!!');<?php }
                                                        ?>" value="Pagar."/>

<input name="imprimir" type="submit" onclick="<?php
                                                        if (($contr >= 1) || ($_GET['btu'] == 2)) {
                                                            //	if ($_POST['cambio']!="") {
                                                            ?>
if(document.mainForm.cambio.value.length==''){if(!confirm('LA CUENTA YA FUE IMPRESA �DESEA VOLVER A IMPRIMIR LA CUENTA?'))
{javascript:return false;}else{if(!confirm('ESTA SEGURO QUE DESEA IMPRIMIR LA CUENTA?'))
{javascript:return false;}document.mainForm.but.value=2;javascript:imprimePedido();envia2('CAJA1.php?pos=<?php echo $_GET['pos']; ?>&mesero=<?php echo $_GET['mesero']; ?>&pt=<?php echo $_GET['pt'] ?>&ar=<?php echo $_GET['ar']; ?>&ms=<?php echo $_GET['ms']; ?>&cont=<?php echo $_GET['cont']; ?>&btu=2','_self','mainForm');}}else{document.mainForm.but.value=2;javascript:imprimePedido();envia2('CAJA1.php?pos=<?php echo $_GET['pos']; ?>&mesero=<?php echo $_GET['mesero']; ?>&pt=<?php echo $_GET['pt'] ?>&ar=<?php echo $_GET['ar']; ?>&ms=<?php echo $_GET['ms']; ?>&cont=<?php echo $_GET['cont']; ?>&btu=2','_self','mainForm');}
<?php } else {
                                                            ?>
                                                            if(!confirm('ESTA SEGURO QUE DESEA IMPRIMIR LA CUENTA?'))
{javascript:return false;}
document.mainForm.but.value=2;javascript:imprimePedido();envia2('CAJA1.php?pos=<?php echo $_GET['pos']; ?>&mesero=<?php echo $_GET['mesero']; ?>&pt=<?php echo $_GET['pt'] ?>&ar=<?php echo $_GET['ar']; ?>&ms=<?php echo $_GET['ms']; ?>&cont=<?php echo $_GET['cont']; ?>&btu=2','_self','mainForm');<?php }
                                                        ?>" value="Imprimir Cta."/>

<?php //} ?>
<?php
                                                    }
                                                }
                                                ?>
<span style="    background: red;
    display: inline-block;
    padding: 5px;
    font-size: 20px;
    border-radius: 4px;
    font-weight: bold;
    float: right;" id="folioventa"></span>
      ARTICULOS 
      <input name="articulos" id="articulos" type="text" size="2" values="" style="border:none; background:none; font-size:20px"/>
    
</div>
<div class="leftpv"> 
<div class="titVenta">
MESERO(A):<?php
                                                    $_SESSION['punto'] = $_GET['pt'];
                                                    $_SESSION['area'] = $_GET['ar'];
                                                    $_SESSION['mesa'] = $_GET['ms'];
                                                    $dt_clav = mysqli_fetch_array(mysqli_query($con ,"SELECT nparte1 FROM ctmeser WHERE codigo='" . $_GET['mesero'] . "'"));
                                                    $_SESSION['vendedor'] = $dt_clav['nparte1'];
                                                    $_SESSION['tipven'] = 1;
                                                    $_SESSION['fecven'] = $dt_empres['fec_alta'];
                                                    $dt_des = mysqli_fetch_array(mysqli_query($con ,"SELECT ctmeser.np_desc1 as mesero FROM ctmeser WHERE ctmeser.nparte1='" . $_SESSION['vendedor'] . "'"));
                                                    echo $dt_des['mesero'];
                                                    ?></div>
<div id="divMenu">
<table border="0">
<tr onclick="opendatos()">
<td  class="cellFootCanDesTit"><div align="left" >Pax:<span id="pers">

<?php echo  $dats['no_pers'];
                                                                                          ?>
        </span></div></td>


<td  class="cellFootCanDesTit"><div align="left">MESA:<?php
                                                                    $busm = mysqli_fetch_array(mysqli_query($con ,"SELECT np_desc1 FROM ctmesas WHERE nparte1='" . $_SESSION['mesa'] . "'"));
                                                                    echo $busm['np_desc1'];
                                                                    $_SESSION['posi'] = $_GET['pos'];
                                                                    ?></div></td>


<td  class="cellFootCanDesTit"><div align="left">HABIT:<span id='habs'>
<?php
                                                                    echo  $resul['no_hab']
                                                                    ?>
                                                                    </span>
</div></td>
<?php
                                                            @$cfol = mysqli_fetch_array(mysqli_query($con ,"select nparte1 from fcomanda order by nparte1 desc limit 1"));
                                                            if (isset($cfol['nparte1'])) {
                                                                $_SESSION['cclav'] = $cfol['nparte1'] + 1;
                                                            } else {
                                                                $_SESSION['cclav'] = '';
                                                            }
                                                            $_SESSION['comand'] = $_GET['comand'];
                                                            ?>
</tr>
</table>
</div>
<div class="basCellDetVen"><div id="divDetVen"><?php require_once("CAJA1_MEN.php"); ?></div></div>

</div>
<div class="rigthpv">
<div class="titVenta">
<?php if (isset($_GET['comand'])) { ?><input  type="button" value="cantidad" tabindex="0" id="cantbtn" class="F3" name="cantbtn" placeholder="cantidad" style="width:100px;float:left; " onclick="$('.bcanbiar').last().trigger( 'click' )" />

<?php } ?>
<?php echo whatday($_SESSION['fecven']) . ', ' . chfecha($_SESSION['fecven'], 'Y-m-d', 'd de M de Y'); ?>
<br/>
<?php if (isset($_GET['comand'])) { ?> <div class=""><input  type="number" min="1" value="1" tabindex="0" id="numa" name="numa" placeholder="cantidad" style="width:80px;float:left; display:none"/> <input name="token" placeholder="BUSQUEDA" id="token" autocomplete="off" tabindex="0" onkeyup="search(this.value)" style="width:350px;"/></div><?php } ?>
</div>
<div align="left" valign="top" class="basCellLinea">
<div style="width:100%;height:50px" id="divLineas"></div> </div>
<div class="basCellGrupo" valign="top">
<div  id="divGrupos"></div> </div>
<div rowspan="2" class="basCellProducto" valign="top">
<div style="" id="divProductos"></div>
<div style="height:385px;display:none" id="divScrPag"><?php include("CAJA3_MEN.php"); ?></div> </div>
</div>
<div class="vacio"></div>
</div>
</form>
</body>

<div id="cantidad" style="display:none;background:#000;color:#fff;height:100%;min-width:500px" title="INTRODUZCA CANTIDAD">
<input name="incantidad" onblur="var that=this;setTimeout(function(){that.focus();},0)" autofocus="autofocus" id="incantidad" type="number" class="emplea" style="text-align:right;font-size:17px" size="25"><br/>
<input  type="button" value="Aceptar" tabindex="0" id="clickcantidad" name="clickcantidad"  style="width:100px " onclick="changecant()" />
</div>

<div id="botonera" style="display:none;background:#000;color:#fff;height:100%;min-width:500px" title="CLAVE DE CAJERO">
<form name="Keypad" id="Keypad" action="#" method="post" enctype="multipart/form-data">
<table border="0" cellpadding="0">
<tbody>
<tr><td colspan="3" align="middle">
<input name="Clave" onblur="var that=this;setTimeout(function(){that.focus();},0)" autofocus="autofocus" id="Clave" type="password" class="emplea" style="text-align:right;font-size:17px" size="25">
</tr>
<tr>
<td align="center"><div align="center">
<input name="btnSeven" type="button" class="men" onClick="NumPressed(7)" value="  7  " /></div></td>
<td align="center"><div align="center">
<input name="btnEight" type="button" class="men" onClick="NumPressed(8)" value="  8  " /></div></td>
<td align="center"><div align="center">
<input name="btnNine" type="button" class="men" onClick="NumPressed(9)" value="  9  " /></div></td>
</tr>
<tr>
<td align="center"><div align="center">
<input name="btnFour" type="button" class="men" onClick="NumPressed(4)" value="  4  " /></div></td>
<td align="center"><div align="center">
<input name="btnFive" type="button" class="men" onClick="NumPressed(5)" value="  5  " /></div></td>
<td align="center"><div align="center">
<input name="btnSix" type="button" class="men" onClick="NumPressed(6)" value="  6  " /></div></td>
</tr>
<tr>
<td align="center"><div align="center">
<input name="btnOne" type="button" class="men" onClick="NumPressed(1)" value="  1  " /></div></td>
<td align="center"><div align="center">
<input name="btnTwo" type="button" class="men" onClick="NumPressed(2)" value="  2  " /></div></td>
<td align="center"><div align="center">
<input name="btnThree" type="button" class="men" onClick="NumPressed(3)" value="  3  " /></div></td>
</tr>
<tr>
<td align="center"><div align="center">
<input name="btnZero" type="button" class="men" onClick="NumPressed(0)" value="  0  " /></div></td>
<td align="center"><div align="center">
<input name="btnok" type="button" onClick="getCajero(document.Keypad.Clave.value)" class="men" id="btnok" value="OK"/></div></td>
<td align="center"><div align="center">
<input name="btnClear" type="button" class="men" onClick="Clear()" value="  X " /></div></td>
</tr>
</tbody>
</table>

</form>
</div>
</html>
<script language="JavaScript" type="text/javascript">/*<![CDATA[*/$("#token").focus();var FKeyPad=document.Keypad;var Accum=0;var FlagNewNum=false;var PendingOp="";function NumPressed(a){if(FlagNewNum){FKeyPad.Clave.value=a;FlagNewNum=false}else{FKeyPad.Clave.value+=a}}function Operation(b){var a=FKeyPad.Clave.value;if(FlagNewNum&&PendingOp!="="){}else{FlagNewNum=true;if("+"==PendingOp){Accum+=parseFloat(a)}else{if("-"==PendingOp){Accum-=parseFloat(a)}else{if("/"==PendingOp){Accum/=parseFloat(a)}else{if("*"==PendingOp){Accum*=parseFloat(a)}else{Accum=parseFloat(a)}}}}FKeyPad.Clave.value=Accum;PendingOp=b}}function Decimal(){var a=FKeyPad.Clave.value;if(FlagNewNum){a="0.";FlagNewNum=false}else{if(a.indexOf(".")==-1){a+="."}}FKeyPad.Clave.value=a}function ClearEntry(){FKeyPad.Clave.value="";FlagNewNum=true}function Clear(){Accum=0;PendingOp="";ClearEntry()}function Neg(){FKeyPad.Clave.value=parseFloat(FKeyPad.Clave.value)*-1}function Percent(){FKeyPad.Clave.value=(parseFloat(FKeyPad.Clave.value)/100)*parseFloat(Accum)}$(function(){$("#Keypad").submit(function(a){getCajero(FKeyPad.Clave.value);a.preventDefault()})});/*]]>*/</script>

<?php

 include_once ("nuevofolio.php");?>
<script type='text/javascript'>
var prodtemp='';
function cantidad(prod){$("#cantidad").dialog({modal:true,width:300});
prodtemp=prod;
}
function changecant(){
 agrProd($('#incantidad').val(),prodtemp);
        $("#cantidad").dialog( "close" );
        $('#incantidad').val('');
        console.log('enter');
}
$('#incantidad').on('keydown', function(e) {
    if (e.which == 13) {
        e.preventDefault();
       changecant();
    }
});
$(document).keypress(
  function(event){
    if (event.which == '13') {
      event.preventDefault();
        var $canfocus = $(':tabbable:visible')
        var index = $canfocus.index(document.activeElement) + 1;
        if (index >= $canfocus.length) index = 0;
        $canfocus.eq(index).focus();
    }
});
</script>
