
les dejo el codigo para que me ayuden
Código PHP:
Ver original
<?php $anho = $_REQUEST['anho']; $mes = $_REQUEST['mes']; $mci = $_REQUEST['mci']; ?> <?php include ("conexion.php"); $conexion= conectarmensajeria(); $direccion = $_SESSION['dir']; $usuario = $_SESSION['user']; $fecha = mssql_query("select distinct month(getdate()) as MES, year(getdate()) as ANHO from CT_DETIND",$conexion); $combo3 = mssql_query("select cod_are,upper(des_are),ORDEN_AREA from ct_detare order by ORDEN_AREA asc",$conexion); t01.cod_res,obj,meta, (case when t01.fecha = '$mes' then cast(valor as float) else 0 end) as [Valor_Mes], des_are,des_res,des_unim,COMENTADO from CT_DETIND t01 inner join CT_DETARE t02 on t01.cod_are = t02.cod_are inner join CT_DETRES t03 on t01.cod_res = t03.cod_res inner join CT_MAEIND t04 on t01.cod_ind = t04.cod_ind inner join CT_COMENTARIOS t05 on t01.cod_com = t05.cod_com where des_res like '%' AND t01.fecha = '$mes' order by 10 asc",$conexion); if($row2[0]<10){ $fecha_anterior = $anho."0".$row2[0]-1; $fecha_actual = $anho."0".$row2[0]; }else{ $fecha_anterior = $anho'.$row2[0]-1; $fecha_actual = $anho.$row2[0]; } } $objetivo_anual = $anho."01"; $area = '%'; $mes_ant=$mes-1; $stmt1=mssql_init("lista_t_f_anterior", $conexion); mssql_bind($stmt1,"@fecha_anterior",$fecha_anterior,SQLVARCHAR,FALSE); $query1 = mssql_execute($stmt1); $stmt1=mssql_init("lista_t_f_actual", $conexion); mssql_bind($stmt1,"@fecha_actual",$fecha_actual,SQLVARCHAR,FALSE); $query2 = mssql_execute($stmt1); $stmt1=mssql_init("lista_t_f_actual", $conexion); mssql_bind($stmt1,"@fecha_actual",$fecha_actual,SQLVARCHAR,FALSE); $query3 = mssql_execute($stmt1); $stmt1=mssql_init("lista_t_f_anterior_area", $conexion); mssql_bind($stmt1,"@fecha_anterior",$fecha_anterior,SQLVARCHAR,FALSE); mssql_bind($stmt1,"@area",$area,SQLVARCHAR,FALSE); mssql_bind($stmt1,"@mci",$mci,SQLVARCHAR,FALSE); $query4 = mssql_execute($stmt1); $stmt1=mssql_init("lista_t_f_actual_area", $conexion); mssql_bind($stmt1,"@fecha_actual",$fecha_actual,SQLVARCHAR,FALSE); mssql_bind($stmt1,"@area",$area,SQLVARCHAR,FALSE); mssql_bind($stmt1,"@mci",$mci,SQLVARCHAR,FALSE); $query5 = mssql_execute($stmt1); $stmt1=mssql_init("lista_t_f_actual_area", $conexion); mssql_bind($stmt1,"@fecha_actual",$fecha_actual,SQLVARCHAR,FALSE); mssql_bind($stmt1,"@area",$area,SQLVARCHAR,FALSE); mssql_bind($stmt1,"@mci",$mci,SQLVARCHAR,FALSE); $query6 = mssql_execute($stmt1); echo $colores; ?> <?php { $anho = $_REQUEST['anho']; $fecha1 = $_REQUEST['mes']; $mci='::SELECCIONE::'; if($fecha1 <= 01){ $fecha2 = 12; $anho2 = $anho-1; $fecha_anterior = $anho2.$fecha2; $fecha_actual = $anho.$fecha1; }else{ $fecha_actual = $anho.$fecha1; $fecha_ant = $fecha1 - 1; if($fecha_ant<10){ $fecha_anterior = $anho."0".$fecha_ant; }else{ $fecha_anterior = $anho.$fecha_ant; } } $objetivo_anual = $anho.'01'; $area = $_REQUEST['area']; $mci = $_REQUEST['mci']; } ?>