<!-- <meta http-equiv="refresh" content="60"> -->
<?php 
// session_start();
foreach($_GET  as $key => $value){${$key}=trim($value);} 
foreach($_POST as $key => $value){${$key}=trim($value);} 
include_once('lib_main.php');
if(!empty($empr)){$link_data=msql_connect('','','',$empr); $cfg_empr=$empr;}
$user_codigo=$_SESSION['user_codigo'];
// $user0=data_maes('user',$user_codigo);
if(empty($user_codigo)){include('user_login0.php');return;}

$empr0=data_maes('empr',$cfg_empr);
$modu0=data_maes('modu',$modu);
$user0=data_maes('user',$user_codigo);

$tpos=2;
$modu='vtas';     
$docu='FC10';     

if($empr0['empr_codigo']=='demo')
{
// $modu='clie';     
// $docu='PC10';     
}
     
$modu=strtolower($modu);
// $docu=strtoupper($docu);
$tabla=$modu;
$plvh=strtoupper($plvh);

if(!empty($idnum1))
{
     $sql_docu='select * from '.$tabla.'1 left join '.$tabla.'2 on idnum1=idnum2 where idnum1="'.$idnum1.'" order by iddet desc limit 1';
     $res_docu=msql_query($sql_docu,$link_data);
     $data_docu=msql_fetch_assoc($res_docu);
     foreach($data_docu as $campo => $valor){${$campo}=trim($valor);} 
}

$cant=1;

if(empty($ptov)){$ptov = $user0['user_ptov'];}
if(empty($ptov)){$ptov = $_COOKIE['ptov'];}
// if(empty($ptov) and $tpos<=2){$ptov=$user0['user_ptov'];}
if(empty($vndd)){$vndd=$user0['user_cedula'];}
// if(empty($modu)){$modu='vtas';}
if(empty($format)){$format=1;}
if(empty($tpos)){$tpos=2;}
if(empty($tpre)){$tpre=1;}
if(empty($ptov))
{
     $sql_ptov='select * from '.$modu.'1 where iuser="'.$user_codigo.'" order by idnum1 desc limit 1';
     $res_ptov=msql_query($sql_ptov,$link_data);
     $ptov=msql_result($res_ptov,0,'ptov');
}

set_hora2grg($modu,$docu,$ptov);


if($format==1){$info=substr($modu,0,2).'det2';}
if($format==2){$info=substr($modu,0,2).'deta';}
if($format==3){$info=substr($modu,0,2).'blog';}

if($tpos==1){$info=substr($modu,0,2).'det1';}
if($tpos==2){$info=substr($modu,0,2).'det2';}
if($tpos==3){$info=substr($modu,0,2).'det2';}

$info=substr($modu,0,2).'blog';
$info=substr($modu,0,2).'det2';
$info_descri='VENTAS';
// if($info=='vtblog'){$info_descri='PTO.EMISION';}

// if(empty($docu)){$docu='FC10';}

$docu0=data_maes('docu',$docu);
$item0=data_maes('item',$item);
$ptov0=data_maes('ptov',$ptov);

$xtitulo='GARAGE';
$xtitle='GARAGE';
$xtopcenter=$xtitle;
if(!empty($docu)){$xtitle.=' /'.$docu;}
if(!empty($numero)){$xtitle.='-'.$numero;}
if(empty($fecha)){$fecha=date('Y-m-d');}

$fecha_min=date('Y-m-d');
$fecha_max=date('Y-m-d');

$idnum1='';

// echo '*/*/*'.$ptov;

if(!empty($docu)  and !empty($ptov) and !empty($numero))
{
     include('sele_info.php');
}

