示例#1
0
    $importes[0] += $importe;
    $pdf->SetX('22');
    $pdf->Cell(0, 0, trim($myrow3['descripcion']), 0, 0, L);
    //$pdf->Cell(0,0,$cadena,0,0,R);
    //**********pruebas
    $pdf->SetX('170');
    $pdf->Cell(0, 0, $cant, 0, 0, M);
    $pdf->SetX('140');
    $pdf->Cell(0, 0, $cos, 0, 0, R);
    //************cierra pruebas
    $pdf->Ln(2);
    //salto de linea
    //$pdf->Ln(1); //salto de linea
}
$despliegaTotal = new acumulados();
$despliegaTotal1 = new acumulados();
$TOTAL = $despliegaTotal->acumulado($basedatos, $usuario, $_GET['numeroE'], $_GET['nCuenta']);
$centavos = strstr($TOTAL, '.');
$centavos = substr($centavos, '1');
$resultado = numerotexto($TOTAL);
$totalCaracteres = strlen($centavos);
if ($totalCaracteres == '1') {
    $centavos = $centavos . '0';
}
if (!$centavos) {
    $centavos = '00';
}
$formula = 'pesos ' . $centavos . '/100 M.N.';
$formula = trim($formula);
$Y = 120;
$pdf->SetFont('Arial', '', 8);
    public function eCuenta($usuario, $fecha1, $hora1, $nT, $basedatos)
    {
        include CONSTANT_PATH_CONFIGURACION . "/funciones.php";
        if (!$_GET['nT']) {
            $_GET['nT'] = $_GET['nt'];
        }
        ?>
<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=300,height=400,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 
        //************************
        $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'];
        $seguro = $myrow3['seguro'];
        ?>

<?php 
        if ($seguro) {
            $_GET['tipoCliente'] = 'aseguradora';
        } else {
            $_GET['tipoCliente'] = 'particular';
        }
        //*****************************Verificando caja abierta**************************
        $sSQLC = "Select * From aperturaCaja ";
        $resultC = mysql_db_query($basedatos, $sSQLC);
        $myrowC = mysql_fetch_array($resultC);
        if ($poliza = $myrowC['numeroPoliza']) {
            //*******************Comienzo la validaci�n*****************
            if ($_POST['pagar'] and $numeroE and $nCuenta) {
                $numeroConfirmacion = rand();
                $q = "UPDATE clientesInternos set \r\nstatus='cerrada',\r\nstatusDeposito='pagado'\r\n\r\nWHERE numeroE = '" . $numeroE . "' and nCuenta='" . $nCuenta . "'";
                mysql_db_query($basedatos, $q);
                echo mysql_error();
                $sSQL341 = "Select * From catTTCaja WHERE codigoTT = 'PSExt'";
                $result341 = mysql_db_query($basedatos, $sSQL341);
                $myrow341 = mysql_fetch_array($result341);
                $naturaleza = $myrow341['naturaleza'];
                $tipoTransaccion = 'PSExt';
                if ($naturaleza == 'Abono') {
                    $naturaleza = 'A';
                } else {
                    if ($naturaleza == 'Cargo') {
                        $naturaleza = 'C';
                    } else {
                        if ($naturaleza == 'Credito') {
                            $naturaleza = 'A';
                        }
                    }
                }
                if ($_GET['tipoCliente'] == 'aseguradora') {
                    $statusTraslado = 'trasladado';
                    $q1 = "UPDATE cargosCuentaPaciente set \r\nstatusTraslado='trasladado',\r\ntipoTransaccion='" . $_GET['tipoTransaccion'] . "',\r\nusuarioTraslado='" . $usuario . "',tipoCliente='" . $_GET['tipoCliente'] . "',\r\nnumPoliza='" . $poliza . "'\r\nWHERE status='cxc' and statusTraslado='standby'";
                    mysql_db_query($basedatos, $q1);
                    echo mysql_error();
                } else {
                    if ($_GET['tipoCliente'] == 'particular') {
                        $statusTraslado = 'trasladado';
                        $q1 = "UPDATE cargosCuentaPaciente set \r\nstatusTraslado='trasladado',\r\ntipoTransaccion='" . $_GET['tipoTransaccion'] . "',\r\nusuarioTraslado='" . $usuario . "',tipoCliente='" . $_GET['tipoCliente'] . "',\r\nnumPoliza='" . $poliza . "'\r\nWHERE status='particular' and statusTraslado='standby'";
                        mysql_db_query($basedatos, $q1);
                        echo mysql_error();
                    } else {
                        if ($_GET['tipoCliente'] == 'otros') {
                            $statusTraslado = 'trasladado';
                            $q1 = "UPDATE cargosCuentaPaciente set \r\nstatusTraslado='trasladado',\r\ntipoTransaccion='" . $_GET['tipoTransaccion'] . "',\r\nusuarioTraslado='" . $usuario . "',tipoCliente='" . $_GET['tipoCliente'] . "',\r\nnumPoliza='" . $poliza . "'\r\nWHERE status='credito' and statusTraslado='standby'";
                            mysql_db_query($basedatos, $q1);
                            echo mysql_error();
                        }
                    }
                }
                $agrega = "INSERT INTO cargosCuentaPaciente (\r\nnumeroE,nCuenta,status,usuario,fecha1,cantidad,tipoTransaccion,codProcedimiento,hora1,\r\nnaturaleza,ejercicio,statusDeposito,numeroConfirmacion,almacen,usuarioTraslado,precioVenta,seguro,\r\nstatusTraslado,tipoCliente,tipoPaciente,numPoliza) values ('" . $numeroE . "','" . $nCuenta . "','transaccion',\r\n'" . $usuario . "','" . $fecha1 . "','1','" . $tipoTransaccion . "','" . $hora1 . "',\r\n'" . $hora1 . "','" . $naturaleza . "','" . $ID_EJERCICIOM . "','pagado','" . $numeroConfirmacion . "','" . $ALMACEN . "','" . $usuario . "',\r\n'" . $_GET['cantidadRecibida'] . "','" . $seguro . "','" . $statusTraslado . "','" . $_GET['tipoCliente'] . "','" . $tipoPaciente . "','" . $poliza . "'\r\n)";
                mysql_db_query($basedatos, $agrega);
                echo mysql_error();
                ?>
<script>
javascript:ventanaSecundaria6('<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/INGRESOS%20HLC/caja/imprimeCajaExternos.php?numeroE=<?php 
                echo $nCliente5;
                ?>
&amp;nT=<?php 
                echo $numeroCuenta;
                ?>
&amp;paciente=<?php 
                echo $_POST['paciente'];
                ?>
&amp;orden=<?php 
                echo $E;
                ?>
&amp;hora1=<?php 
                echo $hora1;
                ?>
');
</script>
<?php 
            }
            ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<style type="text/css">
<!--
.style13 {color: #FFFFFF}
.style11 {color: #FFFFFF; font-size: 10px; font-weight: bold; }
.style7 {font-size: 9px}
.Estilo24 {font-size: 10px}
.style19 {color: #000000; font-weight: bold; }
-->
</style>


</head>

<style type="text/css">
<!--
.style12 {font-size: 10px}
.style14 {font-size: 10px; color: #FFFFFF; }
.style21 {color: #FF0000}
-->
</style>
<BODY >

<h1 align="center">Nota de Venta <?php 
            echo $myrow3['almacen'];
            ?>
</h1>
<form name="form2" id="form2" method="get" action="">
  <table width="43%" height="158" border="0" align="center" cellpadding="4" cellspacing="0">
    <tr bgcolor="#FFFFFF">
      <td width="29%" class="style12">Tipo Pago/Cr&eacute;dito </td>
      <td width="71%" class="style12">
        <?php 
            if (!$_GET['tipoPago']) {
                $_GET['tipoPago'] = 'Efectivo';
            }
            ?>
        <select name="tipoPago" class="style7" id="select2" onchange="javascript:form.submit();">
          <option
				 <?php 
            if ($_GET['tipoPago'] == 'Efectivo') {
                ?>
				 selected="selected"
				  <?php 
            }
            ?>
				 value="Efectivo">Efectivo</option>
          <option
				 <?php 
            if ($_GET['tipoPago'] == 'Tarjeta de Credito') {
                ?>
				 selected="selected"
				  <?php 
            }
            ?>
				 value="Tarjeta de Credito">Tarjeta de Credito</option>
          <option
				<?php 
            if ($_GET['tipoPago'] == 'Cheque') {
                ?>
				 selected="selected"
				  <?php 
            }
            ?>
				 value="Cheque">Cheque</option>
          <option 
				<?php 
            if ($_GET['tipoPago'] == 'Credito') {
                ?>
				 selected="selected"
				 <?php 
            }
            ?>
				value="Credito">Credito</option>
      </select></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <?php 
            if ($_GET['tipoPago'] == 'Tarjeta de Credito') {
                ?>
      <td class="style12">C&oacute;digo de Tarjeta</td>
      <td class="style12"><input name="codigo" type="text" class="style12" id="codigo" 
		 value="<?php 
                if ($_GET['nuevo']) {
                    echo "0000000000";
                } else {
                    if ($myrow2['codigo']) {
                        echo $myrow2['codigo'];
                    }
                }
                ?>
" size="10" readonly=""/>
          <a href="javascript:ventanaSecundaria3('<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/cargos/ventanaTC.php?nombreCampo=<?php 
                echo "codigo";
                ?>
&amp;descripcion=<?php 
                echo "descripcion";
                ?>
&amp;forma=<?php 
                echo "form1";
                ?>
&amp;comision=<?php 
                echo "comision";
                ?>
')"><img src="<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/imagenes/Save.png" alt="Laboratorio Fabricante" width="15" height="15" border="0" /></a></td>
      <input name="comision" type="hidden" value="" />
    </tr>
    <tr bgcolor="#FFFFFF">
      <td bgcolor="#FFFFFF" class="style12">Banco Tarjeta</td>
      <td bgcolor="#FFFFFF" class="style12"><input name="descripcion" type="text" class="style7" value="<?php 
                echo $_GET['descripcion'];
                ?>
"  readonly=""/></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td class="style12">&Uacute;ltimos 4 D&iacute;gitos</td>
      <td class="style12"><label>

        <input name="ultimosDigitos" type="text" class="style7" id="ultimosDigitos" size="4" maxlength="4" value="<?php 
                echo $_GET['ultimosDigitos'];
                ?>
" onkeypress="return checkIt(event)"/>
        
</label></td>
    </tr>
    <tr bgcolor="#FFFFFF">    </tr>
    <?php 
            }
            ?>
    <?php 
            //descuentos pacientes internos
            $sSQL18 = "SELECT *\r\nFROM\r\ndescuentos\r\nWHERE \r\nnumeroE='" . $numeroE . "' AND nCuenta ='" . $nCuenta . "' and nCuenta <>null\r\nand \r\nstatus='activo' and\r\nfechaFinal <= '" . $fecha1 . "'";
            $result18 = mysql_db_query($basedatos, $sSQL18);
            $myrow18 = mysql_fetch_array($result18);
            echo mysql_error();
            //descuentos pacientes ambulatorios
            $sSQL19 = "SELECT *\r\nFROM\r\ndescuentos\r\nWHERE \r\nnumeroE='" . $nCliente . "' \r\nand status='activo' and\r\nfechaFinal <= '" . $fecha1 . "'\r\n ";
            $result19 = mysql_db_query($basedatos, $sSQL19);
            $myrow19 = mysql_fetch_array($result19);
            //******************
            if ($myrow19['cantidad']) {
                $descuento = $myrow19['cantidad'];
            } else {
                if ($myrow19['descuento']) {
                    $TOTAL1 = $myrow19['descuento'] / 100 * $TOTAL;
                    $descuento = $TOTAL1 - $descuento;
                }
            }
            if ($myrow18['cantidad']) {
                $descuento = $myrow18['cantidad'];
            } else {
                if ($myrow18['descuento']) {
                    $TOTAL1 = $myrow18['descuento'] / 100 * $TOTAL;
                    $descuento = $TOTAL1 - $descuento;
                }
            }
            $TOTAL -= $descuento;
            ?>
  </table>
  <input name="nT" type="hidden" class="style12" id="nT" 
		  value="<?php 
            echo $_GET['nT'];
            ?>
" readonly=""/>
</form>
<p align="center">&nbsp;</p>
<form id="form1" name="form1" method="post" action="">
  <table width="642" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#990099" class="Estilo24">
    <tr>      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <th bgcolor="#660066" class="style14" scope="col"><div align="left">N&uacute;mero de Transacci&oacute;n: </div></th>
      <th bgcolor="#660066" class="style14" scope="col"><div align="left"><?php 
            echo $nCliente = $myrow3['keyClientesInternos'];
            ?>
          <input name="numeroE" type="hidden" class="Estilo24" id="numeroE" 
		  value="<?php 
            echo $nCliente = $_POST['numeroE'];
            ?>
" readonly=""/>
</label></div>
      </th>
    </tr>
    <tr>      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <th width="134" bgcolor="#FFCCFF" class="Estilo24" scope="col"><div align="left"><strong>Paciente: </strong></div></th>
      <th width="408" bgcolor="#FFCCFF" class="Estilo24" scope="col"><div align="left"><strong>          <label> </label>
      </strong> <?php 
            echo $myrow3['paciente'];
            ?>
 </div></th>
    </tr>
    <tr>      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <td class="Estilo24">Compa&ntilde;&iacute;a: </td>
      <td class="Estilo24"><label> <?php 
            echo $traeSeguro = $myrow3['seguro'];
            ?>
        <?php 
            $sSQL212 = "SELECT *\r\nFROM\r\nclientes\r\nWHERE \r\nnumCliente='" . $traeSeguro . "'\r\n ";
            $result212 = mysql_db_query($basedatos, $sSQL212);
            $myrow212 = mysql_fetch_array($result212);
            ?>
        <input name="seguro2" type="hidden" id="seguro2" value="<?php 
            echo $traeSeguro;
            ?>
" />
      </label></td>
    </tr>
    <tr>      <th class="Estilo24" scope="col">&nbsp;</th>
      <td bgcolor="#FFCCFF" class="Estilo24">N&deg; Credencial: </td>
      <td bgcolor="#FFCCFF" class="Estilo24"><?php 
            echo $myrow3['credencial'];
            ?>
 </td>
    </tr>
  </table>
  <p>&nbsp;</p>
  

  
  <table width="672" border="0" align="center">
    <tr>
      <th width="104" height="14" bgcolor="#660066" class="style14" scope="col"><span class="style12 ">Fecha/Hora (Cargo)</span></th>
      <th width="405" bgcolor="#660066" class="style14" scope="col"><span class="style12 ">Descripci&oacute;n</span></th>
      <th width="21" bgcolor="#660066" class="style14" scope="col"><span class="style12 ">Cant</span></th>
      <th width="59" bgcolor="#660066" class="style14" scope="col"><span class="style12 ">Importe IC </span></th>
      <th width="61" bgcolor="#660066" class="style14" scope="col"><span class="style12 ">IVA</span></th>
    </tr>
    <tr>
      <?php 
            //traigo agregados
            $sSQL81 = "\r\nSELECT \r\n *,((precioVenta*cantidad)+iva) as sumaTres\r\nFROM\r\ncargosCuentaPaciente \r\n WHERE \r\n numeroE = '" . $numeroE . "'\r\n \r\n and nCuenta='" . $nCuenta . "'\r\n\r\n order by fecha1,hora1 asc\r\n";
            if ($result81 = mysql_db_query($basedatos, $sSQL81)) {
                while ($myrow81 = mysql_fetch_array($result81)) {
                    $keyCAP = $myrow81['keyCAP'];
                    $a = $a + 1;
                    $art = $myrow81['codProcedimiento'];
                    $proc = $myrow81['codProcedimiento'];
                    $codigo = $myrow81['codProcedimiento'];
                    if ($col) {
                        $color = '#FFCCFF';
                        $col = "";
                    } else {
                        $color = '#FFFFFF';
                        $col = 1;
                    }
                    ?>




      <td height="23" bgcolor="<?php 
                    echo $color;
                    ?>
" class="Estilo24"><span class="style7"><?php 
                    echo $myrow81['fecha1'] . " " . $myrow81['hora1'];
                    ?>
</span></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="Estilo24"><span class="style7"><span class="style12"><span class="<?php 
                    echo $estilo;
                    ?>
">
        <?php 
                    $descripcion = new articulosDetalles();
                    $descripcion->descripcion($numeroE, $nCuenta, $codigo, $basedatos);
                    ?>
      </span></span>        <span class="style12">
        <?php 
                    if ($myrow81['um'] == 's' or $myrow81['um'] == 'S') {
                        echo '  ( Servicio )  ';
                    }
                    ?>
        <?php 
                    if ($myrow81['status'] == 'cerrada') {
                        echo '<blink>' . "[Cerrada]" . '</blink>';
                    } else {
                        //echo '<blink>'."[CxC]".'</blink>';
                    }
                    ?>
 </span> </span></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="Estilo24"><span class="style7">
        <?php 
                    if ($_POST['tipoVista'] == 'Agrupado') {
                        echo $cantidad = $myrow14['cantidad2'];
                    } else {
                        echo $cantidad = $myrow81['cantidad'];
                    }
                    ?>
      </span></td>
	
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="Estilo24"><span class="style7">
          
      <span class="style12"><span class="<?php 
                    echo $estilo;
                    ?>
">
  
       <?php 
                    $importe = new acumulados();
                    $importe->importe($keyCAP, $basedatos);
                    ?>
		
      </span></span> </span></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="Estilo24"><span class="style7">
        <?php 
                    $mostrarIVA = new articulosDetalles();
                    echo $mostrarIVA->mostrarIVA($keyCAP, $basedatos);
                    ?>
      </span></td>
	   <?php 
                    if ($tipoTrans and !$myrow81['sumaTres']) {
                        //echo "$".number_format("-".$myrow81['cantidadRecibida'],2);
                        $TOTAL += "-" . $myrow81['cantidadRecibida'];
                    } else {
                        //echo "$".number_format($costoProcedimientos[0],2);
                        //$TOTAL+=$costoProcedimientos[0];
                        //echo "$".number_format($myrow81['sumaTres'],2);
                    }
                    ?>
    </tr>
 
	
	
    <?php 
                }
                ?>
  </table>
  <p>
    <input name="paso_bandera1" type="hidden" id="paso_bandera1" value="<?php 
                echo $bandera;
                ?>
" />
    <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;
                ?>
" /><?php 
                //echo "$".number_format($TOTAL,2);
                ?>
  </p>
  <div align="center">
    <p>&nbsp;</p>
    
    <table width="679" border="0" align="center" class="style12">
      <tr>
        <td width="139" class="style12">&nbsp;</td>
        <td width="139" class="style12">&nbsp;</td>
        <td width="139" class="style12">&nbsp;</td>
        <td width="139" height="23" class="style12">IVA</td>
        <td width="90" class="style12"><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 bgcolor="#FFFFFF" class="style12">&nbsp;</td>
        <td bgcolor="#FFFFFF" class="style12">&nbsp;</td>
        <td bgcolor="#FFFFFF" class="style12">&nbsp;</td>
        <td height="23" class="style12">Total Cargos </td>
        <td class="style12"><div align="right">
            <?php 
                $totalAcumulado = new acumulados();
                echo "\$" . number_format($totalAcumulado->totalAcumulado($basedatos, $usuario, $numeroE, $nCuenta), 2);
                ?>
        </div></td>
      </tr>
    </table>
    <p>&nbsp;</p>
	
	
	
	
	
    <p>
      <input name="pagar" type="submit" class="style7" id="pagar" value="Aplicar Pago" />
      <input name="Submit" type="submit" class="style7" value="Trasladar a Compa&ntilde;ia" />
</p>
  </div>
  <p>&nbsp;</p>
</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 
    }
			  
			  
			  
            </tr>
            <tr bgcolor="#FFFFFF">
              <td class="Estilo24">Compa&ntilde;&iacute;a</td>
              <td class="Estilo24"><span class="style12">
                <?php 
    $despliegaAseguradora = new acumulados();
    echo "\$" . number_format($despliegaAseguradora->acumuladoAseguradora($basedatos, $usuario, $numeroE1, $nCuenta1), 2);
    ?>
              </span></td>
            </tr>
          <tr bgcolor="#FFFFFF">
		  <?php 
    $despliegaTotal = new acumulados();
    if ($despliegaTotal->acumulado($basedatos, $usuario, $numeroE1, $nCuenta1) > 0) {
        $mostrar = 'Total Cargos';
    } else {
        if ($despliegaTotal->acumulado($basedatos, $usuario, $numeroE1, $nCuenta1) < 0) {
            $mostrar = 'Saldo a Favor';
        } else {
            $mostrar = 'Sin Cargos..';
        }
    }
    ?>
		  
            <td width="22%" class="Estilo24"><?php 
    echo $mostrar;
    ?>
</td>
    public function consulta($entidad, $ventana, $TITULO, $nCliente, $basedatos)
    {
        ?>


<script language=javascript> 
function ventanaSecundaria2 (URL){ 
   window.open(URL,"ventana2","width=800,height=800,scrollbars=YES") 
} 
</script> 

  <script language="JavaScript" type="text/javascript">
    /**
    * funcion demo del evento onclick en la tabla
    */
    function envia()
    {
      document.forms[0].submit();
    }
    /**
    * funcion de captura de pulsaci�n de tecla en Internet Explorer
    */ 
    var tecla;
    function capturaTecla(e) 
    {
        if(document.all)
            tecla=event.keyCode;
        else
        {
            tecla=e.which; 
        }
     if(tecla==13)
        {
            document.forms[0].submit();
        }
    }  
    document.onkeydown = capturaTecla;
</script>


<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana","width=800,height=600,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script> 






<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<style type="text/css">

.style11 {color: #FFFFFF; font-size: 10px; font-weight: bold; }
.style12 {font-size: 10px}
.style7 {font-size: 9px}
.style13 {color: #FFFFFF}
.enlace {cursor:default;}


div.htmltooltip{
position: absolute; /*leave this and next 3 values alone*/
z-index: 1000;
left: -1000px;
top: -1000px;
background: #272727;
border: 10px solid black;
color: white;
padding: 3px;
width: 250px; /*width of tooltip*/
}

</style>
</head>


<form id="form1" name="form1" method="get" action="#">
  <h1 align="center"> <?php 
        echo $TITULO;
        ?>
</h1>
  <table width="722" border="0.2" align="center">
    <tr>
      <th width="50" bgcolor="#660066" class="style12" scope="col"><div align="left"><span class="style11 style13"># Folio </span></div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left"><span class="style11 style13">Nombre del paciente:</span></div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left"><span class="style11 style13">Depto.</span></div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left"><span class="style11 style13">tipo</span></div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left"><span class="style11 style13">Cargos</span></div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left"><span class="style11 style13">Abonos</span></div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left">
        <div align="left">
          <div align="left"><span class="style11 style13">Ver</span></div>
        </div>
      </div></th>
    </tr>
    <tr>
      <?php 
        $sSQL = "SELECT *\r\nFROM\r\nclientesInternos \r\nWHERE entidad='" . $entidad . "' \r\nAND\r\nseguro!=''\r\nAND\r\nseguro='" . $nCliente . "'\r\n\r\n\r\nORDER BY keyClientesInternos ASC\r\n ";
        if ($result = mysql_db_query($basedatos, $sSQL)) {
            while ($myrow = mysql_fetch_array($result)) {
                $numeroE = $myrow['numeroE'];
                $nCuenta = $myrow['nCuenta'];
                if ($col) {
                    $color = '#FFCCFF';
                    $col = "";
                } else {
                    $color = '#FFFFFF';
                    $col = 1;
                }
                $seguro = $myrow['seguro'];
                $nT = $myrow['keyClientesInternos'];
                $sSQL1711 = "\r\n\tSELECT \r\nnomCliente\r\nFROM\r\nclientes\r\nWHERE \r\nnumCliente = '" . $seguro . "'\r\n\r\n";
                $result1711 = mysql_db_query($basedatos, $sSQL1711);
                $myrow1711 = mysql_fetch_array($result1711);
                $seguro = $myrow1711['nomCliente'];
                if ($seguro) {
                    $tipoCliente = 'aseguradora';
                } else {
                    $tipoCliente = 'particular';
                }
                if (!$seguro) {
                    $seguro = 'particular';
                }
                ?>
      <td height="24" bgcolor="<?php 
                echo $color;
                ?>
" class="style12"><span class="style7"><?php 
                echo $myrow['keyClientesInternos'];
                ?>
</span></td>


      <td width="253" bgcolor="<?php 
                echo $color;
                ?>
" class="style12"><span class="style7">

	  <?php 
                echo $myrow['paciente'];
                ?>
          <input name="nombrePaciente" type="hidden" id="nombrePaciente" value="<?php 
                echo $nombrePaciente;
                ?>
"/>
        <input name="tipoSeguro" type="hidden" id="tipoSeguro" value="<?php 
                echo $seguro;
                ?>
"/>
      </span></td>
      <td width="143" bgcolor="<?php 
                echo $color;
                ?>
" class="style12"><span class="style121"><span class="style71">
	  <?php 
                echo $myrow['almacen'];
                ?>
</span></span></td>
      <td width="57" bgcolor="<?php 
                echo $color;
                ?>
" class="style12"><span class="style7"><?php 
                echo $myrow['tipoPaciente'];
                ?>
</span></td>
      <td width="79" bgcolor="<?php 
                echo $color;
                ?>
" class="style12"><?php 
                $totalAcumulado = new acumulados();
                $totalCargos[0] += $totalAcumulado->totalAcumuladoAseguradoraCxC($basedatos, $usuario, $numeroE, $nCuenta);
                echo "\$" . number_format($totalAcumulado->totalAcumuladoAseguradoraCxC($basedatos, $usuario, $numeroE, $nCuenta), 2);
                ?>
</td>
      <td width="73" bgcolor="<?php 
                echo $color;
                ?>
" class="style12">$0.00</td>
      <td width="37" bgcolor="<?php 
                echo $color;
                ?>
" class="style12"><div align="left"><span class=""> 
	  <a href="javascript:ventanaSecundaria2('<?php 
                echo $ventana;
                ?>
?codigo=<?php 
                echo $code;
                ?>
&amp;seguro=<?php 
                echo $_POST['seguro'];
                ?>
&amp;medico=<?php 
                echo $_POST['medico'];
                ?>
&amp;nt=<?php 
                echo $nT;
                ?>
')">
	   <img src="<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/imagenes/ver.jpg" alt="Consultar" width="12" height="12" border="0" />	   </a> 
	  </span></div></td>
    </tr>
    <?php 
            }
        }
        ?>
    <input name="menu" type="hidden" value="<?php 
        echo $menu;
        ?>
" />
  </table>






  <table width="637" border="0" align="center">
    <tr>
      <td width="101">&nbsp;</td>
      <td width="101">&nbsp;</td>
      <td width="101">&nbsp;</td>
      <td width="156">&nbsp;</td>
      <td width="77">&nbsp;</td>
      <td width="75">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td><div align="right"><span class="style12"><span class="style7">TOTAL(S/iva)</span></span></div></td>
      <td class="style7"><?php 
        echo "\$" . number_format($totalCargos[0], 2);
        ?>
&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
  <p>&nbsp;</p>
</form>
</body>
</html>


<?php 
    }
示例#5
0
 $convenioAseguradora->convenioAseguradora($basedatos, $usuario, $_GET['numeroE'], $_GET['nCuenta']);
 $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']);
                return false   
        }                     
		
		
}   
  
</script> 
<?php 
if ($_POST['secure']) {
    $_POST['dividirCuentas'] = 'si';
}
$convenioParticular = new acumulados();
$convenioAseguradora = new acumulados();
$cargosParticulares = new acumulados();
$cargosCortesia = new acumulados();
$dev = new acumulados();
if ($_GET['almacen']) {
    $almacenFuente = $_GET['almacen'];
} else {
    $almacenFuente = $_POST['almacenFuente'];
}
$TOTAL = $_GET['TOTAL'];
$iva = $_GET['iva'];
$numeroCuenta = $_GET['nCuenta'];
$descuento = $_GET['descuento'];
$depositos = $_GET['depositos'];
$devolucion = $_GET['cantidadRecibida'] - $TOTAL;
$sSQL3 = "Select * From clientesInternos WHERE keyClientesInternos = '" . $numeroCuenta . "'  ";
$result3 = mysql_db_query($basedatos, $sSQL3);
$myrow3 = mysql_fetch_array($result3);
if ($numeroCuenta) {
    public function eCuentaE($descripcionTransaccion, $mostrar, $usuario, $entidad, $almacen, $fecha1, $hora1, $dia, $usu, $nT, $basedatos)
    {
        $cargosCia = new acumulados();
        $sSQLCent = "Select * From entidades where codigoEntidad='" . $entidad . "'";
        $resultCent = mysql_db_query($basedatos, $sSQLCent);
        $myrowCent = mysql_fetch_array($resultCent);
        if ($myrowCent['rutaRecibo'] != NULL and $myrowCent['rutaReciboPaquete'] != NULL) {
            //**********************************CANDADO PRINCIPAL**********************
            $bali = $almacen;
            $agrega = "INSERT INTO logs (\r\ndescripcion,almacenSolicitante,almacenDestino,usuario,hora,fecha,entidad,folioVenta,cuartoIngreso,cuartoTransferido)\r\nvalues\r\n('ABRiO EL ESTADO DE CUENTA DE CAJA','" . $bali . "','" . $ALMACEN . "',\r\n'" . $usuario . "','" . $hora1 . "','" . $fecha1 . "','" . $entidad . "','" . $_GET['folioVenta'] . "',\r\n'','')";
            //mysql_db_query($basedatos,$agrega);
            echo mysql_error();
            $sSQLC = "Select * From statusCaja where entidad='" . $entidad . "' and usuario='" . $usuario . "' order by keySTC DESC ";
            $resultC = mysql_db_query($basedatos, $sSQLC);
            $myrowC = mysql_fetch_array($resultC);
            $sSQL1 = "Select usuario,folioVenta,keyT From transacciones WHERE entidad='" . $entidad . "' and folioVenta ='" . $_GET['folioVenta'] . "' ";
            $result1 = mysql_db_query($basedatos, $sSQL1);
            $myrow1 = mysql_fetch_array($result1);
            echo mysql_error();
            $sSQL1d = "Select * From clientesInternos WHERE entidad='" . $entidad . "' and folioVenta ='" . $_GET['folioVenta'] . "' ";
            $result1d = mysql_db_query($basedatos, $sSQL1d);
            $myrow1d = mysql_fetch_array($result1d);
            echo mysql_error();
            /*
            $sSQL1tv= "Select * From transacciones WHERE entidad='".$entidad."' and usuario ='".$usuario."' and status='standby' ";
            $result1tv=mysql_db_query($basedatos,$sSQL1tv);
            $myrow1tv = mysql_fetch_array($result1tv);
            echo mysql_error();
            if(($myrow1tv['folioVenta']!=NULL and $myrow1tv['folioVenta']!=$_GET['folioVenta']) and $myrow1d['tipoPaciente']=='externo'){//candado?>
                <script>
            window.alert("ERROR: PARA PODER CONTINUAR DEBES FINALIZAR LA TRANSACCION DEL FOLIO: <?php echo $myrow1tv['folioVenta'];?> y esta en la fecha <?php echo cambia_a_normal($myrow1tv['fecha']);?>");
            window.close();
            </script>
            
            <?php
            }
            */
            if ($myrow1d['tipoPaciente'] == 'externo' and $_POST['imprimir'] != NULL) {
                //***************C A S O 2 ******************
                if ($myrow1['folioVenta'] and $myrow1['usuario'] != $usuario) {
                    ?>
<script>
window.alert("Este proceso esta siendo utilizado por: (<?php 
                    echo $myrow1['usuario'];
                    ?>
) y solo el puede terminar este proceso");
window.close();
</script>
<?php 
                }
                //*******TRASPASO AL MODULO DE FACTURACION AUTOMATICO*******
                $sSQLef = "SELECT\r\n             *\r\n             FROM\r\n             cargosCuentaPaciente\r\n             WHERE \r\n             entidad='" . $entidad . "'\r\n             and\r\n             folioVenta='" . $_GET['folioVenta'] . "'\r\n             and\r\n             gpoProducto!=''\r\n             and \r\n             cantidadParticular>0\r\n             ";
                $resultef = mysql_db_query($basedatos, $sSQLef);
                $myrowef = mysql_fetch_array($resultef);
                if ($myrowef['cantidadParticular'] > 0) {
                    if ($myrow1d['statusDevolucion'] != 'si') {
                        //GENERO LA SOLICITUD
                        $sSQL8aa3 = "\r\nSELECT max(contador)+1 as n\r\nFROM\r\ncontadorFacturas\r\nWHERE\r\nentidad='" . $entidad . "'\r\n  ";
                        $result8aa3 = mysql_db_query($basedatos, $sSQL8aa3);
                        $myrow8aa3 = mysql_fetch_array($result8aa3);
                        $n = $myrow8aa3['n'];
                        if (!$n) {
                            $n = 1;
                        }
                        //asigno valor
                        $_GET['numSolicitud'] = $n;
                        $agrega = "INSERT INTO contadorFacturas (\r\nusuario,contador,entidad\r\n) values (\r\n'" . $usuario . "','" . $n . "','" . $entidad . "'\r\n)";
                        mysql_db_query($basedatos, $agrega);
                        echo mysql_error();
                        //ACTUALIZAR ENCABEZA
                        $actualiza = "UPDATE facturaGrupos\r\nset\r\nnumFactura='" . $_POST['numFactura'] . "'\r\n\r\nwhere\r\nentidad='" . $entidad . "'\r\n    and\r\nnumSolicitud='" . $_GET['numSolicitud'] . "'\r\n";
                        //mysql_db_query($basedatos,$actualiza);
                        echo mysql_error();
                        //CIERRA ACTUALIZA
                        $sSQL2 = "Select * From RFC WHERE RFC like '%{$rfc}%'   ";
                        $result2 = mysql_db_query($basedatos, $sSQL2);
                        $myrow2 = mysql_fetch_array($result2);
                        $sSQL2a = "Select * From datosfacturacion WHERE entidad='" . $entidad . "' and numSolicitud='" . $_GET['numSolicitud'] . "'  ";
                        $result2a = mysql_db_query($basedatos, $sSQL2a);
                        $myrow2a = mysql_fetch_array($result2a);
                        if (!$myrow2a['numSolicitud']) {
                            $sql0 = "INSERT INTO datosfacturacion\r\n(razonSocial,\r\n\t\tcalle,\r\n\t \tcolonia,\r\n\t \tciudad,\r\n\t \testado,\r\n\t \tcp,\r\n\t \tdelegacion,\r\n\t \tpais,\r\n\t \tentidad,\r\n\t \trfc,\r\n\t \tcalle1,\r\n\t \tnumFactura,numSolicitud\r\n                )\r\nvalues\r\n(\r\n'" . $myrow2['razonSocial'] . "',\r\n'" . $myrow2['calle'] . "','" . $myrow2['colonia'] . "',\r\n    '" . $myrow2['ciudad'] . "','" . $myrow2['estado'] . "',\r\n    '" . $myrow2['cp'] . "','" . $myrow2['delegacion'] . "',\r\n        '" . $myrow2['pais'] . "','" . $entidad . "','" . $myrow2['RFC'] . "',\r\n            '" . $myrow2['calle1'] . "','" . $_POST['numFactura'] . "','" . $_GET['numSolicitud'] . "')\r\n\r\n";
                            mysql_db_query($basedatos, $sql0);
                            echo mysql_error();
                        }
                        $_POST['flag1'] = 1;
                        $sSQL = "SELECT\r\n             *\r\n             FROM\r\n             cargosCuentaPaciente\r\n             WHERE \r\n             entidad='" . $entidad . "'\r\n             and\r\n             folioVenta='" . $_GET['folioVenta'] . "'\r\n             and\r\n             gpoProducto!=''\r\n             \r\n             ";
                        $result = mysql_db_query($basedatos, $sSQL);
                        while ($myrow = mysql_fetch_array($result)) {
                            $sql5da = "\r\nSELECT *\r\nFROM\r\nfacturasAplicadas\r\nWHERE\r\nentidad='" . $entidad . "'\r\n    and\r\nfolioVenta='" . $_GET['folioVenta'] . "' \r\nand\r\nnumSolicitud='" . $_GET['numSolicitud'] . "'\r\n    and\r\n    keyCAP='" . $myrow['keyCAP'] . "'\r\n\r\n";
                            $result5da = mysql_db_query($basedatos, $sql5da);
                            $myrow5da = mysql_fetch_array($result5da);
                            $agrega = "INSERT INTO facturasAplicadas (\r\nnumSolicitud,folioVenta,cantidad,\r\nimporte,iva,gpoProducto,descripcionArticulo,\r\ndescripcionGrupo,entidad,status,fecha,hora,numFactura,\r\ncodigo,naturaleza,keyCAP,usuario\r\n\r\n)\r\nvalues \r\n(\r\n\r\n'" . $_GET['numSolicitud'] . "','" . $_GET['folioVenta'] . "','" . $myrow['cantidad'] . "',\r\n'" . $myrow['cantidadParticular'] . "','" . $myrow['ivaParticular'] . "','" . $myrow['gpoProducto'] . "',\r\n    '" . $myrow['descripcionArticulo'] . "','" . $myrow['descripcionGrupoProducto'] . "',\r\n        '" . $entidad . "','request','" . $fecha1 . "','" . $hora1 . "','',\r\n            '" . $myrow['codProcedimiento'] . "','" . $myrow['naturaleza'] . "',\r\n                '" . $myrow['keyCAP'] . "','" . $usuario . "'\r\n        \r\n)";
                            mysql_db_query($basedatos, $agrega);
                            echo mysql_error();
                            $tipoMensaje = 'registrosAgregados';
                            $encabezado = 'Exitoso';
                            $texto = 'Se agregaron Folios de Venta';
                        }
                        //cierra while
                        //TERMINA DE AGREGAR A FACTURAS APLICADAS
                        $sSQLab = "SELECT * FROM entidades where codigoEntidad='" . $entidad . "' ";
                        $resultab = mysql_db_query($basedatos, $sSQLab);
                        $myrowab = mysql_fetch_array($resultab);
                        if ($myrowab['digitosFactura'] > 0) {
                            $sSQLaa = "SELECT contador from contadorSeriesFacturas where \r\n    entidad='" . $entidad . "'\r\n    and    \r\n    numSolicitud='" . $_GET['numSolicitud'] . "'   and tipoFactura='efectivo' ";
                            $resultaa = mysql_db_query($basedatos, $sSQLaa);
                            $myrowaa = mysql_fetch_array($resultaa);
                            if (!$myrowaa['contador']) {
                                //GENERAR FACTURA
                                $q4 = "\r\n\r\n    INSERT INTO contadorSeriesFacturas(contador, usuario,entidad,numSolicitud,tipoFactura)\r\n    SELECT(IFNULL((SELECT MAX(contador)+1 from contadorSeriesFacturas where entidad='" . $entidad . "'), 1)), '" . $usuario . "','" . $entidad . "','" . $_GET['numSolicitud'] . "','efectivo'\r\n\r\n    ";
                                mysql_db_query($basedatos, $q4);
                                echo mysql_error();
                                $sSQLac = "SELECT contador as topeMaximo from contadorSeriesFacturas where \r\n    entidad='" . $entidad . "'\r\n    and    \r\n    numSolicitud='" . $_GET['numSolicitud'] . "' and tipoFactura='efectivo'   ";
                                $resultac = mysql_db_query($basedatos, $sSQLac);
                                $myrowac = mysql_fetch_array($resultac);
                                //echo $myrowac['topeMaximo'];
                                //echo '<br>';
                                $digitos = strlen($myrowac['topeMaximo']);
                                $totalDigitos = $myrowab['digitosFactura'] - $digitos;
                                $totalDigitos = '%0' . $totalDigitos . 's';
                                $digtosCompilados = sprintf($totalDigitos, $var);
                                $numFactura = $myrowab['prefijoEfectivo'] . $digtosCompilados . $myrowac['topeMaximo'];
                                $actualiza = "UPDATE facturaGrupos\r\nset\r\nstatus='facturado',numFactura='" . $numFactura . "'\r\n\r\nwhere\r\nentidad='" . $entidad . "'\r\n    and\r\nnumSolicitud='" . $_GET['numSolicitud'] . "'\r\n";
                                mysql_db_query($basedatos, $actualiza);
                                echo mysql_error();
                                $actualiza1 = "UPDATE facturasAplicadas\r\nset\r\nstatus='facturado',numFactura='" . $numFactura . "'\r\n\r\nwhere\r\nentidad='" . $entidad . "'\r\n    and\r\nnumSolicitud='" . $_GET['numSolicitud'] . "'\r\n";
                                mysql_db_query($basedatos, $actualiza1);
                                echo mysql_error();
                                $actualiza2 = "UPDATE datosfacturacion\r\nset\r\n\r\nnumFactura='" . $numFactura . "'\r\n\r\nwhere\r\nentidad='" . $entidad . "'\r\n    and\r\nnumSolicitud='" . $_GET['numSolicitud'] . "'\r\n";
                                mysql_db_query($basedatos, $actualiza2);
                                echo mysql_error();
                                //echo '<script>';
                                //echo 'window.alert("SE GENERO LA FACTURA: '.$numFactura.'");';
                                //echo '</script>';
                                $tipoMensaje = 'registrosAgregados';
                                $encabezado = 'Exitoso';
                                $texto = 'FOLIO(s) FACTURADOS..';
                                //****GENERAR TICKET******
                                $qTi = "\r\n\r\n    INSERT INTO contadorTicket(contador, usuario,entidad,keyClientesInternos)\r\n    SELECT(IFNULL((SELECT MAX(contador)+1 from contadorTicket where entidad='" . $entidad . "'), 1)), '" . $usuario . "','" . $entidad . "','" . $myrow1d['keyClientesInternos'] . "'\r\n\r\n    ";
                                mysql_db_query($basedatos, $qTi);
                                echo mysql_error();
                                //************************
                                $sSQLT = "SELECT contador as topeMaximo from contadorTicket where entidad='" . $entidad . "' and usuario='" . $usuario . "'order by keyCExt DESC   ";
                                $resultT = mysql_db_query($basedatos, $sSQLT);
                                $myrowT = mysql_fetch_array($resultT);
                                $ticket = $myrowT['topeMaximo'];
                                $tipoFacturacion = 'Auto';
                                require CONSTANT_PATH_CONFIGURACION . "/clases/generarFacturaElectronica.php";
                            } else {
                                echo '<script>window.alert("YA SE GENERO LA FACTURA!");</script>';
                            }
                        } else {
                            echo '<script>window.alert("FAVOR  DE CONFIGURAR LA ENTIDAD PARA FACTURAR CORRECTAMENTE!");</script>';
                        }
                    }
                    //solo entra aqui si no es devolucion
                }
                //solo entra aqui si trae cantidad particular
                //*******CIERRA MODULO DE FACTURACION********
                $actualiza1 = "update faltantes\r\nset\r\nstatus='venta'\r\n\r\nWHERE entidad='" . $entidad . "'\r\nand\r\nkeyClientesInternos='" . $nT . "'\r\nand\r\ngpoProducto!=''\r\n";
                mysql_db_query($basedatos, $actualiza1);
                echo mysql_error();
                $agrega4 = "\r\n    \r\nUPDATE clientesInternos set\r\nnumeroFactura='" . $numFactura . "',\r\nticket='" . $ticket . "',    \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();
                $agrega = "UPDATE cargosCuentaPaciente set \r\nstatusCuenta='cerrada',statusCaja='pagado',fechaCierre='" . $fecha1 . "',fecha1='" . $fecha1 . "'\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "' ";
                mysql_db_query($basedatos, $agrega);
                echo mysql_error();
                $sSQLCaR = "Select numRecibo,codigoCaja From cargosCuentaPaciente where entidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "' \r\nand\r\ntipoTransaccion!=''\r\nand\r\nnumRecibo>0\r\n";
                $resultCaR = mysql_db_query($basedatos, $sSQLCaR);
                $myrowCaR = mysql_fetch_array($resultCaR);
                $agregado = "UPDATE cargosCuentaPaciente set \r\n    numRecibo='" . $myrowCaR['numRecibo'] . "',codigoCaja='" . $myrowCaR['codigoCaja'] . "'\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "'\r\n    and tipoTransaccion!=''\r\n    and\r\n    numRecibo=''\r\n";
                mysql_db_query($basedatos, $agregado);
                echo mysql_error();
                //*********************************************
                //************CASO 1 **********************
                $sSQL1t = "Select status,usuario,folioVenta From transacciones WHERE entidad='" . $entidad . "' and usuario='" . $usuario . "'  order by keyT DESC ";
                $result1t = mysql_db_query($basedatos, $sSQL1t);
                $myrow1t = mysql_fetch_array($result1t);
                echo mysql_error();
                //echo $_GET['folioVenta'];
                //echo $myrow1t['status'].' '.$myrow1t['folioVenta'];
                if ($myrow1t['status'] == 'standby' and $myrow1t['folioVenta'] != $_GET['folioVenta']) {
                    //echo "Debes terminar de  completar la transaccion: ".$myrow1t['folioVenta'];
                    ?>
<script>
window.alert("Estimado: <?php 
                    echo $myrow1t['usuario'];
                    ?>
, debes de completar la transaccion del folio: <?php 
                    echo $myrow1t['folioVenta'];
                    ?>
 ");
window.close();
</script>
<?php 
                }
            }
            //solo externos
            //************************************CANDADO DE USUARIO*****************************************
            ?>






<?php 
            if ($_POST['cerrar']) {
                $particular = $_POST['particular'];
                $aseguradora = $_POST['aseguradora'];
                //*******TRASPASO AL MODULO DE FACTURACION AUTOMATICO*******
                $sSQLef = "SELECT\r\n             *\r\n             FROM\r\n             cargosCuentaPaciente\r\n             WHERE \r\n             entidad='" . $entidad . "'\r\n             and\r\n             folioVenta='" . $_GET['folioVenta'] . "'\r\n             and\r\n             gpoProducto!=''\r\n             and \r\n             cantidadParticular>0\r\n             ";
                $resultef = mysql_db_query($basedatos, $sSQLef);
                $myrowef = mysql_fetch_array($resultef);
                if ($myrowef['cantidadParticular'] > 0) {
                    //solamente entra si tiene cantidad particular
                    if ($myrow1d['statusDevolucion'] != 'si') {
                        //GENERO LA SOLICITUD
                        $sSQL8aa3 = "\r\nSELECT max(contador)+1 as n\r\nFROM\r\ncontadorFacturas\r\nWHERE\r\nentidad='" . $entidad . "'\r\n  ";
                        $result8aa3 = mysql_db_query($basedatos, $sSQL8aa3);
                        $myrow8aa3 = mysql_fetch_array($result8aa3);
                        $n = $myrow8aa3['n'];
                        if (!$n) {
                            $n = 1;
                        }
                        //asigno valor
                        $_GET['numSolicitud'] = $n;
                        $agrega = "INSERT INTO contadorFacturas (\r\nusuario,contador,entidad\r\n) values (\r\n'" . $usuario . "','" . $n . "','" . $entidad . "'\r\n)";
                        mysql_db_query($basedatos, $agrega);
                        echo mysql_error();
                        //ACTUALIZAR ENCABEZA
                        $actualiza = "UPDATE facturaGrupos\r\nset\r\nnumFactura='" . $_POST['numFactura'] . "'\r\n\r\nwhere\r\nentidad='" . $entidad . "'\r\n    and\r\nnumSolicitud='" . $_GET['numSolicitud'] . "'\r\n";
                        //mysql_db_query($basedatos,$actualiza);
                        echo mysql_error();
                        //CIERRA ACTUALIZA
                        $sSQL2 = "Select * From RFC WHERE RFC like '%{$rfc}%'   ";
                        $result2 = mysql_db_query($basedatos, $sSQL2);
                        $myrow2 = mysql_fetch_array($result2);
                        $sSQL2a = "Select * From datosfacturacion WHERE entidad='" . $entidad . "' and numSolicitud='" . $_GET['numSolicitud'] . "'  ";
                        $result2a = mysql_db_query($basedatos, $sSQL2a);
                        $myrow2a = mysql_fetch_array($result2a);
                        if (!$myrow2a['numSolicitud']) {
                            $sql0 = "INSERT INTO datosfacturacion\r\n(razonSocial,\r\n\t\tcalle,\r\n\t \tcolonia,\r\n\t \tciudad,\r\n\t \testado,\r\n\t \tcp,\r\n\t \tdelegacion,\r\n\t \tpais,\r\n\t \tentidad,\r\n\t \trfc,\r\n\t \tcalle1,\r\n\t \tnumFactura,numSolicitud\r\n                )\r\nvalues\r\n(\r\n'" . $myrow2['razonSocial'] . "',\r\n'" . $myrow2['calle'] . "','" . $myrow2['colonia'] . "',\r\n    '" . $myrow2['ciudad'] . "','" . $myrow2['estado'] . "',\r\n    '" . $myrow2['cp'] . "','" . $myrow2['delegacion'] . "',\r\n        '" . $myrow2['pais'] . "','" . $entidad . "','" . $myrow2['RFC'] . "',\r\n            '" . $myrow2['calle1'] . "','" . $_POST['numFactura'] . "','" . $_GET['numSolicitud'] . "')\r\n\r\n";
                            mysql_db_query($basedatos, $sql0);
                            echo mysql_error();
                        }
                        $_POST['flag1'] = 1;
                        $sSQL = "SELECT\r\n             *\r\n             FROM\r\n             cargosCuentaPaciente\r\n             WHERE \r\n             entidad='" . $entidad . "'\r\n             and\r\n             folioVenta='" . $_GET['folioVenta'] . "'\r\n             and\r\n             gpoProducto!=''\r\n             \r\n             ";
                        $result = mysql_db_query($basedatos, $sSQL);
                        while ($myrow = mysql_fetch_array($result)) {
                            $sql5da = "\r\nSELECT *\r\nFROM\r\nfacturasAplicadas\r\nWHERE\r\nentidad='" . $entidad . "'\r\n    and\r\nfolioVenta='" . $_GET['folioVenta'] . "' \r\nand\r\nnumSolicitud='" . $_GET['numSolicitud'] . "'\r\n    and\r\n    keyCAP='" . $myrow['keyCAP'] . "'\r\n\r\n";
                            $result5da = mysql_db_query($basedatos, $sql5da);
                            $myrow5da = mysql_fetch_array($result5da);
                            $agrega = "INSERT INTO facturasAplicadas (\r\nnumSolicitud,folioVenta,cantidad,\r\nimporte,iva,gpoProducto,descripcionArticulo,\r\ndescripcionGrupo,entidad,status,fecha,hora,numFactura,\r\ncodigo,naturaleza,keyCAP,usuario\r\n\r\n)\r\nvalues \r\n(\r\n\r\n'" . $_GET['numSolicitud'] . "','" . $_GET['folioVenta'] . "','" . $myrow['cantidad'] . "',\r\n'" . $myrow['cantidadParticular'] . "','" . $myrow['ivaParticular'] . "','" . $myrow['gpoProducto'] . "',\r\n    '" . $myrow['descripcionArticulo'] . "','" . $myrow['descripcionGrupoProducto'] . "',\r\n        '" . $entidad . "','request','" . $fecha1 . "','" . $hora1 . "','',\r\n            '" . $myrow['codProcedimiento'] . "','" . $myrow['naturaleza'] . "',\r\n                '" . $myrow['keyCAP'] . "','" . $usuario . "'\r\n        \r\n)";
                            mysql_db_query($basedatos, $agrega);
                            echo mysql_error();
                            $tipoMensaje = 'registrosAgregados';
                            $encabezado = 'Exitoso';
                            $texto = 'Se agregaron Folios de Venta';
                        }
                        //cierra while
                        //TERMINA DE AGREGAR A FACTURAS APLICADAS
                        $sSQLab = "SELECT * FROM entidades where codigoEntidad='" . $entidad . "' ";
                        $resultab = mysql_db_query($basedatos, $sSQLab);
                        $myrowab = mysql_fetch_array($resultab);
                        if ($myrowab['digitosFactura'] > 0) {
                            $sSQLaa = "SELECT contador from contadorSeriesFacturas where \r\n    entidad='" . $entidad . "'\r\n    and    \r\n    numSolicitud='" . $_GET['numSolicitud'] . "'   and tipoFactura='efectivo' ";
                            $resultaa = mysql_db_query($basedatos, $sSQLaa);
                            $myrowaa = mysql_fetch_array($resultaa);
                            if (!$myrowaa['contador']) {
                                //GENERAR FACTURA
                                $q4 = "\r\n\r\n    INSERT INTO contadorSeriesFacturas(contador, usuario,entidad,numSolicitud,tipoFactura)\r\n    SELECT(IFNULL((SELECT MAX(contador)+1 from contadorSeriesFacturas where entidad='" . $entidad . "'), 1)), '" . $usuario . "','" . $entidad . "','" . $_GET['numSolicitud'] . "','efectivo'\r\n\r\n    ";
                                mysql_db_query($basedatos, $q4);
                                echo mysql_error();
                                $sSQLac = "SELECT contador as topeMaximo from contadorSeriesFacturas where \r\n    entidad='" . $entidad . "'\r\n    and    \r\n    numSolicitud='" . $_GET['numSolicitud'] . "' and tipoFactura='efectivo'   ";
                                $resultac = mysql_db_query($basedatos, $sSQLac);
                                $myrowac = mysql_fetch_array($resultac);
                                //echo $myrowac['topeMaximo'];
                                //echo '<br>';
                                $digitos = strlen($myrowac['topeMaximo']);
                                $totalDigitos = $myrowab['digitosFactura'] - $digitos;
                                $totalDigitos = '%0' . $totalDigitos . 's';
                                $digtosCompilados = sprintf($totalDigitos, $var);
                                $numFactura = $myrowab['prefijoEfectivo'] . $digtosCompilados . $myrowac['topeMaximo'];
                                $actualiza = "UPDATE facturaGrupos\r\nset\r\nstatus='facturado',numFactura='" . $numFactura . "'\r\n\r\nwhere\r\nentidad='" . $entidad . "'\r\n    and\r\nnumSolicitud='" . $_GET['numSolicitud'] . "'\r\n";
                                mysql_db_query($basedatos, $actualiza);
                                echo mysql_error();
                                $actualiza1 = "UPDATE facturasAplicadas\r\nset\r\nstatus='facturado',numFactura='" . $numFactura . "'\r\n\r\nwhere\r\nentidad='" . $entidad . "'\r\n    and\r\nnumSolicitud='" . $_GET['numSolicitud'] . "'\r\n";
                                mysql_db_query($basedatos, $actualiza1);
                                echo mysql_error();
                                $actualiza2 = "UPDATE datosfacturacion\r\nset\r\n\r\nnumFactura='" . $numFactura . "'\r\n\r\nwhere\r\nentidad='" . $entidad . "'\r\n    and\r\nnumSolicitud='" . $_GET['numSolicitud'] . "'\r\n";
                                mysql_db_query($basedatos, $actualiza2);
                                echo mysql_error();
                                //echo '<script>';
                                //echo 'window.alert("SE GENERO LA FACTURA: '.$numFactura.'");';
                                //echo '</script>';
                                $tipoMensaje = 'registrosAgregados';
                                $encabezado = 'Exitoso';
                                $texto = 'FOLIO(s) FACTURADOS..';
                                //****GENERAR TICKET******
                                $qTi = "\r\n\r\n    INSERT INTO contadorTicket(contador, usuario,entidad,keyClientesInternos)\r\n    SELECT(IFNULL((SELECT MAX(contador)+1 from contadorTicket where entidad='" . $entidad . "'), 1)), '" . $usuario . "','" . $entidad . "','" . $myrow1d['keyClientesInternos'] . "'\r\n\r\n    ";
                                mysql_db_query($basedatos, $qTi);
                                echo mysql_error();
                                //************************
                                $sSQLT = "SELECT contador as topeMaximo from contadorTicket where entidad='" . $entidad . "' and usuario='" . $usuario . "'order by keyCExt DESC   ";
                                $resultT = mysql_db_query($basedatos, $sSQLT);
                                $myrowT = mysql_fetch_array($resultT);
                                $ticket = $myrowT['topeMaximo'];
                                $tipoFacturacion = 'Auto';
                                require CONSTANT_PATH_CONFIGURACION . "/clases/generarFacturaElectronica.php";
                            } else {
                                echo '<script>window.alert("YA SE GENERO LA FACTURA!");</script>';
                            }
                        } else {
                            echo '<script>window.alert("FAVOR  DE CONFIGURAR LA ENTIDAD PARA FACTURAR CORRECTAMENTE!");</script>';
                        }
                    }
                    //solo entra aqui si no es devolucion
                }
                //solo entra aqui si trae cantidad particular
                //*******CIERRA MODULO DE FACTURACION********
                if ($myrow1d['tipoPaciente'] == 'externo') {
                    $agregado = "UPDATE cargosCuentaPaciente set \r\n    numRecibo='" . $myrow1d['numRecibo'] . "',codigoCaja='" . $myrow1d['codigoCaja'] . "',numCorte='" . $myrow1d['numCorte'] . "'\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "'\r\n    and\r\n    gpoProducto=''\r\n    and\r\n    numRecibo=''\r\n";
                    //mysql_db_query($basedatos,$agregado);
                    echo mysql_error();
                }
                $q = "UPDATE antibioticos set\r\nstatus='pagado'\r\n\r\nWHERE\r\nentidad='" . $entidad . "'\r\n    and\r\nkeyClientesInternos='" . trim($_GET['nT']) . "'\r\n";
                mysql_db_query($basedatos, $q);
                echo mysql_error();
                //cierro cuenta
                $agrega4 = "UPDATE clientesInternos set\r\nticket='" . $ticket . "',\r\n    numSolicitud='" . $_GET['numSolicitud'] . "',\r\nstatusEstudio='cargado',    \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();
                $agrega4a = "UPDATE cargosCuentaPaciente set\r\ntipoCuenta='H',\r\nstatus='cerrada',\r\nstatusCuenta='cerrada',\r\n\r\nfechaCierre='" . $fecha1 . "',\r\n\r\nstatusCaja='pagado'\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "' ";
                mysql_db_query($basedatos, $agrega4a);
                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\nentidad='" . $entidad . "'\r\nand\r\ncodigoCuarto='" . $myrow3['cuarto'] . "' \r\n";
                    //mysql_db_query($basedatos,$agregad);
                    echo mysql_error();
                }
                $leyenda = 'Cuenta Cerrada!';
                $sSQL3 = "Select * From clientesInternos WHERE entidad='" . $entidad . "'  and folioVenta = '" . $_GET['folioVenta'] . "'\r\n  ";
                $result3 = mysql_db_query($basedatos, $sSQL3);
                $myrow3 = mysql_fetch_array($result3);
                $agrega5 = "UPDATE porcentajeBeneficencias set\r\nstatus='cargado'\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nnumeroE='" . $myrow3['numeroE'] . "'\r\nand\r\nstatus='standby'\r\nand\r\ndepartamento='" . $myrow3['almacen'] . "'\r\n";
                mysql_db_query($basedatos, $agrega5);
                echo mysql_error();
                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 
                }
            }
            ?>



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



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

<script>

var win = null;
function nueva(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
if(win.window.focus){win.window.focus();}
}

</script>








<?php 
            //************************ACTUALIZO **********************
            //Llenado de datos
            $sSQL3 = "Select * From clientesInternos WHERE \r\n\r\nkeyClientesInternos = '" . $_GET['nT'] . "'  ";
            $result3 = mysql_db_query($basedatos, $sSQL3);
            $myrow3 = mysql_fetch_array($result3);
            $numeroE = $myrow3['numeroE'];
            $nCuenta = $myrow3['nCuenta'];
            $cuarto = $myrow3['cuarto'];
            $seguroT = ltrim($myrow3['seguro']);
            //***************aplicar pago**********************
            ?>



<?php 
            $sSQL3ae = "\r\n\tSELECT \r\nimprimeTicket\r\nFROM\r\nalmacenes\r\nwhere\r\nentidad='" . $entidad . "'\r\n    and\r\nalmacen='" . $_GET['almacenSolicitante'] . "'\r\n\r\n";
            $result3ae = mysql_db_query($basedatos, $sSQL3ae);
            $myrow3ae = mysql_fetch_array($result3ae);
            ?>




<?php 
            if ($_POST['imprimir']) {
                //********************verificar diferencia de centavos*************
                $diferencia = number_format($_POST['totalAbono'] - $_POST['totalCargo'], 2);
                if ($diferencia > 0) {
                    $sSQL3c = "Select keyCAP,cantidadParticular,cantidadAseguradora,ivaParticular,ivaAseguradora From cargosCuentaPaciente WHERE \r\nentidad='" . $entidad . "' and folioVenta = '" . $_GET['folioVenta'] . "' \r\nand\r\ngpoProducto=''\r\nand\r\nnaturaleza='A' order by keyCAP DESC\r\n\r\n ";
                    $result3c = mysql_db_query($basedatos, $sSQL3c);
                    $myrow3c = mysql_fetch_array($result3c);
                    if ($myrow3c['cantidadParticular'] > 0) {
                        $agrega4 = "UPDATE cargosCuentaPaciente set \r\ncantidadParticular=cantidadParticular-'" . $diferencia . "',\r\nprecioVenta=cantidadParticular+cantidadAseguradora\r\nwhere\r\nkeyCAP='" . $myrow3c['keyCAP'] . "' ";
                        mysql_db_query($basedatos, $agrega4);
                        echo mysql_error();
                    } else {
                        if ($myrow3c['cantidadAseguradora'] > 0) {
                            $agrega4 = "UPDATE cargosCuentaPaciente set \r\ncantidadAseguradora=cantidadAseguradora-'" . $diferencia . "',\r\nprecioVenta=cantidadParticular+cantidadAseguradora\r\nwhere\r\nkeyCAP='" . $myrow3c['keyCAP'] . "'  ";
                            mysql_db_query($basedatos, $agrega4);
                            echo mysql_error();
                        }
                    }
                }
                //*******************************************
                //********************TODOS SUS MOVIMIENTOS DEBEN ESTAR PAGADOS***********************
                $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();
                if ($myrow3['tipoPaciente'] == 'externo') {
                    $qd = "UPDATE transacciones\r\nset\r\nstatus='done'\r\nwhere\r\n\r\nstatus='standby'\r\nand\r\nusuario='" . $usuario . "' \r\n ";
                    mysql_db_query($basedatos, $qd);
                    echo mysql_error();
                    $sSQL1d = "Select * From clientesInternos WHERE entidad='" . $entidad . "' and folioVenta ='" . $_GET['folioVenta'] . "' ";
                    $result1d = mysql_db_query($basedatos, $sSQL1d);
                    $myrow1d = mysql_fetch_array($result1d);
                    echo mysql_error();
                    #SI NO TIENE EL RECIBO HAY QUE PONERSELO EN CASO DE CORTESIAS
                    if (!$myrow1d['numRecibo']) {
                        $sSQLC = "Select * From statusCaja where entidad='" . $entidad . "' and usuario='" . $usuario . "' order by keySTC DESC ";
                        $resultC = mysql_db_query($basedatos, $sSQLC);
                        $myrowC = mysql_fetch_array($resultC);
                        $q = "UPDATE statusCaja set\r\nnumRecibo= numRecibo+1\r\nwhere\r\n\r\nkeySTC='" . $myrowC['keySTC'] . "'\r\n ";
                        mysql_db_query($basedatos, $q);
                        echo mysql_error();
                        //***********************ASIGNARA NUMERO DE RECIBO
                        $sSQLCa = "Select numRecibo From statusCaja where keySTC='" . $myrowC['keySTC'] . "'";
                        $resultCa = mysql_db_query($basedatos, $sSQLCa);
                        $myrowCa = mysql_fetch_array($resultCa);
                        $RECIBO = $myrowCa['numRecibo'];
                        $numCorte = $myrowC['numCorte'];
                        $q4 = "UPDATE clientesInternos set numRecibo='" . $RECIBO . "',numCorte='" . $numCorte . "',codigoCaja='" . $myrowC['keyCatC'] . "',\r\nautoriza='" . $usuario . "',statusOtros='standby',responsableCuenta='" . $_GET['responsableCuenta'] . "',\r\nfechaVencimiento='" . $_GET['fechaVencimiento'] . "',\r\nstatusDeposito='pagado',usuario='" . $usuario . "',fecha1='" . $fecha1 . "'\r\nWHERE entidad='" . $entidad . "' and folioVenta='" . $_GET['folioVenta'] . "'";
                        mysql_db_query($basedatos, $q4);
                        echo mysql_error();
                        $agregado = "UPDATE cargosCuentaPaciente set \r\n    numRecibo='" . $RECIBO . "',codigoCaja='" . $myrowC['keyCatC'] . "',numCorte='" . $numCorte . "'\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "'\r\n    and\r\n    gpoProducto=''\r\n    and\r\n    numRecibo=''\r\n";
                        mysql_db_query($basedatos, $agregado);
                        echo mysql_error();
                    }
                }
                //**************************cierro
                if ($_GET['paquete'] == 'si') {
                    ?>
<script language="javascript">
nueva('<?php 
                    echo $myrowCent['rutaReciboPaquetes'];
                    ?>
?numeroE=<?php 
                    echo $myrow3['numeroE'];
                    ?>
&nCuenta=<?php 
                    echo $myrow3['nCuenta'];
                    ?>
&keyClientesInternos=<?php 
                    echo $myrow3['keyClientesInternos'];
                    ?>
&paciente=<?php 
                    echo $_POST['paciente'];
                    ?>
&numeroConfirmacion=<?php 
                    echo $numeroConfirmacion;
                    ?>
&hora1=<?php 
                    echo $hora1;
                    ?>
&cajero=<?php 
                    echo $usuario;
                    ?>
&codigoPaquete=<?php 
                    echo $myrow3['codigoPaquete'];
                    ?>
&numRecibo=<?php 
                    echo $myrowC['numRecibo'];
                    ?>
&paciente=<?php 
                    echo $_POST['paciente'];
                    ?>
&cantidadRecibida=<?php 
                    echo $_POST['cantidadRecibida'];
                    ?>
&folioVenta=<?php 
                    echo $myrow3['folioVenta'];
                    ?>
&fechaSolicitud=<?php 
                    print $_POST['variable_php'];
                    ?>
','ventana7','800','600','yes');
window.opener.document.form10["form10"].submit();
//window.alert("sandra");
window.close();
</script>
<?php 
                } else {
                    ?>







<?php 
                    if ($myrow3ae['imprimeTicket'] == 'si') {
                        ?>
<script>
nueva('imprimeTicket.php?numeroE=<?php 
                        echo $numeroE;
                        ?>
&nCuenta=<?php 
                        echo $nCuenta;
                        ?>
&keyClientesInternos=<?php 
                        echo $nT;
                        ?>
&paciente=<?php 
                        echo $_POST['paciente'];
                        ?>
&numeroConfirmacion=<?php 
                        echo $numeroConfirmacion;
                        ?>
&hora1=<?php 
                        echo $hora1;
                        ?>
&cajero=<?php 
                        echo $usuario;
                        ?>
&fechaSolicitud=<?php 
                        print $_POST['variable_php'];
                        ?>
&folioVenta=<?php 
                        echo $myrow3['folioVenta'];
                        ?>
&entidad=<?php 
                        echo $entidad;
                        ?>
','ventana7','800','600','yes');
window.opener.document.form10["form"].submit();
	
window.close();
</script>
    <?php 
                    } else {
                        ?>
<script>
nueva('<?php 
                        echo $myrowCent['rutaRecibo'];
                        ?>
?numeroE=<?php 
                        echo $numeroE;
                        ?>
&nCuenta=<?php 
                        echo $nCuenta;
                        ?>
&keyClientesInternos=<?php 
                        echo $nT;
                        ?>
&paciente=<?php 
                        echo $_POST['paciente'];
                        ?>
&numeroConfirmacion=<?php 
                        echo $numeroConfirmacion;
                        ?>
&hora1=<?php 
                        echo $hora1;
                        ?>
&cajero=<?php 
                        echo $usuario;
                        ?>
&fechaSolicitud=<?php 
                        print $_POST['variable_php'];
                        ?>
&folioVenta=<?php 
                        echo $myrow3['folioVenta'];
                        ?>
&entidad=<?php 
                        echo $entidad;
                        ?>
','ventana7','800','600','yes');
window.opener.document.form10["form"].submit();
	
window.close();
</script>


<?php 
                    }
                    ?>
    
    
    <?php 
                }
                ?>

<?php 
            }
            ?>









<?php 
            $sSQL3 = "Select * From clientesInternos WHERE entidad='" . $entidad . "' and 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...";
                $agrega5 = "UPDATE porcentajeBeneficencias set\r\nstatus='cargado'\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nnumeroE='" . $myrow3['numeroE'] . "'\r\nand\r\nstatus='standby'\r\nand\r\ndepartamento='" . $myrow3['almacen'] . "'\r\n";
                mysql_db_query($basedatos, $agrega5);
                echo mysql_error();
                ?>


<input name="print" type="button" class="normal" id="print" value="Imprimir EC" onClick="nueva('<?php 
                echo $myrowCent['rutaRecibo'];
                ?>
?numeroE=<?php 
                echo $numeroE;
                ?>
&nCuenta=<?php 
                echo $nCuenta;
                ?>
&keyClientesInternos=<?php 
                echo $nT;
                ?>
&paciente=<?php 
                echo $_POST['paciente'];
                ?>
&numeroConfirmacion=<?php 
                echo $numeroConfirmacion;
                ?>
&hora1=<?php 
                echo $hora1;
                ?>
&cajero=<?php 
                echo $usuario;
                ?>
&fechaSolicitud=<?php 
                print $_POST['variable_php'];
                ?>
&folioVenta=<?php 
                echo $myrow3['folioVenta'];
                ?>
&entidad=<?php 
                echo $entidad;
                ?>
','ventana7','800','600','yes');">

 
   
   <?php 
            } else {
                ?>



<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventanaSecundaria","width=800,height=600,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</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">
    <html>
<head>

</head>


<title></title>
<?php 
                $link = new ventanasPrototype();
                $link->links();
                $estilo = new muestraEstilos();
                $estilo->styles();
                ?>
  <style type="text/css">
    .popup_effect1 {
      background:#11455A;
      opacity: 0.2;
    }
    .popup_effect2 {
      background:#FF0041;
      border: 3px dashed #000;
    }
    
  </style>	
  
  <script languaje="JavaScript">
            
var reloj=new Date(); 

          varjs=  reloj.getHours()+":"+reloj.getMinutes(); 

</script>



<form id="form1" name="form1" method="post" >
    <?php 
                //require('/configuracion/clases/encabezado.php');
                //ABRE ENCABEZADO
                ?>

<?php 
                if (!$folioVenta) {
                    $folioVenta = $_GET['folioVenta'];
                }
                ?>

<?php 
                $link = new ventanasPrototype();
                $link->links();
                $estilo = new muestraEstilos();
                $estilo->styles();
                ?>
	
  
  <script languaje="JavaScript">
            
var reloj=new Date(); 

          varjs=  reloj.getHours()+":"+reloj.getMinutes(); 

</script>



<form id="form1" name="form1" method="post" action="#">
<?php 
                $sSQL = "SELECT *\r\nFROM\r\nclientesInternos \r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $folioVenta . "'\r\n\r\n ";
                $result = mysql_db_query($basedatos, $sSQL);
                $myrow = mysql_fetch_array($result);
                $entidad = $myrow['entidad'];
                $mmt = $myrow['credencial'];
                $keyClientesInternos = $myrow['keyClientesInternos'];
                $folioVENTA = $myrow['folioVenta'];
                $tipoPACIENTE = $myrow['tipoPaciente'];
                $limiteSEGURO = $myrow['limiteSeguro'];
                $SEGURO = $myrow['seguro'];
                ?>

<h1>ESTADO DE CUENTA</h1>
  <table width="993" style="border: 1px solid #CCC;">

    <tr >
      <td width="124" align="left" ><b>FOLIO N&deg;</b></td>
      <td width="655" align="center" > <b>PACIENTE: <span class="titulomedio"><?php 
                echo $myrow['paciente'];
                ?>
</span></b></td>
      <td width="200" align="left" ><b>DEPTO - CUARTO</b></td>
    </tr>
	
	<?php 
                if ($myrow['statusCortesia'] == 'si') {
                    ?>
    <tr>
      <td colspan="3" style="text-align: center"><span class="codigos" style="size:14"><blink>*****EL PACIENTE ES DE CORTESIA****</blink></span></td>
    </tr>
    <?php 
                }
                ?>
	
	<tr>
      <td align="left" style="text-align: center"><span ><?php 
                echo $myrow['folioVenta'];
                ?>
</span></td>
      <td ><span  style="text-align: left">Seguro: <span class="normalmid">
        <?php 
                $segur = $myrow['seguro'];
                if ($segur != '') {
                    $sSQL4 = "Select nomCliente From clientes WHERE entidad='" . $entidad . "' and numCliente='" . $segur . "';\r\n";
                    $result4 = mysql_db_query($basedatos, $sSQL4);
                    $myrow4 = mysql_fetch_array($result4);
                    echo $myrow4['nomCliente'];
                } else {
                    echo particular;
                }
                ?>
        - <?php 
                echo $myrow['credencial'];
                ?>
</span></span></td>
      <td><span >
        <?php 
                $id_almacen = $myrow['almacen'];
                $sSQL1 = "SELECT almacen,descripcion\r\nFROM\r\nalmacenes\r\nWHERE \r\nentidad='" . $entidad . "'\r\nand\r\nalmacen='" . $id_almacen . "'\r\n ";
                $result1 = mysql_db_query($basedatos, $sSQL1);
                $myrow1 = mysql_fetch_array($result1);
                echo $myrow1['descripcion'];
                ?>
        - <?php 
                echo $myrow['cuarto'];
                ?>
</span></td>
    </tr>
    <tr>
      <td colspan="2" style="text-align: left" >Fecha/Hora de Inter.: <span class="normalmid"><?php 
                echo $myrow['fecha'] . " / " . $myrow['hora'];
                ?>
</span></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" style="text-align: left" >M&eacute;dico de Inter.: <span class="normalmid">
        <?php 
                if ($myrow['medico']) {
                    $medico1 = $myrow['medico'];
                    $sSQL3 = "SELECT nombre1,apellido1,apellido2\r\n\tFROM\r\n\tmedicos \r\n\twhere\r\n\tentidad='" . $entidad . "'\r\n\tand\r\n\tnumMedico='" . $medico1 . "'";
                    $result3 = mysql_db_query($basedatos, $sSQL3);
                    $myrow3 = mysql_fetch_array($result3);
                    echo $myrow3['nombre1'] . " " . $myrow3['apellido1'] . " " . $myrow3['apellido2'];
                } else {
                    echo $myrow['medicoForaneo'];
                }
                ?>
      </span></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" style="text-align: left" >Diagn&oacute;stico: <span class="normalmid"><?php 
                echo $myrow['dx'];
                ?>
</span></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" style="text-align: left" ><span  style="text-align: left">Fecha/Hora de Alta: <span class="normalmid"><?php 
                echo $myrow['fechaCierre'] . " / " . $myrow['horaCierre'];
                ?>
</span></span></td>
      <td>&nbsp;</td>
    </tr>
	
	<?php 
                if ($myrow['numeroFactura']) {
                    ?>
    <tr>
      <td colspan="2" style="text-align: left" ><span  style="text-align: left">Numero Factura:  <span class="normalmid"><?php 
                    echo $myrow['numeroFactura'];
                    ?>
</span></span></td>
      <td>&nbsp;</td>
    </tr>
	<?php 
                }
                ?>
  </table>
  <p align="center">
  <?php 
                $sSQLnc = "SELECT *\r\n\tFROM\r\n\tclientesInternos \r\n\twhere\r\n\tentidad='" . $entidad . "'\r\n\tand\r\n\tfolioVenta='" . $myrow['folioDevolucion'] . "' and statusCuenta='cerrada' ";
                $resultnc = mysql_db_query($basedatos, $sSQLnc);
                $myrownc = mysql_fetch_array($resultnc);
                //echo $myrow3i['folioVenta'];
                ?>
	
	
	<?php 
                if ($myrownc['folioVenta']) {
                    ?>
<h1 align="center" class="titulos"> 
   <a href="javascript:nueva('<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/cargos/despliegaCargos.php?usuario=<?php 
                    echo $_GET['usuario'];
                    ?>
&amp;numeroE=<?php 
                    echo $numeroE;
                    ?>
&amp;almacen=<?php 
                    echo $_GET['almacenSolicitante'];
                    ?>
&amp;almacenFuente=<?php 
                    echo $almacen;
                    ?>
&amp;seguro=<?php 
                    echo $seguroT;
                    ?>
&amp;nCuenta=<?php 
                    echo $myrow3['keyClientesInternos'];
                    ?>
&amp;tipoCliente=<?php 
                    echo 'particular';
                    ?>
&amp;tipoVenta=<?php 
                    echo $_GET['tipoVenta'];
                    ?>
&amp;folioVenta=<?php 
                    echo $myrow['folioDevolucion'];
                    ?>
&amp;keyClientesInternos=<?php 
                    echo $myrow3['keyClientesInternos'];
                    ?>
&amp;rand=<?php 
                    echo rand(1000, 10000000);
                    ?>
&amp;paquete=<?php 
                    echo $_GET['paquete'];
                    ?>
&amp;transaccion=<?php 
                    echo $my['codigoTT'];
                    ?>
&amp;precioVenta=<?php 
                    echo $totalParticular;
                    ?>
&amp;modoPago=<?php 
                    if ($_GET['devolucion'] == 'si') {
                        echo 'devolucion';
                    } else {
                        echo 'efectivo';
                    }
                    ?>
&amp;tipoTransaccion=particular&amp;devolucion=<?php 
                    echo $_GET['devolucion'];
                    ?>
&tipoPago=Efectivo','ventana7','800','600','yes');">
NOTA DE CREDITO
</a>
<?php 
                }
                ?>
	
  </p>

    
<?php 
                //CIERRA ENCABEZADO
                ?>
    
    
    
    
    
    
    
    
    
    
    
    
    
    

  <?php 
                //require('/configuracion/clases/operacionesGlobales.php');
                ?>
  
<?php 
                //*******************************OPERACION GLOBAL*****************************
                //CARGOS
                if ($myrow['naturaleza'] == 'C' and $myrow['statusRegreso'] != 'si') {
                    $cargo[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']) + $myrow['iva'] * $myrow['cantidad'];
                }
                //ABONOS
                if ($myrow['naturaleza'] == 'A' and $myrow['gpoProducto'] == '') {
                    $abono[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']) + $myrow['iva'] * $myrow['cantidad'];
                }
                //DEVOLUCIONES
                if ($myrow['naturaleza'] == 'A' and $myrow['statusDevolucion'] == 'si') {
                    $devolucion[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']) + $myrow['iva'] * $myrow['cantidad'];
                }
                //DEVOLUCIONES CARGOS
                if ($myrow['naturaleza'] == 'C' and $myrow['statusDevolucion'] == 'si') {
                    $devolucionCargos[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']) + $myrow['iva'] * $myrow['cantidad'];
                }
                //REGRESOS
                if ($myrow['naturaleza'] == 'C' and $myrow['statusRegreso'] == 'si') {
                    $regreso[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']) + $myrow['iva'] * $myrow['cantidad'];
                }
                //*******************************************************************************
                //CARGOS PARTICULARES
                if ($myrow['naturaleza'] == 'C' and $myrow['statusRegreso'] != 'si') {
                    $cargoParticular[0] += (double) ($myrow['cantidadParticular'] * $myrow['cantidad']) + $myrow['ivaParticular'] * $myrow['cantidad'];
                }
                //ABONOS
                if ($myrow['naturaleza'] == 'A' and $myrow['gpoProducto'] == '') {
                    $abonoParticular[0] += (double) ($myrow['cantidadParticular'] * $myrow['cantidad']) + $myrow['ivaParticular'] * $myrow['cantidad'];
                }
                //DEVOLUCIONES
                if ($myrow['naturaleza'] == 'A' and $myrow['statusDevolucion'] == 'si') {
                    $devolucionParticular[0] += (double) ($myrow['cantidadParticular'] * $myrow['cantidad']) + $myrow['ivaParticular'] * $myrow['cantidad'];
                }
                //REGRESO DE EFECTIVO
                if ($myrow['naturaleza'] == 'C' and $myrow['statusRegreso'] == 'si') {
                    $regresoParticular[0] += (double) ($myrow['cantidadParticular'] * $myrow['cantidad']) + $myrow['ivaParticular'] * $myrow['cantidad'];
                }
                //******************************************************************************************
                //CARGOS ASEGURADORA
                //ES BENEFICENCIA
                // if($myrow['naturaleza']=='A' and $myrow['gpoProducto']==NULL){//devolucion transacciones
                // $abonosBeneficencia[0]+=$myrow['cantidadAseguradora']*$myrow['cantidad'];
                // }elseif($myrow['naturaleza']=='A' and $myrow['statusDevolucion']=='si'){//cargos al paciente
                //  $devolucionBeneficencia[0]+=($myrow['cantidadAseguradora']*$myrow['cantidad'])+($myrow['ivaAseguradora']*$myrow['cantidad']);//devolucion articulos
                // }else if($myrow['naturaleza']=='C' ){//cargos al paciente
                // $cargosBeneficencia[0]+=($myrow['cantidadAseguradora']*$myrow['cantidad'])+($myrow['ivaAseguradora']*$myrow['cantidad']);
                // }else if($myrow['naturaleza']=='C' and $myrow['gpoProducto']==''){//cargos al paciente
                // $pagoDevBeneficencia[0]+=($myrow['precioVenta']*$myrow['cantidad'])+($myrow['iva']*$myrow['cantidad']);
                // }
                if ($myrow['naturaleza'] == 'C' and $myrow['gpoProducto'] != '') {
                    //cargos al paciente
                    $cargosBeneficencia[0] += (double) ($myrow['cantidadBeneficencia'] * $myrow['cantidad']) + $myrow['ivaBeneficencia'] * $myrow['cantidad'];
                }
                if ($myrow['naturaleza'] == 'A' and $myrow['gpoProducto'] != '') {
                    //devolucion de cargo beneficencia
                    $devolucionBeneficencia[0] += (double) ($myrow['cantidadBeneficencia'] * $myrow['cantidad']) + $myrow['ivaBeneficencia'] * $myrow['cantidad'];
                }
                if ($myrow['tipoTransaccion'] == 'DEVXB') {
                    $dtBeneficencia[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']) + $myrow['iva'] * $myrow['cantidad'];
                }
                if ($myrow['naturaleza'] == 'A' and $myrow['gpoProducto'] == '') {
                    //abonos
                    $abonosBeneficencia[0] += (double) ($myrow['cantidadBeneficencia'] * $myrow['cantidad']);
                }
                if ($myrow['naturaleza'] == 'C' and $myrow['statusRegreso'] != 'si') {
                    $cargoAseguradora[0] += (double) ($myrow['cantidadAseguradora'] * $myrow['cantidad']) + $myrow['ivaAseguradora'] * $myrow['cantidad'];
                }
                //ABONOS
                if ($myrow['naturaleza'] == 'A' and $myrow['gpoProducto'] == '') {
                    $abonoAseguradora[0] += (double) ($myrow['cantidadAseguradora'] * $myrow['cantidad']) + $myrow['ivaAseguradora'] * $myrow['cantidad'];
                }
                //DEVOLUCIONES
                if ($myrow['naturaleza'] == 'A' and $myrow['statusDevolucion'] == 'si') {
                    $devolucionAseguradora[0] += (double) ($myrow['cantidadAseguradora'] * $myrow['cantidad']) + $myrow['ivaAseguradora'] * $myrow['cantidad'];
                }
                //REGRESO DE TRASLADO
                if ($myrow['naturaleza'] == 'C' and $myrow['statusRegreso'] == 'si') {
                    $regresoAseguradora[0] += (double) ($myrow['cantidadAseguradora'] * $myrow['cantidad']) + $myrow['ivaAseguradora'] * $myrow['cantidad'];
                }
                //IVA
                if ($myrow['naturaleza'] == 'C') {
                    $ivaCargos[0] += (double) ($myrow['iva'] * $myrow['cantidad']);
                } elseif ($myrow['naturaleza'] == 'A') {
                    $ivaAbonos[0] += (double) ($myrow['iva'] * $myrow['cantidad']);
                }
                //******************************************************************************************
                ?>















<?php 
                //****************************COASEGURO / DEDUCIBLE **********************************
                $s1 = "Select codigoTT From catTTCaja WHERE  coaseguro1='si'  ";
                $rs1 = mysql_db_query($basedatos, $s1);
                $my1 = mysql_fetch_array($rs1);
                $s2 = "Select codigoTT From catTTCaja WHERE  coaseguro2='si'  ";
                $rs2 = mysql_db_query($basedatos, $s2);
                $my2 = mysql_fetch_array($rs2);
                $s3 = "Select codigoTT From catTTCaja WHERE  deducible1='si'  ";
                $rs3 = mysql_db_query($basedatos, $s3);
                $my3 = mysql_fetch_array($rs3);
                $s4 = "Select codigoTT From catTTCaja WHERE  deducible2='si'  ";
                $rs4 = mysql_db_query($basedatos, $s4);
                $my4 = mysql_fetch_array($rs4);
                $s5 = "Select codigoTT From catTTCaja WHERE  aplicarDescuentoParticulares='si'  ";
                $rs5 = mysql_db_query($basedatos, $s5);
                $my5 = mysql_fetch_array($rs5);
                $s5a = "Select codigoTT From catTTCaja WHERE  descuentoParticulares='si'  ";
                $rs5a = mysql_db_query($basedatos, $s5a);
                $my5a = mysql_fetch_array($rs5a);
                $s6 = "Select codigoTT From catTTCaja WHERE  aplicarDescuentoAseguradoras='si'  ";
                $rs6 = mysql_db_query($basedatos, $s6);
                $my6 = mysql_fetch_array($rs6);
                $s6a = "Select codigoTT From catTTCaja WHERE  descuentoAseguradoras='si'  ";
                $rs6a = mysql_db_query($basedatos, $s6a);
                $my6a = mysql_fetch_array($rs6a);
                $s7 = "Select codigoTT From catTTCaja WHERE  trasladoBeneficencia='si'  ";
                $rs7 = mysql_db_query($basedatos, $s7);
                $my7 = mysql_fetch_array($rs7);
                //*************************************************************************************
                if ($myrow['tipoTransaccion'] == $my1['codigoTT']) {
                    $coaseguro1 = $my1['codigoTT'];
                    if ($myrow['naturaleza'] == '-') {
                        $totalCargoCoaseguro1[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']);
                    } else {
                        $totalAbonoCoaseguro1[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']);
                    }
                }
                if ($myrow['tipoTransaccion'] == $my2['codigoTT']) {
                    $coaseguro2 = $my2['codigoTT'];
                    if ($myrow['naturaleza'] == '-') {
                        $totalCargoCoaseguro2[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']);
                    } else {
                        $totalAbonoCoaseguro2[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']);
                    }
                }
                if ($myrow['tipoTransaccion'] == $my3['codigoTT']) {
                    $deducible1 = $my3['codigoTT'];
                    if ($myrow['naturaleza'] == '-') {
                        $totalCargoDeducible1[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']);
                    } else {
                        $totalAbonoDeducible1[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']);
                    }
                }
                if ($myrow['tipoTransaccion'] == $my4['codigoTT']) {
                    $deducible2 = $my4['codigoTT'];
                    if ($myrow['naturaleza'] == '-') {
                        $totalCargoDeducible2[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']);
                    } else {
                        $totalAbonoDeducible2[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']);
                    }
                }
                //*******************CIERRO COASEGURO Y DEDUCIBLE
                //****************APlicar descuentos**********
                if ($myrow['tipoTransaccion'] == $my5['codigoTT'] || $myrow['tipoTransaccion'] == $my5a['codigoTT']) {
                    $descuentoParticular = $my5a['codigoTT'];
                    if ($myrow['naturaleza'] == '-') {
                        $descuentoParticularAplicado[0] += (double) ($myrow['cantidadParticular'] * $myrow['cantidad']);
                    } else {
                        $descuentosParticulares[0] += (double) ($myrow['cantidadParticular'] * $myrow['cantidad']);
                    }
                }
                if ($myrow['tipoTransaccion'] == $my6['codigoTT'] || $myrow['tipoTransaccion'] == $my6a['codigoTT']) {
                    $descuentoAseguradora = $my6a['codigoTT'];
                    if ($myrow['naturaleza'] == '-') {
                        $descuentoAseguradoraAplicado[0] += (double) ($myrow['cantidadAseguradora'] * $myrow['cantidad']);
                    } else {
                        $descuentosAseguradoras[0] += (double) ($myrow['cantidadAseguradora'] * $myrow['cantidad']);
                    }
                }
                if ($myrow['tipoTransaccion'] == $my7['codigoTT'] || $myrow['tipoTransaccion'] == $my7a['codigoTT']) {
                    $transB = $my7['codigoTT'];
                }
                //*********************************************
                ?>
  
    
  <?php 
                //CIERRA OPERACIONES GLOBALES
                ?>
    
    
    
    
    
    
    
    
    
    
  <?php 
                //require('/configuracion/clases/mostrarDatosCuenta.php');
                //MOSTRAR DATOS CUENTA
                ?>
  
<script language=javascript> 
function ventanaSecundaria10 (URL){ 
   window.open(URL,"ventanaSecundaria10","width=500,height=300,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script>
<div align="center">
<span >Opciones de Grupo de Producto: </br></span>
      <?php 
                $sSQL7 = "Select gpoProducto From cargosCuentaPaciente\r\n          where entidad='" . $entidad . "'\r\n             and\r\n             folioVenta='" . $_GET['folioVenta'] . "'\r\n                 and\r\n                 gpoProducto!=''\r\n      group by gpoProducto";
                $result7 = mysql_db_query($basedatos, $sSQL7);
                echo mysql_error();
                ?>
          <select name="gpoProducto1"  id="gpoProducto1" onChange="this.form.submit();" >
		  <option value="">Todos</option>
            <?php 
                while ($myrow7 = mysql_fetch_array($result7)) {
                    $sSQL78 = "SELECT *\r\n                            FROM\r\n                                gpoProductos\r\n                                WHERE\r\n                                    entidad = '" . $entidad . "'\r\n                                    and\r\n                                codigoGP='" . $myrow7['gpoProducto'] . "'\r\n                                ";
                    $result78 = mysql_db_query($basedatos, $sSQL78);
                    $myrow78 = mysql_fetch_array($result78);
                    ?>

            <option
		    <?php 
                    if ($_POST['gpoProducto1'] == $myrow7['gpoProducto']) {
                        echo 'selected';
                    }
                    ?>
		   value="<?php 
                    echo $myrow7['gpoProducto'];
                    ?>
"><?php 
                    echo $myrow78['descripcionGP'];
                    ?>
</option>
            <?php 
                }
                ?>
          </select>
<p></p>
    <table width="817" class="table table-striped" style="border: 1px solid #CCC;">

    <tr >
      <th width="19"   scope="col"><div align="center">#</div></th>
      <th width= "56"   scope="col"><div align="center"># Reg</div></th>
      <th width= "45"   scope="col"><div align="center">Fecha</div></th>
      <th width= "23"   scope="col"><div align="center">C</div></th>
      <th width= "431"   scope="col"><div align="center">Descripcion</div></th>
      <th width= "52"   scope="col"><div align="center">Totales</div></th>
      <th width= "25"   scope="col"><div align="center">N</div></th>
      <th width= "59"   scope="col">Part</th>
      <th width= "59"   scope="col">Benef</th>
	  <th  width= "69"  scope="col"><div align="center">Aseg</div></th>
	  </tr>
    <tr>



<?php 
                $q = "DELETE FROM reportesTemporales\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nusuario='" . $usuario . "'\r\n";
                mysql_db_query($basedatos, $q);
                echo mysql_error();
                if ($_POST['gpoProducto1'] == null) {
                    $sSQL = "SELECT *\r\nFROM\r\ncargosCuentaPaciente\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "'\r\n\r\n\r\n";
                } else {
                    $sSQL = "SELECT *\r\nFROM\r\ncargosCuentaPaciente\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "'\r\n    and\r\n    gpoProducto='" . $_POST['gpoProducto1'] . "'\r\n\r\n\r\n";
                }
                if ($result = mysql_db_query($basedatos, $sSQL)) {
                    while ($myrow = mysql_fetch_array($result)) {
                        $numeroE = $myrow['numeroE'];
                        $nCuenta = $myrow['nCuenta'];
                        if ($col) {
                            $color = '#FFCCFF';
                            $col = "";
                        } else {
                            $color = '#FFFFFF';
                            $col = 1;
                        }
                        $a += 1;
                        $nT = $myrow['keyClientesInternos'];
                        if ($myrow['naturaleza'] == 'A') {
                            $signo = '-';
                        } else {
                            $signo = NULL;
                        }
                        //
                        ?>


 <tr  >
      <td height="24"  ><?php 
                        print $a;
                        ?>
</td>
      <td width="56"   align="center"><?php 
                        echo $myrow['keyCAP'];
                        ?>
</td>
      <td width="45"  ><?php 
                        echo cambia_a_normal($myrow['fecha1']);
                        ?>
</td>
      <td width="23"  ><div align="center">
        <?php 
                        echo round($myrow['cantidad'], 3);
                        //echo $myrow['cantidad'];
                        ?>
      </div></td>
      <td width="431"  ><?php 
                        echo '<span >';
                        echo $myrow['descripcionArticulo'];
                        echo '</span>';
                        if ($myrow['tipoPaciente'] != 'externo') {
                            if ($myrow['naturaleza'] == 'A' and $myrow['gpoProducto'] != '') {
                                echo '</br><div >' . 'Devolucion, folio: ' . $myrow['folioDevolucion'] . '</div>';
                            }
                        }
                        if ($myrow['fechaSolicitud'] != '') {
                            echo '<br>';
                            echo 'Fecha Solicitud: ' . cambia_a_normal($myrow['fechaSolicitud']);
                        }
                        if ($myrow['gpoProducto'] != '') {
                            if ($myrow['statusCargo'] == 'cargado') {
                                echo '</br><div >' . '[ ' . $myrow['statusCargo'] . ']' . ' a las ' . '[ ' . $myrow['horaCargo'] . ']' . ' </div>Solicitado por: ' . '[ ' . $myrow['usuario'] . ']';
                            } else {
                                echo '</br><div ><blink>' . '*************** FAVOR DE SURTIR ********' . '</blink></div>';
                            }
                        } else {
                            echo '</br><div >' . '[ Transaccion]' . '</div>';
                        }
                        $sSQL341c = "Select descripcionGP From gpoProductos WHERE  entidad='" . $entidad . "' and codigoGP='" . $myrow['gpoProducto'] . "'";
                        $result341c = mysql_db_query($basedatos, $sSQL341c);
                        $myrow341c = mysql_fetch_array($result341c);
                        echo '</br>';
                        echo '- ' . $myrow341c['descripcionGP'] . ' -';
                        echo '</br>';
                        if ($myrow['statusDescuentoGlobal'] == 'si') {
                            echo '</br><span >' . ' [' . $myrow['descripcionDescuentoGlobal'] . ']' . '</span>';
                        }
                        if ($myrow['facturacionEspecial'] == 'si') {
                            echo '</br><span >' . ' [' . $myrow['descripcionSeguroFacturacion'] . ']' . '</span>';
                        }
                        //***********************************ALMACENES**********************************
                        $sSQL341cs = "Select * From almacenes WHERE  entidad='" . $entidad . "' and almacen='" . $myrow['almacenSolicitante'] . "'";
                        $result341cs = mysql_db_query($basedatos, $sSQL341cs);
                        $myrow341cs = mysql_fetch_array($result341cs);
                        $sSQL341ca = "Select * From almacenes WHERE  entidad='" . $entidad . "' and almacen='" . $myrow['almacenDestino'] . "'";
                        $result341ca = mysql_db_query($basedatos, $sSQL341ca);
                        $myrow341ca = mysql_fetch_array($result341ca);
                        if ($myrow['gpoProducto'] != '') {
                            echo '</br><span >' . ' [' . $myrow341cs['descripcion'] . '  >  ' . $myrow341ca['descripcion'] . '] ' . '</span>';
                        }
                        //********************************************************************************************
                        if ($myrow['numRecibo']) {
                            ?>
</br><span > Recibo: </span>
	  <a href="javascript:nueva('<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/INGRESOS HLC/caja/imprimirNumeroRecibo.php?keyClientesInternos=<?php 
                            echo $myrow['keyClientesInternos'];
                            ?>
&amp;folioFactura=<?php 
                            echo $_POST['folioFactura'];
                            ?>
&amp;paciente=<?php 
                            echo $_POST['paciente'];
                            ?>
&amp;usuario=<?php 
                            echo $usuario;
                            ?>
&amp;hora1=<?php 
                            echo $hora1;
                            ?>
&amp;fechaImpresion=<?php 
                            echo $_POST['fechaImpresion'];
                            ?>
&amp;credencial=<?php 
                            echo $_POST['credencial'];
                            ?>
&amp;siniestro=<?php 
                            echo $_POST['siniestro'];
                            ?>
&amp;folioVenta=<?php 
                            echo $myrow['folioVenta'];
                            ?>
&entidad=<?php 
                            echo $entidad;
                            ?>
&keyCAP=<?php 
                            echo $myrow['keyCAP'];
                            ?>
','ventana7','800','600','yes');">
<?php 
                            echo $myrow['numRecibo'];
                            ?>
</a>

<?php 
                        }
                        if ($myrow['naturaleza'] == '-') {
                            ?>
</br><span > Cancelar </span>
	  <a href="javascript:nueva('<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/INGRESOS HLC/caja/imprimirNumeroRecibo.php?keyClientesInternos=<?php 
                            echo $myrow['keyClientesInternos'];
                            ?>
&amp;folioFactura=<?php 
                            echo $_POST['folioFactura'];
                            ?>
&amp;paciente=<?php 
                            echo $_POST['paciente'];
                            ?>
&amp;usuario=<?php 
                            echo $usuario;
                            ?>
&amp;hora1=<?php 
                            echo $hora1;
                            ?>
&amp;fechaImpresion=<?php 
                            echo $_POST['fechaImpresion'];
                            ?>
&amp;credencial=<?php 
                            echo $_POST['credencial'];
                            ?>
&amp;siniestro=<?php 
                            echo $_POST['siniestro'];
                            ?>
&amp;folioVenta=<?php 
                            echo $myrow['folioVenta'];
                            ?>
&entidad=<?php 
                            echo $entidad;
                            ?>
&keyCAP=<?php 
                            echo $myrow['keyCAP'];
                            ?>
','ventana7','800','600','yes');">
<?php 
                            echo $myrow['numRecibo'];
                            ?>
</a>

<?php 
                        }
                        if ($myrow['gpoProducto'] != '' and $usuario) {
                            $sSQLa = "\r\nSELECT *\r\nFROM\r\nreportesTemporales\r\nWHERE \r\nentidad='" . $entidad . "' \r\nand\r\nusuario='" . $usuario . "'  \r\nand\r\ncodigoGP='" . $myrow['gpoProducto'] . "'   ";
                            $resulta = mysql_db_query($basedatos, $sSQLa);
                            $myrowa = mysql_fetch_array($resulta);
                            $agrega = "INSERT INTO reportesTemporales (\r\ngpoProducto,importe,entidad,usuario,random,codigoGP,naturaleza,folioVenta\r\n) values (\r\n'" . $myrow341c['descripcionGP'] . "',\r\n'" . $myrow['precioVenta'] * $myrow['cantidad'] . "',\r\n'" . $entidad . "','" . $usuario . "','" . $random . "','" . $myrow['gpoProducto'] . "','" . $myrow['naturaleza'] . "','" . $_GET['folioVenta'] . "'\r\n\r\n)";
                            mysql_db_query($basedatos, $agrega);
                            echo mysql_error();
                        }
                        ?>



<?php 
                        if ($myrow['naturaleza'] == '-') {
                            ?>
</br><span > 
	  <a href="javascript:ventanaSecundaria10('<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/cargos/ventanaEditar.php?keyClientesInternos=<?php 
                            echo $myrow['keyClientesInternos'];
                            ?>
&amp;folioFactura=<?php 
                            echo $_POST['folioFactura'];
                            ?>
&amp;paciente=<?php 
                            echo $_POST['paciente'];
                            ?>
&amp;usuario=<?php 
                            echo $usuario;
                            ?>
&amp;hora1=<?php 
                            echo $hora1;
                            ?>
&amp;fechaImpresion=<?php 
                            echo $_POST['fechaImpresion'];
                            ?>
&amp;credencial=<?php 
                            echo $_POST['credencial'];
                            ?>
&amp;siniestro=<?php 
                            echo $_POST['siniestro'];
                            ?>
&amp;folioVenta=<?php 
                            echo $myrow['folioVenta'];
                            ?>
&entidad=<?php 
                            echo $entidad;
                            ?>
&keyCAP=<?php 
                            echo $myrow['keyCAP'];
                            ?>
','ventana7','500','200','yes');">
Editar</a>
<?php 
                        }
                        ?>

</span>
	   <hr />
      </td>

      <td width="52"  ><div align="center">
<?php 
                        echo '$' . number_format($myrow['precioVenta'] * $myrow['cantidad'] + $myrow['iva'] * $myrow['cantidad'], 2);
                        ?>
      </div></td>
      <td width="25"  ><div align="center">
        <?php 
                        echo $myrow['naturaleza'];
                        ?>
      </div></td>
      
      
      
      
      <td width="59"  ><div align="center">

  <span >
<?php 
                        $triggerParticular = (double) ($myrow['cantidadParticular'] * $myrow['cantidad']) + $myrow['ivaParticular'] * $myrow['cantidad'];
                        echo '$' . number_format($myrow['cantidadParticular'] * $myrow['cantidad'] + $myrow['ivaParticular'] * $myrow['cantidad'], 2);
                        ?>
</span>
      </div></td>
      
      
           <td width="59"  ><div align="center">

  <span >
<?php 
                        $triggerBeneficencia = (double) ($myrow['cantidadBeneficencia'] * $myrow['cantidad']) + $myrow['ivaBeneficencia'] * $myrow['cantidad'];
                        echo '$' . number_format($myrow['cantidadBeneficencia'] * $myrow['cantidad'] + $myrow['ivaBeneficencia'] * $myrow['cantidad'], 2);
                        ?>
</span>
      </div></td> 
      
      
      
      

<td width="69"  ><div align="center">
  <span >
  <?php 
                        $triggerAseguradora = (double) ($myrow['cantidadAseguradora'] * $myrow['cantidad']) + $myrow['ivaAseguradora'] * $myrow['cantidad'];
                        echo '$' . number_format($myrow['cantidadAseguradora'] * $myrow['cantidad'] + $myrow['ivaAseguradora'] * $myrow['cantidad'], 2);
                        ?>
</span>


</div></td>
</tr> 

<?php 
                        //require('/configuracion/clases/operacionesGlobales.php');
                        //ABRE OPERACIONES GLOBALES
                        ?>


<?php 
                        //*******************************OPERACION GLOBAL*****************************
                        //CARGOS
                        if ($myrow['naturaleza'] == 'C' and $myrow['statusRegreso'] != 'si') {
                            $cargo[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']) + $myrow['iva'] * $myrow['cantidad'];
                        }
                        //ABONOS
                        if ($myrow['naturaleza'] == 'A' and $myrow['gpoProducto'] == '') {
                            $abono[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']) + $myrow['iva'] * $myrow['cantidad'];
                        }
                        //DEVOLUCIONES
                        if ($myrow['naturaleza'] == 'A' and $myrow['statusDevolucion'] == 'si') {
                            $devolucion[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']) + $myrow['iva'] * $myrow['cantidad'];
                        }
                        //DEVOLUCIONES CARGOS
                        if ($myrow['naturaleza'] == 'C' and $myrow['statusDevolucion'] == 'si') {
                            $devolucionCargos[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']) + $myrow['iva'] * $myrow['cantidad'];
                        }
                        //REGRESOS
                        if ($myrow['naturaleza'] == 'C' and $myrow['statusRegreso'] == 'si') {
                            $regreso[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']) + $myrow['iva'] * $myrow['cantidad'];
                        }
                        //*******************************************************************************
                        //CARGOS PARTICULARES
                        if ($myrow['naturaleza'] == 'C' and $myrow['statusRegreso'] != 'si') {
                            $cargoParticular[0] += (double) ($myrow['cantidadParticular'] * $myrow['cantidad']) + $myrow['ivaParticular'] * $myrow['cantidad'];
                        }
                        //ABONOS
                        if ($myrow['naturaleza'] == 'A' and $myrow['gpoProducto'] == '') {
                            $abonoParticular[0] += (double) ($myrow['cantidadParticular'] * $myrow['cantidad']) + $myrow['ivaParticular'] * $myrow['cantidad'];
                        }
                        //DEVOLUCIONES
                        if ($myrow['naturaleza'] == 'A' and $myrow['statusDevolucion'] == 'si') {
                            $devolucionParticular[0] += (double) ($myrow['cantidadParticular'] * $myrow['cantidad']) + $myrow['ivaParticular'] * $myrow['cantidad'];
                        }
                        //REGRESO DE EFECTIVO
                        if ($myrow['naturaleza'] == 'C' and $myrow['statusRegreso'] == 'si') {
                            $regresoParticular[0] += (double) ($myrow['cantidadParticular'] * $myrow['cantidad']) + $myrow['ivaParticular'] * $myrow['cantidad'];
                        }
                        //******************************************************************************************
                        //CARGOS ASEGURADORA
                        //ES BENEFICENCIA
                        // if($myrow['naturaleza']=='A' and $myrow['gpoProducto']==NULL){//devolucion transacciones
                        // $abonosBeneficencia[0]+=$myrow['cantidadAseguradora']*$myrow['cantidad'];
                        // }elseif($myrow['naturaleza']=='A' and $myrow['statusDevolucion']=='si'){//cargos al paciente
                        //  $devolucionBeneficencia[0]+=($myrow['cantidadAseguradora']*$myrow['cantidad'])+($myrow['ivaAseguradora']*$myrow['cantidad']);//devolucion articulos
                        // }else if($myrow['naturaleza']=='C' ){//cargos al paciente
                        // $cargosBeneficencia[0]+=($myrow['cantidadAseguradora']*$myrow['cantidad'])+($myrow['ivaAseguradora']*$myrow['cantidad']);
                        // }else if($myrow['naturaleza']=='C' and $myrow['gpoProducto']==''){//cargos al paciente
                        // $pagoDevBeneficencia[0]+=($myrow['precioVenta']*$myrow['cantidad'])+($myrow['iva']*$myrow['cantidad']);
                        // }
                        if ($myrow['naturaleza'] == 'C' and $myrow['gpoProducto'] != '') {
                            //cargos al paciente
                            $cargosBeneficencia[0] += (double) ($myrow['cantidadBeneficencia'] * $myrow['cantidad']) + $myrow['ivaBeneficencia'] * $myrow['cantidad'];
                        }
                        if ($myrow['naturaleza'] == 'A' and $myrow['gpoProducto'] != '') {
                            //devolucion de cargo beneficencia
                            $devolucionBeneficencia[0] += (double) ($myrow['cantidadBeneficencia'] * $myrow['cantidad']) + $myrow['ivaBeneficencia'] * $myrow['cantidad'];
                        }
                        if ($myrow['tipoTransaccion'] == 'DEVXB') {
                            $dtBeneficencia[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']) + $myrow['iva'] * $myrow['cantidad'];
                        }
                        if ($myrow['naturaleza'] == 'A' and $myrow['gpoProducto'] == '') {
                            //abonos
                            $abonosBeneficencia[0] += (double) ($myrow['cantidadBeneficencia'] * $myrow['cantidad']);
                        }
                        if ($myrow['naturaleza'] == 'C' and $myrow['statusRegreso'] != 'si') {
                            $cargoAseguradora[0] += (double) ($myrow['cantidadAseguradora'] * $myrow['cantidad']) + $myrow['ivaAseguradora'] * $myrow['cantidad'];
                        }
                        //ABONOS
                        if ($myrow['naturaleza'] == 'A' and $myrow['gpoProducto'] == '') {
                            $abonoAseguradora[0] += (double) ($myrow['cantidadAseguradora'] * $myrow['cantidad']) + $myrow['ivaAseguradora'] * $myrow['cantidad'];
                        }
                        //DEVOLUCIONES
                        if ($myrow['naturaleza'] == 'A' and $myrow['statusDevolucion'] == 'si') {
                            $devolucionAseguradora[0] += (double) ($myrow['cantidadAseguradora'] * $myrow['cantidad']) + $myrow['ivaAseguradora'] * $myrow['cantidad'];
                        }
                        //REGRESO DE TRASLADO
                        if ($myrow['naturaleza'] == 'C' and $myrow['statusRegreso'] == 'si') {
                            $regresoAseguradora[0] += (double) ($myrow['cantidadAseguradora'] * $myrow['cantidad']) + $myrow['ivaAseguradora'] * $myrow['cantidad'];
                        }
                        //IVA
                        if ($myrow['naturaleza'] == 'C') {
                            $ivaCargos[0] += (double) ($myrow['iva'] * $myrow['cantidad']);
                        } elseif ($myrow['naturaleza'] == 'A') {
                            $ivaAbonos[0] += (double) ($myrow['iva'] * $myrow['cantidad']);
                        }
                        //******************************************************************************************
                        ?>















<?php 
                        //****************************COASEGURO / DEDUCIBLE **********************************
                        $s1 = "Select codigoTT From catTTCaja WHERE  coaseguro1='si'  ";
                        $rs1 = mysql_db_query($basedatos, $s1);
                        $my1 = mysql_fetch_array($rs1);
                        $s2 = "Select codigoTT From catTTCaja WHERE  coaseguro2='si'  ";
                        $rs2 = mysql_db_query($basedatos, $s2);
                        $my2 = mysql_fetch_array($rs2);
                        $s3 = "Select codigoTT From catTTCaja WHERE  deducible1='si'  ";
                        $rs3 = mysql_db_query($basedatos, $s3);
                        $my3 = mysql_fetch_array($rs3);
                        $s4 = "Select codigoTT From catTTCaja WHERE  deducible2='si'  ";
                        $rs4 = mysql_db_query($basedatos, $s4);
                        $my4 = mysql_fetch_array($rs4);
                        $s5 = "Select codigoTT From catTTCaja WHERE  aplicarDescuentoParticulares='si'  ";
                        $rs5 = mysql_db_query($basedatos, $s5);
                        $my5 = mysql_fetch_array($rs5);
                        $s5a = "Select codigoTT From catTTCaja WHERE  descuentoParticulares='si'  ";
                        $rs5a = mysql_db_query($basedatos, $s5a);
                        $my5a = mysql_fetch_array($rs5a);
                        $s6 = "Select codigoTT From catTTCaja WHERE  aplicarDescuentoAseguradoras='si'  ";
                        $rs6 = mysql_db_query($basedatos, $s6);
                        $my6 = mysql_fetch_array($rs6);
                        $s6a = "Select codigoTT From catTTCaja WHERE  descuentoAseguradoras='si'  ";
                        $rs6a = mysql_db_query($basedatos, $s6a);
                        $my6a = mysql_fetch_array($rs6a);
                        $s7 = "Select codigoTT From catTTCaja WHERE  trasladoBeneficencia='si'  ";
                        $rs7 = mysql_db_query($basedatos, $s7);
                        $my7 = mysql_fetch_array($rs7);
                        //*************************************************************************************
                        if ($myrow['tipoTransaccion'] == $my1['codigoTT']) {
                            $coaseguro1 = $my1['codigoTT'];
                            if ($myrow['naturaleza'] == '-') {
                                $totalCargoCoaseguro1[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']);
                            } else {
                                $totalAbonoCoaseguro1[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']);
                            }
                        }
                        if ($myrow['tipoTransaccion'] == $my2['codigoTT']) {
                            $coaseguro2 = $my2['codigoTT'];
                            if ($myrow['naturaleza'] == '-') {
                                $totalCargoCoaseguro2[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']);
                            } else {
                                $totalAbonoCoaseguro2[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']);
                            }
                        }
                        if ($myrow['tipoTransaccion'] == $my3['codigoTT']) {
                            $deducible1 = $my3['codigoTT'];
                            if ($myrow['naturaleza'] == '-') {
                                $totalCargoDeducible1[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']);
                            } else {
                                $totalAbonoDeducible1[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']);
                            }
                        }
                        if ($myrow['tipoTransaccion'] == $my4['codigoTT']) {
                            $deducible2 = $my4['codigoTT'];
                            if ($myrow['naturaleza'] == '-') {
                                $totalCargoDeducible2[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']);
                            } else {
                                $totalAbonoDeducible2[0] += (double) ($myrow['precioVenta'] * $myrow['cantidad']);
                            }
                        }
                        //*******************CIERRO COASEGURO Y DEDUCIBLE
                        //****************APlicar descuentos**********
                        if ($myrow['tipoTransaccion'] == $my5['codigoTT'] || $myrow['tipoTransaccion'] == $my5a['codigoTT']) {
                            $descuentoParticular = $my5a['codigoTT'];
                            if ($myrow['naturaleza'] == '-') {
                                $descuentoParticularAplicado[0] += (double) ($myrow['cantidadParticular'] * $myrow['cantidad']);
                            } else {
                                $descuentosParticulares[0] += (double) ($myrow['cantidadParticular'] * $myrow['cantidad']);
                            }
                        }
                        if ($myrow['tipoTransaccion'] == $my6['codigoTT'] || $myrow['tipoTransaccion'] == $my6a['codigoTT']) {
                            $descuentoAseguradora = $my6a['codigoTT'];
                            if ($myrow['naturaleza'] == '-') {
                                $descuentoAseguradoraAplicado[0] += (double) ($myrow['cantidadAseguradora'] * $myrow['cantidad']);
                            } else {
                                $descuentosAseguradoras[0] += (double) ($myrow['cantidadAseguradora'] * $myrow['cantidad']);
                            }
                        }
                        if ($myrow['tipoTransaccion'] == $my7['codigoTT'] || $myrow['tipoTransaccion'] == $my7a['codigoTT']) {
                            $transB = $my7['codigoTT'];
                        }
                        //*********************************************
                        ?>

<?php 
                        //CIERRA OPERACIONES GLOBALES=
                        ?>



    <?php 
                    }
                }
                ?>
    <input name="menu" type="hidden" value="<?php 
                echo $menu;
                ?>
" />
  </table>
	</p>	
  </div>
  
  
  
  
  
  
  
  
  
  
  
  
  
  <p>
 <?php 
                //require('/configuracion/clases/mostrarTotalesEC.php');
                //MOSTRAR TOTALES EC
                ?>
 
      
      
      
<?php 
                //OPERACIONES GLOBALES
                $totalCargo = (double) ($cargo[0] - $devolucion[0]);
                $totalAbono = (double) ($abono[0] - $regreso[0] + $descuentos[0]);
                $totalParticular = (double) ($cargoParticular[0] - $abonoParticular[0]) - ($devolucionParticular[0] - $regresoParticular[0]);
                $totalBeneficencia = (double) ($cargosBeneficencia[0] - ($abonosBeneficencia[0] - $dtBeneficencia[0])) - ($devolucionBeneficencia[0] - $regresoBeneficencia[0]);
                $totalAseguradora = (double) ($cargoAseguradora[0] - $abonoAseguradora[0]) - ($devolucionAseguradora[0] - $regresoAseguradora[0]);
                //echo $cargosBeneficencia[0].'-1- '.$abonosBeneficencia[0].'-2- '.$devolucionBeneficencia[0].' -3- '.$regresoBeneficencia[0];
                //REDONDEO GLOBALES****/
                $TOTAL = (double) ($totalCargo - $totalAbono);
                if ($TOTAL > -1 and $TOTAL < 1) {
                    $TOTAL = '0.00';
                }
                //**************************
                //******TOTAL PARTICULAR
                $totalParticular = (double) $totalParticular;
                if ($totalParticular > -1 and $totalParticular < 1) {
                    $totalParticular = '0.00';
                }
                //*********************
                //****************TOTAL IVA
                $ivaTotal = (double) ($ivaCargos[0] - $ivaAbonos[0]);
                //**************************
                //******TOTAL ASEGURADORA
                if ($totalAseguradora > -1 and $totalAseguradora < 1) {
                    $totalAseguradora = '0.00';
                }
                //*********************
                //**********COASEGUROS DEDUCIBLES**************
                $totalCoaseguro1 = (double) ($totalCargoCoaseguro1[0] - $totalAbonoCoaseguro1[0]);
                $totalCoaseguro2 = (double) ($totalCargoCoaseguro2[0] - $totalAbonoCoaseguro2[0]);
                $totalDeducible1 = (double) ($totalCargoDeducible1[0] - $totalAbonoDeducible1[0]);
                $totalDeducible2 = (double) ($totalCargoDeducible2[0] - $totalAbonoDeducible2[0]);
                //***************************************************
                //*****************DESCUENTOS*********
                $descuentoP = (double) ($descuentoParticularAplicado[0] - $descuentosParticulares[0]);
                $descuentoA = (double) ($descuentoAseguradoraAplicado[0] - $descuentosAseguradoras[0]);
                //***************************************
                //****************BENEFICENCIAS********
                $ben = (double) ($cargosBeneficencia[0] - $devolucionBeneficencia[0]) - ($abonosBeneficencia[0] - $dtBeneficencia[0] - $pagoDevBeneficencia[0]);
                //*************************************
                ?>
      
      
      
      
<?php 
                //CIERRA TOTALES EC
                ?>
      
  </p>
  
  
  <table width="312"   style="border: 1px solid #CCC;">
    <tr>
      <th width="212"   scope="col"><div align="left">Descripci&oacute;n</div></th>
      <th width="62"   scope="col"><div align="left">Importe</div></th>

    </tr>
    <tr>
<?php 
                $sSQL = "\r\nSELECT gpoProducto\r\nFROM\r\ncargosCuentaPaciente\r\nWHERE\r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "'\r\nand gpoProducto!=''\r\ngroup by gpoProducto\r\n ";
                if ($result = mysql_db_query($basedatos, $sSQL)) {
                    while ($myrow = mysql_fetch_array($result)) {
                        $codigo = $code = $myrow['codigo'];
                        $i += 1;
                        $sSQLac = "\r\nSELECT sum(importe) as cargo\r\nFROM\r\nreportesTemporales\r\nWHERE\r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "'\r\nand\r\ncodigoGP='" . $myrow['gpoProducto'] . "'\r\nand\r\nnaturaleza='C'\r\n\r\n  ";
                        $resultac = mysql_db_query($basedatos, $sSQLac);
                        $myrowac = mysql_fetch_array($resultac);
                        $sSQLaa = "\r\nSELECT sum(importe) as abono\r\nFROM\r\nreportesTemporales\r\nWHERE\r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "'\r\nand\r\ncodigoGP='" . $myrow['gpoProducto'] . "'\r\nand\r\nnaturaleza='A'\r\n ";
                        $resultaa = mysql_db_query($basedatos, $sSQLaa);
                        $myrowaa = mysql_fetch_array($resultaa);
                        $sSQLaa1 = "\r\nSELECT *\r\nFROM\r\ngpoProductos\r\nWHERE\r\nentidad='" . $entidad . "'\r\nand codigoGP='" . $myrow['gpoProducto'] . "'\r\norder by descripcionGP ASC\r\n ";
                        $resultaa1 = mysql_db_query($basedatos, $sSQLaa1);
                        $myrowaa1 = mysql_fetch_array($resultaa1);
                        ?>
      <td   ><div align="left"><span > <?php 
                        echo $myrowaa1['descripcionGP'];
                        ?>
</span></div></td>
      <td   align="right" ><?php 
                        echo "\$" . number_format($myrowac['cargo'] - $myrowaa['abono'], 2);
                        ?>
</td>
    </tr>
    <?php 
                    }
                }
                ?>

            <td  align="right" >
                IVA:
                <?php 
                echo "\$" . number_format($ivaTotal, 2);
                ?>
</td>
  </table>


  






    <p align="center">





 <input type="hidden" name="variable_php" id="variable_php" />

</form>

<p align="center">&nbsp;</p>
<script languaje="JavaScript">            
              document.form1.variable_php.value=varjs;
</script>
<?php 
                //***************SOLO MOSTRAR
                $q = "DELETE FROM reportesTemporales\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nusuario='" . $usuario . "'\r\n";
                mysql_db_query($basedatos, $q);
                echo mysql_error();
                ?>
  <?php 
                //MOSSTRAR DATOS CUENTA
                ?>


   
    
    </table>

</div>
  

  
  




   <?php 
                //MOSTRAR DATOS EC
                //   require('/configuracion/clases/mostrarDatosEC.php');
                //
                ?>

<?php 
                //*******************REFERENCIA*******************
                /* //*******************************OPERACION GLOBAL*****************************
                //CARGOS
                
                if($myrow['naturaleza']=='C'  and $myrow['statusRegreso']!='si'){ 
                $cargo[0]+=($myrow['precioVenta']*$myrow['cantidad'])+($myrow['iva']*$myrow['cantidad']);
                }
                
                //ABONOS
                if($myrow['naturaleza']=='A' and $myrow['gpoProducto']==''){ 
                $abono[0]+=($myrow['precioVenta']*$myrow['cantidad'])+($myrow['iva']*$myrow['cantidad']);
                }
                
                
                //DEVOLUCIONES
                if($myrow['naturaleza']=='A' and $myrow['statusDevolucion']=='si'){
                $devolucion[0]+=($myrow['precioVenta']*$myrow['cantidad'])+($myrow['iva']*$myrow['cantidad']);
                }
                
                
                if($myrow['naturaleza']=='C' and $myrow['statusRegreso']=='si'){ 
                $regreso[0]+=($myrow['precioVenta']*$myrow['cantidad'])+($myrow['iva']*$myrow['cantidad']);
                }
                //******************************************************************************* */
                //*************************************************
                /* 
                //*************CARGOS*************
                $sc="SELECT 
                sum((precioVenta*cantidad) +(iva*cantidad)) as cargos
                FROM
                cargosCuentaPaciente
                WHERE
                entidad='".$entidad."'
                and
                folioVenta='".$_GET['folioVenta']."'
                and
                gpoProducto!=''
                and
                naturaleza='C'  ";
                $rc=mysql_db_query($basedatos,$sc);
                $mc = mysql_fetch_array($rc);
                //**************************************
                
                //****************ABONOS************
                
                $sa="SELECT 
                sum((precioVenta*cantidad) +(iva*cantidad)) as abonos
                FROM
                cargosCuentaPaciente
                WHERE
                entidad='".$entidad."'
                and
                folioVenta='".$_GET['folioVenta']."'
                and
                gpoProducto=''
                and
                naturaleza='A'  ";
                $ra=mysql_db_query($basedatos,$sa);
                $ma = mysql_fetch_array($ra);
                //*************************************
                
                
                //*******************DEVOLUCIONES**************
                $sd="SELECT 
                sum((precioVenta*cantidad) +(iva*cantidad)) as devolucion
                FROM
                cargosCuentaPaciente
                WHERE
                entidad='".$entidad."'
                and
                folioVenta='".$_GET['folioVenta']."'
                and
                gpoProducto!=''
                and
                naturaleza='A' 
                and
                statusDevolucion='si'
                 ";
                $rd=mysql_db_query($basedatos,$sd);
                $md = mysql_fetch_array($rd);
                //*************************************************************	  
                  
                  
                  
                //*****************REGRESO*********************  
                $sr="SELECT 
                sum((precioVenta*cantidad) +(iva*cantidad)) as regreso
                FROM
                cargosCuentaPaciente
                WHERE
                entidad='".$entidad."'
                and
                folioVenta='".$_GET['folioVenta']."'
                and
                gpoProducto!=''
                and
                naturaleza='C'  
                and
                statusRegreso='si'
                ";
                $rr=mysql_db_query($basedatos,$sr);
                $mr = mysql_fetch_array($rr);
                //**************************************************
                
                
                //*****************REGRESO*********************  
                $sdes="SELECT 
                sum((precioVenta*cantidad) +(iva*cantidad)) as descuento
                FROM
                cargosCuentaPaciente
                WHERE
                entidad='".$entidad."'
                and
                folioVenta='".$_GET['folioVenta']."'
                and
                gpoProducto!=''
                and
                naturaleza='A'  
                and
                statusDescuento='si'
                ";
                $rdes=mysql_db_query($basedatos,$sdes);
                $mdes = mysql_fetch_array($rdes);
                //**************************************************
                
                  
                $totalCargo= $mc['cargos']-$md['devolucion']-$mr['regreso']-$mdes['descuento'];
                $totalAbono=$ma['abonos']; */
                ?>
<table width="380" border="0" align="center"  cellspacing="0" style="border: 1px solid #CCC;">
    <tr >
      <td width="25" height="25" >&nbsp;</td>
      <td width="113" >Cargos</td>
      <td width="36"  >
	  <?php 
                echo '$' . number_format($totalCargo, 2);
                ?>
	  </td>
    </tr>
    <tr >
      <td height="26">&nbsp;</td>
      <td >Abonos</td>
      <td ><?php 
                echo '$' . number_format($totalAbono, 2);
                ?>
</td>
    </tr>
	
	
	
    <tr >
      <td height="26" >&nbsp;</td>
      <td  >Total</td>
      <td  ><?php 
                echo '$' . number_format($TOTAL, 2);
                ?>
</td>    </tr>
	


  </table>



<?php 
                //
                //
                //CIERRA MOSTRAR DATOS EC
                ?>
 















<?php 
                $saldos = new acumulados();
                if ($limiteSEGURO > 0 and $SEGURO != NULL) {
                    //doble if
                    $sSQL7ab = "Select * from segurosLimites where entidad='" . $entidad . "'  and seguro='" . $SEGURO . "'  ";
                    $result7ab = mysql_db_query($basedatos, $sSQL7ab);
                    $myrow7ab = mysql_fetch_array($result7ab);
                    $acumulado = $myrow7ab['cantidad'] - $saldos->verificarSaldos($myrow3['seguro'], $entidad, $fecha1, $basedatos, $myrow3['numeroE'], $mmt);
                    if ($TOTAL <= $acumulado) {
                        //MOSTRAR EFECTUAR TRANSACCIONES
                        ?>

<?php 
                        $descripcionTransaccion = $_GET['descripcionTransaccion'];
                        //******ULTIMO TIRON**************
                        if ($_GET['descripcionTransaccion'] == 'altaPacientes') {
                            $sSQL3 = "Select * From clientesInternos WHERE keyClientesInternos = '" . $_GET['nT'] . "'  ";
                            $result3 = mysql_db_query($basedatos, $sSQL3);
                            $myrow3 = mysql_fetch_array($result3);
                        } else {
                            $sSQL3 = "Select * From clientesInternos WHERE keyClientesInternos = '" . $_GET['nCuenta'] . "'  ";
                            $result3 = mysql_db_query($basedatos, $sSQL3);
                            $myrow3 = mysql_fetch_array($result3);
                        }
                        //***********************************
                        ?>
<p>&nbsp;</p>

<a name="final">
    </a>

<table width="590" border="0" align="center" cellpadding="4" cellspacing="0" class="table table-striped" style="border: 1px solid #CCC;">
  <tr>
    <th colspan="2" ><b >Particular</b></th>
    <th width="75" >&nbsp;</th>
     <th colspan="2" ><b >Beneficencia</b></th>
    <th width="75" >&nbsp;</th>
    <th colspan="2" ><b >Aseguradora</b></th>
  </tr>
  <tr>
    <td width="137" ><span >Cargos</span></td>
    <td width="75"><span >
      <?php 
                        $sSQLpartc = "Select sum(cantidadParticular*cantidad) as totalParticular, sum(ivaParticular*cantidad) as totalIVA From cargosCuentaPaciente WHERE entidad='" . $entidad . "' and folioVenta = '" . $_GET['folioVenta'] . "' \r\nand\r\nnaturaleza='C'\r\nand\r\ngpoProducto!=''\r\n ";
                        $resultpartc = mysql_db_query($basedatos, $sSQLpartc);
                        $myrowpartc = mysql_fetch_array($resultpartc);
                        $sSQLparta = "Select sum(cantidadParticular*cantidad) as totalParticular, sum(ivaParticular*cantidad) as totalIVA From cargosCuentaPaciente WHERE entidad='" . $entidad . "' and folioVenta = '" . $_GET['folioVenta'] . "' \r\nand\r\nnaturaleza='A'\r\nand\r\ngpoProducto!=''\r\n ";
                        $resultparta = mysql_db_query($basedatos, $sSQLparta);
                        $myrowparta = mysql_fetch_array($resultparta);
                        echo '$' . number_format($myrowpartc['totalParticular'] - $myrowparta['totalParticular'], 2);
                        ?>
    </span></td>
    <td>&nbsp;</td>
    
    
        <td width="137" ><span >Cargos</span></td>
    <td width="75"><span >
      <?php 
                        $sSQLbenec = "Select sum(cantidadBeneficencia*cantidad) as totalParticular, sum(ivaBeneficencia*cantidad) as totalIVA From cargosCuentaPaciente WHERE entidad='" . $entidad . "' and folioVenta = '" . $_GET['folioVenta'] . "' \r\nand\r\nnaturaleza='C'\r\nand\r\ngpoProducto!=''\r\n ";
                        $resultbenec = mysql_db_query($basedatos, $sSQLbenec);
                        $myrowbenec = mysql_fetch_array($resultbenec);
                        $sSQLbenea = "Select sum(cantidadBeneficencia*cantidad) as totalParticular, sum(ivaBeneficencia*cantidad) as totalIVA From cargosCuentaPaciente WHERE entidad='" . $entidad . "' and folioVenta = '" . $_GET['folioVenta'] . "' \r\nand\r\nnaturaleza='A'\r\nand\r\ngpoProducto!=''\r\n ";
                        $resultbenea = mysql_db_query($basedatos, $sSQLbenea);
                        $myrowbenea = mysql_fetch_array($resultbenea);
                        echo '$' . number_format($myrowbenec['totalParticular'] - $myrowbenea['totalParticular'], 2);
                        ?>
    </span></td>
    <td>&nbsp;</td>
    
    
    
    
    
    
    
    
    
    
    
    
    <td width="116"><span >Cargos</span></td>
    <td width="153"><span >
      <?php 
                        $sSQLasegc = "Select sum(cantidadAseguradora*cantidad) as totalAseguradora, sum(ivaAseguradora*cantidad) as totalIVA From cargosCuentaPaciente WHERE entidad='" . $entidad . "' and folioVenta = '" . $_GET['folioVenta'] . "' \r\nand\r\nnaturaleza='C'\r\nand\r\ngpoProducto!=''\r\n ";
                        $resultasegc = mysql_db_query($basedatos, $sSQLasegc);
                        $myrowasegc = mysql_fetch_array($resultasegc);
                        $sSQLasega = "Select sum(cantidadAseguradora*cantidad) as totalAseguradora, sum(ivaAseguradora*cantidad) as totalIVA \r\n    From cargosCuentaPaciente WHERE entidad='" . $entidad . "' and folioVenta = '" . $_GET['folioVenta'] . "' \r\nand\r\nnaturaleza='A'\r\nand\r\ngpoProducto!=''\r\n ";
                        $resultasega = mysql_db_query($basedatos, $sSQLasega);
                        $myrowasega = mysql_fetch_array($resultasega);
                        echo '$' . number_format($myrowasegc['totalAseguradora'] - $myrowasega['totalAseguradora'], 2);
                        ?>
    </span></td>
    
    
    
    
  </tr>
  
  
  
  
  
  
  
  
  
  
  
  
  
  <tr>
    <td><span >IVA</span></td>
    <td><span ><?php 
                        echo '$' . number_format($myrowpartc['totalIVA'] - $myrowparta['totalIVA'], 2);
                        ?>
</span></td>
    <td>&nbsp;</td>
    <td><span >IVA</span></td>
    <td><span ><?php 
                        echo '$' . number_format($myrowbenec['totalIVA'] - $myrowbenea['totalIVA'], 2);
                        ?>
</span></td>
    <td>&nbsp;</td>
    <td><span >IVA</span></td>
    <td><span ><?php 
                        echo '$' . number_format($myrowasegc['totalIVA'] - $myrowasega['totalIVA'], 2);
                        ?>
</span></td>
  </tr>
  
  
  
  
  
  <tr>
    <td><span >Total</span></td>
    <td><span ><?php 
                        echo '$' . number_format($myrowpartc['totalParticular'] + $myrowpartc['totalIVA'] - ($myrowparta['totalParticular'] + $myrowparta['totalIVA']), 2);
                        ?>
</span></td>
    <td>&nbsp;</td>
    
    <td><span >Total</span></td>
    <td><span ><?php 
                        echo '$' . number_format($myrowbenec['totalParticular'] + $myrowbenec['totalIVA'] - ($myrowbenea['totalParticular'] + $myrowbenea['totalIVA']), 2);
                        ?>
</span></td>
    <td>&nbsp;</td>
    
    
    
    <td><span >Total</span></td>
    <td><span ><?php 
                        echo '$' . number_format($myrowasegc['totalAseguradora'] + $myrowasegc['totalIVA'] - ($myrowasega['totalAseguradora'] + $myrowasega['totalIVA']), 2);
                        ?>
</span></td>
  </tr>
</table>

<p>&nbsp;</p>
<table width="900" class="table table-striped" style="border: 1px solid #CCC;">

  <tr >
    <th width="76"  ><div align="center">Part</div></th>
    <th width="76"  ><div align="center">Aseg</div></th>
    <th width="111"  ><div align="center">Regreso Aseg</div></th>
    <th width="104"  ><div align="center">Regreso Part </div></th>
    <th width="89"  ><div align="center">C1</div></th>
    <th width="100"  ><div align="center">C2</div></th>
    <th width="95"  ><div align="center">D1</div></th>
    <th width="88"  ><div align="center">D2</div></th>
    <th width="77"  ><div align="center">Desc Part </div></th>
    <th width="84"  ><div align="center">Desc Aseg </div></th>
    <th width="84"  ><div align="center">Beneficencia</div></th>
  </tr>
  <tr  >
    <td height="48"  ><div align="center"><span >
<?php 
                        //************************PARTICULARES**********************************************************************
                        //CARGOS PARTICULARES REFERENCIAS
                        /* if($myrow['naturaleza']=='C'  and $myrow['statusRegreso']!='si'){ 
                        $cargoParticular[0]+=($myrow['cantidadParticular']*$myrow['cantidad'])+($myrow['ivaParticular']*$myrow['cantidad']);
                        }
                        
                        //ABONOS
                        if($myrow['naturaleza']=='A' and $myrow['gpoProducto']==''){
                        $abonoParticular[0]+=($myrow['cantidadParticular']*$myrow['cantidad'])+($myrow['ivaParticular']*$myrow['cantidad']);
                        }
                        
                        
                        //DEVOLUCIONES
                        if($myrow['naturaleza']=='A' and $myrow['statusDevolucion']=='si'){
                        $devolucionParticular[0]+=($myrow['cantidadParticular']*$myrow['cantidad'])+($myrow['ivaParticular']*$myrow['cantidad']);
                        }
                        
                        //REGRESO DE EFECTIVO
                        if($myrow['naturaleza']=='C' and $myrow['statusRegreso']=='si'){ 
                        $regresoParticular[0]+=($myrow['cantidadParticular']*$myrow['cantidad'])+($myrow['ivaParticular']*$myrow['cantidad']);
                        } */
                        //******************************************************************************************
                        /* //*************CARGOS*************
                        $sPc="SELECT 
                        sum((cantidadParticular*cantidad) +(ivaParticular*cantidad) as cargoParticular
                        FROM
                        cargosCuentaPaciente
                        WHERE
                        entidad='".$entidad."'
                        and
                        folioVenta='".$_GET['folioVenta']."'
                        and
                        gpoProducto!=''
                        and
                        naturaleza='C'  ";
                        $rPc=mysql_db_query($basedatos,$sPc);
                        $mPc = mysql_fetch_array($rPc);
                        //**************************************
                        
                        //****************ABONOS************
                        
                        $sPa="SELECT 
                        sum((cantidadParticular*cantidad) +(ivaParticular*cantidad) as abonoParticular
                        FROM
                        cargosCuentaPaciente
                        WHERE
                        entidad='".$entidad."'
                        and
                        folioVenta='".$_GET['folioVenta']."'
                        and
                        gpoProducto=''
                        and
                        naturaleza='A'  ";
                        $rPa=mysql_db_query($basedatos,$sPa);
                        $mPa = mysql_fetch_array($rPa);
                        //*************************************
                        
                        
                        //*******************DEVOLUCIONES**************
                        $sPd="SELECT 
                        sum((cantidadParticular*cantidad) +(ivaParticular*cantidad) as devolucionParticular
                        FROM
                        cargosCuentaPaciente
                        WHERE
                        entidad='".$entidad."'
                        and
                        folioVenta='".$_GET['folioVenta']."'
                        and
                        gpoProducto!=''
                        and
                        naturaleza='A' 
                        and
                        statusDevolucion='si'
                         ";
                        $rPd=mysql_db_query($basedatos,$sPd);
                        $mPd = mysql_fetch_array($rPd);
                        //*************************************************************	  
                          
                          
                          
                        //*****************REGRESO*********************  
                        $sPr="SELECT 
                        sum((cantidadParticular*cantidad) +(ivaParticular*cantidad) as regresoParticular
                        FROM
                        cargosCuentaPaciente
                        WHERE
                        entidad='".$entidad."'
                        and
                        folioVenta='".$_GET['folioVenta']."'
                        and
                        gpoProducto!=''
                        and
                        naturaleza='C'  
                        and
                        statusRegreso='si'
                        ";
                        $rPr=mysql_db_query($basedatos,$sPr);
                        $mPr = mysql_fetch_array($rPr);
                        //**************************************************
                        
                        
                        //*****************REGRESO*********************  
                        $sPdes="SELECT 
                        sum((cantidadParticular*cantidad) +(ivaParticular*cantidad) as descuentoParticular
                        FROM
                        cargosCuentaPaciente
                        WHERE
                        entidad='".$entidad."'
                        and
                        folioVenta='".$_GET['folioVenta']."'
                        and
                        gpoProducto!=''
                        and
                        naturaleza='A'  
                        and
                        statusDescuento='si'
                        ";
                        $rPdes=mysql_db_query($basedatos,$sPdes);
                        $mPdes = mysql_fetch_array($rPdes);
                        //**************************************************
                        
                        
                          
                         $totalParticular= $mPc['cargoParticular']-$mPa['abonoParticular']-$mPd['devolucionParticular']-$mPr['regresoParticular']-$mPdes['descuentoParticular'];
                        //***********************************************  ****************************************************************************** */
                        if ($totalParticular > 1 || ($myrow3['statusDevolucion'] == 'si' and $descuentoP < 1 and $descuentoA < 1)) {
                            if ($myrow3['statusCortesia'] == 'si') {
                                $tipoPago = 'Cortesia';
                            } else {
                                if ($myrow3['tipoPaciente'] == 'externo' or ($myrow3['tipoPaciente'] == 'interno' or $myrow3['tipoPaciente'] == 'urgencias') and $myrow3['statusDevolucion'] == 'si') {
                                    if ($devolucionParticular[0] > 0 and $myrow3['statusDevolucion'] == 'si') {
                                        $tipoDevolucion = '';
                                        $tipoPago = '';
                                        if ($totalParticular < 0) {
                                            $totalParticular *= -1;
                                        }
                                    } else {
                                        $s = "Select codigoTT From catTTCaja WHERE  pagoEfectivo='si'";
                                        $rs = mysql_db_query($basedatos, $s);
                                        $my = mysql_fetch_array($rs);
                                        $tipoPago = 'Efectivo';
                                    }
                                } elseif ($myrow3['activaBeneficencia'] == 'si') {
                                    $s = "Select codigoTT From catTTCaja WHERE  trasladoBeneficencia='si'";
                                    $rs = mysql_db_query($basedatos, $s);
                                    $my = mysql_fetch_array($rs);
                                    $tipoPago = 'Beneficencia';
                                    $caso = 1;
                                } else {
                                    $s = "Select codigoTT From catTTCaja WHERE  gastosParticulares='si'";
                                    $rs = mysql_db_query($basedatos, $s);
                                    $my = mysql_fetch_array($rs);
                                    $tipoPago = 'Efectivo';
                                }
                            }
                            ?>
      <?php 
                            if ($mostrar == TRUE) {
                                ?>


<?php 
                                if ($totalParticular > 0 and $totalParticular > -1) {
                                    ?>
<a  href="javascript:nueva('<?php 
                                    echo CONSTANT_PATH_SIMA_RAIZ;
                                    ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                                    echo $_GET['usuario'];
                                    ?>
&amp;numeroE=<?php 
                                    echo $numeroE;
                                    ?>
&amp;almacen=<?php 
                                    echo $_GET['almacenSolicitante'];
                                    ?>
&amp;almacenFuente=<?php 
                                    echo $almacen;
                                    ?>
&amp;seguro=<?php 
                                    echo $seguroT;
                                    ?>
&amp;nCuenta=<?php 
                                    echo $keyClientesInternos;
                                    ?>
&amp;tipoCliente=<?php 
                                    echo 'particular';
                                    ?>
&amp;tipoVenta=<?php 
                                    echo $folioVENTA;
                                    ?>
&amp;folioVenta=<?php 
                                    echo $myrow3['folioVenta'];
                                    ?>
&amp;keyClientesInternos=<?php 
                                    echo $keyClientesInternos;
                                    ?>
&amp;rand=<?php 
                                    echo rand(1000, 10000000);
                                    ?>
&amp;paquete=<?php 
                                    echo $_GET['paquete'];
                                    ?>
&amp;transaccion=particular&amp;precioVenta=<?php 
                                    echo $totalParticular;
                                    ?>
&amp;modoPago=<?php 
                                    if ($_GET['devolucion'] == 'si') {
                                        echo 'devolucionParticular';
                                    } else {
                                        echo 'efectivo';
                                    }
                                    ?>
&amp;tipoTransaccion=particular&amp;tipoPago=<?php 
                                    echo $tipoPago;
                                    ?>
&descripcionTransaccion=<?php 
                                    echo $descripcionTransaccion;
                                    ?>
&status=<?php 
                                    echo $myrow3['status'];
                                    ?>
&statusCortesia=<?php 
                                    echo $myrow3['statusCortesia'];
                                    ?>
&tipoDevolucion=<?php 
                                    echo $tipoDevolucion;
                                    ?>
&beneficencia=<?php 
                                    if ($myrow3['activaBeneficencia'] == 'si') {
                                        echo 'si';
                                    }
                                    ?>
&statusBeneficencia=<?php 
                                    if ($myrow3['activaBeneficencia'] == 'si') {
                                        echo 'si';
                                    }
                                    ?>
&activaBeneficencia=<?php 
                                    if ($myrow3['activaBeneficencia'] == 'si') {
                                        echo 'si';
                                    }
                                    ?>
&caso=<?php 
                                    echo $caso;
                                    ?>
','ventana7','680','380','yes');">
<?php 
                                    echo '$' . number_format($totalParticular, 2);
                                    ?>
</a>
<?php 
                                } else {
                                    echo '<img src="' . CONSTANT_PATH_SIMA_RAIZ . '/imagenes/btns/checkbtn.png" width="18" height="18" />';
                                }
                                ?>



      <?php 
                            } else {
                                echo '$' . number_format($totalParticular, 2);
                            }
                            ?>
      <?php 
                        } else {
                            ?>
      <img src="<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                        }
                        ?>
    </span></div></td>
    <td  ><div align="center"><span >






<?php 
                        //********************************cANTIDAD ASEGURADORA****************************************
                        //*********************REFERENCIA*****************/
                        /* //CARGOS ASEGURADORA 
                        if($myrow['naturaleza']=='C'  and $myrow['statusRegreso']!='si'){
                        $cargoAseguradora[0]+=($myrow['cantidadAseguradora']*$myrow['cantidad'])+($myrow['ivaAseguradora']*$myrow['cantidad']);
                        }
                        
                        //ABONOS
                        if($myrow['naturaleza']=='A' and $myrow['gpoProducto']==''){
                        $abonoAseguradora[0]+=($myrow['cantidadAseguradora']*$myrow['cantidad'])+($myrow['ivaAseguradora']*$myrow['cantidad']);
                        }
                        
                        
                        //DEVOLUCIONES
                        if($myrow['naturaleza']=='A' and $myrow['statusDevolucion']=='si'){ 
                        $devolucionAseguradora[0]+=($myrow['cantidadAseguradora']*$myrow['cantidad'])+($myrow['ivaAseguradora']*$myrow['cantidad']);
                        }
                        
                        //REGRESO DE TRASLADO
                        if($myrow['naturaleza']=='C' and $myrow['statusRegreso']=='si'){
                        $regresoAseguradora[0]+=($myrow['cantidadAseguradora']*$myrow['cantidad'])+($myrow['ivaAseguradora']*$myrow['cantidad']);
                        }
                         */
                        /* 
                        //*************CARGOS*************
                        $sAc="SELECT 
                        sum((cantidadAseguradora*cantidad) +(ivaAseguradora*cantidad) as cargoAseguradora
                        FROM
                        cargosCuentaPaciente
                        WHERE
                        entidad='".$entidad."'
                        and
                        folioVenta='".$_GET['folioVenta']."'
                        and
                        gpoProducto!=''
                        and
                        naturaleza='C'  ";
                        $rAc=mysql_db_query($basedatos,$sAc);
                        $mAc = mysql_fetch_array($rAc);
                        //**************************************
                        
                        //****************ABONOS************
                        
                        $sAa="SELECT 
                        sum((cantidadAseguradora*cantidad) +(ivaAseguradora*cantidad) as abonoAseguradora
                        FROM
                        cargosCuentaPaciente
                        WHERE
                        entidad='".$entidad."'
                        and
                        folioVenta='".$_GET['folioVenta']."'
                        and
                        gpoProducto=''
                        and
                        naturaleza='A'  ";
                        $rAa=mysql_db_query($basedatos,$sAa);
                        $mAa = mysql_fetch_array($rAa);
                        //*************************************
                        
                        
                        //*******************DEVOLUCIONES**************
                        $sAd="SELECT 
                        sum((cantidadAseguradora*cantidad) +(ivaAseguradora*cantidad) as devolucionAseguradora
                        FROM
                        cargosCuentaPaciente
                        WHERE
                        entidad='".$entidad."'
                        and
                        folioVenta='".$_GET['folioVenta']."'
                        and
                        gpoProducto!=''
                        and
                        naturaleza='A' 
                        and
                        statusDevolucion='si'
                        ";
                        $rAd=mysql_db_query($basedatos,$sAd);
                        $mAd = mysql_fetch_array($rAd);
                        //*************************************************************	  
                         
                         
                         
                        //*****************REGRESO*********************  
                        $sAr="SELECT 
                        sum((cantidadAseguradora*cantidad) +(ivaAseguradora*cantidad) as regresoAseguradora
                        FROM
                        cargosCuentaPaciente
                        WHERE
                        entidad='".$entidad."'
                        and
                        folioVenta='".$_GET['folioVenta']."'
                        and
                        gpoProducto!=''
                        and
                        naturaleza='C'  
                        and
                        statusRegreso='si'
                        ";
                        $rAr=mysql_db_query($basedatos,$sAr);
                        $mAr = mysql_fetch_array($rAr);
                        //**************************************************
                        
                        
                        //*****************REGRESO*********************  
                        $sdes="SELECT 
                        sum((cantidadAseguradora*cantidad) +(ivaAseguradora*cantidad) as descuentoAseguradora
                        FROM
                        cargosCuentaPaciente
                        WHERE
                        entidad='".$entidad."'
                        and
                        folioVenta='".$_GET['folioVenta']."'
                        and
                        gpoProducto!=''
                        and
                        naturaleza='A'  
                        and
                        statusDescuento='si'
                        ";
                        $rPdes=mysql_db_query($basedatos,$sPdes);
                        $mPdes = mysql_fetch_array($rPdes);
                        //**************************************************
                        
                        
                         
                        $totalParticular= $mPc['cargoParticular']-$mPa['abonoParticular']-$mPd['devolucionParticular']-$mPr['regresoParticular']-$mPdes['descuentoParticular'];
                        //***********************************************  ******************************************************************************
                        */
                        //**************************************************************************************************
                        if ($totalAseguradora > 1 || $myrow3['statusDevolucion'] == 'si') {
                            if ($devolucionAseguradora[0] > 0 and $myrow3['statusDevolucion'] == 'si') {
                                $s = "Select codigoTT From catTTCaja WHERE  devolucionAseguradora='si'";
                                $rs = mysql_db_query($basedatos, $s);
                                $my = mysql_fetch_array($rs);
                                if ($totalAseguradora < 0) {
                                    $totalAseguradora *= -1;
                                }
                                $tipoPago = '';
                            } else {
                                $s = "Select codigoTT From catTTCaja WHERE  trasladoAseguradora='si'";
                                $rs = mysql_db_query($basedatos, $s);
                                $my = mysql_fetch_array($rs);
                                $tipoPago = 'Cuentas por Cobrar';
                            }
                            ?>







      <?php 
                            if ($totalCoaseguro1 < 1 and $totalCoaseguro2 < 1 and $totalDeducible1 < 1 and $totalDeducible2 < 1 and $descuentoP < 1 and $descuentoA < 1) {
                                ?>
      <?php 
                                if ($mostrar == TRUE) {
                                    ?>
	  
	  
	  
	  <?php 
                                    if ($totalAseguradora > -1 and $totalAseguradora > 0) {
                                        ?>
      <a href="javascript:nueva('<?php 
                                        echo CONSTANT_PATH_SIMA_RAIZ;
                                        ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                                        echo $_GET['usuario'];
                                        ?>
&amp;numeroE=<?php 
                                        echo $numeroE;
                                        ?>
&amp;almacen=<?php 
                                        echo $_GET['almacenSolicitante'];
                                        ?>
&amp;almacenFuente=<?php 
                                        echo $almacen;
                                        ?>
&amp;seguro=<?php 
                                        echo $seguroT;
                                        ?>
&amp;nCuenta=<?php 
                                        echo $keyClientesInternos;
                                        ?>
&amp;tipoCliente=<?php 
                                        echo 'particular';
                                        ?>
&amp;tipoVenta=<?php 
                                        echo $folioVENTA;
                                        ?>
&amp;folioVenta=<?php 
                                        echo $myrow3['folioVenta'];
                                        ?>
&amp;keyClientesInternos=<?php 
                                        echo $keyClientesInternos;
                                        ?>
&amp;rand=<?php 
                                        echo rand(1000, 10000000);
                                        ?>
&amp;paquete=<?php 
                                        echo $_GET['paquete'];
                                        ?>
&amp;precioVenta=<?php 
                                        echo $totalAseguradora;
                                        ?>
&amp;modoPago=<?php 
                                        if ($_GET['devolucion'] == 'si') {
                                            echo 'devolucionAseguradora';
                                        } else {
                                            echo 'cxc';
                                        }
                                        ?>
&amp;transaccion=<?php 
                                        echo $my['codigoTT'];
                                        ?>
&amp;tipoTransaccion=aseguradora&amp;tipoPago=<?php 
                                        echo $tipoPago;
                                        ?>
&amp;devolucion=<?php 
                                        echo $_GET['devolucion'];
                                        ?>
&descripcionTransaccion=<?php 
                                        echo $descripcionTransaccion;
                                        ?>
&status=<?php 
                                        echo $myrow3['status'];
                                        ?>
','ventana7','800','380','yes');"> <?php 
                                        echo '$' . number_format($totalAseguradora, 2);
                                        ?>
</a>
      <?php 
                                    } else {
                                        echo '<img src="' . CONSTANT_PATH_SIMA_RAIZ . '/imagenes/btns/checkbtn.png" width="18" height="18" />';
                                    }
                                    ?>





      <?php 
                                } else {
                                    echo '$' . number_format($totalAseguradora, 2);
                                }
                                ?>
      <?php 
                            } else {
                                ?>
      <?php 
                                echo '$' . number_format($totalAseguradora, 2);
                                ?>
      <?php 
                            }
                            ?>
      <?php 
                        } else {
                            ?>
      <img src="<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                        }
                        ?>
    </span></div></td>

















  
<td  >
<div align="center"><span >
<?php 
                        if ($totalAseguradora < -1 and $devolucionAseguradora[0] < 1) {
                            $tA = $totalAseguradora * -1;
                            ?>
      <?php 
                            if ($mostrar == TRUE) {
                                ?>
      <a href="javascript:nueva('<?php 
                                echo CONSTANT_PATH_SIMA_RAIZ;
                                ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                                echo $_GET['usuario'];
                                ?>
&amp;numeroE=<?php 
                                echo $numeroE;
                                ?>
&amp;almacen=<?php 
                                echo $_GET['almacenSolicitante'];
                                ?>
&amp;almacenFuente=<?php 
                                echo $almacen;
                                ?>
&amp;seguro=<?php 
                                echo $seguroT;
                                ?>
&amp;nCuenta=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;tipoCliente=<?php 
                                echo 'particular';
                                ?>
&amp;tipoVenta=<?php 
                                echo $folioVENTA;
                                ?>
&amp;folioVenta=<?php 
                                echo $myrow3['folioVenta'];
                                ?>
&amp;keyClientesInternos=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;rand=<?php 
                                echo rand(1000, 10000000);
                                ?>
&amp;paquete=<?php 
                                echo $_GET['paquete'];
                                ?>
&amp;transaccion=regreso&amp;precioVenta=<?php 
                                echo $tA;
                                ?>
&amp;modoPago=regresoAseguradora&amp;tipoTransaccion=particular&amp;tipoPago=regresoAseguradora&descripcionTransaccion=<?php 
                                echo $descripcionTransaccion;
                                ?>
&status=<?php 
                                echo $myrow3['status'];
                                ?>
','ventana7','400','800','yes');"> </a></span></div>      <span ><a href="javascript:nueva('<?php 
                                echo CONSTANT_PATH_SIMA_RAIZ;
                                ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                                echo $_GET['usuario'];
                                ?>
&amp;numeroE=<?php 
                                echo $numeroE;
                                ?>
&amp;almacen=<?php 
                                echo $_GET['almacenSolicitante'];
                                ?>
&amp;almacenFuente=<?php 
                                echo $almacen;
                                ?>
&amp;seguro=<?php 
                                echo $seguroT;
                                ?>
&amp;nCuenta=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;tipoCliente=<?php 
                                echo 'particular';
                                ?>
&amp;tipoVenta=<?php 
                                echo $folioVENTA;
                                ?>
&amp;folioVenta=<?php 
                                echo $myrow3['folioVenta'];
                                ?>
&amp;keyClientesInternos=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;rand=<?php 
                                echo rand(1000, 10000000);
                                ?>
&amp;paquete=<?php 
                                echo $_GET['paquete'];
                                ?>
&amp;transaccion=regreso&amp;precioVenta=<?php 
                                echo $tA;
                                ?>
&amp;modoPago=regresoAseguradora&amp;tipoTransaccion=particular&amp;tipoPago=regresoAseguradora&descripcionTransaccion=<?php 
                                echo $descripcionTransaccion;
                                ?>
&status=<?php 
                                echo $myrow3['status'];
                                ?>
','ventana7','400','800','yes');"><blink> 
      <div align="center"><?php 
                                echo '$' . number_format($tA, 2);
                                ?>
 </div>
      </blink></a>
      <div align="center">
        <?php 
                            } else {
                                echo '$' . number_format($tA, 2);
                            }
                            ?>
        <?php 
                        } else {
                            ?>
        <img src="<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
        <?php 
                        }
                        ?>
      </div>
</span>
</td>
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
    <td  ><div align="center"><span >
      <?php 
                        if ($totalParticular < -1) {
                            $tP = $totalParticular * -1;
                            ?>
      <?php 
                            if ($mostrar == TRUE) {
                                ?>
      <a href="javascript:nueva('<?php 
                                echo CONSTANT_PATH_SIMA_RAIZ;
                                ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                                echo $_GET['usuario'];
                                ?>
&amp;numeroE=<?php 
                                echo $numeroE;
                                ?>
&amp;almacen=<?php 
                                echo $_GET['almacenSolicitante'];
                                ?>
&amp;almacenFuente=<?php 
                                echo $almacen;
                                ?>
&amp;seguro=<?php 
                                echo $seguroT;
                                ?>
&amp;nCuenta=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;tipoCliente=<?php 
                                echo 'particular';
                                ?>
&amp;tipoVenta=<?php 
                                echo $folioVENTA;
                                ?>
&amp;folioVenta=<?php 
                                echo $myrow3['folioVenta'];
                                ?>
&amp;keyClientesInternos=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;rand=<?php 
                                echo rand(1000, 10000000);
                                ?>
&amp;paquete=<?php 
                                echo $_GET['paquete'];
                                ?>
&amp;transaccion=regreso&amp;precioVenta=<?php 
                                echo $tP;
                                ?>
&amp;modoPago=regresoParticular&amp;tipoTransaccion=particular&amp;tipoPago=regresoParticular&descripcionTransaccion=<?php 
                                echo $descripcionTransaccion;
                                ?>
&status=<?php 
                                echo $myrow3['status'];
                                ?>
','ventana7','400','800','yes');"></a></span></div>     
        <span >
            
<a href="javascript:nueva('<?php 
                                echo CONSTANT_PATH_SIMA_RAIZ;
                                ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                                echo $_GET['usuario'];
                                ?>
&amp;numeroE=<?php 
                                echo $numeroE;
                                ?>
&amp;almacen=<?php 
                                echo $_GET['almacenSolicitante'];
                                ?>
&amp;almacenFuente=<?php 
                                echo $almacen;
                                ?>
&amp;seguro=<?php 
                                echo $seguroT;
                                ?>
&amp;nCuenta=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;tipoCliente=<?php 
                                echo 'particular';
                                ?>
&amp;tipoVenta=<?php 
                                echo $folioVENTA;
                                ?>
&amp;folioVenta=<?php 
                                echo $myrow3['folioVenta'];
                                ?>
&amp;keyClientesInternos=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;rand=<?php 
                                echo rand(1000, 10000000);
                                ?>
&amp;paquete=<?php 
                                echo $_GET['paquete'];
                                ?>
&amp;transaccion=regreso&amp;precioVenta=<?php 
                                echo $tP;
                                ?>
&amp;modoPago=regresoParticular&amp;tipoTransaccion=particular&amp;tipoPago=regresoParticular&descripcionTransaccion=<?php 
                                echo $descripcionTransaccion;
                                ?>
&status=<?php 
                                echo $myrow3['status'];
                                ?>
','ventana7','400','800','yes');"><blink>
     <div align="center">
     <?php 
                                echo '$' . number_format($tP, 2);
                                ?>
     </div>
      </blink></a>
            
            
      <div align="center">
        <?php 
                            } else {
                                echo '$' . number_format($tP, 2);
                            }
                            ?>
        <?php 
                        } else {
                            ?>
        <img src="<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
        <?php 
                        }
                        ?>
      </div>
    </span></td>
    
    
    
    
    
    
    <td  ><div align="center"><span >
      <?php 
                        if ($totalCoaseguro1 > 1) {
                            ?>
      <?php 
                            if ($mostrar == TRUE) {
                                ?>
      <a href="javascript:nueva('<?php 
                                echo CONSTANT_PATH_SIMA_RAIZ;
                                ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                                echo $_GET['usuario'];
                                ?>
&amp;numeroE=<?php 
                                echo $numeroE;
                                ?>
&amp;almacen=<?php 
                                echo $_GET['almacenSolicitante'];
                                ?>
&amp;almacenFuente=<?php 
                                echo $almacen;
                                ?>
&amp;seguro=<?php 
                                echo $seguroT;
                                ?>
&amp;nCuenta=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;tipoCliente=<?php 
                                echo 'particular';
                                ?>
&amp;tipoVenta=<?php 
                                echo $folioVENTA;
                                ?>
&amp;folioVenta=<?php 
                                echo $myrow3['folioVenta'];
                                ?>
&amp;keyClientesInternos=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;rand=<?php 
                                echo rand(1000, 10000000);
                                ?>
&amp;paquete=<?php 
                                echo $_GET['paquete'];
                                ?>
&amp;transaccion=<?php 
                                echo $coaseguro1;
                                ?>
&amp;precioVenta=<?php 
                                echo $totalCoaseguro1;
                                ?>
&amp;modoPago=efectivo&amp;tipoTransaccion=coaseguro&amp;numCoaseguro=PCoaS1&amp;tipoPago=Efectivo&descripcionTransaccion=<?php 
                                echo $descripcionTransaccion;
                                ?>
&status=<?php 
                                echo $myrow3['status'];
                                ?>
','ventana7','480','380','yes');"> <?php 
                                echo '$' . number_format($totalCoaseguro1, 2);
                                ?>
</a>
      <?php 
                            } else {
                                echo '$' . number_format($totalCoaseguro1, 2);
                            }
                            ?>
      <?php 
                        } else {
                            ?>
      <img src="<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                        }
                        ?>
    </span></div></td>
    
    
    
    
    
    
    
    <td  ><div align="center"><span >
      <?php 
                        if ($totalCoaseguro2 > 1) {
                            ?>
      <?php 
                            if ($mostrar == TRUE) {
                                ?>
      <a href="javascript:nueva('<?php 
                                echo CONSTANT_PATH_SIMA_RAIZ;
                                ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                                echo $_GET['usuario'];
                                ?>
&amp;numeroE=<?php 
                                echo $numeroE;
                                ?>
&amp;almacen=<?php 
                                echo $_GET['almacenSolicitante'];
                                ?>
&amp;almacenFuente=<?php 
                                echo $almacen;
                                ?>
&amp;seguro=<?php 
                                echo $seguroT;
                                ?>
&amp;nCuenta=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;tipoCliente=<?php 
                                echo 'particular';
                                ?>
&amp;tipoVenta=<?php 
                                echo $folioVENTA;
                                ?>
&amp;folioVenta=<?php 
                                echo $myrow3['folioVenta'];
                                ?>
&amp;keyClientesInternos=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;rand=<?php 
                                echo rand(1000, 10000000);
                                ?>
&amp;paquete=<?php 
                                echo $_GET['paquete'];
                                ?>
&amp;transaccion=<?php 
                                echo $coaseguro2;
                                ?>
&amp;precioVenta=<?php 
                                echo $totalCoaseguro2;
                                ?>
&amp;modoPago=efectivo&amp;tipoTransaccion=coaseguro&amp;numCoaseguro=PCoaS2&amp;tipoPago=Efectivo&descripcionTransaccion=<?php 
                                echo $descripcionTransaccion;
                                ?>
&status=<?php 
                                echo $myrow3['status'];
                                ?>
','ventana7','480','380','yes');"> <?php 
                                echo '$' . number_format($totalCoaseguro2, 2);
                                ?>
</a>
      <?php 
                            } else {
                                echo '$' . number_format($totalCoaseguro2, 2);
                            }
                            ?>
      <?php 
                        } else {
                            ?>
      <img src="<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                        }
                        ?>
    </span></div></td>
    
    
    
    
    
    
    
    <td  ><div align="center"><span >
      <?php 
                        if ($totalDeducible1 > 1) {
                            ?>
      <?php 
                            if ($mostrar == TRUE) {
                                ?>
      <a href="javascript:nueva('<?php 
                                echo CONSTANT_PATH_SIMA_RAIZ;
                                ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                                echo $_GET['usuario'];
                                ?>
&amp;numeroE=<?php 
                                echo $numeroE;
                                ?>
&amp;almacen=<?php 
                                echo $_GET['almacenSolicitante'];
                                ?>
&amp;almacenFuente=<?php 
                                echo $almacen;
                                ?>
&amp;seguro=<?php 
                                echo $seguroT;
                                ?>
&amp;nCuenta=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;tipoCliente=<?php 
                                echo 'particular';
                                ?>
&amp;tipoVenta=<?php 
                                echo $folioVENTA;
                                ?>
&amp;folioVenta=<?php 
                                echo $myrow3['folioVenta'];
                                ?>
&amp;keyClientesInternos=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;rand=<?php 
                                echo rand(1000, 10000000);
                                ?>
&amp;paquete=<?php 
                                echo $_GET['paquete'];
                                ?>
&amp;transaccion=<?php 
                                echo $deducible1;
                                ?>
&amp;precioVenta=<?php 
                                echo $totalDeducible1;
                                ?>
&amp;modoPago=efectivo&amp;tipoTransaccion=coaseguro&amp;numCoaseguro=PDeduSeg1&amp;tipoPago=Efectivo&descripcionTransaccion=<?php 
                                echo $descripcionTransaccion;
                                ?>
&status=<?php 
                                echo $myrow3['status'];
                                ?>
','ventana7','480','380','yes');"> <?php 
                                echo '$' . number_format($totalDeducible1, 2);
                                ?>
</a>
      <?php 
                            } else {
                                echo '$' . number_format($totalDeducible1, 2);
                            }
                            ?>
      <?php 
                        } else {
                            ?>
      <img src="<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                        }
                        ?>
    </span></div></td>
    
    
    
    
    
    
    <td  ><div align="center"><span >
      <?php 
                        if ($totalDeducible2 > 1) {
                            ?>
      <?php 
                            if ($mostrar == TRUE) {
                                ?>
      <a href="javascript:nueva('<?php 
                                echo CONSTANT_PATH_SIMA_RAIZ;
                                ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                                echo $_GET['usuario'];
                                ?>
&amp;numeroE=<?php 
                                echo $numeroE;
                                ?>
&amp;almacen=<?php 
                                echo $_GET['almacenSolicitante'];
                                ?>
&amp;almacenFuente=<?php 
                                echo $almacen;
                                ?>
&amp;seguro=<?php 
                                echo $seguroT;
                                ?>
&amp;nCuenta=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;tipoCliente=<?php 
                                echo 'particular';
                                ?>
&amp;tipoVenta=<?php 
                                echo $folioVENTA;
                                ?>
&amp;folioVenta=<?php 
                                echo $myrow3['folioVenta'];
                                ?>
&amp;keyClientesInternos=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;rand=<?php 
                                echo rand(1000, 10000000);
                                ?>
&amp;paquete=<?php 
                                echo $_GET['paquete'];
                                ?>
&amp;transaccion=<?php 
                                echo $deducible2;
                                ?>
&amp;precioVenta=<?php 
                                echo $totalDeducible2;
                                ?>
&amp;modoPago=efectivo&amp;tipoTransaccion=coaseguro&amp;numCoaseguro=PDeduSeg2&amp;tipoPago=Efectivo&descripcionTransaccion=<?php 
                                echo $descripcionTransaccion;
                                ?>
&status=<?php 
                                echo $myrow3['status'];
                                ?>
','ventana7','480','380','yes');"> <?php 
                                echo '$' . number_format($totalDeducible2, 2);
                                ?>
</a>
      <?php 
                            } else {
                                echo '$' . number_format($totalDeducible2, 2);
                            }
                            ?>
      <?php 
                        } else {
                            ?>
      <img src="<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                        }
                        ?>
    </span></div></td>
    
    
    
    
    
    
    
    <td  >
        <div align="center">
            <span >
      <?php 
                        if ($descuentoP > 1) {
                            ?>
      <?php 
                            if ($mostrar == TRUE) {
                                ?>
      <a href="javascript:nueva('<?php 
                                echo CONSTANT_PATH_SIMA_RAIZ;
                                ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                                echo $_GET['usuario'];
                                ?>
&amp;numeroE=<?php 
                                echo $numeroE;
                                ?>
&amp;almacen=<?php 
                                echo $_GET['almacenSolicitante'];
                                ?>
&amp;almacenFuente=<?php 
                                echo $almacen;
                                ?>
&amp;seguro=<?php 
                                echo $seguroT;
                                ?>
&amp;nCuenta=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;tipoCliente=<?php 
                                echo 'particular';
                                ?>
&amp;tipoVenta=<?php 
                                echo $folioVENTA;
                                ?>
&amp;folioVenta=<?php 
                                echo $myrow3['folioVenta'];
                                ?>
&amp;keyClientesInternos=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;rand=<?php 
                                echo rand(1000, 10000000);
                                ?>
&amp;paquete=<?php 
                                echo $_GET['paquete'];
                                ?>
&amp;transaccion=<?php 
                                echo $descuentoParticular;
                                ?>
&amp;precioVenta=<?php 
                                echo $descuentoP;
                                ?>
&amp;modoPago=descuentos&amp;tipoPago=descuentos&amp;descuento=particular&descripcionTransaccion=<?php 
                                echo $descripcionTransaccion;
                                ?>
&status=<?php 
                                echo $myrow3['status'];
                                ?>
','ventana7','480','380','yes');"> 
    <?php 
                                echo '<span class="precio1"><blink>$' . number_format($descuentoP, 2) . '</blink></span>';
                                ?>
      </a>
      <?php 
                            } else {
                                echo '$' . number_format($descuentoP, 2);
                            }
                            ?>
      <?php 
                        } else {
                            ?>
      <img src="<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                        }
                        ?>
    </span></div></td>
    
    
    
    
    
    
    <td  ><div align="center"><span >
      <?php 
                        if ($descuentoA > 1) {
                            ?>
      <?php 
                            if ($mostrar == TRUE) {
                                ?>
      <a href="javascript:nueva('<?php 
                                echo CONSTANT_PATH_SIMA_RAIZ;
                                ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                                echo $_GET['usuario'];
                                ?>
&amp;numeroE=<?php 
                                echo $numeroE;
                                ?>
&amp;almacen=<?php 
                                echo $_GET['almacenSolicitante'];
                                ?>
&amp;almacenFuente=<?php 
                                echo $almacen;
                                ?>
&amp;seguro=<?php 
                                echo $seguroT;
                                ?>
&amp;nCuenta=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;tipoCliente=<?php 
                                echo 'particular';
                                ?>
&amp;tipoVenta=<?php 
                                echo $folioVENTA;
                                ?>
&amp;folioVenta=<?php 
                                echo $myrow3['folioVenta'];
                                ?>
&amp;keyClientesInternos=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;rand=<?php 
                                echo rand(1000, 10000000);
                                ?>
&amp;paquete=<?php 
                                echo $_GET['paquete'];
                                ?>
&amp;transaccion=<?php 
                                echo $descuentoAseguradora;
                                ?>
&amp;precioVenta=<?php 
                                echo $descuentoA;
                                ?>
&amp;modoPago=descuentos&amp;tipoPago=descuentos&amp;descuento=aseguradora&descripcionTransaccion=<?php 
                                echo $descripcionTransaccion;
                                ?>
&status=<?php 
                                echo $myrow3['status'];
                                ?>
','ventana7','480','380','yes');"> 
    <?php 
                                echo '<span class="precio1"><blink>$' . number_format($descuentoA, 2) . '</blink></span>';
                                ?>
      </a>
      <?php 
                            } else {
                                echo '$' . number_format($descuentoA, 2);
                            }
                            ?>
      <?php 
                        } else {
                            ?>
      <img src="<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                        }
                        ?>
    </span></div></td>




    
    
    
    
<?php 
                        //*******************BENEFICENCIA
                        if ($ben != NULL and $ben < 0) {
                            $mp = 'devolucionBeneficencia';
                            $ben = $ben * -1;
                            $tpb = 'devolucionBeneficencia';
                        } else {
                            $mp = 'Beneficencia';
                            $tpb = 'Beneficencia';
                        }
                        ?>



     <td  ><div align="center"><span >
      <?php 
                        if ($ben != NULL) {
                            ?>
      <?php 
                            if ($mostrar == TRUE) {
                                ?>
      <a href="javascript:nueva('<?php 
                                echo CONSTANT_PATH_SIMA_RAIZ;
                                ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                                echo $_GET['usuario'];
                                ?>
&amp;numeroE=<?php 
                                echo $numeroE;
                                ?>
&amp;almacen=<?php 
                                echo $_GET['almacenSolicitante'];
                                ?>
&amp;almacenFuente=<?php 
                                echo $almacen;
                                ?>
&amp;seguro=<?php 
                                echo $seguroT;
                                ?>
&amp;nCuenta=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;tipoCliente=<?php 
                                echo 'particular';
                                ?>
&amp;tipoVenta=<?php 
                                echo $folioVENTA;
                                ?>
&amp;folioVenta=<?php 
                                echo $myrow3['folioVenta'];
                                ?>
&amp;keyClientesInternos=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;rand=<?php 
                                echo rand(1000, 10000000);
                                ?>
&amp;paquete=<?php 
                                echo $_GET['paquete'];
                                ?>
&amp;transaccion=<?php 
                                echo $transB;
                                ?>
&amp;precioVenta=<?php 
                                echo $ben;
                                ?>
&amp;modoPago=<?php 
                                echo $mp;
                                ?>
&amp;tipoPago=<?php 
                                echo $tpb;
                                ?>
&descripcionTransaccion=beneficencia&status=<?php 
                                echo $myrow3['status'];
                                ?>
&beneficencia=si&statusBeneficencia=si','ventana7','480','380','yes');"> <?php 
                                echo '$' . number_format($ben, 2);
                                ?>
</a>
      <?php 
                            } else {
                                echo '$' . number_format($ben, 2);
                            }
                            ?>
      <?php 
                        } else {
                            ?>
      <img src="<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                        }
                        ?>
    </span></div></td>
  </tr>

</table>
<p>&nbsp;</p>

 
 
 <?php 
                        //CIERRA MOSTRAR EFECTUAR TRANSACCIONES
                    } else {
                        echo '<br>';
                        echo '<span class="codigos">ERROR: <blink>' . 'Imposible hacer movimientos en esta cuenta, ya supero su limite de credito!' . '</blink>' . ' tienes cargos por: ' . '$' . number_format($saldos->verificarSaldos($myrow3['seguro'], $entidad, $fecha1, $basedatos, $myrow3['numeroE'], $matricula), 2) . '!!' . '</span>';
                    }
                } else {
                    //no tiene limites
                    ?>

<?php 
                    //MOSTRAR EFECTUAR TRANSACCIONES
                    $descripcionTransaccion = $_GET['descripcionTransaccion'];
                    //******ULTIMO TIRON**************
                    if ($_GET['descripcionTransaccion'] == 'altaPacientes') {
                        $sSQL3 = "Select * From clientesInternos WHERE keyClientesInternos = '" . $_GET['nT'] . "'  ";
                        $result3 = mysql_db_query($basedatos, $sSQL3);
                        $myrow3 = mysql_fetch_array($result3);
                    } else {
                        $sSQL3 = "Select * From clientesInternos WHERE keyClientesInternos = '" . $_GET['nCuenta'] . "'  ";
                        $result3 = mysql_db_query($basedatos, $sSQL3);
                        $myrow3 = mysql_fetch_array($result3);
                    }
                    //***********************************
                    ?>
<p>&nbsp;</p>

<a name="final">
    </a>

<table width="590" border="0" align="center" cellpadding="4" cellspacing="0" class="table table-striped" style="border: 1px solid #CCC;">
  <tr>
    <th colspan="2" ><b >Particular</b></th>
    <th width="75" >&nbsp;</th>
     <th colspan="2" ><b >Beneficencia</b></th>
    <th width="75" >&nbsp;</th>
    <th colspan="2" ><b >Aseguradora</b></th>
  </tr>
  <tr>
    <td width="137" ><span >Cargos</span></td>
    <td width="75"><span >
      <?php 
                    $sSQLpartc = "Select sum(cantidadParticular*cantidad) as totalParticular, sum(ivaParticular*cantidad) as totalIVA From cargosCuentaPaciente WHERE entidad='" . $entidad . "' and folioVenta = '" . $_GET['folioVenta'] . "' \r\nand\r\nnaturaleza='C'\r\nand\r\ngpoProducto!=''\r\n ";
                    $resultpartc = mysql_db_query($basedatos, $sSQLpartc);
                    $myrowpartc = mysql_fetch_array($resultpartc);
                    $sSQLparta = "Select sum(cantidadParticular*cantidad) as totalParticular, sum(ivaParticular*cantidad) as totalIVA From cargosCuentaPaciente WHERE entidad='" . $entidad . "' and folioVenta = '" . $_GET['folioVenta'] . "' \r\nand\r\nnaturaleza='A'\r\nand\r\ngpoProducto!=''\r\n ";
                    $resultparta = mysql_db_query($basedatos, $sSQLparta);
                    $myrowparta = mysql_fetch_array($resultparta);
                    echo '$' . number_format($myrowpartc['totalParticular'] - $myrowparta['totalParticular'], 2);
                    ?>
    </span></td>
    <td>&nbsp;</td>
    
    
        <td width="137" ><span >Cargos</span></td>
    <td width="75"><span >
      <?php 
                    $sSQLbenec = "Select sum(cantidadBeneficencia*cantidad) as totalParticular, sum(ivaBeneficencia*cantidad) as totalIVA From cargosCuentaPaciente WHERE entidad='" . $entidad . "' and folioVenta = '" . $_GET['folioVenta'] . "' \r\nand\r\nnaturaleza='C'\r\nand\r\ngpoProducto!=''\r\n ";
                    $resultbenec = mysql_db_query($basedatos, $sSQLbenec);
                    $myrowbenec = mysql_fetch_array($resultbenec);
                    $sSQLbenea = "Select sum(cantidadBeneficencia*cantidad) as totalParticular, sum(ivaBeneficencia*cantidad) as totalIVA From cargosCuentaPaciente WHERE entidad='" . $entidad . "' and folioVenta = '" . $_GET['folioVenta'] . "' \r\nand\r\nnaturaleza='A'\r\nand\r\ngpoProducto!=''\r\n ";
                    $resultbenea = mysql_db_query($basedatos, $sSQLbenea);
                    $myrowbenea = mysql_fetch_array($resultbenea);
                    echo '$' . number_format($myrowbenec['totalParticular'] - $myrowbenea['totalParticular'], 2);
                    ?>
    </span></td>
    <td>&nbsp;</td>
    
    
    
    
    
    
    
    
    
    
    
    
    <td width="116"><span >Cargos</span></td>
    <td width="153"><span >
      <?php 
                    $sSQLasegc = "Select sum(cantidadAseguradora*cantidad) as totalAseguradora, sum(ivaAseguradora*cantidad) as totalIVA From cargosCuentaPaciente WHERE entidad='" . $entidad . "' and folioVenta = '" . $_GET['folioVenta'] . "' \r\nand\r\nnaturaleza='C'\r\nand\r\ngpoProducto!=''\r\n ";
                    $resultasegc = mysql_db_query($basedatos, $sSQLasegc);
                    $myrowasegc = mysql_fetch_array($resultasegc);
                    $sSQLasega = "Select sum(cantidadAseguradora*cantidad) as totalAseguradora, sum(ivaAseguradora*cantidad) as totalIVA \r\n    From cargosCuentaPaciente WHERE entidad='" . $entidad . "' and folioVenta = '" . $_GET['folioVenta'] . "' \r\nand\r\nnaturaleza='A'\r\nand\r\ngpoProducto!=''\r\n ";
                    $resultasega = mysql_db_query($basedatos, $sSQLasega);
                    $myrowasega = mysql_fetch_array($resultasega);
                    echo '$' . number_format($myrowasegc['totalAseguradora'] - $myrowasega['totalAseguradora'], 2);
                    ?>
    </span></td>
    
    
    
    
  </tr>
  
  
  
  
  
  
  
  
  
  
  
  
  
  <tr>
    <td><span >IVA</span></td>
    <td><span ><?php 
                    echo '$' . number_format($myrowpartc['totalIVA'] - $myrowparta['totalIVA'], 2);
                    ?>
</span></td>
    <td>&nbsp;</td>
    <td><span >IVA</span></td>
    <td><span ><?php 
                    echo '$' . number_format($myrowbenec['totalIVA'] - $myrowbenea['totalIVA'], 2);
                    ?>
</span></td>
    <td>&nbsp;</td>
    <td><span >IVA</span></td>
    <td><span ><?php 
                    echo '$' . number_format($myrowasegc['totalIVA'] - $myrowasega['totalIVA'], 2);
                    ?>
</span></td>
  </tr>
  
  
  
  
  
  <tr>
    <td><span >Total</span></td>
    <td><span ><?php 
                    echo '$' . number_format($myrowpartc['totalParticular'] + $myrowpartc['totalIVA'] - ($myrowparta['totalParticular'] + $myrowparta['totalIVA']), 2);
                    ?>
</span></td>
    <td>&nbsp;</td>
    
    <td><span >Total</span></td>
    <td><span ><?php 
                    echo '$' . number_format($myrowbenec['totalParticular'] + $myrowbenec['totalIVA'] - ($myrowbenea['totalParticular'] + $myrowbenea['totalIVA']), 2);
                    ?>
</span></td>
    <td>&nbsp;</td>
    
    
    
    <td><span >Total</span></td>
    <td><span ><?php 
                    echo '$' . number_format($myrowasegc['totalAseguradora'] + $myrowasegc['totalIVA'] - ($myrowasega['totalAseguradora'] + $myrowasega['totalIVA']), 2);
                    ?>
</span></td>
  </tr>
</table>

<p>&nbsp;</p>
<table width="900" class="table table-striped" style="border: 1px solid #CCC;">

  <tr >
    <th width="76"  ><div align="center">Part</div></th>
    <th width="76"  ><div align="center">Aseg</div></th>
    <th width="111"  ><div align="center">Regreso Aseg</div></th>
    <th width="104"  ><div align="center">Regreso Part </div></th>
    <th width="89"  ><div align="center">C1</div></th>
    <th width="100"  ><div align="center">C2</div></th>
    <th width="95"  ><div align="center">D1</div></th>
    <th width="88"  ><div align="center">D2</div></th>
    <th width="77"  ><div align="center">Desc Part </div></th>
    <th width="84"  ><div align="center">Desc Aseg </div></th>
    <th width="84"  ><div align="center">Beneficencia</div></th>
  </tr>
  <tr  >
    <td height="48"  ><div align="center"><span >
<?php 
                    //************************PARTICULARES**********************************************************************
                    //CARGOS PARTICULARES REFERENCIAS
                    /* if($myrow['naturaleza']=='C'  and $myrow['statusRegreso']!='si'){ 
                    $cargoParticular[0]+=($myrow['cantidadParticular']*$myrow['cantidad'])+($myrow['ivaParticular']*$myrow['cantidad']);
                    }
                    
                    //ABONOS
                    if($myrow['naturaleza']=='A' and $myrow['gpoProducto']==''){
                    $abonoParticular[0]+=($myrow['cantidadParticular']*$myrow['cantidad'])+($myrow['ivaParticular']*$myrow['cantidad']);
                    }
                    
                    
                    //DEVOLUCIONES
                    if($myrow['naturaleza']=='A' and $myrow['statusDevolucion']=='si'){
                    $devolucionParticular[0]+=($myrow['cantidadParticular']*$myrow['cantidad'])+($myrow['ivaParticular']*$myrow['cantidad']);
                    }
                    
                    //REGRESO DE EFECTIVO
                    if($myrow['naturaleza']=='C' and $myrow['statusRegreso']=='si'){ 
                    $regresoParticular[0]+=($myrow['cantidadParticular']*$myrow['cantidad'])+($myrow['ivaParticular']*$myrow['cantidad']);
                    } */
                    //******************************************************************************************
                    /* //*************CARGOS*************
                    $sPc="SELECT 
                    sum((cantidadParticular*cantidad) +(ivaParticular*cantidad) as cargoParticular
                    FROM
                    cargosCuentaPaciente
                    WHERE
                    entidad='".$entidad."'
                    and
                    folioVenta='".$_GET['folioVenta']."'
                    and
                    gpoProducto!=''
                    and
                    naturaleza='C'  ";
                    $rPc=mysql_db_query($basedatos,$sPc);
                    $mPc = mysql_fetch_array($rPc);
                    //**************************************
                    
                    //****************ABONOS************
                    
                    $sPa="SELECT 
                    sum((cantidadParticular*cantidad) +(ivaParticular*cantidad) as abonoParticular
                    FROM
                    cargosCuentaPaciente
                    WHERE
                    entidad='".$entidad."'
                    and
                    folioVenta='".$_GET['folioVenta']."'
                    and
                    gpoProducto=''
                    and
                    naturaleza='A'  ";
                    $rPa=mysql_db_query($basedatos,$sPa);
                    $mPa = mysql_fetch_array($rPa);
                    //*************************************
                    
                    
                    //*******************DEVOLUCIONES**************
                    $sPd="SELECT 
                    sum((cantidadParticular*cantidad) +(ivaParticular*cantidad) as devolucionParticular
                    FROM
                    cargosCuentaPaciente
                    WHERE
                    entidad='".$entidad."'
                    and
                    folioVenta='".$_GET['folioVenta']."'
                    and
                    gpoProducto!=''
                    and
                    naturaleza='A' 
                    and
                    statusDevolucion='si'
                     ";
                    $rPd=mysql_db_query($basedatos,$sPd);
                    $mPd = mysql_fetch_array($rPd);
                    //*************************************************************	  
                      
                      
                      
                    //*****************REGRESO*********************  
                    $sPr="SELECT 
                    sum((cantidadParticular*cantidad) +(ivaParticular*cantidad) as regresoParticular
                    FROM
                    cargosCuentaPaciente
                    WHERE
                    entidad='".$entidad."'
                    and
                    folioVenta='".$_GET['folioVenta']."'
                    and
                    gpoProducto!=''
                    and
                    naturaleza='C'  
                    and
                    statusRegreso='si'
                    ";
                    $rPr=mysql_db_query($basedatos,$sPr);
                    $mPr = mysql_fetch_array($rPr);
                    //**************************************************
                    
                    
                    //*****************REGRESO*********************  
                    $sPdes="SELECT 
                    sum((cantidadParticular*cantidad) +(ivaParticular*cantidad) as descuentoParticular
                    FROM
                    cargosCuentaPaciente
                    WHERE
                    entidad='".$entidad."'
                    and
                    folioVenta='".$_GET['folioVenta']."'
                    and
                    gpoProducto!=''
                    and
                    naturaleza='A'  
                    and
                    statusDescuento='si'
                    ";
                    $rPdes=mysql_db_query($basedatos,$sPdes);
                    $mPdes = mysql_fetch_array($rPdes);
                    //**************************************************
                    
                    
                      
                     $totalParticular= $mPc['cargoParticular']-$mPa['abonoParticular']-$mPd['devolucionParticular']-$mPr['regresoParticular']-$mPdes['descuentoParticular'];
                    //***********************************************  ****************************************************************************** */
                    if ($totalParticular >= 1 || ($myrow3['statusDevolucion'] == 'si' and $descuentoP < 1 and $descuentoA < 1)) {
                        if ($myrow3['statusCortesia'] == 'si') {
                            $tipoPago = 'Cortesia';
                        } else {
                            if ($myrow3['tipoPaciente'] == 'externo' or ($myrow3['tipoPaciente'] == 'interno' or $myrow3['tipoPaciente'] == 'urgencias') and $myrow3['statusDevolucion'] == 'si') {
                                if ($devolucionParticular[0] > 0 and $myrow3['statusDevolucion'] == 'si') {
                                    $tipoDevolucion = '';
                                    $tipoPago = '';
                                    if ($totalParticular < 0) {
                                        $totalParticular *= -1;
                                    }
                                } else {
                                    $s = "Select codigoTT From catTTCaja WHERE  pagoEfectivo='si'";
                                    $rs = mysql_db_query($basedatos, $s);
                                    $my = mysql_fetch_array($rs);
                                    $tipoPago = 'Efectivo';
                                }
                            } elseif ($myrow3['activaBeneficencia'] == 'si') {
                                $s = "Select codigoTT From catTTCaja WHERE  trasladoBeneficencia='si'";
                                $rs = mysql_db_query($basedatos, $s);
                                $my = mysql_fetch_array($rs);
                                $tipoPago = 'Beneficencia';
                                $caso = 1;
                            } else {
                                $s = "Select codigoTT From catTTCaja WHERE  gastosParticulares='si'";
                                $rs = mysql_db_query($basedatos, $s);
                                $my = mysql_fetch_array($rs);
                                $tipoPago = 'Efectivo';
                            }
                        }
                        ?>
      <?php 
                        if ($mostrar == TRUE) {
                            ?>


<?php 
                            if ($totalParticular > 0 and $totalParticular > -1) {
                                ?>
<a  href="javascript:nueva('<?php 
                                echo CONSTANT_PATH_SIMA_RAIZ;
                                ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                                echo $_GET['usuario'];
                                ?>
&amp;numeroE=<?php 
                                echo $numeroE;
                                ?>
&amp;almacen=<?php 
                                echo $_GET['almacenSolicitante'];
                                ?>
&amp;almacenFuente=<?php 
                                echo $almacen;
                                ?>
&amp;seguro=<?php 
                                echo $seguroT;
                                ?>
&amp;nCuenta=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;tipoCliente=<?php 
                                echo 'particular';
                                ?>
&amp;tipoVenta=<?php 
                                echo $folioVENTA;
                                ?>
&amp;folioVenta=<?php 
                                echo $myrow3['folioVenta'];
                                ?>
&amp;keyClientesInternos=<?php 
                                echo $keyClientesInternos;
                                ?>
&amp;rand=<?php 
                                echo rand(1000, 10000000);
                                ?>
&amp;paquete=<?php 
                                echo $_GET['paquete'];
                                ?>
&amp;transaccion=particular&amp;precioVenta=<?php 
                                echo $totalParticular;
                                ?>
&amp;modoPago=<?php 
                                if ($_GET['devolucion'] == 'si') {
                                    echo 'devolucionParticular';
                                } else {
                                    echo 'efectivo';
                                }
                                ?>
&amp;tipoTransaccion=particular&amp;tipoPago=<?php 
                                echo $tipoPago;
                                ?>
&descripcionTransaccion=<?php 
                                echo $descripcionTransaccion;
                                ?>
&status=<?php 
                                echo $myrow3['status'];
                                ?>
&statusCortesia=<?php 
                                echo $myrow3['statusCortesia'];
                                ?>
&tipoDevolucion=<?php 
                                echo $tipoDevolucion;
                                ?>
&beneficencia=<?php 
                                if ($myrow3['activaBeneficencia'] == 'si') {
                                    echo 'si';
                                }
                                ?>
&statusBeneficencia=<?php 
                                if ($myrow3['activaBeneficencia'] == 'si') {
                                    echo 'si';
                                }
                                ?>
&activaBeneficencia=<?php 
                                if ($myrow3['activaBeneficencia'] == 'si') {
                                    echo 'si';
                                }
                                ?>
&caso=<?php 
                                echo $caso;
                                ?>
','ventana7','680','380','yes');">
<?php 
                                echo '$' . number_format($totalParticular, 2);
                                ?>
</a>
<?php 
                            } else {
                                echo '<img src="' . CONSTANT_PATH_SIMA_RAIZ . '/imagenes/btns/checkbtn.png" width="18" height="18" />';
                            }
                            ?>



      <?php 
                        } else {
                            echo '$' . number_format($totalParticular, 2);
                        }
                        ?>
      <?php 
                    } else {
                        ?>
      <img src="<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                    }
                    ?>
    </span></div></td>
    <td  ><div align="center"><span >






<?php 
                    //********************************cANTIDAD ASEGURADORA****************************************
                    //*********************REFERENCIA*****************/
                    /* //CARGOS ASEGURADORA 
                    if($myrow['naturaleza']=='C'  and $myrow['statusRegreso']!='si'){
                    $cargoAseguradora[0]+=($myrow['cantidadAseguradora']*$myrow['cantidad'])+($myrow['ivaAseguradora']*$myrow['cantidad']);
                    }
                    
                    //ABONOS
                    if($myrow['naturaleza']=='A' and $myrow['gpoProducto']==''){
                    $abonoAseguradora[0]+=($myrow['cantidadAseguradora']*$myrow['cantidad'])+($myrow['ivaAseguradora']*$myrow['cantidad']);
                    }
                    
                    
                    //DEVOLUCIONES
                    if($myrow['naturaleza']=='A' and $myrow['statusDevolucion']=='si'){ 
                    $devolucionAseguradora[0]+=($myrow['cantidadAseguradora']*$myrow['cantidad'])+($myrow['ivaAseguradora']*$myrow['cantidad']);
                    }
                    
                    //REGRESO DE TRASLADO
                    if($myrow['naturaleza']=='C' and $myrow['statusRegreso']=='si'){
                    $regresoAseguradora[0]+=($myrow['cantidadAseguradora']*$myrow['cantidad'])+($myrow['ivaAseguradora']*$myrow['cantidad']);
                    }
                     */
                    /* 
                    //*************CARGOS*************
                    $sAc="SELECT 
                    sum((cantidadAseguradora*cantidad) +(ivaAseguradora*cantidad) as cargoAseguradora
                    FROM
                    cargosCuentaPaciente
                    WHERE
                    entidad='".$entidad."'
                    and
                    folioVenta='".$_GET['folioVenta']."'
                    and
                    gpoProducto!=''
                    and
                    naturaleza='C'  ";
                    $rAc=mysql_db_query($basedatos,$sAc);
                    $mAc = mysql_fetch_array($rAc);
                    //**************************************
                    
                    //****************ABONOS************
                    
                    $sAa="SELECT 
                    sum((cantidadAseguradora*cantidad) +(ivaAseguradora*cantidad) as abonoAseguradora
                    FROM
                    cargosCuentaPaciente
                    WHERE
                    entidad='".$entidad."'
                    and
                    folioVenta='".$_GET['folioVenta']."'
                    and
                    gpoProducto=''
                    and
                    naturaleza='A'  ";
                    $rAa=mysql_db_query($basedatos,$sAa);
                    $mAa = mysql_fetch_array($rAa);
                    //*************************************
                    
                    
                    //*******************DEVOLUCIONES**************
                    $sAd="SELECT 
                    sum((cantidadAseguradora*cantidad) +(ivaAseguradora*cantidad) as devolucionAseguradora
                    FROM
                    cargosCuentaPaciente
                    WHERE
                    entidad='".$entidad."'
                    and
                    folioVenta='".$_GET['folioVenta']."'
                    and
                    gpoProducto!=''
                    and
                    naturaleza='A' 
                    and
                    statusDevolucion='si'
                    ";
                    $rAd=mysql_db_query($basedatos,$sAd);
                    $mAd = mysql_fetch_array($rAd);
                    //*************************************************************	  
                     
                     
                     
                    //*****************REGRESO*********************  
                    $sAr="SELECT 
                    sum((cantidadAseguradora*cantidad) +(ivaAseguradora*cantidad) as regresoAseguradora
                    FROM
                    cargosCuentaPaciente
                    WHERE
                    entidad='".$entidad."'
                    and
                    folioVenta='".$_GET['folioVenta']."'
                    and
                    gpoProducto!=''
                    and
                    naturaleza='C'  
                    and
                    statusRegreso='si'
                    ";
                    $rAr=mysql_db_query($basedatos,$sAr);
                    $mAr = mysql_fetch_array($rAr);
                    //**************************************************
                    
                    
                    //*****************REGRESO*********************  
                    $sdes="SELECT 
                    sum((cantidadAseguradora*cantidad) +(ivaAseguradora*cantidad) as descuentoAseguradora
                    FROM
                    cargosCuentaPaciente
                    WHERE
                    entidad='".$entidad."'
                    and
                    folioVenta='".$_GET['folioVenta']."'
                    and
                    gpoProducto!=''
                    and
                    naturaleza='A'  
                    and
                    statusDescuento='si'
                    ";
                    $rPdes=mysql_db_query($basedatos,$sPdes);
                    $mPdes = mysql_fetch_array($rPdes);
                    //**************************************************
                    
                    
                     
                    $totalParticular= $mPc['cargoParticular']-$mPa['abonoParticular']-$mPd['devolucionParticular']-$mPr['regresoParticular']-$mPdes['descuentoParticular'];
                    //***********************************************  ******************************************************************************
                    */
                    //**************************************************************************************************
                    if ($totalAseguradora >= 1 || $myrow3['statusDevolucion'] == 'si') {
                        if ($devolucionAseguradora[0] > 0 and $myrow3['statusDevolucion'] == 'si') {
                            $s = "Select codigoTT From catTTCaja WHERE  devolucionAseguradora='si'";
                            $rs = mysql_db_query($basedatos, $s);
                            $my = mysql_fetch_array($rs);
                            if ($totalAseguradora < 0) {
                                $totalAseguradora *= -1;
                            }
                            $tipoPago = '';
                        } else {
                            $s = "Select codigoTT From catTTCaja WHERE  trasladoAseguradora='si'";
                            $rs = mysql_db_query($basedatos, $s);
                            $my = mysql_fetch_array($rs);
                            $tipoPago = 'Cuentas por Cobrar';
                        }
                        ?>







      <?php 
                        if ($totalCoaseguro1 < 1 and $totalCoaseguro2 < 1 and $totalDeducible1 < 1 and $totalDeducible2 < 1 and $descuentoP < 1 and $descuentoA < 1) {
                            ?>
      <?php 
                            if ($mostrar == TRUE) {
                                ?>
	  
	  
	  
	  <?php 
                                if ($totalAseguradora > -1 and $totalAseguradora > 0) {
                                    ?>
      <a href="javascript:nueva('<?php 
                                    echo CONSTANT_PATH_SIMA_RAIZ;
                                    ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                                    echo $_GET['usuario'];
                                    ?>
&amp;numeroE=<?php 
                                    echo $numeroE;
                                    ?>
&amp;almacen=<?php 
                                    echo $_GET['almacenSolicitante'];
                                    ?>
&amp;almacenFuente=<?php 
                                    echo $almacen;
                                    ?>
&amp;seguro=<?php 
                                    echo $seguroT;
                                    ?>
&amp;nCuenta=<?php 
                                    echo $keyClientesInternos;
                                    ?>
&amp;tipoCliente=<?php 
                                    echo 'particular';
                                    ?>
&amp;tipoVenta=<?php 
                                    echo $folioVENTA;
                                    ?>
&amp;folioVenta=<?php 
                                    echo $myrow3['folioVenta'];
                                    ?>
&amp;keyClientesInternos=<?php 
                                    echo $keyClientesInternos;
                                    ?>
&amp;rand=<?php 
                                    echo rand(1000, 10000000);
                                    ?>
&amp;paquete=<?php 
                                    echo $_GET['paquete'];
                                    ?>
&amp;precioVenta=<?php 
                                    echo $totalAseguradora;
                                    ?>
&amp;modoPago=<?php 
                                    if ($_GET['devolucion'] == 'si') {
                                        echo 'devolucionAseguradora';
                                    } else {
                                        echo 'cxc';
                                    }
                                    ?>
&amp;transaccion=<?php 
                                    echo $my['codigoTT'];
                                    ?>
&amp;tipoTransaccion=aseguradora&amp;tipoPago=<?php 
                                    echo $tipoPago;
                                    ?>
&amp;devolucion=<?php 
                                    echo $_GET['devolucion'];
                                    ?>
&descripcionTransaccion=<?php 
                                    echo $descripcionTransaccion;
                                    ?>
&status=<?php 
                                    echo $myrow3['status'];
                                    ?>
','ventana7','800','380','yes');"> <?php 
                                    echo '$' . number_format($totalAseguradora, 2);
                                    ?>
</a>
      <?php 
                                } else {
                                    echo '<img src="' . CONSTANT_PATH_SIMA_RAIZ . '/imagenes/btns/checkbtn.png" width="18" height="18" />';
                                }
                                ?>





      <?php 
                            } else {
                                echo '$' . number_format($totalAseguradora, 2);
                            }
                            ?>
      <?php 
                        } else {
                            ?>
      <?php 
                            echo '$' . number_format($totalAseguradora, 2);
                            ?>
      <?php 
                        }
                        ?>
      <?php 
                    } else {
                        ?>
      <img src="<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                    }
                    ?>
    </span></div></td>

















  
<td  >
<div align="center"><span >
<?php 
                    if ($totalAseguradora < -1 and $devolucionAseguradora[0] < 1) {
                        $tA = $totalAseguradora * -1;
                        ?>
      <?php 
                        if ($mostrar == TRUE) {
                            ?>
      <a href="javascript:nueva('<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                            echo $_GET['usuario'];
                            ?>
&amp;numeroE=<?php 
                            echo $numeroE;
                            ?>
&amp;almacen=<?php 
                            echo $_GET['almacenSolicitante'];
                            ?>
&amp;almacenFuente=<?php 
                            echo $almacen;
                            ?>
&amp;seguro=<?php 
                            echo $seguroT;
                            ?>
&amp;nCuenta=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;tipoCliente=<?php 
                            echo 'particular';
                            ?>
&amp;tipoVenta=<?php 
                            echo $folioVENTA;
                            ?>
&amp;folioVenta=<?php 
                            echo $myrow3['folioVenta'];
                            ?>
&amp;keyClientesInternos=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;rand=<?php 
                            echo rand(1000, 10000000);
                            ?>
&amp;paquete=<?php 
                            echo $_GET['paquete'];
                            ?>
&amp;transaccion=regreso&amp;precioVenta=<?php 
                            echo $tA;
                            ?>
&amp;modoPago=regresoAseguradora&amp;tipoTransaccion=particular&amp;tipoPago=regresoAseguradora&descripcionTransaccion=<?php 
                            echo $descripcionTransaccion;
                            ?>
&status=<?php 
                            echo $myrow3['status'];
                            ?>
','ventana7','400','800','yes');"> </a></span></div>      <span ><a href="javascript:nueva('<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                            echo $_GET['usuario'];
                            ?>
&amp;numeroE=<?php 
                            echo $numeroE;
                            ?>
&amp;almacen=<?php 
                            echo $_GET['almacenSolicitante'];
                            ?>
&amp;almacenFuente=<?php 
                            echo $almacen;
                            ?>
&amp;seguro=<?php 
                            echo $seguroT;
                            ?>
&amp;nCuenta=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;tipoCliente=<?php 
                            echo 'particular';
                            ?>
&amp;tipoVenta=<?php 
                            echo $folioVENTA;
                            ?>
&amp;folioVenta=<?php 
                            echo $myrow3['folioVenta'];
                            ?>
&amp;keyClientesInternos=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;rand=<?php 
                            echo rand(1000, 10000000);
                            ?>
&amp;paquete=<?php 
                            echo $_GET['paquete'];
                            ?>
&amp;transaccion=regreso&amp;precioVenta=<?php 
                            echo $tA;
                            ?>
&amp;modoPago=regresoAseguradora&amp;tipoTransaccion=particular&amp;tipoPago=regresoAseguradora&descripcionTransaccion=<?php 
                            echo $descripcionTransaccion;
                            ?>
&status=<?php 
                            echo $myrow3['status'];
                            ?>
','ventana7','400','800','yes');"><blink> 
      <div align="center"><?php 
                            echo '$' . number_format($tA, 2);
                            ?>
 </div>
      </blink></a>
      <div align="center">
        <?php 
                        } else {
                            echo '$' . number_format($tA, 2);
                        }
                        ?>
        <?php 
                    } else {
                        ?>
        <img src="<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
        <?php 
                    }
                    ?>
      </div>
</span>
</td>
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
    <td  ><div align="center"><span >
      <?php 
                    if ($totalParticular < -1) {
                        $tP = $totalParticular * -1;
                        ?>
      <?php 
                        if ($mostrar == TRUE) {
                            ?>
      <a href="javascript:nueva('<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                            echo $_GET['usuario'];
                            ?>
&amp;numeroE=<?php 
                            echo $numeroE;
                            ?>
&amp;almacen=<?php 
                            echo $_GET['almacenSolicitante'];
                            ?>
&amp;almacenFuente=<?php 
                            echo $almacen;
                            ?>
&amp;seguro=<?php 
                            echo $seguroT;
                            ?>
&amp;nCuenta=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;tipoCliente=<?php 
                            echo 'particular';
                            ?>
&amp;tipoVenta=<?php 
                            echo $folioVENTA;
                            ?>
&amp;folioVenta=<?php 
                            echo $myrow3['folioVenta'];
                            ?>
&amp;keyClientesInternos=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;rand=<?php 
                            echo rand(1000, 10000000);
                            ?>
&amp;paquete=<?php 
                            echo $_GET['paquete'];
                            ?>
&amp;transaccion=regreso&amp;precioVenta=<?php 
                            echo $tP;
                            ?>
&amp;modoPago=regresoParticular&amp;tipoTransaccion=particular&amp;tipoPago=regresoParticular&descripcionTransaccion=<?php 
                            echo $descripcionTransaccion;
                            ?>
&status=<?php 
                            echo $myrow3['status'];
                            ?>
','ventana7','400','800','yes');"></a></span></div>     
        <span >
            
<a href="javascript:nueva('<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                            echo $_GET['usuario'];
                            ?>
&amp;numeroE=<?php 
                            echo $numeroE;
                            ?>
&amp;almacen=<?php 
                            echo $_GET['almacenSolicitante'];
                            ?>
&amp;almacenFuente=<?php 
                            echo $almacen;
                            ?>
&amp;seguro=<?php 
                            echo $seguroT;
                            ?>
&amp;nCuenta=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;tipoCliente=<?php 
                            echo 'particular';
                            ?>
&amp;tipoVenta=<?php 
                            echo $folioVENTA;
                            ?>
&amp;folioVenta=<?php 
                            echo $myrow3['folioVenta'];
                            ?>
&amp;keyClientesInternos=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;rand=<?php 
                            echo rand(1000, 10000000);
                            ?>
&amp;paquete=<?php 
                            echo $_GET['paquete'];
                            ?>
&amp;transaccion=regreso&amp;precioVenta=<?php 
                            echo $tP;
                            ?>
&amp;modoPago=regresoParticular&amp;tipoTransaccion=particular&amp;tipoPago=regresoParticular&descripcionTransaccion=<?php 
                            echo $descripcionTransaccion;
                            ?>
&status=<?php 
                            echo $myrow3['status'];
                            ?>
','ventana7','400','800','yes');"><blink>
     <div align="center">
     <?php 
                            echo '$' . number_format($tP, 2);
                            ?>
     </div>
      </blink></a>
            
            
      <div align="center">
        <?php 
                        } else {
                            echo '$' . number_format($tP, 2);
                        }
                        ?>
        <?php 
                    } else {
                        ?>
        <img src="<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
        <?php 
                    }
                    ?>
      </div>
    </span></td>
    
    
    
    
    
    
    <td  ><div align="center"><span >
      <?php 
                    if ($totalCoaseguro1 >= 1) {
                        ?>
      <?php 
                        if ($mostrar == TRUE) {
                            ?>
      <a href="javascript:nueva('<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                            echo $_GET['usuario'];
                            ?>
&amp;numeroE=<?php 
                            echo $numeroE;
                            ?>
&amp;almacen=<?php 
                            echo $_GET['almacenSolicitante'];
                            ?>
&amp;almacenFuente=<?php 
                            echo $almacen;
                            ?>
&amp;seguro=<?php 
                            echo $seguroT;
                            ?>
&amp;nCuenta=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;tipoCliente=<?php 
                            echo 'particular';
                            ?>
&amp;tipoVenta=<?php 
                            echo $folioVENTA;
                            ?>
&amp;folioVenta=<?php 
                            echo $myrow3['folioVenta'];
                            ?>
&amp;keyClientesInternos=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;rand=<?php 
                            echo rand(1000, 10000000);
                            ?>
&amp;paquete=<?php 
                            echo $_GET['paquete'];
                            ?>
&amp;transaccion=<?php 
                            echo $coaseguro1;
                            ?>
&amp;precioVenta=<?php 
                            echo $totalCoaseguro1;
                            ?>
&amp;modoPago=efectivo&amp;tipoTransaccion=coaseguro&amp;numCoaseguro=PCoaS1&amp;tipoPago=Efectivo&descripcionTransaccion=<?php 
                            echo $descripcionTransaccion;
                            ?>
&status=<?php 
                            echo $myrow3['status'];
                            ?>
','ventana7','480','380','yes');"> <?php 
                            echo '$' . number_format($totalCoaseguro1, 2);
                            ?>
</a>
      <?php 
                        } else {
                            echo '$' . number_format($totalCoaseguro1, 2);
                        }
                        ?>
      <?php 
                    } else {
                        ?>
      <img src="<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                    }
                    ?>
    </span></div></td>
    
    
    
    
    
    
    
    <td  ><div align="center"><span >
      <?php 
                    if ($totalCoaseguro2 >= 1) {
                        ?>
      <?php 
                        if ($mostrar == TRUE) {
                            ?>
      <a href="javascript:nueva('<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                            echo $_GET['usuario'];
                            ?>
&amp;numeroE=<?php 
                            echo $numeroE;
                            ?>
&amp;almacen=<?php 
                            echo $_GET['almacenSolicitante'];
                            ?>
&amp;almacenFuente=<?php 
                            echo $almacen;
                            ?>
&amp;seguro=<?php 
                            echo $seguroT;
                            ?>
&amp;nCuenta=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;tipoCliente=<?php 
                            echo 'particular';
                            ?>
&amp;tipoVenta=<?php 
                            echo $folioVENTA;
                            ?>
&amp;folioVenta=<?php 
                            echo $myrow3['folioVenta'];
                            ?>
&amp;keyClientesInternos=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;rand=<?php 
                            echo rand(1000, 10000000);
                            ?>
&amp;paquete=<?php 
                            echo $_GET['paquete'];
                            ?>
&amp;transaccion=<?php 
                            echo $coaseguro2;
                            ?>
&amp;precioVenta=<?php 
                            echo $totalCoaseguro2;
                            ?>
&amp;modoPago=efectivo&amp;tipoTransaccion=coaseguro&amp;numCoaseguro=PCoaS2&amp;tipoPago=Efectivo&descripcionTransaccion=<?php 
                            echo $descripcionTransaccion;
                            ?>
&status=<?php 
                            echo $myrow3['status'];
                            ?>
','ventana7','480','380','yes');"> <?php 
                            echo '$' . number_format($totalCoaseguro2, 2);
                            ?>
</a>
      <?php 
                        } else {
                            echo '$' . number_format($totalCoaseguro2, 2);
                        }
                        ?>
      <?php 
                    } else {
                        ?>
      <img src="<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                    }
                    ?>
    </span></div></td>
    
    
    
    
    
    
    
    <td  ><div align="center"><span >
      <?php 
                    if ($totalDeducible1 >= 1) {
                        ?>
      <?php 
                        if ($mostrar == TRUE) {
                            ?>
      <a href="javascript:nueva('<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                            echo $_GET['usuario'];
                            ?>
&amp;numeroE=<?php 
                            echo $numeroE;
                            ?>
&amp;almacen=<?php 
                            echo $_GET['almacenSolicitante'];
                            ?>
&amp;almacenFuente=<?php 
                            echo $almacen;
                            ?>
&amp;seguro=<?php 
                            echo $seguroT;
                            ?>
&amp;nCuenta=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;tipoCliente=<?php 
                            echo 'particular';
                            ?>
&amp;tipoVenta=<?php 
                            echo $folioVENTA;
                            ?>
&amp;folioVenta=<?php 
                            echo $myrow3['folioVenta'];
                            ?>
&amp;keyClientesInternos=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;rand=<?php 
                            echo rand(1000, 10000000);
                            ?>
&amp;paquete=<?php 
                            echo $_GET['paquete'];
                            ?>
&amp;transaccion=<?php 
                            echo $deducible1;
                            ?>
&amp;precioVenta=<?php 
                            echo $totalDeducible1;
                            ?>
&amp;modoPago=efectivo&amp;tipoTransaccion=coaseguro&amp;numCoaseguro=PDeduSeg1&amp;tipoPago=Efectivo&descripcionTransaccion=<?php 
                            echo $descripcionTransaccion;
                            ?>
&status=<?php 
                            echo $myrow3['status'];
                            ?>
','ventana7','480','380','yes');"> <?php 
                            echo '$' . number_format($totalDeducible1, 2);
                            ?>
</a>
      <?php 
                        } else {
                            echo '$' . number_format($totalDeducible1, 2);
                        }
                        ?>
      <?php 
                    } else {
                        ?>
      <img src="<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                    }
                    ?>
    </span></div></td>
    
    
    
    
    
    
    <td  ><div align="center"><span >
      <?php 
                    if ($totalDeducible2 >= 1) {
                        ?>
      <?php 
                        if ($mostrar == TRUE) {
                            ?>
      <a href="javascript:nueva('<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                            echo $_GET['usuario'];
                            ?>
&amp;numeroE=<?php 
                            echo $numeroE;
                            ?>
&amp;almacen=<?php 
                            echo $_GET['almacenSolicitante'];
                            ?>
&amp;almacenFuente=<?php 
                            echo $almacen;
                            ?>
&amp;seguro=<?php 
                            echo $seguroT;
                            ?>
&amp;nCuenta=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;tipoCliente=<?php 
                            echo 'particular';
                            ?>
&amp;tipoVenta=<?php 
                            echo $folioVENTA;
                            ?>
&amp;folioVenta=<?php 
                            echo $myrow3['folioVenta'];
                            ?>
&amp;keyClientesInternos=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;rand=<?php 
                            echo rand(1000, 10000000);
                            ?>
&amp;paquete=<?php 
                            echo $_GET['paquete'];
                            ?>
&amp;transaccion=<?php 
                            echo $deducible2;
                            ?>
&amp;precioVenta=<?php 
                            echo $totalDeducible2;
                            ?>
&amp;modoPago=efectivo&amp;tipoTransaccion=coaseguro&amp;numCoaseguro=PDeduSeg2&amp;tipoPago=Efectivo&descripcionTransaccion=<?php 
                            echo $descripcionTransaccion;
                            ?>
&status=<?php 
                            echo $myrow3['status'];
                            ?>
','ventana7','480','380','yes');"> <?php 
                            echo '$' . number_format($totalDeducible2, 2);
                            ?>
</a>
      <?php 
                        } else {
                            echo '$' . number_format($totalDeducible2, 2);
                        }
                        ?>
      <?php 
                    } else {
                        ?>
      <img src="<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                    }
                    ?>
    </span></div></td>
    
    
    
    
    
    
    
    <td  >
        <div align="center">
            <span >
      <?php 
                    if ($descuentoP >= 1) {
                        ?>
      <?php 
                        if ($mostrar == TRUE) {
                            ?>
      <a href="javascript:nueva('<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                            echo $_GET['usuario'];
                            ?>
&amp;numeroE=<?php 
                            echo $numeroE;
                            ?>
&amp;almacen=<?php 
                            echo $_GET['almacenSolicitante'];
                            ?>
&amp;almacenFuente=<?php 
                            echo $almacen;
                            ?>
&amp;seguro=<?php 
                            echo $seguroT;
                            ?>
&amp;nCuenta=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;tipoCliente=<?php 
                            echo 'particular';
                            ?>
&amp;tipoVenta=<?php 
                            echo $folioVENTA;
                            ?>
&amp;folioVenta=<?php 
                            echo $myrow3['folioVenta'];
                            ?>
&amp;keyClientesInternos=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;rand=<?php 
                            echo rand(1000, 10000000);
                            ?>
&amp;paquete=<?php 
                            echo $_GET['paquete'];
                            ?>
&amp;transaccion=<?php 
                            echo $descuentoParticular;
                            ?>
&amp;precioVenta=<?php 
                            echo $descuentoP;
                            ?>
&amp;modoPago=descuentos&amp;tipoPago=descuentos&amp;descuento=particular&descripcionTransaccion=<?php 
                            echo $descripcionTransaccion;
                            ?>
&status=<?php 
                            echo $myrow3['status'];
                            ?>
','ventana7','480','380','yes');"> 
    <?php 
                            echo '<span class="precio1"><blink>$' . number_format($descuentoP, 2) . '</blink></span>';
                            ?>
      </a>
      <?php 
                        } else {
                            echo '$' . number_format($descuentoP, 2);
                        }
                        ?>
      <?php 
                    } else {
                        ?>
      <img src="<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                    }
                    ?>
    </span></div></td>
    
    
    
    
    
    
    <td  ><div align="center"><span >
      <?php 
                    if ($descuentoA >= 1) {
                        ?>
      <?php 
                        if ($mostrar == TRUE) {
                            ?>
      <a href="javascript:nueva('<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                            echo $_GET['usuario'];
                            ?>
&amp;numeroE=<?php 
                            echo $numeroE;
                            ?>
&amp;almacen=<?php 
                            echo $_GET['almacenSolicitante'];
                            ?>
&amp;almacenFuente=<?php 
                            echo $almacen;
                            ?>
&amp;seguro=<?php 
                            echo $seguroT;
                            ?>
&amp;nCuenta=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;tipoCliente=<?php 
                            echo 'particular';
                            ?>
&amp;tipoVenta=<?php 
                            echo $folioVENTA;
                            ?>
&amp;folioVenta=<?php 
                            echo $myrow3['folioVenta'];
                            ?>
&amp;keyClientesInternos=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;rand=<?php 
                            echo rand(1000, 10000000);
                            ?>
&amp;paquete=<?php 
                            echo $_GET['paquete'];
                            ?>
&amp;transaccion=<?php 
                            echo $descuentoAseguradora;
                            ?>
&amp;precioVenta=<?php 
                            echo $descuentoA;
                            ?>
&amp;modoPago=descuentos&amp;tipoPago=descuentos&amp;descuento=aseguradora&descripcionTransaccion=<?php 
                            echo $descripcionTransaccion;
                            ?>
&status=<?php 
                            echo $myrow3['status'];
                            ?>
','ventana7','480','380','yes');"> 
    <?php 
                            echo '<span class="precio1"><blink>$' . number_format($descuentoA, 2) . '</blink></span>';
                            ?>
      </a>
      <?php 
                        } else {
                            echo '$' . number_format($descuentoA, 2);
                        }
                        ?>
      <?php 
                    } else {
                        ?>
      <img src="<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                    }
                    ?>
    </span></div></td>




    
    
    
    
<?php 
                    //*******************BENEFICENCIA
                    if ($ben != NULL and $ben < 0) {
                        $mp = 'devolucionBeneficencia';
                        $ben = $ben * -1;
                        $tpb = 'devolucionBeneficencia';
                    } else {
                        $mp = 'Beneficencia';
                        $tpb = 'Beneficencia';
                    }
                    ?>



     <td  ><div align="center"><span >
      <?php 
                    if ($ben != NULL) {
                        ?>
      <?php 
                        if ($mostrar == TRUE) {
                            ?>
      <a href="javascript:nueva('<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                            echo $_GET['usuario'];
                            ?>
&amp;numeroE=<?php 
                            echo $numeroE;
                            ?>
&amp;almacen=<?php 
                            echo $_GET['almacenSolicitante'];
                            ?>
&amp;almacenFuente=<?php 
                            echo $almacen;
                            ?>
&amp;seguro=<?php 
                            echo $seguroT;
                            ?>
&amp;nCuenta=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;tipoCliente=<?php 
                            echo 'particular';
                            ?>
&amp;tipoVenta=<?php 
                            echo $folioVENTA;
                            ?>
&amp;folioVenta=<?php 
                            echo $myrow3['folioVenta'];
                            ?>
&amp;keyClientesInternos=<?php 
                            echo $keyClientesInternos;
                            ?>
&amp;rand=<?php 
                            echo rand(1000, 10000000);
                            ?>
&amp;paquete=<?php 
                            echo $_GET['paquete'];
                            ?>
&amp;transaccion=<?php 
                            echo $transB;
                            ?>
&amp;precioVenta=<?php 
                            echo $ben;
                            ?>
&amp;modoPago=<?php 
                            echo $mp;
                            ?>
&amp;tipoPago=<?php 
                            echo $tpb;
                            ?>
&descripcionTransaccion=beneficencia&status=<?php 
                            echo $myrow3['status'];
                            ?>
&beneficencia=si&statusBeneficencia=si','ventana7','480','380','yes');"> <?php 
                            echo '$' . number_format($ben, 2);
                            ?>
</a>
      <?php 
                        } else {
                            echo '$' . number_format($ben, 2);
                        }
                        ?>
      <?php 
                    } else {
                        ?>
      <img src="<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/imagenes/btns/checkbtn.png" width="18" height="18" />
      <?php 
                    }
                    ?>
    </span></div></td>
  </tr>

</table>
<p>&nbsp;</p>
    
    
    
    
<?php 
                    //CIERRA MOSTRAR EFECTUAR TRANSACCIONES
                }
                ?>
  <p align="center">&nbsp;</p>
  <p align="center">

	
	
	
<form  method="post" >
	
	
<div align="center">
<?php 
                //*********************************
                $TOTAL = (double) $TOTAL;
                if ($tipoPACIENTE == 'externo') {
                    $diferencia = (double) ($totalParticular - $totalAseguradora);
                    if ($ben < 1 and (!$diferencia and ($totalParticular < 1 or $totalAseguradora < 1))) {
                        ?>

  <input type="hidden" name="keyT" id="keyT" value="<?php 
                        echo $myrow1['keyT'];
                        ?>
" />
      <input name="imprimir" type="submit"  id="imprimir" value="Finalizar Transaccion" src="../imagenes/btns/new_print.png" onClick="Disab (2)"/>
      <?php 
                    }
                    ?>
      </p>
      <?php 
                } else {
                    ?>
        
      <?php 
                    if ($TOTAL > -1 && $TOTAL < 1 && ($descuentoP < 1 and $descuentoA < 1)) {
                        ?>
  <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 
                    }
                    ?>
        
      <?php 
                }
                ?>
        
         <input type="hidden" name="totalCargo" value="<?php 
                echo $totalCargo;
                ?>
" />
		          <input type="hidden" name="totalAbono" value="<?php 
                echo $totalAbono;
                ?>
" />
      <input type="hidden" name="variable_php" id="variable_php" />
    
    </div>
</form>
<script languaje="JavaScript">            
              document.form1.folioVenta.value=<?php 
                echo $_GET['folioVenta'];
                ?>
			                document.form1.keyClientesInternos.value=<?php 
                echo $_GET['nT'];
                ?>
							    document.form1.nT.value=<?php 
                echo $_GET['nT'];
                ?>
    </script>
    <br>
</body>
</html>
      <?php 
            }
            ?>

<?php 
        } else {
            //validacion del recibo de caja
            echo '<div class="error">ERROR! NO EXISTE LA RUTA DEL RECIBO DE CAJA!</div>';
            echo '<script>';
            echo 'window.alert("NO EXISTE LA RUTA DEL RECIBO!");';
            echo '</script>';
        }
    }
示例#8
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);
示例#9
0
    public function aplicarPago($basedatos, $db_conn)
    {
        ?>

  



<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 ventanaSecundaria (URL){ 
   window.open(URL,"ventana","width=900,height=600,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script>
<script language=javascript> 
function ventanaSecundaria3 (URL){ 
   window.open(URL,"ventana3","width=360,height=250,scrollbars=YES") 
} 
</script>
<script language=javascript> 
function ventanaSecundaria1 (URL){ 
   window.open(URL,"ventana1","width=350,height=300,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria6 (URL){ 
   window.open(URL,"ventana6","width=900,height=600,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</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 language="javascript" type="text/javascript">   

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.tipoTransaccion.value) == false ) {   
                alert("Escoje el Tipo de Transacci�n que desees hacer!")   
                return false   
        }  else if( vacio(F.cantidadRecibida.value) == false ) {   
                alert("Escribe la cantidad!")   
                return false   
        }                     
		
		
}   
  
</script> 





<?php 
        //empieza div '>
        ?>
    <div id="content" style="display:none">
<?php 
        $TOTAL = $_GET['TOTAL'];
        $iva = $_GET['iva'];
        $numeroCuenta = $_GET['nCuenta'];
        $descuento = $_GET['descuento'];
        $depositos = $_GET['depositos'];
        $devolucion = $_GET['cantidadRecibida'] - $TOTAL;
        $sSQL3 = "Select * From clientesInternos WHERE keyClientesInternos = '" . $numeroCuenta . "'  ";
        $result3 = mysql_db_query($basedatos, $sSQL3);
        $myrow3 = mysql_fetch_array($result3);
        $numeroE1 = $myrow3['numeroE'];
        $nCuenta1 = $myrow3['nCuenta'];
        $tipoPaciente = $myrow3['tipoPaciente'];
        $tipoTrans = $myrow3['tipoTransaccion'];
        ?>

<?php 
        if ($tipoPaciente == 'externo' || $tipoPaciente == 'urgencias' and !$_POST['aplicarPago']) {
            ?>
<script>
javascript:ventanaSecundaria6('<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/INGRESOS%20HLC/caja/imprimeCajaExternos.php?numeroE=<?php 
            echo $nCliente5;
            ?>
&amp;nT=<?php 
            echo $numeroCuenta;
            ?>
&amp;paciente=<?php 
            echo $_POST['paciente'];
            ?>
&amp;orden=<?php 
            echo $E;
            ?>
&amp;hora1=<?php 
            echo $hora1;
            ?>
');
</script>

<?php 
        }
        ?>



<?php 
        //************************ACTUALIZO PRECIOS**********************
        $ID_LIBROM = '20';
        //***********************************************************************
        //***********************************Bajar variables
        $hoy = date("Y-m-d");
        $hora = date("H:i a");
        $nPaciente = $_GET['numeroE'];
        if ($_GET['almacen']) {
            $al = $_GET['almacen'];
        } else {
            if ($_GET['almacen1']) {
                $al = $_GET['almacen1'];
            } else {
                if ($_GET['almacen2']) {
                    $al = $_GET['almacen2'];
                } else {
                    if ($_GET['almacen3']) {
                        $al = $_GET['almacen3'];
                    }
                }
            }
        }
        //***********************Cierro validaciones de almac�n************************
        //*********************************CREAR FUNCIONES******************************************
        function saca_por($can, $por)
        {
            $can = $can / 100 * $por;
            $tPor = $can + $cant;
            return $can;
        }
        function saca_pormas($can, $por)
        {
            $can = $can / 100 * $por;
            $tPor = $can - $cant;
            return $can;
        }
        function saca_iva($can, $por)
        {
            $cant = $can;
            $can = $can / 100 * $por;
            $can += $cant;
            return $can;
        }
        //****************************Cierro funciones************************************
        //********************************VERIFICA EL ULTIMO MOVIMIENTO*******************
        //********traigo centro de costos y libro*********
        //$cmdstr1 = "select * from MATEO.CONT_FOLIO where LOGIN = '******' ";
        /* $cmdstr1 = "select * from MATEO.CONT_FOLIO where LOGIN = '******' 
        AND ID_EJERCICIO='".$ID_EJERCICIOM."'
        AND
        ID_LIBRO='".$ID_LIBROM."'
        ";
        $parsed1 = ociparse($db_conn, $cmdstr1);
        ociexecute($parsed1);	 
        $nrows1 = ocifetchstatement($parsed1, $results1); 
        
        for ($i = 0; $i < $nrows1; $i++ ){
        $ID_LIBRO = $results1['ID_LIBRO'][$i];
        $ID_EJERCICIO = $results1['ID_EJERCICIO'][$i];
        }  */
        //***********************************************************************************
        //*****************************Verificando caja abierta**************************
        $sSQLC = "Select * From aperturaCaja ";
        $resultC = mysql_db_query($basedatos, $sSQLC);
        $myrowC = mysql_fetch_array($resultC);
        if ($poliza = $myrowC['numeroPoliza']) {
            //*******************Comienzo la validaci�n*****************
            //********************Llenado de datos
            $sSQL3 = "Select * From clientesInternos WHERE keyClientesInternos = '" . $numeroCuenta . "' ";
            $result3 = mysql_db_query($basedatos, $sSQL3);
            $myrow3 = mysql_fetch_array($result3);
            $numeroE1 = $myrow3['numeroE'];
            $nCuenta1 = $myrow3['nCuenta'];
            //***************aplicar pago**********************
            if ($_GET['aplicarPago'] and $_GET['cantidadRecibida'] and $_GET['tipoTransaccion']) {
                $numeroConfirmacion = rand();
                $q = "UPDATE clientesInternos set \r\nstatus='activa',\r\nstatusDeposito='pagado',\r\nstatusCuenta='abierta'\r\nWHERE numeroE = '" . $numeroE1 . "' and nCuenta='" . $nCuenta1 . "'";
                mysql_db_query($basedatos, $q);
                echo mysql_error();
                $sSQL341 = "Select * From catTTCaja WHERE codigoTT = '" . $_GET['tipoTransaccion'] . "'\r\n\t";
                $result341 = mysql_db_query($basedatos, $sSQL341);
                $myrow341 = mysql_fetch_array($result341);
                $naturaleza = $myrow341['naturaleza'];
                $agrega = "INSERT INTO cargosCuentaPaciente (\r\nnumeroE,nCuenta,status,usuario,fecha1,cantidadRecibida,cantidad,tipoTransaccion,codProcedimiento,hora1,\r\nnaturaleza,ejercicio,statusDeposito,numeroConfirmacion,almacen) values ('" . $numeroE1 . "','" . $nCuenta1 . "','pagado',\r\n'" . $usuario . "','" . $fecha1 . "','" . $_GET['cantidadRecibida'] . "','1','" . $_GET['tipoTransaccion'] . "','" . $hora1 . "',\r\n'" . $hora1 . "','" . $naturaleza . "','" . $ID_EJERCICIOM . "','pagado','" . $numeroConfirmacion . "','" . $ALMACEN . "'\r\n\r\n)";
                mysql_db_query($basedatos, $agrega);
                echo mysql_error();
                if ($myrow3['tipoPaciente'] == 'externo') {
                    $q1 = "UPDATE cargosCuentaPaciente set \r\nstatus='pagado',statusAlta='pagado',\r\ntipoTransaccion='" . $_GET['tipoTransaccion'] . "',\r\n\r\nnumPoliza='" . $poliza . "'\r\nWHERE numeroE = '" . $numeroE1 . "' and nCuenta='" . $nCuenta1 . "' and status='cargado'";
                    mysql_db_query($basedatos, $q1);
                    echo mysql_error();
                }
                $q1 = "UPDATE descuentos set \r\nstatus='usado'\r\nWHERE numeroE = '" . $_GET['numeroE'] . "' and status='activo'";
                //mysql_db_query($basedatos,$q1);
                echo mysql_error();
                //*************SACO EL NUMERO DE MOVIMIENTO y lo actualizo*************************
                $sSQL2 = "Select max(consecutivo) as tope From aperturaCaja ";
                $result2 = mysql_db_query($basedatos, $sSQL2);
                $myrow2 = mysql_fetch_array($result2);
                $numMovto = $myrow2['tope'] + '1';
                $q = "UPDATE aperturaCaja set \r\nconsecutivo = '" . $numMovto . "'\r\n";
                mysql_db_query($basedatos, $q);
                echo mysql_error();
                echo '<script type="text/vbscript">
msgbox "SE HIZO UN MOVIMIENTO!"
</script>';
                $leyenda = 'Se hizo un Movimiento';
                ?>




<?php 
                if ($myrow3['tipoPaciente'] == 'externo' and $_GET['tipoTransaccion'] == '') {
                    ?>
<script>
javascript:ventanaSecundaria2('<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/INGRESOS%20HLC/caja/imprimeCaja2.php?numeroE=<?php 
                    echo $numeroE1;
                    ?>
&amp;nCuenta=<?php 
                    echo $nCuenta1;
                    ?>
&amp;paciente=<?php 
                    echo $_POST['paciente'];
                    ?>
&amp;numeroConfirmacion=<?php 
                    echo $numeroConfirmacion;
                    ?>
&amp;hora1=<?php 
                    echo $hora1;
                    ?>
');
</script>
<script language="JavaScript" type="text/javascript">
  <!--
    opener.location.reload(true);
    self.close();
  // -->
</script>
<script type="text/javascript">
	

		close();
	
</script>
<?php 
                } else {
                    ?>
<script>
javascript:ventanaSecundaria2('<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/INGRESOS%20HLC/caja/imprimeCaja3.php?numeroE=<?php 
                    echo $numeroE1;
                    ?>
&amp;nCuenta=<?php 
                    echo $nCuenta1;
                    ?>
&amp;paciente=<?php 
                    echo $_POST['paciente'];
                    ?>
&amp;numeroConfirmacion=<?php 
                    echo $numeroConfirmacion;
                    ?>
&amp;hora1=<?php 
                    echo $hora1;
                    ?>
');
</script>
<script language="JavaScript" type="text/javascript">
  <!--
    opener.location.reload(true);
    self.close();
  // -->
</script>
<script type="text/javascript">
	

		close();
	
</script>
<?php 
                }
                ?>







<?php 
            }
            //*************************************************
            ?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<style type="text/css">
<!--
.Estilo24 {font-size: 10px}
.style7 {font-size: 9px}
.style8 {
	color: #0000FF;
	font-weight: bold;
}
.style12 {font-size: 10px}
-->
</style>
</head>

<body>

<form id="form1" name="form1" method="get" action="" onSubmit="return valida(this);">
  <table width="442" height="337" border="1" align="center" cellpadding="0" cellspacing="0" class="Estilo24">
    <tr bgcolor="#990033" align="center">
      <td>&nbsp;</td>
    </tr>
    <tr bgcolor="#990033">
      <td><table width="100%" height="320" border="0" cellpadding="4" cellspacing="0">
          <tr bgcolor="#FFFFFF">
            <td class="Estilo24">Tipo de Pago: </td>
            <td class="Estilo24">
			<select name="tipoPago" class="style7" id="tipoPago" onChange="javascript:form.submit();">
             
                <option
				 <?php 
            if ($_GET['tipoPago'] == 'Efectivo') {
                ?>
				 selected="selected"
				  <?php 
            }
            ?>
				 value="Efectivo">Efectivo</option>
                <option
				 <?php 
            if ($_GET['tipoPago'] == 'Tarjeta de Credito') {
                ?>
				 selected="selected"
				  <?php 
            }
            ?>
				 value="Tarjeta de Credito">Tarjeta de Credito</option>
				<option
				<?php 
            if ($_GET['tipoPago'] == 'Cheque') {
                ?>
				 selected="selected"
				  <?php 
            }
            ?>
				 value="Cheque">Cheque</option>
            </select></td>
          </tr>
          <tr bgcolor="#FFFFFF">
		  
		  
		  <?php 
            if ($_GET['tipoPago'] == 'Tarjeta de Credito') {
                ?>
            <td class="Estilo24">C&oacute;digo de Tarjeta: </td>
            <td class="Estilo24"><input name="codigo" type="text" class="Estilo24" id="codigo" 
		 value="<?php 
                if ($_GET['nuevo']) {
                    echo "0000000000";
                } else {
                    if ($myrow2['codigo']) {
                        echo $myrow2['codigo'];
                    }
                }
                ?>
" size="10" readonly=""/>
              <a href="javascript:ventanaSecundaria3('<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/cargos/ventanaTC.php?nombreCampo=<?php 
                echo "codigo";
                ?>
&amp;descripcion=<?php 
                echo "descripcion";
                ?>
&amp;forma=<?php 
                echo "form1";
                ?>
&amp;comision=<?php 
                echo "comision";
                ?>
')"><img src="<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/imagenes/Save.png" alt="Laboratorio Fabricante" width="15" height="15" border="0" /></a></td>
         
		  <input name="comision" type="hidden" value="">
		  </tr>
          <tr bgcolor="#FFFFFF">
            <td bgcolor="#FFFFFF" class="Estilo24">Banco Tarjeta :</td>
            <td bgcolor="#FFFFFF" class="Estilo24"><input name="descripcion" type="text" class="style7" value="<?php 
                echo $_GET['descripcion'];
                ?>
"  readonly=""/></td>
          </tr>
	
		  
          <tr bgcolor="#FFFFFF">
            <td class="Estilo24">&Uacute;ltimos 4 D&iacute;gitos: </td>
            <td class="Estilo24"><label>
              <input name="ultimosDigitos" type="text" class="style7" id="ultimosDigitos" size="4" maxlength="4" value="<?php 
                echo $_GET['ultimosDigitos'];
                ?>
" onKeyPress="return checkIt(event)"/>
            </label></td>
          </tr>	 
		  
          <tr bgcolor="#FFFFFF">
            <td class="Estilo24">C&oacute;digo de Aut. </td>
            <td class="Estilo24"><label>
              <input name="codigoAutTC" type="text" class="style7" id="codigoAutTC" value="<?php 
                echo $_GET['codigoAutTC'];
                ?>
" />
            </label></td>
          </tr>
		    <?php 
            }
            ?>
			
			
			
			
			
			
			
			
			
			
			
			<?php 
            if ($tipoPaciente == 'interno') {
                ?>
            <tr bgcolor="#FFFFFF">
              <td class="Estilo24">Tipo de Transacci&oacute;n </td>
              <td class="Estilo24"><label>
			  
			  <?php 
                $sSQL31 = "Select * From catTTCaja WHERE codigoTT = '" . $tipoTrans . "'\r\n\t";
                $result31 = mysql_db_query($basedatos, $sSQL31);
                $myrow31 = mysql_fetch_array($result31);
                ?>
                <input name="campoDespliega" type="text" class="Estilo24" id="campoDespliega" size="50" 
	value=""
		   readonly=""/>
              </label>
                <label>
				<a href="javascript:ventanaSecundaria1(
		'ventanaTT.php?campoDespliega=<?php 
                echo "campoDespliega";
                ?>
&amp;forma=<?php 
                echo "form1";
                ?>
&amp;campoSeguro=<?php 
                echo "tipoTransaccion";
                ?>
&amp;seguro=<?php 
                echo $_POST['seguro'];
                ?>
')"><img src="<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/imagenes/Save.png" alt="Tipo de Transacci&oacute;n" width="20" height="20" border="0" /></a><a href="javascript:ventanaSecundaria1(
		'ventanaTT.php?campoDespliega=<?php 
                echo "campoDespliega";
                ?>
&amp;forma=<?php 
                echo "form1";
                ?>
&amp;campoSeguro=<?php 
                echo "tipoTransaccion";
                ?>
&amp;seguro=<?php 
                echo $_POST['seguro'];
                ?>
')">
                
				
				<input name="tipoTransaccion" type="hidden" class="Estilo24" id="tipoTransaccion" 
				value=""   readonly="" />
              </a></label></td>
			  <?php 
            } else {
                ?>
			  <input name="tipoTransaccion" type="hidden" class="Estilo24" id="tipoTransaccion" 
				value="CCaja"   readonly="" />
			  <?php 
            }
            ?>
			  
			  
			  
			  
			  
			  
			  
			  
			  
			  
			  
			  
			  
			  
            </tr>
            <tr bgcolor="#FFFFFF">
              <td class="Estilo24">Compa&ntilde;&iacute;a</td>
              <td class="Estilo24"><span class="style12">
                <?php 
            $despliegaAseguradora = new acumulados();
            echo "\$" . number_format($despliegaAseguradora->acumuladoAseguradora($basedatos, $usuario, $numeroE1, $nCuenta1), 2);
            ?>
              </span></td>
            </tr>
          <tr bgcolor="#FFFFFF">
		  <?php 
            $despliegaTotal = new acumulados();
            if ($despliegaTotal->acumulado($basedatos, $usuario, $numeroE1, $nCuenta1) > 0) {
                $mostrar = 'Total Cargos';
            } else {
                if ($despliegaTotal->acumulado($basedatos, $usuario, $numeroE1, $nCuenta1) < 0) {
                    $mostrar = 'Saldo a Favor';
                } else {
                    $mostrar = 'Sin Cargos..';
                }
            }
            ?>
		  
            <td width="22%" class="Estilo24"><?php 
            echo $mostrar;
            ?>
</td>
            <td width="78%" class="Estilo24"><?php 
            echo "\$" . number_format($despliegaTotal->acumulado($basedatos, $usuario, $numeroE1, $nCuenta1), 2);
            ?>
 </td>
          </tr>
          <?php 
            //descuentos pacientes internos
            $sSQL18 = "SELECT *\r\nFROM\r\ndescuentos\r\nWHERE \r\nnumeroE='" . $numeroE1 . "' AND nCuenta ='" . $nCuenta1 . "' and nCuenta <>null\r\nand \r\nstatus='activo' and\r\nfechaFinal <= '" . $fecha1 . "'";
            $result18 = mysql_db_query($basedatos, $sSQL18);
            $myrow18 = mysql_fetch_array($result18);
            echo mysql_error();
            //descuentos pacientes ambulatorios
            $sSQL19 = "SELECT *\r\nFROM\r\ndescuentos\r\nWHERE \r\nnumeroE='" . $nCliente . "' \r\nand status='activo' and\r\nfechaFinal <= '" . $fecha1 . "'\r\n ";
            $result19 = mysql_db_query($basedatos, $sSQL19);
            $myrow19 = mysql_fetch_array($result19);
            //******************
            if ($myrow19['cantidad']) {
                $descuento = $myrow19['cantidad'];
            } else {
                if ($myrow19['descuento']) {
                    $TOTAL1 = $myrow19['descuento'] / 100 * $TOTAL;
                    $descuento = $TOTAL1 - $descuento;
                }
            }
            if ($myrow18['cantidad']) {
                $descuento = $myrow18['cantidad'];
            } else {
                if ($myrow18['descuento']) {
                    $TOTAL1 = $myrow18['descuento'] / 100 * $TOTAL;
                    $descuento = $TOTAL1 - $descuento;
                }
            }
            $TOTAL -= $descuento;
            ?>
          <?php 
            if ($descuento) {
                ?>
          <tr bgcolor="#FFFFFF">
            <td class="Estilo24">Descuento: </td>
            <td class="Estilo24"><?php 
                echo "\$" . number_format($descuento, 2);
                ?>
            </td>
          </tr>
          <?php 
            }
            ?>
		  
		  
        
          <tr bgcolor="#FFFFFF">
            <td class="Estilo24">Cantidad Recibida </td>
            <td class="Estilo24"><input name="cantidadRecibida" type="text" class="style7" id="cantidadRecibida" value="<?php 
            if ($myrow3['deposito'] and $myrow3['status'] == 'standby') {
                echo $myrow3['deposito'];
            }
            ?>
" autocomplete="off"/>
			<input name="TOTAL" type="hidden" class="style7" id="cantidadRecibida" value="<?php 
            echo $TOTAL;
            ?>
"/>	<input name="numeroE" type="hidden" class="style7" id="TOTAL" value="<?php 
            echo $_GET['numeroE'];
            ?>
"/>
			<input name="naturaleza" type="hidden" class="style7" id="naturaleza" value="<?php 
            echo $myrow31['naturaleza'];
            ?>
"/></td>
          </tr>
      </table></td>
    </tr>
  </table>
  <label>
    <div align="center">
      <span class="Estilo24">
      <input name="depositos" type="hidden" class="style7" id="depositos" value="<?php 
            echo $depositos;
            ?>
"/>
      </span>
      <span class="Estilo24">
      <input name="nCuenta" type="hidden" class="style7" id="nCuenta" value="<?php 
            echo $numeroCuenta;
            ?>
"/>
      </span>
      <div align="center">
        <p>
		<?php 
            if (!$_GET['aplicarPago']) {
                ?>
          <input name="aplicarPago" type="submit" class="Estilo24" id="aplicarPago" value="Aplicar Pago" 
		
	/> <?php 
            }
            ?>
        </p>
        <p>
		<?php 
            if ($_GET['aplicarPago']) {
                ?>
          <label> <br />
          <br />
          <input name="Submit" type="submit" class="style7" value="Cerrar (X)" 	onclick="javascript:cerrar();" />
          </label>
</p>
        <?php 
            }
            ?>
  </div>
  </label>
    <p align="center"><span class="style8">
      <?php 
            if ($_GET['cantidadRecibida'] and $myrow2['statusDeposito'] == 'pagado') {
                //onclick="javascript:cerrar();"
                ?>
    Devolver: </span><span class="style8"><?php 
                echo "\$ " . number_format($devolucion, 2);
                ?>
</span>
      <?php 
            }
            ?>
    <span class="Estilo24">    </span></p>
</form>
<p>&nbsp;</p>
</body>
</html>
  <?php 
        } else {
            echo '<script type="text/vbscript">
msgbox "LA CAJA ESTA CERRADA!"
</script>';
        }
        ?>
  </div>
    <script>
  function openPopup(){
    var master = new Window("master", {className: "alphacube", width:350, height:400,title:"Aplicar Pago"});
    master.setContent("content");
    master.setDestroyOnClose();
    master.showCenter();
  }
   
 openPopup();
 
  </script>
<?php 
    }
示例#10
0
    public function eCuenta($nT, $basedatos)
    {
        include CONSTANT_PATH_CONFIGURACION . "/funciones.php";
        if (!$_GET['nT']) {
            $_GET['nT'] = $_GET['nt'];
        }
        ?>
<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=300,height=400,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 PRECIOS**********************
        //********************Llenado de datos
        $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'];
        //***************aplicar pago**********************
        if (!$_POST['tipoVista']) {
            $_POST['tipoVista'] = 'Detalle';
        }
        ?>
<!-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">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<style type="text/css">
<!--
.style13 {color: #FFFFFF}
.style11 {color: #FFFFFF; font-size: 10px; font-weight: bold; }
.style7 {font-size: 9px}
.Estilo24 {font-size: 10px}
.style19 {color: #000000; font-weight: bold; }
-->
</style>


</head>

<style type="text/css">
<!--
.style12 {font-size: 10px}
.style14 {font-size: 10px; color: #FFFFFF; }
.style21 {color: #FF0000}
-->
</style>
<BODY >

<h1 align="center">Estado de Cuenta </h1>
<form id="form1" name="form1" method="post" action="">
  <table width="642" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#990099" class="Estilo24">
    <tr>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <th bgcolor="#660066" class="style14" scope="col"><div align="left">N&uacute;mero de Transacci&oacute;n: </div></th>
      <th bgcolor="#660066" class="style14" scope="col"><div align="left"><?php 
        echo $nCliente = $myrow3['keyClientesInternos'];
        ?>
          <input name="numeroE" type="hidden" class="Estilo24" id="numeroE" 
		  value="<?php 
        echo $nCliente = $_POST['numeroE'];
        ?>
" readonly=""/>
</label></div>
      </th>
    </tr>
    <tr>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <th class="Estilo24" scope="col"><div align="left"><strong>M&eacute;dico: </strong></div></th>
      <th class="Estilo24" 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>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <th width="134" bgcolor="#FFCCFF" class="Estilo24" scope="col"><div align="left"><strong>Paciente: </strong></div></th>
      <th width="408" bgcolor="#FFCCFF" class="Estilo24" scope="col"><div align="left"><strong>
          <label> </label>
      </strong> <?php 
        echo $myrow3['paciente'];
        ?>
 </div></th>
    </tr>
    <tr>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <td class="Estilo24">Compa&ntilde;&iacute;a: </td>
      <td class="Estilo24"><label> <?php 
        echo $traeSeguro = $myrow3['seguro'];
        ?>
            <?php 
        $sSQL212 = "SELECT *\r\nFROM\r\nclientes\r\nWHERE \r\nnumCliente='" . $traeSeguro . "'\r\n ";
        $result212 = mysql_db_query($basedatos, $sSQL212);
        $myrow212 = mysql_fetch_array($result212);
        ?>
            <input name="seguro2" type="hidden" id="seguro2" value="<?php 
        echo $traeSeguro;
        ?>
" />
      </label></td>
    </tr>
    <tr>
      <th class="Estilo24" scope="col">&nbsp;</th>
      <td bgcolor="#FFCCFF" class="Estilo24">N&deg; Credencial: </td>
      <td bgcolor="#FFCCFF" class="Estilo24"><?php 
        echo $myrow3['credencial'];
        ?>
 </td>
    </tr>
    <tr>
      <th class="Estilo24" scope="col">&nbsp;</th>
      <td class="Estilo24">Fecha</td>
      <td class="Estilo24"><span class="style12">
        <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="style12" 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="style12" id="lanzador" value="..." />
        Entre </label>
      <input name="fecha2" type="text" class="style12" 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="style12" id="lanzador1" value="..." />
        <input name="show" type="submit" class="style7" id="show" value="&gt;" />
        
        <?php 
        } else {
            ?>
        <input name="fecha3" type="hidden" class="style12" id="fecha2" value="<?php 
            echo 'all';
            ?>
"/>
		<?php 
        }
        ?>
</label>
</span></td>
    </tr>
    <tr>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <td bgcolor="#FFCCFF" class="Estilo24">Tipo de Vista: </td>
      <td bgcolor="#FFCCFF" class="Estilo24"><label>
        <select name="tipoVista" class="style7" 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 
        if ($_POST['tipoVista']) {
            ?>
  
  <table width="672" border="0" align="center">
    <tr>
      <th width="104" height="14" bgcolor="#660066" class="style14" scope="col"><span class="style12 ">Fecha/Hora (Cargo)</span></th>
      <th width="405" bgcolor="#660066" class="style14" scope="col"><span class="style12 ">Descripci&oacute;n</span></th>
      <th width="21" bgcolor="#660066" class="style14" scope="col"><span class="style12 ">Cant</span></th>
      <th width="59" bgcolor="#660066" class="style14" scope="col"><span class="style12 ">Importe IC </span></th>
      <th width="61" bgcolor="#660066" class="style14" scope="col"><span class="style12 ">IVA</span></th>
    </tr>
    <tr>
      <?php 
            //traigo agregados
            if ($_POST['tipoVista'] == 'Agrupado' and $_POST['banderaFecha']) {
                $sSQL81 = "\r\nSELECT \r\n  *,((precioVenta*cantidad)+iva) as sumaTres\r\nFROM\r\ncargosCuentaPaciente \r\n WHERE numeroE = '" . $numeroE . "'\r\n \r\n and nCuenta='" . $nCuenta . "'\r\n  and (status!='standby' and statusCargo!='standby')\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\n  *,((precioVenta*cantidad)+iva) as sumaTres\r\nFROM\r\ncargosCuentaPaciente \r\n WHERE \r\n numeroE = '" . $numeroE . "'\r\n \r\n and nCuenta='" . $nCuenta . "'\r\n \r\n and (status!='standby' and statusCargo!='standby')\r\n   and \r\n (fecha1 between'" . $_POST['fecha'] . "' and '" . $_POST['fecha2'] . "')\r\n\r\n order by fecha1,hora1 asc\r\n";
                } else {
                    if ($_POST['tipoVista'] == 'Agrupado' and !$_POST['banderaFecha']) {
                        $sSQL81 = "\r\nSELECT \r\n  *,((precioVenta*cantidad)+iva) as sumaTres\r\nFROM\r\ncargosCuentaPaciente \r\n WHERE \r\nnumeroE = '" . $numeroE . "'\r\n \r\n and nCuenta='" . $nCuenta . "'\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\n *,((precioVenta*cantidad)+iva) as sumaTres\r\nFROM\r\ncargosCuentaPaciente \r\n WHERE \r\n numeroE = '" . $numeroE . "'\r\n \r\n and nCuenta='" . $nCuenta . "'\r\n\r\n\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)) {
                    $keyCAP = $myrow81['keyCAP'];
                    $a = $a + 1;
                    $art = $myrow81['codProcedimiento'];
                    $proc = $myrow81['codProcedimiento'];
                    $codigo = $myrow81['codProcedimiento'];
                    if ($col) {
                        $color = '#FFCCFF';
                        $col = "";
                    } else {
                        $color = '#FFFFFF';
                        $col = 1;
                    }
                    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);
                    }
                    ?>




      <td height="23" bgcolor="<?php 
                    echo $color;
                    ?>
" class="Estilo24"><span class="style7"><?php 
                    echo $myrow81['fecha1'] . " " . $myrow81['hora1'];
                    ?>
</span></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="Estilo24"><span class="style7"><span class="style12"><span class="<?php 
                    echo $estilo;
                    ?>
">
        <?php 
                    $descripcion = new articulosDetalles();
                    $descripcion->descripcion($numeroE, $nCuenta, $codigo, $basedatos);
                    ?>
      </span></span>        <span class="style12">
        <?php 
                    if ($myrow81['um'] == 's' or $myrow81['um'] == 'S') {
                        echo '  ( Servicio )  ';
                    }
                    ?>
        <?php 
                    if ($myrow81['status'] == 'cerrada') {
                        echo '<blink>' . "[Cerrada]" . '</blink>';
                    } else {
                        //echo '<blink>'."[CxC]".'</blink>';
                    }
                    ?>
 </span> </span></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="Estilo24"><span class="style7">
        <?php 
                    if ($_POST['tipoVista'] == 'Agrupado') {
                        echo $cantidad = $myrow14['cantidad2'];
                    } else {
                        echo $cantidad = $myrow81['cantidad'];
                    }
                    ?>
      </span></td>
	
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="Estilo24"><span class="style7">
          
      <span class="style12"><span class="<?php 
                    echo $estilo;
                    ?>
">
      <?php 
                    $importe = new acumulados();
                    echo $importe->importe($keyCAP, $basedatos);
                    ?>
</span></span> </span></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="Estilo24"><span class="style7">
        <?php 
                    $mostrarIVA = new articulosDetalles();
                    echo $mostrarIVA->mostrarIVA($keyCAP, $basedatos);
                    ?>
      </span></td>
	   <?php 
                    if ($tipoTrans and !$myrow81['sumaTres']) {
                        //echo "$".number_format("-".$myrow81['cantidadRecibida'],2);
                        $TOTAL += "-" . $myrow81['cantidadRecibida'];
                    } else {
                        //echo "$".number_format($costoProcedimientos[0],2);
                        //$TOTAL+=$costoProcedimientos[0];
                        //echo "$".number_format($myrow81['sumaTres'],2);
                    }
                    ?>
    </tr>
 
	
	
    <?php 
                }
            }
            ?>
  </table>
  <p>
    <input name="paso_bandera1" type="hidden" id="paso_bandera1" value="<?php 
            echo $bandera;
            ?>
" />
    <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;
            ?>
" /><?php 
            //echo "$".number_format($TOTAL,2);
            ?>
  </p>
  <div align="center">
    <p>&nbsp;</p>
    
    <table width="239" border="0" align="left" class="style12">
      <tr>
        <td width="139" height="23" bgcolor="#FFCCFF" class="style12">Medicamentos</td>
        <td width="90" bgcolor="#FFCCFF" class="style12"><div align="right"><?php 
            echo $Tmedicamentos;
            ?>
 </div></td>
      </tr>
      <tr>
        <td height="23" class="style12">Material Quir&uacute;rgico </td>
        <td class="style12"><div align="right"><?php 
            echo $TPAT;
            ?>
 </div></td>
      </tr>
      <tr bgcolor="#FFCCFF">
        <td height="23" class="style12">Servicios Hospitalarios </td>
        <td class="style12"><div align="right"><?php 
            echo "\$" . number_format($servicios[0], 2);
            ?>
 </div></td>
      </tr>
      <tr>
        <td height="23" class="style12">IVA</td>
        <td class="style12"><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="style12">Total Cargos </td>
        <td class="style12"><div align="right">
            <?php 
            $totalAcumulado = new acumulados();
            echo "\$" . number_format($totalAcumulado->totalAcumulado($basedatos, $usuario, $numeroE, $nCuenta), 2);
            ?>
        </div></td>
      </tr>
    </table>
    <p>&nbsp;</p>
	
	
	
	
	
    <table width="239" border="0" align="center" class="style12">
      <tr bgcolor="#FFCCFF">
        <td width="141" height="23" bgcolor="#FFCCFF" class="style12"><span class="style7">Total Abonos</span></td>
        <td width="88" class="style12">
          <div align="right">
            <?php 
            $abonos = new acumulados();
            echo "\$" . number_format($abonos->abonos($basedatos, $usuario, $numeroE, $nCuenta), 2);
            ?>
        </div></td>
      </tr>
      <tr>
        <td height="23" class="style12">Saldo Actual </td>
        <td class="style12"><div align="right">
            <?php 
            $totalCargos = new acumulados();
            $totalCargos = $totalCargos->total($totalAcumulado->totalAcumulado($basedatos, $usuario, $numeroE, $nCuenta), $abonos->abonos($basedatos, $usuario, $numeroE, $nCuenta), $numeroE1, $nCuenta1);
            echo "\$" . number_format($totalCargos, 2);
            ?>
        </div></td>
      </tr>
    </table>
    <p>&nbsp;</p>
  </div>
  <p>&nbsp;</p>
</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 coaseguro($ALMACEN, $entidad, $fecha1, $hora1, $dia, $usuario, $nT, $basedatos)
    {
        $sSQL3 = "Select * From clientesInternos WHERE folioVenta = '" . $_GET['folioVenta'] . "' ";
        $result3 = mysql_db_query($basedatos, $sSQL3);
        $myrow3 = mysql_fetch_array($result3);
        $cargosCia = new acumulados();
        $UserType = new tipoUsuario();
        $UserType = $UserType->tipoDeUsuario($usuario, $basedatos, $ALMACEN);
        ?>
<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 ventanaSecundaria10 (URL){ 
   window.open(URL,"ventana10","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=350,height=300,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 
        if ($_POST['aplicar']) {
            //*********************** coaseguro 1**********************************
            $sSQL31 = "Select * From avisos WHERE entidad='" . $entidad . "' AND numeroE = '" . $numeroE . "' AND nCuenta='" . $nCuenta . "'";
            $result31 = mysql_db_query($basedatos, $sSQL31);
            $myrow31 = mysql_fetch_array($result31);
            if (!$myrow31['statusAviso']) {
                $agrega = "INSERT INTO avisos (\r\nnumeroE,nCuenta,tipoAviso,usuario,fecha,hora,statusAviso,keyCI,\r\nporcentajeDeducible1,\r\nporcentajeCoaseguro1,\r\nporcentajeDeducible2,\r\nporcentajeCoaseguro2,\r\nimporteDeducible1,\r\nimporteCoaseguro1,\r\nimporteDeducible2,\r\nimporteCoaseguro2,\r\nentidad\r\n) \r\nvalues \r\n('" . $numeroE . "','" . $nCuenta . "','caja',\r\n'" . $usuario . "','" . $fecha1 . "','" . $hora1 . "','standby','" . $_GET['nT'] . "',\r\n'" . $_POST['porcentajeDeducible1'] . "',\r\n'" . $_POST['porcentajeCoaseguro1'] . "',\r\n'" . $_POST['porcentajeDeducible2'] . "',\r\n'" . $_POST['porcentajeCoaseguro2'] . "',\r\n\r\n'" . $_POST['importeDeducible1'] . "',\r\n'" . $_POST['importeCoaseguro1'] . "',\r\n'" . $_POST['importeDeducible2'] . "',\r\n'" . $_POST['importeCoaseguro2'] . "',\r\n'" . $entidad . "'\r\n)";
                //mysql_db_query($basedatos,$agrega);
                echo mysql_error();
                $leyenda = "Se solicit&oacute; la transacci&oacute;n de cargo de Coaseguro a Paciente";
            } else {
                $agrega = "UPDATE avisos set \r\nporcentajeDeducible1='" . $_POST['porcentajeDeducible1'] . "',\r\nporcentajeCoaseguro1='" . $_POST['porcentajeCoaseguro1'] . "',\r\nporcentajeDeducible2='" . $_POST['porcentajeDeducible2'] . "',\r\nporcentajeCoaseguro2='" . $_POST['porcentajeCoaseguro2'] . "',\r\n\r\nimporteDeducible1='" . $_POST['importeDeducible1'] . "',\r\nimporteCoaseguro1='" . $_POST['importeCoaseguro1'] . "',\r\nimporteDeducible2='" . $_POST['importeDeducible2'] . "',\r\nimporteCoaseguro2='" . $_POST['importeCoaseguro2'] . "'\r\n\r\nwhere\r\nentidad='" . $entidad . "' AND\r\nnumeroE='" . $numeroE . "' AND\r\nnCuenta='" . $nCuenta . "'\r\n\r\n";
                //mysql_db_query($basedatos,$agrega);
                echo mysql_error();
                $leyenda = "Se actualizaron registros";
            }
            //********************************CIERRA COASEGURO 1
        }
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<?php 
        $estilos = new muestraEstilos();
        $estilos->styles();
        ?>




<BODY >

<h1 align="center"> Coaseguro / Deducible</h1>
<form id="form1" name="form1" method="post" action="">
  <img src="../../imagenes/bordestablas/borde1.png" alt="bo1" width="549" height="24" />
  <table width="549" border="0" align="center" cellpadding="4" cellspacing="0" bordercolor="#990099" class="none">
    <tr>
      <th bgcolor="#CCCCCC" class="none" scope="col"><div align="left">N&uacute;mero de Transacci&oacute;n: </div></th>
      <th bgcolor="#CCCCCC" class="none" scope="col"><div align="left"><?php 
        echo $myrow3['folioVenta'];
        $nCliente = $myrow3['keyClientesInternos'];
        ?>
          <input name="numeroE" type="hidden" class="Estilo24" id="numeroE" 
		  value="<?php 
        echo $nCliente = $_POST['numeroE'];
        ?>
" readonly=""/>
</label></div>      </th>
    </tr>
    <tr>
      <th width="134" bgcolor="#CCCCCC" class="Estilo24" scope="col">
      <div align="left" class="none"><strong>Paciente: </strong></div></th>
      <th width="408" bgcolor="#CCCCCC" class="Estilo24" scope="col">
      <div align="left"><strong>
      
          <label> </label>
      </strong> <?php 
        echo $myrow3['paciente'];
        ?>
 </div></th>
    </tr>
    <tr>
      <td bgcolor="#CCCCCC" class="none">Compa&ntilde;&iacute;a: </td>
<td bgcolor="#CCCCCC" class="none"><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="#CCCCCC" class="none">N&deg; Credencial: </td>
      <td bgcolor="#CCCCCC" class="Estilo24"><?php 
        echo $myrow3['credencial'];
        ?>
 </td>
    </tr>
  </table>
  <img src="../../imagenes/bordestablas/borde2.png" alt="bo1" width="549" height="24" />
<p>&nbsp;</p>
  <img src="../../imagenes/bordestablas/borde1.png" alt="bo1" width="723" height="24" />
  <table width="723" border="0" align="center" cellpadding="4" cellspacing="0">
    <tr bgcolor="#FFFF00">
      <th width="60" class="style14" scope="col"><div align="left" class="none">#Movto.</div></th>
      <th width="112" height="14" class="style14" scope="col"><div align="left" class="none">Fecha/Hora</div></th>
      <th width="270" class="style14" scope="col"><div align="left" class="none">Descripci&oacute;n/Concepto</div></th>
      <th width="44" class="style14" scope="col"><div align="left" class="none">Status</div></th>
      <th width="33" class="style14" scope="col"><div align="left" class="none">Cant</div></th>
      <th width="61" class="style14" scope="col"><div align="left" class="none">Importe</div></th>
      <th width="40" class="style14" scope="col"><div align="left" class="none">IVA</div></th>
      <th width="69" class="style14" scope="col"><div align="left" class="none">Natura</div></th>
    </tr>
    <tr>
      
      <?php 
        //traigo agregados
        $mostrarIVA = new articulosDetalles();
        $status = new acumulados();
        $importe = new acumulados();
        $sSQL81 = "\r\nSELECT *\r\nFROM\r\ncargosCuentaPaciente \r\n WHERE \r\n folioVenta='" . $_GET['folioVenta'] . "'\r\nand\r\nstatusCargo!='cancelado'\r\n\r\n \r\n  order by fecha1,hora1 asc\r\n";
        $result81 = mysql_db_query($basedatos, $sSQL81);
        while ($myrow81 = mysql_fetch_array($result81)) {
            $a += '1';
            $art = $myrow81['codProcedimiento'];
            $codigo = $proc = $myrow81['codProcedimiento'];
            $keyCAP = $myrow81['keyCAP'];
            ?>



<td bgcolor="<?php 
            echo $color;
            ?>
" class="codigos"><?php 
            echo $myrow81['keyCAP'];
            ?>
</span></td>
	
      <td height="21" bgcolor="<?php 
            echo $color;
            ?>
" class="normal">
	  <?php 
            echo $myrow81['hora1'] . " " . cambia_a_normal($myrow81['fecha1']);
            ?>
</span></td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="normal"><span class="style12"><span class="style7">
      <?php 
            $descripcion = new articulosDetalles();
            $descripcion->descripcion($keyCAP, $numeroE, $nCuenta, $codigo, $basedatos);
            ?>
      </span></span>        <span class="style12">
		
        <?php 
            if ($myrow81['um'] == 's' or $myrow81['um'] == 'S') {
                echo '  ( Servicio )  ';
            }
            ?>

      </span> </span></td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="Estilo24"><?php 
            echo $status->status($keyCAP, $basedatos, $usuario, $numeroE, $nCuenta);
            ?>
</td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="Estilo24"><div align="center" class="normal">
          <?php 
            echo $cantidad = $myrow81['cantidad'];
            ?>
      </span></div></td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="precionormal1" align="right">
      
	  <?php 
            echo "\$" . number_format($myrow81['precioVenta'], 2);
            if ($myrow81['naturaleza'] == 'C' or $myrow81['naturaleza'] == 'coaseguro') {
                $cargos[0] += $myrow81['precioVenta'] * $myrow81['cantidad'];
            } else {
                if ($myrow81['naturaleza'] == 'A') {
                    $abonos[0] += $myrow81['precioVenta'] * $myrow81['cantidad'];
                }
            }
            ?>
      </span></span></span></td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="precionormal2" align="right">
	  
        <?php 
            echo "\$" . number_format($myrow81['iva'], 2);
            if ($myrow81['tipoCliente'] == 'aseguradora' or $myrow81['naturaleza'] == 'coaseguro') {
                $SUMAIVA[0] += $myrow81['iva'] * $myrow81['cantidad'];
            }
            ?>
      </span></span></span></td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="precionormal2"><div align="center"><span class="<?php 
            echo $estilo;
            ?>
">
	   
      <span class="style12"><span class="style7">
      <?php 
            if ($myrow81['statusDevolucion'] == 'si' and $myrow81['naturaleza'] == 'A') {
                print '-';
            } else {
                print $myrow81['naturaleza'];
            }
            ?>
    </span></span> </span></div></td>
	</tr>
 
	
	<?php 
            if ($myrow81['statusDescuento'] == 'si') {
                $statusD = 'disabled';
            }
            ?>
    <?php 
        }
        //cierra while
        ?>
	
	
	
  </table>
  <img src="../../imagenes/bordestablas/borde2.png" alt="bo1" width="723" height="24" />


  
  
  
  
  
  
  
  
  
  
  
  <table width="723" border="0" align="center">

    <tr>
      <td width="83" class="style12">&nbsp;</td>
      <td width="83" class="style12">&nbsp;</td>
      <td width="83" class="style12">&nbsp;</td>
      <td width="83" class="style12">&nbsp;</td>
      <td width="179" class="style12">&nbsp;</td>
      <td width="60" class="style12">&nbsp;</td>
      <td width="43" class="style12">&nbsp;</td>
      <td width="57" class="style12">&nbsp;</td>
    </tr>
  </table>
  <p>&nbsp;</p>
  <?php 
        $mostrarCuadroGP = new cuadritoAcumuladoGPO();
        echo $mostrarCuadroGP->mostrarCuadrito($_POST['fecha'], $_POST['fecha2'], 'precionormal1', $entidad, $myrow3['folioVenta'], $basedatos);
        ?>
  
  
  
<?php 
        $iva = new acumulados();
        $ivaD = new acumulados();
        $iva = $iva->ivaAcumulado($basedatos, $usuario, $nT) - $ivaD->ivaAcumuladoD($basedatos, $usuario, $nT);
        ?>
  <div align="center">
    <table width="396" border="1" align="center" class="style12">
      <tr>
        <td height="23" colspan="3" class="style12"><div align="center" class="style25">Cargos Globales </div></td>
      </tr>
      <tr>
        <td width="119" class="style12"><span class="style7">Total Cargos </span>
        <?php 
        $coaseguroN = new acumulados();
        $coa = $coaseguroN->cargosCoaseguroN($basedatos, $usuario, $nT);
        $totalAcumulado = new acumulados();
        $totalDevoluciones = new acumulados();
        $cargos = $totalAcumulado->totalAcumulado($basedatos, $usuario, $nT) - $totalDevoluciones->dev($basedatos, $usuario, $myrow3['folioVenta']) + $iva + $coa;
        echo "\$" . number_format($cargos, 2);
        ?>
        
        </td>
        <td width="111" height="23" class="style12"><span class="style7">Total Abonos     
           <?php 
        $abonos = new acumulados();
        $abonoS = $abonos->abonos($basedatos, $usuario, $myrow3['folioVenta']);
        echo "\$" . number_format($abonos->abonos($basedatos, $usuario, $myrow3['folioVenta']), 2);
        ?>
        </span></td>
        <td width="152" class="style12"><div align="right">
        Saldo Actual 
          <?php 
        if ($abonoS < 0) {
            $STotal = $cargos + $abonoS;
        } else {
            $STotal = $cargos - $abonoS;
        }
        echo "\$" . number_format($STotal, 2);
        ?>
		
        </div></td>
      </tr>
    </table>


  </div>
  <p align="center" class="style7">
  
<?php 
        $sSQL811 = "\r\nSELECT statusCargo\r\n\r\nFROM\r\ncargosCuentaPaciente \r\n WHERE \r\n keyClientesInternos='" . $_GET['nT'] . "'\r\nand\r\nstatusCargo='standby'\r\n\r\n \r\n \r\n";
        $result811 = mysql_db_query($basedatos, $sSQL811);
        $myrow811 = mysql_fetch_array($result811);
        if ($myrow811['statusCargo']) {
            ?>
 <input name="nuevo" type="button" class="style7" id="nuevo" value="Falta Surtir Articulos" disabled=""/>

<?php 
        } else {
            ?>
    <input name="nuevo" type="button" class="style7" id="nuevo" value="Cargar Deducible/Coaseguro"
	  onclick="ventanaSecundaria10('aplicarDeducibleVentana.php?numeroE=<?php 
            echo $numeroE;
            ?>
&nCuenta=<?php 
            echo $nCuenta;
            ?>
&almacen=<?php 
            echo $_GET['almacen'];
            ?>
&almacenFuente=<?php 
            echo $_GET['almacen'];
            ?>
&nT=<?php 
            echo $_GET['nT'];
            ?>
&folioVenta=<?php 
            echo $myrow3['folioVenta'];
            ?>
&cantidadTotal=<?php 
            echo $STotal;
            ?>
')" />
	
	     
	  <?php 
        }
        ?>
  </p>
</form>

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

</body>
</html>
<?php 
    }
    public function subCuenta($bali, $tipoCliente, $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=800,height=600,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['escoje']) {
            $keyCAP = $_POST['keyCAP'];
            $solicita = $_POST['solicita'];
            $solicita1 = $_POST['solicita1'];
            for ($i = 0; $i <= $_POST['bandera']; $i++) {
                $sSQL34 = "Select statusFactura From cargosCuentaPaciente WHERE keyCAP='" . $solicita[$i] . "'  ";
                $result34 = mysql_db_query($basedatos, $sSQL34);
                $myrow34 = mysql_fetch_array($result34);
                if ($solicita[$i]) {
                    if ($myrow34['statusFactura'] == 'standby') {
                        $agrega = "UPDATE cargosCuentaPaciente set \r\n\r\nstatusFactura='request'\r\nwhere\r\nkeyCAP='" . $solicita[$i] . "' \r\n";
                    }
                    mysql_db_query($basedatos, $agrega);
                    echo mysql_error();
                }
            }
            //cierra for
        }
        //cierra actualizar
        if ($_POST['quitar']) {
            $keyCAP = $_POST['keyCAP'];
            $solicita1 = $_POST['solicita1'];
            for ($i = 0; $i <= $_POST['bandera']; $i++) {
                $sSQL34 = "Select statusFactura From cargosCuentaPaciente WHERE keyCAP='" . $solicita1[$i] . "'  ";
                $result34 = mysql_db_query($basedatos, $sSQL34);
                $myrow34 = mysql_fetch_array($result34);
                if ($solicita1[$i]) {
                    if ($myrow34['statusFactura'] == 'request') {
                        $agrega = "UPDATE cargosCuentaPaciente set \r\nstatusFactura='standby'\r\nwhere\r\nkeyCAP='" . $solicita1[$i] . "' \r\n";
                    }
                    mysql_db_query($basedatos, $agrega);
                    echo mysql_error();
                }
            }
            //cierra for
        }
        //cierra quitar
        ?>




<?php 
        if ($_POST['facturar']) {
            if ($_POST['cantidadSolicitada']) {
                if ($_POST['cantidadSolicitada'] <= $_POST['cantidadActual']) {
                    $porcentaje = $_POST['cantidadSolicitada'] / $_POST['cantidadActual'];
                    $agrega = "INSERT INTO cargosFacturados (nt, cantidadFacturada,porcentaje,usuario,fecha,tipoCliente,seguro) values('" . $_GET['nT'] . "','" . $_POST['cantidadSolicitada'] . "','" . $porcentaje . "','" . $usuario . "','" . $fecha . "','" . $_GET['tipoCliente'] . "','" . $myrow3['seguro'] . "')";
                    mysql_db_query($basedatos, $agrega);
                    echo mysql_error();
                    ?>

<script>
javascript:ventanaSecundaria6('<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/cargos/applyInvoice.php?nT=<?php 
                    echo $nT;
                    ?>
&tipoFacturacion=<?php 
                    echo $tipoFacturacion;
                    ?>
&tipoCliente=<?php 
                    echo $_POST['tipoCliente'];
                    ?>
&porcentaje=<?php 
                    echo $porcentaje;
                    ?>
');
</script>



<?php 
                    /* <script>
                    javascript:ventanaSecundaria6('/sima/cargos/applyInvoice.php?nT=<?php echo $nT;?>&tipoFacturacion=<?php echo $tipoFacturacion;?>&tipoCliente=<?php echo $_POST['tipoCliente'];?>&porcentaje=<?php echo $porcentaje;?>');
                    </script> */
                } else {
                    $leyenda = 'La cantidad no debe ser mayor a la q existe!';
                }
            } else {
                $leyenda = 'Escribe la cantidad!';
            }
        }
        ?>





<!-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">
<style type="text/css">
<!--
.style71 {font-size: 9px}
.style71 {font-size: 9px}
.style71 {font-size: 9px}
.style72 {font-size: 10px}
.style72 {font-size: 10px}
.style1 {color: #FF0000}
.style73 {color: #FF0000}
.style73 {color: #FF0000;font-size: 9px}
.style74 {color: #FF0000}
.style74 {color: #FF0000;font-size: 9px}
-->
</style>
<head>






<title></title>
<style type="text/css">
<!--
.style13 {color: #FFFFFF}
.style11 {color: #FFFFFF; font-size: 10px; font-weight: bold; }
.style7 {font-size: 9px}
.Estilo24 {font-size: 10px}
.style19 {color: #000000; font-weight: bold; }
.style1 {color: #FF0000;font-size: 9px}
-->
</style>


</head>
<style type="text/css">
<!--
.style12 {font-size: 10px}
.style14 {font-size: 10px; color: #FFFFFF; }
.style21 {color: #FF0000}
-->
</style>




<BODY  >
<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="Estilo24">
    <tr>
      <th bgcolor="#660066" class="style14" scope="col"><div align="left">N&uacute;mero de Transacci&oacute;n: </div></th>
      <th bgcolor="#660066" class="style14" scope="col"><div align="left"><?php 
        echo $nCliente = $myrow3['keyClientesInternos'];
        ?>
          <input name="numeroE" type="hidden" class="Estilo24" id="numeroE" 
		  value="<?php 
        echo $nCliente = $_POST['numeroE'];
        ?>
" readonly=""/>
</label></div>      </th>
    </tr>
    <tr>
      <th width="134" bgcolor="#FFCCFF" class="Estilo24" scope="col"><div align="left"><strong>Paciente: </strong></div></th>
      <th width="408" bgcolor="#FFCCFF" class="Estilo24" scope="col"><div align="left"><strong>
          <label> </label>
      </strong> <?php 
        echo $myrow3['paciente'];
        ?>
 </div></th>
    </tr>
    <tr>
      <td class="Estilo24">Compa&ntilde;&iacute;a: </td>
      <td class="Estilo24"><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="Estilo24">N&deg; Credencial: </td>
      <td bgcolor="#FFCCFF" class="Estilo24"><?php 
        echo $myrow3['credencial'];
        ?>
 </td>
    </tr>
    <tr>
      <th class="Estilo24" scope="col"><div align="left"><strong>M&eacute;dico: </strong></div></th>
      <th class="Estilo24" 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 align="center">
    <label></label>
	
  </p>
  
  <?php 
        $sSQL341 = "Select sum(cantidadFacturada) as cantidadF From cargosFacturados WHERE nT='" . $_GET['nT'] . "'  ";
        $result341 = mysql_db_query($basedatos, $sSQL341);
        $myrow341 = mysql_fetch_array($result341);
        ?>
  <p align="center">&nbsp;</p>
  <table width="669" border="0" align="center">
    <tr>
      <th width="54" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">#MOV </span></div></th>
      <th width="87" height="14" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">Fecha/Hora </span></div></th>
      <th width="246" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">Descripci&oacute;n/Concepto</span></div></th>
      <th width="56" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">Cant</span></div></th>
      <th width="53" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">Importe</span></div></th>
      <th width="85" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">Importe</span>Facturado</div></th>
      <th width="34" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">Escojer </span></div></th>
      <th width="20" bgcolor="#660066" class="style14" scope="col"><div align="left"></div></th>
    </tr>
	
      <?php 
        //traigo agregados
        if ($tipoCliente == 'aseguradora') {
            $sSQL81 = "\r\nSELECT \r\n* FROM\r\ncargosCuentaPaciente \r\n WHERE \r\n numeroE = '" . $numeroE . "'\r\n \r\n and nCuenta='" . $nCuenta . "'\r\nand\r\nstatus!='transaccion'\r\nand \r\nstatusTraslado='trasladado'\r\nand\r\ntipoCliente='" . $tipoCliente . "'\r\n\r\n \r\n \r\n  order by fecha1,hora1 asc\r\n";
        } else {
            $sSQL81 = "\r\nSELECT \r\n* FROM\r\ncargosCuentaPaciente \r\n WHERE \r\n numeroE = '" . $numeroE . "'\r\n \r\n and nCuenta='" . $nCuenta . "'\r\nand\r\nstatus!='transaccion'\r\n\r\n\r\n\r\n \r\n \r\n  order by fecha1,hora1 asc\r\n";
        }
        $result81 = mysql_db_query($basedatos, $sSQL81);
        while ($myrow81 = mysql_fetch_array($result81)) {
            $a += '1';
            $art = $myrow81['codProcedimiento'];
            $codigo = $proc = $myrow81['codProcedimiento'];
            $keyCAP = $myrow81['keyCAP'];
            ?>
	
	
	
	
    <tr>
<td bgcolor="<?php 
            echo $color;
            ?>
" class="Estilo24"><div align="left"><span class="<?php 
            echo $estilo;
            ?>
"><?php 
            echo $myrow81['keyCAP'];
            ?>
</span> 
  <label>
  <input name="keyCAP[]" type="hidden" id="keyCAP[]" value="<?php 
            echo $keyCAP;
            ?>
"  />
  </label>
</div></td>





      <td height="21" bgcolor="<?php 
            echo $color;
            ?>
" class="Estilo24"><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;
            ?>
" class="Estilo24"><div align="left"><span class="<?php 
            echo $estilo;
            ?>
"><span class="style12"><span class="style7">
        <?php 
            $descripcion = new articulosDetalles();
            $descripcion->descripcion($keyCAP, $numeroE, $nCuenta, $codigo, $basedatos);
            if ($myrow81['status'] != 'transaccion') {
                $nombreMed = new nombreMedico();
                echo " " . $myrow81['descripcion'] . $nombreMed->nombreMed($medico, $basedatos);
            }
            ?>
        </span></span>        <span class="style12">
          
          <?php 
            if ($myrow81['gpoProducto']) {
                echo '[' . $myrow81['gpoProducto'] . ']';
            }
            ?>
          
      </span> </span></div></td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="Estilo24"><div align="left"><span class="<?php 
            echo $estilo;
            ?>
">
        <?php 
            if ($_POST['tipoVista'] == 'Agrupado') {
                echo $cantidad = $myrow14['cantidad2'];
            } else {
                echo $cantidad = $myrow81['cantidad'];
            }
            ?>
      </span></div></td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="Estilo24"><div align="left"><span class="<?php 
            echo $estilo;
            ?>
">
        <?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();
                }
            }
            ?>
        <span class="style12"><span class="style7">
      
          <?php 
            $cantidadActual[0] += $myrow81['precioVenta'] * $myrow81['cantidad'] + $myrow81['iva'] * $myrow81['cantidad'];
            echo "\$" . number_format($cantidadActual[0], 2);
            ?>
          
        </span></span> 
		
		</span></div></td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="<?php 
            echo $estilo;
            ?>
">
	  </td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="<?php 
            echo $estilo;
            ?>
">
	  
	  <?php 
            if ($myrow81['statusFactura'] == 'standby') {
                ?>
	  <input name="solicita[]" type="checkbox" id="solicita[]" value="<?php 
                echo $keyCAP;
                ?>
" />
	  <?php 
            }
            ?>
	  </td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="<?php 
            echo $estilo;
            ?>
">
	
        <div align="left">
          <label>
		  <?php 
            if ($myrow81['statusFactura'] == 'request') {
                $b += 1;
                ?>
          <input name="solicita1[]" type="checkbox" id="solicita1[]" value="<?php 
                echo $keyCAP;
                ?>
" />
		  <?php 
            }
            ?>
          </label>
        </div></td>
	</tr>
 
	
	
    <?php 
        }
        ?>
  </table>


		  <table width="671" border="0" align="center" cellpadding="1" cellspacing="1">
            <tr>
              <th width="92" scope="col">&nbsp;</th>
              <th width="92" scope="col">&nbsp;</th>
              <th width="92" scope="col">&nbsp;</th>
              <th width="170" scope="col">&nbsp;</th>
              <th width="57" scope="col">&nbsp;</th>
              <th width="84" scope="col"><div align="left"><span class="style71">
                <?php 
        echo "\$" . number_format($myrow341['cantidadF'], 2);
        ?>
              </span></div></th>
              <th width="37" scope="col">&nbsp;</th>
              <th width="22" scope="col">&nbsp;</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>
		  <table width="53%" border="3" align="center" cellpadding="1" cellspacing="1" class="style71">
            <tr>
              <th width="18%" scope="col"><span class="style72">Cantidad</span></th>
              <th width="23%" scope="col">
<input name="cantidadSolicitada" type="text" class="style71" id="cantidadSolicitada" value="<?php 
        echo $cantidadActual[0];
        ?>
"></th>
              <th width="59%" scope="col"> <span class="style74"><blink><?php 
        echo $leyenda;
        ?>
</blink></span></th>
            </tr>
          </table>
		  <p align="center">&nbsp;		  </p>
		  <p align="center">
		  <?php 
        if ($myrow341['cantidadF']) {
            echo 'Tienes disponible para facturar: ' . '$' . number_format(ltrim($cantidadActual[0]) - ltrim($myrow341['cantidadF']), 2);
            $cActual = number_format(ltrim($cantidadActual[0]) - ltrim($myrow341['cantidadF']), 2);
        } else {
            $cActual = $cantidadActual[0] + $cantidadIva[0];
        }
        ?>
		  &nbsp;</p>
		  <p align="center">
		    <label>
		    <input name="tipoCliente" type="hidden" id="tipoCliente" value="<?php 
        echo $_GET['tipoCliente'];
        ?>
" />
		    <input name="bandera" type="hidden" id="bandera" value="<?php 
        echo $a;
        ?>
">
		    <input name="escoje" type="submit" class="style7" id="escoje" value="Escoje" />
		    </label>
		    <input name="quitar" type="submit" class="style71" id="quitar" value="Quitar" />
		  </p>
		  <p align="center">
	
		  <?php 
        if ($b > 0) {
            ?>
		    <input name="facturar" type="submit" class="style71" id="nuevo" value="Solicitar Facturar" <?php 
            if (!$cActual) {
                echo 'disabled=""';
            }
            ?>
/>
			<?php 
        }
        ?>
			
<input name="cantidadActual" type="hidden" id="cantidadActual" value="<?php 
        echo $cActual;
        ?>
" />
		
		  </p>
</form>
<p align="center">&nbsp;</p>
</body>
</html>
<?php 
    }
           
        if( vacio(F.tipoTransaccion.value) == false ) {   
                alert("Escoje el Tipo de Transacci�n que desees hacer!")   
                return false   
        }  else if( vacio(F.cantidadRecibida.value) == false ) {   
                alert("Escribe la cantidad!")   
                return false   
        }                     
		
		
}   
  
</script> 
<?php 
$convenioParticular = new acumulados();
$convenioAseguradora = new acumulados();
$cargosParticulares = new acumulados();
$cargosCortesia = new acumulados();
$dev = new acumulados();
if ($_GET['almacen']) {
    $almacenFuente = $_GET['almacen'];
} else {
    $almacenFuente = $_POST['almacenFuente'];
}
$TOTAL = $_GET['TOTAL'];
$iva = $_GET['iva'];
$numeroCuenta = $_GET['nCuenta'];
$descuento = $_GET['descuento'];
$depositos = $_GET['depositos'];
$devolucion = $_GET['cantidadRecibida'] - $TOTAL;
$sSQL3 = "Select * From clientesInternos WHERE keyClientesInternos = '" . $numeroCuenta . "'  ";
示例#14
0
    public function tt($entidad, $class, $estilo, $fechas1, $fechas2, $keyClientesInternos, $folioVenta, $basedatos)
    {
        ?>
<div align="center">
    <div align="left">
      <p>&nbsp;</p>
     <table width="312" border="0" align="left" class="normal">
        <tr>
          <th width="212" bgcolor="#FFFF00" class="negromid" scope="col"><div align="left">Descripci&oacute;n</div></th>
          <th width="62" bgcolor="#FFFF00" class="negromid" scope="col"><div align="left">Importe</div></th>
       </tr>
        <tr>
          <?php 
        $sSQL14a = "\r\nSELECT \r\nseguro\r\nFROM\r\nclientesInternos\r\nWHERE \r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $folioVenta . "'\r\n";
        $result14a = mysql_db_query($basedatos, $sSQL14a);
        $myrow14a = mysql_fetch_array($result14a);
        $sSQL = "\r\nSELECT codigoGP,descripcionGP FROM gpoProductos\r\nWHERE \r\nentidad='" . $entidad . "' \r\nand\r\nactivo='activo'\r\n";
        if ($result = mysql_db_query($basedatos, $sSQL)) {
            while ($myrow = mysql_fetch_array($result)) {
                $codigo = $code = $myrow['codigo'];
                $C = $myrow['codigoGP'];
                $sSQL7D = "SELECT SUM((cantidadAseguradora*cantidad)+(cantidadParticular*cantidad)) as acumulado\r\nFROM\r\ncargosCuentaPaciente\r\nWHERE\r\nentidad='" . $entidad . "'\r\nand\r\ngpoProducto='" . $C . "'\r\nand\r\nfolioVenta='" . $folioVenta . "'\r\n and \r\n statusCargo='cargado'\r\n and\r\n naturaleza='A'\r\n and\r\n status!='transaccion'  \r\n and\r\n statusDevolucion='si'";
                $result7D = mysql_db_query($basedatos, $sSQL7D);
                $myrow7D = mysql_fetch_array($result7D);
                if ($fecha1 and $fecha2) {
                    //***************************
                    $sSQL7 = "SELECT SUM((cantidadAseguradora*cantidad)+(cantidadParticular*cantidad)) as acumulado\r\nFROM\r\ncargosCuentaPaciente\r\nWHERE\r\nentidad='" . $entidad . "'\r\nand\r\ngpoProducto='" . $C . "'\r\nand\r\nfolioVenta='" . $folioVenta . "'\r\n and\r\n statusCargo='cargado'\r\n  and \r\n (fecha1 between'" . $fechas1 . "' and '" . $fechas2 . "')\r\n  and\r\n naturaleza='C'\r\n  and\r\n status!='transaccion'\r\n\r\n ";
                } else {
                    //*****************************
                    $sSQL7 = "SELECT SUM((cantidadAseguradora*cantidad)+(cantidadParticular*cantidad)) as acumulado\r\nFROM\r\ncargosCuentaPaciente\r\nWHERE\r\nentidad='" . $entidad . "'\r\nand\r\ngpoProducto='" . $C . "'\r\nand\r\nfolioVenta='" . $folioVenta . "'\r\n and \r\n statusCargo='cargado'\r\n and\r\n naturaleza='C'\r\n and\r\n status!='transaccion'  ";
                }
                $result7 = mysql_db_query($basedatos, $sSQL7);
                $myrow7 = mysql_fetch_array($result7);
                ?>
          <td  bgcolor="<?php 
                echo $color;
                ?>
" ><div align="left"><span class="normalmid"> <?php 
                echo $myrow['descripcionGP'];
                ?>
</span></div></td>
          <td bgcolor="<?php 
                echo $color;
                ?>
"  align="right" class="precio1"><?php 
                $cargos[0] += $myrow7['acumulado'] - $myrow7D['acumulado'];
                echo "\$" . number_format($myrow7['acumulado'] - $myrow7D['acumulado'], 2);
                ?>
</td>
        </tr>
        <?php 
            }
        }
        ?>
</table>

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

      <table width="292" border="0" align="left" class="normal">
        <tr>
          <td width="153" height="23" align="center" class="normalmid">IVA</td>
          <td width="129" class="negromid"><div align="right">
            <?php 
        $iva = new acumulados();
        $ivaD = new acumulados();
        $iva = $iva->ivaAcumulado($entidad, $basedatos, $usuario, $keyClientesInternos) - $ivaD->ivaAcumuladoD($entidad, $basedatos, $usuario, $keyClientesInternos);
        echo "\$" . number_format($iva, 2);
        ?>
          </div></td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <table width="292" border="0" align="left" class="normal">

        <tr bgcolor="#FFCCFF">
          <td width="158" height="23" bgcolor="#FFFF00" class="negromid">Cargos</td>
          <td width="124" bgcolor="#FFFF00" class="precio1"><div align="right">
            <?php 
        $coaseguroN = new acumulados();
        $coa = $coaseguroN->cargosCoaseguroN($entidad, $basedatos, $usuario, $keyClientesInternos);
        $totalAcumulado = new acumulados();
        $totalDevoluciones = new acumulados();
        $cargos = $totalAcumulado->totalAcumulado($basedatos, $usuario, $keyClientesInternos) - $totalDevoluciones->dev($entidad, $basedatos, $usuario, $folioVenta) + $iva;
        echo "\$" . number_format($cargos, 2);
        ?>
          </div></td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <table width="293" border="0" align="left"  >
        <tr bgcolor="#FFCCFF">
          <td width="158" height="23" bgcolor="#CCCCCC" class="normal"><span class="negromid">Total Abonos</span></td>
          <td width="125" bgcolor="#CCCCCC" class="precio2"><div align="right">
              <?php 
        $abonos = new acumulados();
        $abonoS = $abonos->abonos($entidad, $basedatos, $usuario, $folioVenta);
        echo "\$" . number_format($abonos->abonos($entidad, $basedatos, $usuario, $folioVenta), 2);
        ?>
          </div></td>
        </tr>
        <tr>
          <td height="23" class="negromid">Saldo Actual </td>
      <td class="titulomedio"><div align="right">
              <?php 
        if ($abonoS < 0) {
            $STotal = $cargos + $abonoS;
        } else {
            $STotal = $cargos - $abonoS;
        }
        echo "\$" . number_format($STotal, 2);
        ?>
          </div></td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
    </div>
    <p>&nbsp;</p>
    <table width="279" border="0" align="center" class="normal">
      <tr>
        <td width="197" height="23" class="error2">Total por Surtir (iva incluido ) </td>
        <td width="72" class="precio2"><div align="right">
            <?php 
        $totalxSurtir = new acumulados();
        echo "\$" . number_format($totalxSurtir->totalxSurtirFV($entidad, $basedatos, $usuario, $folioVenta), 2);
        ?>
        </div></td>
      </tr>
    </table>
    <p>&nbsp;</p>
</div>
  <?php 
    }
示例#15
0
    public function revisarCuenta($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'];
            for ($i = 0; $i <= $_POST['bandera2']; $i++) {
                $agrega = "UPDATE cargosCuentaPaciente set \r\nstatus='cerrada',\r\nusuarioAlta='" . $usuario . "',\r\nfechaAlta='" . $fecha1 . "',\r\nhoraAlta='" . $hora1 . "'\r\n\r\nwhere\r\nnumeroE='" . $numeroE . "' \r\nand\r\nnCuenta='" . $nCuenta . "'\r\nand statusAlta='efectivo'\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';
            ?>
<script type="text/vbscript">
msgbox "LA CUENTA <?php 
            echo $_GET['nT'];
            ?>
 ESTA CERRADA!"
</script>';

<script>
javascript:ventanaSecundaria6('<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/INGRESOS%20HLC/caja/imprimirCierreCuenta.php?numeroE=<?php 
            echo $nCliente5;
            ?>
&amp;nT=<?php 
            echo $numeroCuenta;
            ?>
&amp;paciente=<?php 
            echo $_POST['paciente'];
            ?>
&amp;orden=<?php 
            echo $E;
            ?>
&amp;hora1=<?php 
            echo $hora1;
            ?>
');
</script>

<script>
close();
   </script>
   <script language="JavaScript" type="text/javascript">
  <!--
    opener.location.reload(true);
    self.close();
  // -->
</script>
   
   
<?php 
        }
        if (!$_POST['tipoVista']) {
            $_POST['tipoVista'] = 'Detalle';
        }
        ?>
<!-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">
<style type="text/css">
<!--
.style71 {font-size: 9px}
.style71 {font-size: 9px}
.style71 {font-size: 9px}
-->
</style>
<head>






<title></title>
<style type="text/css">
<!--
.style13 {color: #FFFFFF}
.style11 {color: #FFFFFF; font-size: 10px; font-weight: bold; }
.style7 {font-size: 9px}
.Estilo24 {font-size: 10px}
.style19 {color: #000000; font-weight: bold; }
-->
</style>


</head>
<style type="text/css">
<!--
.style12 {font-size: 10px}
.style14 {font-size: 10px; color: #FFFFFF; }
.style21 {color: #FF0000}
-->
</style>




<BODY  >
<?php 
        //ventanasPrototype::links();
        ?>
<h1 align="center"><?php 
        echo $TITULO;
        ?>
</h1>
<form id="form1" name="form1" method="post" action="">
  <table width="642" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#990099" class="Estilo24">
    <tr>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <th bgcolor="#660066" class="style14" scope="col"><div align="left">N&uacute;mero de Transacci&oacute;n: </div></th>
      <th bgcolor="#660066" class="style14" scope="col"><div align="left"><?php 
        echo $nCliente = $myrow3['keyClientesInternos'];
        ?>
          <input name="numeroE" type="hidden" class="Estilo24" id="numeroE" 
		  value="<?php 
        echo $nCliente = $_POST['numeroE'];
        ?>
" readonly=""/>
</label></div>
      </th>
    </tr>
    <tr>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <th width="134" bgcolor="#FFCCFF" class="Estilo24" scope="col"><div align="left"><strong>Paciente: </strong></div></th>
      <th width="408" bgcolor="#FFCCFF" class="Estilo24" scope="col"><div align="left"><strong>
          <label> </label>
      </strong> <?php 
        echo $myrow3['paciente'];
        ?>
 </div></th>
    </tr>
    <tr>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <td class="Estilo24">Compa&ntilde;&iacute;a: </td>
      <td class="Estilo24"><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>
      <th class="Estilo24" scope="col">&nbsp;</th>
      <td bgcolor="#FFCCFF" class="Estilo24">N&deg; Credencial: </td>
      <td bgcolor="#FFCCFF" class="Estilo24"><?php 
        echo $myrow3['credencial'];
        ?>
 </td>
    </tr>
    <tr>
      <th class="Estilo24" scope="col">&nbsp;</th>
      <td class="Estilo24">Fecha</td>
      <td class="Estilo24"><span class="style12">
        <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="style12" 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="style12" id="lanzador" value="..." />
        Entre </label>
      <input name="fecha2" type="text" class="style12" 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="style12" id="lanzador1" value="..." />
        <input name="show" type="submit" class="style7" id="show" value="&gt;" />
        
        <?php 
        } else {
            ?>
        <input name="fecha3" type="hidden" class="style12" id="fecha2" value="<?php 
            echo 'all';
            ?>
"/>
		<?php 
        }
        ?>
</label>
</span></td>
    </tr>
    <tr>
      <th class="Estilo24" scope="col">&nbsp;</th>
      <th class="Estilo24" scope="col"><div align="left"><strong>M&eacute;dico: </strong></div></th>
      <th class="Estilo24" 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>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <td bgcolor="#FFCCFF" class="Estilo24">Tipo de Vista: </td>
      <td bgcolor="#FFCCFF" class="Estilo24"><label>
        <select name="tipoVista" class="style7" 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>



  
  
 
    


  <table width="751" border="0" align="center">
    <tr>
      <th width="60" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">#MOV </span></div></th>
      <th width="96" height="14" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">Fecha/Hora </span></div></th>
      <th width="300" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">Descripci&oacute;n/Concepto</span></div></th>
      <th width="21" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">Cant</span></div></th>
      <th width="27" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">Status</span></div></th>
      <th width="47" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">D Solicita</span></div></th>
      <th width="52" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">D Cargo.</span></div></th>
      <th width="72" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">Tipo P </span></div></th>
      <th width="38" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">N </span></div></th>
    </tr>
	
      <?php 
        //traigo agregados
        $sSQL81 = "\r\nSELECT \r\nkeyCAP,codProcedimiento,um,hora1,fecha1,cantidad,iva,almacenDestino,almacenSolicitante,precioVenta,tipoCliente,gpoProducto,naturaleza,tipoTransaccion,porcentajeVariable,cargosHospitalarios,descripcion\r\nFROM\r\ncargosCuentaPaciente \r\n WHERE \r\nnumeroE = '" . $numeroE . "'\r\n \r\n and nCuenta='" . $nCuenta . "'\r\n\r\n\r\n \r\n group by codProcedimiento \r\n order by fecha1,hora1 asc\r\n";
        if ($result81 = mysql_db_query($basedatos, $sSQL81)) {
            while ($myrow81 = mysql_fetch_array($result81)) {
                $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);
                }
                ?>
	
	
	
	
    <tr>
<td bgcolor="<?php 
                echo $color;
                ?>
" class="Estilo24"><div align="left"><span class="<?php 
                echo $estilo;
                ?>
"><?php 
                echo $myrow81['keyCAP'];
                ?>
</span></div></td>





      <td height="21" bgcolor="<?php 
                echo $color;
                ?>
" class="Estilo24"><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;
                ?>
" class="Estilo24"><div align="left"><span class="<?php 
                echo $estilo;
                ?>
"><span class="style12"><span class="style7">
        <?php 
                $descripcion = new articulosDetalles();
                $descripcion->descripcion($keyCAP, $numeroE, $nCuenta, $codigo, $basedatos);
                $medico = $myrow81['almacenDestino'];
                $nombreMed = new nombreMedico();
                echo " " . $myrow81['descripcion'] . $nombreMed->nombreMed($medico, $basedatos);
                ?>
        </span></span>        <span class="style12">
          
          <?php 
                if ($myrow81['gpoProducto']) {
                    echo '[' . $myrow81['gpoProducto'] . ']';
                }
                ?>
          
      </span> </span></div></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="Estilo24"><div align="left"><span class="<?php 
                echo $estilo;
                ?>
">
        <?php 
                if ($_POST['tipoVista'] == 'Agrupado') {
                    echo $cantidad = $myrow14['cantidad2'];
                } else {
                    echo $cantidad = $myrow81['cantidad'];
                }
                ?>
      </span></div></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="<?php 
                echo $estilo;
                ?>
"><div align="left"><span class="style7">
        
        
        
        <span class="style12">
          <?php 
                $status = new acumulados();
                echo $status->status($keyCAP, $basedatos, $usuario, $numeroE, $nCuenta);
                ?>
        </span></span></div></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="<?php 
                echo $estilo;
                ?>
"><div align="left"><span class="style7"><span class="style12">
      <?php 
                echo $myrow81['almacenSolicitante'];
                ?>
</span></span></div></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="<?php 
                echo $estilo;
                ?>
"><div align="left"><span class="style7"><span class="style12"><?php 
                echo $myrow81['almacenDestino'];
                ?>
</span></span></div></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="<?php 
                echo $estilo;
                ?>
"><span class="Estilo24"><?php 
                echo $myrow81['tipoCliente'];
                ?>
</span></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="<?php 
                echo $estilo;
                ?>
">
	
        <div align="left"><span class="style7"><span class="style12">
          <?php 
                echo $myrow81['naturaleza'];
                ?>
</span>
        </span></div></td>
	</tr>
 
	
	
    <?php 
            }
        }
        ?>
  </table>


  <p align="center">
		    <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>
  <p align="center">&nbsp;</p>
</form>
<p align="center">&nbsp;</p>
</body>
</html>
<?php 
    }
            <td class="Estilo24"><span class="style12">Cantidad </span></td>
            <td class="Estilo24"><span class="style12">
			
		
				
				
		<?php 
        //tipo de paciente externo
        $sSQL3471 = "Select codigoTT From catTTCaja WHERE banderaDevolucion='si'";
        $result3471 = mysql_db_query($basedatos, $sSQL3471);
        $myrow3471 = mysql_fetch_array($result3471);
        $transaccion = $myrow3471['codigoTT'];
        ?>
			 
			 <?php 
        $totalAcumulado = new acumulados();
        $valor = $totalAcumulado->totalAcumulado($basedatos, $usuario, $numeroE, $nCuenta);
        //echo "$".number_format($totalAcumulado->totalAcumulado($basedatos,$usuario,$numeroE,$nCuenta),2);
        ?>
<input name="cantidadRecibida" type="text" class="style7" id="cantidadRecibida" value="<?php 
        echo round(-$valor, 2);
        ?>
" autocomplete="off" readonly=""/>
  <input name="tipoTransaccion" type="hidden" class="Estilo24" id="tipoTransaccion" 
				value="<?php 
        echo $transaccion;
        ?>
"   readonly="" />			 
			 
		 
			 
    public function listaExternos($entidad, $TITULO, $fecha1, $ventana, $basedatos)
    {
        ?>
  <script language="JavaScript" type="text/javascript">
    /**
    * funcion demo del evento onclick en la tabla
    */
    function envia()
    {
      document.forms[0].submit();
    }
    /**
    * funcion de captura de pulsaci�n de tecla en Internet Explorer
    */ 
    var tecla;
    function capturaTecla(e) 
    {
        if(document.all)
            tecla=event.keyCode;
        else
        {
            tecla=e.which; 
        }
     if(tecla==13)
        {
            document.forms[0].submit();
        }
    }  
    document.onkeydown = capturaTecla;
</script>


<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana","width=800,height=600,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script> 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<style type="text/css">

.style11 {color: #FFFFFF; font-size: 10px; font-weight: bold; }
.style12 {font-size: 10px}
.style7 {font-size: 9px}
.style13 {color: #FFFFFF}
.enlace {cursor:default;}


div.htmltooltip{
position: absolute; /*leave this and next 3 values alone*/
z-index: 1000;
left: -1000px;
top: -1000px;
background: #272727;
border: 10px solid black;
color: white;
padding: 3px;
width: 250px; /*width of tooltip*/
}

</style>
</head>
<META HTTP-EQUIV="Refresh"
CONTENT="30"> 
<body>


<form id="form1" name="form1" method="get" action="#">
  <h1 align="center"> <?php 
        echo $TITULO;
        ?>
</h1>
  <table width="584" border="0.2" align="center">
    <tr>
      <th width="51" bgcolor="#660066" class="style12" scope="col"><div align="left"><span class="style11 style13"># Folio </span></div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left"><span class="style11 style13">Nombre del paciente:</span></div></th>
      <th bgcolor="#660066" class="style12" scope="col"><span class="style11 style13">Aseguradora</span></th>
	  <th bgcolor="#660066" class="style12" scope="col"><span class="style11 style13">Departamento</span></th>
    </tr>
    <tr>
      <?php 
        $sSQL = "SELECT *\r\nFROM\r\nclientesInternos \r\nWHERE \r\nentidad='" . $entidad . "' AND\r\nstatus='pendiente' \r\nand \r\ntipoPaciente='externo'\r\nAND\r\nfecha1='" . $fecha1 . "'\r\nORDER BY keyClientesInternos DESC\r\n ";
        if ($result = mysql_db_query($basedatos, $sSQL)) {
            while ($myrow = mysql_fetch_array($result)) {
                $numeroE = $myrow['numeroE'];
                $nCuenta = $myrow['nCuenta'];
                if ($col) {
                    $color = '#FFCCFF';
                    $col = "";
                } else {
                    $color = '#FFFFFF';
                    $col = 1;
                }
                $nT = $myrow['keyClientesInternos'];
                ?>
      <td height="24" bgcolor="<?php 
                echo $color;
                ?>
" class="style12"><span class="style7"><?php 
                echo $myrow['keyClientesInternos'];
                ?>
</span></td>


      <td width="257" bgcolor="<?php 
                echo $color;
                ?>
" class="style12"><span class="style7">

	  	  <?php 
                $verificaCargos = new acumulados();
                $verificaCargos->verificaCargos($basedatos, $usuario, $numeroE, $nCuenta);
                if ($verificaCargos->verificaCargos($basedatos, $usuario, $numeroE, $nCuenta) == TRUE) {
                    ?>
	 
<a href="#"  onClick="javascript:ventanaSecundaria('<?php 
                    echo $ventana;
                    ?>
?numeroE=<?php 
                    echo $myrow['keyClientesInternos'];
                    ?>
&amp;nCuenta=<?php 
                    echo $myrow['keyClientesInternos'];
                    ?>
&amp;almacen=<?php 
                    echo $bali;
                    ?>
&amp;nT=<?php 
                    echo $nT;
                    ?>
')">
	  <?php 
                    echo $myrow['paciente'];
                    ?>
</a>
	  <?php 
                } else {
                    ?>
 
	  <?php 
                    echo $myrow['paciente'] . " [NO TIENE NINGUN CARGO]";
                    ?>
	  
	  <?php 
                }
                ?>
 
          <input name="nombrePaciente" type="hidden" id="nombrePaciente" value="<?php 
                echo $nombrePaciente;
                ?>
"/>
        <input name="tipoSeguro" type="hidden" id="tipoSeguro" value="<?php 
                echo $myrow['seguro'];
                ?>
"/>
      </span></td>

      <td width="138" bgcolor="<?php 
                echo $color;
                ?>
" class="style12"><span class="style7"><?php 
                if ($myrow['seguro']) {
                    $numCliente = $myrow['seguro'];
                    $sSQL17 = "\r\n\tSELECT \r\n*\r\nFROM\r\nclientes\r\nWHERE \r\nnumCliente = '" . $numCliente . "'\r\n";
                    $result17 = mysql_db_query($basedatos, $sSQL17);
                    $myrow17 = mysql_fetch_array($result17);
                    echo $myrow17['nomCliente'];
                } else {
                    echo "Sin Seguro";
                }
                ?>
</span></td>

<td width="120" bgcolor="<?php 
                echo $color;
                ?>
" class="style12"><span class="style7"><?php 
                $al = $myrow['almacen'];
                $sSQL17 = "\r\n\tSELECT \r\n*\r\nFROM\r\nalmacenes\r\nWHERE \r\nalmacen = '" . $al . "'\r\n";
                $result17 = mysql_db_query($basedatos, $sSQL17);
                $myrow17 = mysql_fetch_array($result17);
                echo $myrow17['descripcion'];
                ?>
</span></td>

    </tr>
    <?php 
            }
        }
        ?>
    <input name="menu" type="hidden" value="<?php 
        echo $menu;
        ?>
" />
  </table>






  <p>&nbsp;</p>
</form>
</body>
</html>


<?php 
    }


//***************aplicar pago**********************

if($_POST['aplicar'] and (is_numeric($_POST['porcentaje']) or $_POST['tipoTransaccion']) ){


if($_POST['porcentaje']){
if($_POST['cargosHospitalarios']=='si'){
$banderaPM=new acumulados();
$_POST['cantidadRecibida']=$banderaPM->banderaPorcentajeMedicamentos($entidad,$basedatos,$usuario,$numeroE,$nCuenta);
$_POST['cantidadRecibida']=porcentaje($_POST['cantidadRecibida'],$_POST['porcentaje'],$decimales);
} else {
$_POST['cargosHospitalarios']='no';
$cargosGlobales=new acumulados();
$_POST['cantidadRecibida']=$cargosGlobales->cargosGlobalesCoaseguro($entidad,$basedatos,$usuario,$numeroE,$nCuenta);	
$_POST['cantidadRecibida']=porcentaje($_POST['cantidadRecibida'],$_POST['porcentaje'],$decimales);
}
}
$cantidadRecibida=$_POST['cantidadRecibida'];


$naturaleza='-';






示例#19
0
    public function listaExternos($usuario, $ALMACEN, $entidad, $TITULO, $fecha1, $ventana, $basedatos)
    {
        $sSQLC = "Select * From statusCaja where entidad='" . $entidad . "' and usuario='" . $usuario . "' order by keySTC DESC ";
        $resultC = mysql_db_query($basedatos, $sSQLC);
        $myrowC = mysql_fetch_array($resultC);
        if ($myrowC['status'] == 'abierta') {
            //*******************Comienzo la validaci�n*****************
            ?>







<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana","width=800,height=600,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script> 

<script language="javascript" type="text/javascript">

var win = null;
function nueva(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
if(win.window.focus){win.window.focus();}
}

</script>

 <!-Hoja de estilos del calendario --> 
  <link rel="stylesheet" type="text/css" media="all" href="<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/calendario/calendar-brown.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> 
<script type="text/javascript" src="<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/js/wz_tooltip.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" />

<style type="text/css">
<!--
.Estilo24 {font-size: 13px}
-->
</style>
<head>

<?php 
            $estilos = new muestraEstilos();
            $estilos->styles();
            ?>
<meta http-equiv="refresh" content="30" >
</head>

<body>



<?php 
            if ($_GET['fechaInicial']) {
                $date = $_GET['fechaInicial'];
            } else {
                $date = $fecha1;
            }
            ?>

<form id="form10" name="form10" method="get" action="#">
  <h1 align="center" class="titulo"> <?php 
            echo $TITULO;
            ?>
</h1>
  <p align="center" class="titulo">
    <label>
    <input onChange="this.form.submit();" name="fechaInicial" type="text" class="Estilo24" id="campo_fecha" size="10" maxlength="9" readonly=""
		value="<?php 
            echo $date;
            ?>
"/>
    </label>
    <input name="button" type="button" class="Estilo24" id="lanzador" value="..." />
</p>
  <img src="<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/imagenes/bordestablas/borde1.png" width="864" height="24" />
  <table width="864" border="0.2" align="center" cellpadding="4" cellspacing="0">
    <tr bgcolor="#FFFF00">
      <th width="85" class="blanco" scope="col"><div align="left">Referencia</div></th>
      <th width= "195" class="blanco" scope="col"><div align="left">Nombre del paciente:</div></th>
      <th width= "260" class="blanco" scope="col"><div align="left">Aseguradora</div></th>
	  <th class="blanco" scope="col"><div align="left">Departamento</div></th>
	  <th class="blanco" scope="col"><div align="left">Usuario</div></th>
	  <th class="blanco" scope="col">Aplicar</th>
    </tr>
    <tr>
      <?php 
            $sSQL = "SELECT *\r\nFROM\r\nclientesInternos,cargosCuentaPaciente\r\nWHERE \r\nclientesInternos.entidad='" . $entidad . "' AND\r\nclientesInternos.keyClientesInternos=cargosCuentaPaciente.keyClientesInternos\r\nAND\r\ncargosCuentaPaciente.statusCargo='cargado'\r\nAND\r\nclientesInternos.status='activa' \r\nand \r\nclientesInternos.tipoPaciente='interno'\r\nAND\r\n((clientesInternos.almacenSolicitud!='' and clientesInternos.fechaSolicitud='" . $date . "' ) \r\nor\r\n(clientesInternos.fecha1='" . $date . "' )) \r\ngroup by clientesInternos.keyClientesInternos\r\nORDER BY clientesInternos.nomCliente DESC\r\n ";
            if ($result = mysql_db_query($basedatos, $sSQL)) {
                while ($myrow = mysql_fetch_array($result)) {
                    $numeroE = $myrow['numeroE'];
                    $nCuenta = $myrow['nCuenta'];
                    if ($col) {
                        $color = '#FFCCFF';
                        $col = "";
                    } else {
                        $color = '#FFFFFF';
                        $col = 1;
                    }
                    $nT = $myrow['keyClientesInternos'];
                    ?>
      <td height="24" bgcolor="<?php 
                    echo $color;
                    ?>
" class="codigos"><?php 
                    echo $myrow['folioVenta'];
                    ?>
</td>


      <td width="195" bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal">

	  	  <?php 
                    $verificaCargos = new acumulados();
                    $verificaCargos->verificaCargos($basedatos, $usuario, $numeroE, $nCuenta);
                    if ($myrow['paciente']) {
                        ?>

	  <?php 
                        echo $myrow['paciente'];
                        ?>
	  <?php 
                    } else {
                        ?>
 
	  <?php 
                        echo $myrow['paciente'] . " [NO TIENE NINGUN CARGO]";
                        ?>
	  
	  <?php 
                    }
                    ?>
 
          <input name="nombrePaciente" type="hidden" id="nombrePaciente" value="<?php 
                    echo $nombrePaciente;
                    ?>
"/>
        <input name="tipoSeguro" type="hidden" id="tipoSeguro" value="<?php 
                    echo $myrow['seguro'];
                    ?>
"/>
      </span></td>

      <td width="260" bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal"><?php 
                    if ($myrow['seguro']) {
                        $numCliente = $myrow['seguro'];
                        $sSQL17 = "\r\n\tSELECT \r\n*\r\nFROM\r\nclientes\r\nWHERE \r\nnumCliente = '" . $numCliente . "'\r\n";
                        $result17 = mysql_db_query($basedatos, $sSQL17);
                        $myrow17 = mysql_fetch_array($result17);
                        echo $myrow17['nomCliente'];
                    } else {
                        echo "Sin Seguro";
                    }
                    ?>
</span></td>

<td width="179" bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal"><?php 
                    $al = $myrow['almacen'];
                    $sSQL17 = "\r\n\tSELECT \r\ndescripcion\r\nFROM\r\nalmacenes\r\nWHERE \r\nalmacen = '" . $al . "'\r\n";
                    $result17 = mysql_db_query($basedatos, $sSQL17);
                    $myrow17 = mysql_fetch_array($result17);
                    echo $myrow17['descripcion'];
                    ?>
</td>

<td width="70" bgcolor="<?php 
                    echo $color;
                    ?>
" class="codigos"><?php 
                    echo $myrow['usuario'];
                    ?>
</td>
<td width="49" bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal" align="center"><label>


  <a href="javascript:nueva('estadoCuentaE.php?numeroE=<?php 
                    echo $myrow['keyClientesInternos'];
                    ?>
&nCuenta=<?php 
                    echo $myrow['keyClientesInternos'];
                    ?>
&almacenSolicitante=<?php 
                    echo $ALMACEN;
                    ?>
&nT=<?php 
                    echo $nT;
                    ?>
&folioVenta=<?php 
                    echo $myrow['folioVenta'];
                    ?>
&tipoVenta=<?php 
                    echo 'externo';
                    ?>
','ventana1','800','600','yes')"><img src="<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/imagenes/btns/aplybtn.png" alt="Almac&eacute;n &oacute; M&eacute;dico Activo" width="30" height="24" border="0"/>
  </a>
  
</label></td>

    </tr> 
    <?php 
                }
            }
            ?>
    <input name="menu" type="hidden" value="<?php 
            echo $menu;
            ?>
" />
  </table>
  <img src="../imagenes/bordestablas/borde2.png" width="864" height="24" />
<p>&nbsp;</p>
</form>

    <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> 

</body>
</html>



<?php 
        } else {
            $link = new ventanasPrototype();
            $mensaje = new ventanasPrototype();
            $link->links();
            $mensaje->despliegaMensaje('LA CAJA ESTA CERRADA');
        }
        ?>

<?php 
    }
示例#20
0
    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 
    }
    ?>
      </td>
      <td bgcolor="<?php 
    echo $color;
    ?>
" ><div align="center" class="normal">
          <?php 
    echo $cantidad = $myrow81['cantidad'];
    ?>
      </div></td>
      <td bgcolor="<?php 
    echo $color;
    ?>
" class="normal">
        <?php 
    $importe = new acumulados();
    if ($myrow81['naturaleza'] == 'C') {
        echo '$' . number_format($myrow81['precioVenta'], 2);
        $sumatoriaCargos[0] += $myrow81['precioVenta'];
    } else {
        if ($myrow81['naturaleza'] == 'A') {
            echo '-$' . number_format($myrow81['precioVenta'], 2);
            $sumatoriaAbonos[0] += $myrow81['precioVenta'];
        } else {
            $importe->importe($keyCAP, $basedatos);
        }
    }
    ?>
   </td>
      <td bgcolor="<?php 
    echo $color;
    public function eCuentaE($usuario, $entidad, $almacen, $fecha1, $hora1, $dia, $usu, $nT, $basedatos)
    {
        $bali = $almacen;
        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
        $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'];
        $seguroT = ltrim($myrow3['seguro']);
        //***************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['imprimir']) {
            //*************SACO EL NUMERO DE MOVIMIENTO y lo actualizo*************************
            $sSQLC = "Select * From statusCaja where entidad='" . $entidad . "' and usuario='" . $usuario . "' order by keySTC DESC ";
            $resultC = mysql_db_query($basedatos, $sSQLC);
            $myrowC = mysql_fetch_array($resultC);
            $q = "UPDATE statusCaja set \r\nnumRecibo= numRecibo+1\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nkeyCatC='" . $myrowC['keyCatC'] . "'\r\nand\r\nstatus='abierta'\r\norder by keySTC DESC ";
            mysql_db_query($basedatos, $q);
            echo mysql_error();
            $sSQLC = "Select * From statusCaja where entidad='" . $entidad . "' and usuario='" . $usuario . "' order by keySTC DESC ";
            $resultC = mysql_db_query($basedatos, $sSQLC);
            $myrowC = mysql_fetch_array($resultC);
            $q0 = "UPDATE clientesInternos,cargosCuentaPaciente set \r\nclientesInternos.numRecibo= '" . $myrowC['numRecibo'] . "',\r\ncargosCuentaPaciente.numRecibo= '" . $myrowC['numRecibo'] . "'\r\nwhere\r\n\r\nclientesInternos.keyClientesInternos='" . $_GET['nT'] . "'\r\nand\r\nclientesInternos.keyClientesInternos=cargosCuentaPaciente.keyClientesInternos\r\n\r\n";
            mysql_db_query($basedatos, $q0);
            echo mysql_error();
            //*************************************************************
            if ($_GET['paquete'] == 'si') {
                ?>
<script language="javascript">
ventanaSecundaria2('<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/cargos/imprimirReciboPaquetes.php?numeroE=<?php 
                echo $myrow3['numeroE'];
                ?>
&nCuenta=<?php 
                echo $myrow3['nCuenta'];
                ?>
&keyClientesInternos=<?php 
                echo $myrow3['keyClientesInternos'];
                ?>
&paciente=<?php 
                echo $_POST['paciente'];
                ?>
&numeroConfirmacion=<?php 
                echo $numeroConfirmacion;
                ?>
&hora1=<?php 
                echo $hora1;
                ?>
&cajero=<?php 
                echo $usuario;
                ?>
&codigoPaquete=<?php 
                echo $myrow3['codigoPaquete'];
                ?>
&numRecibo=<?php 
                echo $myrowC['numRecibo'];
                ?>
&paciente=<?php 
                echo $_POST['paciente'];
                ?>
&cantidadRecibida=<?php 
                echo $_POST['cantidadRecibida'];
                ?>
&folioVenta=<?php 
                echo $myrow3['folioVenta'];
                ?>
');
close();
</script>
<?php 
            } else {
                ?>
<script>
javascript:ventanaSecundaria2('<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/cargos/imprimirCargosPA.php?numeroE=<?php 
                echo $numeroE;
                ?>
&nCuenta=<?php 
                echo $nCuenta;
                ?>
&keyClientesInternos=<?php 
                echo $nT;
                ?>
&paciente=<?php 
                echo $_POST['paciente'];
                ?>
&numeroConfirmacion=<?php 
                echo $numeroConfirmacion;
                ?>
&hora1=<?php 
                echo $hora1;
                ?>
&cajero=<?php 
                echo $usuario;
                ?>
');
close();
</script>
<?php 
            }
            ?>


<?php 
        }
        ?>

<!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>






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

<h1 align="center" class="titulos">Nota de Venta </h1>
<form id="form1" name="form1" method="post" action="">
  <table width="642" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#990099" class="Estilo24">
    <tr>
      <th width="10" class="blanco" scope="col">&nbsp;</th>
      <th bgcolor="#660066" class="blanco" scope="col"><div align="left" class="blanco">Referencia</div></th>
      <th bgcolor="#660066" class="blanco" scope="col"><div align="left" class="blanco"><?php 
        echo $nCliente = $myrow3['folioVenta'];
        ?>
          <input name="numeroE" type="hidden" class="blanco" id="numeroE" 
		  value="<?php 
        echo $nCliente = $_POST['numeroE'];
        ?>
" readonly=""/>
</label></div>      </th>
    </tr>
    <tr>
      <th width="10" class="normal" scope="col">&nbsp;</th>
      <th width="134" bgcolor="#FFCCFF" class="normal" scope="col"><div align="left" class="normal">Paciente: </div></th>
      <th width="408" bgcolor="#FFCCFF"  scope="col"><div align="left" class="normal"><strong>
          <label> </label>
      </strong> <?php 
        echo $myrow3['paciente'];
        ?>
 </div></th>
    </tr>
    <tr>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <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>
      <th class="Estilo24" scope="col">&nbsp;</th>
      <td bgcolor="#FFCCFF" class="normal">N&deg; Credencial: </td>
      <td bgcolor="#FFCCFF" class="normal"><?php 
        echo $myrow3['credencial'];
        ?>
 </td>
    </tr>
  </table>
  <p align="center">
  <?php 
        if ($_GET['codigoPaquete']) {
            echo 'Paquete: ' . $_GET['codigoPaquete'];
        }
        ?>
  </p>
  

  
  <table width="713" border="0" align="center">
    <tr>
      <th width="140" height="14" bgcolor="#660066" class="blanco" scope="col"><div align="left" class="blanco">Fecha/Hora </div></th>
      <th width="331" bgcolor="#660066" class="blanco" scope="col"><div align="left" class="blanco">Descripci&oacute;n/Concepto</div></th>
      <th width="34" bgcolor="#660066" class="blanco" scope="col"><div align="left" class="blanco">Cant</div></th>
      <th width="80" bgcolor="#660066" class="blanco" scope="col"><div align="left" class="blanco">Importe</div></th>
      <th width="50" bgcolor="#660066" class="blanco" scope="col"><div align="left" class="blanco">IVA</div></th>
      <th width="52" bgcolor="#660066" class="blanco" scope="col"><div align="left" class="blanco">Convenio</div></th>
    </tr>
    <tr>
    
      <?php 
        //traigo agregados
        if ($_GET['paquete'] == 'si') {
            $sSQL81 = "\r\nSELECT \r\n*\r\nFROM\r\narticulosPaquetesPacientes \r\n WHERE \r\nkeyClientesInternos='" . $_GET['nT'] . "'\r\n";
        } else {
            $sSQL81 = "\r\nSELECT \r\nkeyCAP,codProcedimiento,um,hora1,fecha1,cantidad,iva,almacenDestino,almacenSolicitante,precioVenta,tipoCliente,tipoConvenio,folioVenta\r\nFROM\r\ncargosCuentaPaciente \r\n WHERE \r\nkeyClientesInternos='" . $_GET['nT'] . "'\r\n \r\n \r\n \r\n  order by fecha1,hora1 asc\r\n";
        }
        $result81 = mysql_db_query($basedatos, $sSQL81);
        while ($myrow81 = mysql_fetch_array($result81)) {
            $a += '1';
            if ($_GET['paquete'] == 'si') {
                $codigo = $proc = $myrow81['codigo'];
                $chain = $myrow81['hora'] . " " . cambia_a_normal($myrow81['fecha']);
                $sSQL31 = "select * from articulosPaquetes where keyE='" . $myrow81['keyE'] . "'";
                $result31 = mysql_db_query($basedatos, $sSQL31);
                $myrow31 = mysql_fetch_array($result31);
            } else {
                $chain = $myrow81['hora1'] . " " . cambia_a_normal($myrow81['fecha1']);
                $art = $myrow81['codProcedimiento'];
                $codigo = $proc = $myrow81['codProcedimiento'];
                $keyCAP = $myrow81['keyCAP'];
            }
            ?>


  <td height="21" bgcolor="<?php 
            echo $color;
            ?>
" class="normal">
	  <?php 
            echo $chain;
            ?>
</td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="normal">
      <?php 
            $descripcion = new articulosDetalles();
            $descripcion->descripcion($keyCAP, $numeroE, $nCuenta, $codigo, $basedatos);
            ?>
         
		
        <?php 
            if ($myrow811['um'] == 's' or $myrow811['um'] == 'S') {
                echo '  ( Servicio )  ';
            }
            ?>

      </td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" ><div align="center" class="normal">
          <?php 
            echo $cantidad = $myrow81['cantidad'];
            ?>
      </div></td>

      <td bgcolor="<?php 
            echo $color;
            ?>
" class="normal">
        <?php 
            if ($_GET['paquete'] == 'si') {
                echo '$' . number_format($myrow31['precioPaquete1'], 2);
                $sumatoria[0] += $myrow31['precioPaquete1'] * $myrow31['cantidad'];
            } else {
                $importe = new acumulados();
                echo $importe->importe($keyCAP, $basedatos);
            }
            ?>
   </td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="normal">
        <?php 
            if ($_GET['paquete'] == 'si') {
                echo '$' . number_format($myrow31['ivaPrecioPaquete1'], 2);
                $sumatoriaIVA[0] += $myrow31['ivaPrecioPaquete1'] * $myrow31['cantidad'];
            } else {
                $mostrarIVA = new articulosDetalles();
                echo $mostrarIVA->mostrarIVA($keyCAP, $basedatos);
            }
            ?>
      </td>
      <td bgcolor="<?php 
            echo $color;
            ?>
"><div align="center" class="normal">
	   
      
      <?php 
            if ($myrow81['tipoConvenio'] and $myrow81['tipoConvenio'] != 'No') {
                echo 'C';
            } else {
                echo '---';
            }
            ?>
   </div></td>
	</tr>
 
	
	
    <?php 
        }
        ?>
  </table>

  <p>&nbsp;</p>
  <div align="center">
    <table width="558" border="0" align="center">
      <tr>
        <td width="113" class="style12">&nbsp;</td>
        <td width="124" class="style12">&nbsp;</td>
        <td width="97" class="normal">Total Cargos 
          <?php 
        $totalAcumulado = new acumulados();
        if ($_GET['paquete'] == 'si') {
            echo '$' . number_format($sumatoria[0] + $sumatoriaIVA[0], 2);
            $cantidadRecibida = $sumatoria[0] + $sumatoriaIVA[0];
        } else {
            echo "\$" . number_format($totalAcumulado->totalAcumulado($basedatos, $usuario, $numeroE, $nCuenta), 2);
        }
        ?>
      </td>
        <td width="106" height="23"><div align="left" class="normal">Total Abonos 
            <?php 
        $abonos = new acumulados();
        echo "\$" . number_format($abonos->abonos($basedatos, $usuario, $numeroE, $nCuenta), 2);
        ?>
        </div></td>
        <td width="96"><div align="left" class="normal"><strong>Saldo Actual</strong><strong>
          <?php 
        if ($_GET['paquete'] == 'si') {
            $abono = $abonos->abonos($basedatos, $usuario, $numeroE, $nCuenta);
            $abono1 = $abono * '-1';
            echo '$' . number_format(round($sumatoria[0] + $sumatoriaIVA[0] - $abono1), 2);
        } else {
            if ($abonos->abonos($basedatos, $usuario, $numeroE, $nCuenta) < 0) {
                $abono = $abonos->abonos($basedatos, $usuario, $numeroE, $nCuenta);
                $abono1 = $abono * '-1';
            }
            echo "\$" . number_format($totalAcumulado->totalAcumulado($basedatos, $usuario, $numeroE, $nCuenta) - $abono1, 2);
        }
        ?>
        </strong></div></td>
      </tr>
      <tr>
        <td class="style12">&nbsp;</td>
        <td class="style12">&nbsp;</td>
        <td class="style12"><input name="cantidadRecibida" type="hidden" class="style7" id="cantidadRecibida" value="" /></td>
        <td height="23" class="normal"><div align="right"></div></td>
        <td class="normal"><div align="right"></div></td>
      </tr>
      <tr>
        <td class="style12">&nbsp;</td>
        <td class="style12">&nbsp;</td>
        <td class="style12">&nbsp;</td>
        <td height="23" class="style23 Estilo24"><div align="right"></div></td>
        <td class="style12"><div align="right"></div></td>
      </tr>
    </table>


  </div>
  <p align="center">
	<?php 
        if ($_GET['paquete'] == 'si') {
            //***********************CALCULAR
            if (round($sumatoria[0] + $sumatoriaIVA[0] - $abono1) == NULL) {
                ?>
    <label>
    <input name="imprimir" type="image" class="style27" id="imprimir" value="Imprimir" src="<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/imagenes/btns/printbutton.png"/>
    </label>
	<?php 
            } else {
                ?>
    <input name="Submit" type="image" class="style27" value="Aplicar Pagos" src="<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/imagenes/btns/aplicapay.png"  onclick="javascript:ventanaSecundaria7('<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                echo $_GET['usuario'];
                ?>
&numeroE=<?php 
                echo $numeroE;
                ?>
&almacen=<?php 
                echo $_GET['almacenSolicitante'];
                ?>
&almacenFuente=<?php 
                echo $almacen;
                ?>
&seguro=<?php 
                echo $seguroT;
                ?>
&nCuenta=<?php 
                echo $myrow3['keyClientesInternos'];
                ?>
&tipoCliente=<?php 
                echo 'particular';
                ?>
&tipoVenta=<?php 
                echo $_GET['tipoVenta'];
                ?>
&paquete=<?php 
                echo $_GET['paquete'];
                ?>
')"/>
    <input name="keyClientesInternos" type="hidden" class="style7" id="keyClientesInternos" value="<?php 
                echo $_GET['nT'];
                ?>
" />
	<?php 
            }
            //*********************************
        } else {
            if (round($totalAcumulado->totalAcumulado($basedatos, $usuario, $numeroE, $nCuenta) - $abono1) == NULL) {
                ?>
    <label>
    <input name="imprimir" type="image" class="style27" id="imprimir" value="Imprimir" src="<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/imagenes/btns/printbutton.png"/>
    </label>
	<?php 
            } else {
                ?>
    <input name="Submit" type="image" class="style27" value="Aplicar Pagos" src="<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/imagenes/btns/aplicapay.png"  onclick="javascript:ventanaSecundaria7('<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?usuario=<?php 
                echo $_GET['usuario'];
                ?>
&numeroE=<?php 
                echo $numeroE;
                ?>
&almacen=<?php 
                echo $_GET['almacenSolicitante'];
                ?>
&almacenFuente=<?php 
                echo $almacen;
                ?>
&seguro=<?php 
                echo $seguroT;
                ?>
&nCuenta=<?php 
                echo $myrow3['keyClientesInternos'];
                ?>
&tipoCliente=<?php 
                echo 'particular';
                ?>
&tipoVenta=<?php 
                echo $_GET['tipoVenta'];
                ?>
')"/>
    <input name="keyClientesInternos" type="hidden" class="style7" id="keyClientesInternos" value="<?php 
                echo $_GET['nT'];
                ?>
" />
	<?php 
            }
        }
        ?>
  </p>


</form>

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

</body>
</html>
<?php 
    }
    public function listaExternosDescuentos($ALMACEN, $entidad, $TITULO, $ventana, $basedatos)
    {
        ?>
<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana","width=800,height=600,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script> 
<script src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/js/jquery.js" type="text/javascript"></script>
 <!-Hoja de estilos del calendario --> 
  <link rel="stylesheet" type="text/css" media="all" href="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/calendario/calendar-brown.css" title="win2k-cold-1" />
  <!-- librer�a principal del calendario --> 
 <script type="text/javascript" src="../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> 

<script language="javascript" type="text/javascript">

var win = null;
function nueva(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
if(win.window.focus){win.window.focus();}
}

</script>


<script type="text/javascript" src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/js/wz_tooltip.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" />

<head>

<?php 
        $estilos = new muestraEstilos();
        $estilos->styles();
        ?>
<meta http-equiv="refresh" content="30" >
</head>

<body>
    <div class="page_right">
<?php 
        if ($_GET['fechaInicial']) {
            $date = $_GET['fechaInicial'];
        } else {
            $date = $fecha1;
        }
        ?>


<form id="form10" name="form10" method="get" action="#">
  <h1 align="center" >Aplicar Descuentos Pacientes Externos</h1>
  <p align="center" >Fecha: 
  <input onChange="this.form.submit();" name="fechaInicial" type="text"  id="campo_fecha" size="10" maxlength="10" readonly=""
		value="<?php 
        echo $date;
        ?>
"/>
    </label>
    <input name="button" type="image"src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/imagenes/btns/fecha.png" /></p>

  <!--<table width="536" class="table table-striped">-->
  <table width="536" class="table-template">
    <tr >
      <th width="49"   scope="col"><div align="center">Folio</div></th>
      <th width= "238"   scope="col"><div align="center">Nombre del paciente:</div></th>
      <th   scope="col"><div align="center">Departamento</div></th>
	  <th   scope="col"><div align="center">Usuario</div></th>
	  <th   scope="col"><div align="center">Aplicar</div></th>
    </tr>
    <tr >
      <?php 
        $fecha1 = date("Y-m-d");
        $sSQL = "SELECT *\r\nFROM\r\nclientesInternos\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nstatus!='cancelado'\r\nand\r\ntipoPaciente='externo'\r\nand\r\nfecha='" . $date . "'\r\nand\r\nstatusCaja!='pagado'\r\nand\r\nfolioVenta!=''\r\n\r\nORDER BY paciente ASC\r\n ";
        if ($result = mysql_db_query($basedatos, $sSQL)) {
            while ($myrow = mysql_fetch_array($result)) {
                $numeroE = $myrow['numeroE'];
                $nCuenta = $myrow['nCuenta'];
                $nT = $myrow['keyClientesInternos'];
                ?>
       <tr  > 
      <td height="24" ><?php 
                echo $myrow['folioVenta'];
                ?>
</td>


      <td width="238" >

	  	  <?php 
                $verificaCargos = new acumulados();
                $verificaCargos->verificaCargos($basedatos, $usuario, $numeroE, $nCuenta);
                if ($myrow['paciente']) {
                    ?>

	  <?php 
                    echo $myrow['paciente'];
                    ?>
	  <?php 
                } else {
                    ?>
 
	  <?php 
                    echo $myrow['paciente'] . " [NO TIENE NINGUN CARGO]";
                    ?>
	  
	  <?php 
                }
                ?>
 
        <input name="nombrePaciente" type="hidden" id="nombrePaciente" value="<?php 
                echo $nombrePaciente;
                ?>
"/>
        <input name="tipoSeguro" type="hidden" id="tipoSeguro" value="<?php 
                echo $myrow['seguro'];
                ?>
"/>
      </span></td>

      <td width="104" ><?php 
                $al = $myrow['almacen'];
                $sSQL17 = "\r\n\tSELECT \r\ndescripcion\r\nFROM\r\nalmacenes\r\nWHERE \r\nalmacen = '" . $al . "'\r\n";
                $result17 = mysql_db_query($basedatos, $sSQL17);
                $myrow17 = mysql_fetch_array($result17);
                echo $myrow17['descripcion'];
                ?>
</td>

<td width="74"  align="center"><?php 
                echo $myrow['usuario'];
                ?>
</td>
<td width="49"  align="center"><label>

<?php 
                if ($myrow['descuento'] == '') {
                    ?>
  <a href="javascript:nueva('../cargos/aplicarDescuentos.php?numeroE=<?php 
                    echo $myrow['keyClientesInternos'];
                    ?>
&nCuenta=<?php 
                    echo $myrow['keyClientesInternos'];
                    ?>
&almacenSolicitante=<?php 
                    echo $ALMACEN;
                    ?>
&nT=<?php 
                    echo $nT;
                    ?>
&folioVenta=<?php 
                    echo $myrow['folioVenta'];
                    ?>
&tipoVenta=<?php 
                    echo 'externo';
                    ?>
','ventana1','800','600','yes')"><img src="<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/imagenes/btns/desctbtn.png" alt="Almac&eacute;n &oacute; M&eacute;dico Activo" width="24" height="24" border="0"/>  </a>
<?php 
                } else {
                    echo '---';
                }
                ?>
   
</label></td>
    </tr> 
    <?php 
            }
        }
        ?>
    <input name="menu" type="hidden" value="<?php 
        echo $menu;
        ?>
" />
    <input name="main" type="hidden" value="<?php 
        echo $_GET['main'];
        ?>
" />
    <input name="warehouse" type="hidden" value="<?php 
        echo $_GET['warehouse'];
        ?>
" />
     <input name="datawarehouse" type="hidden" value="<?php 
        echo $_GET['datawarehouse'];
        ?>
" />
  </table>

<p>&nbsp;</p>
</form>
    </div>
<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>
</body>
</html>
<?php 
    }
    public function eCuentaE($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 
        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 
        }
        ?>












<?php 
        //************************ACTUALIZO **********************
        $sSQL3 = "Select * From clientesInternos WHERE entidad='" . $entidad . "' and folioVenta = '" . $_GET['folioVenta'] . "' ";
        $result3 = mysql_db_query($basedatos, $sSQL3);
        $myrow3 = mysql_fetch_array($result3);
        $keyClientesInternos = $myrow3['keyClientesInternos'];
        $numeroE = $myrow3['numeroE'];
        $nCuenta = $myrow3['nCuenta'];
        $cuarto = $myrow3['cuarto'];
        $entidad = $myrow3['entidad'];
        if ($myrow3['seguro']) {
            $tipoCliente = 'aseguradora';
            $seguro = $myrow3['seguro'];
        } else {
            $tipoCliente = 'particular';
        }
        //***************aplicar pago**********************
        //transaccion estatica
        if ($_POST['aplicar'] and is_numeric($_POST['porcentaje']) and $_POST['gpoProducto']) {
            $keyCAP = $_POST['keyCAP'];
            $fechaDescuento = $fecha1 . ' ' . $hora1;
            if ($_POST['gpoProducto'] == '*') {
                $sSQL7 = "SELECT keyCAP\r\nFROM\r\ncargosCuentaPaciente\r\nWHERE \r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "'\r\nand\r\ngpoProducto!=''\r\n\r\n";
            } else {
                $sSQL7 = "SELECT keyCAP\r\nFROM\r\ncargosCuentaPaciente\r\nWHERE \r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "'\r\nand \r\ngpoProducto='" . $_POST['gpoProducto'] . "'\r\n";
            }
            $result7 = mysql_db_query($basedatos, $sSQL7);
            while ($myrow7 = mysql_fetch_array($result7)) {
                if ($myrow3['seguro']) {
                    $agrega = "UPDATE cargosCuentaPaciente set \r\nfechaDescuento='" . $fechaDescuento . "',\r\nusuarioDescuento='" . $usuario . "',\r\nstatusDescuento='aplicado',\r\nprecioOriginal=precioVenta,\r\nivaOriginal=iva,\r\nprecioVenta=precioVenta-precioVenta*('" . $_POST['porcentaje'] . "'*0.01),\r\ncantidadAseguradora=cantidadAseguradora-cantidadAseguradora*('" . $_POST['porcentaje'] . "'*0.01),\r\nivaParticular=ivaAseguradora-ivaAseguradora*('" . $_POST['porcentaje'] . "'*0.01),\r\niva=iva-iva*('" . $_POST['porcentaje'] . "'*0.01)\r\n\r\nwhere\r\nkeyCAP='" . $myrow7['keyCAP'] . "'\r\n";
                    mysql_db_query($basedatos, $agrega);
                    echo mysql_error();
                } else {
                    $agrega = "UPDATE cargosCuentaPaciente set \r\nusuarioDescuento='" . $usuario . "',\r\nfechaDescuento='" . $fechaDescuento . "',\r\nstatusDescuento='aplicado',\r\nprecioOriginal=precioVenta,\r\nivaOriginal=iva,\r\nprecioVenta=precioVenta-precioVenta*('" . $_POST['porcentaje'] . "'*0.01),\r\ncantidadParticular=cantidadParticular-cantidadParticular*('" . $_POST['porcentaje'] . "'*0.01),\r\nivaParticular=ivaParticular-ivaParticular*('" . $_POST['porcentaje'] . "'*0.01),\r\niva=iva-iva*('" . $_POST['porcentaje'] . "'*0.01)\r\n\r\nwhere\r\nkeyCAP='" . $myrow7['keyCAP'] . "'\r\n";
                    mysql_db_query($basedatos, $agrega);
                    echo mysql_error();
                }
            }
            $agrega = "UPDATE clientesInternos set \r\ndescuento='si',\r\nporcentajeDescuento='" . $_POST['porcentaje'] . "',\r\nusuarioDescuento='" . $usuario . "'\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "'\r\n";
            mysql_db_query($basedatos, $agrega);
            echo mysql_error();
            $sSQL7 = "Select descripcionGP From gpoProductos where entidad='" . $entidad . "' and codigoGP='" . $_POST['gpoProducto'] . "'";
            $result7 = mysql_db_query($basedatos, $sSQL7);
            $myrow7 = mysql_fetch_array($result7);
            echo mysql_error();
            ?>
<script>
window.alert("Se le hizo un descuento del <?php 
            echo $_POST['porcentaje'];
            ?>
%");
window.opener.document.forms["form10"].submit();
window.close();
</script>
<?php 
        }
        ?>














<?php 
        if ($_POST['actualiza']) {
            $seguro = $_POST['seguro'];
            $keyCAP = $_POST['keyCAP'];
            for ($i = 0; $i <= $_POST['bandera']; $i++) {
                if ($seguro[$i]) {
                    $agrega = "UPDATE cargosCuentaPaciente set \r\nseguro='" . $seguro[$i] . "'\r\nwhere\r\nkeyCAP='" . $keyCAP[$i] . "'\r\n";
                    mysql_db_query($basedatos, $agrega);
                    echo mysql_error();
                }
            }
            ?>
<script>
window.alert("Se actualizaron registros!");
</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">



<style type="text/css">
<!--
.Estilo24 {font-size: 10px}
.style7 {font-size: 9px}
-->
</style>
<head>
<style type="text/css">
<!--
.devolucion {color: #FFFFFF;font-size: 10px}

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



<BODY  >
<?php 
        //ventanasPrototype::links();
        ?>
<h1 align="center" class="titulos">Estado de Cuenta Informativo</h1>
<p align="center" class="negro">No v&aacute;lido para fines fiscales</p>
<form id="form1" name="form1" method="post" action="">
  <table width="582" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#990099" class="normal">
    <tr>
      <th bgcolor="#330099" class="blancomid" scope="col"><div align="left">Folio de Venta</div></th>
      <th bgcolor="#330099" 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="168" bgcolor="#330099" class="normal" scope="col"><div align="left" class="blancomid"><strong>Paciente</strong></div></th>
      <th width="407" bgcolor="#FFFFFF" class="normalmid" 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="normalmid"><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="normalmid"><?php 
        echo $myrow3['credencial'];
        ?>
 </td>
    </tr>
    <tr>
      <td bgcolor="#330099" class="blancomid">Fecha de Reporte</td>
      <td bgcolor="#FFFFFF" class="normalmid"><span class="normal">
        <label>
        <?php 
        print cambia_a_normal($myrow3['fecha']);
        ?>
        <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 bgcolor="#330099" class="blancomid" scope="col"><div align="left"><strong>M&eacute;dico</strong></div></th>
      <th bgcolor="#FFFFFF" class="normalmid" scope="col"><div align="left">
          <label></label>
          
          <?php 
        $sSQL18 = "Select descripcion From almacenes WHERE entidad='" . $entidad . "' and almacen='" . $myrow3['medico'] . "'";
        $result18 = mysql_db_query($basedatos, $sSQL18);
        $rNombre18 = mysql_fetch_array($result18);
        ?>
          <?php 
        echo $dr = "Dr(a): " . $rNombre18['descripcion'];
        ?>
 </div></th>
    </tr>
    <tr>
      <td bgcolor="#330099" class="blancomid">Fecha Internamiento</td>
      <td bgcolor="#FFFFFF" class="normalmid"><?php 
        print cambia_a_normal($myrow3['fecha']);
        ?>
</td>
    </tr>
    <tr>
      <td bgcolor="#330099" class="blancomid">Dx Entrada</td>
      <td bgcolor="#FFFFFF" class="normalmid"><?php 
        print $myrow3['dx'];
        ?>
</td>
    </tr>
    <tr>
      <td bgcolor="#330099" class="blancomid">Tipo de Vista</td>
      <td bgcolor="#FFFFFF" class="normalmid"><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>
  
  
  
  
  
  
  
  
  
  
  <p>
    <?php 
        if ($_POST['tipoVista']) {
            ?>
  </p>



  
  
  <table width="994" border="0.2" align="center">
    <tr bgcolor="#330099">
      <th width="42" bgcolor="#330099" class="blanco" scope="col"><div align="left" class="blancomid">
          <div align="center">Ref</div>
      </div></th>
      <th width="42" bgcolor="#330099" class="blanco" scope="col"><div align="left" class="blancomid">
          <div align="center">Fecha</div>
      </div></th>
      <th width="260" bgcolor="#330099" class="blanco" scope="col"><div align="left" class="blancomid">
          <div align="center">Descripcion</div>
      </div></th>
      <th width="118" bgcolor="#330099" class="blanco" scope="col"><div align="left" class="blancomid">
          <div align="center">Departamento/Dr</div>
      </div></th>
      <th width="159" bgcolor="#330099" class="blanco" scope="col"><div align="left" class="blancomid">
          <div align="center">Tipo</div>
      </div></th>
      <th width="36" bgcolor="#330099" class="blanco" scope="col"><div align="left" class="blancomid">
          <div align="center">Cant.</div>
      </div></th>
      <th width="70" bgcolor="#330099" class="blanco" scope="col"><div align="left" class="blancomid">
          <div align="center">P.Unit.</div>
      </div></th>
      <th width="70" bgcolor="#330099" class="blanco" scope="col"><div align="left" class="blancomid">
          <div align="center">Part.</div>
      </div></th>
      <th width="67" bgcolor="#330099" class="blanco" scope="col"><div align="left" class="blancomid">
          <div align="center">Aseg.</div>
      </div></th>
      <th width="42" bgcolor="#330099" class="blanco" scope="col"><div align="left" class="blancomid">
          <div align="center">IVA</div>
      </div></th>
      <th width="42" bgcolor="#330099" class="blanco" scope="col">N</th>
    </tr>
    <tr>
      <?php 
            $sSQL = "SELECT \r\n* \r\nFROM cargosCuentaPaciente\r\nWHERE\r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_GET['folioVenta'] . "'\r\nand\r\n gpoProducto!=''\r\n order by descripcionArticulo\r\n  ASC\r\n";
            $result = mysql_db_query($basedatos, $sSQL);
            while ($myrow = mysql_fetch_array($result)) {
                $bandera += "1";
                $gpoProducto = $myrow['gpoProducto'];
                $code1 = $myrow['codProcedimiento'];
                //*************************************CONVENIOS********************************************
                $sSQL12 = "\r\nSELECT descripcion\r\nFROM\r\n  articulos\r\nWHERE \r\nentidad='" . $entidad . "'\r\nand\r\n(keyPA='" . $myrow['keyPA'] . "' or codigo='" . $myrow['codProcedimiento'] . "')\r\n";
                $result12 = mysql_db_query($basedatos, $sSQL12);
                $myrow12 = mysql_fetch_array($result12);
                //cierro descuento
                if ($myrow['statusDevolucion'] == 'si' and $myrow['naturaleza'] == 'A') {
                    $devolucionFinal[0] += $myrow['precioVenta'] * $myrow['cantidad'] + $myrow['iva'] * $myrow['cantidad'];
                }
                if ($myrow['naturaleza'] == 'C') {
                    $cargosFinal[0] += $myrow['precioVenta'] * $myrow['cantidad'];
                }
                if ($myrow['statusDevolucion'] != 'si') {
                    if ($myrow['naturaleza'] == 'A') {
                        $abonosFinal[0] += $myrow['precioVenta'] * $myrow['cantidad'];
                    }
                }
                ?>
    </tr>
    <tr bgcolor="#FFFFFF" onMouseOver="bgColor='#ffff33'" onMouseOut="bgColor='#ffffff'" >
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="codigos"><?php 
                echo $myrow['keyCAP'];
                ?>
</td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="normal"><?php 
                echo cambia_a_normal($myrow['fecha1']);
                ?>
</td>
      <td height="24" bgcolor="<?php 
                echo $color;
                ?>
" class="normal"><?php 
                if ($myrow['status'] == 'transaccion') {
                    $sSQL341 = "Select descripcion From catTTCaja WHERE entidad='" . $entidad . "' and codigoTT = '" . $myrow['tipoTransaccion'] . "'";
                    $result341 = mysql_db_query($basedatos, $sSQL341);
                    $myrow341 = mysql_fetch_array($result341);
                    echo $myrow341['descripcion'];
                } else {
                    echo $myrow['descripcionArticulo'];
                }
                ?>
          <?php 
                echo '</br>';
                if ($myrow['statusDevolucion'] == 'si' and $myrow['naturaleza'] == 'A') {
                    print '<span class="error">' . '[Devolucion Folio: ' . $myrow['folioDevolucion'] . ']' . '</span>';
                } else {
                    if ($myrow['statusCargo'] == 'standbyR') {
                        print '<blink><span  class="error">' . 'El usuario: ' . $myrow['usuario'] . ' no ha enviado la solicitud!' . '</span></blink>';
                    } else {
                        if ($myrow['statusCargo'] == 'standby') {
                            print '<span class="error">' . '[sin surtir]' . '</span>';
                        } else {
                            if ($myrow['statusCargo'] == 'cargado') {
                                print '<span  class="codigos">' . '[cargado]' . '</span>';
                            }
                        }
                    }
                }
                //echo $myrow['statusDevolucion'].$myrow['folioDevolucion'];
                ?>
      </td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="normal"><div align="center">
          <?php 
                $sSQL12a1 = "\r\nSELECT descripcion\r\nFROM\r\nalmacenes\r\nWHERE\r\nentidad='" . $entidad . "'\r\n and\r\nalmacen='" . $myrow['almacenDestino'] . "'\r\n";
                $result12a1 = mysql_db_query($basedatos, $sSQL12a1);
                $myrow12a1 = mysql_fetch_array($result12a1);
                echo $myrow12a1['descripcion'];
                ?>
      </div></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="normal"><div align="center">
          <?php 
                $sSQL12a = "\r\nSELECT descripcionGP\r\nFROM\r\ngpoProductos\r\nWHERE \r\nentidad='" . $entidad . "'\r\nand\r\ncodigoGP='" . $myrow['gpoProducto'] . "'\r\n";
                $result12a = mysql_db_query($basedatos, $sSQL12a);
                $myrow12a = mysql_fetch_array($result12a);
                echo $myrow12a['descripcionGP'];
                ?>
      </div></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="normal"><div align="center"><?php 
                echo $myrow['cantidad'];
                ?>
</div></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="normal"><div align="center">
        <?php 
                if ($myrow['naturaleza'] == 'C') {
                    echo '$' . number_format($myrow['precioVenta'], 2);
                }
                ?>
      </div></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="normal"><div align="center"><span class="precionormal2">
          <?php 
                if ($myrow['naturaleza'] == 'C') {
                    $particular[0] += $myrow['cantidadParticular'] * $myrow['cantidad'] + $myrow['ivaParticular'] * $myrow['cantidad'];
                    if ($myrow['cantidadParticular'] * $myrow['cantidad'] + $myrow['ivaParticular'] * $myrow['cantidad']) {
                        echo "\$" . number_format($myrow['cantidadParticular'] * $myrow['cantidad'] + $myrow['ivaParticular'] * $myrow['cantidad'], 2);
                    } else {
                        echo "0.00";
                    }
                } else {
                    if ($myrow['naturaleza'] == 'A') {
                        echo '-$' . number_format($myrow['precioVenta'], 2);
                    }
                }
                ?>
      </span></div></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="normal"><div align="center"><span class="precionormal1">
          <?php 
                if ($myrow['naturaleza'] == 'C') {
                    $aseguradora[0] += $myrow['cantidadAseguradora'] * $myrow['cantidad'] + $myrow['ivaAseguradora'] * $myrow['cantidad'];
                    if ($myrow['cantidadAseguradora'] * $myrow['cantidad'] + $myrow['ivaAseguradora'] * $myrow['cantidad']) {
                        echo "\$" . number_format($myrow['cantidadAseguradora'] * $myrow['cantidad'] + $myrow['ivaAseguradora'] * $myrow['cantidad'], 2);
                    } else {
                        echo "0.00";
                    }
                }
                ?>
      </span></div></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="normal"><div align="center"><span class="negro">
          <?php 
                if ($myrow['naturaleza'] == 'C') {
                    $isva[0] += $myrow['iva'] * $myrow['cantidad'];
                    echo '$' . number_format($myrow['iva'] * $myrow['cantidad'], 2);
                }
                ?>
      </span></div></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="normal"><div align="center">
        <?php 
                if ($myrow['statusDevolucion'] == 'si' and $myrow['naturaleza'] == 'A') {
                    echo 'A';
                } else {
                    echo $myrow['naturaleza'];
                }
                ?>
      </div></td>
    </tr>
    <?php 
            }
            ?>
  </table>
  <p align="center">&nbsp;</p>
  <p align="center">
    <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>
  <p>&nbsp;</p>
    <table width="279" border="0" align="center" class="normal">
      <tr>

	  
        <td width="197" height="23" class="normalmid">Total por Surtir (iva incluido ) </td>
        <td width="72" class="normalmid"><div align="right">
            <?php 
            $totalxSurtir = new acumulados();
            echo "\$" . number_format($totalxSurtir->totalxSurtirFV($entidad, $basedatos, $usuario, $_GET['folioVenta']), 2);
            ?>
        </div></td>
      </tr>
    </table>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p align="left">
    <?php 
            $despliegaTotales = new totales();
            $despliegaTotales->tt($entidad, $class, $estilo, $fechas1, $fechas2, $myrow3['keyClientesInternos'], $_GET['folioVenta'], $basedatos);
            ?>
    </p>
    
    <?php 
        }
        ?>
	
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <table width="379" border="1" align="center" class="style7">
      <tr>
        <th width="91" scope="col"><div align="left"><span class="normal">Grupo de Producto</span></div></th>
        <th width="272" scope="col"><div align="left"><span class="normal">
            <?php 
        //*********gpoProductos
        $sSQL7 = "Select * From gpoProductos where entidad='" . $myrow3['entidad'] . "' AND activo ='activo' ORDER BY descripcionGP ASC ";
        $result7 = mysql_db_query($basedatos, $sSQL7);
        echo mysql_error();
        ?>
            <select name="gpoProducto" class="Estilo24" id="gpoProducto">
              <option value="*">TODOS LOS GRUPOS</option>
              <?php 
        while ($myrow7 = mysql_fetch_array($result7)) {
            ?>
              <option 
		   <?php 
            if ($myrow7['codigoGP'] == $myrow['gpoProducto']) {
                echo 'selected=""';
            }
            ?>
		   value="<?php 
            echo $myrow7['codigoGP'];
            ?>
"><?php 
            echo $myrow7['descripcionGP'];
            ?>
</option>
              <?php 
        }
        ?>
            </select>
        </span></div></th>
      </tr>
      <tr>
        <td><div align="left">Porcentaje: </div></td>
        <td><label>
            <div align="left">
            
            <?php 
        $coaseguroN = new acumulados();
        $coa = $coaseguroN->cargosCoaseguroN($entidad, $basedatos, $usuario, $keyClientesInternos);
        $totalAcumulado = new acumulados();
        $totalDevoluciones = new acumulados();
        $iva = new acumulados();
        $ivaD = new acumulados();
        $iva = $iva->ivaAcumulado($entidad, $basedatos, $usuario, $keyClientesInternos) - $ivaD->ivaAcumuladoD($entidad, $basedatos, $usuario, $keyClientesInternos);
        $cargos = $totalAcumulado->totalAcumulado($basedatos, $usuario, $keyClientesInternos) - $totalDevoluciones->dev($entidad, $basedatos, $usuario, $folioVenta) + $iva + $coa;
        //echo "$".number_format($cargos,2);
        ?>
            
              <input name="porcentaje" type="text" class="style7" id="porcentaje" size="3"  value="<?php 
        echo $_POST['porcentaje'];
        ?>
"  <?php 
        echo $statusD;
        ?>
 autocomplete="off" />
<input name="totalCargos" type="hidden" class="style7" id="porcentaje" 
value="<?php 
        echo $cargos;
        ?>
"/>
              <input name="nT" type="hidden" class="style7" id="porcentaje" value="<?php 
        echo $_GET['nT'];
        ?>
" />
              <input name="bandera" type="hidden" class="style7" id="porcentaje" value="<?php 
        echo $a;
        ?>
" />
            </div>
          </label>
            <label></label></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><input name="aplicar" type="submit" class="style7" id="aplicar" value="Aplicar" <?php 
        echo $statusD;
        ?>
 /></td>
      </tr>
    </table>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
	
	
    <p>&nbsp;</p>
  </div>
 

  <p align="center">
    <input name="keyClientesInternos" type="hidden" id="keyClientesInternos" value="<?php 
        echo $myrow3['keyClientesInternos'];
        ?>
" />
  </p>
</form>
<?php 
        if ($_POST['banderaFecha']) {
            ?>
<p align="center">
  <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> 
</p>
<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 
    }
示例#25
0
    

  <p>&nbsp;</p>
  <div align="center">
    <table width="558" border="0" align="center" class="style12">
      <tr>
        <td width="113" class="style12">&nbsp;</td>
        <td width="124" class="style12">&nbsp;</td>
        <td width="97" class="style12"><span class="style7">Total Cargos </span>          <?php 
    $totalAcumulado = new acumulados();
    echo "\$" . number_format($totalAcumulado->totalAcumulado($basedatos, $usuario, $numeroE, $nCuenta), 2);
    ?>
</td>
        <td width="106" height="23" class="style12"><span class="style7">Total Abonos     
          <?php 
    $abonos = new acumulados();
    echo "\$" . number_format($abonos->abonos($basedatos, $usuario, $numeroE, $nCuenta), 2);
    ?>
        </span></td>
        <td width="96" class="style12"><div align="right">
        Saldo Actual 
          <?php 
    if ($abonos->abonos($basedatos, $usuario, $numeroE, $nCuenta) < 0) {
        $abono = $abonos->abonos($basedatos, $usuario, $numeroE, $nCuenta);
        $abono1 = $abono * '-1';
    }
    $banderaBoton = $totalAcumulado->totalAcumulado($basedatos, $usuario, $numeroE, $nCuenta) - $abono1;
    echo "\$" . number_format($totalAcumulado->totalAcumulado($basedatos, $usuario, $numeroE, $nCuenta) - $abono1, 2);
    ?>
          </div></td>
      </tr>
    public function facturaCoaseguro($tipoFacturacion, $entidad, $fecha1, $hora1, $dia, $usuario, $nT, $basedatos)
    {
        include CONSTANT_PATH_CONFIGURACION . "/funciones.php";
        $cargosCia = new acumulados();
        ?>
<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana","width=800,height=600,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script> 

<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;
        }
        //********************Llenado de datos
        $sSQL3 = "Select * From clientesInternos WHERE keyClientesInternos = '" . $_GET['nT'] . "' or keyClientesInternos='" . $_GET['nT1'] . "'";
        $result3 = mysql_db_query($basedatos, $sSQL3);
        $myrow3 = mysql_fetch_array($result3);
        $numeroE = $myrow3['numeroE'];
        $nCuenta = $myrow3['nCuenta'];
        $cuarto = $myrow3['cuarto'];
        $seguro = $myrow3['seguro'];
        //***************aplicar pago**********************
        if ($_GET['facturar'] and $_GET['numFactura'] and $_GET['flag'] == 'standby') {
            $keyCAP = $_GET['keyCAP'];
            for ($i = 0; $i <= $_GET['bandera']; $i++) {
                if ($keyCAP[$i]) {
                    //**********************
                    $sSQL31 = "Select statusFactura From cargosCuentaPaciente WHERE keyCAP = '" . $keyCAP[$i] . "'";
                    $result31 = mysql_db_query($basedatos, $sSQL31);
                    $myrow31 = mysql_fetch_array($result31);
                    //verifico q ya esta facturado
                    if ($myrow31['statusFactura'] == 'standby') {
                        $agrega = "UPDATE cargosCuentaPaciente set \r\nnumFactura='" . $_GET['numFactura'] . "',\r\nstatusFactura='cargado',\r\nusuarioSolicitudFactura='" . $usuario . "',\r\nfechaSolicitudFactura='" . $fecha1 . "',\r\nhoraSolicitudFactura='" . $hora1 . "'\r\n\r\nwhere\r\nkeyCAP='" . $keyCAP[$i] . "'";
                        mysql_db_query($basedatos, $agrega);
                        echo mysql_error();
                        $leyenda = 'Se factur� con El n�mero de Factura es el ' . $_GET['numFactura'];
                    } else {
                        $leyenda = 'registros ya facturados!';
                    }
                }
            }
            echo $leyenda;
            /* echo '<script language="JavaScript" type="text/javascript">
              <!--
                opener.location.reload(true);
            self.close();
              // -->
            </script>'; */
            $flag = 'load';
        } else {
            $flag = 'standby';
        }
        if ($_GET['quitar']) {
            $keyCAP = $_GET['keyCAP1'];
            for ($i = 0; $i <= $_GET['bandera']; $i++) {
                if ($keyCAP[$i]) {
                    $agrega = "UPDATE cargosCuentaPaciente set \r\n\r\nstatusFactura='standby',\r\nusuarioSolicitudFactura='" . $usuario . "',\r\nfechaSolicitudFactura='" . $fecha1 . "',\r\nhoraSolicitudFactura='" . $hora1 . "'\r\n\r\nwhere\r\nkeyCAP='" . $keyCAP[$i] . "' \r\n";
                    //mysql_db_query($basedatos,$agrega);
                    echo mysql_error();
                }
            }
        }
        ?>













<!-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">
<style type="text/css">
<!--
.style71 {font-size: 9px}
.style71 {font-size: 9px}
.style71 {font-size: 9px}
-->
</style>
<head>






<title></title>
<style type="text/css">
<!--
.style13 {color: #FFFFFF}
.style11 {color: #FFFFFF; font-size: 10px; font-weight: bold; }
.style7 {font-size: 9px}
.Estilo24 {font-size: 10px}
.style19 {color: #000000; font-weight: bold; }
-->
</style>


</head>
<style type="text/css">
<!--
.style12 {font-size: 10px}
.style14 {font-size: 10px; color: #FFFFFF; }
.style21 {color: #FF0000}
-->
</style>




<BODY  >

<h1 align="center">FACTURACION</h1>
<form id="form1" name="form1" method="get" action="">
  <table width="413" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#990099" class="Estilo24">
    <tr>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <th bgcolor="#660066" class="style14" scope="col"><div align="left">Transacci&oacute;n: </div></th>
      <th bgcolor="#660066" class="style14" scope="col"><div align="left"><?php 
        echo $nCliente = $myrow3['keyClientesInternos'];
        ?>
          <input name="numeroE" type="hidden" class="Estilo24" id="numeroE" 
		  value="<?php 
        echo $nCliente = $_GET['numeroE'];
        ?>
" readonly=""/>
</label></div>      </th>
    </tr>
    <tr>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <th width="134" bgcolor="#FFCCFF" class="Estilo24" scope="col"><div align="left"><strong>Paciente: </strong></div></th>
      <th width="408" bgcolor="#FFCCFF" class="Estilo24" scope="col"><div align="left"><strong>
          <label> </label>
      </strong> <?php 
        echo $myrow3['paciente'];
        ?>
 </div></th>
    </tr>
    <tr>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <td class="Estilo24">Compa&ntilde;&iacute;a: </td>
      <td class="Estilo24"><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>
      <th class="Estilo24" scope="col">&nbsp;</th>
      <td bgcolor="#FFCCFF" class="Estilo24">N&deg; Credencial: </td>
      <td bgcolor="#FFCCFF" class="Estilo24"><?php 
        echo $myrow3['credencial'];
        ?>
 </td>
    </tr>
    <tr>
      <th class="Estilo24" scope="col">&nbsp;</th>
      <th class="Estilo24" scope="col"><div align="left"><strong>M&eacute;dico: </strong></div></th>
      <th class="Estilo24" 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>
      <th class="Estilo24" scope="col">&nbsp;</th>
      <th bgcolor="#FFCCFF" class="Estilo24" scope="col"><div align="left"># de Factura </div></th>
      <th bgcolor="#FFCCFF" class="Estilo24" scope="col"><div align="left">
        <label>

      <input name="numFactura" type="text" class="style7" id="numFactura" value="<?php 
        if ($_GET['numFactura']) {
            echo $_GET['numFactura'];
        }
        ?>
" <?php 
        if ($_GET['numFactura']) {
            echo 'disabled=""';
        }
        ?>
/>

        </label>
      </div></th>
    </tr>
  </table>
  <p>&nbsp;</p>



 

    


  <table width="597" border="0" align="center">
    <tr>
      <th width="62" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">#MOV </span></div></th>
      <th width="100" height="14" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">Fecha/Hora </span></div></th>
      <th width="282" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">Descripci&oacute;n/Concepto</span></div></th>
      <th width="25" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">Cant</span></div></th>
      <th width="59" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">Importe</span></div></th>
      <th width="43" bgcolor="#660066" class="style14" scope="col"><div align="left"><span class="style12 ">IVA</span></div></th>
    </tr>
	
      <?php 
        //traigo agregados
        $sSQL81 = "\r\nSELECT \r\n*\r\nFROM\r\ncargosCuentaPaciente \r\n WHERE \r\n numeroE = '" . $numeroE . "'\r\n \r\n and nCuenta='" . $nCuenta . "'\r\n \r\nand\r\nstatus='transaccion'\r\nand\r\nstatusFactura='solicita'\r\nand tipoCliente='coaseguro'\r\n\r\n\r\n order by hora1 asc\r\n";
        if ($result81 = mysql_db_query($basedatos, $sSQL81)) {
            while ($myrow81 = mysql_fetch_array($result81)) {
                $tipoCliente = $myrow81['tipoCliente'];
                $a += '1';
                $art = $myrow81['codProcedimiento'];
                $codigo = $proc = $myrow81['codProcedimiento'];
                $keyCAP = $myrow81['keyCAP'];
                $keyCAP1[] = $myrow81['keyCAP'];
                $fecha1 = $myrow81['fecha1'];
                $fecha2 = $myrow81['fecha1'];
                $sSQL14 = "\r\nSELECT \r\nstatusFactura\r\nFROM\r\ncargosCuentaPaciente\r\nWHERE \r\nkeyCAP='" . $keyCAP . "'\r\n\r\n";
                $result14 = mysql_db_query($basedatos, $sSQL14);
                $myrow14 = mysql_fetch_array($result14);
                //****
                $sSQL = "\r\nSELECT sum(precioVenta*cantidad) as precioVentas\r\nfrom \r\ncargosCuentaPaciente\r\nWHERE \r\ngpoProducto= '" . $myrow81['gpoProducto'] . "'\r\nand\r\nkeyCAP='" . $keyCAP . "'\r\n";
                $result = mysql_db_query($basedatos, $sSQL);
                $myrow = mysql_fetch_array($result);
                $sSQL31 = "Select statusFactura From cargosCuentaPaciente WHERE keyCAP = '" . $keyCAP . "'";
                $result31 = mysql_db_query($basedatos, $sSQL31);
                $myrow31 = mysql_fetch_array($result31);
                ?>
	
	
	
	
    <tr>


<td bgcolor="<?php 
                echo $color;
                ?>
" class="Estilo24"><div align="left"><span class="<?php 
                echo $estilo;
                ?>
"><?php 
                echo $myrow81['keyCAP'];
                ?>
</span>
  <input name="keyCAP[]" type="hidden" id="keyCAP[]" value="<?php 
                echo $myrow81['keyCAP'];
                ?>
" />
</div></td>





      <td height="21" bgcolor="<?php 
                echo $color;
                ?>
" class="Estilo24"><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;
                ?>
" class="Estilo24"><div align="left"><span class="<?php 
                echo $estilo;
                ?>
"><span class="style12"><span class="style7">
        <?php 
                $descripcion = new articulosDetalles();
                $descripcion->descripcion($keyCAP, $numeroE, $nCuenta, $codigo, $basedatos);
                ?>
        </span></span>        <span class="style12">
          
          <?php 
                if ($myrow81['gpoProducto']) {
                    echo '[' . $myrow81['gpoProducto'] . ']';
                }
                if ($myrow31['statusFactura'] == 'cargado') {
                    echo '<blink>' . '[REGISTRO FACTURADO] ' . '</blink>';
                }
                ?>
          
      </span> </span></div></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="Estilo24"><div align="left"><span class="<?php 
                echo $estilo;
                ?>
">

      </span><span class="<?php 
                echo $estilo;
                ?>
"><?php 
                echo $myrow81['cantidad'];
                ?>
</span></div></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="Estilo24"><div align="left"><span class="<?php 
                echo $estilo;
                ?>
">
        
        <span class="style12"><span class="style7">
          	<?php 
                $cantidadRegistros += 1;
                $importes[0] += $myrow81['precioVenta'];
                echo "\$" . number_format($myrow81['precioVenta'], 2);
                $cantidadTransaccion[0] += $myrow81['precioVenta'];
                ?>
          
        </span></span> </span></div></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" class="<?php 
                echo $estilo;
                ?>
"><span class="style71">
        <?php 
                $mostrarIVA = new articulosDetalles();
                echo $mostrarIVA->mostrarIVA($keyCAP, $basedatos);
                $cantidadIVA[0] += $myrow81['iva'];
                ?>
      </span></td>
    </tr>
 
	
	
    <?php 
                $FECHA[$a] = $myrow81['fecha1'];
            }
            ?>
  </table>

  <p align="center">
    <?php 
            $sSQL74 = "SELECT SUM(precioVenta*cantidad) as acumuladoPrincipal\r\nFROM\r\ncargosCuentaPaciente\r\nWHERE\r\n\r\n(numeroE='" . $numeroE . "' and nCuenta='" . $nCuenta . "')\r\n and  statusCargo='cargado'\r\n and\r\n tipoCliente='aseguradora'\r\n  ";
            $result74 = mysql_db_query($basedatos, $sSQL74);
            $myrow74 = mysql_fetch_array($result74);
            $porcentaje = $cantidadTransaccion[0] / $myrow74[0];
            ?>
<label>
      <input name="facturar" type="submit" class="style7" value="Facturar" <?php 
            if ($_GET['facturar'] or $myrow31['statusFactura'] == 'cargado') {
                echo 'disabled=""';
            }
            ?>
 />
    </label>
      <label>

	  
	  </label>
  </p>
  
  
   
  <?php 
            echo $myrow31['statusFactura'];
            if ($myrow31['statusFactura'] == 'solicita') {
                ?>
		
		
  
  <p align="center" class="style71">
<a href="#"  onClick="javascript:ventanaSecundaria('printInvoice.php?numeroE=<?php 
                echo $numeroE;
                ?>
&nCuenta=<?php 
                echo $nCuenta;
                ?>
&entidad=<?php 
                echo $entidad;
                ?>
&nT=<?php 
                echo $nT;
                ?>
&numFactura=<?php 
                echo $_GET['numFactura'];
                ?>
&porcentaje=<?php 
                echo $porcentaje;
                ?>
')">
	Imprimir Factura 
	</a>
   
   
       <---->  
	    <a href="#"  onClick="javascript:ventanaSecundaria('printDetailsInvoice.php?numeroE=<?php 
                echo $numeroE;
                ?>
&nCuenta=<?php 
                echo $nCuenta;
                ?>
&almacenSolicitante=<?php 
                echo $ALMACEN;
                ?>
&entidad=<?php 
                echo $entidad;
                ?>
&numFactura=<?php 
                echo $_GET['numFactura'];
                ?>
')">
   Imprimir Detalles 
   </a>
  </p>
<?php 
            }
            ?>
  
  
  
  <div align="center">
    <p align="left">
	

    <table width="384" border="0" align="left" cellpadding="1" cellspacing="1" class="style71">
      <tr>
        <th width="216" bgcolor="#FFCCFF" class="<?php 
            echo $estilo;
            ?>
" scope="col"><div align="left">Descripci&oacute;n</div></th>
        <th width="76" bgcolor="#FFCCFF" class="<?php 
            echo $estilo;
            ?>
" scope="col"><div align="left">Importe</div></th>
        <th width="78" bgcolor="#FFCCFF" class="<?php 
            echo $estilo;
            ?>
" scope="col"><div align="left">% Importe aPagar </div></th>
      </tr>
      <tr>
        <?php 
            $sSQL71 = "SELECT sum(precioVenta) as sumaAbonos\r\nFROM\r\ncargosCuentaPaciente\r\nWHERE\r\n(numeroE='" . $numeroE . "' and nCuenta='" . $nCuenta . "')\r\nand\r\ntipoCobro='Efectivo'\r\nand\r\nstatus='transaccion'\r\nand\r\nnaturaleza='A'";
            $result71 = mysql_db_query($basedatos, $sSQL71);
            $myrow71 = mysql_fetch_array($result71);
            $sSQL = "\r\nSELECT codigoGP,descripcionGP FROM gpoProductos\r\nWHERE \r\nentidad='" . $entidad . "' \r\nand\r\nactivo='activo'\r\n";
            if ($result = mysql_db_query($basedatos, $sSQL)) {
                while ($myrow = mysql_fetch_array($result)) {
                    $codigo = $code = $myrow['codigo'];
                    if ($col) {
                        $color = '#FFCCFF';
                        $col = "";
                    } else {
                        $color = '#FFFFFF';
                        $col = 1;
                    }
                    $C = $myrow['codigoGP'];
                    $sSQL7 = "SELECT SUM(precioVenta*cantidad) as acumulado,SUM(iva*cantidad) as sumaIVA\r\nFROM\r\ncargosCuentaPaciente\r\nWHERE\r\ngpoProducto='" . $C . "'\r\nand\r\n\r\n\r\n(numeroE='" . $numeroE . "' and nCuenta='" . $nCuenta . "')\r\n and (status!='standby' and statusCargo!='standby'  AND status!='cancelado')\r\n and\r\n tipoCliente='aseguradora'\r\n  ";
                    $result7 = mysql_db_query($basedatos, $sSQL7);
                    $myrow7 = mysql_fetch_array($result7);
                    $sumarIVA[0] += $myrow7['sumaIVA'];
                    $acumulado[0] += $myrow7['acumulado'];
                    ?>
        <td  bgcolor="<?php 
                    echo $color;
                    ?>
" ><div align="left"><span class=""> <?php 
                    echo $myrow['descripcionGP'];
                    ?>
</span></div></td>
        <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="<?php 
                    echo $estilo;
                    ?>
"><?php 
                    echo "\$" . number_format($myrow7['acumulado'], 2);
                    ?>
</td>
        <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="<?php 
                    echo $estilo;
                    ?>
"><?php 
                    if ($myrow7[0]) {
                        //$porcentaje=$_GET['porcentaje'];
                        $importePorcentaje = $myrow7[0] * $porcentaje;
                        $importeP[0] += $importePorcentaje;
                        echo "\$" . number_format($importePorcentaje, 2);
                    } else {
                        echo '$' . '0.00';
                    }
                    ?>
          &nbsp;</td>
      </tr>
      <?php 
                }
            }
            ?>
    </table>
    �
    </p>
    <p align="left">&nbsp;</p>
    <p align="left">&nbsp;</p>
    <p align="left">&nbsp;</p>
    <p align="left">&nbsp;</p>
    <p align="left">&nbsp;</p>
    <p align="left">&nbsp;</p>
    <table width="384" height="0" border="0" align="left" cellpadding="0" cellspacing="1" class="style71">
      <tr>
        <td bgcolor="#660066" class="style14"><span class="Estilo24">IVA (Acumulado) </span></td>
        <td bgcolor="#660066" class="style14"><?php 
            echo "\$" . number_format($sumarIVA[0], 2);
            ?>
 &nbsp;</td>
        <td bgcolor="#660066" class="style14"><?php 
            $sSQL74 = "SELECT SUM(iva*cantidad) as sumaIVA\r\nFROM\r\ncargosCuentaPaciente\r\nWHERE\r\n(numeroE='" . $numeroE . "' and nCuenta='" . $nCuenta . "')\r\nand\r\nstatus!='transaccion'\r\n\r\n and (status!='standby' and statusCargo!='standby'  AND status!='cancelado')\r\n  ";
            $result74 = mysql_db_query($basedatos, $sSQL74);
            $myrow74 = mysql_fetch_array($result74);
            $sumaIVA = $myrow74['sumaIVA'] * $_GET['porcentaje'];
            echo "\$" . number_format($sumaIVA, 2);
            ?>
        </td>
      </tr>
      <tr>
        <td width="46%" bgcolor="#660066" class="style14"><div align="left">TOTALES</div></td>
        <td width="17%" bgcolor="#660066" class="style14"><?php 
            echo "\$" . number_format($acumulado[0] + $sumarIVA[0], 2);
            ?>
</td>
        <td width="16%" bgcolor="#660066" class="style14"><?php 
            echo "\$" . number_format($importeP[0] + $sumaIVA, 2);
            ?>
</td>
      </tr>
      <tr>
        <td class="style71"><?php 
            ?>
          &nbsp;</td>
        <td class="style71">&nbsp;</td>
        <td class="style71">&nbsp;</td>
      </tr>
    </table>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
  </div>
  <?php 
            if ($myrow3['status'] != 'cerrada') {
                ?>
  <?php 
                $cargosParticulares = new acumulados();
                $totalxSurtir = new acumulados();
                $cargosAseguradora = new acumulados();
                $otros = new acumulados();
                if ($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) {
                    ?>
  <?php 
                }
                ?>
  <?php 
            } else {
                echo "LA CUENTA DEL PACIENTE " . $myrow3['paciente'] . " ESTA CERRADA...";
            }
            ?>
   <input name="bandera" type="hidden" value="<?php 
            echo $a;
            ?>
" />
   <input name="flag" type="hidden" value="<?php 
            echo $flag;
            ?>
" />
   <input name="nT1" type="hidden" id="nT1" value="<?php 
            echo $_GET['nT'];
            ?>
" />
</form>
<?php 
        }
        ?>
<p align="center">&nbsp;</p>
<?php 
        if ($_GET['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 
    }
示例#27
0
    public function eCuentaE($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
        $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['imprimir']) {
            ?>
<script>
javascript:ventanaSecundaria2('<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/INGRESOS%20HLC/caja/imprimeCaja2.php?numeroE=<?php 
            echo $numeroE;
            ?>
&amp;nCuenta=<?php 
            echo $nCuenta;
            ?>
&amp;paciente=<?php 
            echo $_POST['paciente'];
            ?>
&amp;numeroConfirmacion=<?php 
            echo $numeroConfirmacion;
            ?>
&amp;hora1=<?php 
            echo $hora1;
            ?>
');
</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">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<script>

function muestra_oculta(id){
if (document.getElementById){ //se obtiene el id
var el = document.getElementById(id); //se define la variable "el" igual a nuestro div
el.style.display = (el.style.display == 'none') ? 'block' : 'none'; //damos un atributo display:none que oculta el div
}
}
window.onload = function(){/*hace que se cargue la funci�n lo que predetermina que div estar� oculto hasta llamar a la funci�n nuevamente*/
muestra_oculta('contenido_a_mostrar');/* "contenido_a_mostrar" es el nombre de la etiqueta DIV que deseamos mostrar */
}
</script>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />


<title></title>
<style type="text/css">
<!--
.style13 {color: #FFFFFF}
.style11 {color: #FFFFFF; font-size: 10px; font-weight: bold; }
.style7 {font-size: 9px}
.Estilo24 {font-size: 10px}
.style19 {color: #000000; font-weight: bold; }
-->
</style>


</head>
<style type="text/css">
<!--
.style12 {font-size: 10px}
.style14 {font-size: 10px; color: #FFFFFF; }
.style21 {color: #FF0000}
-->
</style>




<BODY >

<h1 align="center">Nota de Venta </h1>
<form id="form1" name="form1" method="post" action="">
  <table width="642" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#990099" class="Estilo24">
    <tr>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <th bgcolor="#660066" class="style14" scope="col"><div align="left">N&uacute;mero de Transacci&oacute;n: </div></th>
      <th bgcolor="#660066" class="style14" scope="col"><div align="left"><?php 
        echo $nCliente = $myrow3['keyClientesInternos'];
        ?>
          <input name="numeroE" type="hidden" class="Estilo24" id="numeroE" 
		  value="<?php 
        echo $nCliente = $_POST['numeroE'];
        ?>
" readonly=""/>
</label></div>
      </th>
    </tr>
    <tr>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <th width="134" bgcolor="#FFCCFF" class="Estilo24" scope="col"><div align="left"><strong>Paciente: </strong></div></th>
      <th width="408" bgcolor="#FFCCFF" class="Estilo24" scope="col"><div align="left"><strong>
          <label> </label>
      </strong> <?php 
        echo $myrow3['paciente'];
        ?>
 </div></th>
    </tr>
    <tr>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <td class="Estilo24">Compa&ntilde;&iacute;a: </td>
      <td class="Estilo24"><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>
      <th class="Estilo24" scope="col">&nbsp;</th>
      <td bgcolor="#FFCCFF" class="Estilo24">N&deg; Credencial: </td>
      <td bgcolor="#FFCCFF" class="Estilo24"><?php 
        echo $myrow3['credencial'];
        ?>
 </td>
    </tr>
  </table>
  <p>&nbsp;</p>
  

  
  <table width="675" border="0" align="center">
    <tr>
      <th width="105" height="14" bgcolor="#660066" class="style14" scope="col"><span class="style12 ">Fecha/Hora </span></th>
      <th width="348" bgcolor="#660066" class="style14" scope="col"><span class="style12 ">Descripci&oacute;n/Concepto</span></th>
      <th width="21" bgcolor="#660066" class="style14" scope="col"><span class="style12 ">Cant</span></th>
      <th width="73" bgcolor="#660066" class="style14" scope="col"><span class="style12 ">Importe</span></th>
      <th width="51" bgcolor="#660066" class="style14" scope="col"><span class="style12 ">IVA</span></th>
      <th width="51" bgcolor="#660066" class="style14" scope="col"><span class="style12 ">Convenio</span></th>
    </tr>
    <tr>
      <?php 
        //traigo agregados
        $sSQL81 = "\r\nSELECT \r\nkeyCAP,codProcedimiento,um,hora1,fecha1,cantidad,iva,almacenDestino,almacenSolicitante,precioVenta,tipoCliente,tipoConvenio\r\nFROM\r\ncargosCuentaPaciente \r\n WHERE \r\n numeroE = '" . $numeroE . "'\r\n \r\n and nCuenta='" . $nCuenta . "'\r\nand\r\nstatusCargo!='cancelado'\r\n \r\n \r\n \r\n  order by fecha1,hora1 asc\r\n";
        $result81 = mysql_db_query($basedatos, $sSQL81);
        while ($myrow81 = mysql_fetch_array($result81)) {
            $a += '1';
            $art = $myrow81['codProcedimiento'];
            $codigo = $proc = $myrow81['codProcedimiento'];
            $keyCAP = $myrow81['keyCAP'];
            ?>




      <td height="21" bgcolor="<?php 
            echo $color;
            ?>
" class="Estilo24"><span class="<?php 
            echo $estilo;
            ?>
">
	  <?php 
            echo $myrow81['hora1'] . " " . cambia_a_normal($myrow81['fecha1']);
            ?>
</span></td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="Estilo24"><span class="<?php 
            echo $estilo;
            ?>
"><span class="style12"><span class="style7">
      <?php 
            $descripcion = new articulosDetalles();
            $descripcion->descripcion($numeroE, $nCuenta, $codigo, $basedatos);
            ?>
      </span></span>        <span class="style12">
		
        <?php 
            if ($myrow811['um'] == 's' or $myrow811['um'] == 'S') {
                echo '  ( Servicio )  ';
            }
            ?>

      </span> </span></td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="Estilo24"><div align="center"><span class="<?php 
            echo $estilo;
            ?>
">
          <?php 
            echo $cantidad = $myrow81['cantidad'];
            ?>
      </span></div></td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="Estilo24"><span class="<?php 
            echo $estilo;
            ?>
"><span class="style12"><span class="style7">
        <?php 
            $importe = new acumulados();
            echo $importe->importe($keyCAP, $basedatos);
            ?>
      </span></span></span></td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="Estilo24"><span class="<?php 
            echo $estilo;
            ?>
"><span class="style12"><span class="style7">
        <?php 
            $mostrarIVA = new articulosDetalles();
            echo $mostrarIVA->mostrarIVA($keyCAP, $basedatos);
            ?>
      </span></span></span></td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="Estilo24"><div align="center"><span class="<?php 
            echo $estilo;
            ?>
">
	   
      <span class="style12"><span class="style7">
      <?php 
            if ($myrow81['tipoConvenio'] and $myrow81['tipoConvenio'] != 'No') {
                echo 'C';
            } else {
                echo '---';
            }
            ?>
    </span></span> </span></div></td>

		
	</tr>
 
	
	
    <?php 
        }
        ?>
  </table>

  <p>&nbsp;</p>
  <div align="center">
    <table width="558" border="0" align="center" class="style12">
      <tr>
        <td width="113" class="style12">&nbsp;</td>
        <td width="124" class="style12">&nbsp;</td>
        <td width="97" class="style12"><span class="style7">Total Cargos </span>          <?php 
        $totalAcumulado = new acumulados();
        echo "\$" . number_format($totalAcumulado->totalAcumulado($basedatos, $usuario, $numeroE, $nCuenta), 2);
        ?>
</td>
        <td width="106" height="23" class="style12"><span class="style7">Total Abonos     
          <?php 
        $abonos = new acumulados();
        echo "\$" . number_format($abonos->abonos($basedatos, $usuario, $numeroE, $nCuenta), 2);
        ?>
        </span></td>
        <td width="96" class="style12"><div align="right">
        Saldo Actual 
          <?php 
        echo "\$" . number_format($totalAcumulado->totalAcumulado($basedatos, $usuario, $numeroE, $nCuenta) - $abonos->abonos($basedatos, $usuario, $numeroE, $nCuenta), 2);
        ?>
          </div></td>
      </tr>
    </table>


  </div>
  <p align="center">
<?php 
        if (!$totalCargos) {
            ?>
    <input name="imprimir" type="submit" class="style7" id="aplicarPago" value="Imprimir" />
	<?php 
        }
        ?>
	<input name="Submit" type="button" class="style7" value="Aplicar Pagos"  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';
        ?>
')"/>
  </p>


</form>

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

</body>
</html>
<?php 
    }









<?php 




 $saldos=new acumulados();








 if( $limiteSEGURO>0 and $SEGURO!=NULL){
//doble if
$sSQL7ab= "Select * from segurosLimites where entidad='".$entidad."'  and seguro='".$SEGURO."'  ";
$result7ab=mysql_db_query($basedatos,$sSQL7ab);
$myrow7ab = mysql_fetch_array($result7ab);

$acumulado=$myrow7ab['cantidad']-$saldos-> verificarSaldos($myrow3['seguro'],$entidad,$fecha1,$basedatos,$myrow3['numeroE'],$matricula);
        echo $color;
        ?>
" >
	  <?php 
        echo $myrow['folioVenta'];
        ?>
      </span></td>


      <td width="131" bgcolor="<?php 
        echo $color;
        ?>
" >

	  	  <?php 
        $verificaCargos = new acumulados();
        $verificaCargos->verificaCargos($basedatos, $usuario, $numeroE, $nCuenta);
        if ($myrow['paciente']) {
            ?>

	  <?php 
            echo $myrow['paciente'];
            ?>
	  <?php 
        } else {
            ?>
 
	  <?php 
            echo $myrow['paciente'] . " [NO TIENE NINGUN CARGO]";
            ?>
	  
echo $_POST['extension'];
?>
&folioVenta=<?php 
echo $_GET['folioVenta'];
?>
');"></a></p>

<?php 
$iva = new acumulados();
$ivaD = new acumulados();
$iva = $iva->ivaAcumulado($entidad, $basedatos, $usuario, $myrow3['keyClientesInternos']) - $ivaD->ivaAcumuladoD($entidad, $basedatos, $usuario, $myrow3['keyClientesInternos']);
//echo "$".number_format($iva,2);
$coaseguroN = new acumulados();
$coa = $coaseguroN->cargosCoaseguroN($entidad, $basedatos, $usuario, $myrow3['keyClientesInternos']);
$totalAcumulado = new acumulados();
$totalDevoluciones = new acumulados();
$cargos = $totalAcumulado->totalAcumulado($basedatos, $usuario, $myrow3['keyClientesInternos']) - $totalDevoluciones->dev($entidad, $basedatos, $usuario, $_GET['folioVenta']) + $iva;
?>



<?php 
if ($_POST['extension'] == 0) {
    ?>
<p align="center">

  
  </p>
<table width="440" height="53" border="1" align="center" bordercolor="#FF0000">
    <!--<tr bgcolor="#330099">-->
    <tr >