<?php 
declare(strict_types=0);
foreach($_GET as $campo => $valor){${$campo}=trim($valor);} 
foreach($_POST as $campo => $valor){${$campo}=trim($valor);} 
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;}

// echo '<meta http-equiv="refresh" content="5">';

$docu0=data_maes('docu',$docu);
$modu=$docu0['docu_tabla'];

// if(empty($modu)){$modu='caja';}

if($modu=='caja')
{
     $info='cjblog';
     $info_descri='CAJA';
}

if($modu=='bcos')
{
     $info='bcblog';
     $info_descri='BANCO';
}

// view_caba();

if(empty($format)){$format=2;}

if($docu0['docu_tabla']=='caja'){if($format==2){$info='cjdet2';}}
if($docu0['docu_tabla']=='bcos'){if($format==2){$info='bcdet2';}}
if($docu0['docu_tabla']=='dxco'){if($format==2){$info='dcdet2';}}
if($docu0['docu_tabla']=='dxpa'){if($format==2){$info='dpdet2';}}

if($info=='cjblog'){$info_descri='CAJA';}
if($info=='cjdet2'){$info_descri='DOC.CAJA';}
if($info=='bcblog'){$info_descri='BANCOS';}
if($info=='bcdet2'){$info_descri='DOC.BANCOS';}
if(empty($user0['user_tipo'])){$cost='false';}

// if(!mb_stristr2('.sist.supe',$user0['user_tipo']))
// {
//      $sql_acce='select * from acce1 left join acce2 on idnum1=idnum2 where numero='.$user_codigo.' and docum="COST" and info=1';
//      $res_acce=msql_query($sql_acce,$link_data);
//      if(msql_num_rows($res_acce)==0){$cost='false';}
// }

if(empty($rcdd)){$rcdd=$user0['user_cedula'];}

if(empty($caja)){$caja=$user0['user_caja'];}
if(empty($caja)){$caja=$_COOKIE['caja'];}

if(empty($ctab)){$ctab=$user0['user_ctab'];}
if(empty($ctab)){$ctab=$_COOKIE['ctab'];}



if(empty($caja))
{
     $fecha_caja=date('Y-m-01',strtotime('-1 month'));
     $sql_caja='select distinct bode from caja1 where status not in("O","X") and fecha>="'.$fecha_caja.'"';
     $res_caja=msql_query($sql_caja,$link_data);
     if(msql_num_rows($res_caja)==1)
     {$caja=msql_result($res_caja,0,'caja');}
}

if(empty($ctab))
{
     $fecha_ctab=date('Y-m-01',strtotime('-1 month'));
     $sql_ctab='select distinct ctab from bcos1 where status not in("O","X") and fecha>="'.$fecha_ctab.'" limit 1';
     $res_ctab=msql_query($sql_ctab,$link_data);
     if(msql_num_rows($res_ctab)==1)
     {$ctab=msql_result($res_ctab,0,'ctab');}
}     



if($format==2)
{
     $docum='';
     $cant=0;
     $puni=0;
}

$docu0=data_maes('docu',$docu);
$enti0=data_maes('enti',$enti);
$caja0=data_maes('caja',$caja);
$ctab0=data_maes('ctab',$ctab);
$bcos0=data_maes('bcos',$bcos);
$ctas0=data_maes('ctas',$ctas);
$docum0=data_maes('docu',$docum);

$modu=strtolower($modu);
$tabla=$modu;

$xtitulo='CAJA/BCOS';
// if($modu=='caja'){$xtitulo='CAJA';}
// if($modu=='bcos'){$xtitulo='BANCO';}

if($modu=='dxco'){$xtitulo='DOC X COB';}
if($modu=='dxpa'){$xtitulo='DOC X PAG';}

$xtitle='REG.'.$xtitulo;
$xtopcenter=$xtitle;
if(!empty($docu)){$xtitle.=' /'.$docu;}
if(!empty($numero)){$xtitle.='-'.$numero;}
if(empty($numero)){$total=0;}