if(!empty($sql_info))
{
     $sql_info1=$sql_info;
     $sql_info1=str_replace('group by idnum1,iddet','group by idnum1',$sql_info1);
     $res_info1=msql_query($sql_info1,$link_data);
     
     $subt_iva=msql_result($res_info1,0,'subt_iva_hide');
     $subt_iva0=msql_result($res_info1,0,'subt_iva0_hide');
     $tiva=msql_result($res_info1,0,'iva');
     $total=msql_result($res_info1,0,'total');
     $pvp=msql_result($res_info1,0,'total')/msql_result($res_info1,0,'cant');
     
     $plvh=msql_result($res_info1,0,'plvh');
     $item=msql_result($res_info1,0,'item');
     $hora1=msql_result($res_info1,0,'entra');
     $hora2=msql_result($res_info1,0,'sale');
     $hora3=msql_result($res_info1,0,'tiempo');
     
     $claveacc=msql_result($res_info1,0,'claveacc_hide');
     $iuser=msql_result($res_info1,0,'iuser_hide');
     
     if(msql_num_rows($res_info1)!=0)
     {
          $subt_iva0=number_format($subt_iva0,2);
          $subt_iva=number_format($subt_iva,2);
          $tiva=number_format($tiva,2);
          $total=number_format($total,2);
     }
          
     $res_info=msql_query($sql_info,$link_data);
     if(!empty($numero))
     {
          $idnum1=msql_result($res_info,0,'idnum1_hide');
          $edit=msql_result($res_info,0,'b_o');
          
          $data_head=data_docu($docu,$idnum1);
          foreach($data_head as $key => $value){${$key}=trim($value);} 
     }

     $plvh0=data_maes('plvh',$plvh);
     $wsapp=$plvh0['plvh_wsapp'];     
}


// datalist
{
     
$fecha1=date('Y-m-d',strtotime('-1 days'));     
$ztabla='plvh';
$zwhere='(plvh_codigo in (select plvh from clie1 left join clie2 on idnum1=idnum2 where fecha>="'.$fecha1.'") or plvh_codigo in (select plvh from vtas1 left join vtas2 on idnum1=idnum2 where fecha>="'.$fecha1.'"))';
include('ele_datalist.php');
     
$ztabla='enti';
{$zwhere='(left(enti_codigo,10) in(select distinct left(enti,10) from '.$modu.'1))';}
include('ele_datalist.php');
              
$ztabla='item';
$zlpre='pvp1';     
$zwhere='(item_descri like "GARA%")';
include('ele_datalist.php');
     
// $ztabla='docu';
// $zwhere='(docu_tabla="'.$modu.'")';
// include('ele_datalist.php');

echo '<datalist id="dlpuni"></datalist>';
echo '<datalist id="dlpvp"></datalist>';
echo '<datalist id="dldcto"></datalist>';

}


