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>';
        }
    }
$pdf->SetXY(2,5);
$pdf->Cell(0,0,'POLIZA DE DIARIO',0,0,M);

$pdf->SetX(1);


//*****************ech*************





$fecha1=$_GET['fecha'];
$pdf->SetY(10);
$pdf->Cell(0,0,cambia_a_normal($fecha1),0,0,R);



$pdf->SetXY(2,10);
$pdf->Cell(0,0,"HOSPITAL LA CARLOTA",0,0,M);
$pdf->SetX(1);


$pdf->SetXY(2,25);
$pdf->Cell(0,0,"CONSUMO DE ALMACENES",0,0,M);
$pdf->SetX(1);



Esempio n. 3
0
    } else {
        echo '---';
    }
    ?>
        </span></td>
        
        
        <td align="center">
          <?php 
    echo cambia_a_normal($myrow['fechaInicial']);
    ?>
        </span></td>
        
        <td align="center">
          <?php 
    echo cambia_a_normal($myrow['fechaFinal']);
    ?>
        </span></td>
      </tr>
	  <?php 
}
?>

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

</form>
    </div>
<?php 
$mostrarFooter = new menus();
$mostrarFooter->footerTemplate($usuario, $entidad, $basedatos);
            //  $result7d=mysql_db_query($basedatos,$sSQL7d);
            //  $myrow7d = mysql_fetch_array($result7d);
            //********************************************************************
            ?>
      <td height="24" bgcolor="<?php 
            echo $color;
            ?>
" ><div align="left"><?php 
            echo $a;
            ?>
</div></td>
      <td height="24" bgcolor="<?php 
            echo $color;
            ?>
" ><div align="left"><?php 
            echo cambia_a_normal($myrow['fechaCierre']);
            ?>
</div></td>

<td height="24" bgcolor="<?php 
            echo $color;
            ?>
" ><div align="left"><?php 
            echo $myrow['folioVenta'];
            ?>
</div></td>


      <td width="233" bgcolor="<?php 
            echo $color;
            ?>
//*****************************************************
/* $pdf->SetXY(2,17);                                  //*  
$pdf->Cell(0,0,$myrow1['descripcionCaja'],0,0,M);   //*
$pdf->SetX(1);     */                                  //*
//*****************************************************

/* $pdf->SetXY(2,20);  
$pdf->Cell(0,0,'Num. Corte: '.$_GET['numCorte'],0,0,M); */




$pdf->SetXY(50,20);  
$pdf->Cell(0,0,'Fecha Inicial: '.cambia_a_normal($_GET['fechaInicial']),0,0,R);
$pdf->SetXY(160,24);  
$pdf->Cell(0,0,'Fecha Final: '.cambia_a_normal($_GET['fechaFinal']),0,0,R); 

//***********************************EFECTIVO SOLAMENTE***********************************


$pdf->SetFont('Arial','',10);
$pdf->line(2,32,203,32);




$pdf->SetXY(2,30);
$pdf->Cell(0,0,'FV.',0,0,M);

$pdf->SetXY(15,30);
$pdf->Cell(0,0,'CONCEPTO',0,0,M);
Esempio n. 6
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 
    }


$pdf->SetXY(2,10);
$pdf->Cell(0,0,"SOLICITUDES GRANEL",0,0,M);
$pdf->SetX(1); 


//Usuario
$pdf->SetXY(2,13);
$pdf->SetFont('Arial','',8);
$pdf->Cell(0,0,'Usuario Cargo: '.$myrow2c['usuario'],0,0,L);

$pdf->SetXY(2,16);
$pdf->SetFont('Arial','',8);
$pdf->Cell(0,0,'Fecha Cargo: '.cambia_a_normal($myrow2c['fecha']),0,0,L);


$pdf->SetXY(2,19);
$pdf->SetFont('Arial','',8);
$pdf->Cell(0,0,'Hora Cargo: '.$myrow2c['hora'],0,0,L);

$pdf->SetXY(2,22);
$pdf->SetFont('Arial','',8);
$pdf->Cell(0,0,'Departamento: '.$myrow2c['descripcionAlmacen'],0,0,L);