$fecha0=fecha0($modu);
if(empty($fecha)){$fecha=date('Y-m-d');}

if(empty($fecha1)){$fecha1=date('Y-m-d',strtotime('-7 days'));}
if(empty($fecha2)){$fecha2=date('Y-m-d');}

// $fecha_min=date('Y-m-d',strtotime('-7 days'));
{
$fecha_min=date('Y-m-01',strtotime('-10 days'));
     
if($cfg_empr=='span'){$fecha_min=date('Y-m-01',strtotime('-2 month'));}
if($cfg_empr=='pcs1'){$fecha_min=date('Y-m-01',strtotime('-1 month'));}
}
if($cfg_empr=='pcs1' and date('Y-m-d')<='2025-06-10'){$fecha_min=date('Y-m-01',strtotime('-2 month'));}
if($cfg_empr=='imcp' and date('Y-m-d')<='2025-06-11'){$fecha_min=date('Y-m-01',strtotime('-1 month'));}


$dom = new DOMDocument();
     $dom->encoding = 'utf-8';
     $dom->xmlVersion = '1.0';
     $dom->formatOutput = true;
echo $dom->saveXML();

// echo '<br>===='.$format;
// echo '<br>1===='.$docu;
// echo '<br>1===='.$caja;
// echo '<br>1===='.$numero;
// echo '<br>1===='.$sql_info;

// if($format==2 and !empty($docu) and !empty($caja) and !empty($numero))
if($format==2 and !empty($docu) and !empty($caja.$ctab) and !empty($numero))
{include('sele_info.php');}

// echo '<br>1===='.$sql_info;

// if($format==3 and !empty($caja) and empty($numero))
// {include('sele_info.php');}

// echo '=========='.$modu;
// echo '=========='.$caba;

if(!empty($modu))
if(!empty($caba))
if($format==3 and empty($numero))
{
     $caja='';
     $ctab='';
     $modu=$docu0['docu_tabla'];
     if($docu0['docu_tabla']=='caja'){$caja=$caba; }
     if($docu0['docu_tabla']=='bcos'){$ctab=$caba;}
     include('sele_info.php');
}

// echo '<br>===='.$sql_info;

$data_head=array();

if(!empty($sql_info))
{
     $sql_info1=$sql_info;
     $sql_info1=str_replace('group by idnum1,iddet','group by idnum1',$sql_info1);
     $sql_info1=str_replace('group by idnum1,iddet','group by idnum1',$sql_info1);
     $res_info1=msql_query($sql_info1,$link_data);
     
     $cantidad=msql_result($res_info1,0,'total_hide');
     $total=msql_result($res_info1,0,'total_hide');
     
     $sql_info=str_replace('order by ','order by fecha desc, idnum1 desc, iddet desc, ',$sql_info);
     $sql_info.=' limit 100';
     $res_info=msql_query($sql_info,$link_data);
     if(msql_num_rows($res_info)==0)
     {
          if($fecha1!=$fecha2)
          {
               $sql_info=str_replace($fecha1,$fecha0,$sql_info);
               $res_info=msql_query($sql_info,$link_data);
          }
     }
     
     $msgres=number_format(msql_num_rows($res_info)).' Resultado(s)...';

     if(!empty($numero))
     {
          $idnum1=msql_result($res_info,0,'idnum1');
          if(empty($idnum1)){$idnum1=msql_result($res_info,0,'idnum1_hide');}
          $edit=msql_result($res_info,0,'b_o');
          if(msql_num_rows($res_info)==0){$edit=1;}
          

          $data_head=data_docu($docu,$idnum1);
          foreach($data_head as $key => $value){${$key}=trim($value);} 
     }
     if(empty($idnum1)){$edit=1;}
}