// PANTALLA FILTROS
// echo '<div id="filtros" noprint >';
echo '<div id="filtros"  >';
{
     
// OCULTOS
echo '<div hide>';   
{
//      echo '<input id="fpag" value="01">';
//      echo '<input id="ipip" value="'.$ipip.'">';
     echo '<input id="modu" value="'.$modu.'">';
     echo '<input id="docu" value="'.$docu.'">';
     echo '<input id="info" value="'.$info.'">';
     echo '<input id="tpos" value="'.$tpos.'">';
     echo '<input id="idnum1" value="'.$idnum1.'">';
     echo '<input id="stfin" value="'.$stfin.'">';
     echo '<input id="iddet" value="">';
}     
echo '</div>';     
          
$zobj=2;     
include('ele_break.php');
     
$zid='btn_nuevo'; 
$zlabel='Nuevo';
$zalign='right';
$zonclick='{fn_nuevo();}';
$zsize=1.6;     
include('ele_button.php');
         
$zid='fecha';
$ztype='date';
$zlabel='Fecha';
$zvalue=$fecha;
$zmin=$fecha_min;     
$zmax=$fecha_max;     
$zreado=2;
{$zhide=1;}
include('ele_input.php');  
     
// $zid='docu';
// $zlabel='Docum.';
// $zvalue=$docu;
// $ztabla='docu';
// $zwhere='(docu_tabla="'.$modu.'")';
// if(!empty($docu)){$zreado=2;}
// $zonblur='{location.href="?scri='.basename(__FILE__,'.php').'&tpos="+document.getElementById("tpos").value+"&docu="+document.getElementById("docu").value+"&ptov="+document.getElementById("ptov").value;}';
// $zonchange=$zonblur;
// if($tpos<=2){$zobj=1;}     
// if($tpos<=2){$zreado=1;}     
// if($tpos<=2){$zlist='nolist';}
// $zhide=1;     
// include('ele_select.php');

// $zobj=4;     
$zid='ptov';
$ztabla='ptov';
$zlabel='🅿 Parqueo';
$zvalue=$ptov; 
$zonblur='{location.href="?scri='.basename(__FILE__,'.php').'&tpos="+document.getElementById("tpos").value+"&docu="+document.getElementById("docu").value+"&ptov="+document.getElementById("ptov").value;}';
$zonchange=$zonblur;
$zsize=1.8;
$zexact=1;     
// $zreado=2;     
// $zhide=1;     
include('ele_select.php');

$zid='btn_print'; 
$zlabel='Impri.';
$zalign='right';
$href='?scri=info_docu3&prnt=1&docu='.$docu.'&idnum='.$idnum1.'&pgsize=T65';  
if($stfin==1)
{$href='?scri=info_docu3&prnt=1&docu='.$docu.'&idnum='.$idnum1.'&pgsize=P65';}
$zonclick='{print_url("'.$href.'");}';
if(empty($idnum1)){$zhide=1;}     
if(empty($numero)){$zhide=1;}
$zsize=1.8;     
include('ele_button.php');
     
     
$zobj=1;
include('ele_break.php');
     
     
$zid='numero';
// $zlabel='🎫🧾 Ticket ';
$zlabel='🧾 Ticket ';
if($stfin==1)
{$zlabel='📝 Factura';}
$zvalue=(int)$numero;
$zmin=1;
$zmax=9999999;     
$zclass='numeric-int';
$zreado=2;     
$zondblclick='{document.getElementById("'.$zid.'").style.width="'.round(7*2/3,2).'em";}';     
$zonblur='{if(document.getElementById("'.$zid.'").getAttribute("disabled")!=""){document.getElementById("idnum1").value="";fn_consulta();}}';
$zbackcolor='grey';
$zfontcolor='white';
$zsize=1.5;     
include('ele_input.php');
     
         
$zid='btn_consul'; 
$zlabel='Consultar';
$zalign='right';
$zonclick='{fn_consulta(event);}';
$zhide=1;     
include('ele_button.php');

     
if(!empty($ptov))
{
     
$zobj=1;     
include('ele_break.php');
     
{
     $zobj=1;
     $zid='vndd';
     $ztabla='enti';
     $zvalue=$vndd;
     $zlist='dlvndd';
     $zalign='right';
     $zreado=1;
     $zlabel='Vendedor';
     $zhide=1;
     include('ele_input.php');
     
     $zid='plvh';
     $zlabel='🚘 Placa';
//      if(getPlatform()!='Android')
//      {$zlabel='&#128664;';}
     $zvalue=$plvh;
     $ztabla='plvh';
     $zsize=1.5;
     if(!empty($numero)){$zreado=1;}
     include('ele_input.php');

     $zobj=1;
     include('ele_break.php');
     
     $zid='iser';
     $zlabel='💲Tarifa';
     $zvalue=$item;
     $ztabla='item';
     $zsize=1.5;
     $zautoc='off';
     if(!empty($numero)){$zreado=1;}
     $zwhere='(item_descri like "GARA%")';
     if(getPlatform()!='Android')
     {include('ele_input.php');}
     else
     {include('ele_select.php');}
     
     $zobj=1;
     include('ele_break.php');
     
     $zid='hora1';
     $zlabel='⌚ Entra';
     $zvalue=$hora1;
     $zsize=1.5;
     $ztype='time';
     $zdefa=date('H:i');
     $zmin=date('H:i',strtotime('-500 minutes'));
     $zmax=date('H:i',strtotime('+5 minutes'));
     if(!empty($numero)){$zreado=2; $zdefa=$hora1;}
     include('ele_input.php');
     
     $zid='hora2';
     $zlabel='⏰ Sale';
     $zsize=1.5;
     $ztype='time';
     $zvalue=$hora2;
     if(empty($stfin))
     {$zvalue=date('H:i');}    
     $zmin=date('H:i',strtotime('-500 minutes'));
     if($zmin>date('H:i')){$zmin='00:00';}
     $zmax=date('H:i',strtotime('+1 minutes'));
     if(empty($numero)){$zhide=1;}
     if($stfin==1){$zreado=1;}    
     include('ele_input.php');

     $zid='tiempo';
     $zlabel='Tiempo';
//      if(getPlatform()!='Android')
//      {$zlabel="&#9203;";}
     $zlabel="⏳";
     $zvalue=$hora3;
     $zsize=1.5;
     $zwidth=4;
     if(empty($numero)){$zhide=1;}
     $zreado=1;
     include('ele_input.php');

     $zid='pvp';
     $zlabel='$';
     if(getPlatform()!='Android')
     {$zlabel='&#128178;';}
     $zlabel='💲';
     $zvalue=number_format($pvp,2);
     $zwidth=2;
     $zmax=999;
     $zreado=1;
     $zsize=1.5;
     if(empty($numero)){$zhide=1;}
     include('ele_input.php');
     
     $zid='total';
     if(getPlatform()!='Android')
     {$zlabel='Total &#128178;';}
     $zlabel='💲Total';
     $zvalue=number_format($total,2);
     $zwidth=3;
     $zmax=999;
     $zreado=1;
     $zsize=1.5;
     if(empty($numero)){$zhide=1;}
     include('ele_input.php');

     
     
     $zobj=1;
     include('ele_break.php');

     
//      $zid='enti';
     $zid='codt';
     $zlabel='👤 Cliente';
     $zvalue=$enti;
     $ztabla='enti';
     $zdefa='9999999999';
     $zsize=1.5;
     {
     $zsave=1;
     $zsavet='plvh';
     $zsavec=$enti;
     $zsavef='enti';
     }
     if($stfin==1)
     {
//      $zsave=1; 
//      $zsavet=$modu;
//      $zsavei=$idnum1;
//      $zsavef='enti';
     }    
     include('ele_input.php');
     
     $zobj=1;
     include('ele_break.php');
     
     if($tpos==2)
     {
     $zid='nombre';
     $zlabel='Nombre';
     $zvalue=$nombre;
     $zsize=1.5;
     $zhide=1;
     include('ele_input.php');
     
     $zid='email';
     $zlabel='e-mail';
     $zvalue=$email;
     $zsize=1.5;
     $zhide=1;
     include('ele_input.php');
     
          
     $zid='wsapp';
     $zlabel='📱 Celular';
     $zvalue=$wsapp;
     $ztype='number';
     $zsize=1.5;
     if($fecha==date('Y-m-d'))
     {
     $zsave=1;
     $zsavet='plvh';
     $zsavec=$plvh;
     $zsavef='wsapp';
     }
     if(empty($numero)){$zreado=1; }  
//      if(!empty($numero)){$zreado=0;}  
     include('ele_input.php');
     }
          
     $cant=1;
     $zobj=4;
     $zid='cant';
     $zlabel='Cant.';
     $zvalue=(float)$cant;
     $zdefa=1;
     $zmin=0;
     $zmax=9999;
     $zwidth=5;
     $zclass='numeric-dec';
     $zhide=1;
     include('ele_input.php');


//      if($cost=='true')
     {
     $zid='puni';
     $zlabel='P.Unit';
     $zvalue=(float)$puni;
     $zmin=0;
     $zmax=9999.99;
     $zclass='numeric-dec';
     $zlist='dlpuni';
     $zsize=1.5;
     $zlabel='Tarifa';
     $zreado=1;     
     $zhide=1;
     include('ele_input.php');
          
     $zobj=4;
     $zid='iva';
     $zlabel='% IVA';
     $zvalue=$iva;
     $zmin=0;
     $zmax=9999;
     $zclass='numeric-dec';
     $zlist='dliva';
     $zsize=0.9;
     $zhide=1;
     include('ele_input.php');
          
//      $zid='total';
//      $zalign='right';
//      $zlabel='Total $2';
//      $zvalue=$total;
//      $zclass='numeric-dec';
//      $zwidth=7;
//      $zmax=99999.99;
//      $zsize=1.5;
//      $zreado=1;
// //      $zhide=1;     
//      include('ele_input.php');
          
          
     }


     
}

$zid='btn_final'; 
$zlabel='Finalizar';
$zalign='right';
$zonclick='{fn_finalizar();}';
if(!empty($numero) and empty($edit)){$zhide=1;}     
if(empty($numero)){$zhide=1;}     
if($stfin==1){$zhide=1;}  
$zsize=1.5;
include('ele_button.php');
     

$zid='btn_grabar'; 
$zlabel='Grabar';
$zalign='right';
$zonclick='{if(document.getElementById("plvh").value!=""){save_docu(event);}}';
$zsize=1.5;
if(empty($numero)){$zhide=0;}  
if(!empty($numero)){$zhide=1;}  
if($total==0){$zhide=0;}
$zsize=1.5;
$zbackcolor='black';   
$z1click=1;     
include('ele_button.php');
     
     
$zobj=2;     
include('ele_break.php');

}
     
// TITULO     
     
     

}     



