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