$cargosAseguradora = new acumulados();
 $cargosParticulares = new acumulados();
 $otros = new acumulados();
 if ($_GET['tipoVenta'] == 'interno') {
     if ($tipoCliente == 'otros') {
         $cargoxPagar = $otros->otros($basedatos, $usuario, $_GET['numeroE'], $_GET['nCuenta']);
     } else {
         if ($tipoCliente == 'aseguradora') {
             $cargoxPagar = $cargosAseguradora->cargosAseguradora($basedatos, $usuario, $_GET['numeroE'], $_GET['nCuenta']);
         } else {
             if ($tipoCliente == 'particular') {
                 $cargoxPagar = $cargosParticulares->cargosParticulares($basedatos, $usuario, $_GET['numeroE'], $_GET['nCuenta']);
             } else {
                 if ($tipoCliente == 'coaseguro') {
                     $coaseguro = new acumulados();
                     $cargoxPagar = $coaseguro->cargosCoaseguro($basedatos, $usuario, $_GET['numeroE'], $_GET['nCuenta']);
                 }
             }
         }
     }
     if ($_GET['tipoVenta'] != 'interno') {
         if ($convenioAseguradora->convenioAseguradora($basedatos, $usuario, $_GET['numeroE'], $_GET['nCuenta'])) {
             $cargoxPagar = $convenioAseguradora->convenioAseguradora($basedatos, $usuario, $_GET['numeroE'], $_GET['nCuenta']);
         }
     }
     //solo casos de externos entran a convenios
 } else {
     //el tipo de venta es externo
     if ($_GET['tipoPago'] == 'Credito' and $convenioAseguradora->convenioAseguradora($basedatos, $usuario, $_GET['numeroE'], $_GET['nCuenta'])) {
         $cargoxPagar = $convenioAseguradora->convenioAseguradora($basedatos, $usuario, $_GET['numeroE'], $_GET['nCuenta']);
     } else {
         } else {
             $valor = $cargosParticularesCC->cargosParticularesCC($basedatos, $usuario, $_GET['nCuenta']);
             $valor = 'Escribe la Cantidad';
         }
         //*****************************************
     } else {
         //pESTE SOLO ES para AlTa de PaCientEs
         $sSQL3471 = "Select codigoTT From catTTCaja WHERE codigoTT='" . $_GET['transaccion'] . "'";
         if ($_GET['tipoTransaccion'] == 'particular') {
             $valor = $cargosParticularesCC->cargosParticularesCC($basedatos, $usuario, $_GET['nCuenta']);
         } else {
             if ($_GET['tipoTransaccion'] == 'otros') {
                 $valor = $otros->otros($basedatos, $usuario, $numeroE, $nCuenta);
             } else {
                 if ($_GET['tipoTransaccion'] == 'coaseguro') {
                     $valor = $coaseguro->cargosCoaseguro($basedatos, $usuario, $_GET['nCuenta']);
                 } else {
                     if ($_GET['tipoTransaccion'] == 'aseguradora') {
                         $valor = $cargosAseguradoraCC->cargosAseguradoraCC($basedatos, $usuario, $_GET['nCuenta']);
                     }
                 }
             }
         }
     }
     //cierra alli
 } else {
     //tipo de paciente externo
     if ($myrow3['paquete'] == 'si') {
         $sSQL3471 = "Select * From catTTCaja WHERE banderaPaquete = 'si'";
         //***************EFECTUO VARIOS PASOS*******************
         $sSQL17u = "\r\n\tSELECT \r\nseguro\r\n\r\nFROM\r\nclientesInternos\r\nWHERE \r\nkeyClientesInternos='" . $_GET['nCuenta'] . "'\r\n";
    public function eCuenta($bali, $transacciones, $TITULO, $entidad, $fecha1, $hora1, $dia, $usuario, $nT, $basedatos)
    {
        include CONSTANT_PATH_CONFIGURACION . "/funciones.php";
        $cargosCia = new acumulados();
        $cargosParticularesCC = new cierraCuenta();
        $cargosAseguradoraCC = new cierraCuenta();
        ?>
<script language=javascript> 
function ventanaSecundaria4 (URL){ 
   window.open(URL,"ventana4","width=800,height=300,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script>
<script language=javascript> 
function ventanaSecundaria2 (URL){ 
   window.open(URL,"ventana2","width=630,height=500,scrollbars=YES,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria1 (URL){ 
   window.open(URL,"ventana1","width=530,height=300,scrollbars=YES") 
} 
</script> 

<script language=javascript> 
function ventanaSecundaria5 (URL){ 
   window.open(URL,"ventana5","width=500,height=500,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script>

<script language=javascript> 
function ventanaSecundaria3 (URL){ 
   window.open(URL,"ventana3","width=500,height=400,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script>

<script language=javascript> 
function ventanaSecundaria6 (URL){ 
   window.open(URL,"ventana6","width=500,height=400,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script>
<script language=javascript> 
function ventanaSecundaria7 (URL){ 
   window.open(URL,"ventana7","width=500,height=600,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script>
<script language="javascript" type="text/javascript">   
//Validacion de campos de texto no vacios by Mauricio Escobar   
//   
//Iv�n Nieto P�rez   
//Este script y otros muchos pueden   
//descarse on-line de forma gratuita   
//en El C�digo: www.elcodigo.com   
  
  
//*********************************************************************************   
// Function que valida que un campo contenga un string y no solamente un " "   
// Es tipico que al validar un string se diga   
//    if(campo == "") ? alert(Error)   
// Si el campo contiene " " entonces la validacion anterior no funciona   
//*********************************************************************************   
  
//busca caracteres que no sean espacio en blanco en una cadena   
function vacio(q) {   
        for ( i = 0; i < q.length; i++ ) {   
                if ( q.charAt(i) != " " ) {   
                        return true   
                }   
        }   
        return false   
}   
  
//valida que el campo no este vacio y no tenga solo espacios en blanco   
function valida(F) {   
           
        if( vacio(F.campo.value) == false ) {   
                alert("Introduzca un cadena de texto.")   
                return false   
        } else {   
                alert("OK")   
                //cambiar la linea siguiente por return true para que ejecute la accion del formulario   
                return true   
        }   
           
}   
  
  
  
  
</script> 

<SCRIPT LANGUAGE="JavaScript">
function checkIt(evt) {
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        status = "Este campo s�lo acepta n�meros."
        return false
    }
    status = ""
    return true
}
</SCRIPT>
<script type="text/javascript">
<!-- por carlitos. cualquier duda o pregunta, visita www.forosdelweb.com

var ancho=100
var alto=100
var fin=300
var x=100
var y=100

function inicio()
{
ventana = window.open("cita.php", "_blank", "height=1,width=1,top=x,left=y,screenx=x,screeny=y");
abre();
}
function abre()
{
if (ancho<=fin) {
ventana.moveto(x,y);
ventana.resizeto(ancho,alto);
x+=5
y+=5
ancho+=15
alto+=15
timer= settimeout("abre()",1)
}
else {
cleartimeout(timer)
}
}
// -->
</script>




<?php 
        $cargosParticulares = new acumulados();
        $totalxSurtir = new acumulados();
        $cargosAseguradora = new acumulados();
        $otros = new acumulados();
        if ($_POST['cerrar']) {
            $particular = $_POST['particular'];
            $aseguradora = $_POST['aseguradora'];
            //cierro cuenta
            $agrega4 = "UPDATE clientesInternos set \r\ntipoCuenta='H',\r\nstatus='cerrada',\r\nstatusCuenta='cerrada',\r\nusuarioCierre='" . $usuario . "',\r\nfechaCierre='" . $fecha1 . "',\r\nhoraCierre='" . $hora1 . "',\r\nstatusCaja='pagado'\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "' ";
            mysql_db_query($basedatos, $agrega4);
            echo mysql_error();
            //********************CIERRO STATUS CUENTA***********************
            $agrega = "UPDATE cargosCuentaPaciente set \r\nstatusCuenta='cerrada',fechaCierre='" . $fecha1 . "'\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "'";
            mysql_db_query($basedatos, $agrega);
            echo mysql_error();
            //*********************************************
            //cierro cuarto a sucio
            if ($myrow3['cuarto']) {
                $agregad = "UPDATE cuartos set \r\nstatus='sucio',\r\nusuarioSalida='" . $usuario . "',\r\nfechaSalida='" . $fecha1 . "',\r\nhoraSalida='" . $hora1 . "'\r\n\r\nwhere\r\ncodigoCuarto='" . $myrow3['cuarto'] . "' \r\n";
                //mysql_db_query($basedatos,$agregad);
                echo mysql_error();
            }
            $leyenda = 'Se cerr� la cuenta';
            $sSQL3 = "Select * From clientesInternos WHERE folioVenta = '" . $_GET['folioVenta'] . "' ";
            $result3 = mysql_db_query($basedatos, $sSQL3);
            $myrow3 = mysql_fetch_array($result3);
            if ($myrow3['status'] == 'cerrada' and $myrow3['statusCuenta'] == 'cerrada') {
                ?>
<script>
window.opener.document.forms["form1"].submit();
window.alert("Cuenta Cerrada");
//window.close();
</script>
<?php 
            } else {
                ?>

<script>
window.opener.document.forms["form1"].submit();
window.alert("Hay un problema con la cuenta");
//window.close();
</script>


<?php 
            }
        }
        ?>




















<!-Hoja de estilos del calendario --> 
  <link rel="stylesheet" type="text/css" media="all" href="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/calendario/calendar-tas.css" title="win2k-cold-1" /> 

  <!-- librer�a principal del calendario --> 
 <script type="text/javascript" src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/calendario/calendar.js"></script> 

 <!-- librer�a para cargar el lenguaje deseado --> 
  <script type="text/javascript" src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/calendario/lang/calendar-es.js"></script> 

  <!-- librer�a que declara la funci�n Calendar.setup, que ayuda a generar un calendario en unas pocas l�neas de c�digo --> 
  <script type="text/javascript" src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/calendario/calendar-setup.js"></script> 
  
  
  <?php 
        $sSQL3 = "Select * From clientesInternos WHERE folioVenta = '" . $_GET['folioVenta'] . "' ";
        $result3 = mysql_db_query($basedatos, $sSQL3);
        $myrow3 = mysql_fetch_array($result3);
        //***************aplicar pago**********************
        if ($myrow3['statusCuenta'] == 'cerrada' and $myrow3['status'] == 'cerrada') {
            echo "LA CUENTA DEL PACIENTE " . $myrow3['paciente'] . " ESTA CERRADA...";
            ?>
    <input name="imprimir" type="submit" class="normal" id="imprimir" value="Imprimir" onClick="window.print();return false" />
   
   <?php 
        } else {
            ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<html xmlns="http://www.w3.org/1999/xhtml">



<head>
<?php 
            $showStyles = new muestraEstilos();
            $showStyles->styles();
            ?>
</head>



<BODY  >
<?php 
            //ventanasPrototype::links();
            ?>
<h1 align="center"><?php 
            echo $TITULO;
            ?>
</h1>
<form id="form1" name="form1" method="post" action="">
  <table width="549" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#990099" class="normal">
    <tr bgcolor="#330099">
      <th bgcolor="#330099" class="blancomid" scope="col"><div align="left">Folio de Venta</div></th>
      <th class="blanco" scope="col"><div align="left"><?php 
            echo $_GET['folioVenta'];
            $nCliente = $myrow3['keyClientesInternos'];
            ?>
          <input name="numeroE" type="hidden" class="normal" id="numeroE" 
		  value="<?php 
            echo $nCliente = $_POST['numeroE'];
            ?>
" readonly=""/>
</label></div>      </th>
    </tr>
    <tr>
      <th width="160" bgcolor="#330099" class="blancomid" scope="col"><div align="left"><strong>Paciente</strong></div></th>
      <th width="382" bgcolor="#FFFFFF" class="normal" scope="col"><div align="left"><strong>
          <label> </label>
      </strong> <?php 
            echo $myrow3['paciente'];
            ?>
 </div></th>
    </tr>
    <tr>
      <td bgcolor="#330099" class="blancomid">Compa&ntilde;&iacute;a</td>
  <td bgcolor="#FFFFFF" class="normal"><label> <?php 
            echo $traeSeguro = $myrow3['seguro'];
            ?>
            <?php 
            displaySeguro::despliegaSeguro($traeSeguro, $basedatos);
            ?>
            <input name="seguro2" type="hidden" id="seguro2" value="<?php 
            echo $traeSeguro;
            ?>
" />
      </label></td>
    </tr>
    <tr>
      <td bgcolor="#330099" class="blancomid">N&deg; Credencial</td>
      <td bgcolor="#FFFFFF" class="normal"><?php 
            echo $myrow3['credencial'];
            ?>
 </td>
    </tr>
    <tr>
      <th bgcolor="#330099" class="blanco" scope="col"><div align="left">Fecha Ingreso</div></th>
      <th bgcolor="#FFFFFF" class="normal" scope="col"><div align="left"><?php 
            echo cambia_a_normal($myrow3['fecha']);
            ?>
</div>      </th>
    </tr>
    <tr>
      <th bgcolor="#330099" class="blanco" scope="col"><div align="left"><strong>M&eacute;dico</strong></div></th>
      <th bgcolor="#FFFFFF" class="normal" scope="col"><div align="left">
          <label> <?php 
            echo $medico = $myrow3['medico'];
            ?>
 </label>
          <label> </label>
          <?php 
            $sSQL18 = "Select * From medicos WHERE numMedico ='" . $medico . "'";
            $result18 = mysql_db_query($basedatos, $sSQL18);
            $rNombre18 = mysql_fetch_array($result18);
            ?>
          <?php 
            echo $dr = "Dr(a): " . $rNombre18["apellido1"] . " " . $rNombre18["apellido2"] . " " . $rNombre18["apellido3"] . " " . $rNombre18["nombre1"] . " " . $rNombre18["nombre2"];
            ?>
 </div></th>
    </tr>
  </table>
  <p>&nbsp;</p>
  
  
  
  
  
  
  
  
  
  
  <p>

  </p>



  
  
    <?php 
            $content = new contenidos();
            $content->desplegarContenidos($entidad, $class, $estilo, $fechas1, $fechas2, $myrow3['keyClientesInternos'], $_GET['folioVenta'], $basedatos);
            ?>


  <p>&nbsp;</p>
          <p>
    <input name="recibo" type="hidden" id="recibo" value="<?php 
            echo $nCliente = $_POST['numeroE'];
            ?>
" />
    <input name="nCliente" type="hidden" id="nCliente" value="<?php 
            echo $nCliente;
            ?>
" />
    <input name="almacen" type="hidden" id="almacen" value="<?php 
            echo $ALMACEN;
            ?>
" />
  </p>
  <div align="center">
    <div align="left">
      <p>&nbsp;</p>
      
      <p>&nbsp;</p>
	  <p>&nbsp;</p>
    </div>
   
<?php 
            $despliegaTotales = new totales();
            $despliegaTotales->tt($entidad, $class, $estilo, $fechas1, $fechas2, $myrow3['keyClientesInternos'], $_GET['folioVenta'], $basedatos);
            ?>
    <p>&nbsp;</p>
    <p>&nbsp;</p>

    <p align="left">&nbsp;</p>

	
	<?php 
            if ($myrow3['status'] != 'cerrada') {
                ?>
	
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <table width="86%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <th width="15%" scope="col">
		
		
		
		<table width="94" border="0" align="left">
          <tr bgcolor="#660066">
            <th class="blanco" scope="col">
			
			<span class="blanco">Particular<a href="#" onClick="javascript:ventanaSecundaria7('<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?numeroE=<?php 
                echo $numeroE;
                ?>
&amp;almacen=<?php 
                echo $bali;
                ?>
&amp;seguro=<?php 
                echo $_POST['seguro'];
                ?>
&amp;nCuenta=<?php 
                echo $myrow3['keyClientesInternos'];
                ?>
&amp;tipoCliente=<?php 
                echo 'particular';
                ?>
')"> </a></span></th>
          </tr>
          <tr>
            <th width="98" bgcolor="#660066" class="blanco" scope="col"><span class="blanco"> <span class="blanco">Total a pagar </span> </span></th>
          </tr>
          <tr>
            <td><div align="center"><span class="normal"> <span class="normal">
                <?php 
                //echo "$".number_format($cargosParticulares->cargosParticulares($basedatos,$usuario,$numeroE,$nCuenta),2);
                $ttP = $cargosParticularesCC->cargosParticularesCC($basedatos, $usuario, $myrow3['keyClientesInternos']);
                // $T=round($T,$ase);
                if ($ttP) {
                    if ($cargosParticularesCC->cargosParticularesCC($basedatos, $usuario, $myrow3['keyClientesInternos']) < 0) {
                        $dev = 'si';
                        $cantidadDevolucion = $cargosParticularesCC->cargosParticularesCC($basedatos, $usuario, $myrow3['keyClientesInternos']);
                    } else {
                        $dev = '';
                    }
                    ?>
                <a href="#" onClick="javascript:ventanaSecundaria7('<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?almacenFuente=<?php 
                    echo $bali;
                    ?>
&numeroE=<?php 
                    echo $numeroE;
                    ?>
&almacen=<?php 
                    echo $bali;
                    ?>
&seguro=<?php 
                    echo $_POST['seguro'];
                    ?>
&nCuenta=<?php 
                    echo $myrow3['keyClientesInternos'];
                    ?>
&tipoCliente=<?php 
                    echo 'particular';
                    ?>
&tipoVenta=<?php 
                    echo 'interno';
                    ?>
&tipoMovimiento=<?php 
                    echo 'transaccion';
                    ?>
&tipoTransaccion=particular&random=<?php 
                    echo rand(90000, 900000000);
                    ?>
&devolucion=<?php 
                    print $dev;
                    ?>
&cantidadDevolucion=<?php 
                    echo $cantidadDevolucion;
                    ?>
')">
                <?php 
                    echo "\$" . number_format($cargosParticularesCC->cargosParticularesCC($basedatos, $usuario, $myrow3['keyClientesInternos']), 2);
                    ?>
                </a>
                <?php 
                } else {
                    echo "\$" . number_format($cargosParticularesCC->cargosParticularesCC($basedatos, $usuario, $myrow3['keyClientesInternos']), 2);
                }
                ?>
            </span></span></div></td>
          </tr>
        </table>
		
		
		
		</th>
        <th width="2%" scope="col">&nbsp;</th>
        <th width="15%" scope="col">&nbsp;</th>
        <th width="31%" scope="col">&nbsp;</th>
        <th width="2%" scope="col">&nbsp;</th>
        <th width="5%" scope="col">&nbsp;</th>
        <th width="16%" scope="col"><table width="94" border="0">
          <tr>
            <th bgcolor="#660066"  scope="col"><span class="blanco">D.Coaseguro </span></th>
          </tr>
          <tr>
            <th width="88" bgcolor="#660066"  scope="col"><span class="blanco">Total a pagar </span></th>
          </tr>
          <tr>
            <td><div align="center"><span class="normal">
                <?php 
                $coaseguro = new acumulados();
                $ttCO = $coaseguro->cargosCoaseguro($basedatos, $usuario, $_GET['nT']);
                if ($ttCO) {
                    ?>
                <a href="#" onClick="javascript:ventanaSecundaria7('<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?numeroE=<?php 
                    echo $numeroE;
                    ?>
&almacen=<?php 
                    echo $bali;
                    ?>
&almacenFuente=<?php 
                    echo $bali;
                    ?>
&seguro=<?php 
                    echo $_POST['seguro'];
                    ?>
&nCuenta=<?php 
                    echo $myrow3['keyClientesInternos'];
                    ?>
&tipoCliente=<?php 
                    echo 'coaseguro';
                    ?>
&tipoVenta=<?php 
                    echo 'interno';
                    ?>
&tipoMovimiento=<?php 
                    echo 'transaccion';
                    ?>
&tipoTransaccion=coaseguro&random=<?php 
                    echo rand(90000, 900000000);
                    ?>
')">
                <?php 
                    echo "\$" . number_format($coaseguro->cargosCoaseguro($basedatos, $usuario, $_GET['nT']), 2);
                    ?>
                </a>
                <?php 
                } else {
                    echo "\$" . number_format($coaseguro->cargosCoaseguro($basedatos, $usuario, $_GET['nT']), 2);
                }
                ?>
            </span></div></td>
          </tr>
        </table></th>
        <th width="14%" scope="col"><table width="94" border="0" align="right">
          <tr>
            <th bgcolor="#660066"  scope="col"><span class="blanco"> Compa&ntilde;&iacute;a
                  <?php 
                //echo "$".number_format($Tcargos,2);
                ?>
                  <?php 
                //echo "$".number_format( $Tabonos,2);
                $t1 = $TOTAL + $Tiva;
                ?>
                  <?php 
                //echo "$".number_format($deposito[0],2);
                //echo "Pago por Otros";
                $t2 = $Tabonos;
                ?>
            </span></th>
          </tr>
          <tr>
            <th width="172" bgcolor="#660066" class="blanco" scope="col">Saldo Cia. </th>
          </tr>
          <tr>
            <td><span class="normal">
            

              <?php 
                $ttCA = $cargosAseguradoraCC->cargosAseguradoraCC($basedatos, $usuario, $_GET['nT']);
                if ($ttCA && !$coaseguro->cargosCoaseguro($basedatos, $usuario, $_GET['nT'])) {
                    ?>
              <a href="#" onClick="javascript:ventanaSecundaria7('<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?numeroE=<?php 
                    echo $numeroE;
                    ?>
		&almacen=<?php 
                    echo $bali;
                    ?>
&almacenFuente=<?php 
                    echo $bali;
                    ?>
&seguro=<?php 
                    echo $_POST['seguro'];
                    ?>
&nCuenta=<?php 
                    echo $myrow3['keyClientesInternos'];
                    ?>
&tipoCliente=<?php 
                    echo 'aseguradora';
                    ?>
&tipoVenta=<?php 
                    echo 'interno';
                    ?>
&tipoTransaccion=aseguradora&random=<?php 
                    echo rand(90000, 900000000);
                    ?>
')">
              <?php 
                    echo "\$" . number_format($cargosAseguradoraCC->cargosAseguradoraCC($basedatos, $usuario, $_GET['nT']), 2);
                    ?>
              </a>
              <?php 
                } else {
                    echo "\$" . number_format($cargosAseguradoraCC->cargosAseguradoraCC($basedatos, $usuario, $_GET['nT']), 2);
                }
                ?>
        
    
        
        
            </span> </td>
          </tr>
        </table></th>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>

    <p>&nbsp;</p>
  </div>
 

  <p align="center">
    
	<?php 
                $variables = round($ttP + $ttO + $ttCO + $ttCA + $totalxSurtir->totalxSurtirFV($basedatos, $usuario, $myrow3['folioVenta']), 2);
                //****************************************
                if (!$myrow661['status'] and !$myrow14a['cierreCuenta'] and $variables) {
                    ?>
	<input name="faltan" type="image" src="<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/imagenes/btns/aplypago.png" id="cerrar" value="Falta Aplicar Pagos" disabled=""/>	
	<?php 
                } else {
                    if (!$variables) {
                        ?>
	<input name="cerrar" type="submit" class="normal" id="cerrar" value="Cerrar Cuenta" onClick="if(confirm('&iquest;Est&aacute;s seguro que deseas cerrar la cuenta?') == false){return false;}" />
	<?php 
                    }
                }
                //cierra validaciones de proceso de cierre de departamentos
                ?>
  </p>
  <div align="center">

    
    <?php 
            } else {
                echo "LA CUENTA DEL PACIENTE " . $myrow3['paciente'] . " ESTA CERRADA...";
                ?>
    <input name="imprimir" type="submit" class="normal" id="imprimir" value="Imprimir" onClick="window.print();return false" />
    <?php 
            }
            ?>
  </div>
</form>

<p align="center">&nbsp;</p>
<?php 
            if ($_POST['banderaFecha']) {
                ?>
  <script type="text/javascript"> 
   Calendar.setup({ 
    inputField     :    "campo_fecha",     // id del campo de texto 
     ifFormat     :     "%Y-%m-%d",     // formato de la fecha que se escriba en el campo de texto 
     button     :    "lanzador"     // el id del bot�n que lanzar� el calendario 
}); 
</script> 
  <script type="text/javascript"> 
   Calendar.setup({ 
    inputField     :    "campo_fecha1",     // id del campo de texto 
     ifFormat     :     "%Y-%m-%d",     // formato de la fecha que se escriba en el campo de texto 
     button     :    "lanzador1"     // el id del bot�n que lanzar� el calendario 
}); 
</script>
<?php 
            }
        }
        ?>
</body>
</html>
<?php 
    }
Beispiel #4
0
    ?>
        <?php 
    echo "\$" . number_format($cargosParticularesCC->cargosParticularesCC($entidad, $basedatos, $usuario, $keyClientesInternos), 2);
    ?>
        <?php 
} else {
    ?>
        <?php 
    print 'Agregar Abono';
}
?>
      </span></td>
      <td><span class="titulomedio">
        <?php 
$coaseguro = new acumulados();
$ttCO = $coaseguro->cargosCoaseguro($entidad, $basedatos, $usuario, $keyClientesInternos);
if ($ttCO) {
    ?>
        <?php 
    echo "\$" . number_format($coaseguro->cargosCoaseguro($entidad, $basedatos, $usuario, $keyClientesInternos), 2);
    ?>
        <?php 
} else {
    echo "\$" . number_format($coaseguro->cargosCoaseguro($entidad, $basedatos, $usuario, $keyClientesInternos), 2);
}
?>
      </span></td>
      <td><span class="titulomedio">
        <?php 
$ttCA = $cargosAseguradoraCC->cargosAseguradoraCC($entidad, $basedatos, $usuario, $keyClientesInternos);
if ($ttCA && !$coaseguro->cargosCoaseguro($entidad, $basedatos, $usuario, $keyClientesInternos)) {
    public function eCuenta($bali, $transacciones, $TITULO, $entidad, $fecha1, $hora1, $dia, $usuario, $nT, $basedatos)
    {
        include CONSTANT_PATH_CONFIGURACION . "/funciones.php";
        $cargosCia = new acumulados();
        ?>
<script language=javascript> 
function ventanaSecundaria4 (URL){ 
   window.open(URL,"ventana4","width=800,height=300,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script>
<script language=javascript> 
function ventanaSecundaria2 (URL){ 
   window.open(URL,"ventana2","width=630,height=500,scrollbars=YES,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria1 (URL){ 
   window.open(URL,"ventana1","width=530,height=300,scrollbars=YES") 
} 
</script> 

<script language=javascript> 
function ventanaSecundaria5 (URL){ 
   window.open(URL,"ventana5","width=500,height=500,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script>

<script language=javascript> 
function ventanaSecundaria3 (URL){ 
   window.open(URL,"ventana3","width=500,height=400,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script>

<script language=javascript> 
function ventanaSecundaria6 (URL){ 
   window.open(URL,"ventana6","width=500,height=400,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script>
<script language=javascript> 
function ventanaSecundaria7 (URL){ 
   window.open(URL,"ventana7","width=500,height=600,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script>
<script language="javascript" type="text/javascript">   
//Validacion de campos de texto no vacios by Mauricio Escobar   
//   
//Iv�n Nieto P�rez   
//Este script y otros muchos pueden   
//descarse on-line de forma gratuita   
//en El C�digo: www.elcodigo.com   
  
  
//*********************************************************************************   
// Function que valida que un campo contenga un string y no solamente un " "   
// Es tipico que al validar un string se diga   
//    if(campo == "") ? alert(Error)   
// Si el campo contiene " " entonces la validacion anterior no funciona   
//*********************************************************************************   
  
//busca caracteres que no sean espacio en blanco en una cadena   
function vacio(q) {   
        for ( i = 0; i < q.length; i++ ) {   
                if ( q.charAt(i) != " " ) {   
                        return true   
                }   
        }   
        return false   
}   
  
//valida que el campo no este vacio y no tenga solo espacios en blanco   
function valida(F) {   
           
        if( vacio(F.campo.value) == false ) {   
                alert("Introduzca un cadena de texto.")   
                return false   
        } else {   
                alert("OK")   
                //cambiar la linea siguiente por return true para que ejecute la accion del formulario   
                return true   
        }   
           
}   
  
  
  
  
</script> 

<SCRIPT LANGUAGE="JavaScript">
function checkIt(evt) {
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        status = "Este campo s�lo acepta n�meros."
        return false
    }
    status = ""
    return true
}
</SCRIPT>
<script type="text/javascript">
<!-- por carlitos. cualquier duda o pregunta, visita www.forosdelweb.com

var ancho=100
var alto=100
var fin=300
var x=100
var y=100

function inicio()
{
ventana = window.open("cita.php", "_blank", "height=1,width=1,top=x,left=y,screenx=x,screeny=y");
abre();
}
function abre()
{
if (ancho<=fin) {
ventana.moveto(x,y);
ventana.resizeto(ancho,alto);
x+=5
y+=5
ancho+=15
alto+=15
timer= settimeout("abre()",1)
}
else {
cleartimeout(timer)
}
}
// -->
</script>




<?php 
        //************************ACTUALIZO **********************
        //********************Llenado de datos
        if (!$_GET['nT']) {
            $_GET['nT'] = $nT;
        }
        if (!$bali) {
            $bali = $_GET['almacenFuente'];
        }
        $sSQL3 = "Select * From clientesInternos WHERE keyClientesInternos = '" . $_GET['nT'] . "' ";
        $result3 = mysql_db_query($basedatos, $sSQL3);
        $myrow3 = mysql_fetch_array($result3);
        $numeroE = $myrow3['numeroE'];
        $nCuenta = $myrow3['nCuenta'];
        $cuarto = $myrow3['cuarto'];
        //***************aplicar pago**********************
        if ($_POST['actualizar']) {
            $particular = $_POST['particular'];
            $aseguradora = $_POST['aseguradora'];
            for ($i = 0; $i <= $_POST['bandera2']; $i++) {
                if ($aseguradora[$i]) {
                    $status = 'efectivo';
                    $keyCAP[] = $aseguradora[$i];
                } else {
                    $status = 'cxc';
                    $keyCAP[] = $particular[$i];
                }
                $agrega = "UPDATE cargosCuentaPaciente set \r\nstatusAlta='" . $status . "',\r\nusuarioAlta='" . $usuario . "',\r\nfechaAlta='" . $fecha1 . "',\r\nhoraAlta='" . $hora1 . "'\r\n\r\nwhere\r\nkeyCAP='" . $keyCAP[$i] . "' \r\n";
                mysql_db_query($basedatos, $agrega);
                echo mysql_error();
            }
            //cierra for
        }
        //cierra actualizar
        $cargosParticulares = new acumulados();
        $totalxSurtir = new acumulados();
        $cargosAseguradora = new acumulados();
        $otros = new acumulados();
        if ($_POST['cerrar'] and $cargosParticulares->cargosParticulares($basedatos, $usuario, $numeroE, $nCuenta) == NULL and $totalxSurtir->totalxSurtir($basedatos, $usuario, $numeroE, $nCuenta) == NULL and $otros->otros($basedatos, $usuario, $numeroE, $nCuenta) == NULL and $cargosAseguradora->cargosAseguradora($basedatos, $usuario, $numeroE, $nCuenta) == NULL) {
            $particular = $_POST['particular'];
            $aseguradora = $_POST['aseguradora'];
            //********************CIERRO STATUS CUENTA***********************
            $agrega = "UPDATE cargosCuentaPaciente set \r\nstatusCuenta='cerrada'\r\n\r\n\r\nwhere\r\nnumeroE='" . $numeroE . "' \r\nand\r\nnCuenta='" . $nCuenta . "'\r\n\r\n";
            mysql_db_query($basedatos, $agrega);
            echo mysql_error();
            //*********************************************
            //cierro cuenta
            $agrega = "UPDATE clientesInternos set \r\nstatus='cerrada',\r\nstatusCuenta='cerrada',\r\nusuarioCierre='" . $usuario . "',\r\nfechaCierre='" . $fecha1 . "',\r\nhoraCierre='" . $hora1 . "'\r\n\r\nwhere\r\nkeyClientesInternos='" . $_GET['nT'] . "' \r\n";
            mysql_db_query($basedatos, $agrega);
            echo mysql_error();
            //cierro cuarto a sucio
            $agrega = "UPDATE cuartos set \r\nstatus='sucio',\r\nusuarioSalida='" . $usuario . "',\r\nfechaSalida='" . $fecha1 . "',\r\nhoraSalida='" . $hora1 . "'\r\n\r\nwhere\r\ncodigoCuarto='" . $cuarto . "' \r\n";
            mysql_db_query($basedatos, $agrega);
            echo mysql_error();
            $leyenda = 'Se cerr� la cuenta';
            ?>

   
   
<?php 
        }
        if (!$_POST['tipoVista']) {
            $_POST['tipoVista'] = 'Detalle';
        }
        ?>

<?php 
        if ($_POST['imprimir']) {
            ?>
<script>
javascript:ventanaSecundaria2('<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/cargos/imprimirCargosInternosCC.php?numeroE=<?php 
            echo $numeroE;
            ?>
&nCuenta=<?php 
            echo $nCuenta;
            ?>
&paciente=<?php 
            echo $_POST['paciente'];
            ?>
&numeroConfirmacion=<?php 
            echo $numeroConfirmacion;
            ?>
&hora1=<?php 
            echo $hora1;
            ?>
&keyClientesInternos=<?php 
            echo $myrow3['keyClientesInternos'];
            ?>
');
  <!--
window.opener.document.forms["form1"].submit();
self.close();
  // -->
</script>

<?php 
        }
        ?>
<!-Hoja de estilos del calendario --> 
  <link rel="stylesheet" type="text/css" media="all" href="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/calendario/calendar-tas.css" title="win2k-cold-1" /> 

  <!-- librer�a principal del calendario --> 
 <script type="text/javascript" src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/calendario/calendar.js"></script> 

 <!-- librer�a para cargar el lenguaje deseado --> 
  <script type="text/javascript" src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/calendario/lang/calendar-es.js"></script> 

  <!-- librer�a que declara la funci�n Calendar.setup, que ayuda a generar un calendario en unas pocas l�neas de c�digo --> 
  <script type="text/javascript" src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/calendario/calendar-setup.js"></script> 
  
  
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<html xmlns="http://www.w3.org/1999/xhtml">



<head>
<?php 
        $showStyles = new muestraEstilos();
        $showStyles->styles();
        ?>
</head>



<BODY  >
<?php 
        //ventanasPrototype::links();
        ?>
<h1 align="center"><?php 
        echo $TITULO;
        ?>
</h1>
<form id="form1" name="form1" method="post" action="">
  <table width="549" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#990099" class="normal">
    <tr>
      <th bgcolor="#660066" class="blanco" scope="col"><div align="left">N&uacute;mero de Transacci&oacute;n: </div></th>
      <th bgcolor="#660066" class="blanco" scope="col"><div align="left"><?php 
        echo $nCliente = $myrow3['keyClientesInternos'];
        ?>
          <input name="numeroE" type="hidden" class="normal" id="numeroE" 
		  value="<?php 
        echo $nCliente = $_POST['numeroE'];
        ?>
" readonly=""/>
</label></div>      </th>
    </tr>
    <tr>
      <th width="134" bgcolor="#FFCCFF" class="normal" scope="col"><div align="left"><strong>Paciente: </strong></div></th>
      <th width="408" bgcolor="#FFCCFF" class="normal" scope="col"><div align="left"><strong>
          <label> </label>
      </strong> <?php 
        echo $myrow3['paciente'];
        ?>
 </div></th>
    </tr>
    <tr>
      <td class="normal">Compa&ntilde;&iacute;a: </td>
      <td class="normal"><label> <?php 
        echo $traeSeguro = $myrow3['seguro'];
        ?>
            <?php 
        displaySeguro::despliegaSeguro($traeSeguro, $basedatos);
        ?>
            <input name="seguro2" type="hidden" id="seguro2" value="<?php 
        echo $traeSeguro;
        ?>
" />
      </label></td>
    </tr>
    <tr>
      <td bgcolor="#FFCCFF" class="normal">N&deg; Credencial: </td>
      <td bgcolor="#FFCCFF" class="normal"><?php 
        echo $myrow3['credencial'];
        ?>
 </td>
    </tr>
    <tr>
      <td class="normal">Fecha</td>
      <td class="normal"><span class="normal">
        <label>
        <input type="checkbox" name="banderaFecha" value="checkbox" onClick="javascript:this.form.submit();" 
		<?php 
        if ($_POST['banderaFecha']) {
            echo 'checked="checked"';
        }
        ?>
		/>
        </label>
		
		
		<?php 
        if ($_POST['banderaFecha']) {
            ?>
        <input name="fecha" type="text" class="normal" id="campo_fecha"
	  value="<?php 
            if ($_POST['fecha']) {
                echo $_POST['fecha'];
            } else {
                if ($myrow3['hoy']) {
                    echo $myrow3['hoy'];
                } else {
                    echo $fecha1;
                }
            }
            ?>
" size="9" readonly="" />
        <label>
        <input name="button" type="button" class="normal" id="lanzador" value="..." />
        Entre </label>
      <input name="fecha2" type="text" class="normal" id="campo_fecha1"
	  value="<?php 
            if ($_POST['fecha2']) {
                echo $_POST['fecha2'];
            } else {
                if ($myrow3['hoy']) {
                    echo $myrow3['hoy'];
                } else {
                    echo $fecha1;
                }
            }
            ?>
" size="9" readonly="" />
        <label>
        <input name="button2" type="button" class="normal" id="lanzador1" value="..." />
        <input name="show" type="submit" class="normal" id="show" value="&gt;" />
        
        <?php 
        } else {
            ?>
        <input name="fecha3" type="hidden" class="normal" id="fecha2" value="<?php 
            echo 'all';
            ?>
"/>
		<?php 
        }
        ?>
</label>
</span></td>
    </tr>
    <tr>
      <th class="normal" scope="col"><div align="left"><strong>M&eacute;dico: </strong></div></th>
      <th class="normal" scope="col"><div align="left">
          <label> <?php 
        echo $medico = $myrow3['medico'];
        ?>
 </label>
          <label> </label>
          <?php 
        $sSQL18 = "Select * From medicos WHERE numMedico ='" . $medico . "'";
        $result18 = mysql_db_query($basedatos, $sSQL18);
        $rNombre18 = mysql_fetch_array($result18);
        ?>
          <?php 
        echo $dr = "Dr(a): " . $rNombre18["apellido1"] . " " . $rNombre18["apellido2"] . " " . $rNombre18["apellido3"] . " " . $rNombre18["nombre1"] . " " . $rNombre18["nombre2"];
        ?>
 </div></th>
    </tr>
    <tr>
      <td bgcolor="#FFCCFF" class="normal">Tipo de Vista: </td>
      <td bgcolor="#FFCCFF" class="normal"><label>
        <select name="tipoVista" class="normal" id="tipoVista" onChange="javascript:form1.submit();">
          <option>Escoje la Opci&oacute;n</option>
          <option
		  <?php 
        if ($_POST['tipoVista'] == 'Agrupado') {
            ?>
		  selected="selected"
		  <?php 
        }
        ?>
		   value="Agrupado">Agrupado</option>
          
		  
		  <option
		  <?php 
        if ($_POST['tipoVista'] == 'Detalle') {
            ?>
		  selected="selected"
		  <?php 
        }
        ?>
		   value="Detalle">Detalle</option>
        </select>
      </label></td>
    </tr>
  </table>
  <p>&nbsp;</p>
  
  
  
  
  
  
  
  
  
  
  <?php 
        //compruebo el proceso de alta
        $sSQL32 = "Select * From procesoAlta WHERE (status='request' or status='cargado')\r\nand\r\nkeyClientesInternos='" . $_GET['nT'] . "'";
        $result32 = mysql_db_query($basedatos, $sSQL32);
        $myrow32 = mysql_fetch_array($result32);
        ?>
  
  
  
  <?php 
        if ($myrow32['numeroE']) {
            ?>
  <table width="471" border="0" align="center">
    <tr>
      <th width="420" height="15" bgcolor="#660066" scope="col"><div align="left"><span class="blanco">Departamento </span></div></th>
      <th width="58" bgcolor="#660066" scope="col"><div align="left"><span class="blanco">Fecha</span></div></th>
      <th width="76" bgcolor="#660066" scope="col"><div align="left"><span class="blanco">Hora</span></div></th>
      <th width="37" bgcolor="#660066" scope="col"><div align="left"><span class="blanco">Usuario</span></div></th>
      <th width="56" bgcolor="#660066" scope="col"><div align="left"><span class="blanco">Status </span></div></th>
    </tr>
    <tr>
      <?php 
            $sSQL = "Select * From almacenes WHERE entidad='" . $entidad . "'\r\n  and\r\naltaPaciente='si'\r\norder by descripcion ASC\r\n";
            if ($sSQL) {
                $result = mysql_db_query($basedatos, $sSQL);
                while ($myrow = mysql_fetch_array($result)) {
                    if ($col) {
                        $color = '#FFCCFF';
                        $col = "";
                    } else {
                        $color = '#FFFFFF';
                        $col = 1;
                    }
                    $A = $myrow['almacen'];
                    $sSQL661 = "Select * From procesoAlta \r\nWHERE\r\nentidad='" . $entidad . "'\r\nand\r\nstatus='cargado'\r\nand\r\nalmacen='" . $A . "'\r\nand\r\nkeyClientesInternos='" . $_GET['nT'] . "'";
                    $result661 = mysql_db_query($basedatos, $sSQL661);
                    $myrow661 = mysql_fetch_array($result661);
                    ?>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal"><span class="style71"><?php 
                    if ($myrow661['status']) {
                        echo $myrow['descripcion'];
                    } else {
                        echo $myrow['descripcion'] . ' [No se ha completado el proceso de Cierre]';
                    }
                    ?>
</span></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal"><span class="style71"><?php 
                    if ($myrow661['fecha']) {
                        echo cambia_a_normal($myrow661['fecha']);
                    }
                    ?>
</span></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal"><span class="style71"><?php 
                    echo $myrow661['hora'];
                    ?>
</span></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal"><span class="style71"><?php 
                    echo $myrow661['usuario'];
                    ?>
</span></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal"><span class="style71"><?php 
                    if (!$myrow661['status']) {
                        echo '<img src="' . CONSTANT_PATH_SIMA_RAIZ . '/imagenes/candado.png" alt="LA CUENTA ESTA EN REVISION" width="12" height="12" border="0">';
                    } else {
                        echo '<img src="' . CONSTANT_PATH_SIMA_RAIZ . '/imagenes/solicitado.png" alt="LA CUENTA ESTA EN REVISION" width="12" height="12" border="0">';
                    }
                    ?>
      <span class="normal"></span></span></td>
    </tr>
    <?php 
                }
            }
            ?>
  </table>
  <?php 
        }
        ?>
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  <p>
    <?php 
        if ($_POST['tipoVista']) {
            ?>
  </p>



  
  
    <table width="847" border="0" align="center">
    <tr>
     
      <th width="96" height="14" bgcolor="#660066" class="blanco" scope="col"><div align="left"><span class="blanco ">Fecha/Hora </span></div></th>
      <th width="300" bgcolor="#660066"  scope="col"><div align="left"><span class="blanco ">Descripci&oacute;n/Concepto</span></div></th>
      <th width="21" bgcolor="#660066"  scope="col"><div align="left"><span class="blanco ">Cant</span></div></th>
      <th width="55" bgcolor="#660066"  scope="col"><div align="left"><span class="blanco ">P.U.</span></div></th>
      <th width="55" bgcolor="#660066"  scope="col"><div align="left"><span class="blanco ">Importe</span></div></th>
      <th width="33" bgcolor="#660066"  scope="col"><div align="left"><span class="blanco ">IVA</span></div></th>
      <th width="27" bgcolor="#660066"  scope="col"><div align="left"><span class="blanco ">Status</span></div></th>
      <th width="47" bgcolor="#660066"  scope="col"><div align="left"><span class="blanco ">D Solicita</span></div></th>
      <th width="52" bgcolor="#660066"  scope="col"><div align="left"><span class="blanco ">D Cargo.</span></div></th>
      <th width="72" bgcolor="#660066"  scope="col"><div align="left"><span class="blanco ">Tipo P </span></div></th>
      <th width="38" bgcolor="#660066"  scope="col"><div align="left"><span class="blanco ">N </span></div></th>
    </tr>
	
      <?php 
            //traigo agregados
            if ($_POST['tipoVista'] == 'Agrupado' and $_POST['banderaFecha']) {
                $sSQL81 = "\r\nSELECT \r\nkeyCAP,codProcedimiento,um,hora1,fecha1,cantidad,iva,almacenDestino,almacenSolicitante,precioVenta,tipoCliente,gpoProducto,naturaleza,tipoTransaccion,porcentajeVariable,cargosHospitalarios,descripcion,status,almacen,statusDevolucion\r\nFROM\r\ncargosCuentaPaciente \r\n WHERE keyClientesInternos='" . $_GET['nT'] . "'\r\n  \r\n  and\r\n(fecha1 between'" . $_POST['fecha'] . "' and '" . $_POST['fecha2'] . "')\r\n\r\n\r\n \r\n group by codProcedimiento \r\n order by fecha1,hora1 asc\r\n";
            } else {
                if ($_POST['tipoVista'] == 'Detalle' and $_POST['banderaFecha']) {
                    $sSQL81 = "\r\nSELECT \r\nkeyCAP,codProcedimiento,um,hora1,fecha1,cantidad,iva,almacenDestino,almacenSolicitante,precioVenta,tipoCliente,gpoProducto,naturaleza,tipoTransaccion,porcentajeVariable,cargosHospitalarios,descripcion,status,almacen,statusDevolucion\r\nFROM\r\ncargosCuentaPaciente \r\n WHERE \r\nkeyClientesInternos='" . $_GET['nT'] . "'\r\n \r\n and \r\n (fecha1 between '" . $_POST['fecha'] . "' AND '" . $_POST['fecha2'] . "')\r\n \r\n order by hora1 asc\r\n";
                } else {
                    if ($_POST['tipoVista'] == 'Agrupado' and !$_POST['banderaFecha']) {
                        $sSQL81 = "\r\nSELECT \r\nkeyCAP,codProcedimiento,um,hora1,fecha1,cantidad,iva,almacenDestino,almacenSolicitante,precioVenta,tipoCliente,gpoProducto,naturaleza,tipoTransaccion,porcentajeVariable,cargosHospitalarios,descripcion,status,almacen,statusDevolucion\r\nFROM\r\ncargosCuentaPaciente \r\n WHERE \r\nkeyClientesInternos='" . $_GET['nT'] . "'\r\n \r\n group by codProcedimiento \r\n order by fecha1,hora1 asc\r\n";
                    } else {
                        if ($_POST['tipoVista'] == 'Detalle' and !$_POST['banderaFecha']) {
                            $sSQL81 = "\r\nSELECT \r\nkeyCAP,codProcedimiento,um,hora1,fecha1,cantidad,iva,almacenDestino,almacenSolicitante,precioVenta,tipoCliente,gpoProducto,naturaleza,tipoTransaccion,porcentajeVariable,cargosHospitalarios,descripcion,status,almacen,statusDevolucion\r\nFROM\r\ncargosCuentaPaciente \r\n WHERE \r\nkeyClientesInternos='" . $_GET['nT'] . "'\r\nand \r\nstatus!='cancelado'\r\n \r\n \r\n \r\n  order by fecha1,hora1 asc\r\n";
                        }
                    }
                }
            }
            if ($result81 = mysql_db_query($basedatos, $sSQL81)) {
                while ($myrow81 = mysql_fetch_array($result81)) {
                    if ($col) {
                        $color = '#FFCCFF';
                        $col = "";
                    } else {
                        $color = '#FFFFFF';
                        $col = 1;
                    }
                    $a += '1';
                    $art = $myrow81['codProcedimiento'];
                    $codigo = $proc = $myrow81['codProcedimiento'];
                    $keyCAP = $myrow81['keyCAP'];
                    if ($_POST['tipoVista'] == 'Agrupado') {
                        $sSQL14 = "\r\nSELECT \r\nsum(cantidad) as cantidad2\r\nFROM\r\ncargosCuentaPaciente\r\nWHERE \r\ncodProcedimiento = '" . $proc . "' and  numeroE = '" . $numeroE . "'\r\n";
                        $result14 = mysql_db_query($basedatos, $sSQL14);
                        $myrow14 = mysql_fetch_array($result14);
                    }
                    $style = 'normal';
                    ?>
	
	
	
	
    <tr>






      <td height="21" bgcolor="<?php 
                    echo $color;
                    ?>
" class="<?php 
                    echo $style;
                    ?>
"><div align="left"><span class="<?php 
                    echo $estilo;
                    ?>
">
      <?php 
                    echo $myrow81['hora1'] . " " . cambia_a_normal($myrow81['fecha1']);
                    ?>
</span></div></td>
	

	
	
      <td bgcolor="<?php 
                    echo $color;
                    ?>
">
	  <div align="left">
	  
	  <span class="<?php 
                    echo $style;
                    ?>
">
        <?php 
                    $descripcion = new articulosDetalles();
                    $descripcion->descripcion($keyCAP, $numeroE, $nCuenta, $codigo, $basedatos);
                    if ($myrow81['status'] != 'transaccion') {
                        $nombreMed = new nombreMedico();
                        //echo " ".$myrow81['descripcion'].$nombreMed->nombreMed($myrow81['almacen'],$basedatos);
                    }
                    ?>
		
  
          
          <?php 
                    if ($myrow81['gpoProducto']) {
                        echo '[' . $myrow81['gpoProducto'] . ']';
                    }
                    ?>
       </span>	   </div></td>
	   
	   
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="<?php 
                    echo $style;
                    ?>
"><div align="left">
        <?php 
                    if ($_POST['tipoVista'] == 'Agrupado') {
                        echo $cantidad = $myrow14['cantidad2'];
                    } else {
                        echo $cantidad = $myrow81['cantidad'];
                    }
                    ?>
     </div></td>
	  
	  
	  
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" ><?php 
                    if ($myrow81['naturaleza'] == 'C') {
                        echo '$' . number_format($myrow81['precioVenta'], 2);
                    } else {
                        echo '---';
                    }
                    ?>
</td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" ><div align="left"><span class="<?php 
                    echo $style;
                    ?>
">
        <?php 
                    if ($myrow81['cargosHospitalarios']) {
                        $tipoTransaccion = $myrow81['tipoTransaccion'];
                        $sSQL6 = "\r\n\tSELECT \r\nvariable\r\nFROM\r\ncatTTCaja\r\nWHERE \r\ncodigoTT = '" . $tipoTransaccion . "'\r\nand\r\nvariable='si'\r\n";
                        $result6 = mysql_db_query($basedatos, $sSQL6);
                        $myrow6 = mysql_fetch_array($result6);
                        if ($myrow6['variable']) {
                            if ($myrow81['cargosHospitalarios'] == 'si') {
                                $banderaPM = new acumulados();
                                $precioVentaC = $banderaPM->banderaPorcentajeMedicamentos($entidad, $basedatos, $usuario, $numeroE, $nCuenta);
                                $precioVentaC = porcentaje($precioVentaC, $myrow81['porcentajeVariable'], $a);
                            } else {
                                $cargosAseguradora = new acumulados();
                                $precioVentaC = $cargosAseguradora->cargosAseguradora($basedatos, $usuario, $numeroE, $nCuenta);
                                $precioVentaC = porcentaje($precioVentaC, $myrow81['porcentajeVariable'], $a);
                            }
                            //Actualiza
                            $q1 = "UPDATE cargosCuentaPaciente set \r\nprecioVenta='" . $precioVentaC . "'\r\nWHERE \r\nkeyCAP='" . $keyCAP . "'";
                            //mysql_db_query($basedatos,$q1);
                            echo mysql_error();
                        }
                    }
                    ?>
      
          
          <?php 
                    $importe = new acumulados();
                    echo $importe->importe($keyCAP, $basedatos);
                    ?>
          
     
		
		</span></div></td>
		
		
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" >
	  <div align="left">
	  <span class="<?php 
                    echo $style;
                    ?>
">
        <?php 
                    $mostrarIVA = new articulosDetalles();
                    echo $mostrarIVA->mostrarIVA($keyCAP, $basedatos);
                    ?>
      </span></div></td>
	  
	  
	  
	  
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="<?php 
                    echo $style;
                    ?>
"><div align="left">
        
        
        
    
          <?php 
                    $status = new acumulados();
                    echo $status->status($keyCAP, $basedatos, $usuario, $numeroE, $nCuenta);
                    ?>
        </div></td>
		
		
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="<?php 
                    echo $style;
                    ?>
"><div align="left">
      <?php 
                    echo $myrow81['almacenSolicitante'];
                    ?>
</div></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="<?php 
                    echo $style;
                    ?>
"><div align="left"><?php 
                    echo $myrow81['almacenDestino'];
                    ?>
</div></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="<?php 
                    echo $style;
                    ?>
"><?php 
                    echo $myrow81['tipoCliente'];
                    ?>
</td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="<?php 
                    echo $style;
                    ?>
">
	
        <div align="left">
          <?php 
                    echo $myrow81['naturaleza'];
                    ?>
</div></td>
	</tr>
 
	
	
    <?php 
                }
                ?>
  </table>


  <p>&nbsp;</p>
          <p>
    <input name="recibo" type="hidden" id="recibo" value="<?php 
                echo $nCliente = $_POST['numeroE'];
                ?>
" />
    <input name="nCliente" type="hidden" id="nCliente" value="<?php 
                echo $nCliente;
                ?>
" />
    <input name="almacen" type="hidden" id="almacen" value="<?php 
                echo $ALMACEN;
                ?>
" />
  </p>
  <div align="center">
    <div align="left">
      <p>&nbsp;</p>
      
<?php 
                $mostrarCuadroGP = new cuadritoAcumuladoGPO();
                echo $mostrarCuadroGP->mostrarCuadrito($_POST['fecha'], $_POST['fecha2'], 'normal', $entidad, $numeroE, $nCuenta, $basedatos);
                ?>
        
	  <p>&nbsp;</p>
	  <p>&nbsp;</p>
    </div>
   
    
    <p>&nbsp;</p>
    <table width="239" border="0" align="center" class="normal">
      <tr>

	  
        <td width="141" height="23" class="normal">Total por Surtir (iva incluido ) </td>
        <td width="88" class="normal"><div align="right">
            <?php 
                $totalxSurtir = new acumulados();
                echo "\$" . number_format($totalxSurtir->totalxSurtir($basedatos, $usuario, $numeroE, $nCuenta), 2);
                ?>
        </div></td>
      </tr>
    </table>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <table width="239" border="0" align="left" class="normal">
      <tr>
        <td width="139" height="23" class="normal">IVA</td>
        <td width="90" class="normal"><div align="right">
            <?php 
                $iva = new acumulados();
                $iva = $iva->ivaAcumulado($basedatos, $usuario, $numeroE, $nCuenta);
                echo "\$" . number_format($iva, 2);
                ?>
        </div></td>
      </tr>
      <tr bgcolor="#FFCCFF">
        <td height="23" class="normal">Total Cargos </td>
        <td class="normal"><div align="right">
            <?php 
                $totalAcumulado = new acumulados();
                $cargoS = $totalAcumulado->totalAcumulado($basedatos, $usuario, $numeroE, $nCuenta);
                echo "\$" . number_format($totalAcumulado->totalAcumulado($basedatos, $usuario, $numeroE, $nCuenta) + $coaseguro, 2);
                ?>
        </div></td>
      </tr>
    </table>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p align="left">&nbsp;</p>
    <table width="239" border="0" align="left"  >
      <tr bgcolor="#FFCCFF">
        <td width="141" height="23" class="normal"><span class="normal">Total Abonos</span></td>
        <td width="88" class="normal">
		<div align="right">
		<?php 
                $abonos = new acumulados();
                $abonoS = $abonos->abonos($basedatos, $usuario, $numeroE, $nCuenta);
                echo "\$" . number_format($abonos->abonos($basedatos, $usuario, $numeroE, $nCuenta), 2);
                ?>
          </div>	    </td>
      </tr>
      <tr>
        <td height="23" class="normal">Saldo Actual </td>
        <td class="normal"><div align="right">
        <?php 
                $totalCargos = new acumulados();
                $totalCargos = $totalCargos->total($totalAcumulado->totalAcumulado($basedatos, $usuario, $numeroE, $nCuenta), $abonos->abonos($basedatos, $usuario, $numeroE, $nCuenta), $numeroE1, $nCuenta1);
                if ($abonoS < 0) {
                    $abonoS *= -1;
                }
                $STotal = $cargoS - $abonoS;
                echo "\$" . number_format($cargoS - $abonoS, 2);
                /* if(!$STotal and eregi('-',$STotal)){
                		echo 'step';
                		} */
                /* 	if(($cargoS-$abonoS>0){
                		echo "$".number_format($cargoS-$abonoS,2);
                		} else {
                		echo "$".number_format(($cargoS-$abonoS)*-1,2);
                		} */
                ?>
          </div></td>
      </tr>
    </table>

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	<?php 
                if ($myrow3['status'] != 'cerrada') {
                    ?>
	
	
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
	
	
    <table width="86%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <th width="15%" scope="col">
		
		
		
		<table width="94" border="0" align="left">
          <tr bgcolor="#660066">
            <th class="blanco" scope="col">
			
			<span class="blanco">Particular<a href="#" onClick="javascript:ventanaSecundaria7('<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?numeroE=<?php 
                    echo $numeroE;
                    ?>
&amp;almacen=<?php 
                    echo $bali;
                    ?>
&amp;seguro=<?php 
                    echo $_POST['seguro'];
                    ?>
&amp;nCuenta=<?php 
                    echo $myrow3['keyClientesInternos'];
                    ?>
&amp;tipoCliente=<?php 
                    echo 'particular';
                    ?>
')"> </a></span></th>
          </tr>
          <tr>
            <th width="98" bgcolor="#660066" class="blanco" scope="col"><span class="blanco"> <span class="blanco">Total a pagar </span> </span></th>
          </tr>
          <tr>
            <td><div align="center"><span class="normal"> <span class="normal">
                <?php 
                    //echo "$".number_format($cargosParticulares->cargosParticulares($basedatos,$usuario,$numeroE,$nCuenta),2);
                    $cargosParticulares = new acumulados();
                    $T = $cargosParticulares->cargosParticulares($basedatos, $usuario, $numeroE, $nCuenta);
                    // $T=round($T,$ase);
                    if ($T and $transacciones == 'si') {
                        ?>
                <a href="#" onClick="javascript:ventanaSecundaria7('<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?almacenFuente=<?php 
                        echo $bali;
                        ?>
&numeroE=<?php 
                        echo $numeroE;
                        ?>
&almacen=<?php 
                        echo $bali;
                        ?>
&seguro=<?php 
                        echo $_POST['seguro'];
                        ?>
&nCuenta=<?php 
                        echo $myrow3['keyClientesInternos'];
                        ?>
&tipoCliente=<?php 
                        echo 'particular';
                        ?>
&tipoVenta=<?php 
                        echo 'interno';
                        ?>
&tipoMovimiento=<?php 
                        echo 'transaccion';
                        ?>
&tipoPago=Efectivo')">
                <?php 
                        echo "\$" . number_format($cargosParticulares->cargosParticulares($basedatos, $usuario, $numeroE, $nCuenta), 2);
                        ?>
                </a>
                <?php 
                    } else {
                        echo "\$" . number_format($cargosParticulares->cargosParticulares($basedatos, $usuario, $numeroE, $nCuenta), 2);
                    }
                    ?>
            </span></span></div></td>
          </tr>
        </table>
		
		
		
		</th>
        <th width="2%" scope="col">&nbsp;</th>
        <th width="15%" scope="col"><table width="94" border="0" align="center">
          <tr>
            <th bgcolor="#660066"  scope="col"><span class="blanco">Otros Clientes </span></th>
          </tr>
          <tr>
            <th width="88" bgcolor="#660066" scope="col"><span class="blanco">Total a pagar </span></th>
          </tr>
          <tr>
            <td><div align="center"><span class="normal">
                <?php 
                    $otros = new acumulados();
                    if ($otros->otros($basedatos, $usuario, $numeroE, $nCuenta) > 0) {
                        ?>
                <a href="#" onClick="javascript:ventanaSecundaria7('<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?numeroE=<?php 
                        echo $numeroE;
                        ?>
&almacen=<?php 
                        echo $bali;
                        ?>
&almacenFuente=<?php 
                        echo $bali;
                        ?>
&seguro=<?php 
                        echo $_POST['seguro'];
                        ?>
&nCuenta=<?php 
                        echo $myrow3['keyClientesInternos'];
                        ?>
&tipoCliente=<?php 
                        echo 'otros';
                        ?>
&tipoVenta=<?php 
                        echo 'interno';
                        ?>
&tipoMovimiento=<?php 
                        echo 'transaccion';
                        ?>
')">
                <?php 
                        echo "\$" . number_format($otros->otros($basedatos, $usuario, $numeroE, $nCuenta), 2);
                        ?>
                </a>
                <?php 
                    } else {
                        echo "\$" . number_format($otros->otros($basedatos, $usuario, $numeroE, $nCuenta), 2);
                    }
                    ?>
            </span></div></td>
          </tr>
        </table></th>
        <th width="31%" scope="col">&nbsp;</th>
        <th width="2%" scope="col">&nbsp;</th>
        <th width="5%" scope="col">&nbsp;</th>
        <th width="16%" scope="col"><table width="94" border="0">
          <tr>
            <th bgcolor="#660066"  scope="col"><span class="blanco">D.Coaseguro </span></th>
          </tr>
          <tr>
            <th width="88" bgcolor="#660066"  scope="col"><span class="blanco">Total a pagar </span></th>
          </tr>
          <tr>
            <td><div align="center"><span class="normal">
                <?php 
                    $coaseguro = new acumulados();
                    if ($coaseguro->cargosCoaseguro($basedatos, $usuario, $numeroE, $nCuenta) > 0) {
                        ?>
                <a href="#" onClick="javascript:ventanaSecundaria7('<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?numeroE=<?php 
                        echo $numeroE;
                        ?>
&almacen=<?php 
                        echo $bali;
                        ?>
&almacenFuente=<?php 
                        echo $bali;
                        ?>
&seguro=<?php 
                        echo $_POST['seguro'];
                        ?>
&nCuenta=<?php 
                        echo $myrow3['keyClientesInternos'];
                        ?>
&tipoCliente=<?php 
                        echo 'coaseguro';
                        ?>
&tipoVenta=<?php 
                        echo 'interno';
                        ?>
&tipoMovimiento=<?php 
                        echo 'transaccion';
                        ?>
')">
                <?php 
                        echo "\$" . number_format($coaseguro->cargosCoaseguro($basedatos, $usuario, $numeroE, $nCuenta), 2);
                        ?>
                </a>
                <?php 
                    } else {
                        echo "\$" . number_format($coaseguro->cargosCoaseguro($basedatos, $usuario, $numeroE, $nCuenta), 2);
                    }
                    ?>
            </span></div></td>
          </tr>
        </table></th>
        <th width="14%" scope="col"><table width="94" border="0" align="right">
          <tr>
            <th bgcolor="#660066"  scope="col"><span class="blanco"> Compa&ntilde;&iacute;a
                  <?php 
                    //echo "$".number_format($Tcargos,2);
                    ?>
                  <?php 
                    //echo "$".number_format( $Tabonos,2);
                    $t1 = $TOTAL + $Tiva;
                    ?>
                  <?php 
                    //echo "$".number_format($deposito[0],2);
                    //echo "Pago por Otros";
                    $t2 = $Tabonos;
                    ?>
            </span></th>
          </tr>
          <tr>
            <th width="172" bgcolor="#660066" class="blanco" scope="col">Saldo Cia. </th>
          </tr>
          <tr>
            <td><span class="normal">
              <?php 
                    $cargosAseguradora = new acumulados();
                    if ($cargosAseguradora->cargosAseguradora($basedatos, $usuario, $numeroE, $nCuenta) != null and $transacciones == 'si') {
                        ?>
              <a href="#" onClick="javascript:ventanaSecundaria7('<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?numeroE=<?php 
                        echo $numeroE;
                        ?>
		&almacen=<?php 
                        echo $bali;
                        ?>
&almacenFuente=<?php 
                        echo $bali;
                        ?>
&seguro=<?php 
                        echo $_POST['seguro'];
                        ?>
&nCuenta=<?php 
                        echo $myrow3['keyClientesInternos'];
                        ?>
&tipoCliente=<?php 
                        echo 'aseguradora';
                        ?>
&tipoVenta=<?php 
                        echo 'interno';
                        ?>
')">
              <?php 
                        echo "\$" . number_format($cargosAseguradora->cargosAseguradora($basedatos, $usuario, $numeroE, $nCuenta), 2);
                        ?>
              </a>
              <?php 
                    } else {
                        echo "\$" . number_format($cargosAseguradora->cargosAseguradora($basedatos, $usuario, $numeroE, $nCuenta), 2);
                    }
                    ?>
            </span> </td>
          </tr>
        </table></th>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
    <p>&nbsp;</p>
  </div>
  <?php 
                    if (($cargosParticulares->cargosParticulares($basedatos, $usuario, $numeroE, $nCuenta) == NULL or $cargosParticulares->cargosParticulares($basedatos, $usuario, $numeroE, $nCuenta) == 0) and ($totalxSurtir->totalxSurtir($basedatos, $usuario, $numeroE, $nCuenta) == NULL or $totalxSurtir->totalxSurtir($basedatos, $usuario, $numeroE, $nCuenta) == 0) and ($otros->otros($basedatos, $usuario, $numeroE, $nCuenta) == NULL or $otros->otros($basedatos, $usuario, $numeroE, $nCuenta) == 0) and ($cargosAseguradora->cargosAseguradora($basedatos, $usuario, $numeroE, $nCuenta) == NULL or $cargosAseguradora->cargosAseguradora($basedatos, $usuario, $numeroE, $nCuenta) == 0)) {
                        ?>
  <p align="center">
    
	<?php 
                        if (!$myrow661['status']) {
                            ?>
	<input name="faltan" type="submit" class="normal" id="cerrar" value="Faltan Departamentos" disabled=""/>	
	<?php 
                        } else {
                            ?>
	<input name="cerrar" type="submit" class="normal" id="cerrar" value="Cerrar Cuenta" />
	<?php 
                        }
                        //cierra validaciones de proceso de cierre de departamentos
                        ?>
	
	
    <input name="keyClientesInternos" type="hidden" id="keyClientesInternos" value="<?php 
                        echo $myrow3['keyClientesInternos'];
                        ?>
" />
  </p>
  <div align="center">
    <?php 
                    }
                    ?>
    
    <?php 
                } else {
                    echo "LA CUENTA DEL PACIENTE " . $myrow3['paciente'] . " ESTA CERRADA...";
                    ?>
    <input name="imprimir" type="submit" class="normal" id="imprimir" value="Imprimir" />
    <?php 
                }
                ?>
  </div>
</form>
<?php 
            }
            ?>
<p align="center">&nbsp;</p>
<?php 
            if ($_POST['banderaFecha']) {
                ?>
  <script type="text/javascript"> 
   Calendar.setup({ 
    inputField     :    "campo_fecha",     // id del campo de texto 
     ifFormat     :     "%Y-%m-%d",     // formato de la fecha que se escriba en el campo de texto 
     button     :    "lanzador"     // el id del bot�n que lanzar� el calendario 
}); 
</script> 
  <script type="text/javascript"> 
   Calendar.setup({ 
    inputField     :    "campo_fecha1",     // id del campo de texto 
     ifFormat     :     "%Y-%m-%d",     // formato de la fecha que se escriba en el campo de texto 
     button     :    "lanzador1"     // el id del bot�n que lanzar� el calendario 
}); 
</script>
<?php 
            }
        }
        ?>
</body>
</html>
<?php 
    }
    public function closing($keyClientesInternos, $basedatos)
    {
        ?>
<table width="86%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <th width="15%" scope="col">
		
		
		
		<table width="94" border="0" align="left">
          <tr bgcolor="#660066">
            <th class="blanco" scope="col">
			
			<span class="blanco">Particular<a href="#" onClick="javascript:ventanaSecundaria7('<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?numeroE=<?php 
        echo $numeroE;
        ?>
&amp;almacen=<?php 
        echo $bali;
        ?>
&amp;seguro=<?php 
        echo $_POST['seguro'];
        ?>
&amp;nCuenta=<?php 
        echo $myrow3['keyClientesInternos'];
        ?>
&amp;tipoCliente=<?php 
        echo 'particular';
        ?>
')"> </a></span></th>
          </tr>
          <tr>
            <th width="98" bgcolor="#660066" class="blanco" scope="col"><span class="blanco"> <span class="blanco">Total a pagar </span> </span></th>
          </tr>
          <tr>
            <td><div align="center"><span class="normal"> <span class="normal">
                <?php 
        //echo "$".number_format($cargosParticulares->cargosParticulares($basedatos,$usuario,$numeroE,$nCuenta),2);
        $ttP = $cargosParticularesCC->cargosParticularesCC($basedatos, $usuario, $myrow3['keyClientesInternos']);
        // $T=round($T,$ase);
        if ($ttP) {
            if ($cargosParticularesCC->cargosParticularesCC($basedatos, $usuario, $myrow3['keyClientesInternos']) < 0) {
                $dev = 'si';
                $cantidadDevolucion = $cargosParticularesCC->cargosParticularesCC($basedatos, $usuario, $myrow3['keyClientesInternos']);
            } else {
                $dev = '';
            }
            ?>
                <a href="#" onClick="javascript:ventanaSecundaria7('<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?almacenFuente=<?php 
            echo $bali;
            ?>
&numeroE=<?php 
            echo $numeroE;
            ?>
&almacen=<?php 
            echo $bali;
            ?>
&seguro=<?php 
            echo $_POST['seguro'];
            ?>
&nCuenta=<?php 
            echo $myrow3['keyClientesInternos'];
            ?>
&tipoCliente=<?php 
            echo 'particular';
            ?>
&tipoVenta=<?php 
            echo 'interno';
            ?>
&tipoMovimiento=<?php 
            echo 'transaccion';
            ?>
&tipoTransaccion=particular&random=<?php 
            echo rand(90000, 900000000);
            ?>
&devolucion=<?php 
            print $dev;
            ?>
&cantidadDevolucion=<?php 
            echo $cantidadDevolucion;
            ?>
')">
                <?php 
            echo "\$" . number_format($cargosParticularesCC->cargosParticularesCC($basedatos, $usuario, $myrow3['keyClientesInternos']), 2);
            ?>
                </a>
                <?php 
        } else {
            echo "\$" . number_format($cargosParticularesCC->cargosParticularesCC($basedatos, $usuario, $myrow3['keyClientesInternos']), 2);
        }
        ?>
            </span></span></div></td>
          </tr>
        </table>
		
		
		
		</th>
        <th width="2%" scope="col">&nbsp;</th>
        <th width="15%" scope="col"><table width="94" border="0" align="center">
          <tr>
            <th bgcolor="#660066"  scope="col"><span class="blanco">Otros Clientes </span></th>
          </tr>
          <tr>
            <th width="88" bgcolor="#660066" scope="col"><span class="blanco">Total a pagar </span></th>
          </tr>
          <tr>
            <td><div align="center"><span class="normal">
                <?php 
        //*******************OTROS**********************
        $otros = new acumulados();
        $ttO = $otros->otros($basedatos, $usuario, $numeroE, $nCuenta);
        if ($ttO) {
            ?>
                <a href="#" onClick="javascript:ventanaSecundaria7('<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?numeroE=<?php 
            echo $numeroE;
            ?>
&almacen=<?php 
            echo $bali;
            ?>
&almacenFuente=<?php 
            echo $bali;
            ?>
&seguro=<?php 
            echo $_POST['seguro'];
            ?>
&nCuenta=<?php 
            echo $myrow3['keyClientesInternos'];
            ?>
&tipoCliente=<?php 
            echo 'otros';
            ?>
&tipoVenta=<?php 
            echo 'interno';
            ?>
&tipoMovimiento=<?php 
            echo 'transaccion';
            ?>
&tipoTransaccion=otros&random=<?php 
            echo rand(90000, 900000000);
            ?>
')">
                <?php 
            echo "\$" . number_format($otros->otros($basedatos, $usuario, $numeroE, $nCuenta), 2);
            ?>
                </a>
                <?php 
        } else {
            echo "\$" . number_format($otros->otros($basedatos, $usuario, $numeroE, $nCuenta), 2);
        }
        ?>
            </span></div></td>
          </tr>
        </table></th>
            
        
        
        
        
        <th width="31%" scope="col">&nbsp;</th>
        <th width="2%" scope="col">&nbsp;</th>
        <th width="5%" scope="col">&nbsp;</th>
        <th width="16%" scope="col"><table width="94" border="0">
          <tr>
            <th bgcolor="#660066"  scope="col"><span class="blanco">D.Coaseguro </span></th>
          </tr>
          <tr>
            <th width="88" bgcolor="#660066"  scope="col"><span class="blanco">Total a pagar </span></th>
          </tr>
          <tr>
            <td><div align="center"><span class="normal">
                <?php 
        $coaseguro = new acumulados();
        $ttCO = $coaseguro->cargosCoaseguro($basedatos, $usuario, $_GET['nT']);
        if ($ttCO) {
            ?>
                <a href="#" onClick="javascript:ventanaSecundaria7('<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?numeroE=<?php 
            echo $numeroE;
            ?>
&almacen=<?php 
            echo $bali;
            ?>
&almacenFuente=<?php 
            echo $bali;
            ?>
&seguro=<?php 
            echo $_POST['seguro'];
            ?>
&nCuenta=<?php 
            echo $myrow3['keyClientesInternos'];
            ?>
&tipoCliente=<?php 
            echo 'coaseguro';
            ?>
&tipoVenta=<?php 
            echo 'interno';
            ?>
&tipoMovimiento=<?php 
            echo 'transaccion';
            ?>
&tipoTransaccion=coaseguro&random=<?php 
            echo rand(90000, 900000000);
            ?>
')">
                <?php 
            echo "\$" . number_format($coaseguro->cargosCoaseguro($basedatos, $usuario, $_GET['nT']), 2);
            ?>
                </a>
                <?php 
        } else {
            echo "\$" . number_format($coaseguro->cargosCoaseguro($basedatos, $usuario, $_GET['nT']), 2);
        }
        ?>
            </span></div></td>
          </tr>
        </table></th>
        <th width="14%" scope="col"><table width="94" border="0" align="right">
          <tr>
            <th bgcolor="#660066"  scope="col"><span class="blanco"> Compa&ntilde;&iacute;a
                  <?php 
        //echo "$".number_format($Tcargos,2);
        ?>
                  <?php 
        //echo "$".number_format( $Tabonos,2);
        $t1 = $TOTAL + $Tiva;
        ?>
                  <?php 
        //echo "$".number_format($deposito[0],2);
        //echo "Pago por Otros";
        $t2 = $Tabonos;
        ?>
            </span></th>
          </tr>
          <tr>
            <th width="172" bgcolor="#660066" class="blanco" scope="col">Saldo Cia. </th>
          </tr>
          <tr>
            <td><span class="normal">
            

              <?php 
        $ttCA = $cargosAseguradoraCC->cargosAseguradoraCC($basedatos, $usuario, $_GET['nT']);
        if ($ttCA && !$coaseguro->cargosCoaseguro($basedatos, $usuario, $_GET['nT'])) {
            ?>
              <a href="#" onClick="javascript:ventanaSecundaria7('<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?numeroE=<?php 
            echo $numeroE;
            ?>
		&almacen=<?php 
            echo $bali;
            ?>
&almacenFuente=<?php 
            echo $bali;
            ?>
&seguro=<?php 
            echo $_POST['seguro'];
            ?>
&nCuenta=<?php 
            echo $myrow3['keyClientesInternos'];
            ?>
&tipoCliente=<?php 
            echo 'aseguradora';
            ?>
&tipoVenta=<?php 
            echo 'interno';
            ?>
&tipoTransaccion=aseguradora&random=<?php 
            echo rand(90000, 900000000);
            ?>
')">
              <?php 
            echo "\$" . number_format($cargosAseguradoraCC->cargosAseguradoraCC($basedatos, $usuario, $_GET['nT']), 2);
            ?>
              </a>
              <?php 
        } else {
            echo "\$" . number_format($cargosAseguradoraCC->cargosAseguradoraCC($basedatos, $usuario, $_GET['nT']), 2);
        }
        ?>
        
    
        
        
            </span> </td>
          </tr>
        </table></th>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
    <?php 
    }