// RESULTADO
$sty_resu='float:right;';
$sty_resu='margin:0 auto;';
echo '<span id="main2" style="'.$sty_resu.'"  >';
{
     if(gettype($res_info)!='NULL')
     {
          $zreso=$res_info;
          $zinfo=$info;
          $zname=$zname;
          $zhead=0;
          $zgfsize=0.9;
          $zheightrow='2';
          $zblockidnum=1;
          $zhidebtns=1;
          include('ele_grid.php');     
     }
}     
echo '</span>';     


echo '</div>';


$zid='btn_envia'; 
$zlabel='WsApp';
$zalign='right';
if(!empty($numero))
{$zonclick='{send_wsapp(document.getElementById("wsapp").value);}';}
$zsize=1.5;
if(empty($numero)){$zhide=1;}  
$zsize=1.5;
include('ele_button.php');
     

echo '<div align="center" height="auto" id="divstock" unselectable="on" onmousedown="return false;" onselectstart="return false;">';
echo '</div>';
echo '<div style="clear:both;">&#127380; : '.$idnum1.'</div>';


?>
<script>
function fn_consulta(event)
{
     var xhref='',dataget;
     xhref=xhref+'?scri=<?php echo basename(__FILE__,'.php');?>';
     
     dataget=new_FormData('filtros','get');
     xhref=xhref+dataget;
     
     document.getElementById("main2").innerHTML='Espere...';
     location.href=xhref;
}
</script>

