Example #1
0
</head>
<body><p><br></p>
<div style="text-align:center;"> Aguarde mientras obtenemos la/s última/s cotización del Dolar</div>

<div id="content">
<!-- Progress bar holder -->
<div id="progress" style="width:500px;border:1px solid #ccc;"></div>
<!-- Progress information -->
<div id="information" style="width"></div>

</div>
<?php 
sleep(1);
$fechaInicio = strtotime($nuevafecha) + 86400;
$fechaFin = strtotime($fecha);
$total = dias_transcurridos($nuevafecha, $fecha);
$x = 1;
for ($i = $fechaInicio; $i <= $fechaFin; $i += 86400) {
    $percent = intval($x / $total * 100) . "%";
    $x++;
    $fecha = date("Y-m-d", $i);
    $name = nombrearchivo(date("Y-m-d", $i));
    /*Busco en el BCU los datos de las cotizaciones*/
    $salida = shell_exec('/var/www/html/servicemcc/tipocambio/tmp/cotiz ' . $name) . "\n";
    $valor = file_get_contents('tmp/' . $name);
    $Borro = shell_exec('rm /var/www/html/servicemcc/tipocambio/tmp/' . $name);
    $valor = str_replace(",", ".", $valor);
    if (!empty($valor) and $valor != 0) {
        $sql_chek = "SELECT * FROM `tipocambio` WHERE `fecha` = '" . $fecha . "' LIMIT 0 , 1 ";
        $rs_chek = mysql_query($sql_chek);
        if (mysql_num_rows($rs_chek) == 0) {
Example #2
0
<?php

include "../dll/config.php";
include "../dll/mysql.php";
extract($_POST);
$fecha_actual = date("Y-m-d");
$dias = dias_transcurridos($fecha_nacimiento, $fecha_actual);
$anios = $dias / 365;
if ($anios > 0 and $anios <= 2.9) {
    $tipo_paciente = "Bebe";
}
if ($anios >= 3 and $anios <= 12.9) {
    $tipo_paciente = "Ninio";
}
if ($anios >= 13 and $anios <= 18.9) {
    $tipo_paciente = "Adolecente";
}
if ($anios > 19 and $anios <= 49.9) {
    $tipo_paciente = "Adulto";
}
if ($anios >= 50 and $anios <= 65) {
    $tipo_paciente = "Mayor";
}
if ($anios > 65) {
    $tipo_paciente = "3ra edad";
}
$query = "insert into atenciones_medicas values('','{$nombre}','{$apellido}','{$cedula}','{$genero}','{$fecha_nacimiento}','{$correo}','{$direccion}','{$tipo_paciente}','{$medico}','{$sintomas}','{$prescripcion}','{$indicaciones}')";
$result = mysql_query($query) or die('Consulta fallida: ' . mysql_error());
$query1 = "select max(id) from atenciones_medicas";
$result1 = mysql_query($query1) or die('Consulta fallida: ' . mysql_error());
while ($line = mysql_fetch_row($result1)) {
           echo "<td>" . utf8_encode($ds[9]) . "</td>";
           echo "<td>" . $ds[3] . "</td>";
           echo "<td>" . $ds[4] . "</td>";
           echo "<td>" . $ds[5] . "</td>";
           echo "<td>" . $ds[6] . "</td>";
           if ($ds[7] == 1) {
               $dias = dias_transcurridos(date("Y-m-d"), $ds[4]);
               echo "<th><div></div>" . $dias['estado'] . " " . $dias['cantidad'] . " dias  </th>";
               if (date('Y-m-d') > $ds[4]) {
                   echo "<th><a class='btn btn-danger'>Proceso Retrasado</a></th>";
               } else {
                   echo "<th><a class='btn btn-warning'>En proceso</a></th>";
               }
           } else {
               //echo "<th>Finalizado el proceso</th>";
               $dias = dias_transcurridos($ds[5], $ds[4]);
               echo "<th> Se culmino " . $dias['estado1'] . " " . $dias['cantidad'] . " Dias</th>";
               if ($ds[5] > $ds[4]) {
                   echo "<th><a class='btn btn-success'>Finalizado,Fecha Retrasada</a></th>";
               } else {
                   echo "<th><a class='btn btn-success'>Finalizado</a></th>";
               }
           }
           if ($_SESSION['perfil'] == "PRESIDENTE DE PROYECTO DE INVESTIGACION" || $_SESSION['idperil'] == 3) {
               if ($_SESSION['idusuario'] == $ds[8] || $_SESSION['perfil'] == "PRESIDENTE DE PROYECTO DE INVESTIGACION") {
                   //if($)
                   if ($ds[7] == 1) {
                       ?>
 <input type='hidden' name='cls' id=cls'' value='1' class='cls<?php 
                       echo $l[0];
                       ?>
Example #4
0
function calcularCostoEstadia($fechaIn, $fechaOut, $cuentaId)
{
    $request = Slim::getInstance()->request();
    $sql_query = "SELECT h.tarifa\n                FROM habitacion h left join clase_habitacion t on (h.tipo_habitacion=t.id)\n                left join estadia e on (e.habitacion=h.id)\n                left join cuenta c on (c.id=e.idReserva)\n                where c.id = :cuentaId";
    try {
        $dbCon = getDB();
        $stmt = $dbCon->prepare($sql_query);
        $stmt->bindParam("cuentaId", $cuentaId);
        $stmt->execute();
        $total = 0;
        $habitaciones = $stmt->fetchAll(PDO::FETCH_OBJ);
        $dias = dias_transcurridos($fechaIn, $fechaOut);
        foreach ($habitaciones as $item) {
            $sum = 0;
            $sum = $item->tarifa * $dias;
            $total = $sum + $total;
        }
        $dbCon = null;
        return $total;
    } catch (PDOException $e) {
        echo '{"error inesperado" : {"text":' . $e->getMessage() . '}}';
    }
}
		$importe=(($sueldoDiario*40)/365)*$diasTranscurridos;
		$importe = number_format($importe, 2, ".", "");
	break;
		//--------------------------- Para prima vacacional -----------------
	case '119':
		$diasP=$_POST['dias'];
		$sql="SELECT e.fechaingr,SUM(n.importe) AS importe FROM";
		$sql.=" nomina n INNER JOIN nominaemp e ON n.idnominaemp=e.idnominaemp";
  		$sql.=" WHERE (n.concepto=101 AND n.idnominaemp=$_POST[idnominaemp]) OR
		 			(n.concepto=114 AND n.idnominaemp=$_POST[idnominaemp])";
		$res_sb = mysqli_query( $conexion, $sql );
		$ren_sb = mysqli_fetch_array( $res_sb );
		mysqli_free_result( $res_sb );
		$sueldoDiario=($ren_sb['importe']*2)/30;
		$ultimoDA=date('Y')."-12-31";
		$diasTranscurridos=dias_transcurridos($ren_sb['fechaingr'],$ultimoDA);
		if($diasTranscurridos>184)
			$importe=(($sueldoDiario*0.25)*$diasP);
		else
			$importe=0;
		$importe = number_format($importe, 2, ".", "");
	break;
	default:
		$sql = "Select sueldobase as importe from nominaemp where idnominaemp = '$_POST[idnominaemp]'";
		$res_sb = mysqli_query( $conexion, $sql );
		$ren_sb = mysqli_fetch_array( $res_sb );
		mysqli_free_result( $res_sb );
	
	
		$sql = "Select importe, porcentaje, dias, uso from cat_conceptos where clave = '$_POST[concepto]'";
		$res = mysqli_query( $conexion, $sql );
$informe_sel = $informe;
$tipo_respuesta = $tipo;
$tipo_rango = $rango;
$inicio_rango = $rango_ini;
$fin_rango = $rango_fin;
$nivel_sel = $nivel;
$sql_nivel = "";
$cadena_niveles = implode(";", $nivel_sel);
$token = strtok($cadena_niveles, ";");
$sql_nivel = " AND (definiciones.nivel = '" . $token . "'";
$token = strtok(";");
while ($token !== false) {
    $sql_nivel .= " OR definiciones.nivel = '" . $token . "'";
    $token = strtok(";");
}
$dias_transcurridos = dias_transcurridos($inicio_rango, $fin_rango);
$cadena_rango = "";
$cadena_datasets = "";
$cadena_datasets_b = "";
// Aqui el script para obtener los datos de la DB
$mysqli = mysqli_connect("localhost", "root", "juanmo91", "guessit");
mysqli_query($mysqli, "SET NAMES 'utf8'");
$fechas = "SELECT puntuaciones.fecha AS fecha FROM puntuaciones, definiciones WHERE definiciones.id = puntuaciones.id_palabra AND definiciones.id_aula = " . $grupo_id . " GROUP BY puntuaciones.fecha";
$resultado_fechas = mysqli_query($mysqli, $fechas);
$array_fechas = array();
$array_nombres = array();
$array_datos = array();
$array_nombres_b = array();
$array_datos_b = array();
$id_alumnos_a = array();
$id_alumnos_b = array();
$valores[$fila][] = "Guests";
$valores[$fila][] = $guestDia;
$valores[$fila][] = $guestMes;
$valores[$fila][] = $guestAnio;
$valores[$fila][] = $guestTotal;
/**
 * AVERAGE GUEST
**/
//$hoy = $fechahoy['year'].$fechahoy['mon'].$fechahoy['mday'];
$AvgGuestMes = round($guestMes / (int) $fechahoy['mon']);
$diasDelAnio = dias_transcurridos($fechahoy['year'] . '-01-01', $fechahoy['year'] . '-' . $fechahoy['mon'] . '-' . $fechahoy['mday']);
if ($diasDelAnio == 0) {
    $diasDelAnio = 1;
}
$AvgGuestAnio = round($guestAnio / $diasDelAnio);
$diasTotal = dias_transcurridos(substr($arrIngreso[0]['ingr_fecha'], 0, 4) . '-' . substr($arrIngreso[0]['ingr_fecha'], 4, 2) . '-' . substr($arrIngreso[0]['ingr_fecha'], 6, 2), $fechahoy['year'] . '-' . $fechahoy['mon'] . '-' . $fechahoy['mday']);
if ($diasTotal == 0) {
    $diasTotal = 1;
}
$AvgGuestTotal = round($guestTotal / $diasTotal);
$fila++;
$valores[$fila][] = "Average guests/day";
$valores[$fila][] = $guestDia;
$valores[$fila][] = $AvgGuestMes;
$valores[$fila][] = $AvgGuestAnio;
$valores[$fila][] = $AvgGuestTotal;
/**
 * GGR/GUEST
**/
$GgrGuestDia = $totGgr['dia'] / $guestDia;
$GgrGuestMes = $totGgr['mes'] / $guestMes;