Пример #1
0
    public function listadoServicios($titulo, $ventana, $entidad, $almacenSolicitante, $codigo, $basedatos)
    {
        if (!$_POST['almacenDestino']) {
            $_POST['almacenDestino'] = $ALMACEN;
        }
        ?>

<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana","widtd=350,height=270,scrollbars=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>
<?php 
        $estilos = new muestraEstilos();
        $estilos->styles();
        ?>
</head>

<body>
    <div class="page_right">
<h1 ><?php 
        echo $titulo;
        ?>
</h1>
<form id="form2" name="form2" metdod="post" action="">

  <!--<table widtd="482" class="table-forma">-->
  <table widtd="482" class="table-template-left">
    <tr>
      <td   scope="col">&nbsp;</td>
      <td    scope="col"><div align="left">Almac&eacute;n</div></td>
      <td   scope="col">
        <div align="left">
          <?php 
        require CONSTANT_PATH_CONFIGURACION . "/componentes/comboAlmacen.php";
        $comboAlmacen = new comboAlmacen();
        $comboAlmacen->despliegaAlmacen($entidad, 'style12', $almacenSolicitante, $almacenDestino, $basedatos);
        ?>
      </div></td>
    </tr>
    <tr>
      <td   scope="col">&nbsp;</td>
      <td height="36"   scope="col"><div align="left">Mini-Almac&eacute;n</div></td>
      <td   scope="col">
        <div align="left">
          <?php 
        $comboAlmacen1 = new comboAlmacen();
        if (!$_POST['almacenDestino']) {
            $_POST['almacenDestino'] = $almacenSolicitante;
        }
        $comboAlmacen1->despliegaMiniAlmacen($entidad, 'style12', $_POST['almacenDestino'], $almacenDestino, $basedatos);
        ?>
      </div></td>
    </tr>
    <tr >
      <td widtd="10"  scope="col">&nbsp;</td>
      <td widtd="84" height="35"  scope="col"><div align="left"><span >Art&iacute;culo </span></div></td>
      <td widtd="388"  scope="col"><div align="left"><span >
          <input name="nomArticulo" type="text"  id="nomArticulo" size="60" 
		  
		  value="<?php 
        if ($_POST['nomArticulo']) {
            echo $_POST['nomArticulo'];
        }
        ?>
"/>
</span></div>
      </td>
    </tr>
    <tr>
      <td  scope="col">&nbsp;</td>
      <td   scope="col">&nbsp;</td>
      <td  scope="col"><div align="left">
        <input name="buscar" type="submit"  id="buscar" value="buscar" />
        <?php 
        if ($_POST['nomArticulo'] === '*') {
            ?>
        <span >Este proceso puede demorar varios minutos...</span>
        <?php 
        }
        ?>
      </div>
        <label>
      </label></td>
    </tr>
  </table>

</form>
<p align="center" >&nbsp;</p>
<p align="center" >
  <?php 
        if ($_POST['buscar'] and $_POST['nomArticulo'] and $_POST['almacenDestino']) {
            $articulo = $_POST['nomArticulo'];
            if ($articulo and $_POST['almacenDestino']) {
                if ($articulo != '*') {
                    $sSQL = "\r\nSELECT * FROM articulos,existencias\r\n\r\n WHERE \r\n articulos.entidad='" . $entidad . "' AND\r\n articulos.um='s'\r\n and\r\n existencias.almacen='" . $_POST['almacenDestino1'] . "'\r\n and\r\n articulos.codigo=existencias.codigo and\r\n articulos.descripcion like '%{$articulo}%'\r\n order by articulos.descripcion ASC";
                } else {
                    $sSQL = "\r\nSELECT * FROM articulos,existencias\r\n\r\n WHERE \r\n articulos.entidad='" . $entidad . "' AND\r\n articulos.um='s'\r\n and\r\n existencias.almacen='" . $_POST['almacenDestino1'] . "'\r\n and\r\n articulos.codigo=existencias.codigo \r\n order by articulos.descripcion ASC";
                }
                //cierra todos
            } else {
                $sSQL = "\r\nSELECT * FROM articulos\r\nWHERE articulos.entidad='" . $entidad . "' AND\r\n articulos.um='s'\r\nand\r\narticulos.descripcion like '%{$articulo}%'\r\n\r\n order by articulos.descripcion ASC";
            }
            if ($result = mysql_db_query($basedatos, $sSQL)) {
                echo mysql_error();
                ?>
</p>
      <form id="form1" name="form1" metdod="get" action="<?php 
                echo $modifica = 'modificaP.php';
                ?>
">
  <p>&nbsp;</p>

  <!--<table widtd="584" class="table table-striped">-->
  <table widtd="584" class="table-template-left">
    <tr>
      <th widtd="84"   scope="col"><div align="left"><span >C&oacute;digo</span></div></th>
      <th widtd="359"   scope="col"><div align="left"><span >Descripci&oacute;n</span></div></th>
      <th widtd="57"   scope="col"><div align="left"><span >Cuarto</span></div></th>
      <th widtd="66"   scope="col"><div align="left">Editar</div></th>
    </tr>
    <tr>

<?php 
                while ($myrow = mysql_fetch_array($result)) {
                    $id_cuarto = $myrow['id_cuarto'];
                    $codigo = $code = $myrow['codigo'];
                    $sSQL5 = "SELECT *\r\nFROM\r\n  `precioArticulos`\r\nWHERE\r\ncodigo = '" . $code . "'  \r\n  ";
                    $result5 = mysql_db_query($basedatos, $sSQL5);
                    $myrow5 = mysql_fetch_array($result5);
                    $sSQL6 = "SELECT *\r\nFROM\r\n  `articulosPrecioNivel`\r\nWHERE\r\ncodigo = '" . $code . "'  \r\n  ";
                    $result6 = mysql_db_query($basedatos, $sSQL6);
                    $myrow6 = mysql_fetch_array($result6);
                    /*  
                    if($col){
                    $color = '#FFCCFF';
                    $col = "";
                    } else {
                    $color = '#FFFFFF';
                    $col = 1;
                    } 
                    */
                    $C = $myrow['codigo'];
                    $sSQL7 = "SELECT *\r\nFROM\r\n  `clientesPrecios`\r\nWHERE\r\ncodigo = '" . $code . "' and numCliente='" . $_POST['seguro'] . "'  \r\n  ";
                    $result7 = mysql_db_query($basedatos, $sSQL7);
                    $myrow7 = mysql_fetch_array($result7);
                    if ($myrow6['nivel1'] and $myrow6['nivel3']) {
                        $color = '#0000FF';
                        $estilo = "style11";
                    } else {
                        $myrow6['nivel1'] = "Falta Precio";
                        $myrow6['nivel3'] = "Falta Precio";
                        $estilo = "style12";
                    }
                    if ($myrow6['nivel1'] == "1" or $myrow6['nivel3'] == "1") {
                        //$color='#FF0000';
                        //$estilo="style11";
                    }
                    $totalRegistros += "1";
                    $sSQL15 = "SELECT *\r\nFROM\r\n  `articulos`\r\nWHERE\r\ncodigo = '" . $code . "'  \r\n  ";
                    $result15 = mysql_db_query($basedatos, $sSQL15);
                    $myrow15 = mysql_fetch_array($result15);
                    ?>
      <td  >
        <label>
        <?php 
                    echo $C;
                    ?>
        </label>      </td>
      <td   ><span ><?php 
                    echo $myrow15['descripcion'];
                    ?>
</span></td>
    
	  <td  ><span >

	  
	  <?php 
                    if ($myrow['id_cuarto']) {
                        echo $myrow['id_cuarto'];
                    } else {
                        echo '---';
                    }
                    ?>

	  
	  </span></td>
	 
      <td  > <div align="left"><a href="#" onClick="javascript:ventanaSecundaria('<?php 
                    echo $ventana;
                    ?>
?numeroE=<?php 
                    echo $myrow['numeroE'];
                    ?>
		&amp;nCuenta=<?php 
                    echo $myrow['nCuenta'];
                    ?>
&amp;almacen=<?php 
                    echo $_POST['almacenDestino1'];
                    ?>
&amp;codigo=<?php 
                    echo $codigo;
                    ?>
&amp;almacenPrincipal=<?php 
                    echo $ALMACEN;
                    ?>
&amp;codigo=<?php 
                    echo $code;
                    ?>
')"> <img src="<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/imagenes/edit.jpg" alt="Editar el art�culo: <?php 
                    echo $myrow15['descripcion'];
                    ?>
" widtd="12" height="12" border="0" /> </a> </div></td>
    </tr>
    <?php 
                }
            }
        }
        ?>
  </table>

  <p align="center">
    <label></label>
    <input name="bandera" type="hidden" id="bandera" value="<?php 
        echo $totalRegistros;
        ?>
" />
    <input name="almacen" type="hidden" id="almacen" value="<?php 
        echo $_POST['almacen'];
        ?>
" />
  </p>
</form>
<?php 
        if ($totalRegistros) {
            ?>
<p align="center"><strong><em>Se encontraron  <?php 
            echo $totalRegistros;
            ?>
 registros</em></strong></p>
<?php 
        }
        ?>
<p>&nbsp;</p>
    </div>
</body>
</html>
<?php 
    }
Пример #2
0
<html xmlns="http://www.w3.org/1999/xhtml">



<head>
<style type="text/css">
<!--
.Estilo1 {color: #FFFFFF;
          background:#000066;

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


    
    
    
</head>



<BODY  >
<?php 
$sSQL3= "Select * From clientesInternos WHERE entidad='".$entidad."' and folioVenta = '".$_GET['folioVenta']."' ";
$result3=mysql_db_query($basedatos,$sSQL3);
Пример #3
0
}
?>


 
<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">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<?php 
$estilo = new muestraEstilos();
$estilo->styles();
?>
</head>

<body onLoad="inicio();">
    <div class="page_right">
 <p align="center" class="titulos">Lista de Convenios  </p>
 <form id="form2" name="form2" method="post" action="">
    <!--<table width="775" class="table table-striped" >-->
    <table width="775" class="table-template-left" >

      <tr>
        <th width="57" height="25" >#</th>
        <th width="316" >Nombre del Cliente</th>
        <th width="53" align="center" >Grupo</th>