<script>
function fn_nuevo(event)
{
     var enti;
     swal.fire({
          icon:'warning',
          title:'Nuevo Documento',
          text:'Continuar ?',
          confirmButtonText:'Nuevo',
          confirmButtonColor:color1,
          focusCancel:true,
          showCancelButton:true,
          cancelButtonColor: 'darkred',
          timer:60000
     }).then((result) => 
          {
               if(result.isConfirmed)
               {
                    document.getElementById("fecha").value="";
                    document.getElementById("numero").value="";
                    document.getElementById("idnum1").value="";
                    document.getElementById("hora1").value="";
                    document.getElementById("plvh").value="";
                    document.getElementById("wsapp").value="";
                    document.getElementById("stfin").value="";
//                     enti=document.getElementById("enti").value;
//                     {document.getElementById("enti").value="";}
                    enti=document.getElementById("codt").value;
                    {document.getElementById("codt").value="";}
                    fn_consulta(event);
               }
          })
}     
</script>


<script>
function fn_deledeta(event)
{
//      anul_docu(document.getElementById('docu').value,document.getElementById('idnum1').value,'ALL');
//      return;
}          
</script>

<script>
function fn_finalizar(event)
{
     swal.fire({
          icon:'warning',
          title:'Finalizar Documento',
          text:'Continuar ?',
          confirmButtonText:'Finalizar',
          confirmButtonColor:color1,
          focusCancel:true,
          showCancelButton:true,
          cancelButtonColor: 'darkred',
          timer:10000
     }).then((result) => 
          {
               if(result.isConfirmed)
               {
               document.getElementById("stfin").value="1";
               document.getElementById("iddet").value="1";
               save_docu(event);
               }
          })
}
</script>

<script>
function calc_subtot(event)
{
     var cant,puni,dcto,iva,ice,irbp,pvp;
     var subtot,tdcto,tice,tiva,tirbp,subtot,total;
     var efectivo,tarjeta,cambio;
     
     if(document.getElementById("cant")){cant=document.getElementById("cant").value ||0;}
     if(document.getElementById("puni")){puni=document.getElementById("puni").value ||0;}
     if(document.getElementById("dcto")){dcto=document.getElementById("dcto").value ||0;}
     if(document.getElementById("iva")){iva=document.getElementById("iva").value ||0;}
     if(document.getElementById("ice")){ice=document.getElementById("ice").value ||0;}
     if(document.getElementById("irbp")){irbp=document.getElementById("irbp").value ||0;}
     
     if(document.getElementById("subtot")){subtot=document.getElementById("subtot").value ||0;}
     if(document.getElementById("total")){total=document.getElementById("total").value ||0;}
     if(document.getElementById("efectivo")){efectivo=document.getElementById("efectivo").value ||0;}
     if(document.getElementById("tarjeta")){tarjeta=document.getElementById("tarjeta").value ||0;}
     
     subtot=puni;
     tdcto=subtot*dcto/100;
     tice=subtot*ice/100;
     subtot=subtot-tdcto+tice;
     tiva=subtot*iva/100;
     tirbp=cant*irbp;
     subtot=subtot+tiva;
     
     pvp=subtot;
     pvp=pvp.toFixed(2);
     
     subtot=subtot*cant;
     subtot=subtot.toFixed(2);
     
     if(total==0){total=subtot;}
     
     cambio=0;
//      if(efectivo>total && total>0)
     if(parseFloat(efectivo)>parseFloat(total) && parseFloat(total)>0)
     {cambio=efectivo-total;}
     
     if(document.getElementById("pvp")){document.getElementById("pvp").value=parseFloat(pvp);}
     if(document.getElementById("subtot")){document.getElementById("subtot").value=subtot;}

}
</script>

