-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy of reportecliente.php
77 lines (51 loc) · 5.16 KB
/
Copy of reportecliente.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?
require_once('include/header.inc.php');
if ($_SESSION['valid_user'] != 't')
echo '<meta http-equiv="refresh" content="0;url=ingreso.php?invalid=invalid"';
?>
<script language="javascript" src="script/cal2.js"></script>
<script language="javascript" src="script/cal_conf2.js"></script>
<?
$imprimir = null;
$imprimir .= "<table align=center border=0>
<caption><H2>Reporte</H2></caption>";
$formulario = new cForm();
$formulario->_name = 'freporte';
$formulario->add_text('fecha_inicio', 0, 0);
$formulario->inputcal('t_fecha_inicio_4', '', '12', '10', '', 0, 0, 1, 1, "javascript:showCal('Calendar1')", 'imagenes/cal.gif');
$formulario->add_text('fecha_fin', 0, 0);
$formulario->inputcal('t_fecha_fin_4', '', '12', '10', '', 0, 0, 1, 1, "javascript:showCal('Calendar2')", 'imagenes/cal.gif');
$imprimir .= $formulario->drawwithout('enviar', 'Enviar', '', 'center', '', 1, 1, '', 1, 2);
$imprimir .= "</table>";
echo $imprimir;
if ($_POST['enviar'])
{
$fv = new FormValidator($_POST);
$fv->doValidation();
if($fv->isError()) {
//
// if error show the error box
//
$imprimir .= ($fv->getErrorBox());
}
else {
$sql = "select ord.ingreso, ord.referencia, ord.unidades, cliente.nombre_cliente, ord.orden,
(select to_char(inicio, 'YYYY/mm/dd HH12:MI:SS') || ' -- ' || case when finalizacion is null then 'sin finalizar' else to_char(finalizacion, 'YYYY/mm/dd HH12:MI:SS') end from seguimiento where orden = ord.orden and proceso = 's001' and (inicio between '{$_REQUEST['t_fecha_inicio_4']}' and '{$_REQUEST['t_fecha_fin_4']}') and ((finalizacion between '{$_REQUEST['t_fecha_inicio_4']}' and '{$_REQUEST['t_fecha_fin_4']}') or finalizacion is null)) as SEPARACION,
(select to_char(inicio, 'YYYY/mm/dd HH12:MI:SS') || ' -- ' || case when finalizacion is null then 'sin finalizar' else to_char(finalizacion, 'YYYY/mm/dd HH12:MI:SS') end from seguimiento where orden = ord.orden and proceso = 'i001' and (inicio between '{$_REQUEST['t_fecha_inicio_4']}' and '{$_REQUEST['t_fecha_fin_4']}') and ((finalizacion between '{$_REQUEST['t_fecha_inicio_4']}' and '{$_REQUEST['t_fecha_fin_4']}') or finalizacion is null)) as IMPRESION,
(select to_char(inicio, 'YYYY/mm/dd HH12:MI:SS') || ' -- ' || case when finalizacion is null then 'sin finalizar' else to_char(finalizacion, 'YYYY/mm/dd HH12:MI:SS') end from seguimiento where orden = ord.orden and proceso = 'g001' and (inicio between '{$_REQUEST['t_fecha_inicio_4']}' and '{$_REQUEST['t_fecha_fin_4']}') and ((finalizacion between '{$_REQUEST['t_fecha_inicio_4']}' and '{$_REQUEST['t_fecha_fin_4']}') or finalizacion is null)) as GRABACION,
(select to_char(inicio, 'YYYY/mm/dd HH12:MI:SS') || ' -- ' || case when finalizacion is null then 'sin finalizar' else to_char(finalizacion, 'YYYY/mm/dd HH12:MI:SS') end from seguimiento where orden = ord.orden and proceso = 'm001' and (inicio between '{$_REQUEST['t_fecha_inicio_4']}' and '{$_REQUEST['t_fecha_fin_4']}') and ((finalizacion between '{$_REQUEST['t_fecha_inicio_4']}' and '{$_REQUEST['t_fecha_fin_4']}') or finalizacion is null)) as MUESTRA,
(select to_char(inicio, 'YYYY/mm/dd HH12:MI:SS') || ' -- ' || case when finalizacion is null then 'sin finalizar' else to_char(finalizacion, 'YYYY/mm/dd HH12:MI:SS') end from seguimiento where orden = ord.orden and proceso = 'p001' and (inicio between '{$_REQUEST['t_fecha_inicio_4']}' and '{$_REQUEST['t_fecha_fin_4']}') and ((finalizacion between '{$_REQUEST['t_fecha_inicio_4']}' and '{$_REQUEST['t_fecha_fin_4']}') or finalizacion is null)) as PRODUCCION,
(select to_char(inicio, 'YYYY/mm/dd HH12:MI:SS') || ' -- ' || case when finalizacion is null then 'sin finalizar' else to_char(finalizacion, 'YYYY/mm/dd HH12:MI:SS') end from seguimiento where orden = ord.orden and proceso = 't001' and (inicio between '{$_REQUEST['t_fecha_inicio_4']}' and '{$_REQUEST['t_fecha_fin_4']}') and ((finalizacion between '{$_REQUEST['t_fecha_inicio_4']}' and '{$_REQUEST['t_fecha_fin_4']}') or finalizacion is null)) as TERMOFIJACION,
(select to_char(inicio, 'YYYY/mm/dd HH12:MI:SS') || ' -- ' || case when finalizacion is null then 'sin finalizar' else to_char(finalizacion, 'YYYY/mm/dd HH12:MI:SS') end from seguimiento where orden = ord.orden and proceso = 'd001' and inicio >='{$_REQUEST['t_fecha_inicio_4']}' and finalizacion <= '{$_REQUEST['t_fecha_fin_4']}') as DESPACHO
from cliente, orden as ord, seguimiento";
$sql .= " where '".$_SESSION['id_user']."' = ord.cliente and ord.orden = seguimiento.orden and cliente.id_cliente = ord.cliente";
$sql .= " and (inicio between '{$_REQUEST['t_fecha_inicio_4']}' and '{$_REQUEST['t_fecha_fin_4']}') and (finalizacion between '{$_REQUEST['t_fecha_inicio_4']}' and '{$_REQUEST['t_fecha_fin_4']}') group by ingreso, referencia, unidades, nombre_cliente, ord.orden";
//echo $sql;
$pager = new ADODB_Pager($db,$sql);
$pager->Render($rows_per_page=10);
/*if ($db->Execute($sql) === false){
$imprimir .= "Error en la consulta :". $db->ErrorMsg()."<br>";
}*/
}
}
?>