/*
and
(fechaCargo >='".$_GET['fechaInicial']."' and fechaCargo<='".$_GET['fechaFinal']."')
and
statusCaja='pagado'
and
tipoPaciente='externo'
and
gpoProducto!=''
group by almacenSolicitante
";
$result=mysql_db_query($basedatos,$sSQL); 

?>
</h1>
<p align="center">
<?php print 'De la Fecha: '.cambia_a_normal($_GET['fechaInicial']).' a '.cambia_a_normal($_GET['fechaFinal']);?>
</p>
<p align="center">
<?php	
while($myrow = mysql_fetch_array($result)){


$dxA=new desplegarACC();
$dxA-> eACC($_GET['fechaInicial'],$_GET['fechaFinal'],$entidad,$myrow['almacenSolicitante'],$basedatos);


}



?>
Esempio n. 9
0





?>
    <tr bgcolor="#FFFFFF" onMouseOver="bgColor='#ffff33'" onMouseOut="bgColor='#ffffff'" >
      <td bgcolor="<?php echo $color;?>" class="codigos"><div align="center"><span class="normalmid">
	  
	  <a href="#" 
onclick="javascript:ventanaSecundaria11('<?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&folioVenta=<?php echo $myrow['folioVenta'];?>')">  
	  <?php echo $myrow['folioVenta']; ?>	  </a>
	  
	  </span></div></td>
      <td bgcolor="<?php echo $color;?>" class="normal"><div align="center"><span class="normalmid"><?php echo cambia_a_normal($myrow['fecha1']); ?></span></div></td>
      <td bgcolor="<?php echo $color;?>" class="normal"><div align="center"><span class="normalmid"><?php echo $myrow['paciente']; ?></span></div></td>
      <td bgcolor="<?php echo $color;?>" class="normal"><div align="center"><span class="normalmid"><?php echo $myrow['status']; ?></span></div></td>
      <td bgcolor="<?php echo $color;?>" class="normal"><div align="center"><span class="normalmid"><?php echo $myrow['statusCuenta']; ?></span></div></td>
      <td bgcolor="<?php echo $color;?>" class="normal"><div align="center"><span class="normalmid"><?php echo $myrow['tipoPaciente']; ?></span></div></td>
      <td bgcolor="<?php echo $color;?>" class="normal"><div align="center"><?php echo '$'.number_format($cargos,3);?></div></td>
      <td bgcolor="<?php echo $color;?>" class="normal"><div align="center"><?php echo '$'.number_format($abonos,3);?></div></td>
      <td height="24" bgcolor="<?php echo $color;?>" class="normal"><div align="center">
	  <?php 
	  if($STotal>1 or $STotal<-1){
	  echo '<span class="codigos"><blink>'.'$'.number_format($STotal,2).'</blink></span>';
	  }else{
	  echo '$'.money_format($STotal,2);
	  }
	  ?>
	  </div></td>
Esempio n. 10
0
            if ($myrow['status'] == 'cortesia') {
                echo ' [Cortesia]';
            }
            if ($myrow142['keyDiagnostico']) {
                echo '<span class="style1">' . '  (Revisado)' . '</span>';
            }
            ?>
</a>
</td>


    <td class="normal" >
  
       <?php 
            if ($myrow2['fechaNacimiento'] != NULL) {
                echo cambia_a_normal($myrow2['fechaNacimiento']);
            } else {
                echo '---';
            }
            ?>
  
</td>

    
<td class="normal" style="">
 <label class="normal">
 <?php 
            if ($myrow['statusCaja'] == 'pagado') {
                echo $myrow['statusCaja'];
            } else {
                echo '---';
Esempio n. 11
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 
    }
Esempio n. 12
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 
    }
    public function imprimirServiciosP($entidad, $fecha1, $hora1, $numeroE, $nCuenta, $keyCAP, $basedatos)
    {
        ?>
<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana1","width=630,height=800,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>
<?php 
        if ($_POST['cerrar']) {
            ?>
<script language="JavaScript" type="text/javascript">
  <!--
    opener.location.reload(true);
    self.close();
  // -->
</script>
<script type="text/javascript">
	

		close();
	
</script>


<script language="JavaScript" type="text/javascript">
function imprimirPagina() { if (window.print) window.print(); else alert("Lo siento, pero a tu navegador no se le puede ordenar imprimir" + " desde la web. Actualizate o hazlo desde los menús"); }
</script>

<?php 
        }
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<style type="text/css">
<!--
.style7 {font-size: 9px}
.style12 {font-size: 10px}
.Estilo3 {font-size: 16px; font-family: "Times New Roman", Times, serif; color: #FFFFFF; font-weight: bold; }
.Estilo24 {font-size: 10px}
.style17 {color: #000000; font-size: 10px; font-weight: bold; }
-->
</style>
</head>
<h1 align="center">HOSPITAL LA CARLOTA</h1>
<h4 align="center">Ordenes de cargo </h4>
<form id="form1" name="form1" method="post" action="">
  <table width="577" border="0" align="center">
    <tr>
      <th width="93" scope="col"><div align="left"><span class="style17">Hora/Fecha</span></div></th>
      <th width="157" scope="col"><div align="left"><span class="style17">Paciente - Cuarto</span></div></th>
      <th width="177" scope="col"><div align="left"><span class="style17">Descripci&oacute;n</span></div></th>
    </tr>
    <tr>
<?php 
        $sSQL18 = "\r\nSELECT \r\n*\r\nFROM\r\ncargosCuentaPaciente\r\nWHERE \r\nentidad='" . $entidad . "'\r\nand\r\nstatusImpresionSolicitud='standby'\r\nand\r\nusuario='" . $_GET['usuario'] . "'\r\norder by codProcedimiento ASC\r\n";
        $result18 = mysql_db_query($basedatos, $sSQL18);
        while ($myrow18 = mysql_fetch_array($result18)) {
            $q = "UPDATE cargosCuentaPaciente set \r\nstatusImpresionSolicitud='cargado'\r\nwhere\r\n\r\nkeyCAP='" . $myrow18['keyCAP'] . "'\r\n";
            mysql_db_query($basedatos, $q);
            echo mysql_error();
            $requi = $myrow18['id_requisicion'];
            $id_proveedor = $myrow18['id_proveedor'];
            $id_almacen = $myrow18['id_almacen'];
            $b += '1';
            $a += '1';
            if ($col) {
                $color = '#CCCCCC';
                $col = "";
            } else {
                $color = '#FFFFFF';
                $col = 1;
            }
            $code1 = $myrow18['codProcedimiento'];
            $sSQL4 = "Select * From articulos WHERE entidad='" . $entidad . "' and codigo= '" . $code1 . "'";
            $result4 = mysql_db_query($basedatos, $sSQL4);
            $myrow4 = mysql_fetch_array($result4);
            $descripcion = $myrow4['descripcion'];
            $sSQL7 = "Select * From existencias WHERE entidad='" . $entidad . "' and codigo= '" . $code1 . "' and almacen='HALM'";
            $result7 = mysql_db_query($basedatos, $sSQL7);
            $myrow7 = mysql_fetch_array($result7);
            $sSQL1 = "Select * From clientesInternos WHERE entidad='" . $entidad . "' and numeroE= '" . $myrow18['numeroE'] . "' \r\nand\r\nnCuenta='" . $myrow18['nCuenta'] . "'\r\n";
            $result1 = mysql_db_query($basedatos, $sSQL1);
            $myrow1 = mysql_fetch_array($result1);
            ?>
      <td height="24" bgcolor="<?php 
            echo $color;
            ?>
" class="style12"><div align="center"><span class="style7">
      </span><span class="style7">
      <?php 
            echo $myrow18['hora1'] . "-" . cambia_a_normal($myrow18['fecha1']);
            ?>
      </span></div>        
        <span class="style7"><label></label>
        <div align="center"></div>
      </span></td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="style12"><span class="style7">
        <?php 
            echo $myrow1['paciente'] . "-" . $myrow1['cuarto'];
            ?>
      </span></td>
      <td bgcolor="<?php 
            echo $color;
            ?>
" class="style12"><span class="style7"><?php 
            echo $descripcion;
            ?>
<span class="Estilo24">
        <input name="codigoAlfa[]" type="hidden" id="codigoAlfa[]" value="<?php 
            echo $code1;
            ?>
" />
      </span></span></td>
    </tr>
    <?php 
        }
        //cierra while
        ?>
  </table>
  <div align="center">  </div>
  <p align="center">
    <input name="cerrar" type="submit" class="style7" id="cerrar" value="Cerrar" />
  </p>
</form>
</body>
</html>
<?php 
    }
">

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


      <td height="24" bgcolor="<?php 
                echo $color;
                ?>
"><div align="left" >
          <?php 
                echo $myrow18['horaSolicitud'] . "</br>" . cambia_a_normal($myrow18['fechaSolicitud']);
                ?>
        </span></div>
        <span ><label></label>
        <div align="left"></div>
      </span></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" ><span >
        <?php 
                $descripcion = new articulosDetalles();
                $descripcion->descripcion($entidad, $keyCAP, $numeroE, $nCuenta, $codigo, $basedatos);
                ?>
        <input name="codigoAlfa[]" type="hidden" id="codigoAlfa[]" value="<?php 
                echo $code1;
$result1 = mysql_db_query($basedatos, $sSQL1);
$myrow1 = mysql_fetch_array($result1);
//*****************************************************
$pdf->SetXY(2, 17);
//*
$pdf->Cell(0, 0, $myrow1['descripcionCaja'], 0, 0, M);
//*
$pdf->SetX(1);
//*
//*****************************************************
$pdf->SetXY(2, 20);
$pdf->Cell(0, 0, 'Num. Corte: ' . $_GET['numCorte'], 0, 0, M);
$pdf->SetXY(2, 24);
$pdf->Cell(0, 0, 'Fecha Apertura: ' . cambia_a_normal($myrow1a['fechaApertura']) . ' ' . $myrow1a['horaApertura'], 0, 0, M);
$pdf->SetXY(30, 24);
$pdf->Cell(0, 0, 'Fecha Cierre: ' . cambia_a_normal($myrow1a['fechaCorte']) . ' ' . $myrow1a['horaCorte'], 0, 0, R);
//***********************************EFECTIVO SOLAMENTE***********************************
$pdf->SetFont('Arial', '', 10);
$pdf->line(2, 32, 203, 32);
$pdf->SetXY(2, 30);
$pdf->Cell(0, 0, 'Folio', 0, 0, M);
$pdf->SetXY(15, 30);
$pdf->Cell(0, 0, 'Recibo', 0, 0, M);
$pdf->SetXY(30, 30);
$pdf->Cell(0, 0, 'Descripción', 0, 0, M);
//*************TRANSACCIONES***************
$pdf->SetXY(170, 30);
$pdf->Cell(0, 0, 'Cargos', 0, 0, M);
$pdf->SetXY(190, 30);
$pdf->Cell(0, 0, 'Abonos', 0, 0, M);
//****************************************
            $existencias = 'si';
        } else {
            $existencias = NULL;
        }
    }
    ?>
  <tr >
    <td height="48" ><?php 
    echo $bandera;
    echo '<br>';
    print $myrow['keyCAP'];
    ?>
</td>
    <td ><span >
      <?php 
    print cambia_a_normal($myrow['fechaSolicitud']) . " " . $myrow['horaSolicitud'];
    ?>
    </span></td>
    <td ><span >
      <div align="left" ><a href="#"  onclick="javascript:ventanaSecundaria('<?php 
    echo CONSTANT_PATH_SIMA_RAIZ;
    ?>
/cargos/cambiarArticulos.php?numeroE=<?php 
    echo $myrow['numeroE'];
    ?>
		&amp;nCuenta=<?php 
    echo $myrow['nCuenta'];
    ?>
&amp;almacen=<?php 
    echo $bali;
    ?>
<?php 
if($myrow['cantidadoPorcentaje']=='no'){
echo 'readonly=""';
}
?>
/>
         
        </span></td>
        <td bgcolor="<?php echo $color?>" class="Estilo24"><span class="style7">
          <?php 
	  echo cambia_a_normal($myrow['fechaInicial']);
	 // echo $myrow2['existencias'];
	 
	  ?>
        </span></td>
        <td bgcolor="<?php echo $color?>" class="Estilo24"><label><span class="style7"><?php echo cambia_a_normal($myrow['fechaFinal'],2);
	  ?>
     
        </span></label></td>
        <td bgcolor="<?php echo $color?>" class="Estilo24">
		
		<input name="keyConvenios[]" type="checkbox" id="keyConvenios[]" value="<?php echo $myrow['keyConvenios']; ?>" /></td>
      </tr>
      <?php  
	  $bandera+='1';
	  }  //cierra while
	  ?>
  </table>
    <p align="center"><em> 
	
	

      <td bgcolor="<?php 
                echo $color;
                ?>
"><span >
        <?php 
                echo $myrow18['horaSolicitud'] . "</br>" . cambia_a_normal($myrow18['fechaSolicitud']);
                ?>
      </span></td>
      <td height="24" bgcolor="<?php 
                echo $color;
                ?>
"><div align="left" >
          <?php 
                echo $myrow18['horaCargo'] . "</br>" . cambia_a_normal($myrow18['fechaCargo']);
                ?>
        </span></div>
        <span class="style7"><label></label>
        <div align="center"></div>
      </span></td>
      <td bgcolor="<?php 
                echo $color;
                ?>
" >
        <?php 
                $descripcion = new articulosDetalles();
                $descripcion->descripcion($entidad, $keyCAP, $numeroE, $nCuenta, $codigo, $basedatos);
                ?>
        <span class="Estilo24">
        <input name="codigoAlfa[]" type="hidden" id="codigoAlfa[]" value="<?php 
Esempio n. 19
0
    public function listadoServicios($entidad, $almacenSolicitante, $codigo, $basedatos)
    {
        if (!$_POST['almacenDestino']) {
            $_POST['almacenDestino'] = $ALMACEN;
        }
        ?>


<?php 
        function cambia_a_normal($fecha)
        {
            ereg("([0-9]{2,4})-([0-9]{1,2})-([0-9]{1,2})", $fecha, $mifecha);
            $lafecha = $mifecha[3] . "/" . $mifecha[2] . "/" . $mifecha[1];
            return $lafecha;
        }
        ?>

<script language=javascript> 
function ventanaSecundaria (URL){ 
   window.open(URL,"ventana","width=350,height=170,scrollbars=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria2 (URL){ 
   window.open(URL,"ventana2","width=660,height=800,scrollbars=YES") 
} 
</script> 
<?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();
            }
        }
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<style type="text/css">
<!--
.style7 {
	font-size: 9px;
	color: #FFFFFF;
}
.style11 {color: #FFFFFF; font-size: 10px; font-weight: bold; }
.style12 {font-size: 10px}
.Estilo3 {font-size: 16px; font-family: "Times New Roman", Times, serif; color: #FFFFFF; font-weight: bold; }
.style14 {color: #0000FF}
.style18 {font-size: 10px; font-style: italic; }
.Estilo24 {font-size: 10px}
.style19 {font-size: 9px}
.style71 {font-size: 9px}
.style71 {font-size: 9px}
.style71 {font-size: 9px}
-->
</style>
</head>

<body>
<h1 align="center">LISTADO DE SERVICIOS </h1>
<form id="form2" name="form2" method="post" action="">
  <table width="545" border="0" align="center">
    <tr>
      <th width="153" scope="col"><div align="left"><span class="style12">Servicios</span></div></th>
      <th width="382" scope="col"><div align="left"><span class="style12">
          <input name="nomArticulo" type="text" class="style12" id="nomArticulo" size="80" 
		  
		  value="<?php 
        if ($_POST['nomArticulo']) {
            echo $_POST['nomArticulo'];
        }
        ?>
"/>
</span></div>      </th>
    </tr>
    <tr>
      <th height="43" scope="col">&nbsp;</th>
      <th scope="col"><div align="left">
        <input name="buscar" type="submit" class="Estilo24" id="buscar" value="buscar" />
        <?php 
        if ($_POST['nomArticulo'] === '*') {
            ?>
        <span class="style18">Este proceso puede demorar varios minutos...</span>
        <?php 
        }
        ?>
      </div>
      <label>      </label></th>
    </tr>
  </table>
</form>
<p align="center" class="style14">
  <?php 
        if ($_POST['buscar'] and $_POST['nomArticulo']) {
            $articulo = $_POST['nomArticulo'];
            if ($articulo == '*') {
                $sSQL = "\r\nSELECT * FROM articulos\r\n\r\n WHERE \r\n articulos.entidad='" . $entidad . "' AND\r\n articulos.servicio='si' AND\r\n \r\narticulos.activo!='cancelado' \r\n\r\n order by articulos.descripcion ASC";
            } else {
                $sSQL = "\r\nSELECT * FROM articulos\r\nWHERE articulos.entidad='" . $entidad . "' AND\r\n articulos.servicio='si' and\r\narticulos.descripcion like '%{$articulo}%'\r\nand\r\narticulos.activo!='cancelado'\r\ngroup by articulos.codigo\r\n order by articulos.descripcion ASC";
            }
            if ($result = mysql_db_query($basedatos, $sSQL)) {
                ?>
</p>
      <form id="form1" name="form1" method="get" action="<?php 
                echo $modifica = 'modificaP.php';
                ?>
">
  <p>&nbsp;</p>
  <table width="783" border="0" align="center" class="style19">
    <tr>

      <th width="408" bgcolor="#FFCCFF" class="style12" scope="col"><div align="left"><span class="style12">Descripci&oacute;n</span></div></th>
      <th width="116" bgcolor="#FFCCFF" class="style12" scope="col"><div align="left"><span class="Estilo24">Fecha Mod. </span></div></th>
      <th width="44" bgcolor="#FFCCFF" class="style12" scope="col"><div align="left"><span class="Estilo24">Precios</span></div></th>
      <th width="49" bgcolor="#FFCCFF" class="style12" scope="col"><div align="left">Modificar </div></th>
      <th width="48" bgcolor="#FFCCFF" class="style12" scope="col"><div align="left">Status </div></th>
    </tr>
    <tr>

<?php 
                while ($myrow = mysql_fetch_array($result)) {
                    echo mysql_error();
                    $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'] == "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);
                    $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'];
                    ?>
      
      <td  bgcolor="<?php 
                    echo $color;
                    ?>
" ><div align="left"><span class="">
	  <?php 
                    echo $myrow15['descripcion'];
                    ?>
        <?php 
                    if (!$bali) {
                        echo '<img src="' . CONSTANT_PATH_SIMA_RAIZ . '/imagenes/candado.png" alt="NO TIENE ASIGNADO NINGUN PRECIO O ALMACEN" width="13" height="13" border="0" />';
                    }
                    ?>
    </span></div></td>
    
	  <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="style12"><?php 
                    if ($myrow['fechaActualizacion']) {
                        echo $myrow['usuario'] . " " . cambia_a_normal($myrow['fechaActualizacion']) . " " . $myrow['hora'];
                    } else {
                        echo '...';
                    }
                    ?>
</td>
	  <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="style12"><div align="left"><span class=""> <a href="javascript:ventanaSecundaria2('<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/cargos/listaAlmacenes.php?codigo=<?php 
                    echo $code;
                    ?>
&amp;seguro=<?php 
                    echo $_POST['seguro'];
                    ?>
&amp;medico=<?php 
                    echo $_POST['medico'];
                    ?>
&amp;usuario=<?php 
                    echo $usuario;
                    ?>
&amp;keyPA=<?php 
                    echo $myrow['keyPA'];
                    ?>
')"> <img src="<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/imagenes/almacen.jpeg" alt="Almacenes" width="12" height="12" border="0" /></a> </span></div></td>
	  <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="style12"><div align="left"><a href="<?php 
                    echo $modifica;
                    ?>
?nRequisicion=<?php 
                    echo $requisicion;
                    ?>
&amp;almacen=
		<?php 
                    echo $myrow13['seguro'];
                    ?>
&amp;medico=<?php 
                    echo $_GET['medico'];
                    ?>
&amp;codigo=<?php 
                    echo $codigo;
                    ?>
&amp;almacen=<?php 
                    echo $_POST['almacenDestino1'];
                    ?>
"><img src="<?php 
                    echo CONSTANT_PATH_SIMA_RAIZ;
                    ?>
/imagenes/Save.png" alt="Modificaci&oacute;n de Art&iacute;culos, M&aacute;ximo, M&iacute;nimo, Reorden.." width="12" height="12" border="0" /> </a> </div></td>
	  <?php 
                    $sSQL151 = "SELECT articulos.codigo\r\nFROM\r\narticulos,articulosPaquetes\r\nWHERE articulos.entidad='" . $entidad . "' AND\r\narticulos.codigo = '" . $code . "'  and\r\narticulos.codigo=articulosPaquetes.codigo\r\nand\r\narticulos.entidad=articulosPaquetes.entidad\r\ngroup by articulos.codigo\r\n  ";
                    $result151 = mysql_db_query($basedatos, $sSQL151);
                    $myrow151 = mysql_fetch_array($result151);
                    if ($myrow151['codigo']) {
                        $ventanita = CONSTANT_PATH_SIMA_RAIZ . '/cargos/ventanitaCambiaPVyP.php';
                    } else {
                        $ventanita = CONSTANT_PATH_SIMA_RAIZ . '/ADMINHOSPITALARIAS/inventarios/ventanitaCambiaPrecio.php';
                    }
                    ?>
	  
	  
	  
      <td bgcolor="<?php 
                    echo $color;
                    ?>
" class="style12"><span class="style71">
        <?php 
                    if ($myrow['activo'] == 'A') {
                        ?>
      </span> <span class="Estilo24"> <a href="catalogoAlmacen.php?codigo5=<?php 
                        echo $code;
                        ?>
&amp;seguro=<?php 
                        echo $_POST['seguro'];
                        ?>
&amp;inactiva=<?php 
                        echo 'inactiva';
                        ?>
&amp;tipoAlmacen=<?php 
                        echo $_POST['tipoAlmacen'];
                        ?>
&amp;codigo=<?php 
                        echo $C;
                        ?>
"> <img src="<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/imagenes/surtido.png" alt="ACTIVO" width="12" height="12" border="0" onClick="if(confirm('&iquest;Est&aacute;s seguro que deseas inactivar este registro?') == false){return false;}" /></a>
      <?php 
                    } else {
                        ?>
      <a href="catalogoAlmacen.php?codigo5=<?php 
                        echo $code;
                        ?>
&amp;seguro=<?php 
                        echo $_POST['seguro'];
                        ?>
&amp;activa=<?php 
                        echo "activa";
                        ?>
&amp;usuario=<?php 
                        echo $E;
                        ?>
&amp;tipoAlmacen=<?php 
                        echo $_POST['tipoAlmacen'];
                        ?>
&amp;codigo=<?php 
                        echo $C;
                        ?>
"> <img src="<?php 
                        echo CONSTANT_PATH_SIMA_RAIZ;
                        ?>
/imagenes/candado.png" alt="INACTIVO" width="12" height="12" border="0"  onclick="if(confirm('Esta seguro que deseas activar este registro?') == false){return false;}" /></a>
      <?php 
                    }
                    ?>
      </span></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>
</body>
</html>
<?php 
    }
Esempio n. 20
0
        $a += '1';
        $art = $myrow81['codProcedimiento'];
        $codigo = $proc = $myrow81['codProcedimiento'];
        $keyCAP = $myrow81['keyCAP'];
        ?>


  <td height="21" bgcolor="<?php 
        echo $color;
        ?>
" class="Estilo24"><span class="<?php 
        echo $estilo;
        ?>
">
	  <?php 
        echo $myrow81['hora1'] . " " . cambia_a_normal($myrow81['fecha1']);
        ?>
</span></td>
      <td bgcolor="<?php 
        echo $color;
        ?>
" class="Estilo24"><span class="<?php 
        echo $estilo;
        ?>
"><span class="style12"><span class="style7">
      <?php 
        $descripcion = new articulosDetalles();
        $descripcion->descripcion($keyCAP, $numeroE, $nCuenta, $codigo, $basedatos);
        ?>
      </span></span>        <span class="style12">
		
    echo $myrow['usuario'];
    ?>
')">
        <?php 
    echo $myrow8aa['descripcion'];
    ?>
      </a> </span></td>



      <td class="normal"><?php 
    echo $myrow['usuario'];
    ?>
</td>
     <td class="normal"><?php 
    echo cambia_a_normal($myrow['fecha1']);
    echo '</br>';
    echo $myrow['hora1'];
    ?>
     </td>
    </tr>
    <?php 
}
?>
    <tr>
      <td colspan="6"><img src="../../imagenes/bordestablas/borde2.png" width="400" height="20" /></td>
    </tr>
  </table>
  <p>&nbsp;</p>
  <p align="center"><span class="style7">
//establece el nombre del paciente

$pdf->SetXY(2,5);
$pdf->Cell(0,0,'DETALLES',0,0,M);
$pdf->SetX(1);


//*****************ech*************





$fecha1=$_GET['fecha'];
$pdf->SetY(10);
$pdf->Cell(0,0,'Fecha Inicial: '.cambia_a_normal($_GET['fechaInicial']).' a la fecha: '.cambia_a_normal($_GET['fechaFinal']),0,0,R);



$pdf->SetXY(2,10);
$pdf->Cell(0,0,"HOSPITAL LA CARLOTA",0,0,M);
$pdf->SetX(1); 


//***********************************EFECTIVO SOLAMENTE***********************************


$pdf->SetFont('Arial','',10);
$pdf->line(2,32,203,32);

fechaInicial <= '".$fecha1."' 
";
$re=mysql_db_query($basedatos,$sSQL45z);
$si = mysql_fetch_array($re);


if(!$si['usuario']){ 

$sSQL45z1= "Select usuario,fechaInicial,fechaFinal,keyCredencial from pacientesCredenciales where entidad='".$entidad."' 
and numeroE='".$_POST['numeroEx']."' and seguro='".$_POST['seguro']."' 
";
$re1=mysql_db_query($basedatos,$sSQL45z1);
$si1 = mysql_fetch_array($re1);
?>
<script>
window.alert("La credencial: #<?php echo $si1['keyCredencial'];?> expir?z en: <?php echo cambia_a_normal($si1['fechaFinal']);?>, por lo cual est? bloqueada o cancelada..!");
window.close();
</script>
<?php }
}
}



if($_GET['almacen']){
$ALMACEN=$_GET['almacen'];
} else {
$_GET['almacen']=$ALMACEN;
}
?>
Esempio n. 24
0
                <td  >
          <label>
          <div align="center">
              <a href="javascript:ventanaSecundaria4('../cargos/despliegaCargos.php?folioVenta=<?php echo $myrow['folioVenta'];?>');">
            <?php echo $myrow['folioVenta'];?>
              </a>
          </div>
          </label>
      </td>



        <td >
          <div align="center">
      <?php echo cambia_a_normal($myrow['fecha']);?>

        </div>
        </span></td>


        
        <td >
                <div align="left">
                  <?php  echo $myrow['paciente'];
		?>
                </div>
        </td>
    
     
        <td >
Esempio n. 25
0
$pdf->Cell(0, 0, 'Usuario Cargo: ' . $_GET['usuarioCargo'], 0, 0, L);
$pdf->SetXY(2, 16);
$pdf->SetFont('Arial', '', 8);
$pdf->Cell(0, 0, 'Fecha Cargo: ' . cambia_a_normal($_GET['fecha']), 0, 0, L);
$pdf->SetXY(2, 19);
$pdf->SetFont('Arial', '', 8);
$pdf->Cell(0, 0, 'Hora Cargo: ' . $_GET['hora'], 0, 0, L);
$pdf->SetXY(2, 22);
$pdf->SetFont('Arial', '', 8);
$pdf->Cell(0, 0, 'Departamento: ' . $_GET['departamentoSolicitante'], 0, 0, L);
$pdf->SetXY(50, 13);
$pdf->SetFont('Arial', '', 8);
$pdf->Cell(0, 0, 'Usuario Solicita: ' . $_GET['usuarioSolicitante'], 0, 0, M);
$pdf->SetXY(50, 16);
$pdf->SetFont('Arial', '', 8);
$pdf->Cell(0, 0, 'Fecha Solicita: ' . cambia_a_normal($_GET['fechaSolicitud']), 0, 0, M);
$pdf->SetXY(50, 19);
$pdf->SetFont('Arial', '', 8);
$pdf->Cell(0, 0, 'Hora Solicita: ' . $_GET['horaSolicitud'], 0, 0, M);
$pdf->SetFont('Arial', '', 10);
$pdf->line(2, 32, 203, 32);
$pdf->SetXY(2, 30);
$pdf->Cell(0, 0, '#', 0, 0, M);
$pdf->SetXY(15, 30);
$pdf->Cell(0, 0, 'Descripcion', 0, 0, M);
//$pdf->SetXY(140,30);
//$pdf->Cell(0,0,'Hora',0,0,M);
//
//$pdf->SetXY(160,30);
//$pdf->Cell(0,0,'Fecha',0,0,M);
$pdf->SetXY(140, 30);
}
//referencia
$pdf->SetXY(2, 45);
$pdf->Cell(0, 0, 'Referencia: ' . $myrow311['folioVenta'], 0, 0, L);
//numero de paciente
//$pdf->SetXY(302,25);
$pdf->SetXY(2, 25);
$pdf->Cell(0, 0, 'Recibo: ' . $myrow311['numRecibo'], 0, 0, R);
//cambiar fecha
//$myrow1['fecha1']=cambia_a_normal($myrow1['fecha1']);
$fecha1 = date("d/m/Y");
$pdf->SetY(30);
$pdf->Cell(0, 0, 'Fecha: ' . $fecha1, 0, 0, R);
//Citas
$pdf->SetY(34);
$pdf->Cell(0, 0, 'Hora/Fecha de Solicitud: ' . $myrow311['hora'] . '-' . cambia_a_normal($myrow311['fecha1']), 0, 0, R);
//Status
if ($myrow311['statusPaciente']) {
    $pdf->SetY(38);
    $pdf->Cell(0, 0, 'Tipo Px: ' . $myrow311['statusPaciente'], 0, 0, R);
}
//Usuario
$pdf->SetY(42);
$pdf->Cell(0, 0, 'Usuario Autoriz�: ' . $myrow311['usuario'], 0, 0, R);
//Credencial/N�mina
if ($myrow311['credencial']) {
    $pdf->SetY(45);
    $pdf->Cell(0, 0, 'Credencial/N�mina: ' . $myrow311['credencial'], 0, 0, R);
}
$pdf->SetFont('Arial', '', 10);
//$pdf->SetXY(2,37);
Esempio n. 27
0
entidad='".$entidad."'
and
almacen='".$myrow['almacenSolicitud']."'  ";
$result39=mysql_db_query($basedatos,$sSQL39);
$myrow39 = mysql_fetch_array($result39);

?>



        <tr bgcolor="#ffffff" onMouseOver="bgColor='#cccccc'" onMouseOut="bgColor='#ffffff'" >
       <td class="normal"><?php 
	echo $myrow['numeroE'];
	  ?></td>
       <td  class="normal"><?php 
	echo cambia_a_normal($myrow['fechaSolicitud']);
	  ?></td>
       <td  class="normal"><?php 
echo $myrow['paciente'];
echo '</br>';
echo $myrow['folioVenta'];
	  ?></td>
       <td  class="normal"><?php 
	echo $myrow['credencial'];
	  ?></td>
       <td  class="normal" ><?php 
	  
	 echo $myrow['statusPaciente'];
	  ?></td>

       <td  class="normal" ><?php 
Esempio n. 28
0
    public function eCuentaE($fecha1, $hora1, $dia, $usuario, $nT, $basedatos)
    {
        include CONSTANT_PATH_CONFIGURACION . "/funciones.php";
        $cargosCia = new acumulados();
        ?>
<script language=javascript> 
function ventanaSecundaria4 (URL){ 
   window.open(URL,"ventana4","width=800,height=300,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script>
<script language=javascript> 
function ventanaSecundaria2 (URL){ 
   window.open(URL,"ventana2","width=630,height=500,scrollbars=YES,scrollbars=YES,resizable=YES, maximizable=YES") 
} 
</script> 
<script language=javascript> 
function ventanaSecundaria1 (URL){ 
   window.open(URL,"ventana1","width=530,height=300,scrollbars=YES") 
} 
</script> 

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

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

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

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

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

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




<?php 
        //************************ACTUALIZO **********************
        //********************Llenado de datos
        $sSQL3 = "Select * From clientesInternos WHERE keyClientesInternos = '" . $_GET['nT'] . "' ";
        $result3 = mysql_db_query($basedatos, $sSQL3);
        $myrow3 = mysql_fetch_array($result3);
        $numeroE = $myrow3['numeroE'];
        $nCuenta = $myrow3['nCuenta'];
        $cuarto = $myrow3['cuarto'];
        //***************aplicar pago**********************
        if ($_POST['actualizar']) {
            $particular = $_POST['particular'];
            $aseguradora = $_POST['aseguradora'];
            for ($i = 0; $i <= $_POST['bandera2']; $i++) {
                if ($aseguradora[$i]) {
                    $status = 'efectivo';
                    $keyCAP[] = $aseguradora[$i];
                } else {
                    $status = 'cxc';
                    $keyCAP[] = $particular[$i];
                }
                $agrega = "UPDATE cargosCuentaPaciente set \r\nstatusAlta='" . $status . "',\r\nusuarioAlta='" . $usuario . "',\r\nfechaAlta='" . $fecha1 . "',\r\nhoraAlta='" . $hora1 . "'\r\n\r\nwhere\r\nkeyCAP='" . $keyCAP[$i] . "' \r\n";
                mysql_db_query($basedatos, $agrega);
                echo mysql_error();
            }
            //cierra for
        }
        //cierra actualizar
        $cargosParticulares = new acumulados();
        $totalxSurtir = new acumulados();
        $cargosAseguradora = new acumulados();
        $otros = new acumulados();
        if ($_POST['imprimir']) {
            ?>
<script>
javascript:ventanaSecundaria2('<?php 
            echo CONSTANT_PATH_SIMA_RAIZ;
            ?>
/INGRESOS%20HLC/caja/imprimeCaja2.php?numeroE=<?php 
            echo $numeroE;
            ?>
&amp;nCuenta=<?php 
            echo $nCuenta;
            ?>
&amp;paciente=<?php 
            echo $_POST['paciente'];
            ?>
&amp;numeroConfirmacion=<?php 
            echo $numeroConfirmacion;
            ?>
&amp;hora1=<?php 
            echo $hora1;
            ?>
');
</script>
<?php 
        }
        ?>
<!-Hoja de estilos del calendario --> 
  <link rel="stylesheet" type="text/css" media="all" href="<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/calendario/calendar-tas.css" title="win2k-cold-1" /> 

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

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

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

<script>

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

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


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


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




<BODY >

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

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




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

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

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

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


  </div>
  <p align="center">
<?php 
        if (!$totalCargos) {
            ?>
    <input name="imprimir" type="submit" class="style7" id="aplicarPago" value="Imprimir" />
	<?php 
        }
        ?>
	<input name="Submit" type="button" class="style7" value="Aplicar Pagos"  onClick="javascript:ventanaSecundaria7('<?php 
        echo CONSTANT_PATH_SIMA_RAIZ;
        ?>
/INGRESOS%20HLC/caja/ventanaAplicaPagoInternos.php?numeroE=<?php 
        echo $numeroE;
        ?>
		&amp;almacen=<?php 
        echo $bali;
        ?>
&amp;seguro=<?php 
        echo $_POST['seguro'];
        ?>
&amp;nCuenta=<?php 
        echo $myrow3['keyClientesInternos'];
        ?>
&amp;tipoCliente=<?php 
        echo 'particular';
        ?>
')"/>
  </p>


</form>

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

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





     <tr>
       <td ><?php 
                echo $f;
                ?>
</td> 
       <td ><span >

	   <?php 
                if ($myrow11['fecha'] != NULL) {
                    echo cambia_a_normal($myrow11['fecha']);
                } else {
                    echo '---';
                }
                ?>
	 
	   </span></td>
       
           <td ><span >
           <?php 
                if ($especial == TRUE) {
                    echo $myrow11['sustancia'];
                } else {
                    echo $myrow11['descripcion'];
                }
                ?>
        $result7a = mysql_db_query($basedatos, $sSQL7a);
        $myrow7a = mysql_fetch_array($result7a);
        $totales[0] += $myrow7c['cargos'] - $myrow7a['abonos'];
        ?>
        <td bgcolor="<?php 
        echo $color;
        ?>
" class="codigosmid"><label><?php 
        echo $myrow['folioVenta'];
        ?>
</label></td>
        <td bgcolor="<?php 
        echo $color;
        ?>
" class="normalmid"><?php 
        echo cambia_a_normal($fecha1);
        ?>
</td>
        <td bgcolor="<?php 
        echo $color;
        ?>
" class="normalmid"><?php 
        echo '$' . number_format($myrow7c['cargos'] - $myrow7a['abonos'], 2);
        ?>
</td>
      </tr>
      <?php 
    }
    //cierra while
    ?>
    </table>