<script>document.title="<?php echo $xtitle;?>"</script>
<script>document.getElementById('topcenter').innerHTML="<?php echo $xtopcenter;?>"</script>
<!-- <script>calc_subtot()</script> -->
<?php if (empty($numero)) { ?>
<script>document.getElementById('plvh').focus();</script>
<?php } ?>

<?php if (!empty($numero)) { ?>
<script>document.getElementById('codt').focus();</script>
<?php } ?>

<script>
function send_wsapp(wsapp='')
{
     var url='',texto='',phone='',link='', linkv;
//      link='https://<?php echo strtolower($empr0['empr_codigo']); ?>.vcrxol.com/index3.php?scri=info_docu3&prnt=1';
     link='https://<?php echo strtolower($empr0['empr_codigo']); ?>.vcrxol.com/?scri=info_docu3&prnt=1';
     link=link+'&pgsize='+'<?php if($stfin==1){echo 'P';}else{echo 'T';} ?>';
     link=link+'&clave='+'<?php echo $claveacc; ?>';
     link=encodeURIComponent(link);
     
     
//      linkv=
     linkv='https://<?php echo strtolower($empr0['empr_codigo']); ?>.vcrxol.com/?scri=qplvh1';
     linkv=linkv+'&plvh='+'<?php echo strtoupper($plvh); ?>';
     linkv=encodeURIComponent(linkv);

     var eol='%0A';
     
     <?php if($stfin==1) {?>
     texto ='*=== COMPROBANTE - ELECTRONICO ===*';
     texto+=eol;
     texto+='📃 Factura : *'+'<?php echo $ptoe.'-'.$numero; ?>'+'* ';
     texto+=eol;
     <?php } ?>
     
     <?php if($stfin!=1) {?>
     texto ='*=== TICKET - ELECTRONICO ===*';
     texto+=eol;
     texto+='🧾 Ticket : *'+'<?php echo $ptoe.'-'.$numero; ?>'+'* ';
     texto+=eol;
     <?php } ?>
     
     texto+='📆 Fecha : '+'<?php echo $fecha; ?>'+' ';
     texto+=eol;
     texto+='Emisor : '+'<?php echo $empr0['empr_ruc'].' - '.$empr0['empr_descri']; ?>'+' ';
     texto+=eol;
     texto+='👤 Cliente : '+'<?php echo $enti.' - '.ucwords(strtolower($enti0['enti_descri'])) ; ?>'+' ';
     texto+=eol;
     
     <?php $uniclock=uni_clock($hora1); ?>
     
     texto+='🚘 Placa  : *'+'<?php echo strtoupper($plvh); ?>'+'* '+'<?php echo $plvh0['plvh_mrca'].' - '.$plvh0['plvh_clor']; ?>';
     texto+=eol;
     texto+='💲 Tarifa : $'+'<?php echo number_format($pvp,2); ?>'+' Hora o Fracción ';
     texto+=eol;
//      texto+='⌚ Entra  : *'+'<?php //echo $hora1; ?>'+'* ';
     texto+='<?php echo $uniclock; ?>'+' Entra  : *'+'<?php echo $hora1; ?>'+'* ';
     texto+=eol;
     
     <?php if($stfin!=1) {?>
     texto+='🔗 Link : '+linkv;
     texto+=eol;
     <?php } ?>
     
     <?php if($stfin==1) {?>
     texto+='⏰ Sale  : *'+'<?php echo $hora2; ?>'+'* ';
     texto+=eol;
     texto+='💲 Total : *$'+'<?php echo $total; ?>'+'* ';
     texto+=eol;
     texto+='🔑 Clave : '+'<?php echo $claveacc; ?>'+' ';
     texto+=eol;
     texto+='🔗 Link : '+link;
     <?php } ?>
     
     
     if(wsapp==='')
     {
          var mensaje='';
          mensaje=mensaje+'<result>';
          mensaje=mensaje+'<text>Digite Número</text>';
          mensaje=mensaje+'</result>';
          swal_fire(mensaje);
          return;
     }
     
     wsapp.substring(wsapp.length-10);
     wsapp=String(wsapp).padStart(10, '0');
     
     phone='593';
     phone='593'+wsapp;
     
     url=url+'https://api.whatsapp.com/send/';
     url=url+'?phone='+phone;
     url=url+'&text='+texto;
     
//      url=encodeURIComponent(url);
     
     window.open(url,'_blank');
}
</script>