Пример #4
0
    public function compraDirecta($fecha1, $hora1, $departamento, $basedatos, $usuario, $entidad)
    {
        if ($_GET['keyR'] and ($_GET['inactiva'] or $_GET['activa'])) {
            if ($_GET['inactiva'] == "inactiva") {
                $q = "UPDATE OC set \r\n\r\n\tstatus='cancelado'\r\n\t\tWHERE keyR='" . $_GET['keyR'] . "'";
                //mysql_db_query($basedatos,$q);
                echo mysql_error();
            }
        }
        ?>


<?php 
        if ($_POST['actualizar']) {
            if ($_POST['departamento'] and is_numeric($_POST['cantidad']) and $_POST['descripcion']) {
                $agregaSaldo = "INSERT INTO OC ( codigo,id_almacen,usuario,fecha,hora,ID_EJERCICIO,cantidad,status,id_requisicion,prioridad,statusCompras,id_proveedor,entidad,proveedor1,descripcion,precioUnitario\r\n) values ('1','" . $_POST['departamento'] . "',\r\n'" . $usuario . "','" . $fecha1 . "','" . $hora1 . "','" . $ID_EJERCICIOM . "','" . $_POST['cantidad'] . "','request','" . $myrow333['req'] . "',\r\n'" . $_POST['prioridad'] . "','comprar','" . $_POST['proveedor'] . "','" . $entidad . "','" . $_POST['proveedor1'] . "','" . $_POST['descripcion'] . "','" . $_POST['precioUnitario'] . "')";
                mysql_db_query($basedatos, $agregaSaldo);
                echo mysql_error();
                print '<p class="style1">' . 'Se solicit� el art�culo: ' . $_POST['descripcion'] . '</p>';
            } else {
                print 'Te faltan campos por llenar';
            }
        }
        ?>



<script language=javascript> 
function ventanaSecundariaF (URL){ 
   window.open(URL,"ventanaSecundariaF","width=700,height=600,scrollbars=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" />
<style type="text/css">
<!--
.style1 {color: #0000FF}
-->
</style>
<?php 
        $estilos = new muestraEstilos();
        $estilos->styles();
        ?>

</head>

<body>
<form id="form2" name="form2" method="post" action="#">
  <p align="center" class="titulos">&nbsp;</p>
  <div align="center"><?php 
        //echo $departamento;
        ?>
  </div>
 
  <img src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/imagenes/bordestablas/borde1.png" width="435" height="24" />
  <table width="310" border="0" align="center" cellpadding="4" cellspacing="0">

    <tr bgcolor="#FFFF00">
      <th colspan="3" class="style12" scope="col"><span class="titulos">CONTROL DE COMPRA</span></th>
    </tr>
    <tr bgcolor="#CCCCCC">
      <th width="1" height="42" class="style12" scope="col"><div align="center"></div></th>
      <td width="30" class="negromid"><div align="center">Cant</div></td>
      <td width="265" class="negromid"><div align="center">Descripci&oacute;n General</div></td>
    </tr>
    <tr bgcolor="#CCCCCC">
      <th class="style12" scope="col">&nbsp;</th>
      <td class="style19"><span class="Estilo24">
        <input name="cantidad" type="text" class="camposmid" id="cantidad" value ="<?php 
        echo $myrow2['descripcion'];
        ?>
" size="4" onKeyPress="return checkIt(event)"/>
      </span></td>
      <td rowspan="2" class="style19"><span class="style12">
        <textarea name="descripcion" cols="60" class="camposmid" id="descripcion"><?php 
        echo $myrow2['descripcionGeneral'];
        ?>
</textarea>
      </span></td>
    </tr>
    <tr bgcolor="#CCCCCC">
      <th class="style12" scope="col">&nbsp;</th>
      <td class="style19">&nbsp;</td>
    </tr>
    <tr bgcolor="#CCCCCC">
      <th width="1" class="style12" scope="col"></th>
      <td class="style12"><div align="center" class="style18"></div></td>
      <td class="style12"><div align="center">
        <input name="actualizar" type="image" src="../../imagenes/btns/addorden.png" id="actualizar" value="Agregar OC" />
        <input type="hidden" name="departamento" value="<?php 
        echo $departamento;
        ?>
" />
      </div></td>
    </tr>
  </table>
  <img src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/imagenes/bordestablas/borde2.png" width="435" height="24" />
</form>




























<p>&nbsp;</p>
<p align="center">
<a href="javascript:ventanaSecundariaF('enviarSolicitud.php?almacen=<?php 
        echo $departamento;
        ?>
&numeroE=<?php 
        echo $numeroE;
        ?>
&nCuenta=<?php 
        echo $myrow45['nCuenta'];
        ?>
&credencial=<?php 
        echo $_POST['credencial'];
        ?>
&seguro=<?php 
        echo $_POST['seguro'];
        ?>
&medico=<?php 
        echo $_POST['medico'];
        ?>
&usuario=<?php 
        echo $usuario;
        ?>
&almacenDestino=<?php 
        echo $_GET['almacen'];
        ?>
&almacenSolicitante=<?php 
        echo $almacen;
        ?>
&banderaCXC=<?php 
        echo $_POST['banderaCXC'];
        ?>
&cargoTotal=<?php 
        echo $_POST['cargoTotal'];
        ?>
&fechaSolicitud=<?php 
        echo $_GET['fechaSolicitud'];
        ?>
&horaSolicitud=<?php 
        echo $_POST['horaSolicitud'];
        ?>
&keyClientesInternos=<?php 
        echo $myrow112['keyClientesInternos'];
        ?>
&almacenSolicitud=<?php 
        echo $_GET['almacenDestino1'];
        ?>
')">Enviar Solicitud </a></p>
</body>
</html>
<?php 
    }
Пример #5
0
    public function eCuenta($fecha1, $hora1, $dia, $usuario, $nT, $basedatos)
    {
        include CONSTANT_PATH_CONFIGURACION . "/funciones.php";
        $cargosParticularesDiscrimina = new cierraCuenta();
        $cargosAseguradoraDiscrimina = new cierraCuenta();
        $entidad = $_GET['entidad'];
        ?>
<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 type="text/javascript" src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/js/public_smo_scripts.js"> </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 **********************
        if ($_POST['actualizar']) {
            $sSQL45 = "Select * from clientesInternos where entidad='" . $_GET['entidad'] . "' and folioVenta ='" . $_GET['folioVenta'] . "'";
            $result45 = mysql_db_query($basedatos, $sSQL45);
            $myrow45 = mysql_fetch_array($result45);
            $aseguradora = $_POST['aseguradora'];
            $particular = $_POST['particular'];
            for ($i = 0; $i <= $_POST['bandera']; $i++) {
                if ($aseguradora[$i] != NULL or $particular[$i] != NULL) {
                    if ($particular[$i]) {
                        $agrega = "UPDATE cargosCuentaPaciente set \r\n\r\ncantidadAseguradora=precioVenta,\r\nivaAseguradora=iva,\r\ntipoCliente='aseguradora',\r\nstatus='aseguradora',\r\nseguro='" . $myrow45['seguro'] . "',\r\nclientePrincipal='" . $myrow45['clientePrincipal'] . "',\r\ncantidadParticular=NULL,\r\nivaParticular=NULL\r\n\r\n\r\nwhere\r\nkeyCAP='" . $particular[$i] . "'\r\n";
                        mysql_db_query($basedatos, $agrega);
                        echo mysql_error();
                        //******************************************
                    } else {
                        if ($aseguradora[$i]) {
                            $agrega = "UPDATE cargosCuentaPaciente set \r\ncantidadParticular=precioVenta,\r\nivaParticular=iva,\r\ntipoCliente='particular',\r\ncantidadAseguradora=NULL,\r\nivaAseguradora=NULL,\r\nseguro=NULL,\r\nclientePrincipal=NULL\r\n\r\n\r\nwhere\r\nkeyCAP='" . $aseguradora[$i] . "'";
                            mysql_db_query($basedatos, $agrega);
                            echo mysql_error();
                        }
                    }
                }
            }
            //cierra for
            echo '<span ><blink>' . 'Se hicieron Cambios...' . '</blink></span>';
        }
        //cierra actualizar
        //********************Llenado de datos
        $sSQL3 = "Select * From clientesInternos WHERE  entidad='" . $_GET['entidad'] . "' and folioVenta ='" . $_GET['folioVenta'] . "'";
        $result3 = mysql_db_query($basedatos, $sSQL3);
        $myrow3 = mysql_fetch_array($result3);
        $numeroE = $myrow3['numeroE'];
        $nCuenta = $myrow3['nCuenta'];
        //***************aplicar pago**********************
        ?>
<script type="text/javascript">
<!--
function checkAll(checkname, exby) {
for (i = 0; i < checkname.length; i++)
checkname[i].checked = exby.checked? true:false
}
// -->
</script>
<!-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> 
  <SCRIPT LANGUAGE="JavaScript">
<!-- 	
// by Nannette Thacker
// http://www.shiningstar.net
// This script checks and unchecks boxes on a form
// Checks and unchecks unlimited number in the group...
// Pass the Checkbox group name...
// call buttons as so:
// <input type=button name="CheckAll"   value="Check All"
	//onClick="checkAll(document.myform.list)">
// <input type=button name="UnCheckAll" value="Uncheck All"
	//onClick="uncheckAll(document.myform.list)">
// -->

<!-- Begin
function checkAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}
//  End -->
</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>



<!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" class="titulos">Ajustes a Cuentas </h1>
<form id="form1" name="form1" method="post" action="">

  <table width="800" class="table-forma">
    <tr align="center" >
      <td width="151"><span >FOLIO DE VENTA</span></td>
      <td width="68"><span >FECHA</span></td>
      <td width="453"><span >PACIENTE:</span> <a href="#" 
onclick="javascript:ventanaSecundaria7('<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/cargos/despliegaCargos.php?numeroE=<?php 
        echo $myrow['numeroE'];
        ?>
&amp;nCuenta=<?php 
        echo $myrow['nCuenta'];
        ?>
&amp;almacen=<?php 
        echo $ALMACEN;
        ?>
&amp;almacenFuente=<?php 
        echo $ALMACEN;
        ?>
&amp;nT=<?php 
        echo $nT;
        ?>
&amp;tipoCliente=<?php 
        echo $tipoCliente;
        ?>
&amp;tipoMovimiento=<?php 
        echo 'cierreCuenta';
        ?>
&amp;tipoPaciente=interno&amp;folioVenta=<?php 
        echo $myrow3['folioVenta'];
        ?>
') "> <span > <?php 
        echo $myrow3['paciente'];
        ?>
</span></a></td>
      <td width="145"><span >DEPTO.</td>
    </tr>
    <tr align="center">
      <td><span >
        <?php 
        echo $nCliente = $myrow3['folioVenta'];
        ?>
        <input name="numeroE" type="hidden" class="blanco" id="numeroE" 
		  value="<?php 
        echo $nCliente = $_POST['numeroE'];
        ?>
" readonly=""/>
      </span></td>
      <td><span ><?php 
        echo cambia_a_normal($myrow3['fecha']);
        ?>
</span></td>
      <td><span > Seguro:
<?php 
        if ($myrow3['seguro']) {
            $sSQL4 = "Select nomCliente From clientes WHERE entidad='" . $entidad . "' and numCliente='" . $myrow3['seguro'] . "'  ";
            $result4 = mysql_db_query($basedatos, $sSQL4);
            $myrow4 = mysql_fetch_array($result4);
            echo $myrow4['nomCliente'];
        } else {
            echo particular;
        }
        ?>
      </span></td>
      <td><span >
        <?php 
        $alma = $myrow3['almacen'];
        $sSQL4a = "Select descripcion From almacenes WHERE entidad='" . $entidad . "' and almacen='" . $alma . "';\r\n";
        $result4a = mysql_db_query($basedatos, $sSQL4a);
        $myrow4a = mysql_fetch_array($result4a);
        echo $myrow4a['descripcion'];
        ?>
      </span></td>
    </tr>
    <tr>
      <td >&nbsp;</td>
      <td>&nbsp;</td>
      <td  align="center">Credencial: <?php 
        echo $myrow3['credencial'];
        ?>
</td>
      <td>&nbsp;</td>
    </tr>

  </table>
  
  
  <p>
  <table width="900" class="table table-striped">

    <tr >
      <th width="23" >#</th>
      <th width="51" >Ref</th>
      <th width="101" >Fecha/Hora</th>
      <th width="324" >Descripcion</th>
      <th width="17" >N</th>
      <th width="17" >C</th>
      <th width="69" >Importe</th>
      <th width="65" >Iva</th>
      <th width="55" >CPart</th>
      <th width="57" >CAseg</th>
      <th width="59" >ivaP</th>
      <th width="62" >ivaA</th>
      <th width="62" >P</th>
      <th width="62" >A</th>
    </tr>
<?php 
        //traigo agregados
        $sSQL81 = "\r\n SELECT \r\n*\r\n FROM\r\n cargosCuentaPaciente \r\n WHERE \r\n \r\nfolioVenta='" . $_GET['folioVenta'] . "'\r\n \r\n and\r\ngpoProducto!=''\r\n  \r\n order by fecha1, hora1 asc\r\n ";
        $primeraVez = NULL;
        if ($result81 = mysql_db_query($basedatos, $sSQL81)) {
            while ($myrow = mysql_fetch_array($result81)) {
                $a += 1;
                ?>
    <?php 
                include CONSTANT_PATH_CONFIGURACION . '/clases/operacionesGlobales.php';
                ?>

    <tr >
      <td height="48" ><?php 
                echo $a;
                ?>
</td>
      <td ><?php 
                echo $myrow['keyCAP'];
                ?>
</td>
      <td ><span ><?php 
                echo cambia_a_normal($myrow['fecha1']) . " " . $myrow['hora1'];
                ?>

      </span></td>
      <td ><span ><span class="<?php 
                echo $estilo;
                ?>
">
        <?php 
                print $myrow['descripcionArticulo'];
                ?>
      </span>
          <?php 
                if ($myrow['statusCargo'] == 'pendiente' or $myrow['statusCargo'] == 'standby') {
                    echo '<blink>' . " Art&iacute;culo No Surtido! " . '</blink>';
                    echo " Solicita: " . $myrow16['almacenSolicitante'] . " Destino: " . $myrow16['almacenDestino'];
                }
                if ($myrow['statusCargo'] == 'standby' or $myrow['statusCargo'] == 'request') {
                    echo '<span class="style1">' . ' [Este art�culo no ha sido surtido!]' . '<span>';
                }
                ?>
      </span></td>
      <td >&nbsp;</td>
      <td ></td>
      <td ><span class="<?php 
                echo $estilo;
                ?>
"><?php 
                echo '$' . number_format($myrow['precioVenta'] * $myrow['cantidad'], 2);
                ?>
</span></td>
      <td ><?php 
                echo '$' . number_format($myrow['iva'] * $myrow['cantidad'], 2);
                ?>
</td>
      <td ><?php 
                echo '$' . number_format($myrow['cantidadParticular'] * $myrow['cantidad'], 2);
                ?>
</td>
      <td ><?php 
                echo '$' . number_format($myrow['cantidadAseguradora'] * $myrow['cantidad'], 2);
                ?>
</td>
      <td ><?php 
                echo '$' . number_format($myrow['ivaParticular'] * $myrow['cantidad'], 2);
                ?>
</td>
      <td ><?php 
                echo '$' . number_format($myrow['ivaAseguradora'] * $myrow['cantidad'], 2);
                ?>
</td>
      <td ><?php 
                if ($myrow['tipoCliente'] == 'particular') {
                    ?>
        <input type="checkbox" name="particular[]" id="particular[]" value="<?php 
                    echo $myrow['keyCAP'];
                    ?>
" />
        <?php 
                } else {
                    echo '---';
                }
                ?>
</td>
      <td ><span class="normalmid">
        <div align="center">
          <?php 
                if ($myrow['tipoCliente'] == 'aseguradora') {
                    ?>
          <input type="checkbox" name="aseguradora[]" id="aseguradora[]" value="<?php 
                    echo $myrow['keyCAP'];
                    ?>
"/>
          <?php 
                } else {
                    echo '---';
                }
                ?>
        </div>
        </label>
      </span></td>
    </tr>
    <?php 
            }
            ?>

  </table><br />
  	   <?php 
            include CONSTANT_PATH_CONFIGURACION . '/clases/mostrarTotalesEC.php';
            ?>
 <br />
   <?php 
            include CONSTANT_PATH_CONFIGURACION . '/clases/mostrarDatosEC.php';
            ?>
 
  
  <p><?php 
            include CONSTANT_PATH_CONFIGURACION . '/clases/mostrarEfectuarTransacciones.php';
            ?>
</p>
  <p>


    <input name="bandera" type="hidden" id="bandera" value="<?php 
            echo $a;
            ?>
"  />


    <input name="actualizar" type="submit" class="style7" id="actualizar" value="Actualizar Cambios"
	  <?php 
            if ($a < 1) {
                echo 'disabled="disabled"';
            }
            ?>
/>
  </p>
  <div align="center"></div>
  <p>&nbsp;</p>
</form>
<?php 
        }
        ?>
<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 despliegaSolicitudes($entidad, $titulo, $bali, $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,"ventana1","width=700,height=600,scrollbars=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" />
<?php 
        $estilos = new muestraEstilos();
        $estilos->styles();
        ?>

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



 <?php 
        require CONSTANT_PATH_CONFIGURACION . "/componentes/comboAlmacen.php";
        ?>
<form id="form1" name="form1" method="post" action="#">
  <h1 align="center" class="titulos"><?php 
        echo $titulo;
        ?>
</h1>
  <p align="center">&nbsp;<em>Escoje el MiniAlmac&eacute;n a Surtir</em>    <?php 
        $comboAlmacen1 = new comboAlmacen();
        $comboAlmacen1->despliegaMiniAlmacen($entidad, 'style7', $bali, $almacenDestino, $basedatos);
        if (!$bali) {
            $bali = $_POST['almacenDestino1'];
        }
        ?>
  </p>
  <table width="551" border="0.2" align="center">
    <tr>
      <th width="61" bgcolor="#660066" class="style12" scope="col"><div align="left" class="blancomid">N&deg; Cta.</div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left" class="blancomid">Nombre del paciente:</div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left" class="blancomid">Dpto. Solicita</div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left" class="blancomid">Cuarto</div></th>
    </tr>
    <tr>
	<?php 
        $sSQL = "SELECT *\r\nFROM\r\ncargosCuentaPaciente \r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\nalmacenDestino='" . $bali . "'\r\nand\r\nstatusCargo='standby'\r\nand\r\nfolioVenta!=''\r\norder by keyCAP ASC\r\n\r\n ";
        $result = mysql_db_query($basedatos, $sSQL);
        while ($myrow = mysql_fetch_array($result)) {
            if ($col) {
                $color = '#FFCCFF';
                $col = "";
            } else {
                $color = '#FFFFFF';
                $col = 1;
            }
            ?>
      <td height="24" bgcolor="<?php 
            echo $color;
            ?>
" class="normalmid"><?php 
            echo $myrow['keyClientesInternos'];
            ?>
</span></td>
      <td width="288" bgcolor="<?php 
            echo $color;
            ?>
" class="normalmid">
	  <a href="#" onClick="javascript:ventanaSecundaria('<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/cargos/despliegaSolicitudesDirectas.php?keyClientesInternos=<?php 
            echo $myrow['keyClientesInternos'];
            ?>
&numeroE=<?php 
            echo $myrow['numeroE'];
            ?>
		&nCuenta=<?php 
            echo $myrow['nCuenta'];
            ?>
&almacen=<?php 
            echo $bali;
            ?>
&seguro=<?php 
            echo $_POST['seguro'];
            ?>
&almacenDestino=<?php 
            echo $bali;
            ?>
')"><?php 
            echo $myrow['paciente'];
            ?>
</a>
      </span></td>
      <td width="138" bgcolor="<?php 
            echo $color;
            ?>
" class="normalmid">
<?php 
            $almacenSolicitante = new nombreDepartamento();
            $almacenSolicitante->nombre($myrow['almacenSolicitante'], $basedatos);
            ?>
</span></td>
      <td width="46" bgcolor="<?php 
            echo $color;
            ?>
" class="normalmid"><?php 
            echo $myrow['cuarto'];
            ?>
</span></td>
    </tr>
    <?php 
        }
        ?>
    <input name="nombres" type="hidden" value="<?php 
        echo $nombrePaciente;
        ?>
" />
  </table>
  <span class="normal">
  <input name="nombrePaciente" type="hidden" id="nombrePaciente" value="<?php 
        echo $nombrePaciente;
        ?>
" />
  </span></span>
  <input name="almacen1" type="hidden" id="almacen1" value="<?php 
        echo $_POST['almacen'];
        ?>
" />
  <input name="almacen2" type="hidden" id="almacen2" value="<?php 
        echo $_POST['almacen1'];
        ?>
" />
  <input name="almacen3" type="hidden" id="almacen3" value="<?php 
        echo $_POST['almacen2'];
        ?>
" />
  <input name="almacen" type="hidden" id="almacen3" value="<?php 
        echo $_POST['almacen3'];
        ?>
" />
  <span class="style12"><span class="style7">
  <input name="tipoSeguro" type="hidden" id="tipoSeguro" value="<?php 
        echo $myrow['seguro'];
        ?>
"/>
  <input name="nombrePaciente2" type="hidden" id="nombrePaciente22" value="<?php 
        echo $nombrePaciente;
        ?>
"/>
</span></span>
</form>
</body>
</html>
<?php 
    }
    public function listadoPIT($entidad, $TITULO, $ventana, $bali, $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,"ventana1","width=800,height=600,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script> 
<?php 
        if ($_GET['transfer'] == 'yes') {
            $transfer = 'no';
            $q = "UPDATE clientesInternos set \r\nsolicitaTransferencia='si',\r\nalmacenTransferencia='" . $_GET['almacenTransferencia'] . "',\r\nstatus='ontransfer'\r\nWHERE \r\nkeyClientesInternos='" . $_GET['keyCI'] . "'";
            mysql_db_query($basedatos, $q);
            echo mysql_error();
        } else {
            $transfer = 'yes';
        }
        ?>



<!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();
        ?>
</head>
<META HTTP-EQUIV="Refresh"
CONTENT="60"> 
<body>
<form id="form1" name="form1" method="post" action="#">
  <h1 align="center" class="titulos"><?php 
        echo $TITULO;
        ?>
</h1>
  <span class="style12"></span>
  <table width="499" border="0.2" align="center">
    <tr>
      <th width="50" bgcolor="#660066" class="style12" scope="col"><div align="left" class="blanco">N� Cuenta </div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left" class="blanco">Nombre del paciente</div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left" class="blanco">Cub&iacute;culo</div></th>
     
      <th bgcolor="#660066" class="style12" scope="col"><div align="left" class="blanco">Transferir</div></th>
    </tr>
    <tr>
      <?php 
        $sSQL = "SELECT *\r\nFROM\r\nclientesInternos \r\nWHERE entidad='" . $entidad . "' AND\r\nstatusCuenta = 'abierta'\r\nand\r\n(status='activa' or status='ontransfer')\r\nand \r\ntipoPaciente='urgencias'\r\nand\r\nsolicitaTransferencia=''\r\nORDER BY keyClientesInternos ASC\r\n ";
        if ($result = mysql_db_query($basedatos, $sSQL)) {
            while ($myrow = mysql_fetch_array($result)) {
                $sSQL31 = "SELECT status FROM\r\nclientesInternos\r\nWHERE \r\nkeyClientesInternos='" . $myrow['keyClientesInternos'] . "'";
                $result31 = mysql_db_query($basedatos, $sSQL31);
                $myrow31 = mysql_fetch_array($result31);
                if ($col) {
                    $color = '#FFCCFF';
                    $col = "";
                } else {
                    $color = '#FFFFFF';
                    $col = 1;
                }
                ?>
	  
<td height="24" bgcolor="<?php 
                echo $color;
                ?>
" class="codigos"><?php 
                echo $myrow['keyClientesInternos'];
                ?>
</span></td>
      <td width="316" bgcolor="<?php 
                echo $color;
                ?>
" class="normal">

	  <?php 
                echo $myrow['paciente'];
                if ($myrow['status'] == 'ontransfer') {
                    echo '   [Se solicit� la transferencia de �ste paciente]';
                }
                ?>
      </span></td>
      <td width="37" bgcolor="<?php 
                echo $color;
                ?>
" class="normal" align="center"><?php 
                echo $myrow['cuarto'];
                ?>
</span></td>
      
	  
      <td width="37" bgcolor="<?php 
                echo $color;
                ?>
" class="style12"><div align="center">
	  

<?php 
                if ($myrow['status'] == 'activa') {
                    ?>
<a href="<?php 
                    echo $_SERVER['PHP_SELF'];
                    ?>
?numeroE=<?php 
                    echo $numeroE;
                    ?>
&amp;nCuenta=<?php 
                    echo $nCuenta;
                    ?>
&amp;transfer=<?php 
                    echo $transfer;
                    ?>
&amp;keyCI=<?php 
                    echo $myrow['keyClientesInternos'];
                    ?>
&amp;medico=<?php 
                    echo $_POST['medico'];
                    ?>
&amp;almacenTransferencia=<?php 
                    echo $bali;
                    ?>
&amp;usuario=<?php 
                    echo $usuario;
                    ?>
"><img src="<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/imagenes/btns/reservbtn.png" alt="TRANSFERIR" width="24" height="22" border="0" onClick="if(confirm('Estas seguro que deseas **solicitar** transferir la cuenta?') == false){return false;}" /></a>
<?php 
                } else {
                    ?>
<img src="<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/imagenes/btns/reservbtn.png" alt="TRANSFERIR"  border="0"/>

    <?php 
                }
                ?>
</div></td>
    </tr>
    <?php 
            }
        }
        ?>
    <input name="nombres" type="hidden" value="<?php 
        echo $nombrePaciente;
        ?>
" />
  </table>
  <span class="style12"><span class="style7">
  <input name="nombrePaciente" type="hidden" id="nombrePaciente" value="<?php 
        echo $nombrePaciente;
        ?>
" />
  <input name="nombrePaciente2" type="hidden" id="nombrePaciente2" value="<?php 
        echo $nombrePaciente;
        ?>
"/>
  <input name="tipoSeguro" type="hidden" id="tipoSeguro" value="<?php 
        echo $myrow['seguro'];
        ?>
"/>
  </span></span>

</form>
</body>
</html>


<?php 
    }
    public function consultarArticulosxAlmacen($almacen, $entidad, $basedatos)
    {
        ?>

<?php 
        $articulo = $_POST['nomArticulo'];
        ?>

<?php 
        if ($_GET['codigo'] and ($_GET['inactiva'] or $_GET['activa'])) {
            if ($_GET['inactiva'] == "inactiva") {
                $q = "UPDATE articulos set \r\n\r\n\t\tactivo='I'\r\n\t\tWHERE keyPA='" . $_GET['keyPA'] . "'";
                mysql_db_query($basedatos, $q);
                echo mysql_error();
            } else {
                $q = "UPDATE articulos set \r\n\r\n\t\tactivo='A'\r\n\t\tWHERE keyPA='" . $_GET['keyPA'] . "'";
                mysql_db_query($basedatos, $q);
                echo mysql_error();
            }
        }
        if (!$_POST['nomArticulo']) {
            $_POST['nomArticulo'] = $_GET['nomArticulo'];
        }
        if (!$_POST['almacenDestino']) {
            $_POST['almacenDestino'] = $_GET['almacenDestino'];
        }
        if (!$_POST['almacenDestino1']) {
            $_POST['almacenDestino1'] = $_GET['almacenDestino1'];
        }
        ?>
<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana","width=350,height=189,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria2 (URL){ 
   window.open(URL,"ventana2","width=660,height=800,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria20 (URL){ 
   window.open(URL,"ventana20","width=350,height=170,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria9 (URL){ 
   window.open(URL,"ventanaSecundaria9","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 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">
<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();
        ?>

</head>

<body>
    <div class="page_right">
<h1 align="center" >Art&iacute;culos/Servicios x Almac&eacute;n </h1>
<form id="form2" name="form2" method="post" action="">

    <!--<table width="399" class="table-forma">-->
    <table width="399" class="table-template-left">
      <?php 
        if (verificaCargoTotal::verificaCT($seguro, $basedatos)) {
            ?>
      <?php 
        }
        ?>
      <tr >
        <td width="88"   scope="col"><div align="left">Departamento</div></td>
        <td width="301"  scope="col"> <div align="left" >
            <?php 
        require CONSTANT_PATH_CONFIGURACION . "/componentes/comboAlmacen.php";
        $comboAlmacen = new comboAlmacen();
        $comboAlmacen->despliegaAlmacen($entidad, 'combos', $almacenSolicitante, $almacenDestino, $basedatos);
        ?>
        </div></td>
      </tr>
      <tr >
        <td   scope="col"><div align="left">Mini Almac&eacute;n </div></td>
        <td  scope="col"> <div align="left" >
            <?php 
        $comboAlmacen1 = new comboAlmacen();
        if (!$almacenDestino) {
            $almacenDestino = $almacenSolicitante;
        }
        $comboAlmacen1->despliegaMiniAlmacen($entidad, 'combos', $_POST['almacenDestino'], $almacenDestino, $basedatos);
        ?>
        </div></td>
      </tr>
    </table>

  <p>&nbsp;</p>
 
  <!--<table width="532" class="table-forma">-->
  <table width="532" class="table-template-left">
    <tr>
      <td height="22"   scope="col"><div align="left">T&iacute;tulo</div></td>
      <td  scope="col"><label>
        <div align="left">
          <textarea name="titulo" cols="60" wrap="virtual"  id="titulo"><?php 
        echo $_POST['titulo'];
        ?>
</textarea>
        </div>
      </label></td>
    </tr>
    <tr>
      <td height="22"   scope="col"><div align="left">Incluir Referidos </div></td>
      <td  scope="col"><div align="left">
        <label>
        <input name="referidos" type="checkbox" id="referidos" value="si" <?php 
        if ($_POST['referidos']) {
            echo 'checked=""';
        }
        ?>
 />
        </label>
      </div></td>
    </tr>
    <tr>
      <td height="22" align="left"   scope="col">Precio</td>
      <td  scope="col"><div align="left">
        <label>
        <input type="radio" name="radio" id="asegura" value="asegura" />
        </label>
      Aseguradora 
      <label>
      <input type="radio" name="radio" id="part" value="part" />
      Particular</label>
      <label>
      <input type="radio" name="radio" id="ambos" value="ambos" />
      Ambos Precios</label>
      </div></td>
    </tr>
    <tr>
      <td height="22"   scope="col"><div align="left">Porcentaje % </div></td>
      <td  scope="col"><div align="left">
        <label>
        <input name="porcentaje" type="text"  id="porcentaje" size="2" maxlength="2" value="<?php 
        echo $_POST['porcentaje'];
        ?>
"  onkeypress="return checkIt(event)"/>
        </label>
      </div></td>
    </tr>
    <tr>
      <td width="88" height="22"  scope="col">&nbsp;</td>
      <td width="322"  scope="col"><span >
          </span>
        <div align="left" >
          <input name="buscar" type="submit" src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/imagenes/btns/searcharticles.png" id="buscar" value="buscar" />
        </div>        </td>
    </tr>
  </table>

</form>
<p align="center" >
  <?php 
        if ($_POST['referidos'] == 'si') {
            $sSQL = "\r\nSELECT \r\narticulos.codigo,articulos.keyPA,articulos.descripcion \r\nFROM articulos,existencias\r\nwhere \r\n\r\narticulos.entidad='" . $entidad . "' AND\r\narticulos.codigo=existencias.codigo\r\nand\r\nexistencias.almacen='" . $_POST['almacenDestino1'] . "'\r\n    AND\r\n    articulos.activo='A'\r\norder by articulos.descripcion ASC\r\n";
        } else {
            $sSQL = "\r\nSELECT  \r\narticulos.codigo,articulos.keyPA,articulos.descripcion \r\nFROM articulos,existencias\r\nwhere \r\n\r\narticulos.entidad='" . $entidad . "' AND\r\narticulos.codigo=existencias.codigo\r\nand\r\n(articulos.laboratorioReferido='no' or articulos.laboratorioReferido='' )\r\nand\r\nexistencias.almacen='" . $_POST['almacenDestino1'] . "'\r\n    AND\r\n    articulos.activo='A'\r\norder by articulos.descripcion ASC\r\n";
        }
        if ($result = mysql_db_query($basedatos, $sSQL)) {
            echo mysql_error();
            ?>
  <br />
  Listado de Servicios de: <?php 
            $sSQL6a = "SELECT descripcion\r\nFROM\r\n  almacenes\r\nWHERE entidad='" . $entidad . "' AND\r\nalmacen='" . $_POST['almacenDestino1'] . "'\r\n  ";
            $result6a = mysql_db_query($basedatos, $sSQL6a);
            $myrow6a = mysql_fetch_array($result6a);
            echo $myrow6a['codigo'];
            ?>
</p>
      <form id="form1" name="form1" method="post" action="">
  <p>&nbsp;</p>

  <!--<table width="500" class="table table-striped">-->
  <table width="500" class="table-template-left">

      <tr >
        <th width="2"  scope="col"><div align="left" >#</div></th>
    <th width="539"  scope="col"><div align="left" >Descripci&oacute;n</div></th>
            <th width="62"  scope="col"><div align="left" >Part</div></th>
        <th width="59"  scope="col"><div align="left" >Aseg</div></th>
      </tr>
      <tr >
        <?php 
            while ($myrow = mysql_fetch_array($result)) {
                $keyPA = $myrow['keyPA'];
                $totalRegistros += 1;
                $codigo = $code = $myrow['codigo'];
                $sSQL52 = "SELECT count(*) as totalRegedit\r\nFROM\r\nexistencias\r\nWHERE entidad='" . $entidad . "' AND\r\ncodigo = '" . $code . "'  \r\n  ";
                $result52 = mysql_db_query($basedatos, $sSQL52);
                $myrow52 = mysql_fetch_array($result52);
                $i = $myrow52['totalRegedit'];
                $sSQL5 = "SELECT *\r\nFROM\r\n  `precioArticulos`\r\nWHERE entidad='" . $entidad . "' AND\r\ncodigo = '" . $code . "'  \r\n  ";
                $result5 = mysql_db_query($basedatos, $sSQL5);
                $myrow5 = mysql_fetch_array($result5);
                $sSQL51 = "SELECT *\r\nFROM\r\nexistencias\r\nWHERE entidad='" . $entidad . "' AND\r\ncodigo = '" . $code . "'  \r\n  ";
                $result51 = mysql_db_query($basedatos, $sSQL51);
                $myrow51 = mysql_fetch_array($result51);
                $bali = $myrow51['almacen'];
                $sSQL6 = "SELECT *\r\nFROM\r\n  `articulosPrecioNivel`\r\nWHERE entidad='" . $entidad . "' AND\r\ncodigo = '" . $code . "'  and\r\nalmacen='" . $_POST['almacenDestino1'] . "'\r\n  ";
                $result6 = mysql_db_query($basedatos, $sSQL6);
                $myrow6 = mysql_fetch_array($result6);
                if ($col) {
                    $color = '#FFFF99';
                    $col = "";
                } else {
                    $color = '#FFFFFF';
                    $col = 1;
                }
                $C = $myrow['codigo'];
                $sSQL7 = "SELECT activo\r\nFROM\r\narticulos\r\nWHERE entidad='" . $entidad . "' AND\r\ncodigo = '" . $code . "' \r\n  ";
                $result7 = mysql_db_query($basedatos, $sSQL7);
                $myrow7 = mysql_fetch_array($result7);
                $gpoProducto = $myrow['gpoProducto'];
                $sSQL39 = "\r\n\tSELECT \r\nprefijo\r\nFROM\r\ngpoProductos\r\nWHERE codigoGP='" . $gpoProducto . "'";
                $result39 = mysql_db_query($basedatos, $sSQL39);
                $myrow39 = mysql_fetch_array($result39);
                ?>
        <td height="24"  ><span >
          <label><?php 
                echo $totalRegistros;
                ?>
</label>
        </span></td>
        <td  ><?php 
                echo $myrow['descripcion'];
                ?>
          <?php 
                if (!$bali) {
                    echo '<img src="' . CONSTANT_PATH_SIMA_RAIZ . '/imagenes/stop.png" alt="NO TIENE ASIGNADO NINGUN PRECIO O ALMACEN" width="13" height="13" border="0" />';
                }
                ?>
          <?php 
                if ($myrow['generico'] == 'si') {
                    ?>
          <blink> <img src="<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/imagenes/g.jpg" alt="MEDICAMENTO GENERICO..." width="12" height="12" border="0" /></blink>
          <?php 
                } else {
                    echo '';
                }
                ?>
</td>
       
        <td align="right"  ><?php 
                if ($myrow6['nivel1']) {
                    echo "\$" . number_format($myrow6['nivel1'], 2);
                } else {
                    echo '...';
                }
                ?>
</td>
        <td align="right"  ><?php 
                if ($myrow6['nivel3']) {
                    echo "\$" . number_format($myrow6['nivel3'], 2);
                } else {
                    echo '...';
                }
                ?>
</td>
        <?php 
                if ($UM == 's' or $UM == 'S') {
                    $modifica = 'modificaP.php';
                } else {
                    $modifica = 'modificaA.php';
                }
                ?>
      </tr>
      <?php 
            }
        }
        ?>
    </table>




  <p align="center">
    <label></label>
    <input name="bandera" type="hidden" id="bandera" value="<?php 
        echo $totalRegistros;
        ?>
" />
  
  
<?php 
        if ($totalRegistros >= 1) {
            ?>
    <a href="javascript:ventanaSecundaria9('imprimirPrecios.php?nRequisicion=<?php 
            echo $requisicion;
            ?>
&almacen=
<?php 
            echo $_POST['almacenDestino1'];
            ?>
&medico=<?php 
            echo $_GET['medico'];
            ?>
&codigo=<?php 
            echo $C;
            ?>
&almacenes=<?php 
            echo $Cd;
            ?>
&porcentaje=<?php 
            echo $_POST['porcentaje'];
            ?>
&referidos=<?php 
            echo $_POST['referidos'];
            ?>
&titulo=<?php 
            echo $_POST['titulo'];
            ?>
')"><br><img src="../imagenes/btns/printbutton.png" border="0" width="18" height="18"/></a>
<?php 
        }
        ?>
</p>


<input name="warehouse" type="hidden" value="<?php 
        echo $_GET['warehouse'];
        ?>
">
<input name="main" type="hidden" value="<?php 
        echo $_GET['main'];
        ?>
">


</form>
<?php 
        if ($totalRegistros) {
            ?>
<p align="center" ><strong><em>Se encontraron  <?php 
            echo $totalRegistros;
            ?>
 registros</em></strong></p>
<?php 
        }
        ?>
<p>&nbsp;</p>
    </div>
</body>
</html>
<?php 
    }
    public function listaInternos($estado, $fecha1, $hora1, $usuario, $ALMACEN, $entidad, $TITULO, $ventana, $basedatos)
    {
        ?>



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

<?php 
        if ($_GET['alta'] == 'activar') {
            $sSQL31 = "Select * From clientesInternos WHERE keyClientesInternos='" . $_GET['nT'] . "'";
            $result31 = mysql_db_query($basedatos, $sSQL31);
            $myrow31 = mysql_fetch_array($result31);
            $numeroE = $myrow31['numeroE'];
            $nCuenta = $myrow31['nCuenta'];
            $keyClientesInternos = $myrow31['keyClientesInternos'];
            $cuarto = $myrow31['cuarto'];
            $q = "UPDATE procesoAlta set \r\nstatus='request' ,\r\nusuario='" . $usuario . "',\r\nfecha='" . $fecha1 . "',\r\nhora='" . $hora1 . "',\r\nnPaso='" . $paso . "'\r\nWHERE \r\nalmacen='" . $ALMACEN . "'\r\nand\r\nentidad='" . $entidad . "'\r\nand\r\nkeyClientesInternos='" . $_GET['nT'] . "'";
            mysql_db_query($basedatos, $q);
            echo mysql_error();
            $_GET['alta'] = '';
        } else {
            $_GET['alta'] = 'activar';
        }
        ?>
<!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();
        ?>
</head>
<META HTTP-EQUIV="Refresh"
CONTENT="60"> 
<body>

<form id="form1" name="form1" method="get" action="#">
  <h1 align="center" class="titulos"><?php 
        echo $TITULO;
        ?>
</h1>
  <table width="739" border="0.2" align="center">
    <tr>
      <th width="50" bgcolor="#660066" class="style12" scope="col"><div align="left" class="blanco"># Folio</div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left" class="blanco">Nombre del paciente:</div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left" class="blanco">Seguro</div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left" class="blanco">
        <div align="center">Usuario</div>
      </div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left" class="blanco">
        <div align="center">Fecha </div>
      </div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left" class="blanco">
        <div align="center">Cuarto</div>
      </div></th>
      <th bgcolor="#660066" class="style12" scope="col"><div align="left" class="blanco">
        <div align="center">Status</div>
      </div></th>
    </tr>
    <tr>
<?php 
        $almacenesCierreCuenta = new articulosDetalles();
        $sSQL = "SELECT *\r\nFROM\r\nclientesInternos \r\nWHERE \r\nentidad='" . $entidad . "'\r\nAND\r\n(tipoPaciente='interno' or tipoPaciente='urgencias')\r\nand\r\nstatusCuenta = 'abierta'\r\nand\r\nstatus='activa'\r\nand \r\n(statusDeposito='pagado' or statusDeposito='cxc' or statusDeposito='urgencias')\r\nORDER BY keyClientesInternos DESC\r\n ";
        if ($result = mysql_db_query($basedatos, $sSQL)) {
            while ($myrow = mysql_fetch_array($result)) {
                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';
                }
                $sSQL11 = "\r\n\tSELECT \r\n*\r\nFROM\r\nprocesoAlta\r\nWHERE \r\n\r\nentidad='" . $entidad . "'\r\nand\r\nkeyClientesInternos = '" . $nT . "'\r\nand\r\nalmacen='" . $ALMACEN . "'\r\n\r\n";
                $result11 = mysql_db_query($basedatos, $sSQL11);
                $myrow11 = mysql_fetch_array($result11);
                $sSQL12 = "\r\nSELECT \r\n*\r\nFROM\r\nalmacenes\r\nWHERE \r\nentidad='" . $entidad . "'\r\nand\r\nalmacen = '" . $ALMACEN . "'\r\nand\r\naltaEspecial='si'\r\n";
                $result12 = mysql_db_query($basedatos, $sSQL12);
                $myrow12 = mysql_fetch_array($result12);
                ?>
      <td height="24" bgcolor="<?php 
                echo $color;
                ?>
" class="codigos">
	  
	  <?php 
                echo $myrow['keyClientesInternos'];
                ?>
</td>


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

	  <?php 
                echo $myrow['paciente'];
                $cierreCuentaReporte = new articulosDetalles();
                echo $cierreCuentaReporte->cierreCuentaReportes($entidad, $nT, $numeroE, $nCuenta, $basedatos);
                ?>
          <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="178" bgcolor="<?php 
                echo $color;
                ?>
" class="normal">
	  <?php 
                echo $seguro;
                ?>
</span></span></td>
      <td width="60" bgcolor="<?php 
                echo $color;
                ?>
" class="normal">
	  <?php 
                echo $myrow11['usuario'];
                ?>
</td>
      <td width="60" bgcolor="<?php 
                echo $color;
                ?>
" class="normal" align="center">
	  <?php 
                echo $myrow11['fecha'] . " " . $myrow11['hora'];
                ?>
</td>
      <td width="60" bgcolor="<?php 
                echo $color;
                ?>
" class="normal" align="center"><?php 
                echo $myrow['cuarto'];
                ?>
</td>
      <td width="48" bgcolor="<?php 
                echo $color;
                ?>
" class="normal" align="center">
	  
		  <?php 
                if ($myrow11['status'] == 'standby') {
                    ?>
	  <a href='procesoAltaPx.php?codigo=<?php 
                    echo $code;
                    ?>
&seguro=<?php 
                    echo $_POST['seguro'];
                    ?>
&medico=<?php 
                    echo $_POST['medico'];
                    ?>
&alta=<?php 
                    echo $_GET['alta'];
                    ?>
&nT=<?php 
                    echo $nT;
                    ?>
'"><img src="<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/imagenes/btns/reservbtn.png" alt="	ALTA" width="24" height="22" border="0"  onclick="if(confirm('Esta seguro que deseas correr el proceso del paciente <?php 
                    echo $myrow['paciente'];
                    ?>
?') == false){return false;}" />	  </a>

	  <?php 
                } else {
                    if ($myrow11['status'] == 'request') {
                        ?>
	  <img src="<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/imagenes/iconosSima/lock_icon.jpg" alt="LA CUENTA ESTA PREPARADA" width="12" height="12" border="0" />
	  <?php 
                    } else {
                        if ($myrow11['status'] == 'cargado') {
                            ?>
	  <img src="<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/imagenes/iconosSima/unlock_icon.jpg" alt="LA CUENTA ESTA LISTA" width="12" height="12" border="0" />
	  <?php 
                        } else {
                            ?>
	  <img src="<?php 
                            echo CONSTANT_PATH_SIMA_RAIZ;
                            ?>
/imagenes/pregunta.png" alt="	ALTA" width="12" height="12" border="0" />
	  <?php 
                        }
                    }
                }
                ?>
	  </td>
    </tr>
    <?php 
            }
        }
        ?>
    <input name="menu" type="hidden" value="<?php 
        echo $menu;
        ?>
" />
  </table>



<?php 
        $titulo = 'prueba';
        $url = $ventana;
        $abajo = 70;
        $izquierda = 0;
        $ancho = 300;
        $alto = 200;
        //$ventanas=new ventanasPrototype();
        //$ventanas->despliegaVentana($titulo,$url,$abajo,$izquierda,$anchura,$altura);
        ?>


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


<?php 
    }
Пример #11
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 
    }
Пример #12
0
    public function eCuenta($tipoFacturacion, $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=800,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 ventanaSecundaria8 (URL){ 
   window.open(URL,"ventana8","width=500,height=300,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 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
        //********************Llenado de datos
        $sSQL3 = "Select * From clientesInternos WHERE folioVenta = '" . $_GET['folioVenta'] . "' ";
        $result3 = mysql_db_query($basedatos, $sSQL3);
        $myrow3 = mysql_fetch_array($result3);
        $numeroE = $myrow3['numeroE'];
        $nCuenta = $myrow3['nCuenta'];
        $cuarto = $myrow3['cuarto'];
        //***************aplicar pago**********************
        if ($_POST['aplicarFactura'] and is_numeric($_POST['folioFactura'])) {
            $keyCAP = $_POST['keyCAP'];
            $importe = $_POST['importe'];
            for ($i = 0; $i <= $_POST['bandera']; $i++) {
                $sSQL37 = "Select statusFactura From clientesInternos WHERE folioVenta = '" . $_GET['folioVenta'] . "' ";
                $result37 = mysql_db_query($basedatos, $sSQL3);
                $myrow37 = mysql_fetch_array($result37);
                if ($myrow37['statusFactura'] != 'facturado' and $keyCAP[$i]) {
                    $sql = "UPDATE cargosFacturados set \r\n\r\nstatus='facturado'\r\nwhere\r\nstatus='standby'\r\nand\r\nnumFactura='" . $_POST['folioFactura'] . "'\r\nand\r\nnT='" . $keyCAP[$i] . "' and keyClientesInternos='" . $_POST['keyClientesInternos'] . "'\r\n";
                    mysql_db_query($basedatos, $sql);
                    echo mysql_error();
                    $sql = "UPDATE cargosCuentaPaciente set \r\nfolioFactura='" . $_POST['folioFactura'] . "',\r\nstatusFactura='facturado'\r\nwhere\r\nstatus='transaccion'\r\nand\r\nkeyCAP='" . $keyCAP[$i] . "' and folioVenta='" . $_GET['folioVenta'] . "'\r\n";
                    mysql_db_query($basedatos, $sql);
                    echo mysql_error();
                    //****************************************************
                    //compruebo si todavia sigue vigente la factura, si queda algo por facturar
                    $sSQL14 = "\r\nSELECT \r\n(cargosCuentaPaciente.precioVenta-sum(cantidadFacturada)) as cantidadF\r\nFROM\r\ncargosCuentaPaciente,cargosFacturados\r\nWHERE \r\ncargosCuentaPaciente.keyCAP='" . $keyCAP[$i] . "' and\r\ncargosCuentaPaciente.keyCAP=cargosFacturados.nT\r\nand\r\ncargosFacturados.numFactura='" . $_POST['folioFactura'] . "'\r\nand\r\ncargosFacturados.status='facturado'\r\n";
                    $result14 = mysql_db_query($basedatos, $sSQL14);
                    $myrow14 = mysql_fetch_array($result14);
                    if ($myrow3['statusFactura'] != 'facturado' and !$myrow14['cantidad'] and $_POST['disponible'] == $_POST['importe'] or $_POST['disponible'] and !$_POST['solicita']) {
                        //echo 'meto todo';
                        if ($_POST['disponible'] and !$_POST['solicita']) {
                            $_POST['importe'] = $_POST['disponible'];
                            $agrega = "INSERT INTO cargosFacturados (numFactura,cantidadFacturada,porcentaje,usuario,fecha,tipoCliente,seguro,nt,keyClientesInternos,status,statusImpresion) values('" . $_POST['folioFactura'] . "','" . $_POST['importe'] . "','" . $porcentaje . "','" . $usuario . "','" . $fecha1 . "','aseguradora','" . $myrow3['seguro'] . "','" . $keyCAP[$i] . "','" . $_POST['keyClientesInternos'] . "','facturado','standby')";
                            mysql_db_query($basedatos, $agrega);
                            echo mysql_error();
                        }
                    }
                    //cierra validacion del IF
                    //************************lo facturado == importe ***************************
                    $sSQL13 = "Select sum(cantidadFacturada) as cantidadF From cargosFacturados WHERE numFactura='" . $_POST['folioFactura'] . "' and\r\nnT='" . $keyCAP[$i] . "' and status='facturado'";
                    $result13 = mysql_db_query($basedatos, $sSQL13);
                    $myrow13 = mysql_fetch_array($result13);
                    if (round($myrow13['cantidadF'], 2) == $importe) {
                        $sql = "UPDATE clientesInternos set \r\nnumeroFactura='" . $_POST['folioFactura'] . "',\r\nstatusFactura='facturado'\r\nwhere\r\nfolioVenta='" . $_GET['folioVenta'] . "'\r\n";
                        mysql_db_query($basedatos, $sql);
                        echo mysql_error();
                    }
                    //**************************************************************************
                    //******************************************************
                }
            }
            $_GET['inactiva'] = 'activa';
            $sqla = "UPDATE clientes set \r\nrfc='" . $_POST['rfc'] . "',\r\nrazonSocial='" . $_POST['razonSocial'] . "',\r\ncalle='" . $_POST['calle'] . "',\r\ncolonia='" . $_POST['colonia'] . "',\r\nciudad='" . $_POST['ciudad'] . "',\r\nestado='" . $_POST['estado'] . "',\r\ncp='" . $_POST['cp'] . "',\r\npais='" . $_POST['pais'] . "'\r\nwhere\r\nnumCliente='" . $myrow3['seguro'] . "'\r\n";
            mysql_db_query($basedatos, $sqla);
            echo mysql_error();
            ?>
 <script language="JavaScript" type="text/javascript">
javascript:ventanaSecundaria2('<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/cargos/printDetailsInvoice.php?keyClientesInternos=<?php 
            echo $_POST['keyClientesInternos'];
            ?>
&folioFactura=<?php 
            echo $_POST['folioFactura'];
            ?>
&paciente=<?php 
            echo $_POST['paciente'];
            ?>
&usuario=<?php 
            echo $usuario;
            ?>
&hora1=<?php 
            echo $hora1;
            ?>
'); 
window.opener.document.forms["form1"].submit();
window.location = 'ctaTransferidas.php'
self.close();
</script> 
<?php 
        }
        if ($_POST['escoje'] and $_POST['escojer']) {
            $keyCAP = $_POST['escojer'];
            for ($i = 0; $i <= $_POST['bandera']; $i++) {
                if ($keyCAP[$i]) {
                    $sql = "UPDATE cargosCuentaPaciente set \r\n\r\nstatusFactura='request',\r\nusuarioSolicitudFactura='" . $usuario . "',\r\nfechaSolicitudFactura='" . $fecha1 . "',\r\nhoraSolicitudFactura='" . $hora1 . "',\r\nfolioFactura='" . $_POST['folioFactura'] . "'\r\n\r\nwhere\r\nkeyCAP='" . $keyCAP[$i] . "' \r\n";
                    mysql_db_query($basedatos, $sql);
                    echo mysql_error();
                }
            }
        }
        if ($_POST['quitar2'] and $_POST['quitar']) {
            $keyCAP = $_POST['quitar'];
            for ($i = 0; $i <= $_GET['bandera']; $i++) {
                if ($keyCAP) {
                    $agrega = "UPDATE cargosCuentaPaciente set \r\n\r\nstatusFactura='standby',\r\nusuarioSolicitudFactura='" . $usuario . "',\r\nfechaSolicitudFactura='" . $fecha1 . "',\r\nhoraSolicitudFactura='" . $hora1 . "',\r\nfolioFactura=''\r\nwhere\r\nkeyCAP='" . $keyCAP[$i] . "' \r\n";
                    mysql_db_query($basedatos, $agrega);
                    echo mysql_error();
                }
            }
        }
        ?>








<?php 
        $sSQL3 = "Select * From clientesInternos WHERE folioVenta = '" . $_GET['folioVenta'] . "' ";
        $result3 = mysql_db_query($basedatos, $sSQL3);
        $myrow3 = mysql_fetch_array($result3);
        ?>
<!-Hoja de estilos del calendario --> 
  <link rel="stylesheet" type="text/css" media="all" href="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/calendario/calendar-tas.css" title="win2k-cold-1" /> 

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

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

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


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

<style type="text/css">
<!--
.Estilo1 {color: #FFFFFF;
          background:#000066;

}
 
-->
</style>

</head>

<BODY  >

<h1 align="center" class="titulos">Solicitar servicios/art&iacute;culos Facturaci&oacute;n </h1>
<form id="form1" name="form1" method="post" 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="blanco" scope="col"><div align="left">Transacci&oacute;n: </div></th>
      <th bgcolor="#660066" class="blanco" scope="col"><div align="left"><?php 
        echo $keyClientesInternos = $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="normal" scope="col"><div align="left"><strong>Paciente</strong></div></th>
      <th width="408" bgcolor="#FFCCFF" class="normal" scope="col"><div align="left"><strong>
          <label> </label>
      </strong> <?php 
        echo $myrow3['paciente'];
        ?>
 </div></th>
    </tr>
    <tr>
      <th width="10" class="Estilo24" scope="col">&nbsp;</th>
      <td class="normal">Folio de Venta</td>
      <td class="normal"><label><?php 
        echo $myrow3['folioVenta'];
        ?>
</label></td>
    </tr>
  </table>
  <p>&nbsp;</p>
  <table width="697" border="3" align="center" cellpadding="1" cellspacing="1" bordercolor="#990099" class="Estilo1">
    <tr>
      <th class="blanco" scope="col"><div align="left">Fecha</div></th>
      <th class="blanco" scope="col"><div align="left">
          <?php 
        echo cambia_a_normal($myrow3['fecha1']);
        ?>
      </div></th>
      <th bgcolor="#660066" class="blanco"  scope="col"></th>
      <th  scope="col" class="blanco"></th>
      <th  scope="col"></th>
    </tr>
    <tr>
      <th class="blanco" scope="col"><div align="left"><strong>Paciente </strong></div></th>
      <th class="blanco" scope="col"><div align="left">
          <?php 
        $keyClientesInternos = $nCliente = $myrow3['keyClientesInternos'];
        ?>
          <?php 
        echo $myrow3['paciente'];
        ?>
          <input name="numeroE2" type="hidden" class="Estilo24" id="numeroE2" 
		  value="<?php 
        echo $nCliente = $_POST['numeroE'];
        ?>
" readonly=""/>
      </div></th>
      <th bgcolor="#660066" class="blanco"  scope="col">&nbsp;</th>
      <th  scope="col" class="blanco"><div align="left">Compa&ntilde;&iacute;a</div></th>
      <th  scope="col"><div align="left"><span class="blanco">
          <?php 
        $traeSeguro = $myrow3['seguro'];
        ?>
          <?php 
        $sSQL455 = "Select clientePrincipal from clientes where entidad='" . $entidad . "' and numCliente='" . $myrow3['seguro'] . "'";
        $result455 = mysql_db_query($basedatos, $sSQL455);
        $myrow455 = mysql_fetch_array($result455);
        $sSQL455 = "Select * from clientes where entidad='" . $entidad . "' and numCliente='" . $myrow455['clientePrincipal'] . "'";
        $result455 = mysql_db_query($basedatos, $sSQL455);
        $myrow455 = mysql_fetch_array($result455);
        echo $myrow455['nomCliente'];
        ?>
          <input name="seguro" type="hidden" id="seguro" value="<?php 
        echo $traeSeguro;
        ?>
" />
      </span></div></th>
    </tr>
    <tr>
      <th colspan="5" class="blanco" scope="col"> <div align="center"># Factura
        <input autocomplete="off" name="folioFactura" type="text" <?php 
        if ($_POST['folioFactura']) {
            echo 'class="normal"';
        }
        ?>
 id="folioFactura" value="<?php 
        echo $_POST['folioFactura'];
        ?>
"  />
        </div>
          <div align="left"></div>
        <div align="left"></div></th>
    </tr>
  </table>
  <p align="center" class="style7">&nbsp;</p>



 

    

<?php 
        if ($myrow3['statusFactura'] != 'facturado') {
            ?>
  <table width="880" height="0" border="0" align="center" class="style7">
    <tr>
      <th width="45" bgcolor="#660066" class="blanco" scope="col"><div align="left">#Folio </div></th>
      <th width="103" height="14" bgcolor="#660066" class="blanco" scope="col"><div align="left">Fecha/Hora </div></th>
      <th width="260" bgcolor="#660066" class="blanco" scope="col"><div align="left">Descripci&oacute;n/Concepto</div></th>
      <th width="69" bgcolor="#660066" class="blanco" scope="col"><div align="left">Importe</div></th>
      <th width="60" bgcolor="#660066" class="blanco" scope="col"><div align="left">Solicita</div></th>
      <th width="67" bgcolor="#660066" class="blanco" scope="col"><div align="left">Facturado</div></th>
      <th width="71" bgcolor="#660066" class="blanco" scope="col"><div align="left">Disponible</div></th>
      <th width="61" bgcolor="#660066" class="blanco" scope="col"><div align="left">Escojer</div></th>
      <th width="60" bgcolor="#660066" class="blanco" scope="col"><div align="left">Quitar</div></th>
      <th width="42" bgcolor="#660066" class="blanco" scope="col"><div align="left"></div></th>
    </tr>
	
<?php 
            //traigo agregados
            $sSQL81 = "\r\nSELECT \r\n*\r\nFROM\r\ncargosCuentaPaciente \r\n WHERE \r\nfolioVenta='" . $_GET['folioVenta'] . "'\r\n and\r\n naturaleza='A'\r\n\r\n order by 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'];
                    $sSQL14 = "\r\nSELECT \r\nstatusFactura\r\nFROM\r\ncargosCuentaPaciente\r\nWHERE \r\nkeyCAP='" . $keyCAP . "'\r\n\r\n\r\n";
                    $result14 = mysql_db_query($basedatos, $sSQL14);
                    $myrow14 = mysql_fetch_array($result14);
                    ?>
	

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

      <td height="21" bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal"><div align="left">
      <?php 
                    echo $myrow81['hora1'] . " " . cambia_a_normal($myrow81['fecha1']);
                    ?>
</div></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal"><div align="left">
        <?php 
                    $descripcion = new articulosDetalles();
                    $descripcion->descripcion($keyCAP, $numeroE, $nCuenta, $codigo, $basedatos);
                    ?>
                  
          <?php 
                    if ($myrow81['gpoProducto']) {
                        echo '[' . $myrow81['gpoProducto'] . ']';
                    }
                    ?>
          
 </div></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal"><div align="left">
       

        <?php 
                    if ($myrow81['naturaleza'] == 'A') {
                        $suma[0] = $myrow81['precioVenta'];
                        $sumaImporte[0] += $suma[0];
                        echo "\$" . number_format($suma[0], 2);
                    } else {
                        echo 'N/A';
                    }
                    ?>

          
      </div></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal"><?php 
                    $sSQL341 = "Select sum(cantidadFacturada) as cantidadF From cargosFacturados WHERE numFactura='" . $_POST['folioFactura'] . "' and\r\nnT='" . $myrow81['keyCAP'] . "' and status='standby'";
                    $result341 = mysql_db_query($basedatos, $sSQL341);
                    $myrow341 = mysql_fetch_array($result341);
                    $solicita[0] += $myrow341['cantidadF'];
                    echo "\$" . number_format($myrow341['cantidadF'], 2);
                    ?>
</td>
  

  

  
  
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal">
	  <?php 
                    $sSQL321 = "Select sum(cantidadFacturada) as cantidadF From cargosFacturados WHERE numFactura='" . $_POST['folioFactura'] . "' and\r\nnT='" . $myrow81['keyCAP'] . "' and status='facturado'";
                    $result321 = mysql_db_query($basedatos, $sSQL321);
                    $myrow321 = mysql_fetch_array($result321);
                    $myrow321['cantidadF'] = round($myrow321['cantidadF'], 2);
                    $facturado[0] += $suma[0] - $myrow321['cantidadF'];
                    echo "\$" . number_format($myrow321['cantidadF'], 2);
                    ?>
</td>
     
	 
	  <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal"><?php 
                    $disponible[0] += $suma[0] - $myrow321['cantidadF'];
                    echo "\$" . number_format($suma[0] - $myrow321['cantidadF'], 2);
                    ?>
</td>
	  <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal">
	  
	  
	 
	  
	  <div align="left">
	  <?php 
                    if ($myrow81['statusFactura'] == 'standby' and $myrow81['tipoCobro'] == 'Cuentas por Cobrar') {
                        ?>
        <input name="escojer[]" type="checkbox" id="escojer[]" value="<?php 
                        echo $myrow81['keyCAP'];
                        ?>
" />
		<?php 
                    } else {
                        echo $escojer = '---';
                    }
                    ?>
		
		
      </div>
	  
	 
	  </td>
	  
	  

	  <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal">
	
	 
	 
	    <div align="left">
		 <?php 
                    if ($myrow81['statusFactura'] == 'request') {
                        $quitar += 1;
                        ?>
          <input name="quitar[]" type="checkbox" id="quitar[]" value="<?php 
                        echo $myrow81['keyCAP'];
                        ?>
" />
		  	<?php 
                    } else {
                        echo $quitar = '---';
                    }
                    ?>
        </div>	
		
		</td>
		
		
		
	  <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal"><div align="center">
	  
	 
	  <a href="javascript:ventanaSecundaria7('<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/INGRESOS%20HLC/cxc/subCuentasParticular.php?nRequisicion=<?php 
                    echo $requisicion;
                    ?>
&almacen=<?php 
                    echo $ALMACEN;
                    ?>
&nT=<?php 
                    echo $_GET['nT'];
                    ?>
&keyCAP=<?php 
                    echo $myrow81['keyCAP'];
                    ?>
&aseguradora=<?php 
                    echo $_GET['aseguradora'];
                    ?>
&entidad=<?php 
                    echo $entidad;
                    ?>
&particular=<?php 
                    echo $_GET['particular'];
                    ?>
&referido=<?php 
                    echo $_GET['referido'];
                    ?>
&gpoProducto=<?php 
                    echo $gpoProducto;
                    ?>
&tipoCliente=<?php 
                    echo $myrow81['tipoCliente'];
                    ?>
&codigo=<?php 
                    echo $C;
                    ?>
&almacenes=<?php 
                    echo $Cd;
                    ?>
')">
	  <label></label>
	  </a>
	  
	  
	 
	  
	  <?php 
                    $diferiencia = $suma[0] - $myrow341['cantidadF'];
                    if ($_POST['folioFactura'] and $diferiencia != '0' and $myrow81['statusFactura'] == 'request') {
                        ?>
      <a href="#" onClick="javascript:ventanaSecundaria8('ventanaCambiaImporte.php?keyCAP=<?php 
                        echo $myrow81['keyCAP'];
                        ?>
&seguro=<?php 
                        echo $myrow3['seguro'];
                        ?>
&folioFactura=<?php 
                        echo $_POST['folioFactura'];
                        ?>
&keyClientesInternos=<?php 
                        echo $myrow3['keyClientesInternos'];
                        ?>
')"><img src="<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/imagenes/modificascl.png" width="12" height="12" border="0" /></a>
      <?php 
                    }
                    ?>
</div></td>
      </tr>
 
	
	
    <?php 
                }
                ?>
  </table>
<?php 
            }
            ?>


  <p>
  <p>&nbsp;</p>
  <label>
    <div align="center">
      <div align="center">
	
	<input name="importe" type="hidden" class="style71" id="importe" value="<?php 
            echo $sumaImporte[0];
            ?>
" />
	<input name="disponible" type="hidden" class="style71" id="disponible" value="<?php 
            echo $disponible[0];
            ?>
" />
	<input name="solicita" type="hidden" class="style71" id="solicita" value="<?php 
            echo $solicita[0];
            ?>
" />
	<input name="facturado" type="hidden" class="style71" id="facturado" value="<?php 
            echo $facturado[0];
            ?>
" />
	
        <?php 
            if (!$myrow31['sumaFacturada']) {
                ?>
        <input name="escoje" type="submit" class="style71" id="escoje" value="Escojer Elementos" />
        <input name="quitar2" type="submit" class="style71" id="quitar" value="Quitar Elementos" />
          <?php 
            }
            ?>
		        
  </div>
  </label>
  <p align="center">
    <label>
	
	  
	<?php 
            $sSQL331 = "Select sum(cantidadFacturada) as cantidadF From cargosFacturados WHERE numFactura='" . $_POST['folioFactura'] . "' and\r\nnT='" . $myrow81['keyCAP'] . "' and status='standby'";
            $result331 = mysql_db_query($basedatos, $sSQL331);
            $myrow331 = mysql_fetch_array($result331);
            if (!$solicita[0] and $_POST['folioFactura']) {
                ?>
    <input name="aplicarFactura" type="submit" class="style7" id="aplicarFactura" value="Facturar" onClick="if(confirm('Estas seguro que deseas facturar <?php 
                echo "\$" . number_format($disponible[0], 2);
                ?>
 pesos?') == false){return false;}" />

<?php 
            } else {
                ?>
    <input name="aplicarFactura" type="submit" class="style7" id="aplicarFactura" value="Facturar" onClick="if(confirm('Estas seguro que deseas facturar <?php 
                echo "\$" . number_format($solicita[0], 2);
                ?>
 pesos?') == false){return false;}" />
	<?php 
            }
            ?>
	
	

    </label>
  </p>
 
<input name="bandera" type="hidden" value="<?php 
            echo $a;
            ?>
" />

<input name="keyClientesInternos" type="hidden" value="<?php 
            echo $myrow3['keyClientesInternos'];
            ?>
" />
</form>
<?php 
        }
        ?>

	<?php 
        if ($myrow3['statusFactura'] == 'facturado') {
            echo 'Registros ya Facturados';
        }
        ?>

<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 despliegaCitas($entidad, $ventana, $fecha1, $hora1, $almacen, $basedatos)
    {
        $almacenDestino = $almacen;
        $forma = $_GET['forma'];
        $campoDespliega = $_GET['campoDespliega'];
        $campoDespliegaFecha = $_GET['campoDespliegaFecha'];
        require CONSTANT_PATH_CONFIGURACION . "/componentes/comboAlmacen.php";
        ?>
<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-system.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 language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana","width=300,height=200,scrollbars=YES") 
} 
</script> 
  <script language=javascript> 
function ventanaSecundaria7 (URL){ 
   window.open(URL,"ventana7","width=600,height=600,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script>
  <script language=javascript> 
function ventanaSecundaria2 (URL){ 
   window.open(URL,"ventana2","width=800,height=600,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script>
<script language=javascript> 
function ventanaSecundaria4 (URL){ 
   window.open(URL,"ventana4","width=660,height=400,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria5 (URL){ 
   window.open(URL,"ventana5","width=630,height=700,scrollbars=YES") 
} 
</script> 


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


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


<?php 
        if ($_GET['keyClientesInternos'] and ($_GET['inactiva'] or $_GET['activa'])) {
            if ($_GET['inactiva'] == "inactiva") {
                $q = "UPDATE clientesInternos set \r\n\r\n\tstatus='cancelado'\r\n\t\tWHERE keyClientesInternos='" . $_GET['keyClientesInternos'] . "'";
                mysql_db_query($basedatos, $q);
                echo mysql_error();
            }
        }
        ?>
<!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();
        ?>



<meta http-equiv="refresh" content="90">


</head>
<body>
<form id="form1" name="form1" method="GET" action="citas.php">

  <h1 align="center">
    <?php 
        //**************VERIFICAR EL ESTADO DE LA CITA*****************
        if (!$_GET['fechaSolicitud']) {
            $_GET['fechaSolicitud'] = $fecha1;
        }
        if ($myrow6['descripcion']) {
            echo $myrow6['descripcion'];
        }
        //**************************************************************
        ?>
</h1>
  <table width="513" border="0" align="center">

    <tr valign="middle" class="style71">
      <th width="49" class="negro" scope="col"><span class="Estilo25">
        <input name="button" type="image"  id="lanzador" value="fecha"  src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/imagenes/btns/fechadate.png"/>
      </span></th>
      <th width="283" scope="col"><div align="left">
        <input name="fechaSolicitud" type="text" class="campos" id="campo_fecha"
	  value="<?php 
        if ($_GET['fechaSolicitud']) {
            echo $fecha2 = $_GET['fechaSolicitud'];
        } else {
            echo $fecha2 = $fecha1;
        }
        ?>
" size="15" readonly="" onChange="javascript:this.form.submit();"/>
        </div></th>
      <th width="19" scope="col">&nbsp;</th>
      <th width="144" scope="col"><span class="Estilo25">
        <label></label>
        </span>
      <div align="left"></div></th>
    </tr>
    <tr class="style71">
      <th class="negro" scope="col"><div align="left" class="negro">
        <div align="left">M&eacute;dico</div>
      </div></th>
      <th scope="col"><div align="left">
	  <?php 
        $aCombo = "Select almacen,descripcion From almacenes where \r\nentidad='" . $entidad . "' AND\r\nactivo='A' and almacenPadre='" . $almacen . "' \r\nand\r\nmedico='si'\r\norder by descripcion ASC";
        $rCombo = mysql_db_query($basedatos, $aCombo);
        ?>
<select name="almacenDestino1" class="combos" id="almacenDestino1" onChange="javascript:this.form.submit();"/>        


	   
	   <option value="">EN LISTA DE ESPERA</option><option value="">------</option>
	   
        <?php 
        while ($resCombo = mysql_fetch_array($rCombo)) {
            ?>
		
        <option 
		<?php 
            if ($resCombo['almacen'] == $_GET['almacenDestino1']) {
                echo 'selected=""';
            }
            ?>
		
		value="<?php 
            echo $resCombo['almacen'];
            ?>
"><?php 
            echo $resCombo['descripcion'];
            ?>
</option>
        <?php 
        }
        ?>
        </select>
	  </div></th>
	  
	  
	  
	  
	  <?php 
        if ($_GET['almacenDestino1']) {
            ?>
      <th scope="col">
	  
	  
	  
	  <a href="#" onClick="javascript:ventanaSecundaria7('ventanaMedicosNotas.php?numeroE=<?php 
            echo $numeroE;
            ?>
		&nCuenta=<?php 
            echo $nCuenta;
            ?>
&keyCAP=<?php 
            echo $keyCAP;
            ?>
&almacen=<?php 
            echo $almacenDestino;
            ?>
&fechaSolicitud=<?php 
            echo $_GET['fechaSolicitud'];
            ?>
&id_medico=<?php 
            echo $_GET['almacenDestino1'];
            ?>
&alma=<?php 
            echo $almacen;
            ?>
')">
		<img src="<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/imagenes/btns/addnote.png" alt="Agregar Notas" border="0" /></a>	  </th>
      <th scope="col"><div align="left">
	  
	  </div></th>
	  <?php 
        }
        ?>
    </tr>
  </table>
  <h3 align="center"><?php 
        $sSQL6 = "Select usuario,descripcion From medicosCitasCanceladas where\r\nentidad='" . $entidad . "'\r\nAND\r\nalmacen='" . $_GET['almacenDestino1'] . "'\r\nand\r\nfecha = '" . $_GET['fechaSolicitud'] . "' \r\n";
        $result6 = mysql_db_query($basedatos, $sSQL6);
        $myrow6 = mysql_fetch_array($result6);
        if ($myrow6['descripcion']) {
            echo '<span class="style1">' . '<blink>' . 'Aviso Importante: ' . '</blink>' . '</span>' . $myrow6['descripcion'];
            echo '</br>';
            echo 'Atte: ' . $myrow6['usuario'];
        }
        ?>
</h3>
  
  <tr>
    <td>
    <div id="contentLoading" class="contentLoading">
<img src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/imagenes/barras/loading30.gif" alt="Loading data, please wait...">
</div>
<div id="contentArea">
</div>
</td>
</tr>
    
</form>


<p>&nbsp; </p>
<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">
<!--
jQuery(function($) {
$("#contentArea").load("despliegaCitas.php?almacenDestino1=<?php 
        echo $_GET['almacenDestino1'];
        ?>
&fecha2=<?php 
        echo $fecha2;
        ?>
&fecha1=<?php 
        echo $fecha1;
        ?>
&almacen=<?php 
        echo $almacen;
        ?>
");
});

$().ajaxSend(function(r,s){
$("#contentLoading").show();
});

$().ajaxStop(function(r,s){
$("#contentLoading").fadeOut("fast");
});

//-->
</script>
</html>
<?php 
    }
Пример #14
0
    public function historialPacientes($entidad, $TITULO, $basedatos)
    {
        ?>


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


	<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<head>
<?php 
        $estilo = new muestraEstilos();
        $estilo->styles();
        ?>

	<script src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/js/scripts/autocomplete.js" type="text/javascript"></script>
	<link rel="stylesheet" href="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/js/stylesheets/autocomplete.css" type="text/css" />
	</head>
<body>


   <h4 align="center"><?php 
        echo $TITULO;
        ?>
</h4>
<form id="frmSearch" action="" method="post" name="frmSearch">
 <div align="center">
   <table width="200" border="0">
     <tr>
       <td>Paciente</td><input type="hidden" name="numeroE" id="numeroE" />
       <td><span id="sprytextfield1">
         <label>
         <input type="text" name="paciente" id="paciente" />
         </label>
        <span class="textfieldRequiredMsg">Se necesita un valor.</span></span></td>
     </tr>
     <tr>
       <td>&nbsp;</td>
       <td>&nbsp;</td>
     </tr>
     <tr>
       <td>&nbsp;</td>
       <td><label>
         <input type="submit" name="button" id="button" value="Buscar" />
         <span class="style7">
         <input name="expediente" type="hidden" id="expediente" value="<?php 
        echo $_POST['expediente'];
        ?>
" />
         </span></label></td>
     </tr>
   </table>
   <p>&nbsp;</p>
 </div>
    
</form>

 <p>&nbsp;</p>
<form id="form1" name="form1" method="post" action="modificaPacientes.php">
  <table width="365" border="0" align="center" cellpadding="4" cellspacing="0">
    <tr bgcolor="#FFFF00">
      <th width="71" class="style12" scope="col"><div align="left"><span class="style11 style13"># Paciente </span></div></th>
      <th class="style12" scope="col"><div align="left"><span class="style11 style13">Nombre del paciente:</span></div></th>
    </tr>
    <tr>
      <?php 
        $apellido3 = $_POST['txtSearch'];
        //$apellido3=substr($apellido3,"0","6");
        $apellido3 = trim($apellido3);
        if ($apellido3) {
            $sSQL = "SELECT *\r\n  FROM\r\npacientes\r\nWHERE \r\nentidad='" . $entidad . "'\r\nAND\r\nnumCliente like '%{$apellido3}%'\r\nor \r\nnombreCompleto like '%{$apellido3}%'\r\n\r\n ";
            if ($result = mysql_db_query($basedatos, $sSQL)) {
                while ($myrow = mysql_fetch_array($result)) {
                    if ($col) {
                        $color = '#FFCCFF';
                        $col = "";
                    } else {
                        $color = '#FFFFFF';
                        $col = 1;
                    }
                    $nombrePaciente = $myrow['nombre1'] . " " . $myrow['nombre2'] . " " . $myrow['apellido1'] . " " . $myrow['apellido2'] . " " . $myrow['apellido3'];
                    $E = $myrow['numCliente'];
                    $sSQL3 = "Select * From clientesInternos WHERE numeroE = '" . $E . "' order by nCuenta DESC ";
                    $result3 = mysql_db_query($basedatos, $sSQL3);
                    $myrow3 = mysql_fetch_array($result3);
                    ?>

<td height="24" bgcolor="<?php 
                    echo $color;
                    ?>
" class="style12"><span class="style7">
     <?php 
                    echo $E;
                    ?>
      </span></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="style12"><span class="style7">
<?php 
                    if ($myrow3['keyClientesInternos']) {
                        ?>
	   <a href="#" rel="htmltooltip" onClick="javascript:ventanaSecundaria('<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/consultas/consultaEC.php?nT=<?php 
                        echo $myrow3['keyClientesInternos'];
                        ?>
		&amp;nCuenta=<?php 
                        echo $myrow['nCuenta'];
                        ?>
&amp;almacen=<?php 
                        echo $bali;
                        ?>
&amp;basedatos=<?php 
                        echo $basedatos;
                        ?>
&amp;seguro=<?php 
                        echo $N;
                        ?>
&amp;numCliente=<?php 
                        echo $N;
                        ?>
')">	  <?php 
                        echo $myrow['nombre1'] . " " . $myrow['nombre2'] . " " . $myrow['apellido1'] . " " . $myrow['apellido2'] . " " . $myrow['apellido3'];
                        ?>
	  </a>
	  <?php 
                    } else {
                        ?>
	  <?php 
                        echo $myrow['nombre1'] . " " . $myrow['nombre2'] . " " . $myrow['apellido1'] . " " . $myrow['apellido2'] . " " . $myrow['apellido3'];
                        ?>
	  <?php 
                    }
                    ?>
	  </span>        <div align="center">	  <a href="javascript:ventanaSecundaria3('modificarP.php?numeroExpediente=<?php 
                    echo $myrow['numCliente'];
                    ?>
')">	  </a></div></td>
    </tr>
    <?php 
                }
            }
        }
        ?>
    <input name="nombres" type="hidden" value="<?php 
        echo $nombrePaciente;
        ?>
" />
  </table>
</form>
<p>&nbsp; </p>
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
//-->
</script>

  <script>
		new Autocomplete("expediente", function() { 
			this.setValue = function( id ) {
				document.getElementsByName("paciente")[0].value = id;
			}
			
			// If the user modified the text but doesn't select any new item, then clean the hidden value.
			if ( this.isModified )
				this.setValue("");
			
			// return ; will abort current request, mainly used for validation.
			// For example: require at least 1 char if this request is not fired by search icon click
			if ( this.value.length < 1 && this.isNotClick ) 
				return ;
			
			// Replace .html to .php to get dynamic results.
			// .html is just a sample for you
			return "<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/cargos/pacientesQuery.php?q=" + this.value;
			// return "completeEmpName.php?q=" + this.value;
		});	
	</script>
</body>

</html>
<?php 
    }
    public function consultarArticulos($almacen, $entidad, $basedatos)
    {
        $articulo = $_GET['nomArticulo'];
        if ($_GET['codigo'] and ($_GET['inactiva'] or $_GET['activa'])) {
            if ($_GET['inactiva'] == "inactiva") {
                $q = "UPDATE articulos set \r\n\r\n\t\tactivo='I'\r\n\t\tWHERE keyPA='" . $_GET['keyPA'] . "'";
                mysql_db_query($basedatos, $q);
                echo mysql_error();
            } else {
                if ($_GET['activa'] == "activa") {
                    $q = "UPDATE articulos set \r\n\r\n\t\tactivo='A'\r\n\t\tWHERE keyPA='" . $_GET['keyPA'] . "'";
                    mysql_db_query($basedatos, $q);
                    echo mysql_error();
                }
            }
        }
        ?>
<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana","width=350,height=189,scrollbars=YES") 
} 
</script>
 
<script language=javascript> 
function ventanaSecundaria2 (URL){ 
   window.open(URL,"ventana2","width=660,height=800,scrollbars=YES") 
} 
</script> 


<script language=javascript> 
function ventanaSecundaria6 (URL){ 
   window.open(URL,"ventana6","width=450,height=170,scrollbars=YES") 
} 
</script> 

<script language=javascript> 
function ventanaSecundaria7 (URL){ 
   window.open(URL,"ventana7","width=450,height=170,scrollbars=YES") 
} 
</script> 
<?php 
        $fecha1 = date("Y-m-d");
        $hora1 = date("H:i a");
        if ($_POST['actualizar']) {
            $keyPA = $_POST['keyPA'];
            $gpoProducto = $_POST['gpoProducto1'];
            $aseguradora = $_POST['aseguradora'];
            $particular = $_POST['particular'];
            $descripcion = $_POST['descripcion'];
            $almacen = $_POST['almacen'];
            for ($i = 0; $i <= $_POST['bandera']; $i++) {
                if ($keyPA[$i] != NULL) {
                    $q1 = "UPDATE articulos set \r\ndescripcion='" . $descripcion[$i] . "',\r\ngpoProducto='" . $gpoProducto[$i] . "',\r\n\r\nfechaActualizacion='" . $fecha1 . "',\r\n\r\nhora='" . $hora1 . "'\r\n\r\n\r\nWHERE keyPA='" . $keyPA[$i] . "'";
                    mysql_db_query($basedatos, $q1);
                    echo mysql_error();
                    $q2 = "UPDATE articulosPrecioNivel set \r\n\r\nnivel1='" . $particular[$i] . "',\r\nnivel3='" . $aseguradora[$i] . "',\r\nalmacen='" . $almacen[$i] . "'\r\n\r\nWHERE entidad='" . $entidad . "' and  keyPA='" . $keyPA[$i] . "' \r\nand\r\nalmacen='" . $_POST['almacenDestino1'] . "'\r\n";
                    mysql_db_query($basedatos, $q2);
                    echo mysql_error();
                    $q3 = "UPDATE existencias set \r\n\r\ndescripcion='" . $descripcion[$i] . "',\r\nalmacen='" . $almacen[$i] . "'\r\n\r\n\r\nWHERE \r\n\r\nentidad='" . $entidad . "' and  keyPA='" . $keyPA[$i] . "' \r\nand\r\nalmacen='" . $_POST['almacenDestino1'] . "'\r\n";
                    mysql_db_query($basedatos, $q3);
                    echo mysql_error();
                }
            }
            echo 'Se hicieron cambios en el sistema...';
        }
        ?>










<?php 
        $fecha1 = date("Y-m-d");
        $hora1 = date("H:i a");
        if ($_POST['delete']) {
            $keyPA = $_POST['keyPA1'];
            for ($i = 0; $i <= $_POST['bandera']; $i++) {
                if ($keyPA[$i]) {
                    $q3 = "DELETE FROM existencias where entidad='" . $entidad . "' and almacen='" . $_POST['almacenDestino1'] . "' and keyPA='" . $keyPA[$i] . "' ";
                    mysql_db_query($basedatos, $q3);
                    echo mysql_error();
                    $q4 = "DELETE FROM articulosPrecioNivel where entidad='" . $entidad . "' and almacen='" . $_POST['almacenDestino1'] . "' and keyPA='" . $keyPA[$i] . "' ";
                    mysql_db_query($basedatos, $q4);
                    echo mysql_error();
                }
            }
            echo 'Se eliminaron cambios en el sistema...';
        }
        ?>



        <script type="text/javascript" src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/js/editp/spec/support/jquery.js"></script>
        <script type="text/javascript" src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/js/editp/spec/support/jquery.ui.js"></script>
        <script type="text/javascript" src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/js/editp/lib/jquery.editinplace.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" />
<?php 
        $estilos = new muestraEstilos();
        $estilos->styles();
        ?>
</head>

<body>
    <div class="page_right">
<h1 align="center" >Listado por GPO </h1>







<form id="form1" name="form1" method="post" >

  <!--<table width="474" class="table-forma">-->
  <table width="474" class="table-template">
    <tr>
      <td height="21"   scope="col"><div align="center" >Almac&eacute;n </div></td>
	  
	  
	  
	  
      <td   scope="col"><div align="left">
        <?php 
        $aCombo = "Select * From almacenes where entidad='" . $entidad . "' AND\r\nactivo='A' and stock='si' order by descripcion ASC";
        $rCombo = mysql_db_query($basedatos, $aCombo);
        ?>
          <select name="almacenDestino" class="combos" id="almacenDestino" />
  
          <option value="">---</option>
          <?php 
        while ($resCombo = mysql_fetch_array($rCombo)) {
            ?>
          <option 
		<?php 
            if ($_POST['almacenDestino'] == $resCombo['almacen']) {
                echo 'selected="selected"';
            }
            ?>
		value="<?php 
            echo $resCombo['almacen'];
            ?>
"><?php 
            echo $resCombo['descripcion'];
            ?>
</option>
          <?php 
        }
        ?>
          </select>
      </div></td>
    </tr>
	
	
	
	
	
	
  
	
	
	
	
	




    <tr>
      <td height="22"  scope="col">&nbsp;</td>
      <td  scope="col"><div align="left"><span >
          <input name="buscar" type="submit" src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/imagenes/btns/searcharticles.png" id="buscar" value="buscar" />
      </span></div></td>
    </tr>
  </table>

<p>&nbsp;</p>
 
  <!--<table width="791" class="table table-striped">-->
  <table width="791" class="table-template">
    <tr >
      <th width="5"  scope="col"><p align="left" >#</p></th>
      <th width="300"  scope="col"><p align="left" >Descripcion</p></th>
     <th width="50" scope="col"><p align="left" >Anaquel</p></th>
      <th width="200" scope="col"><p align="left" >Grupo</p></th>
 <th width="200" scope="col"><p align="left" >Costo</p></th>
      <th width="60" scope="col"><p align="left" >P Part</p></th>
      <th width="50" scope="col"><p align="left" >P Aseg</p></th>


      <!--<th width="52" bgcolor="#660066" scope="col" class="blanco">Usuario</th>-->
    </tr>


<?php 
        if ($_POST['buscar']) {
            //codigo
            $sSQL = "\r\nSELECT * from articulos,existencias where articulos.entidad='" . $entidad . "' and \r\nexistencias.almacen='" . $_POST['almacenDestino'] . "' and \r\n    articulos.descripcion!='' \r\n    and\r\nexistencias.codigo=articulos.codigo    \r\norder by articulos.gpoProducto,articulos.descripcion ASC";
            $result = mysql_db_query($basedatos, $sSQL);
            while ($myrow = mysql_fetch_array($result)) {
                $a += 1;
                $totalRegistros += 1;
                $i = $myrow52['totalRegedit'];
                $sSQL78 = "SELECT nivel1,nivel3\r\nFROM\r\narticulosPrecioNivel\r\nWHERE \r\nentidad='" . $entidad . "'\r\nand\r\ncodigo = '" . $myrow['codigo'] . "' \r\nand\r\nalmacen='" . $_POST['almacenDestino'] . "'\r\n  ";
                $result78 = mysql_db_query($basedatos, $sSQL78);
                $myrow78 = mysql_fetch_array($result78);
                $sSQL78a = "SELECT *\r\nFROM\r\nprecioArticulos\r\nWHERE \r\nentidad='" . $entidad . "'\r\nand\r\ncodigo = '" . $myrow['codigo'] . "' \r\norder by keyC DESC\r\n  ";
                $result78a = mysql_db_query($basedatos, $sSQL78a);
                $myrow78a = mysql_fetch_array($result78a);
                $gpoProducto = $myrow['gpoProducto'];
                $sSQL39 = "\r\n\tSELECT \r\nprefijo,rutaModifica,descripcionGP\r\nFROM\r\ngpoProductos\r\nWHERE \r\ncodigoGP='" . $myrow['gpoProducto'] . "'";
                $result39 = mysql_db_query($basedatos, $sSQL39);
                $myrow39 = mysql_fetch_array($result39);
                $color1 = '#FF3300';
                $bandera = +1;
                ?>

      
      
      
  <tr  >

          <td >
        <span  >

<?php 
                echo $a;
                ?>
	  </span></td>




  <td   >
        <span  >
        <input name="keyPA[]" type="hidden" id="codigo" value="<?php 
                echo $myrow['keyPA'];
                ?>
" />
      </span>

	  	  <label>
<?php 
                echo $myrow['descripcion'];
                if ($myrow['sustancia'] != NULL) {
                    echo '<br>';
                    echo 'Sustancia: ' . $myrow['sustancia'];
                }
                ?>
	  </label>
      

	  
	  	<?php 
                if ($myrow['generico'] == 'si') {
                    ?>
					<blink>
		<img src="../imagenes/g.jpg" alt="MEDICAMENTO GENERICO..." width="12" height="12" border="0" />		</blink>
		<?php 
                } else {
                    echo '';
                }
                ?>
	  </span></td>
      

         


<script type="text/javascript">
/*
 * Another In Place Editor - a jQuery edit in place plugin
 *
 * Copyright (c) 2009 Dave Hauenstein
 *
 * License:
 * This source file is subject to the BSD license bundled with this package.
 * Available online: {@link http://www.opensource.org/licenses/bsd-license.php}
 * If you did not receive a copy of the license, and are unable to obtain it,
 * email davehauenstein@gmail.com,
 * and I will send you a copy.
 *
 * Project home:
 * http://code.google.com/p/jquery-in-place-editor/
 *
 */
$(document).ready(function(){
	

	// Using a callback function to update 2 divs
	$("#<?php 
                echo $myrow['keyE'];
                ?>
").editInPlace({
            url: "<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/cargos/ajusteAnaquel.php?keyE=<?php 
                echo $myrow['keyE'];
                ?>
"
		//callback: function(element_id,original_element, html, original){
                     
		//	$("#updateDiv1").html("The original html was: " + original);
		//	$("#updateDiv2").html( html);
                //        $("#updateDiv3").html("El ID es el: " + element_id);
		//	return(html);
		//}
	});
	
        
        	// A select input field so we can limit our options
	$("#<?php 
                echo $myrow['keyPA'];
                ?>
").editInPlace({
		callback: function(unused, enteredText) { return enteredText; },
                url: "<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/cargos/ajusteGpoProducto.php?gpoProducto=<?php 
                echo $myrow['gpoProducto'];
                ?>
&keyPA=<?php 
                echo $myrow['keyPA'];
                ?>
",
		field_type: "select",
		select_options: "<?php 
                $sSQL7a = "Select * From gpoProductos where \r\n(codigoGP!='HONMED' and codigoGP!='sIVA' and codigoGP!='cIVA')     \r\nORDER BY descripcionGP ASC ";
                $result7a = mysql_db_query($basedatos, $sSQL7a);
                while ($myrow7a = mysql_fetch_array($result7a)) {
                    echo $myrow7a['descripcionGP'] . ',';
                }
                ?>
"
	});

	
	// If you need to remove an already bound editor you can call

	// > $(selectorForEditors).unbind('.editInPlace')

	// Which will remove all events that this editor has bound. You need to make sure however that the editor is 'closed' when you call this.
	
});
</script>  


      <td   >
<div align="left" >
<?php 
                echo $myrow['anaquel'];
                ?>
      
</div>          


</td>

	 
    <?php 
                /*?>  <td bgcolor="<?php echo $color;?>" >
                  <?php echo cambia_a_normal($myrow['fechaActualizacion'])." <".$myrow['hora'].">"; ?></td><?php */
                ?>
      <td   >
          <?php 
                //*********gpoProductos
                echo $myrow39['descripcionGP'];
                ?>

</td>






   
      <td  >
          
          <?php 
                //*********gpoProductos
                echo '$' . number_format($myrow78a['costo'], 2);
                ?>

</td>





         
      <td   >
	  
	  

	  <label>

 <?php 
                echo '$' . number_format($myrow78['nivel1'], 2);
                ?>
	  </label>
	  </a></td>
      <td   >

	  	 <?php 
                echo '$' . number_format($myrow78['nivel3'], 2);
                ?>
      </td>
      
      
      
      
      

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

<?php 
        if ($totalRegistros) {
            ?>
<div align="center" class="notice"><strong><em>Se encontraron  <?php 
            echo $totalRegistros;
            ?>
 registros</em></strong></div></a>
<?php 
        }
        ?>
<p>&nbsp;</p>
    </div>
</body>
</html>
<?php 
    }
Пример #16
0
    public function pacientesJubilados($ventana, $entidad, $usuario, $numeroE, $basedatos)
    {
        ?>

<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.nombrePaciente.value) == false ) {   
                alert("Por Favor, escribe el nombre del paciente!")   
                return false   
        } else if( vacio(F.deposito.value) == false ) {   
                alert("Por Favor, escribe el dep�sito!")   
                return false   
        } else if( vacio(F.medico.value) == false ) {   
                alert("Por Favor, escoje el m�dico responsable del internamiento!")   
                return false   
        }  else if( vacio(F.cuarto.value) == false ) {   
                alert("Por Favor, escoje el cuarto que desees asignar!")   
                return false   
        }  else if( vacio(F.limiteCredito.value) == false ) {   
                alert("Por Favor, escoje el l�mite que desees asignar!")   
                return false   
        }   
}   
  
  
  
  
</script>

<script language=javascript> 
function ventanaSecundaria5 (URL){ 
   window.open(URL,"ventana5","width=500,height=600,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria6 (URL){ 
   window.open(URL,"ventana6","width=260,height=300,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria7 (URL){ 
   window.open(URL,"ventana7","width=850,height=600,scrollbars=YES") 
} 
</script>
<script language=javascript> 
function ventanaSecundaria1 (URL){ 
   window.open(URL,"ventana1","width=650,height=700,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria2 (URL){ 
   window.open(URL,"ventana2","width=220,height=250,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria3 (URL){ 
   window.open(URL,"ventana3","width=800,height=400,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria4 (URL){ 
   window.open(URL,"ventana4","width=270,height=350,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana","width=550,height=180,scrollbars=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">
<!--
// Nannette Thacker http://www.shiningstar.net
function confirmSubmit()
{
var agree=confirm("Est� Ud. seguro de cambiar a este paciente de cama?");
var bandera;
if (agree)
	return true ;
else
	return false ;
}
// -->
</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" />
<script src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/js/scripts/autocomplete.js" type="text/javascript"></script>
	<link rel="stylesheet" href="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/js/stylesheets/autocomplete.css" type="text/css" />

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

<body>
    <div class="page_right">
<h1>Porcentajes Especiales - Pacientes </h1>
<?php 
        echo $leyenda;
        ?>
  <form id="form1" name="form1" method="post" action="#" >

<!--<table width="496" class="table-forma">-->
<table width="496" class="table-template-left">
  <tr >
      <td height="20" colspan="3" ><div align="center" >Datos del Paciente </div></td>
    </tr>
      <tr valign="middle" >
        <td colspan="3" ><span >Escribe las primeras letras del Apellido</span></td>
      </tr>
<tr>  
<td width="428" ><div align="left" >
        <input name="paciente" type="text"  id="paciente" value="<?php 
        echo $myrow10['paciente'];
        ?>
" size="60" onChange="this.form.submit();"/>
         
				<?php 
        echo '</br>';
        ?>
		<a href="javascript:ventanaSecundaria1(
		'<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/cargos/busquedaAvanzada.php?reload=si')" class="style1">
		<span align="center">Busqueda Avanzada 
		</a></span>
        </div></td>

        <td width="18">
         
      <input name="numeroEx" type="hidden"  id="numeroE" value="<?php 
        echo $numeroEs = $_POST['numeroE'];
        ?>
" readonly="" /></td>
    </tr>
    </table>

<div align="center">
  <?php 
        if ($nombres = $_POST['paciente']) {
            $sSQL = "\r\nSELECT * FROM \r\npacientes \r\nwhere \r\n(entidad='" . $entidad . "'\r\nAND\r\n(\r\n(CONCAT(nombre1) like '%{$nombres}%')\r\nor\r\n(CONCAT(apellido1,' ',apellido2) like trim('%{$nombres}%'))\r\nor\r\n(CONCAT(apellido1,'  ',apellido2) like '%{$nombres}%')\r\nor\r\n(CONCAT(nombre1) like '%{$nombres}%')\r\nor\r\n(nombreCompleto like '%{$nombres}%')\r\n)) or (entidad='" . $entidad . "'\r\nand\r\nnumCliente='" . $nombres . "'\r\n)\r\norder by\r\nnombreCompleto asc\r\n";
            $result = mysql_db_query($basedatos, $sSQL);
            ?>
</div>
<p>&nbsp;</p>
<!--<table width="594" class="table table-striped">-->
<table width="594" class="table-template-left">

       <tr >
 <th width="17"  scope="col"><div align="left" >
          <div align="center">#</div>
      </div></th>
        <th width="67" scope="col"><div align="left" >
          <div align="center">Exp.</div>
        </div></th>
      <th width="229" scope="col"><div align="left" >Paciente</div></th>
      <th width="91" scope="col"><div align="left" >
        <div align="center">Porcentajes</div>
      </div></th>
      <th width="68" scope="col"><div align="left" >
        <div align="center">Editar Exp.</div>
      </div></th>
    </tr>

        <?php 
            $result = mysql_db_query($basedatos, $sSQL);
            while ($myrow = mysql_fetch_array($result)) {
                $bandera += "1";
                //cierro descuento
                $NUMEROE = $myrow['numCliente'];
                $sSQL33 = "Select  * From porcentajeJubilados WHERE keyPacientes = '" . $myrow['keyPacientes'] . "'";
                $result33 = mysql_db_query($basedatos, $sSQL33);
                $myrow33 = mysql_fetch_array($result33);
                ?>

<tr >
        <td  bgcolor="<?php 
                echo $color;
                ?>
" ><span >
        <?php 
                echo $bandera;
                ?>
        </span></td>
		  
		  <td bgcolor="<?php 
                echo $color;
                ?>
" ><span >
		    <?php 
                echo $myrow['numCliente'];
                ?>
</span></td>
		  <td bgcolor="<?php 
                echo $color;
                ?>
" >
		 
		<?php 
                echo $myrow['nombreCompleto'];
                ?>
		</td>
        <td ><div align="center">
		  
		   <?php 
                if ($myrow['jubilado'] == 'si') {
                    ?>
		  <a href="#" onClick="ventanaSecundaria3('<?php 
                    echo $ventana;
                    ?>
?numeroE=<?php 
                    echo $myrow['numCliente'];
                    ?>
&codigoPaquete=<?php 
                    echo $myrow['codigoPaquete'];
                    ?>
&keyPacientes=<?php 
                    echo $myrow['keyPacientes'];
                    ?>
&nCuenta=<?php 
                    echo $myrow['nCuenta'];
                    ?>
&almacen2=<?php 
                    echo $A;
                    ?>
&seguro=<?php 
                    echo $_POST['seguro'];
                    ?>
&numCliente=<?php 
                    echo $N;
                    ?>
')"> Editar Porcentaje </a> 
		  <?php 
                } else {
                    echo '---';
                }
                ?>
     </div></td>
        <td   align="center">
        
		
		
<a href="javascript:ventanaSecundaria1('../ventanas/modificarP.php?campoDespliega=<?php 
                echo "nomSeguro";
                ?>
&amp;forma=<?php 
                echo "F";
                ?>
&amp;numeroExpediente=<?php 
                echo $myrow['numCliente'];
                ?>
&amp;seguro=<?php 
                echo $_POST['seguro'];
                ?>
&porcentajeEspecial=si')">Editar</a></td>
    </tr>

      <?php 
            }
            ?>
   
    <?php 
        }
        ?>
</table>
	
	<?php 
        if ($nombres) {
            ?>
	<p align="center" ><span >Se encontraron:  <?php 
            echo $bandera;
            ?>
 registros..   </span></p>
	<?php 
        }
        ?>
	<p>
	  <input name="nombrePaciente1" type="hidden"  id="nombrePaciente" size="60" readonly="" 
		value="<?php 
        echo $nombrePaciente;
        ?>
"  />
    </p>
  </form>
  <!--<p>&nbsp;</p>-->

<script>
		new Autocomplete("paciente", function() { 
			this.setValue = function( id ) {
				document.getElementsByName("numeroEx")[0].value = id;
			}
			
			// If the user modified the text but doesn't select any new item, then clean the hidden value.
			if ( this.isModified )
				this.setValue("");
			
			// return ; will abort current request, mainly used for validation.
			// For example: require at least 1 char if this request is not fired by search icon click
			if ( this.value.length < 1 && this.isNotClick ) 
				return ;
			
			// Replace .html to .php to get dynamic results.
			// .html is just a sample for you
			return "<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/cargos/pacientesx.php?entidad=<?php 
        echo $entidad;
        ?>
&q=" + this.value;
			// return "completeEmpName.php?q=" + this.value;
		});	
	</script>
    </div>
</body>
</html>
<?php 
    }
    public function eACC($fechaInicial, $fechaFinal, $entidad, $almacenSolicitante, $basedatos)
    {
        ?>
 
<script language=javascript> 
function ventanaSecundaria1 (URL){ 
   window.open(URL,"ventana1","width=800,height=600,scrollbars=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>
<?php 
        $estilos = new muestraEstilos();
        $estilos->styles();
        ?>
</head>



<?php 
        $sSQL7e = "SELECT *\r\nFROM\r\nalmacenes\r\nWHERE\r\nentidad='" . $entidad . "'\r\nand\r\nalmacen='" . $almacenSolicitante . "'\r\n\r\n";
        $result7e = mysql_db_query($basedatos, $sSQL7e);
        $myrow7e = mysql_fetch_array($result7e);
        ?>
<body>
 <h1 align="center">
 <?php 
        //print $myrow7e['descripcion'];
        ?>
 
  <?php 
        print $myrow7e['descripcion'];
        ?>
 </h1>
    <p align="center"><br />
    </p>
<form id="form2" name="form2" method="post" action="">
  <div align="center">
   
<?php 
        $sSQL = "Select gpoProducto From cargosCuentaPaciente where \r\nentidad='" . $entidad . "'\r\nand\r\ntipoPaciente='externo'\r\nand\r\ngpoProducto!=''\r\nand\r\nalmacenSolicitante='" . $almacenSolicitante . "'\r\nand\r\n(fechaCierre>='" . $fechaInicial . "' and fechaCierre<='" . $fechaFinal . "')\r\nand\r\nventasDirectas!='si'\r\nand\r\ngpoProducto!='HONMED'\r\ngroup by gpoProducto\r\norder by almacen\r\n";
        $result = mysql_db_query($basedatos, $sSQL);
        ?>

</div>
  <table width="514" border="0" align="center">
     <tr>
       <th width="75" bgcolor="#660066" scope="col"><div align="left"><span class="blanco">C&oacute;digo GP</span></div></th>
       <th width="251" bgcolor="#660066" scope="col"><div align="left"><span class="blanco">Descripci&oacute;n de Productos </span></div></th>
       <th width="60" bgcolor="#660066" scope="col"><div align="left"><span class="blanco">Ingresos</span></div></th>
       <th width="45" bgcolor="#660066" scope="col"><div align="left"><span class="blanco">IVA</span></div></th>
       <th width="61" bgcolor="#660066" scope="col"><div align="left"><span class="blanco">Detalles</span></div></th>
    </tr>
     <tr>
<?php 
        while ($myrow = mysql_fetch_array($result)) {
            if ($col) {
                $color = '#FFCCFF';
                $col = "";
            } else {
                $color = '#FFFFFF';
                $col = 1;
            }
            //************************EFECTIVOS******************
            $sSQL7 = "SELECT sum(precioVenta*cantidad) as efectivos,sum(iva*cantidad) as ivar\r\n\r\nFROM\r\ncargosCuentaPaciente\r\nWHERE\r\nentidad='" . $entidad . "'\r\nand\r\n(fechaCierre>='" . $fechaInicial . "' and fechaCierre<='" . $fechaFinal . "')\r\nand\r\ntipoPaciente='externo'\r\nand\r\nalmacenSolicitante='" . $almacenSolicitante . "'\r\nand\r\ngpoProducto='" . $myrow['gpoProducto'] . "'\r\nand\r\nstatusCaja='pagado'\r\nand\r\nnaturaleza='C'\r\nand\r\nventasDirectas!='si'\r\nand\r\ngpoProducto!='HONMED'\r\n\r\n  ";
            $result7 = mysql_db_query($basedatos, $sSQL7);
            $myrow7 = mysql_fetch_array($result7);
            $sSQL7d = "SELECT  sum(precioVenta*cantidad) as efectivos,sum(iva*cantidad) as ivar\r\n\r\nFROM\r\ncargosCuentaPaciente\r\nWHERE\r\nentidad='" . $entidad . "'\r\nand\r\n(fechaCierre>='" . $fechaInicial . "' and fechaCierre<='" . $fechaFinal . "')\r\nand\r\ntipoPaciente='externo'\r\nand\r\nalmacenSolicitante='" . $almacenSolicitante . "'\r\nand\r\ngpoProducto='" . $myrow['gpoProducto'] . "'\r\nand\r\nstatusCaja='pagado'\r\nand\r\nnaturaleza='A'\r\n\r\nand\r\nventasDirectas!='si'\r\nand\r\ngpoProducto!='HONMED'\r\n";
            $result7d = mysql_db_query($basedatos, $sSQL7d);
            $myrow7d = mysql_fetch_array($result7d);
            //***********************************************************
            $efectivos[0] += $myrow7['efectivos'] - $myrow7d['efectivos'];
            $ivars[0] += $myrow7['ivar'] - $myrow7d['ivar'];
            $sSQL7ss = "SELECT descripcionGP\r\n\r\nFROM\r\ngpoProductos\r\nWHERE\r\nentidad='" . $entidad . "'\r\nand\r\ncodigoGP='" . $myrow['gpoProducto'] . "'";
            $result7ss = mysql_db_query($basedatos, $sSQL7ss);
            $myrow7ss = mysql_fetch_array($result7ss);
            ?>
       <td bgcolor="<?php 
            echo $color;
            ?>
" class="normalmid"><span class="style7">
       
         <label>
         <?php 
            echo $myrow['gpoProducto'];
            ?>
         </label>
       </span></td>
       <td bgcolor="<?php 
            echo $color;
            ?>
" class="normalmid">
	   <span class="style71">
	   <?php 
            echo $myrow7ss['descripcionGP'];
            ?>
	   </span>	

          </td>
       <td bgcolor="<?php 
            echo $color;
            ?>
" class="normalmid">
	   <?php 
            //echo $myrow7['efectivos'].' '.$myrow7d['efectivos'].'<br>';
            echo "\$" . number_format($myrow7['efectivos'] - $myrow7d['efectivos'], 2);
            ?>
       </td>
       <td bgcolor="<?php 
            echo $color;
            ?>
" class="normalmid">
	   
	   <?php 
            //echo ($myrow7['efectivos']*$myrow['porcentaje']).' '.($myrow7d['efectivos']*$myrow['porcentaje']).'<br>';
            echo "\$" . number_format($myrow7['ivar'] - $myrow7d['ivar'], 2);
            ?>
       
       
       </td>
       <td bgcolor="<?php 
            echo $color;
            ?>
" class="normalmid"><div align="center">
         <?php 
            if ($myrow7['efectivos']) {
                ?>
         <a href="#" 
onclick="javascript:ventanaSecundaria1('reportexGPOAD.php?fecha=<?php 
                echo $_POST['fecha'];
                ?>
&amp;gpoProducto=<?php 
                echo $myrow['gpoProducto'];
                ?>
&amp;almacen=<?php 
                echo $almacen;
                ?>
&amp;almacenFuente=<?php 
                echo $myrow['almacenSolicitante'];
                ?>
&amp;nT=<?php 
                echo $nT;
                ?>
&amp;tipoCliente=<?php 
                echo $tipoCliente;
                ?>
&amp;tipoMovimiento=<?php 
                echo 'cierreCuenta';
                ?>
&amp;fechaInicial=<?php 
                echo $_GET['fechaInicial'];
                ?>
&amp;fechaFinal=<?php 
                echo $_GET['fechaFinal'];
                ?>
&folioVenta=<?php 
                echo $FV;
                ?>
&random=<?php 
                echo $_GET['random'];
                ?>
')"><img src="../../imagenes/btns/detailsbtn.png" width="18" height="18" border="0" /></a>
         <?php 
            } else {
                echo '---';
            }
            ?>
       </div></td>
     </tr>
     
    
<?php 
        }
        //cierra while
        ?>
     
     
  </table>
  
  
  
  
  <p>&nbsp;</p>
  
  
  
  
  
  
  
  
  <table width="200" border="1" align="center">
    <tr>
      <th colspan="2" scope="col">Subtotales</th>
    </tr>
    <tr>
      <th width="97" scope="col"><div align="left">SubTotal</div></th>
      <th width="87" scope="col"><div align="left"><?php 
        print '$' . number_format($efectivos[0], 2);
        ?>
</div></th>
    </tr>
    <tr>
      <th scope="col"><div align="left">IVA</div></th>
      <th scope="col"><div align="left">
	  <?php 
        print '$' . number_format($ivars[0], 2);
        //print '$'. number_format($ivarD[0], 2);
        ?>
</div></th>
    </tr>
    <tr>
      <td><div align="left">TOTAL</div></td>
      <td><div align="left">
	  <?php 
        print '$' . number_format($efectivos[0] + $ivars[0], 2);
        ?>
</div></td>
    </tr>
  </table>
  
  

  </form>
 <p align="center">&nbsp;</p>
</body>
</html>
<?php 
    }
Пример #18
0
    public function eCCI($folioVenta, $basedatos)
    {
        ?>


<?php 
        $cargosCia = new acumulados();
        $cargosParticularesCC = new cierraCuenta();
        $cargosAseguradoraCC = new cierraCuenta();
        $numeroPaciente = $_GET['numeroE'];
        $seguro = $_GET['seguro'];
        $medico = $_GET['medico'];
        $almacen = $_GET['almacen'];
        $nCuenta = $_GET['nCuenta'];
        $tipoCargo = $_GET['tipoCargo'];
        ?>

<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.almacen.value) == false ) {   
                alert("Por Favor, escoje el departamento!")   
                return false   
        } else if( vacio(F.tipoUM.value) == false ) {   
                alert("Por Favor, escoje si es un servicio o si son artículos lo que vas a cargar!")   
                return false   
        } else if( vacio(F.nomArticulo.value) == false ) {   
                alert("Por Favor, escoje el artículo o servicio para solicitar!")   
                return false   
        }            
}   
  
  
  
  
</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>
<?php 
        $sSQL = "SELECT *\r\nFROM\r\nclientesInternos \r\nwhere\r\nfolioVenta='" . $folioVenta . "'\r\n\r\n ";
        $result = mysql_db_query($basedatos, $sSQL);
        $myrow = mysql_fetch_array($result);
        $entidad = $myrow['entidad'];
        $keyClientesInternos = $myrow['keyClientesInternos'];
        ?>
<!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();
        ?>

<style type="text/css">
<!--
.Estilo1 {
	color: #FF0000;
	font-weight: bold;
	size:116px;
}
.Estilo2 {font-size: 16px}
-->
</style>
</head>

<body>
<p align="center">
  <label></label><label>
  </label></p>
  
<form id="form2" name="form2" method="post" action="" onSubmit="return valida(this);">
  <table width="513" border="0" align="center">
    <tr bgcolor="#330099">
      <th colspan="2" scope="col"><div align="center"><span class="blanco Estilo2"> Estado de Cuenta </span></div></th>
    </tr>
    <tr>
      <th bgcolor="#330099" scope="col"><div align="left" class="blanco">Folio de Venta</div></th>
      <th scope="col"><div align="left"><span class="normalmid"><?php 
        echo $myrow['folioVenta'];
        ?>
</span></div></th>
    </tr>
    <tr>
      <th bgcolor="#330099" scope="col"><div align="left"><span class="blanco">Paciente</span></div></th>
      <th scope="col"><div align="left"><span class="normal"><?php 
        echo $myrow['paciente'];
        ?>
</span></div></th>
    </tr>
    <tr>
      <th bgcolor="#330099" scope="col"><div align="left"><span class="blanco">Departamento Internamiento</span></div></th>
      <th scope="col"><div align="left" class="normal"><?php 
        $id_almacen = $myrow['almacen'];
        $sSQL1 = "SELECT almacen,descripcion\r\nFROM\r\nalmacenes\r\nWHERE \r\nalmacen='" . $id_almacen . "'\r\n ";
        $result1 = mysql_db_query($basedatos, $sSQL1);
        $myrow1 = mysql_fetch_array($result1);
        echo $myrow1['almacen'] . " - " . $myrow1['descripcion'];
        ?>
</div></th>
    </tr>
    <tr>
      <th bgcolor="#330099" scope="col"><div align="left"><span class="blanco"> Seguro </span></div></th>
      <th scope="col"><div align="left"><span class="normal"><?php 
        $seguro1 = $myrow['seguro'];
        $sSQL4 = "SELECT nomCliente\r\n\tFROM\r\n\tclientes \r\n\twhere\r\n\tnumCliente='" . $seguro1 . "'";
        $result4 = mysql_db_query($basedatos, $sSQL4);
        $myrow4 = mysql_fetch_array($result4);
        echo $myrow4['nomCliente'];
        ?>
	  </span>
          </label>
      </div></th>
    </tr>
    <tr>
      <th bgcolor="#330099" scope="col"><div align="left"><span class="blanco">Credencial</span></div></th>
      <th scope="col"><div align="left"><span class="normal"><?php 
        echo $myrow['credencial'];
        ?>
</span></div></th>
    </tr>
    <tr>
      <th width="171" bgcolor="#330099" scope="col"><div align="left"><span class="blanco">Fecha/Hora Internamiento</span></div></th>
      <th width="332" scope="col"><div align="left"><span class="normal"><?php 
        echo $myrow['fecha'] . " / " . $myrow['hora'];
        ?>
</span></div></th>
    </tr>
    <tr>
      <th bgcolor="#330099" scope="col"><div align="left" class="blanco">Medico Internamiento</div></th>
      <th scope="col"><div align="left"><span class="normal">
	  
	 <?php 
        $medico1 = $myrow['medico'];
        $sSQL3 = "SELECT descripcion\r\n\tFROM\r\n\talmacenes \r\n\twhere\r\n\talmacen='" . $medico1 . "'";
        $result3 = mysql_db_query($basedatos, $sSQL3);
        $myrow3 = mysql_fetch_array($result3);
        echo $myrow3['descripcion'];
        ?>
     
     
     </span></div></th>
    </tr>
    <tr>
      <th bgcolor="#330099" scope="col"><div align="left" class="blanco">Diagn&oacute;stico</div></th>
      <th scope="col"><div align="left"><span class="normal"><?php 
        echo $myrow['dx'];
        ?>
</span></div></th>
    </tr>
  </table>
  
  

  
  
  
  
  
  <p align="center" class="titulos">Listado de Cargos</p>

<?php 
        if ($myrow['statusFactura'] == 'facturado') {
            ?>
  <p align="center" class="titulos Estilo1"><blink>Facturado</blink></p>
<?php 
        }
        ?>

  <div align="center">

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




 
  



<?php 
        if ($sC > 0) {
            ?>
<p>&nbsp;</p>

<p align="center"><blink></blink><br />
</p>
<?php 
        }
        ?>





<?php 
        $despliegaTotales = new totales();
        $despliegaTotales->tt($entidad, $class, $estilo, $fechas1, $fechas2, $keyClientesInternos, $_GET['folioVenta'], $basedatos);
        ?>



  <p align="center">&nbsp;</p>
  <p>
      <input name="gpoProducto" type="hidden" id="numPaciente2" value="<?php 
        echo $gpoProducto;
        ?>
" />
      <input name="numeroMedico1" type="hidden" id="numeroMedico1" value="<?php 
        echo $numeroMedico;
        ?>
" />
      <input name="nombreDelPaciente2" type="hidden" id="nombreDelPaciente2" value="<?php 
        echo $nombreDelPaciente;
        ?>
" />
      <input name="extension2" type="hidden" id="extension2" value="<?php 
        echo $extension;
        ?>
" />
      <input name="segu1" type="hidden" id="segu1" value="<?php 
        echo $segu;
        ?>
" />
      <input name="bandera" type="hidden" id="numPaciente22" value="<?php 
        echo $bandera;
        ?>
" />
</p>
</form>
  <p></p>
  
  <table width="86%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <th width="15%" scope="col">&nbsp;</th>
      <th width="2%" 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">&nbsp;</th>
      <th width="14%" scope="col"><table width="94" border="0" align="right">
          <tr>
            <td width="172">&nbsp;</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>
    </tr>
  </table>
  <p align="center">&nbsp;</p>
  
</body>
</html>
<?php 
    }
Пример #19
0
    public function consultarPrecios($almacen, $entidad, $basedatos)
    {
        ?>

<?php 
        $articulo = $_POST['nomArticulo'];
        ?>

<?php 
        if ($_GET['codigo'] and $_GET['inactiva']) {
            if ($_GET['inactiva'] == "inactiva") {
                $q = "UPDATE articulos set \r\n\r\n\t\tactivo='I'\r\n\t\tWHERE entidad='" . $entidad . "' AND\r\n\t\talmacen='" . $_GET['codigo'] . "'";
                mysql_db_query($basedatos, $q);
                echo mysql_error();
            } else {
                $q = "UPDATE articulos set \r\n\r\n\t\tactivo='A'\r\n\t\tWHERE entidad='" . $entidad . "' AND\r\n\t\tcodigo='" . $_GET['codigo'] . "'";
                mysql_db_query($basedatos, $q);
                echo mysql_error();
            }
        }
        ?>
<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana","width=350,height=189,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria2 (URL){ 
   window.open(URL,"ventana2","width=350,height=170,scrollbars=YES") 
} 
</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">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<?php 
        $estilos = new muestraEstilos();
        $estilos->styles();
        ?>
</head>

<body>
    <div class="page_right">
<h1 align="center">M&eacute;dicos Precios x Departamento </h1>
<form id="form2" name="form2" method="post" action="">
  <div align="center">
    <table width="600" class="table-template-left">
    <!--<table width="600" class="table-forma">-->
      <?php 
        if (verificaCargoTotal::verificaCT($seguro, $basedatos)) {
            ?>
      <?php 
        }
        ?>
      <tr >
        <td  scope="col">&nbsp;</td>
        <td  scope="col"><div align="left" >Todos</div></td>
        <td  scope="col"><div align="left">
          <input name="todos" type="checkbox" id="todos" value="si" <?php 
        if ($_POST['todos'] == 'si') {
            echo 'checked=""';
        }
        ?>
 />
        </div></td>
        <td  scope="col"><input name="Submit" type="submit"  value="Mostrar" /></td>
      </tr>
      <tr >
        <td width="31"  scope="col"><label></label></td>
        <td width="103"  scope="col"><div align="left">Departamento</div></td>
        <td width="347"  scope="col"><div align="left">
          <?php 
        require CONSTANT_PATH_CONFIGURACION . "/componentes/comboAlmacen.php";
        $comboAlmacen = new comboAlmacen();
        $comboAlmacen->despliegaAlmacen($entidad, 'style7', $almacenSolicitante, $almacenDestino, $basedatos);
        ?>
        </div></td>
        <td width="104"  scope="col">&nbsp;</td>
      </tr>
    </table>

<label></label>
  </div>
  <p>&nbsp;</p>
</form>
<p align="center" class="style14">
  <?php 
        if ($_POST['almacenDestino']) {
            $articulo = '*';
            if ($articulo === '*' and !$_POST['todos']) {
                $sSQL = "\r\nselect articulosPrecioNivel.codigo,articulosPrecioNivel.keyAPN,almacenes.almacenPadre,almacenes.almacen,almacenes.descripcion, articulosPrecioNivel.nivel1,articulosPrecioNivel.nivel3 \r\nfrom almacenes,articulosPrecioNivel where almacenes.medico='si'\r\nand\r\nalmacenes.almacen=articulosPrecioNivel.almacen\r\nand\r\nalmacenes.almacenPadre='" . $_POST['almacenDestino'] . "' \r\ngroup by almacenes.descripcion ASC\r\n";
            } else {
                $sSQL = " select * from almacenes\r\nwhere\r\nalmacenPadre='" . $_POST['almacenDestino'] . "' \r\nand\r\nmedico='si'\r\n";
            }
            if ($result = mysql_db_query($basedatos, $sSQL)) {
                echo mysql_error();
                ?>
</p>
      <form id="form1" name="form1" method="post" action="modificaA.php">
  <p align="center">&nbsp;</p>

  <table width="600" class="table table-striped">
    <tr>
      <th width="69"  scope="col"><div align="left"><span >C&oacute;digo</span></div></th>
      <th width="321"  scope="col"><div align="left"><span >Mini Almac&eacute;n  (M&eacute;dico)</span></div></th>
      <th width="74"  scope="col"><div align="left"><span >Part.</span></div></th>
      <th width="68"  scope="col"><div align="left"><span >Aseg.</span></div></th>
      <th width="41"  scope="col"><div align="left"><span >Editar</span></div></th>
    </tr>
    <tr>

<?php 
                while ($myrow = mysql_fetch_array($result)) {
                    $totalRegistros += 1;
                    $sSQL5 = "SELECT *\r\nFROM\r\n  `precioArticulos`\r\nWHERE entidad='" . $entidad . "' AND\r\ncodigo = '" . $code . "'  \r\n  ";
                    $result5 = mysql_db_query($basedatos, $sSQL5);
                    $myrow5 = mysql_fetch_array($result5);
                    $sSQL52 = "SELECT count(*) as totalRegedit\r\nFROM\r\nexistencias\r\nWHERE entidad='" . $entidad . "' AND\r\ncodigo = '" . $code . "'  \r\n  ";
                    $result52 = mysql_db_query($basedatos, $sSQL52);
                    $myrow52 = mysql_fetch_array($result52);
                    $i = $myrow52['totalRegedit'];
                    $sSQL51 = "SELECT *\r\nFROM\r\nexistencias\r\nWHERE entidad='" . $entidad . "' AND\r\ncodigo = '" . $code . "'  \r\n  ";
                    $result51 = mysql_db_query($basedatos, $sSQL51);
                    $myrow51 = mysql_fetch_array($result51);
                    $bali = $myrow51['almacen'];
                    $sSQL6 = "SELECT *\r\nFROM\r\narticulosPrecioNivel\r\nWHERE entidad='" . $entidad . "' \r\nAND\r\nalmacen='" . $myrow['almacen'] . "'\r\n\r\n  ";
                    $result6 = mysql_db_query($basedatos, $sSQL6);
                    $myrow6 = mysql_fetch_array($result6);
                    $C = $codigo = $code = $myrow6['codigo'];
                    if ($col) {
                        $color = '#FFFF99';
                        $col = "";
                    } else {
                        $color = '#FFFFFF';
                        $col = 1;
                    }
                    $Cd = $myrow['almacen'];
                    $sSQL7 = "SELECT *\r\nFROM\r\narticulos\r\nWHERE entidad='" . $entidad . "' AND\r\ncodigo = '" . $code . "' \r\n  ";
                    $result7 = mysql_db_query($basedatos, $sSQL7);
                    $myrow7 = mysql_fetch_array($result7);
                    ?>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" height="24" ><span >
        <label><?php 
                    echo $Cd;
                    ?>
</label>
      </span></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" ><span ><?php 
                    echo $myrow['descripcion'];
                    ?>
 
        <?php 
                    if (!$bali) {
                        echo '<img src="' . CONSTANT_PATH_SIMA_RAIZ . '/imagenes/stop.png" alt="NO TIENE ASIGNADO NINGUN PRECIO O ALMACEN" width="13" height="13" border="0" />';
                    }
                    ?>
	  
	  	<?php 
                    if ($myrow['generico'] == 'si') {
                        ?>
					<blink>
		<img src="../imagenes/g.jpg" alt="MEDICAMENTO GENERICO..." width="12" height="12" border="0" />		</blink>
		<?php 
                    } else {
                        echo '';
                    }
                    ?>
	  </span></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" >
	   
	  <?php 
                    if ($myrow6['nivel1']) {
                        echo "\$" . number_format($myrow6['nivel1'], 2);
                    } else {
                        echo '...';
                    }
                    ?>
      </td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" ><span >
        <?php 
                    if ($myrow6['nivel3']) {
                        echo "\$" . number_format($myrow6['nivel3'], 2);
                    } else {
                        echo '...';
                    }
                    ?>
      </span></td>
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" >
	  
	  <a 
	   onmouseover="Tip('<div class=&quot;estilo25&quot;><?php 
                    echo '' . $myrow['descripcion'];
                    ?>
</div>')" onMouseOut="UnTip()"
	  href="javascript:ventanaSecundaria2('../ventanas/cambiarMedicos.php?nRequisicion=<?php 
                    echo $requisicion;
                    ?>
&amp;almacenPadre=
		<?php 
                    echo $myrow['almacenPadre'];
                    ?>
&amp;keyAPN=<?php 
                    echo $myrow['keyAPN'];
                    ?>
&amp;codigo=<?php 
                    echo $C;
                    ?>
&amp;almacen=<?php 
                    echo $Cd;
                    ?>
&keyPA=<?php 
                    echo $myrow['keyPA'];
                    ?>
')">
		
		<img src="../imagenes/Save.png" alt="Modificar Precios" width="12" height="12" border="0" />
		
		</a></td>
      <?php 
                    if ($UM == 's' or $UM == 'S') {
                        $modifica = 'modificaP.php';
                    } else {
                        $modifica = 'modificaA.php';
                    }
                    ?>
    </tr>
    <?php 
                }
            }
            ?>
  </table>
 
  <p align="center">
    <label></label>
    <input name="bandera" type="hidden" id="bandera" value="<?php 
            echo $totalRegistros;
            ?>
" />
  </p>
</form>
<?php 
            if ($totalRegistros) {
                ?>
<p align="center"><strong><em>Se encontraron  <?php 
                echo $totalRegistros;
                ?>
 registros</em></strong></p>
<?php 
            }
        }
        ?>
<p>&nbsp;</p>
    </div>
</body>
</html>
<?php 
    }
    public function catalogosServicios($entidad, $almacenSolicitante, $usuario, $fecha1, $basedatos)
    {
        ?>


<?php 
        $sSQL2a1 = "Select * From modulosGrupos WHERE  clasificacion='HONMED'  ";
        $result2a1 = mysql_db_query($basedatos, $sSQL2a1);
        $myrow2a1 = mysql_fetch_array($result2a1);
        if ($myrow2a1['clasificacion'] == 'HONMED') {
            $_GET['gpoProducto'] = $myrow2a1['gpoProducto'];
        } else {
            ?>
<script>
window.alert("Oops! hay un problema de configuracion");
window.close();
</script>
<?php 
        }
        ?>

<script language=javascript> 
function ventanaSecundaria2 (URL){ 
   window.open(URL,"ventana2","width=300,height=600,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana1","width=630,height=700,scrollbars=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.descripcion.value) == false ) {   
                alert("Por Favor, escribe una breve descripci�n del art�culo!")   
                return false   
        } else if( vacio(F.gpoProducto.value) == false ) {   
                alert("Por Favor, escribe el grupo de producto que deseas anexar!")   
                return false   
         
        } 
           
}   
 
</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."
		alert("S�lo Se aceptan N�meros!")
        return false
    }
    status = ""
    return true
}
</SCRIPT>


<?php 
        $fecha1 = date("Y-m-d");
        if (!$_GET['generico']) {
            $_GET['generico'] = 'no';
        }
        if (!$_GET['paquete']) {
            $_GET['paquete'] = 'no';
        }
        if ($_GET['nuevo']) {
            $_GET['keyPA'] = NULL;
        } else {
            $_GET['nuevo'] = NULL;
        }
        if ($_GET['actualizar'] and $_GET['descripcion']) {
            if ($_GET['keyPA']) {
                $sSQL1 = "Select * From articulos WHERE  keyPA = '" . $_GET['keyPA'] . "'  ";
                $result1 = mysql_db_query($basedatos, $sSQL1);
                $myrow1 = mysql_fetch_array($result1);
                echo mysql_error();
            } else {
                $sSQL1 = "Select * From articulos WHERE  usuario='" . $usuario . "' and random='" . $_GET['random'] . "'";
                $result1 = mysql_db_query($basedatos, $sSQL1);
                $myrow1 = mysql_fetch_array($result1);
            }
            if (!$myrow1['keyPA'] and !$_GET['keyPA']) {
                $sSQL122 = "SELECT \r\nmax(codigo)+1 as ultimoDigito\r\nFROM\r\narticulos\r\nwhere \r\nentidad='" . $entidad . "'\r\n";
                $result122 = mysql_db_query($basedatos, $sSQL122);
                $myrow122 = mysql_fetch_array($result122);
                $agrega = "INSERT INTO articulos (\r\ncodigo,descripcion,descripcion1,um,gpoProducto,usuario,fecha,cbarra,laboratorio,sustancia,activo,umVentas,ventaPieza,observaciones,cajaCon,hora,entidad,generico,servicio,paquete,random,especialidad,laboratorioReferido,referido,procedimiento) \r\nvalues ('" . $myrow122['ultimoDigito'] . "','" . $_GET['descripcion'] . "','" . $_GET['descripcion1'] . "','" . $_GET['um'] . "','" . $_GET['gpoProducto'] . "',\r\n'" . $usuario . "','" . $fecha1 . "',\r\n'" . $_GET['cbarra'] . "','" . $_GET['laboratorio'] . "','" . $_GET['sustancia'] . "','A','" . $_GET['umVentas'] . "',\r\n'" . $_GET['ventaPieza'] . "','" . $_GET['observaciones'] . "','" . $_GET['cajaCon'] . "','" . $hora1 . "','" . $entidad . "',\r\n'" . $_GET['generico'] . "','no','" . $_GET['paquete'] . "','" . $_GET['random'] . "','" . $_GET['especialidad'] . "','" . $_GET['referido'] . "','" . $_GET['referido'] . "','" . $_GET['procedimiento'] . "')";
                mysql_db_query($basedatos, $agrega);
                echo mysql_error();
                ?>

<script>
window.alert( "ARTICULO <?php 
                echo $_GET['descripcion'];
                ?>
 AGREGADO... ");
</script>
<?php 
            } else {
                $q1 = "UPDATE articulos set \r\n\r\ndescripcion='" . $_GET['descripcion'] . "', \r\ndescripcion1='" . $_GET['descripcion1'] . "', \r\num='" . $_GET['um'] . "', \r\ngpoProducto='" . $_GET['gpoProducto'] . "', \r\ncbarra='" . $_GET['cbarra'] . "',\r\nlaboratorio='" . $_GET['laboratorio'] . "',\r\nsustancia='" . $_GET['sustancia'] . "',\r\numVentas='" . $_GET['umVentas'] . "',\r\nfechaActualizacion='" . $fecha1 . "',\r\nventaPieza='" . $_GET['ventaPieza'] . "',\r\nobservaciones='" . $_GET['observaciones'] . "',\r\ncajaCon='" . $_GET['cajaCon'] . "',\r\nhora='" . $hora1 . "',\r\nusuario='" . $usuario . "',\r\nentidad='" . $entidad . "',\r\ngenerico='" . $_GET['generico'] . "',\r\npaquete='" . $_GET['paquete'] . "',\r\nespecialidad='" . $_GET['especialidad'] . "',\r\nreferido='" . $_GET['referido'] . "',\r\nlaboratorioReferido='" . $_GET['referido'] . "',\r\nprocedimiento='" . $_GET['procedimiento'] . "'\r\nWHERE keyPA='" . $_GET['keyPA'] . "'";
                mysql_db_query($basedatos, $q1);
                echo mysql_error();
                ?>
<script>
window.alert("ARTICULO ACTUALIZADO");
</script>

<?php 
                //echo 'Articulo actualizado';
            }
        }
        if ($_GET['borrar'] and $_GET['codigo']) {
            $agrega = "INSERT INTO articulosHistoria (\r\ncodigo,descripcion,descripcion1,um,gpoProducto,usuario,fecha,cbarra,laboratorio,sustancia,activo,umVentas,ventaPieza,observaciones,cajaCon,hora,entidad,generico,tipoTransaccion) \r\nvalues ('" . $_GET['codigo'] . "','" . $_GET['descripcion'] . "','" . $_GET['descripcion1'] . "','" . $_GET['um'] . "','" . $_GET['gpoProducto'] . "',\r\n\r\n'" . $usuario . "','" . $fecha1 . "',\r\n'" . $_GET['cbarra'] . "','" . $_GET['laboratorio'] . "','" . $_GET['sustancia'] . "','A','" . $_GET['umVentas'] . "',\r\n'" . $_GET['ventaPieza'] . "','" . $_GET['observaciones'] . "','" . $_GET['cajaCon'] . "','" . $hora1 . "','" . $entidad . "',\r\n'" . $_GET['generico'] . "','borrar')";
            mysql_db_query($basedatos, $agrega);
            echo mysql_error();
            $q1 = "UPDATE articulos set \r\nactivo='cancelado'\r\n\r\nWHERE entidad='" . $entidad . "' AND keyPA='" . $_GET['keyPA'] . "'";
            mysql_db_query($basedatos, $q1);
            echo mysql_error();
            echo 'Se elimino el articulo';
            echo '<script type="text/vbscript">
msgbox "SE ELIMINO EL ARTICULO"
</script>';
        }
        if ($_GET['keyPA']) {
            $r = NULL;
            $sSQL = "Select * From articulos WHERE  keyPA = '" . $_GET['keyPA'] . "' or keyPA='" . $myrow['keyPA'] . "' ";
            $result = mysql_db_query($basedatos, $sSQL);
            $myrow = mysql_fetch_array($result);
        } else {
            if ($_GET['random']) {
                $r = NULL;
                $sSQL = "Select * From articulos WHERE  usuario='" . $usuario . "' and random='" . $_GET['random'] . "'";
                $result = mysql_db_query($basedatos, $sSQL);
                $myrow = mysql_fetch_array($result);
            } else {
                $r = 'disabled=""';
            }
        }
        ?>


</h1>
<?php 
        $estilos = new muestraEstilos();
        $estilos->styles();
        ?>
<div class="page_right">
<form id="form1" name="form1" method="GET" action=""/>
<p align="center" >Catalogo de Honorarios Medicos</p>

<!--<table width="630" class="table-forma">-->
<table width="630" class="table-template-left">
    <tr>
      <td width="3" scope="col">&nbsp;</td>
      <td width="227" >
        <label>
        
        <div align="left" >Descripci&oacute;n</div>
        <span >
        </label>
      </span></td>
      <td width="386" ><label>
        <div align="left">
<textarea name="descripcion" cols="57" rows="3"  id="descripcion"><?php 
        echo $descripcion = $myrow['descripcion'];
        ?>
</textarea>
        </div>
      </label></td>
    </tr>
    <tr>
      <td scope="col">&nbsp;</td>
      <td ><div align="left" >Descripci&oacute;n (Impresi&oacute;n en Factura):</div></td>
      <td ><label>
        <input name="descripcion1" type="text"  id="descripcion1" value="<?php 
        echo $descripcion = $myrow['descripcion1'];
        ?>
" size="60" />
      </label></td>
    </tr>
	<tr>
	  <td scope="col">&nbsp;</td>
	  <td ><span >&iquest;Es un paquete? </span></td>
	  <td >   <input name="paquete" type="checkbox" id="referido" value="si"
		<?php 
        if ($myrow['paquete'] == 'si') {
            echo 'checked="checked"';
        }
        ?>
/>	 </td>
    </tr>
	<tr>
	  <td scope="col">&nbsp;</td>
	  <td ><span >Especialidad </span></td>
	  <td >
	  
	  
<?php 
        require_once CONSTANT_PATH_CONFIGURACION . '/componentes/comboEspecialidades.php';
        $listaEsp = new especialidades();
        $listaEsp->listaEspecialidadesMedicasSS($entidad, 'style12', $myrow['especialidad'], $myrow['especialidad'], $basedatos);
        ?>
	  </td>
    </tr>
	<tr>
	  <td scope="col">&nbsp;</td>
	  <td  >Procedimiento</td>
	  <td ><input name="procedimiento" type="checkbox" id="procedimiento" value="si"
		<?php 
        if ($myrow['procedimiento'] == 'si') {
            echo 'checked="checked"';
        }
        ?>
 /></td>
  </tr>
	<tr>
	  <td scope="col">&nbsp;</td>
	  <td  >Referido</span></td>
	  <td >
	  	    <input name="referido" type="checkbox" id="referido" value="si"
		<?php 
        if ($myrow['laboratorioReferido'] == 'si') {
            echo 'checked="checked"';
        }
        ?>
 />
	  &nbsp;</td>
    </tr>
	<tr>
	  <td width="3" scope="col">&nbsp;</td>

      <td  >Agregar Precios - Almacen</span></td>
      <td >
 

    <label>
    
    <a href="javascript:ventanaSecundaria('<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/cargos/listaAlmacenesTodos.php?codigo=<?php 
        echo $myrow['codigo'];
        ?>
&keyPA=<?php 
        echo $myrow['keyPA'];
        ?>
&amp;seguro=<?php 
        echo $_GET['seguro'];
        ?>
&amp;medico=<?php 
        echo $_GET['medico'];
        ?>
&amp;usuario=<?php 
        echo $usuario;
        ?>
&activar=si')"><img src="../imagenes/Save.png" alt="Almacenes" width="20" height="20" border="0" />          </a>          </label></td>
    </tr>
   



</table><br />
        <input name="nuevo" type="submit"  id="nuevo" value="Nuevo" <?php 
        echo $r;
        ?>
 />
        <input name="borrar" type="submit"  id="borrar" value="Borrar" />
        
        <input name="random" type="hidden"  id="random" value="<?php 
        echo rand(50000, 5000000);
        ?>
" />
          <input name="keyPA" type="hidden"  id="borrar2" value="<?php 
        echo $myrow['keyPA'];
        ?>
" />
        <input name="actualizar" type="submit"  id="actualizar" value="Actualizar/Grabar" />
        <br /><br />

        <input name="main" type="hidden" class="boton1" id="nuevo" value="<?php 
        echo $_GET['main'];
        ?>
"  />
        <input name="warehouse" type="hidden" class="boton1" id="nuevo" value="<?php 
        echo $_GET['warehouse'];
        ?>
"  />
</form>
<div align="center"><a href="listadoProcedimientos.php">Regresar a Listado de Servicios </a>
</div>
</div>
</body>
</html>

<?php 
    }
Пример #21
0
    public function eCCI($usuario, $entidad, $folioVenta, $basedatos)
    {
        $cargosCia = new acumulados();
        //**********************************CANDADO PRINCIPAL**********************
        /* $bali=$almacen;
        $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 From transacciones WHERE entidad='".$entidad."' and folioVenta ='".$_GET['folioVenta']."' ";
        $result1=mysql_db_query($basedatos,$sSQL1);
        $myrow1 = mysql_fetch_array($result1);
        echo mysql_error();
        
        
        
        if($myrow1['folioVenta'] AND $myrow1['usuario']!=$usuario){ ?>
        <script>
        window.alert("Este proceso est� siendo utilizado por: (<?php echo $myrow1['usuario'];?>) y s�lo el puede terminar este proceso");
        window.close();
        </script>
        <?php 
        } else if(!$myrow1['folioVenta']){
        $agrega = "INSERT INTO transacciones (
        folioVenta,usuario,fecha,hora,keyCatC,entidad) 
        values ('".$_GET['folioVenta']."','".$usuario."','".$fecha1."','".$hora1."','".$myrowC['keyCatC']."' ,'".$entidad."'  ) ";
        mysql_db_query($basedatos,$agrega);
        echo mysql_error();
        } */
        //************************************CANDADO DE USUARIO
        ?>






<?php 
        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'\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\nentidad='" . $entidad . "'\r\nand\r\ncodigoCuarto='" . $myrow3['cuarto'] . "' \r\n";
                //mysql_db_query($basedatos,$agregad);
                echo mysql_error();
            }
            $leyenda = 'Se cerr� la cuenta';
            $sSQL3 = "Select * From clientesInternos WHERE entidad='" . $entidad . "' and 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 
            }
        }
        ?>



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

<?php 
        if ($_POST['imprimir']) {
            if ($_GET['paquete'] == 'si') {
                ?>
<script language="javascript">
nueva('<?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'];
                ?>
&fechaSolicitud=<?php 
                print $_POST['variable_php'];
                ?>
','ventana7','800','600','yes');
//window.opener.document.form10["form10"].submit();
//window.alert("sandra");
window.close();
</script>
<?php 
            } else {
                ?>
<script>
nueva('<?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;
                ?>
&fechaSolicitud=<?php 
                print $_POST['variable_php'];
                ?>
','ventana7','800','600','yes');
//window.opener.document.form10["form"].submit();

window.close();
</script>
<?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...";
            ?>
    <input name="print" type="button" class="normal" id="print" value="Imprimir EC" onClick="ventanaSecundaria7('<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/INGRESOS HLC/caja/imprimirEstadoCuenta.php?numeroE=<?php 
            echo $myrow['numeroE'];
            ?>
&amp;nCuenta=<?php 
            echo $myrow['nCuenta'];
            ?>
&amp;almacen=<?php 
            echo $ALMACEN;
            ?>
&amp;almacenFuente=<?php 
            echo $ALMACEN;
            ?>
&amp;keyClientesInternos=<?php 
            echo $myrow3['keyClientesInternos'];
            ?>
&amp;tipoCliente=<?php 
            echo $tipoCliente;
            ?>
&amp;tipoMovimiento=<?php 
            echo 'cierreCuenta';
            ?>
&amp;tipoPaciente=interno&folioVenta=<?php 
            echo $myrow3['folioVenta'];
            ?>
');">

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




<title></title>
<?php 
            $link = new ventanasPrototype();
            $link->links();
            $estilo = new muestraEstilos();
            $estilo->styles();
            ?>
    <?php 
            include CONSTANT_PATH_CONFIGURACION . '/clases/encabezado.php';
            ?>

  <?php 
            include CONSTANT_PATH_CONFIGURACION . '/clases/mostrarDatosCuenta.php';
            ?>
  <?php 
            include CONSTANT_PATH_CONFIGURACION . '/clases/mostrarEfectuarTransacciones.php';
            ?>
</html>

<?php 
        }
    }
Пример #22
0
    public function foliosDevolucion($entidad, $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 ventanaSecundaria1 (URL){ 
   window.open(URL,"ventanaSecundaria1","width=800,height=600,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script> 

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


<script type="text/javascript">
<!--
function comprueba()
{
if (confirm('Estas seguro que deseas enviar la cuenta de este paciente a admisiones? ya no podras hacer cargos, y la operaci�n es irreversible')) return true;
return false;
}
-->
</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" />
<?php 
        $estilos = new muestraEstilos();
        $estilos->styles();
        ?>

</head>

<body>
<form id="form1" name="form1" method="post" >
  <h1 align="center" class="titulos">Devoluciones Pacientes Internos (Ctas. Cerradas)</h1>
  <p align="center" class="titulos">
    <label>Introduce el folio de Venta
    <input name="folioVenta" type="text" id="folioVenta" size="10" />
    </label>
    <label>
    <input type="submit" name="buscar" id="buscar" value="Buscar" />
    </label>
</p>
 <?php 
        if ($_POST['folioVenta']) {
            ?>
  <p align="center" class="titulos"><?php 
            print 'Folio: ' . $_POST['folioVenta'];
            ?>
</p>
  <span class="style12"></span>
  
  

  <table width="598" border="0.2" align="center" cellpadding="4" cellspacing="0">
    <tr bgcolor="#FFFF00">

      <th class="style12" scope="col"><div align="left" class="normal">
        <div align="left">Nombre del paciente</span></div>
      </div></th>
      <th class="style12" scope="col"><div align="left" class="normal">
        <div align="left">Seguro</div>
      </div></th>
      <th class="style12" scope="col"><div align="center" class="normal">
        <div align="left">Usuario</div>
      </div></th>
      <th class="style12" scope="col"><div align="center" class="normal">
        <div align="left">Cargar</div>
      </div></th>
    </tr>
    <tr>
<?php 
            $sSQL = "SELECT *\r\nFROM\r\nclientesInternos \r\nWHERE \r\nentidad='" . $entidad . "'\r\nand\r\nfolioVenta='" . $_POST['folioVenta'] . "'\r\nand\r\n(tipoPaciente='interno' or tipoPaciente='urgencias')\r\nand\r\nstatusCuenta='cerrada'\r\n";
            if ($result = mysql_db_query($basedatos, $sSQL)) {
                while ($myrow = mysql_fetch_array($result)) {
                    $sSQL31 = "SELECT * FROM\r\nclientesInternos\r\nWHERE \r\nkeyClientesInternos='" . $myrow['keyClientesInternos'] . "'";
                    $result31 = mysql_db_query($basedatos, $sSQL31);
                    $myrow31 = mysql_fetch_array($result31);
                    $sSQL31c = "SELECT keyCAP FROM\r\ncargosCuentaPaciente\r\nWHERE \r\nkeyClientesInternos='" . $myrow['keyClientesInternos'] . "'\r\nand\r\nstatusCargo!='cargado'\r\n";
                    $result31c = mysql_db_query($basedatos, $sSQL31c);
                    $myrow31c = mysql_fetch_array($result31c);
                    $sSQL31cd = "SELECT \r\nnomCliente\r\nFROM\r\nclientes\r\nWHERE \r\nentidad='" . $entidad . "'\r\nand\r\nnumCliente='" . $myrow['seguro'] . "' \r\n";
                    $result31cd = mysql_db_query($basedatos, $sSQL31cd);
                    $myrow31cd = mysql_fetch_array($result31cd);
                    ?>



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

	  <?php 
                    echo $myrow['paciente'];
                    if ($myrow31['folioDevolucion'] != NULL) {
                        echo '<br>';
                        echo '<span class="informativo">Folio Devolucion: ' . $myrow31['folioDevolucion'] . '</span>';
                        echo '<br>';
                    }
                    if ($myrow['status'] == 'ontransfer') {
                        echo '   [Se solicito la transferencia de este paciente]';
                    }
                    ?>
      </span></td>
      <td width="205" bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal"><?php 
                    if ($myrow31cd['nomCliente']) {
                        echo $myrow31cd['nomCliente'];
                    } else {
                        echo 'particular';
                    }
                    ?>
</td>
      <td width="70" bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal"><?php 
                    echo $myrow['usuario'];
                    ?>
</td>
      <td width="70" bgcolor="<?php 
                    echo $color;
                    ?>
" class="normal"><div align="left">


<?php 
                    if ($myrow['statusCaja'] == 'pagado' and $myrow['statusCargoDevolucion'] == '') {
                        ?>
      <a href="#" onClick="javascript:ventanaSecundaria1('<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/cargos/aplicarDevolucionesInternos.php?numeroE=<?php 
                        echo $myrow['numeroE'];
                        ?>
&amp;nCuenta=<?php 
                        echo $myrow['nCuenta'];
                        ?>
&amp;almacen=<?php 
                        echo $ALMACEN;
                        ?>
&amp;almacenFuente=<?php 
                        echo $ALMACEN;
                        ?>
&amp;nT=<?php 
                        echo $nT;
                        ?>
&amp;tipoCliente=<?php 
                        echo $tipoCliente;
                        ?>
&amp;tipoMovimiento=<?php 
                        echo 'cierreCuenta';
                        ?>
&amp;tipoPaciente=interno&amp;folioVenta=<?php 
                        echo $myrow['folioVenta'];
                        ?>
')">
        <img src="<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/imagenes/btns/addbtn.png" alt="Pacientes Activos" width="22" height="22" border="0" />        </a>
        <?php 
                    } else {
                        print 'aplicado';
                    }
                    ?>
		
      </div></td>
    </tr>
    <?php 
                }
            }
        }
        ?>
    <input name="nombres" type="hidden" value="<?php 
        echo $nombrePaciente;
        ?>
" />
  </table>
  <span class="style12"><span class="style7">
  <input name="nombrePaciente" type="hidden" id="nombrePaciente" value="<?php 
        echo $nombrePaciente;
        ?>
" />
  <input name="nombrePaciente2" type="hidden" id="nombrePaciente2" value="<?php 
        echo $nombrePaciente;
        ?>
"/>
  <input name="tipoSeguro" type="hidden" id="tipoSeguro" value="<?php 
        echo $myrow['seguro'];
        ?>
"/>
  </span></span>

</form>
</body>
</html>
<?php 
    }
Пример #23
0
    public function estadoCuenta($entidad, $basedatos)
    {
        ?>
<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana1","width=700,height=600,scrollbars=YES") 
} 
</script> 

<script language=javascript>
function ventanaSecundaria3 (URL){ 
   window.open(URL,"ventana3","width=400,height=400,scrollbars=YES") 
} 
</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.medico.value) == false ) {   
                alert("Por Favor, escoje un m�dico que va a atender a este paciente!")   
                return false   
        } else if( vacio(F.paciente.value) == false ) {   
                alert("Por Favor, escribe el nombre del paciente!")   
                return false   
        } else if( vacio(F.seguro.value) == false ) {   
                alert("Por Favor, escoje alg�n tipo de seguro, o tambi�n si es particular!")   
                return false   
        }            
}   
</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" />

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

</head>

<body>
    <div class="page_right">
 <h1 align="center" >Estado de Cuenta de Aseguradoras </h1>
 <p>
   <label></label>
 </p>
 <form id="form1" name="form1" method="post" action="">

   <p>&nbsp;</p>
   <!--<table width="691" class="table table-striped">-->
   <table width="691" class="table-template-left">


     <tr >
       <th width="39"  align="center">#  </th>
       <th width="327" >Descripcion</th>
       <th width="111" align="center" >Global</th>
       
       <th width="115" align="center" >Detalles</th>
     
     </tr>
	 
 <?php 
        $sSQL = "Select numCliente,nomCliente From clientes\r\n where entidad='" . $entidad . "' AND clientePrincipal='' and\r\n subCliente=''\r\n and\r\n tipoCliente='compania'\r\n  order by nomCliente ASC";
        $result = mysql_db_query($basedatos, $sSQL);
        while ($myrow = mysql_fetch_array($result)) {
            if ($col) {
                $color = '#FFCCFF';
                $col = "";
            } else {
                $color = '#FFFFFF';
                $col = 1;
            }
            $N = $myrow['numCliente'];
            $keyCAP = $myrow['keyCAP'];
            $bandera += 1;
            $gpoProducto = $myrow['gpoProducto'];
            $codigo = $myrow['codProcedimiento'];
            //traigo descuento
            //cierro descuento
            if ($col) {
                $color = '#FFCCFF';
                $col = '';
            } else {
                $color = '#FFFFFF';
                $col = 1;
            }
            if ($myrow['status'] == 'cancelado') {
                $color = '#FF0000';
                $col = "";
            }
            ?>
     <tr >
       <td   align="center"><?php 
            echo $bandera;
            ?>
</td>
       <td ><?php 
            echo $myrow['nomCliente'];
            ?>
</td>
       <td  align="center">
	   <a href="#" onClick="javascript:ventanaSecundaria('../../cargos/verSaldos.php?numeroE=<?php 
            echo $myrow['numeroE'];
            ?>
		&amp;nCuenta=<?php 
            echo $myrow['nCuenta'];
            ?>
&amp;almacen=<?php 
            echo $bali;
            ?>
&amp;seguro=<?php 
            echo $N;
            ?>
&amp;numCliente=<?php 
            echo $N;
            ?>
')">
	   Ver	   </a>	   </td>
       <td  align="center">
	      <a href="#" onClick="javascript:ventanaSecundaria('../../cargos/detallesClientes.php?numeroE=<?php 
            echo $myrow['numeroE'];
            ?>
		&amp;nCuenta=<?php 
            echo $myrow['nCuenta'];
            ?>
&amp;almacen=<?php 
            echo $bali;
            ?>
&amp;seguro=<?php 
            echo $N;
            ?>
&amp;numCliente=<?php 
            echo $N;
            ?>
&nombreCliente=<?php 
            echo $myrow['nomCliente'];
            ?>
')">
	   Ver 
	   </a>
	   </td>

       
     </tr>
     <?php 
        }
        ?>

   </table>
   <p>&nbsp;</p>
 </form>
 <p align="center">&nbsp;</p>
    </div>
</body>
</html>
<?php 
    }
    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>';
        }
    }
Пример #25
0
    public function catalogoArticulos($entidad, $usuario, $codigo, $fecha1, $basedatos)
    {
        ?>


<?php 
        $sSQL2a1 = "Select * From modulosGrupos WHERE  clasificacion='MAT'  ";
        $result2a1 = mysql_db_query($basedatos, $sSQL2a1);
        $myrow2a1 = mysql_fetch_array($result2a1);
        if ($myrow2a1['clasificacion'] == 'MAT') {
            $_GET['gpoProducto'] = $myrow2a1['gpoProducto'];
        } else {
            ?>
<script>
window.alert("Oops! hay un problema de configuracion");
window.close();
</script>
<?php 
        }
        ?>

<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana1","width=630,height=700,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria3 (URL){ 
   window.open(URL,"ventana3","width=600,height=300,scrollbars=YES") 
} 
</script>

<script language=javascript> 
function ventanaSecundaria4 (URL){ 
   window.open(URL,"ventana4","width=600,height=300,scrollbars=YES") 
} 
</script>

<script language=javascript> 
function ventanaSecundaria2 (URL){ 
   window.open(URL,"ventana2","width=300,height=600,scrollbars=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.descripcion.value) == false ) {   
                alert("Por Favor, escribe una breve descripci�n del art�culo!")   
                return false   
        } else if( vacio(F.gpoProducto.value) == false ) {   
                alert("Por Favor, escribe el grupo de producto que deseas anexar!")   
                return false   
        } else if( vacio(F.costo.value) == false ) {   
                alert("Por Favor, escoje el costo!")   
                return false   
        } else if( vacio(F.pmax.value) == false ) {   
                alert("Por Favor, escoje el m�ximo!")   
                return false   
        } else if( vacio(F.reorden.value) == false ) {   
                alert("Por Favor, escoje el punto de reorden!")   
                return false   
        } else if( vacio(F.pmin.value) == false ) {   
                alert("Por Favor, escoje el m�nimo!")   
                return false   
        } else if( vacio(F.precioEfectivo.value) == false ) {   
                alert("Por Favor, escoje el precio efectivo venta al p�blico!")   
                return false   
        } else if( vacio(F.precioCredito.value) == false ) {   
                alert("Por Favor, escoje el precio Credito venta al p�blico!")   
                return false   
         }  
}   
 
</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>
<?php 
        $fecha1 = date("Y-m-d");
        if (!$_GET['generico']) {
            $_GET['generico'] = 'no';
        }
        if (!$_GET['paquete']) {
            $_GET['paquete'] = 'no';
        }
        if ($_GET['nuevo']) {
            $_GET['keyPA'] = NULL;
        } else {
            $_GET['nuevo'] = NULL;
        }
        if ($_GET['actualizar'] and $_GET['descripcion']) {
            if ($_GET['keyPA']) {
                $sSQL1 = "Select * From articulos WHERE  keyPA = '" . $_GET['keyPA'] . "'  ";
                $result1 = mysql_db_query($basedatos, $sSQL1);
                $myrow1 = mysql_fetch_array($result1);
                echo mysql_error();
            } else {
                $sSQL1 = "Select * From articulos WHERE  usuario='" . $usuario . "' and random='" . $_GET['random'] . "'";
                $result1 = mysql_db_query($basedatos, $sSQL1);
                $myrow1 = mysql_fetch_array($result1);
            }
            if (!$myrow1['keyPA'] and !$_GET['keyPA']) {
                $sSQL122 = "SELECT \r\nmax(codigo)+1 as ultimoDigito\r\nFROM\r\narticulos\r\nwhere entidad='" . $entidad . "'\r\n";
                $result122 = mysql_db_query($basedatos, $sSQL122);
                $myrow122 = mysql_fetch_array($result122);
                $agrega = "INSERT INTO articulos (\r\ncodigo,descripcion,descripcion1,um,gpoProducto,\r\nusuario,fecha,cbarra,laboratorio,sustancia,activo,umVentas,\r\nventaPieza,observaciones,cajaCon,hora,entidad,generico,servicio,paquete,random,\r\ncaducidad,maquilado,grupo) \r\nvalues ('" . $myrow122['ultimoDigito'] . "','" . $_GET['descripcion'] . "','" . $_GET['descripcion1'] . "','" . $_GET['um'] . "','" . $_GET['gpoProducto'] . "',\r\n'" . $usuario . "','" . $fecha1 . "',\r\n'" . $_GET['cbarra'] . "','" . $_GET['laboratorio'] . "','" . $_GET['sustancia'] . "','A','" . $_GET['umVentas'] . "',\r\n'" . $_GET['ventaPieza'] . "','" . $_GET['observaciones'] . "','" . $_GET['cajaCon'] . "','" . $hora1 . "','" . $entidad . "',\r\n'" . $_GET['generico'] . "','no','" . $_GET['paquete'] . "','" . $_GET['random'] . "',\r\n'" . $_GET['caducidad'] . "','" . $_GET['maquilado'] . "','" . $_GET['grupo'] . "' )";
                mysql_db_query($basedatos, $agrega);
                echo mysql_error();
                //******************ASIGNAR ARTICULOS ALMACENES******************
                $sSQL3ab = "Select keyPA From articulos WHERE entidad='" . $entidad . "' and codigo='" . $myrow122['ultimoDigito'] . "'  ";
                $result3ab = mysql_db_query($basedatos, $sSQL3ab);
                $myrow3ab = mysql_fetch_array($result3ab);
                $sSQL3a = "Select almacen From almacenes WHERE entidad='" . $entidad . "' and centroDistribucion='si'  ";
                $result3a = mysql_db_query($basedatos, $sSQL3a);
                $myrow3a = mysql_fetch_array($result3a);
                $q = "insert into articulosPrecioNivel\r\n(\r\ncodigo,precioPaquete1,\r\nprecioPaquete3,\r\nnivel1,\r\nnivel3,\r\nid_medico,\r\nkeyPA,almacen,usuario,fecha,hora,entidad)\r\nvalues\r\n('" . $myrow122['ultimoDigito'] . "','" . $precioPaquete1[$i] . "','" . $precioPaquete3[$i] . "',\r\n    '1','1.10', '" . $id_medico[$i] . "','" . $myrow3ab['keyPA'] . "','" . $myrow3a['almacen'] . "','" . $usuario . "','" . $fecha . "','" . $hora . "','" . $entidad . "')";
                mysql_db_query($basedatos, $q);
                echo mysql_error();
                $agrega = "INSERT INTO existencias (\r\ncodigo,almacen,usuario,hora,fechaA,ID_EJERCICIO,entidad,keyPA,descripcion,tipoVenta,existencia,cantidadTotal,anaquel,cantidadSurtir,cantidadIndividual\r\n) values (\r\n'" . $myrow122['ultimoDigito'] . "',\r\n'" . $myrow3a['almacen'] . "',\r\n'" . $usuario . "',\r\n'" . $hora1 . "',\r\n'" . $fecha1 . "',\r\n'" . $ID_EJERCICIOM . "','" . $entidad . "','" . $myrow3ab['keyPA'] . "','" . $_GET['descripcion'] . "','','','','" . $anaquel[$i] . "','',''\r\n\r\n)";
                mysql_db_query($basedatos, $agrega);
                echo mysql_error();
                //***********************************************************
                ?>

<script>
window.alert( "ARTICULO <?php 
                echo $_GET['descripcion'];
                ?>
 AGREGADO... ");
</script>
<?php 
            } else {
                $q1 = "UPDATE articulos set \r\ngrupo='" . $_GET['grupo'] . "',     \r\n maquilado='" . $_GET['maquilado'] . "',\r\ncaducidad='" . $_GET['caducidad'] . "',\r\ndescripcion='" . $_GET['descripcion'] . "', \r\ndescripcion1='" . $_GET['descripcion1'] . "', \r\num='" . $_GET['um'] . "', \r\ngpoProducto='" . $_GET['gpoProducto'] . "', \r\ncbarra='" . $_GET['cbarra'] . "',\r\nlaboratorio='" . $_GET['laboratorio'] . "',\r\nsustancia='" . $_GET['sustancia'] . "',\r\numVentas='" . $_GET['umVentas'] . "',\r\nfechaActualizacion='" . $fecha1 . "',\r\nventaPieza='" . $_GET['ventaPieza'] . "',\r\nobservaciones='" . $_GET['observaciones'] . "',\r\ncajaCon='" . $_GET['cajaCon'] . "',\r\nhora='" . $hora1 . "',\r\nusuario='" . $usuario . "',\r\nentidad='" . $entidad . "',\r\ngenerico='" . $_GET['generico'] . "',\r\npaquete='" . $_GET['paquete'] . "'\r\nWHERE keyPA='" . $_GET['keyPA'] . "'";
                mysql_db_query($basedatos, $q1);
                echo mysql_error();
                $qas = "UPDATE existencias set \r\ndescripcion='" . $myrow1['descripcion'] . "'\r\nWHERE \r\nkeyPA='" . $_GET['keyPA'] . "'";
                mysql_db_query($basedatos, $qas);
                echo mysql_error();
                ?>
<script>
window.alert("ARTICULO ACTUALIZADO");
</script>

<?php 
                //echo 'Articulo actualizado';
            }
        }
        if ($_GET['borrar'] and $_GET['codigo']) {
            $agrega = "INSERT INTO articulosHistoria (\r\ncodigo,descripcion,descripcion1,um,gpoProducto,usuario,fecha,cbarra,laboratorio,sustancia,activo,umVentas,ventaPieza,observaciones,cajaCon,hora,entidad,generico,tipoTransaccion) \r\nvalues ('" . $_GET['codigo'] . "','" . $_GET['descripcion'] . "','" . $_GET['descripcion1'] . "','" . $_GET['um'] . "','" . $_GET['gpoProducto'] . "',\r\n\r\n'" . $usuario . "','" . $fecha1 . "',\r\n'" . $_GET['cbarra'] . "','" . $_GET['laboratorio'] . "','" . $_GET['sustancia'] . "','A','" . $_GET['umVentas'] . "',\r\n'" . $_GET['ventaPieza'] . "','" . $_GET['observaciones'] . "','" . $_GET['cajaCon'] . "','" . $hora1 . "','" . $entidad . "',\r\n'" . $_GET['generico'] . "','borrar')";
            mysql_db_query($basedatos, $agrega);
            echo mysql_error();
            $q1 = "UPDATE articulos set \r\nactivo='cancelado'\r\n\r\nWHERE entidad='" . $entidad . "' AND keyPA='" . $_GET['keyPA'] . "'";
            mysql_db_query($basedatos, $q1);
            echo mysql_error();
            echo 'Se elimino el articulo';
            echo '<script type="text/vbscript">
msgbox "SE ELIMINO EL ARTICULO"
</script>';
        }
        if ($_GET['keyPA']) {
            $r = NULL;
            $sSQL = "Select * From articulos WHERE  keyPA = '" . $_GET['keyPA'] . "' or keyPA='" . $myrow['keyPA'] . "' ";
            $result = mysql_db_query($basedatos, $sSQL);
            $myrow = mysql_fetch_array($result);
        } else {
            if ($_GET['random']) {
                $r = NULL;
                $sSQL = "Select * From articulos WHERE  usuario='" . $usuario . "' and random='" . $_GET['random'] . "'";
                $result = mysql_db_query($basedatos, $sSQL);
                $myrow = mysql_fetch_array($result);
            } else {
                $r = 'disabled=""';
            }
        }
        ?>

<!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>
<?php 
        $estilos = new muestraEstilos();
        $estilos->styles();
        ?>
</head>

<body>
    <div class="page_right">
<form id="form1" name="form1" method="GET" action="" />
  <div align="center" ><br />
    Alta/Modifica de Materiales<br />
</div>


  <div align="center" >
    <p>
    <!--<table width="348">-->
        <table width="348" class="table-template">
<tr>
         
       
        
    <td width="115" align="right">
      <input name="nuevo"  type="submit" src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/imagenes/bordestablas/btns/newbtn.png" id="nuevo" value="Nuevo" <?php 
        echo $r;
        ?>
 />
     </td>
    <td width="118" align="right"><div align="center"><input name="actualizar"   type="submit" src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/imagenes/bordestablas/btns/refreshbtn.png"  id="actualizar" value="Actualizar/Grabar" />
    </div></td>
    <td width="115" align="right"><div align="center"> <input name="borrar"  type="submit" src='<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/imagenes/bordestablas/btns/deletebtn.png' id="borrar" value="Borrar" /></div></td>
  </tr>

</table>
    </p>
  </div>

  <!--<table width="516" class="table-forma" >-->
  <table width="516" class="table-template-left" >
    <tr >
      <td width="4"  bgcolor="">&nbsp;</td>
      <td width="148" ><label> </label>
          <div align="left" >Descripci&oacute;n:</div>
      <span > </span></td>
      <td width="359" ><?php 
        $descripcion = $myrow['descripcion'];
        ?>
      <textarea name="descripcion" cols="50" rows="3"  id="descripcion"><?php 
        echo $descripcion;
        ?>
</textarea></td>
      <td width="19" ><label> </label>
      <div align="left"></div></td>
    </tr>

      
      
      
      
      
 
              
              
    <tr >
      <td >&nbsp;</td>
      <td >Unidad de Medida </td>
      <td ><label>
        <?php 
        //*********Unidades de Medida
        $sSQL71 = "Select * From unidadMedida\r\nwhere entidad='" . $entidad . "' \r\n\r\n ORDER BY descripcionUM ASC ";
        $result71 = mysql_db_query($basedatos, $sSQL71);
        ?>
        <select name="um"  >
          <?php 
        while ($myrow71 = mysql_fetch_array($result71)) {
            ?>
          <option
		    <?php 
            if ($myrow['um'] == $myrow71['codigoUM']) {
                echo 'selected=""';
            }
            ?>
		   value="<?php 
            echo $myrow71['codigoUM'];
            ?>
"><?php 
            echo $myrow71['descripcionUM'];
            ?>
</option>
          <?php 
        }
        ?>
        </select></br>

            
           
      <a href="javascript:ventanaSecundaria4(
		'../ventanas/catalogoUM.php?codigoUM=<?php 
        echo $myrow71['codigoUM'];
        ?>
&amp;forma=<?php 
        echo "form1";
        ?>
&amp;campo=<?php 
        echo "cbarra";
        ?>
')">Editar</a>
</td>
 <td ><label></label></td>
 <td ><label></label></td>

    </tr>       
      
      
      
      
      
      
      
      
      
    <tr >
      <td>&nbsp;</td>
      <td ><span >C&oacute;digo Barra:</span></td>
      <td ><input name="cbarra" type="text"  id="cbarra" value="<?php 
        echo $myrow['cbarra'];
        ?>
" size="40"  autocomplete="off"/>
      <a href="javascript:ventanaSecundaria4(
		'<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/cargos/agregaCB.php?descripcion=<?php 
        echo $descripcion;
        ?>
&amp;forma=<?php 
        echo "form1";
        ?>
&amp;campo=<?php 
        echo "cbarra";
        ?>
')">Adjuntar</a></td>

    </tr>
    <?php 
        $sSQL111 = "SELECT \r\n *\r\nFROM\r\n  precioArticulos\r\nwhere entidad='" . $entidad . "' AND codigo = '" . $_POST['codigo'] . "'";
        $result111 = mysql_db_query($basedatos, $sSQL111);
        $myrow111 = mysql_fetch_array($result111);
        echo mysql_error();
        $PA = $myrow111['keyPA'];
        ?>
      <tr >
      <td scope="col">&nbsp;</td>
      <td >La caja contiene: (Opcional)</td>
      <td colspan="2" valign="middle" ><label>
        <input type="text" name="cajaCon" value="<?php 
        echo $myrow['cajaCon'];
        ?>
" size="10"  />
      </label></td>
    </tr>
    
    
    <tr >
      <td scope="col">&nbsp;</tdh>
      <td >Grupo  </td>
      
      
      <td colspan="2" valign="middle" ><label>
        
              <select name="grupo" >
                  <option value="">Escoje</option>
                  
                  <option
                      <?php 
        if ($myrow['grupo'] == 'I') {
            echo 'selected=""';
        }
        ?>
                      value="I">I</option>
                      
                  
                  <option
                      <?php 
        if ($myrow['grupo'] == 'II') {
            echo 'selected=""';
        }
        ?>
                      value="II">II</option>
                       
                                    
                      <option
                      <?php 
        if ($myrow['grupo'] == 'III') {
            echo 'selected=""';
        }
        ?>
                      value="III">III</option>
                                                      
                     <option
                      <?php 
        if ($myrow['grupo'] == 'IV') {
            echo 'selected=""';
        }
        ?>
                      value="IV">IV</option>
                                                                                    
                        <option
                      <?php 
        if ($myrow['grupo'] == 'V') {
            echo 'selected=""';
        }
        ?>
                      value="V">V</option>
                                                  
                                                                     <option
                      <?php 
        if ($myrow['grupo'] == 'VI') {
            echo 'selected=""';
        }
        ?>
                      value="VI">VI</option>
                                                                         
                                                        
                                                        
              </selected>
          
           
              
              
              
      </label></td>
      <td  >&nbsp;</td>
    </tr>    
    

    <tr >
      <td>&nbsp;</td>
      <td  >Generar C&oacute;digo:</td>
      <td  ><a href="javascript:ventanaSecundaria3('<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/cargos/cBarraSubeVentana.php?codigo=<?php 
        echo $_POST['codigo'];
        ?>
&amp;seguro=<?php 
        echo $_POST['seguro'];
        ?>
&amp;medico=<?php 
        echo $_POST['medico'];
        ?>
&amp;usuario=<?php 
        echo $usuario;
        ?>
')"><img src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/imagenes/barcode.gif" width="89" height="68" border="0" /></a>(Click en la imagen para Generar)</td>
      <td >&nbsp;</td>
    </tr>
    <tr >
      <td>&nbsp;</td>
      <td >Producto Maquilado?</td>
      <td >
        <input name="maquilado" type="checkbox" id="maquilado" value="si"  <?php 
        if ($myrow['maquilado']) {
            echo 'checked=""';
        }
        ?>
 />
        
		<?php 
        if ($myrow['maquilado'] == 'si') {
            ?>
		<label>
		<a href="javascript:ventanaSecundaria('<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/cargos/articulosMaquilados.php?keyPACOM=<?php 
            echo $myrow['keyPA'];
            ?>
&descripcion=<?php 
            echo $myrow['descripcion'];
            ?>
')">
		<img src="<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/imagenes/Save.png" alt="Almacenes" width="20" height="20" border="0" />
		</a>
		</label>
		
		<?php 
            echo '<span >' . '[Agregar articulos que componen este producto]' . '</span>';
            ?>

		<?php 
        }
        ?>
		</td>
      <td >&nbsp;</td>
    </tr>
    <tr >
      <td>&nbsp;</td>
      <td >Caducidad</td>
      <td >
	  <input name="caducidad" type="text"  id="caducidad" value="<?php 
        echo $myrow['caducidad'];
        ?>
" size="9" maxlength="9"  autocomplete="off"/>
	  <br />
	    Favor de respetar este formato de fecha para la caducidad: <?php 
        echo '<span ><blink>' . $fecha1 . '<blink></span>';
        ?>
	  </td>
      <td >&nbsp;</td>
    </tr>
    <tr >
      <td>&nbsp;</td>
      <?php 
        if ($myrow['codigo']) {
            ?>
      <td ><span >Precios-Almacen:</span></td>
      <td >
        <a href="javascript:ventanaSecundaria('<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/cargos/listaAlmacenesTodos.php?keyPA=<?php 
            echo $myrow['keyPA'];
            ?>
&amp;seguro=<?php 
            echo $_GET['seguro'];
            ?>
&amp;medico=<?php 
            echo $_GET['medico'];
            ?>
&amp;usuario=<?php 
            echo $usuario;
            ?>
')"><img src="<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/imagenes/Save.png" alt="Almacenes" width="20" height="20" border="0" /></a></td>
      <td >&nbsp;</td>
    </tr>

    <?php 
        }
        ?>

    <tr >
      <td colspan="4">       
 
          <input name="random" type="hidden"  id="random" value="<?php 
        echo rand(50000, 5000000);
        ?>
" />
          <input name="keyPA" type="hidden"  id="borrar2" value="<?php 
        echo $myrow['keyPA'];
        ?>
" /></td>
    </tr>
</table>


          <input name="warehouse" type="hidden"  id="random" value="<?php 
        echo $_GET['warehouse'];
        ?>
" />
          <input name="main" type="hidden"  id="borrar2" value="<?php 
        echo $_GET['main'];
        ?>
" />
</form>
<div align="center"><a href="precios.php">Regresar al listado de art&iacute;culos</a> </div>
<p>&nbsp;</p>
<p>&nbsp;</p>
    </div>
</body>
</html>


<?php 
    }
Пример #26
0
    public function expedientesDuplicados($ALMACEN, $fecha1, $hora1, $entidad, $usuario, $numeroE, $basedatos)
    {
        ?>

<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.nombrePaciente.value) == false ) {   
                alert("Por Favor, escribe el nombre del paciente!")   
                return false   
        } else if( vacio(F.deposito.value) == false ) {   
                alert("Por Favor, escribe el dep�sito!")   
                return false   
        } else if( vacio(F.medico.value) == false ) {   
                alert("Por Favor, escoje el m�dico responsable del internamiento!")   
                return false   
        }  else if( vacio(F.cuarto.value) == false ) {   
                alert("Por Favor, escoje el cuarto que desees asignar!")   
                return false   
        }  else if( vacio(F.limiteCredito.value) == false ) {   
                alert("Por Favor, escoje el l�mite que desees asignar!")   
                return false   
        }   
}   
  
  
  
  
</script>

<script language=javascript> 
function ventanaSecundaria5 (URL){ 
   window.open(URL,"ventana5","width=500,height=600,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria6 (URL){ 
   window.open(URL,"ventana6","width=260,height=300,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria7 (URL){ 
   window.open(URL,"ventana7","width=850,height=600,scrollbars=YES") 
} 
</script>
<script language=javascript> 
function ventanaSecundaria1 (URL){ 
   window.open(URL,"ventana1","width=650,height=700,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria2 (URL){ 
   window.open(URL,"ventana2","width=220,height=250,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria3 (URL){ 
   window.open(URL,"ventana3","width=270,height=350,scrollbars=YES") ;
} 
</script> 
<script language=javascript> 
function ventanaSecundaria4 (URL){ 
   window.open(URL,"ventana4","width=270,height=350,scrollbars=YES"); 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana","width=700,height=600,scrollbars=YES") ;
} 
</script> 




<?php 
        if ($_POST['request'] and $_POST['numeroEx1'] and $_POST['almacenDestino'] and $_POST['medico']) {
            $numeroEx = $_POST['numeroEx1'];
            $sSQL32 = "Select * From expedientesSolicitados WHERE entidad='" . $entidad . "' and numeroEx = '" . $_POST['numeroEx1'] . "'  and status='solicitar' order by keyES DESC";
            $result32 = mysql_db_query($basedatos, $sSQL32);
            $myrow32 = mysql_fetch_array($result32);
            if (!$myrow32['status']) {
                $q4 = "INSERT INTO expedientesSolicitados (almacen,medico,motivo,usuario,hora,fecha,numeroEx,entidad,status) values ('" . $_POST['almacenDestino'] . "','" . $_POST['medico'] . "','" . $_POST['motivo'] . "','" . $usuario . "','" . $hora1 . "','" . $fecha1 . "','" . $_POST['numeroEx1'] . "','" . $entidad . "','solicitar')";
                mysql_db_query($basedatos, $q4);
                echo mysql_error();
                ?>
<script>
window.alert("Se solicito el expediente: <?php 
                echo $_GET['numeroEx1'];
                ?>
");
</script>
<?php 
            } else {
                ?>
<script>
window.alert("El expediente se encuentra fuera");
</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" />
<script src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/js/scripts/autocomplete.js" type="text/javascript"></script>
<link rel="stylesheet" href="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/js/stylesheets/autocomplete.css" type="text/css" />
<?php 
        $estilos = new muestraEstilos();
        $estilos->styles();
        ?>

</head>

<body>
    <div class="page_right">
<h1 >&nbsp;</h1>
<h1 >Solicitar Expedientes sin folio de venta </h1>
<form name="form2" id="form2" method="post" action="">
  <p>&nbsp;</p>
  
  
  
  
  

  
  
  
<!--<table width="524" class="table-forma" >-->
<table width="524" class="table-template-left" >
    <tr valign="middle" >
      <th><div align="center" >Datos del Paciente </div></th>
    </tr>
    <tr valign="middle" >
      <td  >Nuevo Paciente <span ><span ><a href="javascript:ventanaSecundaria1('../ventanas/modificarP.php?campoDespliega=<?php 
        echo "nomSeguro";
        ?>
&amp;forma=<?php 
        echo "F";
        ?>
&amp;numeroExpediente=<?php 
        echo $myrow['numCliente'];
        ?>
&amp;seguro=<?php 
        echo $_POST['seguro'];
        ?>
&almacen=<?php 
        echo $ALMACEN;
        ?>
')"><img src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/imagenes/btns/addpatient.png" alt="Datos Generales del Paciente" width="22" height="22" border="0" /></a><a href="javascript:ventanaSecundaria1('modificarP.php?campoDespliega=<?php 
        echo "nomSeguro";
        ?>
&amp;forma=<?php 
        echo "F";
        ?>
&amp;numeroExpediente=<?php 
        echo $myrow['numCliente'];
        ?>
&amp;seguro=<?php 
        echo $_POST['seguro'];
        ?>
')"></a></span></span></td>
    </tr>
    <tr valign="middle" >
      <td >N&deg; Exp. Apellido o Nombre</td>
    </tr>
    <tr valign="top"  >
      <td  ><span >
        <input name="paciente" type="text"  id="paciente" size="60" onChange="this.form.submit();">
            </span>
        <input name="numeroEx" type="hidden"  id="numeroEx"  readonly="" />
        <label></label>
      &nbsp;</td>
    </tr>
  </table>

  <p align="center">

  <input name="nombrePaciente1" type="hidden"  id="nombrePaciente" size="60" readonly="" 
		value="<?php 
        echo $nombrePaciente;
        ?>
"  />
  <input name="nombrePaciente12" type="hidden" id="nombrePaciente122" value="<?php 
        echo $_POST['numPaciente'];
        ?>
"/>
    <input name="nCuenta" type="hidden"  id="nCuenta3" onKeyPress="return checkIt(event)" value="<?php 
        echo $nCuenta;
        ?>
" readonly=""/>
    <input name="numeroE" type="hidden"  id="numeroE3" value="<?php 
        echo $numeroEs = $_POST['numeroE'];
        ?>
" readonly="" /></p>
	
	
	
	
	  <?php 
        if ($_POST['numeroEx']) {
            ?>
<br />
  <!--<table width="524" class="table-forma">-->
  <table width="524" class="table-template-left">
   <tr>
      <td width="11">&nbsp;</td>
      <td width="198" >Departamento solicitante</td>
      <td width="225"><label>
<?php 
            $aCombo = "Select * From almacenes where\r\nentidad='" . $entidad . "' AND\r\n activo='A' and (miniAlmacen ='' or miniAlmacen='No') order by descripcion ASC";
            $rCombo = mysql_db_query($basedatos, $aCombo);
            ?>
        <select name="almacenDestino" class="" id="almacenDestino" />        
     
  <option value="" >---</option>
        <?php 
            while ($resCombo = mysql_fetch_array($rCombo)) {
                ?>
        <option 
		<?php 
                if ($ALMACEN == $resCombo['almacen'] and !$_POST['almacenDestino']) {
                    echo 'selected="selected"';
                } else {
                    if ($_POST['almacenDestino'] == $resCombo['almacen']) {
                        echo 'selected="selected"';
                    }
                }
                ?>
		value="<?php 
                echo $resCombo['almacen'];
                ?>
"><?php 
                echo $resCombo['descripcion'];
                ?>
</option>
        <?php 
            }
            ?>
        </select>
	  </label></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td >Dr. Solicitante</td>
      <td><label>
      <input name="medico" type="text" id="medico" />
      </label></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td >Motivo</td>
      <td><textarea name="motivo" wrap="virtual" id="motivo"></textarea></td>
    </tr>

  </table>
  <br />
     <input name="request" type="submit" id="request2" value="Solicitar" />
<br />
  <br />
  <!--<table width="449" class="table table-striped">-->
  <table width="449" class="table-template-left">
    <tr >
      <th width="57"   scope="col"><div align="left" >Exp</div></th>
      <th width="269"  scope="col"><div align="left" >Paciente</div></th>
      <th width="109" scope="col"><div align="center" >Editar</div></th>
    </tr>
      
<?php 
            $sSQL = "\r\nSELECT * from pacientes where \r\nentidad='" . $entidad . "'\r\nand\r\nnumCliente='" . $_POST['numeroEx'] . "'";
            $result = mysql_db_query($basedatos, $sSQL);
            while ($myrow = mysql_fetch_array($result)) {
                $numCliente = $myrow['numCliente'];
                $nombrePaciente = $myrow['nombre1'] . " " . $myrow['nombre2'] . " " . $myrow['apellido1'] . " " . $myrow['apellido2'] . " " . $myrow['apellido3'];
                $a += 1;
                $NUMEROE = $myrow['numCliente'];
                $sSQL31 = "Select  * From clientesInternos WHERE numeroE = '" . $myrow['numCliente'] . "' ";
                $result31 = mysql_db_query($basedatos, $sSQL31);
                $myrow31 = mysql_fetch_array($result31);
                $keyClientesInternos = $myrow31['keyClientesInternos'];
                $NC = $myrow['numCliente'];
                ?>
<tr  onMouseOver="bgColor='#ffff33'" onMouseOut="bgColor='#ffffff'" >
        <td height="24" bgcolor="<?php 
                echo $color;
                ?>
" class="codigos">
		 <a href="#"  onClick="javascript:ventanaSecundaria('dxActuales.php?numeroE=<?php 
                echo $myrow['numCliente'];
                ?>
		&amp;nCuenta=<?php 
                echo $myrow['nCuenta'];
                ?>
&amp;almacen=<?php 
                echo $bali;
                ?>
&amp;seguro=<?php 
                echo $_POST['seguro'];
                ?>
&amp;keyClientesInternos=<?php 
                echo $keyClientesInternos;
                ?>
')">		 </a>
		 <?php 
                echo $NC;
                ?>
		 
		  <input name="numeroEx1" type="hidden" id="bandera" value="<?php 
                echo $myrow['numCliente'];
                ?>
" />
	  </td>
          <td bgcolor="<?php 
                echo $color;
                ?>
" >
            <?php 
                if ($myrow['nombreCompleto']) {
                    echo $myrow['nombreCompleto'];
                } else {
                    echo '---';
                }
                ?>

          </span></span></span></td>
        <td bgcolor="<?php 
                echo $color;
                ?>
" ><div align="center"><span class="style12">
          
          
          <a href="javascript:ventanaSecundaria1('<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/OPERACIONESHOSPITALARIAS/admisiones/modificarP.php?campoDespliega=<?php 
                echo "nomSeguro";
                ?>
&forma=<?php 
                echo "F";
                ?>
&numeroExpediente=<?php 
                echo $myrow['numCliente'];
                ?>
&seguro=<?php 
                echo $_POST['seguro'];
                ?>
')"><img src="<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/imagenes/btns/editbtn.png" alt="Datos Generales del Paciente" width="22" height="22" border="0" />          </a>
          
        </span></div></td>
    </tr>

      <?php 
            }
            ?>
  </table>
  
  
  
  
  <br /><br />
  
  
  <p><label></label>
  </p>
  <p align="center">
    <input name="bandera" type="hidden" id="request" value="<?php 
            echo $a;
            ?>
" />
  HISTORIAL DE EXPEDIENTES </p>
  <!--<table width="998" class="table table-striped">-->
  <table width="998" class="table-template-left">
    <tr  >
      <th width="77"  scope="col"><div align="center" >
          <div align="left">Fecha</div>
      </div></th>
      <th width="53" scope="col"><div align="center" >
          <div align="left">#Exp.</span></div>
      </div></th>
      <th width="200" scope="col"><div align="center" >
          <div align="left">Paciente</span></div>
      </div></th>
      <th width="154" scope="col"><div align="center" >
          <div align="left">M&eacute;dico</span></div>
      </div></th>
      <th width="120" scope="col"><div align="center" >
        <div align="left">Usuario Solicita </span></div>
      </div></th>
      <th width="120" scope="col"><div align="center" >
        <div align="left">Usuario Recibe </span></div>
      </div></th>
      <th width="120" scope="col"><div align="center" >Motivo</div></th>
      <th width="120" scope="col"><div align="center" >
          <div align="left">Departamento</span></div>
      </div></th>
    </tr>
    <tr  >
      <?php 
            $sSQL11 = "\r\nSelect * From expedientesSolicitados WHERE entidad='" . $entidad . "' and numeroEx='" . $_POST['numeroEx'] . "'\r\n";
            $result11 = mysql_db_query($basedatos, $sSQL11);
            while ($myrow = mysql_fetch_array($result11)) {
                echo mysql_error();
                $bandera += 1;
                //****************************Terminan las validaciones
                ?>
    </tr>
    <tr >
      <td><div align="center" >
          <?php 
                echo $myrow['hora'] . " " . cambia_a_normal($myrow['fecha']);
                ?>
          </span> </span> </div></td>
      <td ><?php 
                echo $myrow['numeroEx'];
                ?>
</td>
      <td ><?php 
                $sSQL711a = "SELECT *\r\nFROM\r\npacientes\r\nWHERE\r\nentidad='" . $entidad . "' \r\n\r\nand\r\nnumCliente='" . $myrow['numeroEx'] . "'\r\n";
                $result711a = mysql_db_query($basedatos, $sSQL711a);
                $myrow711a = mysql_fetch_array($result711a);
                ?>
          <?php 
                echo $myrow711a['nombreCompleto'];
                ?>
        &nbsp;
          <div align="left"></div></td>
      <td ><div align="left" ></span>
              <?php 
                echo $myrow['medico'];
                ?>
        </div>        �</td>
      <td ><?php 
                echo $myrow['usuario'];
                ?>
</td>
      <td ><?php 
                echo $myrow['usuarioRecepcion'];
                ?>
</td>
      <td ><?php 
                echo $myrow['motivo'];
                ?>
</td>
      <td ><?php 
                echo $myrow['almacen'];
                ?>
      </td>
    </tr>
    <?php 
            }
            ?>
  </table>
  <?php 
        }
        ?>
  <p>&nbsp;</p>
  <p align="center">&nbsp;</p>
</form>

	  

	  
	  <script>
		new Autocomplete("nomSeguro", function() { 
			this.setValue = function( id ) {
				document.getElementsByName("seguro")[0].value = id;
			}
			
			// If the user modified the text but doesn't select any new item, then clean the hidden value.
			if ( this.isModified )
				this.setValue("");
			
			// return ; will abort current request, mainly used for validation.
			// For example: require at least 1 char if this request is not fired by search icon click
			if ( this.value.length < 1 && this.isNotClick ) 
				return ;
			
			// Replace .html to .php to get dynamic results.
			// .html is just a sample for you
			return "<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/cargos/clientesTodosAjax.php?q=" + this.value;
			// return "completeEmpName.php?q=" + this.value;
		});	
	</script>
  <script>
		new Autocomplete("paciente", function() { 
			this.setValue = function( id ) {
				document.getElementsByName("numeroEx")[0].value = id;
			}
			
			// If the user modified the text but doesn't select any new item, then clean the hidden value.
			if ( this.isModified )
				this.setValue("");
			
			// return ; will abort current request, mainly used for validation.
			// For example: require at least 1 char if this request is not fired by search icon click
			if ( this.value.length < 4 && this.isNotClick ) 
				return ;
			
			// Replace .html to .php to get dynamic results.
			// .html is just a sample for you
			return "<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/cargos/pacientesx.php?entidad=<?php 
        echo $entidad;
        ?>
&q=" + this.value;
			// return "completeEmpName.php?q=" + this.value;
		});	
	</script>
    </div>
</body>
</html>
<?php 
    }
Пример #27
0
    public function eACC($random, $entidad, $almacen, $basedatos)
    {
        ?>
 
<script language=javascript> 
function ventanaSecundaria1 (URL){ 
   window.open(URL,"ventana1","width=800,height=600,scrollbars=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>
<?php 
        $estilos = new muestraEstilos();
        $estilos->styles();
        ?>
</head>



<?php 
        $sSQL7e = "SELECT *\r\nFROM\r\nalmacenes\r\nWHERE\r\nalmacen='" . $almacen . "'\r\n\r\n";
        $result7e = mysql_db_query($basedatos, $sSQL7e);
        $myrow7e = mysql_fetch_array($result7e);
        ?>
<body>
 <h1 align="center"><?php 
        print $FV . '   ' . $myrow7e['descripcion'];
        ?>
</h1>
    <p align="center"><br />
    </p>
<form id="form2" name="form2" method="post" action="">
  <div align="center">
   
<?php 
        $sSQL = "Select * From gpoProductos where entidad='" . $entidad . "' ORDER BY descripcionGP ASC";
        $result = mysql_db_query($basedatos, $sSQL);
        ?>

</div>
  <table width="514" border="0" align="center">
     <tr>
       <th width="75" bgcolor="#660066" scope="col"><div align="left"><span class="blanco">C&oacute;digo GP</span></div></th>
       <th width="251" bgcolor="#660066" scope="col"><div align="left"><span class="blanco">Descripci&oacute;n de Productos </span></div></th>
       <th width="60" bgcolor="#660066" scope="col"><div align="left"><span class="blanco">Ingresos</span></div></th>
       <th width="45" bgcolor="#660066" scope="col"><div align="left"><span class="blanco">IVA</span></div></th>
       <th width="61" bgcolor="#660066" scope="col"><div align="left"><span class="blanco">Detalles</span></div></th>
    </tr>
     <tr>
<?php 
        while ($myrow = mysql_fetch_array($result)) {
            if ($col) {
                $color = '#FFCCFF';
                $col = "";
            } else {
                $color = '#FFFFFF';
                $col = 1;
            }
            $sSQL7 = "SELECT  sum(efectivo) as efectivos,sum(iva) as ivar\r\n\r\nFROM\r\nreportesFinancieros\r\nWHERE\r\nrandom='" . $_GET['random'] . "'\r\nand\r\n\r\ngpoProducto='" . $myrow['codigoGP'] . "'\r\nand\r\nalmacen='" . $almacen . "'\r\n";
            $result7 = mysql_db_query($basedatos, $sSQL7);
            $myrow7 = mysql_fetch_array($result7);
            $efectivo[0] += $myrow7['efectivos'];
            $ivar[0] += $myrow7['ivar'];
            ?>
       <td bgcolor="<?php 
            echo $color;
            ?>
" class="normalmid"><span class="style7">
       
         <label>
         <?php 
            echo $myrow['codigoGP'];
            ?>
         </label>
       </span></td>
       <td bgcolor="<?php 
            echo $color;
            ?>
" class="normalmid">
	   <span class="style71">
	   <?php 
            echo $myrow['descripcionGP'];
            ?>
	   </span>	
       <?php 
            if ($myrow7s['cashDev']) {
                print '</br>' . 'Devoluciones: ' . '$' . number_format($dev[0], 2);
            }
            ?>
          </td>
       <td bgcolor="<?php 
            echo $color;
            ?>
" class="normalmid"><?php 
            echo "\$" . number_format($myrow7['efectivos'], 2);
            ?>
</td>
       <td bgcolor="<?php 
            echo $color;
            ?>
" class="normalmid"><?php 
            echo "\$" . number_format($myrow7['ivar'], 2);
            ?>
</td>
       <td bgcolor="<?php 
            echo $color;
            ?>
" class="normalmid"><div align="center">
         <?php 
            if ($myrow7['efectivos']) {
                ?>
         <a href="#" 
onclick="javascript:ventanaSecundaria1('detallesAlmacenesHA.php?fecha=<?php 
                echo $_POST['fecha'];
                ?>
&amp;gpoProducto=<?php 
                echo $myrow['codigoGP'];
                ?>
&amp;almacen=<?php 
                echo $almacen;
                ?>
&amp;almacenFuente=<?php 
                echo $myrow['almacenSolicitante'];
                ?>
&amp;nT=<?php 
                echo $nT;
                ?>
&amp;tipoCliente=<?php 
                echo $tipoCliente;
                ?>
&amp;tipoMovimiento=<?php 
                echo 'cierreCuenta';
                ?>
&amp;fechaInicial=<?php 
                echo $fechaInicial;
                ?>
&amp;fechaFinal=<?php 
                echo $fechaFinal;
                ?>
&folioVenta=<?php 
                echo $FV;
                ?>
&random=<?php 
                echo $_GET['random'];
                ?>
')"><img src="../../imagenes/btns/detailsbtn.png" width="18" height="18" border="0" /></a>
         <?php 
            } else {
                echo '---';
            }
            ?>
       </div></td>
     </tr>
     
    
    <?php 
        }
        //cierra while
        ?>
     
     
  </table>
  
  
  
  
  <p>&nbsp;</p>
  <table width="200" border="1" align="center">
    <tr>
      <th colspan="2" scope="col">Subtotales</th>
    </tr>
    <tr>
      <th width="97" scope="col"><div align="left">SubTotal</div></th>
      <th width="87" scope="col"><div align="left"><?php 
        print '$' . number_format($efectivo[0], 2);
        ?>
</div></th>
    </tr>
    <tr>
      <th scope="col"><div align="left">IVA</div></th>
      <th scope="col"><div align="left"><?php 
        print '$' . number_format($ivar[0], 2);
        ?>
</div></th>
    </tr>
    <tr>
      <td><div align="left">TOTAL</div></td>
      <td><div align="left"><?php 
        print '$' . number_format($efectivo[0] + $ivar[0], 2);
        ?>
</div></td>
    </tr>
  </table>
  
  

  </form>
 <p align="center">&nbsp;</p>
</body>
</html>
<?php 
    }
Пример #28
0
    public function cargarArticulos($fechaSolicitud, $horaSolicitud, $entidad, $banderaCXC, $almacen, $ID_EJERCICIOM, $dia, $fecha1, $hora1, $usuario, $numeroPaciente, $seguro, $credencial, $medico, $almacenSolicitante, $nCuenta, $tipoCargo, $almacenDestino, $tipoPaciente, $basedatos)
    {
        //**************VERIFICO QUE NO ESTE PAGADO***************
        $sSQL15 = "Select statusCaja,tipoPaciente From clientesInternos WHERE keyClientesInternos='" . $_GET['keyClientesInternos'] . "'";
        $result15 = mysql_db_query($basedatos, $sSQL15);
        $myrow15 = mysql_fetch_array($result15);
        if ($myrow15['statusCaja'] == 'pagado' and $myrow15['tipoPaciente'] == 'externo') {
            ?>

<script>

window.alert("Imposible seguir haciendo cargos");

window.close();

</script>

<?php 
        }
        //********************************************************
        //************INSTANCIAMIENTOS******************
        $convenios = new validaConvenios();
        $global = new validaConvenios();
        $tipoConvenioS = new validaConvenios();
        $traeSeguro = new verificaSeguro1();
        $verificaSaldos1 = new verificaSeguro1();
        $verificaSaldosInternos = new verificaSeguro1();
        $validaJubilados = new validaConvenios();
        $porcentajeJubilados = new validaConvenios();
        $ivaAseguradora = new ivaCierre();
        $ivaParticular = new ivaCierre();
        $pagoEfectivo = new ivaCierre();
        $descripcion = new articulosDetalles();
        $random = rand(10000, 10000000000000.0);
        $porcentajeIVA = new articulosDetalles();
        $descripcionGrupoProducto = new articulosDetalles();
        //***********ALMACEN PRINCIPAL***************/
        $sSQL6 = "SELECT almacen\r\n\r\nFROM\r\n\r\nalmacenes\r\n\r\nWHERE\r\n\r\nentidad='" . $entidad . "' \r\n\r\n\r\n\r\nand centroDistribucion='si'";
        $result6 = mysql_db_query($basedatos, $sSQL6);
        $myrow6 = mysql_fetch_array($result6);
        $almacenPrincipal = $myrow6['almacen'];
        //necesitamos definirlo desde el cat�logo de almacenes
        if (!$almacenPrincipal) {
            ?>

<script>

window.alert("No existe almacen principal definido");

</script>

<?php 
        }
        ?>





<script language=javascript> 

function ventanaSecundaria1 (URL){ 

   window.open(URL,"ventana1","width=500,height=500,scrollbars=YES") 

} 

</script> 



<script language=javascript> 

function ventanaSecundaria5 (URL){ 

   window.open(URL,"ventana5","width=50,height=250,scrollbars=YES") 

} 

</script>

<script language=javascript> 

function ventanaSecundaria3 (URL){ 

   window.open(URL,"ventana3","width=420,height=350,scrollbars=YES") 

} 

</script> 



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

  

  

<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.escoje.value) == null ) {   

                alert("Por Favor, escoje como quieres agregar art�culos!")   

                return false   

        }            

}   

  

  

  

  

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



<?php 
        $almacen = $_POST['almacenDestino'];
        if ($_POST['almacenDestino1']) {
            $almacen = $_POST['almacenDestino1'];
        } else {
            $almacen = $_POST['almacenDestino'];
        }
        //$seguro=$_POST['seguro']='EC100048';
        //$credencial=$_POST['credencial']='20-ovidio';
        if (!$_POST['buscar'] and $_POST['insertarArticulos'] or is_numeric($_POST['nomArticulo'])) {
            /* $filtro=verificaSeguro::verificaSaldos($dia,$fecha1,$hora1,$seguro,$credencial,$basedatos);
            
            if($filtro!=null) */
            if ($_POST['insertarArticulos'] or is_numeric($_POST['nomArticulo'])) {
                //*************************PRESIONO INSERTAR ARTICULOS******************
                $aux = traeAuxiliar::auxiliar($fecha1, $hora1, $almacen, $basedatos, $ID_EJERCICIOM, $db_conn);
                $iva = new articulosDetalles();
                if ($_POST['cargo']) {
                    $status = "cxc";
                } else {
                    $status = "pendiente";
                }
                $codigo = $_POST['codigoArt'];
                if (is_numeric($_POST['nomArticulo'])) {
                    $_POST['bandera'] = 0;
                }
                $descripcionDescuentoGlobal = $_POST['descripcionDescuentoGlobal'];
                $statusDescuentoGlobal = $_POST['statusDescuentoGlobal'];
                $cantidad = $_POST['cantidad'];
                $agregarA = $_POST['agregarA'];
                $codigoBeta = $_POST['codigoBeta'];
                $laboratorioReferido = $_POST['laboratorioReferido'];
                $um = $_POST['um'];
                for ($i = 0; $i <= $_POST['bandera']; $i++) {
                    //********************FOR
                    $b += 1;
                    if (is_numeric($_POST['nomArticulo'])) {
                        $sSQL6 = "SELECT codigo\r\n\r\nFROM\r\n\r\narticulos\r\n\r\nWHERE\r\n\r\n\r\n\r\nentidad='" . $entidad . "' \r\n\r\nand \r\n\r\ncbarra='" . $_POST['nomArticulo'] . "'    ";
                        $result6 = mysql_db_query($basedatos, $sSQL6);
                        $myrow6 = mysql_fetch_array($result6);
                        $codigo[$i] = $myrow6['codigo'];
                        $cantidad[$i] = 1;
                        $leyenda = "Se Agregaron Articulos";
                        if (!$myrow6['codigo']) {
                            echo '<script>';
                            echo 'window.alert("No se encontro el articulo");';
                            echo '</script>';
                            $codigo[$i] = NULL;
                            $cantidad[$i] = NULL;
                            $leyenda = "No se encontro el articulo";
                        }
                    } else {
                        $leyenda = "Se Agregaron Articulos";
                        $codigo[$i] = $codigoBeta[$i];
                    }
                    $grupoProducto = new articulosDetalles();
                    $gpoProducto = $grupoProducto->grupoProducto($entidad, $codigo[$i], $basedatos);
                    $descripcionGP = $descripcionGrupoProducto->descripcionGrupoProducto($entidad, $gpoProducto, $basedatos);
                    $costoHospital = costoHospital($codigo[$i], $basedatos);
                    $ctaContable = centroCosto($medico, $basedatos);
                    $medico = devuelveMedico::regresaMedico($entidad, $codigo[$i], $basedatos);
                    $seguro = $traeSeguro->traeSeguro($_GET['keyClientesInternos'], $basedatos);
                    //$priceLevel=$convenios->validacionConvenios($precioLevel,$codigo[$i],$almacen,$gpoProducto,$seguro,$basedatos);
                    $priceLevel = new articulosDetalles();
                    $priceLevel = $priceLevel->precioVenta($paquete, $_POST['generico'], $cantidad[$i], $numeroPaciente, $_GET['keyClientesInternos'], $codigo[$i], $almacen, $basedatos);
                    if ($cantidad[$i]) {
                        $cargoAuto = new articulosDetalles();
                        $cargoAuto = $cargoAuto->cargoAuto($entidad, $codigo[$i], $basedatos);
                        $cLlave = new articulosDetalles();
                        $keyPA = $cLlave->codigollave($entidad, $codigo[$i], $basedatos);
                        $antibiotico = new articulosDetalles();
                        $acumuladoGlobal = $global->precioGlobal($entidad, $precioLevel, $codigo[$i], $almacen, $gpoProducto, $seguro, $basedatos);
                        $cargos = $convenios->validacionConveniosNivel($entidad, $precioLevel, $codigo[$i], $almacen, $gpoProducto, $seguro, $basedatos);
                        //$traeConvenio=$traeConvenio->traeConvenio($precioLevel,$codigo[$i],$almacen,$gpoProducto,$seguro,$basedatos);
                        $tipoConvenio = $tipoConvenioS->tipoConvenio($entidad, $precioLevel, $codigo[$i], $almacen, $gpoProducto, $seguro, $basedatos);
                        //$vConvenio=$vConvenio->vConvenio($precioLevel,$codigo[$i],$almacen,$gpoProducto,$seguro,$basedatos);
                        if ($error != 'faked') {
                            $iva = new articulosDetalles();
                            $iva = $iva->iva($entidad, $cantidad[$i], $codigo[$i], $priceLevel, $basedatos);
                            if ($acumuladoGlobal > $priceLevel) {
                                //$acumulado=$acumuladoGlobal-$priceLevel;
                                $acumulado = $priceLevel;
                            } else {
                                $acumulado = $priceLevel;
                            }
                            // son jubilados y trae seguro?
                            $precioOriginal = $priceLevel;
                            $ivaOriginal = $iva;
                            if ($seguro) {
                                if ($tipoConvenio != 'No' or $validaJubilados->validacionJubilados($_GET['numeroE'], $seguro, $entidad, $basedatos) == 'si') {
                                    if ($validaJubilados->validacionJubilados($_GET['numeroE'], $seguro, $entidad, $basedatos) == 'si') {
                                        $percent = $porcentajeJubilados->porcentajeJubilados($_GET['numeroE'], $seguro, $entidad, $basedatos);
                                        $percent *= 0.01;
                                        $cantidadAseguradora = $priceLevel * $percent;
                                        $cantidadParticular = $priceLevel - $cantidadAseguradora;
                                        //$cantidadParticular=(($priceLevel*$cantidad[$i])+($iva*$cantidad[$i]))-$cantidadAseguradora;
                                        $ivaAseguradorat = $ivaAseguradora->ivaAseguradora($entidad, $cantidad[$i], $keyPA, $cantidadAseguradora, $basedatos);
                                        $ivaParticulart = $ivaParticular->ivaParticular($entidad, $cantidad[$i], $keyPA, $cantidadParticular, $basedatos);
                                    } else {
                                        if ($tipoConvenio == 'cantidad') {
                                            $cantidadAseguradora = $convenios->validacionConvenios($entidad, $cantidad[$i], $iva, $priceLevel, $codigo[$i], $almacen, $gpoProducto, $seguro, $basedatos);
                                            //aqui ninguna aseguradora absorbe nada, solo paga porque es fijo
                                            $acumulado = $cantidadAseguradora;
                                            $priceLevel = $acumulado;
                                            $ivaAseguradorat = $ivaAseguradora->ivaAseguradora($entidad, $cantidad[$i], $keyPA, $priceLevel, $basedatos);
                                        } else {
                                            if ($tipoConvenio == 'grupoProducto') {
                                                $cantidadAseguradora = $convenios->validacionConvenios($entidad, $cantidad[$i], $iva, $priceLevel, $codigo[$i], $almacen, $gpoProducto, $seguro, $basedatos);
                                                $cantidadParticular = $cantidadAseguradora - $priceLevel;
                                                $ivaAseguradorat = $ivaAseguradora->ivaAseguradora($entidad, $cantidad[$i], $keyPA, $cantidadAseguradora, $basedatos);
                                                $ivaParticulart = $ivaParticular->ivaParticular($entidad, $cantidad[$i], $keyPA, $cantidadParticular, $basedatos);
                                            } else {
                                                if ($tipoConvenio == 'global') {
                                                    $cantidadAseguradora = $convenios->validacionConvenios($entidad, $cantidad[$i], $iva, $priceLevel, $codigo[$i], $almacen, $gpoProducto, $seguro, $basedatos);
                                                    $cantidadParticular = $priceLevel - $cantidadAseguradora;
                                                    $ivaAseguradorat = $ivaAseguradora->ivaAseguradora($entidad, $cantidad[$i], $keyPA, $cantidadAseguradora, $basedatos);
                                                    $ivaParticulart = $ivaParticular->ivaParticular($entidad, $cantidad[$i], $keyPA, $cantidadParticular, $basedatos);
                                                } else {
                                                    if ($tipoConvenio == 'precioEspecial') {
                                                        //puede afectar el precio base
                                                        if ($pagoEfectivo->pagoEfectivo($entidad, $seguro, $cantidad, $keyPA, $almacen, $basedatos) == 'si') {
                                                            $acumulado = $cantidadParticular = $convenios->validacionConvenios($entidad, $cantidad[$i], $iva, $priceLevel, $codigo[$i], $almacen, $gpoProducto, $seguro, $basedatos);
                                                            $cantidadAseguradora = NULL;
                                                            $ivaParticulart = $ivaParticular->ivaParticular($entidad, $cantidad[$i], $keyPA, $cantidadParticular, $basedatos);
                                                            $ivaAseguradorat = $iva;
                                                        } else {
                                                            $cantidadAseguradora = $convenios->validacionConvenios($entidad, $cantidad[$i], $iva, $priceLevel, $codigo[$i], $almacen, $gpoProducto, $seguro, $basedatos);
                                                            $ivaAseguradorat = $ivaAseguradora->ivaAseguradora($entidad, $cantidad[$i], $keyPA, $cantidadAseguradora, $basedatos);
                                                            $cantidadParticular = NULL;
                                                            $ivaParticular = NULL;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                } else {
                                    $cantidadParticular = NULL;
                                    $ivaParticulart = NULL;
                                    $cantidadAseguradora = $priceLevel;
                                    $ivaAseguradorat = $iva;
                                }
                            } else {
                                $cantidadParticular = $priceLevel;
                                $ivaParticulart = $iva;
                                $cantidadAseguradora = NULL;
                                $ivaAseguradorat = NULL;
                            }
                            $sSQL3115 = "Select folioVenta,status,beneficencia,primeraVez From clientesInternos WHERE keyClientesInternos='" . $_GET['keyClientesInternos'] . "'";
                            $result3115 = mysql_db_query($basedatos, $sSQL3115);
                            $myrow3115 = mysql_fetch_array($result3115);
                            $sSQL3115y = "Select pagoEfectivo From clientes WHERE entidad='" . $entidad . "' and numCliente='" . $seguro . "' ";
                            $result3115y = mysql_db_query($basedatos, $sSQL3115y);
                            $myrow3115y = mysql_fetch_array($result3115y);
                            if ($myrow3115['status'] == 'cortesia') {
                                //valido si es cortes�a
                                $status = 'cortesia';
                                $tipoCliente = 'cortesia';
                            } else {
                                //no es cortes�a
                                if ($myrow3115y['pagoEfectivo'] == 'si') {
                                    $status = 'particular';
                                    $statusAlta = 'standby';
                                    $tipoCliente = 'particular';
                                    $cantidadAseguradora = NULL;
                                    $ivaAseguradorat = NULL;
                                    $cantidadParticular = $convenios->validacionConvenios($entidad, "1", $iva, $priceLevel, $codigo[$i], $almacen, $gpoProducto, $seguro, $basedatos);
                                    $ivaParticular = $ivaAseguradora->ivaAseguradora($entidad, "1", $keyPA, $cantidadAseguradora, $basedatos);
                                } else {
                                    //no se paga en efectivo ese seguro
                                    if ($seguro) {
                                        $status = 'cxc';
                                        $statusAlta = 'standby';
                                        $tipoCliente = 'aseguradora';
                                    } else {
                                        $status = 'particular';
                                        $statusAlta = 'standby';
                                        $tipoCliente = 'particular';
                                    }
                                }
                                //termina si son cargos directos
                            }
                            //termina cortes�a
                            $statusCargo = 'cargadoR';
                            //*****************************
                            //no trae ni hora ni fecha
                            if (!$_POST['horaSolicitud']) {
                                $_POST['horaSolicitud'] = $hora1;
                            }
                            if (!$_POST['fechaSolicitud']) {
                                $_POST['fechaSolicitud'] = $fecha1;
                            }
                            //*****************************cargo clientePrincipal
                            $sSQL455 = "Select clientePrincipal,baseParticular from clientes where entidad='" . $entidad . "' and numCliente='" . $seguro . "'";
                            $result455 = mysql_db_query($basedatos, $sSQL455);
                            $myrow455 = mysql_fetch_array($result455);
                            $sSQL455a = "Select nomCliente from clientes where entidad='" . $entidad . "' and numCliente='" . $myrow455['clientePrincipal'] . "'";
                            $result455a = mysql_db_query($basedatos, $sSQL455a);
                            $myrow455a = mysql_fetch_array($result455a);
                            //****************************************************************
                            //*****************************almacenes TEMP,solo consulta externa********************
                            $sSQL455z = "Select * from almacenesTemp \r\n\r\nwhere\r\n\r\nfecha='" . $fecha1 . "'\r\n\r\nand\r\n\r\nalmacen='" . $_GET['almacenDestino'] . "'\r\n\r\nand\r\n\r\nalmacenPrincipal='" . $_GET['almacen'] . "'\r\n\r\norder by keyAT DESC\r\n\r\n\r\n\r\n";
                            //$result455z=mysql_db_query($basedatos,$sSQL455z);
                            //$myrow455z = mysql_fetch_array($result455z);
                            if ($myrow455z['keyAT']) {
                                $desc = $myrow455z['descripcion'];
                            } else {
                                $desc = $myrowj2['descripcion'];
                            }
                            //****************************************************************
                            //****************************DESCUENTOS AUTOMATICOS**********
                            //if($usuario=='omorales')echo $myrow455['baseParticular'];
                            if (!$seguro or $myrow455['baseParticular'] == 'si') {
                                $sSQL7ada = "Select * From descuentosAutomaticos where entidad='" . $entidad . "' and \r\n\r\ndepartamento='" . $_GET['almacen'] . "' \r\n\r\nand\r\n\r\ngpoProducto='" . $gpoProducto . "'\r\n\r\nand\r\n\r\n(tipoPaciente='externo' or tipoPaciente='ambos')\r\n\r\n";
                                $result7ada = mysql_db_query($basedatos, $sSQL7ada);
                                $myrow7ada = mysql_fetch_array($result7ada);
                                echo mysql_error();
                                if ((!$seguro or $myrow455['baseParticular'] == 'si') and $myrow7ada['gpoProducto'] == '*' || $myrow7ada['gpoProducto'] == $gpoProducto) {
                                    $descuentoP = $cantidadParticular * ($myrow7ada['porcentaje'] * 0.01);
                                    $cantidadParticular -= $descuentoP;
                                    $descuentoIvaP = $ivaParticulart * ($myrow7ada['porcentaje'] * 0.01);
                                    $ivaParticulart -= $descuentoIvaP;
                                    $descuentoA = $cantidadAseguradora * ($myrow7ada['porcentaje'] * 0.01);
                                    $cantidadAseguradora -= $descuentoA;
                                    $descuentoIvaA = $ivaAseguradorat * ($myrow7ada['porcentaje'] * 0.01);
                                    $ivaAseguradorat -= $descuentoIvaA;
                                }
                            }
                            //******************************************************************
                            //***************************************************
                            //Clientes que facturan a otros
                            $sSQL3y = "Select * From clientesGrupos WHERE entidad='" . $entidad . "' and seguro='" . $myrow455['clientePrincipal'] . "' and gpoProducto='" . $gpoProducto . "'";
                            $result3y = mysql_db_query($basedatos, $sSQL3y);
                            $myrow3y = mysql_fetch_array($result3y);
                            if ($myrow3y['seguro']) {
                                $seguro2 = $seguro;
                                $seguro = $myrow3y['seguro'];
                                $myrow455['clientePrincipal'] = $seguro;
                            } else {
                                $seguro2 = NULL;
                            }
                            //***************************************************
                            //****************************
                            $pi = $porcentajeIVA->porcentajeIVA($entidad, $cantidad[$i], $codigo[$i], $precioVenta, $basedatos);
                            if ($cantidadParticular > 0) {
                                $pp = $cantidadParticular / ($cantidadParticular + $cantidadAseguradora);
                            }
                            if ($cantidadAseguradora > 0) {
                                $pa = $cantidadAseguradora / ($cantidadParticular + $cantidadAseguradora);
                            }
                            if ($ivaParticulart > 0) {
                                $pip = $ivaParticulart / ($ivaParticulart + $ivaAseguradorat);
                            }
                            if ($ivaAseguradorat > 0) {
                                $pia = $ivaAseguradorat / ($ivaParticulart + $ivaAseguradorat);
                            }
                            //***************************
                            $aIngreso = new almacenesIngreso();
                            if ($aIngreso->almacenIngreso($gpoProducto, $entidad, $basedatos) == 'almacenSolicitante') {
                                $almacenIngreso = $almacenSolicitante;
                            } else {
                                if ($aIngreso->almacenIngreso($gpoProducto, $entidad, $basedatos) == 'almacenDestino') {
                                    $almacenIngreso = $almacen;
                                }
                            }
                            //****************
                            $sSQL6ab = "SELECT almacenPadre,descripcion\r\nFROM\r\nalmacenes\r\nWHERE\r\n\r\nentidad='" . $entidad . "'\r\nand\r\nalmacen='" . $almacenIngreso . "'\r\n  ";
                            $result6ab = mysql_db_query($basedatos, $sSQL6ab);
                            $myrow6ab = mysql_fetch_array($result6ab);
                            $almacenIngreso = $myrow6ab['almacenPadre'];
                            //****************
                            //****************
                            $sSQL6abc = "SELECT medico,descripcion\r\nFROM\r\nalmacenes\r\nWHERE\r\n\r\nentidad='" . $entidad . "'\r\nand\r\nalmacen='" . $almacen . "'\r\n  ";
                            $result6abc = mysql_db_query($basedatos, $sSQL6abc);
                            $myrow6abc = mysql_fetch_array($result6abc);
                            if ($myrow6abc['medico'] == 'si') {
                                $descripcionMedico = $myrow6abc['descripcion'];
                            }
                            //****************
                            //BENEFICENCIAS AQUI EN TRA EL PORCENTAJE DE AYUDA
                            if ($myrow3115['beneficencia'] == 'si' and !$myrow455['clientePrincipal']) {
                                $sSQL10a = "Select * From porcentajeBeneficencias\r\n                where entidad='" . $entidad . "' and numeroE='" . $_GET['numeroE'] . "'\r\n                and\r\n                fecha='" . $fecha1 . "' and status='standby' and departamento='" . $_GET['almacen'] . "'";
                                $result10a = mysql_db_query($basedatos, $sSQL10a);
                                $myrow10a = mysql_fetch_array($result10a);
                                $P = $myrow10a['porcentaje'];
                                $cantidadParticularOriginal = $cantidadParticular;
                                $ivaOriginalParticular = $ivaParticulart;
                                $descuentoP = $cantidadParticular * ($P * 0.01);
                                $cantidadParticular = $descuentoP;
                                $descuentoIvaP = $ivaParticulart * ($P * 0.01);
                                $ivaParticulart = $descuentoIvaP;
                                $cantidadAseguradora = $cantidadParticularOriginal - $cantidadParticular;
                                $ivaAseguradorat = $ivaOriginalParticular - $descuentoIvaP;
                            }
                            //CIERRO BENEFICENCIAS
                            //******************************************************
                            $diaNumerico = date("d");
                            $year = date("Y");
                            $mes = date("m");
                            //******************************************************
                            $agrega1 = "INSERT INTO cargosCuentaPaciente (\r\n\r\nnumeroE,\r\n\r\nnCuenta,\r\n\r\ncodProcedimiento,\r\n\r\ncantidad,\r\n\r\nusuario,\r\n\r\nfecha1,\r\n\r\n\r\n\r\nstatus,\r\n\r\nalmacen,\r\n\r\nprecioVenta,\r\n\r\n\r\n\r\nctaMayor,\r\n\r\nctoCosto,\r\n\r\nauxiliar,\r\n\r\nejercicio,\r\n\r\nseguro,iva,dia,costoHospital,hora1,existencias,um,\r\n\r\nmedico,tipoPaciente,prioridad,horaSolicitud,fechaSolicitud,laboratorioReferido,\r\n\r\ncredencial,statusCargo,tipoCliente,naturaleza,\r\n\r\nstatusTraslado,almacenSolicitante,almacenDestino,statusEstudio,statusCaja,\r\n\r\ntipoConvenio,cantidadParticular,cantidadAseguradora,entidad,cargoAuto,gpoProducto,\r\n\r\nstatusFactura,keyClientesinternos,statusDevolucion,folioVenta,clientePrincipal,keyPA,ivaParticular,\r\n\r\nivaAseguradora,usuarioCargo,horaCargo,fechaCargo,descripcionArticulo,random,clienteFacturacion,\r\n\r\nporcentajeIVA,\r\n\r\nporcentajeParticular,\r\n\r\nporcentajeAseguradora,\r\n\r\nporcentajeIVAParticular,\r\n\r\nporcentajeIVAAseguradora,statusDescuentoGlobal,descripcionDescuentoGlobal,antibiotico,\r\n\r\nprecioOriginal,ivaOriginal,tipoCuenta,almacenIngreso,descripcionAlmacen,\r\n\r\ndescripcionGrupoProducto,statusBeneficencia,\r\n\r\ndiaNumerico,year,mes,\r\n\r\ndescripcionClientePrincipal,descripcionMedico,primeraVez\r\n\r\n) values (\r\n\r\n'" . $_GET['numeroE'] . "',\r\n\r\n'" . $_GET['nCuenta'] . "',\r\n\r\n'" . $codigo[$i] . "',\r\n\r\n'" . $cantidad[$i] . "',\r\n\r\n'" . $usuario . "',\r\n\r\n'" . $fecha1 . "',\r\n\r\n\r\n\r\n'" . $status . "',\r\n\r\n'" . $_GET['almacen'] . "',\r\n\r\n'" . $cantidadParticular . "'+'" . $cantidadAseguradora . "',\r\n\r\n\r\n\r\n'" . $ctaMayor . "',\r\n\r\n'" . $centroCostoAlmacen . "',\r\n\r\n'" . $aux . "',\r\n\r\n'" . $ID_EJERCICIOM . "',\r\n\r\n'" . $seguro . "','" . $ivaParticulart . "'+'" . $ivaAseguradorat . "','" . $dia . "','" . $costoHospital . "','" . $hora1 . "','" . $existenciasAjuste . "','" . $um . "',\r\n\r\n'" . $medico . "','externo','" . $_POST['prioridad'] . "',\r\n\r\n'" . $_POST['horaSolicitud'] . "','" . $_POST['fechaSolicitud'] . "','" . $laboratorioReferido[$i] . "','" . $credencial . "',\r\n\r\n'" . $statusCargo . "','" . $tipoCliente . "','C',\r\n\r\n'standby',\r\n\r\n'" . $_GET['almacen'] . "','" . $almacen . "','standby','standby',\r\n\r\n'" . $tipoConvenio . "','" . $cantidadParticular . "','" . $cantidadAseguradora . "','" . $entidad . "','" . $cargoAuto . "',\r\n\r\n'" . trim($gpoProducto) . "','standby','" . $_GET['keyClientesInternos'] . "','no','" . $myrow3115['folioVenta'] . "',\r\n    \r\n    '" . trim($myrow455['clientePrincipal']) . "','" . $keyPA . "',\r\n\r\n'" . $ivaParticulart . "','" . $ivaAseguradorat . "','" . $usuario . "','" . $hora1 . "','" . $fecha1 . "',\r\n\r\n    '" . $descripcion->descripcionArticulo($keyCAP, $numeroE, $nCuenta, $codigo[$i], $basedatos) . "',\r\n\r\n'" . $random . "','" . $seguro2 . "',\r\n\r\n\r\n\r\n'" . $pi . "',\r\n\r\n'" . $pp . "',\r\n\r\n'" . $pa . "',\r\n\r\n'" . $pip . "',\r\n\r\n'" . $pia . "',\r\n\r\n'" . $statusDescuentoGlobal[$i] . "',\r\n\r\n'" . $descripcionDescuentoGlobal[$i] . "',\r\n\r\n'" . $antibiotico->mostrarAntibiotico($entidad, $codigo[$i], $basedatos) . "','" . $precioOriginal . "','" . $ivaOriginal . "','D','" . $almacenIngreso . "',\r\n\r\n'" . $myrow6ab['descripcion'] . "','" . $descripcionGP . "','" . $myrow3115['beneficencia'] . "',\r\n\r\n'" . $diaNumerico . "','" . $year . "','" . $mes . "',\r\n\r\n'" . $myrow455a['nomCliente'] . "','" . $descripcionMedico . "','" . $myrow3115['primeraVez'] . "'\r\n\r\n)";
                            mysql_db_query($basedatos, $agrega1);
                            echo mysql_error();
                            //*********************************agregar faltantes**********************
                            $sSQL455s = "Select stock from almacenes where entidad='" . $entidad . "' and almacen='" . $almacen . "' and centroDistribucion!='si'";
                            $result455s = mysql_db_query($basedatos, $sSQL455s);
                            $myrow455s = mysql_fetch_array($result455s);
                            if ($myrow455s['stock'] == 'si') {
                                //*************VERIFICO SI ES CON CAJA*************
                                $sSQL29a = "SELECT cajaCon\r\nFROM\r\narticulos\r\nwhere\r\nentidad='" . $entidad . "'\r\nand\r\ncodigo='" . $codigo[$i] . "'\r\n\r\n";
                                $result29a = mysql_db_query($basedatos, $sSQL29a);
                                $myrow29a = mysql_fetch_array($result29a);
                                if ($myrow29a['cajaCon'] > 1) {
                                    $cantidadTotal = $myrow29a['cajaCon'] * $cantidad[$i];
                                }
                                //*************************************************
                                $agrega1 = "INSERT INTO faltantes (\r\n\r\n\r\n\r\ncodigo,\r\n\r\ncantidad,\r\n\r\nusuario,\r\n\r\nfecha1,\r\n\r\nhora1,\r\n\r\nalmacen,\r\n\r\nejercicio,\r\n\r\ndia,\r\n\r\nstatus,entidad,almacenSolicitante,folioVenta,keyPA,gpoProducto,naturaleza,descripcion,random,keyClientesInternos,cantidadTotal\r\n\r\n) values (\r\n\r\n\r\n\r\n'" . $codigo[$i] . "',\r\n\r\n'" . $cantidad[$i] . "',\r\n\r\n'" . $usuario . "',\r\n\r\n'" . $fecha1 . "',\r\n\r\n'" . $hora1 . "',\r\n\r\n'" . $_GET['almacen'] . "',\r\n\r\n'" . $ID_EJERCICIOM . "',\r\n\r\n'" . $dia . "',\r\n\r\n'','" . $entidad . "','" . $almacen . "','" . $myrow3115['folioVenta'] . "','" . $keyPA . "','" . trim($gpoProducto) . "','C',\r\n    '" . $descripcion->descripcionArticulo($keyCAP, $numeroE, $nCuenta, $codigo[$i], $basedatos) . "','" . $random . "','" . $_GET['keyClientesInternos'] . "',\r\n        '" . $cantidadTotal . "')";
                                mysql_db_query($basedatos, $agrega1);
                                echo mysql_error();
                            }
                            //******************************************************************
                            $tipoMensaje = 'registrosAgregados';
                            $encabezado = 'Exito!';
                            $texto = 'Se hicieron Cargos...';
                            $actualiza1 = "update clientesInternos \r\n\r\nset\r\n\r\nstatus='pendiente',statusExpediente='request'\r\n\r\nWHERE keyClientesInternos ='" . $_GET['keyClientesInternos'] . "'\r\n\r\nAND\r\n\r\nstatus!='cortesia'\r\n\r\n";
                            mysql_db_query($basedatos, $actualiza1);
                            echo mysql_error();
                        } else {
                            //cantidad
                            $leyenda[0] = "No se hicieron Cargos, favor de revisar!";
                        }
                        //****************saco la cuenta contable de la forma en que ingresa*****************
                        //?????   insertarRegistros($agregarA[$i],$almacen,$cantidad[$i],$fecha1,$ID_EJERCICIOM,$usuario,$basedatos);
                    }
                }
                //*****************************************************CIERRO ALMA**************************************************
            }
            //cierro buscar
            /* <script language="JavaScript" type="text/javascript">
            
            javascript:ventanaSecundaria1('/sima/cargos/imprimirCargosPA.php?keyClientesInternos=<?php echo $_GET['keyClientesInternos'];?>&amp;nCuenta=<?php echo $_GET['nCuenta'];?>');
            
            
            
            self.close();
            
            </script> */
            ?>





<?php 
        }
        //verificaSeguro::verificaSaldos($dia,$fecha1,$hora1,$seguro,$credencial,$basedatos);
        ?>







<?php 
        $sSQL321 = "Select  * From clientesInternos WHERE keyClientesInternos='" . $_GET['keyClientesInternos'] . "'";
        $result321 = mysql_db_query($basedatos, $sSQL321);
        $myrow321 = mysql_fetch_array($result321);
        /* 
        $sSQL31= "Select  * From clientesInternos WHERE  entidad='".$entidad."' AND numeroE = '".$numeroPaciente."' ";
        $result31=mysql_db_query($basedatos,$sSQL31);
        $myrow31 = mysql_fetch_array($result31);
        */
        /*
        
        $sSQL311= "Select  * From clientesInternos WHERE  entidad='".$entidad."' AND numeroE = '".$numeroPaciente."' and status='activa'";
        
        $result311=mysql_db_query($basedatos,$sSQL311);
        
        $myrow311 = mysql_fetch_array($result311); */
        /* $paciente=$myrow31['nombre1']." ".$myrow31['nombre2']." ".$myrow31['apellido1']." ".$myrow31['apellido2']." ".$myrow31['apellido3']; */
        if ($myrow321['paciente']) {
            $paciente = $myrow321['paciente'];
        }
        ?>







<script language=javascript> 

function ventanaSecundaria (URL){ 

   window.open(URL,"ventanaSecundaria","width=350,height=189,scrollbars=YES") 

} 

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

<html xmlns="http://www.w3.org/1999/xhtml">

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



<head>

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

<style type="text/css">

<!--

.gpoProducto {

	font-size: 10px;

	color: #0000FF;

}

.boton {
	font-family: Verdana, sans-serif;
	font-size: 12px;
	color: #03F;
	border: 1px #666666 solid;
	background-color: #f2f2f2;
	font-weight: bold;
	background-position: left;
	background-attachment: fixed;
}


-->

</style>





</head>



<body  onLoad="document.getElementById('nomArticulo').focus();">





<span class="titulos2" align="center">
    <h1>
    <?php 
        if ($texto != NULL) {
            $mostrarMensajes = new informacion();
            $mostrarMensajes->mostrarMensajes($encabezado, $tipoMensaje, $id, $texto, $basedatos);
        }
        ?>
</h1></span></br>

<br />

<form id="form2" name="form2" method="post" action="" >

  <table width="200" border="0" cellspacing="0" cellpadding="0" align="center">

    <tr>

      <td colspan="8"><img src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/imagenes/bordestablas/borde1.png" width="620" height="28" /></td>

    </tr>

    <tr bgcolor="#FFFF00">

      <td colspan="8" align="center" class="negromid">Paciente: <span class="titulomedio"><?php 
        echo $paciente;
        ?>
</span></td>

 


      
    </tr>

    <tr>

     






      <td colspan="3" bgcolor="#CCCCCC" class="negromid">Seguro<span class="normalmid">:  

        <?php 
        $sSQL3113 = "Select nomCliente,clientePrincipal From clientes WHERE  entidad='" . $entidad . "' and numCliente='" . $seguro . "' ";
        $result3113 = mysql_db_query($basedatos, $sSQL3113);
        $myrow3113 = mysql_fetch_array($result3113);
        $sSQL311 = "Select cantidad From segurosLimites WHERE  entidad='" . $entidad . "' and seguro='" . $seguro . "' ";
        $result311 = mysql_db_query($basedatos, $sSQL311);
        $myrow311 = mysql_fetch_array($result311);
        echo $myrow3113['nomCliente'];
        ?>

      </span></td>


      <td colspan="2" align="center" bgcolor="#CCCCCC" class="negromid">Limite de Cr&eacute;dito</td>

      <td colspan="2" align="center" bgcolor="#CCCCCC" class="negromid">Cr&eacute;dito Disponible</td>

    </tr>

    <tr>

      <td height="28" bgcolor="#CCCCCC">&nbsp;</td>
                 <?php 
        if ($myrow321['beneficencia'] == 'si') {
            $sSQL10a = "Select * From porcentajeBeneficencias\r\n                where entidad='" . $entidad . "' and numeroE='" . $myrow321['numeroE'] . "'\r\n                and\r\n                fecha='" . $fecha1 . "' and status='standby' and departamento='" . $_GET['almacen'] . "'";
            $result10a = mysql_db_query($basedatos, $sSQL10a);
            $myrow10a = mysql_fetch_array($result10a);
            ?>
  <td width="300" bgcolor="#CCCCCC" class="negromid">El paciente es de beneficencia, paga solo el <span class="titulomedio">
     <?php 
            echo $P = $myrow10a['porcentaje'];
            ?>
%
      </span></td>
  <?php 
        }
        ?>

      <td width="313" bgcolor="#CCCCCC">&nbsp;</td>

      <td colspan="2" bgcolor="#CCCCCC">&nbsp;</td>

      <td colspan="2" align="center" bgcolor="#CCCCCC"><span class="precionormal1"><?php 
        echo "\$" . number_format($myrow311['cantidad'], 2);
        ?>
</span></td>

      <td colspan="2" align="center" bgcolor="#CCCCCC"><span class="precionormal2"><?php 
        echo "\$" . number_format($myrow321['limiteSeguro'], 2);
        ?>
</span></td>

    </tr>

    <tr>

      <td colspan="8" bgcolor="#FFFF66" class="negromid" align="center">ALMACEN A SOLICITAR</td>

    </tr>

    <tr>

      <td bgcolor="#CCCCCC">&nbsp;</td>

      <td colspan="2" bgcolor="#CCCCCC"><span class="negromid">Almacen

        

      </span></td>

      <td colspan="5" bgcolor="#CCCCCC"><span class="negromid">MiniAlmacen

        

          

      </span></td>

    </tr>

    <tr>

      <td height="19" bgcolor="#CCCCCC">&nbsp;</td>

      <td bgcolor="#CCCCCC"><span class="normalmid">

        <?php 
        require CONSTANT_PATH_CONFIGURACION . "/componentes/comboAlmacen.php";
        $comboAlmacen = new comboAlmacen();
        $comboAlmacen->despliegaAlmacenAAV($entidad, 'style7', $almacenSolicitante, $almacenDestino, $basedatos);
        ?>

      </span></td>

      <td colspan="6" bgcolor="#CCCCCC" class="normalmid"><?php 
        $comboAlmacen1 = new comboAlmacen();
        if ($myrow321['almacenSolicitud'] and $myrow321['tipoPaciente'] == 'externo') {
            $almacenDestino = $myrow321['almacenSolicitud'];
        } else {
            if (!$almacenDestino) {
                $almacenDestino = $almacenSolicitante;
            }
        }
        $comboAlmacen1->despliegaMiniAlmacen($entidad, 'combos', $almacenDestino, $almacenDestino, $basedatos);
        ?>
</td>

    </tr>

    <tr bgcolor="#FFFF66">

      <td colspan="8" align="center" class="negromid">ARTICULO A CARGAR</td>

    </tr>

    <tr>

      <td height="27" colspan="8" align="center" bgcolor="#CCCCCC"><input  name="nomArticulo" type="text" class="camposmid" id="nomArticulo" size="60" autocomplete="off" 

<?php 
        /* echo     $sSQL3113c= "Select numCliente From clientes WHERE  entidad='".$entidad."' and numCliente='".$seguro."' and convenioExclusivo='si' ";
        
        $result3113c=mysql_db_query($basedatos,$sSQL3113c);
        
        $myrow3113c = mysql_fetch_array($result3113c);
        
        if($myrow3113c['numCliente']){
        
        //echo 'disabled=""';
        
        } */
        ?>
 /></td>

    </tr>

    <tr>

      <td colspan="8" bgcolor="#CCCCCC" align="center">

       <input name="buscar" type="submit"  id="buscar" value="Buscar Articulo o Servicio" class="boton" src="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/imagenes/btns/new_busca.png" />

          <?php 
        if ($_POST['buscar']) {
            ?>

      

      </td>

    </tr>

    <tr bgcolor="#FFFFFF">

      <td height="23" colspan="8">&nbsp;</td>

    </tr>

    <tr>

      <td height="39" colspan="8" align="center" bgcolor="#CCCCCC" valign="middle">

        <input name="insertarArticulos" type="submit" id="insertarArticulos" value="Agregar Art&iacute;culos o Servicios" src="<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/imagenes/btns/new_agregaarticulo.png" />

        <?php 
        }
        ?>

      </td>

    </tr>

    <tr bgcolor="#FFFF00">

      <td colspan="8">

                      <?php 
        if ($_POST['almacenDestino1']) {
            $almacenDestinoB = $_POST['almacenDestino1'];
        } else {
            $almacenDestinoB = $_POST['almacenDestino'];
        }
        $articulo = $_POST['nomArticulo'];
        $unidadMedida = new articulosDetalles();
        if ($_POST['paquete'] == "si") {
            $sSQL = "SELECT \r\n\r\narticulos.codigo,articulos.gpoProducto as gpoProductos,articulos.generico,articulos.laboratorioReferido,articulos.keyPA,articulos.descripcion\r\n\r\nFROM articulos,existencias\r\n\r\nWHERE\r\n\r\n(articulos.entidad='" . $entidad . "' AND existencias.entidad='" . $entidad . "' )\r\n\r\nAND\r\n\r\n\r\n\r\narticulos.gpoProducto!=''\r\n\r\nAND\r\n\r\n\r\n\r\narticulos.cbarra='" . $articulo . "'\r\n\r\nAND\r\n\r\narticulos.activo='A' \r\n\r\nAND\r\n\r\narticulos.codigo=existencias.codigo \r\n\r\nand\r\n\r\nexistencias.almacen='" . $almacenDestinoB . "'\r\n\r\nand\r\n\r\narticulos.paquete='si'\r\n\r\norder by articulos.descripcion ASC\r\n\r\n";
        } else {
            if ($articulo) {
                if (is_numeric($articulo)) {
                    $sSQL = "SELECT \r\n\r\narticulos.codigo,articulos.gpoProducto as gpoProductos,articulos.generico,articulos.referido,articulos.laboratorioReferido,articulos.keyPA,articulos.descripcion\r\n\r\nFROM articulos,existencias\r\n\r\nWHERE\r\n\r\n(articulos.entidad='" . $entidad . "' AND existencias.entidad='" . $entidad . "' )\r\n\r\nAND\r\n\r\n\r\n\r\narticulos.gpoProducto!=''\r\n\r\nAND\r\n\r\n\r\n\r\narticulos.cbarra='" . $articulo . "'\r\n\r\nAND\r\n\r\narticulos.activo='A' \r\n\r\nAND\r\n\r\narticulos.codigo=existencias.codigo \r\n\r\nand\r\n\r\nexistencias.almacen='" . $almacenDestinoB . "'\r\n\r\norder by articulos.descripcion ASC\r\n\r\n";
                } else {
                    $sSQL = "SELECT \r\n\r\narticulos.codigo,articulos.gpoProducto as gpoProductos,articulos.generico,articulos.referido,articulos.laboratorioReferido,articulos.keyPA,articulos.descripcion\r\n\r\nFROM articulos,existencias\r\n\r\nWHERE\r\n\r\n(articulos.entidad='" . $entidad . "' AND existencias.entidad='" . $entidad . "' )\r\n\r\nAND\r\n\r\narticulos.gpoProducto!=''\r\n\r\nAND\r\n\r\n\r\n\r\narticulos.activo='A' and\r\n\r\n(articulos.descripcion like '%{$articulo}%' or articulos.descripcion1 like '%{$articulo}%')\r\n\r\nAND\r\n\r\narticulos.codigo=existencias.codigo and\r\n\r\nexistencias.almacen='" . $almacenDestinoB . "'\r\n\r\norder by articulos.descripcion ASC\r\n\r\n";
                }
            }
            if (!$articulo and $_POST['buscar']) {
                $sSQL = "SELECT \r\n\r\narticulos.codigo,articulos.gpoProducto as gpoProductos,articulos.generico,articulos.referido,articulos.laboratorioReferido,articulos.keyPA,articulos.descripcion\r\n\r\nFROM articulos,existencias\r\n\r\nWHERE\r\n\r\n(articulos.entidad='" . $entidad . "' AND existencias.entidad='" . $entidad . "' )\r\n\r\nand\r\n\r\nexistencias.almacen='" . $almacenDestinoB . "'\r\n\r\nand\r\n\r\narticulos.gpoProducto!=''\r\n\r\nAND\r\n\r\n\r\n\r\narticulos.activo='A' \r\n\r\nand\r\n\r\nexistencias.keyPA=articulos.keyPA\r\n\r\norder by articulos.descripcion ASC\r\n\r\n\r\n\r\n";
            }
            //********************CONVENIO EXCLUSIVO************************
            if (!$articulo and $myrow3113c['numCliente']) {
                if ($myrow3113c['numCliente']) {
                    $sSQL = "SELECT \r\n\r\narticulos.codigo,articulos.gpoProducto as gpoProductos,articulos.generico,articulos.referido,articulos.laboratorioReferido,articulos.keyPA,convenios.keyConvenios,convenios.keyPA as simulacion,articulos.descripcion\r\n\r\nFROM articulos,convenios\r\n\r\nWHERE\r\n\r\n(articulos.entidad='" . $entidad . "' AND existencias.entidad='" . $entidad . "' )\r\n\r\nand\r\n\r\nconvenios.departamento='" . $almacenDestinoB . "'\r\n\r\nand\r\n\r\narticulos.gpoProducto!=''\r\n\r\nAND\r\n\r\n\r\n\r\narticulos.activo='A' \r\n\r\nand\r\n\r\nconvenios.keyPA=articulos.keyPA\r\n\r\norder by articulos.descripcion ASC\r\n\r\ngroup by convenios.keyPA\r\n\r\n\r\n\r\n";
                } else {
                    $sSQL = "SELECT \r\n\r\narticulos.codigo,articulos.gpoProducto as gpoProductos,articulos.generico,articulos.referido,articulos.laboratorioReferido,articulos.keyPA,convenios.keyConvenios,convenios.keyPA as simulacion,articulos.descripcion\r\n\r\nFROM articulos,convenios\r\n\r\nWHERE\r\n\r\n(articulos.entidad='" . $entidad . "' AND existencias.entidad='" . $entidad . "' )\r\n\r\nand\r\n\r\narticulos.gpoProducto!=''\r\n\r\n\r\n\r\nAND\r\n\r\narticulos.activo='A' and\r\n\r\n(articulos.descripcion like '%{$articulo}%' or articulos.descripcion1 like '%{$articulo}%')\r\n\r\nAND\r\n\r\narticulos.codigo=convenios.codigo and\r\n\r\nconvenios.almacen='" . $almacenDestinoB . "'\r\n\r\ngroup by convenios.keyPA\r\n\r\norder by articulos.descripcion ASC\r\n\r\n";
                }
            }
            //**************************************************************
            if ($result = mysql_db_query($basedatos, $sSQL)) {
                $almacenDestino = $almacenDestinoB;
                ?>

</div>

        <p align="center"> 

  <span class="style15">

  <?php 
                echo $leyenda;
                ?>

	</span><?php 
                if ($horaSolicitud and $fechaSolicitud) {
                    ?>

		

		

	    <input name="fechaSolicitud" type="hidden" class="style7"  value="<?php 
                    echo $fechaSolicitud;
                    ?>
"/>

<input name="horaSolicitud" type="hidden" class="style7" value="<?php 
                    echo $horaSolicitud;
                    ?>
" size="10"/>

 

   <?php 
                }
                ?>

      

      

      </td>

    </tr>

    <tr bgcolor="#FFFF00">

      <td bgcolor="#FFFF00">



      

      

      

      </td>

      <td colspan="3" align="center" class="negromid">Descripcion</td>

      <?php 
                $sSQL7ada1 = "Select actualizaPrecios From almacenes where entidad='" . $entidad . "' and almacen='" . $_GET['almacen'] . "'  ";
                $result7ada1 = mysql_db_query($basedatos, $sSQL7ada1);
                $myrow7ada1 = mysql_fetch_array($result7ada1);
                echo mysql_error();
                ?>



<?php 
                if ($myrow7ada1['actualizaPrecios'] == 'si') {
                    ?>

      

      <td width="75" align="right" class="negromid">V Publico</td>

      <?php 
                }
                ?>

      <td width="58" align="right" class="negromid">P Part</td>

      <td width="77" align="right" class="negromid">P Aseg</td>

      <td width="77" align="center" class="negromid">Cant</td>

    </tr>



    <?php 
                while ($myrow = mysql_fetch_array($result)) {
                    $almacen = $almacenDestino;
                    $bandera += "1";
                    $sSQL3113cd = "Select descripcionGP From gpoProductos WHERE entidad='" . $entidad . "' and codigoGP='" . $myrow['gpoProductos'] . "'  ";
                    $result3113cd = mysql_db_query($basedatos, $sSQL3113cd);
                    $myrow3113cd = mysql_fetch_array($result3113cd);
                    //$gpoProducto=$myrow3113cd['descripcionGP'];
                    $gpoProducto = $myrow['gpoProductos'];
                    $code1 = $myrow['codigo'];
                    $codigo = $myrow['codigo'];
                    $keyPA = $myrow['keyPA'];
                    //*************************************CONVENIOS********************************************
                    $ctaMayor = $myrow12['ctaContable'];
                    $costoHospital = costoHospital($code1, $basedatos);
                    $codigoUM = $myrow12['um'];
                    $seguro = $traeSeguro->traeSeguro($_GET['keyClientesInternos'], $basedatos);
                    //**********************************CONVENIOS
                    $convenios = new validaConvenios();
                    $global = new validaConvenios();
                    $tipoConvenioS = new validaConvenios();
                    $traeSeguro = new verificaSeguro1();
                    $verificaSaldos1 = new verificaSeguro1();
                    $verificaSaldosInternos = new verificaSeguro1();
                    $validaJubilados = new validaConvenios();
                    $porcentajeJubilados = new validaConvenios();
                    $ivaParticular = new ivaCierre();
                    $priceLevel = new articulosDetalles();
                    $priceLevel = $priceLevel->precioVenta($paquete, $myrow['generico'], "1", $numeroPaciente, $_GET['keyClientesInternos'], $codigo, $almacen, $basedatos);
                    $precioNormal = $priceLevel;
                    $um = new articulosDetalles();
                    $um = $um->um($codigo, $basedatos);
                    $cargoAuto = new articulosDetalles();
                    $cargoAuto = $cargoAuto->cargoAuto($entidad, $codigo, $basedatos);
                    $informacionExistencias = new existencias();
                    $existenciasAjuste = $informacionExistencias->informacionExistencias($entidad, $codigo, $almacen, $usuario, $fecha1, $basedatos);
                    $acumuladoGlobal = $global->precioGlobal($entidad, $precioLevel, $codigo, $almacen, $gpoProducto, $seguro, $basedatos);
                    $cargos = $convenios->validacionConveniosNivel($entidad, $precioLevel, $codigo, $almacen, $gpoProducto, $seguro, $basedatos);
                    //$traeConvenio=$traeConvenio->traeConvenio($precioLevel,$codigo[$i],$almacen,$gpoProducto,$seguro,$basedatos);
                    $tipoConvenio = $tipoConvenioS->tipoConvenio($entidad, $precioLevel, $codigo, $almacen, $gpoProducto, $seguro, $basedatos);
                    //$vConvenio=$vConvenio->vConvenio($precioLevel,$codigo[$i],$almacen,$gpoProducto,$seguro,$basedatos);
                    $iva = new articulosDetalles();
                    $iva = $iva->iva($entidad, "1", $codigo, $priceLevel, $basedatos);
                    //***************PRECIO PUBLICO*******************/
                    $ventaPublico = $precioNormal + $iva;
                    //*************************************************/
                    if ($acumuladoGlobal > $priceLevel) {
                        //$acumulado=$acumuladoGlobal-$priceLevel;
                        $acumulado = $priceLevel;
                    } else {
                        $acumulado = $priceLevel;
                    }
                    if ($seguro) {
                        if ($tipoConvenio != 'No' or $validaJubilados->validacionJubilados($_GET['numeroE'], $seguro, $entidad, $basedatos) == 'si') {
                            if ($validaJubilados->validacionJubilados($_GET['numeroE'], $seguro, $entidad, $basedatos) == 'si') {
                                $percent = $porcentajeJubilados->porcentajeJubilados($_GET['numeroE'], $seguro, $entidad, $basedatos);
                                $percent *= 0.01;
                                $cantidadAseguradora = $priceLevel * $percent;
                                $cantidadParticular = $priceLevel - $cantidadAseguradora;
                            } else {
                                //no son jubilados
                                if ($tipoConvenio == 'cantidad') {
                                    $cantidadAseguradora = $convenios->validacionConvenios($entidad, "1", $iva, $priceLevel, $codigo, $almacen, $gpoProducto, $seguro, $basedatos);
                                    //aqui ninguna aseguradora absorbe nada, solo paga porque es fijo
                                    $acumulado = $cantidadAseguradora;
                                    $priceLevel = $acumulado;
                                    $ivaAseguradorat = $ivaAseguradora->ivaAseguradora($entidad, "1", $keyPA, $priceLevel, $basedatos);
                                } else {
                                    if ($tipoConvenio == 'grupoProducto') {
                                        $cantidadAseguradora = $convenios->validacionConvenios($entidad, "1", $iva, $priceLevel, $codigo, $almacen, $gpoProducto, $seguro, $basedatos);
                                        $cantidadParticular = $cantidadAseguradora - $priceLevel;
                                        $ivaAseguradorat = $ivaAseguradora->ivaAseguradora($entidad, "1", $keyPA, $cantidadAseguradora, $basedatos);
                                        $ivaParticulart = $ivaParticular->ivaParticular($entidad, "1", $keyPA, $cantidadParticular, $basedatos);
                                    } else {
                                        if ($tipoConvenio == 'global') {
                                            $cantidadAseguradora = $convenios->validacionConvenios($entidad, "1", $iva, $priceLevel, $codigo, $almacen, $gpoProducto, $seguro, $basedatos);
                                            $cantidadParticular = $priceLevel - $cantidadAseguradora;
                                            $ivaAseguradorat = $ivaAseguradora->ivaAseguradora($entidad, "1", $keyPA, $cantidadAseguradora, $basedatos);
                                            $ivaParticulart = $ivaParticular->ivaParticular($entidad, "1", $keyPA, $cantidadParticular, $basedatos);
                                        } else {
                                            if ($tipoConvenio == 'precioEspecial') {
                                                if ($pagoEfectivo->pagoEfectivo($entidad, $seguro, "1", $keyPA, $almacen, $basedatos) == 'si') {
                                                    $acumulado = $cantidadParticular = $convenios->validacionConvenios($entidad, "1", $iva, $priceLevel, $codigo, $almacen, $gpoProducto, $seguro, $basedatos);
                                                    $ivaParticulart = $ivaParticular->ivaParticular($entidad, "1", $keyPA, $cantidadParticular, $basedatos);
                                                    $cantidadAseguradora = NULL;
                                                    $ivaAseguradorat = NULL;
                                                } else {
                                                    $cantidadAseguradora = $convenios->validacionConvenios($entidad, "1", $iva, $priceLevel, $codigo, $almacen, $gpoProducto, $seguro, $basedatos);
                                                    $ivaAseguradorat = $ivaAseguradora->ivaAseguradora($entidad, "1", $keyPA, $cantidadAseguradora, $basedatos);
                                                    $cantidadParticular = NULL;
                                                    $ivaParticulart = NULL;
                                                }
                                            } else {
                                                $cantidadParticular = $priceLevel;
                                                $ivaParticulart = $iva;
                                                $cantidadAseguradora = NULL;
                                            }
                                        }
                                    }
                                }
                            }
                            //termina validacion dejubiliados
                        } else {
                            //trae seguro pero no convenio
                            $cantidadAseguradora = $priceLevel;
                            $ivaAseguradorat = $iva;
                        }
                    } else {
                        $cantidadParticular = $priceLevel;
                        $ivaParticulart = $iva;
                    }
                    if ($seguro) {
                        $sSQL3113c = "Select * From clientes WHERE  entidad='" . $entidad . "' and numCliente='" . $seguro . "'  ";
                        $result3113c = mysql_db_query($basedatos, $sSQL3113c);
                        $myrow3113c = mysql_fetch_array($result3113c);
                        if ($myrow3113c['convenioExclusivo'] == 'si') {
                            $sSQL3113cd = "SELECT \r\n\r\nkeyPA\r\n\r\nFROM convenios\r\n\r\nWHERE\r\n\r\nkeyPA='" . $myrow['keyPA'] . "'\r\n\r\nand\r\n\r\ndepartamento='" . $almacenDestinoB . "'";
                            $result3113cd = mysql_db_query($basedatos, $sSQL3113cd);
                            $myrow3113cd = mysql_fetch_array($result3113cd);
                            if (!$myrow3113cd['keyPA']) {
                                $aviso = 'Requiere autorizacion medica!';
                            }
                        } else {
                            $aviso = '';
                        }
                        if ($myrow3113c['pagoEfectivo'] == 'si') {
                            $cantidadAseguradora = NULL;
                            $ivaAseguradorat = NULL;
                            $cantidadParticular = $convenios->validacionConvenios($entidad, "1", $iva, $priceLevel, $codigo, $almacen, $gpoProducto, $seguro, $basedatos);
                            $ivaParticular = $ivaAseguradora->ivaAseguradora($entidad, "1", $keyPA, $cantidadAseguradora, $basedatos);
                        }
                    }
                    ?>

    

    <tr bgcolor="#FFFFFF" onMouseOver="bgColor='#cccccc'" onMouseOut="bgColor='#ffffff'" >

      <td height="26">&nbsp;</td>

      <td colspan="3" class="negromid">

      <?php 
                    echo $myrow['descripcion'];
                    echo '</br>';
                    echo '<span class="">' . $aviso . '</span>';
                    ?>

                

                

	<?php 
                    if ($myrow['laboratorioReferido'] == 'si') {
                        echo '<span class="codigos">' . 'Estudio Referido' . '</span>';
                    }
                    if ($gpoProducto) {
                        $sSQL3113cd = "Select * From gpoProductos WHERE  entidad='" . $entidad . "' and codigoGP='" . $gpoProducto . "'  ";
                        $result3113cd = mysql_db_query($basedatos, $sSQL3113cd);
                        $myrow3113cd = mysql_fetch_array($result3113cd);
                        echo '<span class="gpoProducto">' . '[ ' . $myrow3113cd['descripcionGP'] . ' ]' . '</span>';
                    } else {
                        echo '<span class="error">' . 'No tiene Grupo de Producto Definido' . '</span>';
                    }
                    ?>

        </span><span class="codigos">

        <input name="codigoArt[]2" type="hidden" id="codigoArt[]2" value="<?php 
                    echo $myrow['codigo'];
                    ?>
" />

        <input name="codigoBeta[]" type="hidden" id="codigoBeta[]" value="<?php 
                    echo $myrow['codigo'];
                    ?>
" />

<?php 
                    $sSQL15a = "\r\n\r\nSELECT fechaFinal\r\n\r\nFROM\r\n\r\nconvenios\r\n\r\nWHERE\r\n\r\nentidad='" . $entidad . "'\r\n\r\nand\r\n\r\nkeyPA='" . $myrow['keyPA'] . "'\r\n\r\nand\r\n\r\nnumCliente='" . $_GET['seguro'] . "'\r\n\r\nand\r\n\r\nfechaFinal<='" . $fecha1 . "'\r\n\r\n";
                    $result15a = mysql_db_query($basedatos, $sSQL15a);
                    $myrow15a = mysql_fetch_array($result15a);
                    //valido las fechas
                    if ($myrow15a['fechaFinal']) {
                        $flat = 'disable';
                        echo '</br>';
                        echo '<blink>' . 'Convenio Vencido el ' . cambia_a_normal($myrow15a['fechaFinal']) . '' . '</blink>';
                    } else {
                        $flat = NULL;
                    }
                    //*****************************cargo clientePrincipal
                    $sSQL455 = "Select clientePrincipal,baseParticular from clientes where entidad='" . $entidad . "' and numCliente='" . $seguro . "'";
                    $result455 = mysql_db_query($basedatos, $sSQL455);
                    $myrow455 = mysql_fetch_array($result455);
                    //****************************************************************
                    //****************************DESCUENTOS AUTOMATICOS**********
                    $sSQL7ada = "Select * From descuentosAutomaticos where entidad='" . $entidad . "' \r\n\r\nand departamento='" . $_GET['almacen'] . "' \r\n\r\nand\r\n\r\ngpoProducto='" . $gpoProducto . "'\r\n\r\nand (tipoPaciente='externo' or tipoPaciente='ambos') ";
                    $result7ada = mysql_db_query($basedatos, $sSQL7ada);
                    $myrow7ada = mysql_fetch_array($result7ada);
                    echo mysql_error();
                    if ((!$seguro or $myrow455['baseParticular'] == 'si') and $myrow7ada['gpoProducto'] == '*' || $myrow7ada['gpoProducto'] == $gpoProducto) {
                        $cantidadParticularOriginal = $cantidadParticular;
                        $ivaOriginalParticular = $ivaParticulart;
                        $cantidadAseguradoraOriginal = $cantidadAseguradora;
                        $ivaOriginalAseguradora = $ivaAseguradorat;
                        $descuentoP = $cantidadParticular * ($myrow7ada['porcentaje'] * 0.01);
                        $cantidadParticular -= $descuentoP;
                        $descuentoIvaP = $ivaParticulart * ($myrow7ada['porcentaje'] * 0.01);
                        $ivaParticulart -= $descuentoIvaP;
                        $descuentoA = $cantidadAseguradora * ($myrow7ada['porcentaje'] * 0.01);
                        $cantidadAseguradora -= $descuentoA;
                        $descuentoIvaA = $ivaAseguradorat * ($myrow7ada['porcentaje'] * 0.01);
                        $ivaAseguradorat -= $descuentoIvaA;
                        echo '</br>';
                        echo $descripcionDescuentoGlobal = 'Descuento ' . $myrow7ada['porcentaje'] . '%';
                        ?>

          <input name="statusDescuentoGlobal[]" type="hidden" id="statusDescuentoGlobal" value="si" />

          <input name="descripcionDescuentoGlobal[]" type="hidden" id="numPaciente2" value="<?php 
                        echo $descripcionDescuentoGlobal;
                        ?>
" />



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

<?php 
                    //BENEFICENCIAS AQUI EN TRA EL PORCENTAJE DE AYUDA
                    if ($P > 0 and !$myrow321['seguro']) {
                        $cantidadParticularOriginal = $cantidadParticular;
                        $ivaOriginalParticular = $ivaParticulart;
                        $descuentoP = $cantidadParticular * ($P * 0.01);
                        $cantidadParticular = $descuentoP;
                        $descuentoIvaP = $ivaParticulart * ($P * 0.01);
                        $ivaParticulart = $descuentoIvaP;
                        $cantidadAseguradora = $cantidadParticularOriginal - $cantidadParticular;
                        $ivaAseguradorat = $ivaOriginalParticular - $descuentoIvaP;
                        echo '</br>';
                        echo $descripcionDescuentoGlobal = 'Descuento ' . $P . '%';
                    }
                    //CIERRO BENEFICENCIAS
                    ?>

      

      </td><?php 
                    if ($myrow7ada1['actualizaPrecios'] == 'si') {
                        ?>

      <td class="normalmid" align="right">

      <a  href="javascript:ventanaSecundaria('<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/ADMINHOSPITALARIAS/inventarios/ventanitaCambiaPrecioFormas.php?codigo=<?php 
                        echo $code;
                        ?>
&amp;seguro=<?php 
                        echo $_GET['seguro'];
                        ?>
&amp;medico=<?php 
                        echo $_GET['medico'];
                        ?>
&amp;usuario=<?php 
                        echo $usuario;
                        ?>
&amp;keyPA=<?php 
                        echo $myrow['keyPA'];
                        ?>
')"><?php 
                        echo '$' . number_format($ventaPublico, 2);
                        ?>
</a>



      </td>

      <?php 
                    }
                    ?>

      <td align="right" class="precio2">

<?php 
                    if ($cantidadParticular) {
                        echo "\$" . number_format($cantidadParticular + $ivaParticulart, 2);
                    } else {
                        echo '---';
                    }
                    ?>

      </td>

      <td align="right" class="precio1">

      <?php 
                    if ($cantidadAseguradora) {
                        echo "\$" . number_format($cantidadAseguradora + $ivaAseguradorat, 2);
                    } else {
                        echo '---';
                    }
                    ?>

      

      </td>

      <td align="center">

      <input  name="cantidad[]" type="text" id="cantidad" class="camposmid" onKeyPress="return checkIt(event)" size="3" 

<?php 
                    if ($flat == 'disable') {
                        echo 'readonly=""';
                    } else {
                        if (!$gpoProducto or !$precioNormal) {
                            echo 'readonly=""';
                        } else {
                            $statusExistencias = new articulosDetalles();
                            echo $statusExistencias->statusExistencias($entidad, $unidadMedida->unidadMedida($codigo, $basedatos), $almacen, $codigo, $basedatos);
                        }
                    }
                    ?>
 autocomplete="off" />

      </td>

      

      <?php 
                    $mouseOver = 'onmouseover';
                    $mouseOut = 'onMouseOut';
                    ?>

    </tr>

    <?php 
                }
                //cierra while
                ?>

    <tr>

      <td bgcolor="#FFFFFF">&nbsp;</td>

      <td colspan="3" bgcolor="#FFFFFF">&nbsp;</td>

      <td colspan="2" bgcolor="#FFFFFF">&nbsp;</td>

      <td colspan="2" bgcolor="#FFFFFF">&nbsp;</td>

    </tr>

    <tr>

      <td colspan="8"><img src="<?php 
                echo CONSTANT_PATH_SIMA_RAIZ;
                ?>
/imagenes/bordestablas/borde2.png" width="620" height="28" /></td>

    </tr>

  </table>

 



<div align="center" class="normal"><?php 
            }
        }
        ?>



</div>

        <p align="center">

		<?php 
        if ($bandera) {
            ?>

		<span class="precredmid"> <?php 
            if (is_numeric($_POST['nomArticulo'])) {
                echo "";
            } else {
                echo "Se encontraron {$bandera} articulos con la palabra: {$articulo}";
            }
            ?>

		<?php 
        } else {
            ?>

		<?php 
            //echo "No se encontro el articulo"
            ?>

		<?php 
        }
        ?>

&nbsp;</p>



        <div align="center">

          <input name="gpoProducto" type="hidden" id="numPaciente2" value="<?php 
        echo $gpoProducto;
        ?>
" />

          <input name="numeroMedico1" type="hidden" id="numeroMedico1" value="<?php 
        echo $numeroMedico;
        ?>
" />

          <input name="alis" type="hidden" id="nombreDelPaciente2" value="<?php 
        echo $almacen;
        ?>
" />

          <input name="extension2" type="hidden" id="extension2" value="<?php 
        echo $extension;
        ?>
" />

          <input name="segu1" type="hidden" id="segu1" value="<?php 
        echo $segu;
        ?>
" />

          <input name="bandera" type="hidden" id="numPaciente22" value="<?php 
        echo $bandera;
        ?>
" />

          

        </div>

</form>

  <p></p>



</body>

</html>

<?php 
    }
Пример #29
0









<!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();
?>
<style>
    input{ 
text-align:right; 
}


.inpu{
   font-size: 0.875em;
}
</style>
</head>
    <body>
        <div class="page_right">
    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 
    }