// echo '*/*/*'.$format;
// PANTALLA FILTROS
$bgcolor=$caba0['caba_color'];
echo '<div id="filtros" style="background-color:'.$bgcolor.';" noprint >';
{
// OCULTOS
echo '<div hide>';     
     echo '<input id="format" value="'.$format.'">';
//      echo '<input id="modu" value="'.$modu.'">';
     echo '<input id="info" value="'.$info.'">';
     echo '<input id="idnum1" value="'.$idnum1.'">';
     echo '<input id="fecha1" value="'.$fecha1.'">';
     echo '<input id="fecha2" value="'.$fecha2.'">';
     echo '<input id="stfin" value="'.$stfin.'">';
echo '</div>';     
     
$ztabla='ctas';
include('ele_datalist.php');
     
$ztabla='enti';
{$zwhere='(left(enti_codigo,10) in(select distinct left(enti,10) from vtas1) or left(enti_codigo,10) in(select distinct left(enti,10) from comp1))';}
include('ele_datalist.php');
     
$ztabla='docu';
$zwhere='(docu_tabla in("caja","bcos","dxco","dxpa") and docu_tipo like "tran")';
include('ele_datalist.php');

$zid='dldocum';     
$ztabla='docu';
$zwhere='(docu_tabla in("caja","bcos","vtas","comp","dxco","dxpa"))';
include('ele_datalist.php');

$zobj=2;     
include('ele_break.php');
 
if($format==2) 
{
     $zid='btn_nuevo'; 
     $zlabel='Nuevo';
     $zalign='right';
     $zonclick='{fn_nuevo();}';
     $zsize=1.5;     
     include('ele_button.php');
}


     
if($format==3)
{
     $zid='modu';
     $ztabla='modu';
     $zlabel='Modulo';
     $zvalue=$modu; 
     $zexact=1;     
//      if(!empty($caba)){$zreado=1;}
//      $zondblclick='{document.getElementById("'.$zid.'").removeAttribute("disabled");}';     
//      $zonchange='{fn_consulta(event);}';
//      $zonblur=$zonchange;
     $zhide=1;
     include('ele_select.php');  
     
     $zid='caba';
     $ztabla='caba';
     $zlabel='Caja/Ctab';
     $zvalue=$caba; 
     $zexact=1;     
     if(!empty($caba)){$zreado=1;}
     $zondblclick='{document.getElementById("'.$zid.'").removeAttribute("disabled");}';     
     $zonchange='{fn_consulta(event);}';
     $zonblur=$zonchange;
     include('ele_select.php');     
}
     
     
if(1==2)     
if($format==3 and $modu=='caja')
{
     $zid='caja';
     $ztabla='caja';
     $zlabel='Caja';
     $zvalue=$caja; 
     $zexact=1;     
     if(!empty($caja)){$zreado=1;}
     $zondblclick='{document.getElementById("'.$zid.'").removeAttribute("disabled");}';     
     $zonchange='{fn_consulta(event);}';
     $zonblur=$zonchange;
     include('ele_select.php');
}

if(1==2)     
if($format==3 and $modu=='bcos')
{
     $caba1=$ctab;     
     $zid='ctab';
     $ztabla='ctab';
     $zlabel='Banco';
     $zvalue=$ctab; 
     $zexact=1;     
     if(!empty($ctab)){$zreado=1;}
     $zondblclick='{document.getElementById("'.$zid.'").removeAttribute("disabled");}';     
     $zonchange='{fn_consulta(event);}';
     $zonblur=$zonchange;
     include('ele_select.php');
}
     
     
     
$zid='fecha';
$ztype='date';
$zlabel='Fecha';
$zvalue=$fecha;
$zmin=$fecha_min;     
$zmax=$fecha2;
include('ele_input.php');  
     
$zid='docu';
$zlabel='Docum.';
$zvalue=$docu;
$ztabla='docu';
// $zwhere='(docu_tabla="caja" or docu_tabla="bcos")';
$zwhere='(docu_tabla in ("caja","bcos","dxco","dxpa"))';
$zonchange='{fn_consulta(event);}';     
if(!empty($numero)){$zreado=2;}
include('ele_input.php');     
     
if($format==2) 
{
     $zid='numero';
     $zlabel='№';
     $zvalue=$numero;
     $zvalue=(int)$numero;
     $zmin=0;
     $zmax=999999999;  
     $zautoc='off';
     $zclass='numeric-int';
     
     $zreado=1;
     if($numero*1>0){$zreado=2;}
     if(substr($docu,0,3)=='ICH'){$zreado=0;}
     if(mb_stristr2('.IV10.EV10',$docu)){$zreado=0;}
     if($modu=='bcos'){$zreado=0;}
//      echo '===='.$modu;
     
     $zondblclick='{document.getElementById("'.$zid.'").style.width="'.round(7*2/3,2).'em";}';     
     $zonblur='{if(document.getElementById("'.$zid.'").getAttribute("disabled")!=""){document.getElementById("idnum1").value="";}}';
     $zonchange='{fn_consulta(event);}';
     $zbackcolor='grey';
     $zfontcolor='white';
     $zsize=1.2;     
     include('ele_input.php');
     
     $zid='fcobro';
     $ztype='date';
     $zlabel='F.Cobro';
     $zvalue=$fecha;
     $zhide=1;
     $zmin=$fecha_min;     
     $zmax=$fecha2;
     if(substr($docu,0,3)=='ICH')
     {$zhide=0; $zmax=date('Y-m-j',strtotime('+12 month'));}
     if($modu=='bcos'){$zhide=1;}
     include('ele_input.php');  
     
}
     
$zid='total';
$zlabel='Total 💲';
$zvalue=number_format($total,2);
$zwidth=5;
$zclass='align-r';
$zalign='right';     
$zsize=1.5;
if($total>0){$zreado=2;}
// if($total==0){$zhide=1;}     
$zhide=1;     
include('ele_input.php');

     
$zid='valtot';
$zlabel='Valor 💲';
$zvalue=number_format($valtot,2);
$zwidth=5;
// $zclass='align-r';
$zalign='right';     
$zclass='numeric-dec';
$zsize=1.5;
$zonchange='';    
$zonchange.='{document.getElementById("docum").value="";}';
$zonchange.='{document.getElementById("ptoem").value="";}';
$zonchange.='{document.getElementById("numer").value="";}';
$zonchange.='{document.getElementById("cant").value="";}';
$zonchange.='{calc_subtot();}';
// if($total>0){$zreado=2;}
// if($total==0){$zhide=1;}     
include('ele_input.php');
     
     
     
     
     
     
$zobj=1;     
include('ele_break.php');


     
     
     

// if($modu=='bcos')
// {
// $zobj=1;     
// include('ele_break.php');
// }
     
if($modu=='bcos')
if($format==2)
{
     $caba1=$ctab;
     $zid='ctab';
     $ztabla='ctab';
     $zlabel='Banco';
     $zvalue=$ctab; 
     $zondblclick='{document.getElementById("'.$zid.'").removeAttribute("disabled");}';     
     $zonchange='{fn_consulta(event);}';
     $zonblur=$zonchange;
     $zexact=1;     
     include('ele_select.php');
}

     
     
     

     
     
     
     
     
     
     
     
     
     
     
     
     
     
    
     

     
     
     
     
     
     
          
if($format==2)
{
     $zid='btn_print'; 
     $zlabel='Imprimir';
     $zalign='right';
//      $href='?prnt=1&docu='.$docu.'&idnum='.$idnum1.'&formato=';  
     $href='?scri=info_docu3&prnt=1&docu='.$docu.'&idnum='.$idnum1.'&formato=';  
     if(mb_stristr2('.hg01',$cfg_empr)){$href.='&destino=txt';}
     $zonclick='{print_url("'.$href.'");}';
     if(empty($idnum1)){$zhide=1;}     
     $zsize=1.5;     
     include('ele_button.php');
}
               
if($format==3)
{
     $zid='btn_consul'; 
     $zlabel='Consultar';
     $zalign='right';
     $zonclick='{document.getElementById("fecha1").value="";document.getElementById("fecha2").value="";fn_consulta(event);}';
     include('ele_button.php');
}     

// echo '<span style="float:right; white-space:nowrap;">';     
// echo '</span>';     

// $zid='total';
// $zlabel='Total 💲';
// $zvalue=number_format($total,2);
// $zwidth=5;
// $zclass='align-r';
// $zalign='right';     
// $zsize=1.5;
// if($total>0){$zreado=2;}     
// include('ele_input.php');
     
// $zobj=1;     
// include('ele_break.php');

if($modu=='caja')     
if($format==2)
{
     $caba1=$caja;     
     $zid='caja';
     $ztabla='caja';
     $zlabel='Caja';
     $zvalue=$caja; 
     $zondblclick='{document.getElementById("'.$zid.'").removeAttribute("disabled");}';     
     $zonchange='{fn_consulta(event);}';
     $zonblur=$zonchange;
     $zexact=1;     
     include('ele_select.php');
}

     
if(@mb_stristr2('.DB10.EE13.CH10.ND13',$docu))
{
     $zid='caba2';
     $zlabel='Caja/Bco.2';
     $zvalue=$caba2;
     $ztabla='caba';
     $zwhere='(caba_codigo!="'.$caba1.'")';
     include('ele_select.php');
}     
     
     
     
if(@mb_stristr2('.DB10.EE13.CH10.ND13',$docu))
{
//      $zid='caba2';
//      $zlabel='Caja/Bco.2';
//      $zvalue=$caba2;
//      $ztabla='caba';
//      $zwhere='(caba_codigo!="'.$caba1.'")';
//      $zexact=1;
//      include('ele_select.php');
}     

// bcos
// if(!empty($ctab) and !empty($docu) and !empty($numero))
// caja     
// if(!empty($caja) and !empty($docu))
     
if(!empty($docu))
{
//      if($format==2)
     if(!@mb_stristr2('.DB10.EE13.CHX10.ND13',$docu))
     {
          $zid='enti';
          $zlabel='Entidad';
          if(@mb_stristr2('.DC10.ICH1.IV10',$docu)){$zlabel='Cliente';}
          if(@mb_stristr2('.DP10.CH10.EV10',$docu)){$zlabel='Proveedor';}
          if(@mb_stristr2('.DP90.',$docu)){$zlabel='Empleado';}
          $zvalue=$enti;
          $ztabla='enti';
//           $zonblur ='{fn_cxcp(event);fn_cxcp(event,"cxpa");}';
//           $zonenter=$zonblur;
//           if(mb_stristr2('.ICH1.',$docu))
          {
               $zonblur='{fn_consulta(event);}';
               $zonchange='{fn_consulta(event);}';
          }
          include('ele_input.php');

     }     

     
     
     if(@mb_stristr2('.IE10.DC10',$docu))
     {
          $zid='rcdd';
          $ztabla='rcdd';
          $zlabel='Recaudador';
          $zvalue=$rcdd;
          $zlist='dlrcdd';
          $zalign='right';
          $zhide=1;
//           if($tpos==1){$zobj=1;$zreado=1;$zhide=0;}
//           if($tpos==2){$zreado=2;$zobj=6;}
//           if($tpos==3){$zreado=0;$zobj=6;}
//           if($tpos!=1){$zdefa=$vndd;}

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

     $zid='concepto';
     $zlabel='Concepto';
     $zwidth=25;    
     $zrows=2;     
     $zvalue=$concepto;
     include('ele_input.php');

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

     if(@mb_stristr2('.caja.bcos.dxco.dxpa',$modu))
     {
          $zobj=4;
          $zid='docum';
          $zlabel='Doc.Apli.';
          $zvalue=$docum;
          $ztabla='docu';
          $zlist='dldocum';
          if(substr($docu,2,2)=='13')
          {
               $zvalue='';
               $zreado=1;
          }
          include('ele_input.php');

          $zobj=4;
          $zid='ptoem';
          $zlabel='Pto.Emi.';
          $zvalue=$ptoem;
          $zclass='numeric-int';
          $zwidth=6;
          if(substr($docu,2,2)=='13')
          {
               $zvalue='';
               $zreado=1;
          }
          include('ele_input.php');

          $zobj=4;
          $zid='numer';
          $zlabel='Número';
          $zvalue=$numer;
          $zclass='numeric-int';
          if(substr($docu,2,2)=='13')
          {
               $zvalue='';
               $zreado=1;
          }
          include('ele_input.php');

          $zobj=4;
          $zid='cant';
          $zlabel='Cantidad';
          $zvalue=(float)$cant;
          $zwidth=5;
          $zclass='numeric-dec';
          if(substr($docu,2,2)=='13')
          {
               $zvalue='';
//                $zreado=1;
          }
          include('ele_input.php');
          
     }
     
     $zid='btn_grabar'; 
     $zlabel='Grabar';
     $zalign='right';
     $zonclick='{save_docu(event);}';
     if(!empty($numero) and empty($edit)){$zhide=1;}
     if(substr($docu,0,3)=='ICH'){$zhide=0;}
     if($format==3){$zhide=0;}
     $zsize=1.5;     
     if(days_diff($data_head['idate'])>1){$zhide=1;}
     if($data_head['stfin']==1){$zhide=1;}
     include('ele_button.php');

     $zobj=4;
     $zid='ctas';
     $zlabel='Cta. Contable';
     $zvalue=$ctas;
     $ztabla='ctas';
     if(substr($docu,2,2)=='13' or mb_stristr2('.DC.DP.AC.AP.',substr($docu,0,2)) )
     {
          $zvalue='';
          $zreado=1;
     }
     include('ele_input.php');

     $zobj=4;     
     $zid='detalle';
     $zlabel='Notas';
     $zwidth=25;    
     $zrows=2;     
     $zvalue=$detalle;
     include('ele_input.php');
     
}

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

}     
echo '</div>';

// RESULTADO
echo '<div id="main2" >';
if(gettype($res_info)!='NULL')
{
     $zalign='right';
     $zid='difer';
     $zlabel='Difer.';
//      $zvalue=number_format($total-$cantidad,2);
     $zvalue=number_format($valtot-$total,2);
     $zwidth=8;
     $zclass='numeric-dec';
     $zreado=1;
     if($total<=0){$zhide=1;}
     include('ele_input.php');
     
     $zreso=$res_info;
     $zinfo=$info;
     $zname=$zname;
     $zhead=0;
     $zgfsize=0.9;
     $zheightrow='2';
     $zblockidnum=1;
     $zhidebtns=1;
     if($format==3)
     {
          $zblockidnum=0;
          $zblockfield='fecha';
     }
     include('ele_grid.php');     
}
echo '</div>';     

$qcxco=0;
$qcxpa=0;
if(mb_stristr2('.IE.IC.DC.AC..CC.IV.',substr($docu,0,2))){$qcxco=1;}
// if(mb_stristr2('.EE.CH.DP.AP',substr($docu,0,2))){$qcxpa=1;}
if(mb_stristr2('.EE.CH.DP.AP..CP.EV',substr($docu,0,2)) or $docu=='ECH2'){$qcxpa=1;}


if(1==2)
if(!empty($enti))
if(substr($enti,0,4)!='9999')     
{
     if($qcxco==1){$anticipo=calc_anticipo('AC',$enti);}
     if($qcxpa==1){$anticipo=calc_anticipo('AP',$enti);}
     $zid='anticipo';
     $zlabel='Anticipos';
     $zvalue=number_format($anticipo,2);
     $zreado=1;
     $ztalign='right;';
     $zwidth=5;
     $zclass='numeric-dec';
     if($anticipo==0){$zhide=1;}
     $zhide=1;
     include('ele_input.php');
}

// if($qcxco==1)
{
     $zobj=2;     
     include('ele_break.php');
     
     $zid='btn_cxcob'; 
     $zlabel='🔎 CXCob';
     $zonclick='{fn_cxcp(event,"cxco");}';
     if($qcxco==0){$zhide=1;}
     include('ele_button.php'); 
     
     $zobj=1;     
     include('ele_break.php');
     

     $dom_div = new DOMDocument();
          $dom_div->encoding = 'utf-8';
          $dom_div->xmlVersion = '1.0';
          $dom_div->formatOutput = true;

          $div=$dom_div->appendChild($dom_div->createElement("div",""));
               $div->setAttribute("id","divcxco");
               $div->setAttribute("align","center");
               $div->setAttribute("height","auto");
               $div->setAttribute("unselectable","on");
               $div->setAttribute("onmousedown","return false;");
               $div->setAttribute("onselecstart","return false;");
               $div->setAttribute("style","margin-top:0em;");
               if($qcxco==0){$div->setAttribute("hide","");}
     echo $dom_div->saveHTML();
}

// if($qcxpa==1)
{
     $zobj=2;     
     include('ele_break.php');
     
     $zid='btn_cxpag'; 
     $zlabel='🔎 CXPag';
     $zonclick='{fn_cxcp(event,"cxpa");}';
     if($qcxpa==0){$zhide=1;}
     include('ele_button.php');

     $zobj=1;     
     include('ele_break.php');
     
    $dom_div = new DOMDocument();
          $dom_div->encoding = 'utf-8';
          $dom_div->xmlVersion = '1.0';
          $dom_div->formatOutput = true;

          $div=$dom_div->appendChild($dom_div->createElement("div",""));
               $div->setAttribute("id","divcxpa");
               $div->setAttribute("align","center");
               $div->setAttribute("height","auto");
               $div->setAttribute("unselectable","on");
               $div->setAttribute("onmousedown","return false;");
               $div->setAttribute("onselecstart","return false;");
               $div->setAttribute("style","margin-top:0em;");
               if($qcxpa==0){$div->setAttribute("hide","");}
     echo $dom_div->saveHTML();
}

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

echo '<div style="clear:both;">&#127380; : '.$idnum1.'</div>';
?>

<script>
function fn_cxcp(event,modu='cxco')
{
     var enti,docu,modu,info,xdiv,xsrc='?';
     enti=document.getElementById('enti').value;
     docu=document.getElementById('docu').value;
     if(enti===''){return;}
     if(docu===''){return;}
     
     xdiv='div'+modu;
     if(modu=='cxco'){info='ccresu';}     
     if(modu=='cxpa'){info='cpresu';}     
     
     if(enti.length>=10)
     {
          var datapost,dato;
          datapost=new FormData();
          datapost.append('script','info_modu3');
          datapost.append('modu',modu);
          datapost.append('info',info);
          datapost.append('fecha1','2000-01-01');
          datapost.append('fecha2','<?php echo date('Y-m-t');?>');
          datapost.append('prnt','1');
          datapost.append('zhidebtns','1');
          datapost.append('zhidehead','1');
          datapost.append('zhidecols','1');
          datapost.append('enti',enti);
          datapost.append('tsaldo','69');
          dato=exe_ajax(datapost,xdiv,'',true);
     }
}
</script>

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

     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("numero").value="";
                    document.getElementById("idnum1").value="";
                    document.getElementById("total").value="0";
                    enti=document.getElementById("enti").value;
                    {document.getElementById("enti").value="";}
                    fn_consulta(event);
               }
          })
}     
     
</script>

<script>document.title="<?php echo $xtitle;?>"</script>
<script>document.getElementById('topcenter').innerHTML="<?php echo $xtopcenter;?>"</script>
<!-- <script>set_noback();</script> -->
<!-- <script>window.onbeforeunload = function(){return 'Are you sure you want to leave?';};</script> -->

