function capturista($op, $fechai, $fechaf, $buscar, $filtros, $reason, $editados) { ?> <table align="center" class="tabla" border="0"> <thead> <tr bgcolor="#E6E6E6" height="20"> <td colspan="28" align="center"><b>Reporte de SCRAP <?php switch ($op) { case "proceso": echo "en Proceso"; break; case "rechazados": echo "Rechazado"; break; case "aprobados": echo "Aprobado"; break; case "cancelados": echo "Cancelado"; break; } ?> </b></td> </tr> </thead> </table><br> <table align="center" border="1"> <thead> <tr height="20"> <td align="center" width="50" bgcolor="#FFCC33" rowspan="2"><b>No.Item</b></td> <td align="center" width="120" bgcolor="#FFCC33" rowspan="2"><b>Fecha</b></td> <td align="center" width="120" bgcolor="#FFCC33" rowspan="2"><b>No.Parte</b></td> <td align="center" width="150" bgcolor="#FFCC33" rowspan="2"><b>Descripción</b></td> <td align="center" width="150" bgcolor="#FFCC33" rowspan="2"><b>Qty</b></td> <td align="center" width="150" bgcolor="#FFCC33" rowspan="2"><b>Turno</b></td> <?php if ($reason != 1) { ?> <td align="center" width="120" bgcolor="#FFCC33" rowspan="2"><b>Código Scrap</b></td><?php } ?> <?php if ($reason == 1) { ?> <td align="center" width="120" bgcolor="#FFCC33" rowspan="2"><b>Reason Code</b></td><?php } ?> <td align="center" width="100" bgcolor="#FFCC33" rowspan="2"><b>Valor</b></td> <td align="center" width="100" bgcolor="#FFCC33" rowspan="2"><b>Proceso</b></td> <td align="center" width="200" bgcolor="#FFCC33" rowspan="2"><b>Proyecto</b></td> <td align="center" width="200" bgcolor="#FFCC33" rowspan="2"><b>Defecto</b></td> <td align="center" bgcolor="#FFCC33" colspan="6"><b>Cod.Causa Original</b></td> <td align="center" width="120" bgcolor="#FFCC33" rowspan="2"><b>Posición</b></td> <td align="center" width="90" bgcolor="#FFCC33" rowspan="2"><b>Información Obligatoria</b></td> <td align="center" width="90" bgcolor="#FFCC33" rowspan="2"><b>Supervisor</b></td> <td align="center" colspan="8" bgcolor="#FFCC33"><b>Autorizaciones</b></td> </tr> <tr> <td align="center" width="180" bgcolor="#FFCC33"><b>Área</b></td> <td align="center" width="120" bgcolor="#FFCC33"><b>Estación</b></td> <td align="center" width="100" bgcolor="#FFCC33"><b>Línea</b></td> <td align="center" width="100" bgcolor="#FFCC33"><b>Defecto</b></td> <td align="center" width="100" bgcolor="#FFCC33"><b>Causa</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>Código Scrap</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>LO</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>LOA</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>LPL</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>FFM</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>FFC</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>PROD</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>SQM</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>INV</b></td> </tr> </thead> <tbody> <?php if ($op == 'aprobados') { if (!$fechai) { $fechai = date("Y-m-d", mktime(0, 0, 0, date("m"), 1, date("Y"))); } if (!$fechaf) { $fechaf = date("Y-m-d", mktime(0, 0, 0, date("m") + 1, 0, date("Y"))); } } $s_1 .= "select * from "; switch ($op) { case "proceso": $s_1 .= "vw_pendientes "; break; case "rechazados": $s_1 .= "vw_rechazados "; break; case "cancelados": $s_1 .= "vw_cancelados "; break; case "aprobados": $s_1 .= "vw_aprobados "; break; } $s_1 .= " where no_folio!='0' "; if ($fechai != '' && $fechaf != '') { $s_1 .= "and (fecha>='{$fechai}' and fecha<='{$fechaf}') "; } if ($editados == '1') { $s_1 .= "and editado='1' "; } for ($i = 0; $i <= 2; $i++) { if ($buscar[$i] != '' && $filtros[$i] != '') { $s_1 .= " and ( "; $data = split(",", $buscar[$i]); for ($j = 0; $j < count($data); $j++) { $s_1 .= get_operador($filtros[$i], $data[$j]) . " or "; } $s_1 = substr($s_1, 0, -3) . " ) "; } } $s_1 .= filtros_capturista($division); $s_1 .= " order by no_folio desc"; $r_1 = mysql_query($s_1); while ($d_1 = mysql_fetch_array($r_1)) { $qty = $qty + $d_1['cantidad']; $cost = $cost + $d_1['total']; ?> <tr> <td align="center"><?php echo $d_1['no_folio']; ?> </td> <td align="center"><?php echo $d_1['fecha']; ?> </td> <td align="center"><?php echo $d_1['no_parte']; ?> </td> <td align="left"><?php echo $d_1['descripcion']; ?> </td> <td align="center"><?php echo $d_1['cantidad']; ?> </td> <td align="center"><?php echo $d_1['turno']; ?> </td> <?php if ($reason != 1) { ?> <td align="center"><?php echo $d_1['codigo_scrap']; ?> </td><?php } ?> <?php if ($reason == 1) { ?> <td align="center"><?php echo $d_1['reason_code']; ?> </td><?php } ?> <td align="right" class="small"><?php echo number_format($d_1['total'], 2); ?> </td> <td align="left"><?php echo $d_1['estacion']; ?> </td> <td align="left"><?php echo $d_1['proyecto']; ?> </td> <td align="left"><?php echo $d_1['defecto']; ?> </td> <? $original = data_codigo_original($d_1['no_folio'],$d_1['financiero']); ?> <td align="left"><?php echo $original['area']; ?> </td> <td align="left"><?php echo $original['estacion']; ?> </td> <td align="left"><?php echo $original['linea']; ?> </td> <td align="left"><?php echo $original['defecto']; ?> </td> <td align="left"><?php echo $original['causa']; ?> </td> <td align="center"><?php echo $original['codigo']; ?> </td> <td align="center"><?php echo $d_1['ubicacion']; ?> </td> <td align="center"><?php echo $d_1['info_1'] . $d_1['info_2']; ?> </td> <td align="left"><?php echo $d_1['supervisor']; ?> </td> <td align="center"><?php echo get_datos("lo", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("loa", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("lpl", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("ffm", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("ffc", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("prod", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("sqm", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("inv", $d_1['no_folio']); ?> </td> </tr> <?php } ?> <tr> <td align="right" colspan="4"><b>Totales </b></td> <td align="center" bgcolor="#FFCC33"><b><?php echo $qty; ?> </b></td> <td align="center" colspan="2"> </td> <td align="center" bgcolor="#FFCC33"><b><?php echo number_format($cost, 2); ?> </b></td> <td align="center" colspan="20"> </td> </tr> </tbody> </table> <?php }
?> </td> <td align="center"><?php echo get_datos("prod", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("sqm", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("fin", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("inv", $d_1['no_folio']); ?> </td> </tr> <?php } ?> <tr> <td align="right" colspan="4"><b>Totales </b></td> <td align="center" bgcolor="#FFCC33"><b><?php echo $qty; ?> </b></td> <td align="center" colspan="2"> </td> <td align="center" bgcolor="#FFCC33"><b><?php echo number_format($cost, 2);
function corto($fechai, $fechaf, $buscar, $filtros) { ?> <table align="center" class="tabla" border="0"> <thead> <tr bgcolor="#E6E6E6" height="20"> <td colspan="8" align="center"><b>REPORTE PRELIMINAR CORTO DE SCRAP</b></td> </tr> </thead> </table><br> <table align="center" border="1"> <thead> <tr height="20"> <td align="center" width="90" bgcolor="#FFCC33" rowspan="2"><b>Folio</b></td> <td align="center" width="90" bgcolor="#FFCC33" rowspan="2"><b>No. Parte</b></td> <td align="center" width="90" bgcolor="#FFCC33" rowspan="2"><b>Qty</b></td> <td align="center" width="90" bgcolor="#FFCC33" rowspan="2"><b>Fecha creación</b></td> <td align="center" width="90" bgcolor="#FFCC33" rowspan="2"><b>Hora creación</b></td> <td align="center" bgcolor="#FFCC33" colspan="3"><b>Inventarios</b></td> </tr> <tr height="20"> <td align="center" width="90" bgcolor="#FFCC33"><b>Status</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>Fecha</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>Hora</b></td> </tr> </thead> <tbody> <?php $s_f = "select folios.*, partes.no_parte, partes.cantidad, partes.padre, aut_bitacora.fecha, aut_bitacora.hora from scrap_partes as partes, scrap_folios as folios, "; $s_f .= "autorizaciones, numeros_parte, aut_bitacora where folios.no_folio = partes.no_folio and autorizaciones.no_folio = folios.no_folio and "; $s_f .= "partes.no_parte = numeros_parte.nombre and aut_bitacora.no_folio = folios.no_folio and aut_bitacora.depto='inv' and aut_bitacora.status='1' "; for ($i = 0; $i <= 2; $i++) { if ($buscar[$i] != '' && $filtros[$i] != '') { $s_f .= " and ( "; $data = split(",", $buscar[$i]); for ($j = 0; $j < count($data); $j++) { $s_f .= get_operador($filtros[$i], $data[$j]) . " or "; } $s_f = substr($s_f, 0, -3) . " ) "; } } if ($fechai != '' && $fechaf != '') { $s_f .= "and (folios.fecha>='{$fechai}' and folios.fecha<='{$fechaf}') "; } if ($_SESSION["TYPE"] != 'autorizador') { $s_f .= filtros_capturista(); } if ($_SESSION["TYPE"] == 'autorizador') { $s_f .= filtros_autorizador(); } $s_f .= "group by partes.id order by folios.no_folio asc"; $r_1 = mysql_query($s_f); while ($d_1 = mysql_fetch_array($r_1)) { if ($d_1['activo'] == '1') { $qty = $qty + $d_1['cantidad']; } ?> <tr> <td align="center"><?php echo $d_1['no_folio']; ?> </td> <td align="left" style="mso-number-format:'0';"><?php echo $d_1['no_parte']; ?> </td> <td align="center"><?php echo $d_1['cantidad']; ?> </td> <?php $a_folio = substr($d_1['timer'], 0, 4); $m_folio = substr($d_1['timer'], 4, 2); $d_folio = substr($d_1['timer'], 6, 2); $h_folio = substr($d_1['timer'], 8, 2); $min_folio = substr($d_1['timer'], 10, 2); $seg_folio = substr($d_1['timer'], 12, 2); $fecha_folio = date("d-m-Y", mktime($h_folio, $min_folio, $seg_folio, $m_folio, $d_folio, $a_folio)); $hora_folio = date("H:i:s", mktime($h_folio, $min_folio, $seg_folio, $m_folio, $d_folio, $a_folio)); ?> <td align="center"><?php echo $fecha_folio; ?> </td> <td align="center"><?php echo $hora_folio; ?> </td> <td align="center"><?php echo get_datos("inv", $d_1['no_folio']); ?> </td> <td align="center"><?php echo $d_1['fecha']; ?> </td> <td align="center"><?php echo $d_1['hora']; ?> </td> </tr> <?php } ?> <tr> <td colspan="2"> </td> <td align='right' bgcolor='#FFCC33'><?php echo "{$qty} "; ?> </td> <td align="center" colspan="5"> </td> </tr> </tbody> </table> <?php }
function consultas($fechai, $fechaf, $aplica_oes, $buscar, $filtros, $tipo, $reason, $editada, $motivo) { if ($tipo != 'proceso') { if (!$fechai) { $fechai = date("Y-m-d", mktime(0, 0, 0, date("m"), 1, date("Y"))); } if (!$fechaf) { $fechaf = date("Y-m-d", mktime(0, 0, 0, date("m") + 1, 0, date("Y"))); } } ?> <table align="center" class="tabla" border="0"> <thead> <tr bgcolor="#E6E6E6" height="20"> <td colspan="32" align="center"><b>Reporte de SCRAP <?php switch ($tipo) { case "proceso": echo "en Proceso"; break; case "rechazados": echo "Rechazado"; break; case "aprobados": echo "Aprobado"; break; case "cancelados": echo "Cancelado"; break; } ?> </b></td> </tr> </thead> </table><br> <table align="center" border="1"> <thead> <tr height="20"> <td align="center" width="50" bgcolor="#FFCC33" rowspan="2"><b>No.Item</b></td> <td align="center" width="120" bgcolor="#FFCC33" rowspan="2"><b>Fecha</b></td> <td align="center" width="120" bgcolor="#FFCC33" rowspan="2"><b>No.Parte</b></td> <td align="center" width="150" bgcolor="#FFCC33" rowspan="2"><b>Descripción</b></td> <td align="center" width="150" bgcolor="#FFCC33" rowspan="2"><b>Qty</b></td> <td align="center" width="150" bgcolor="#FFCC33" rowspan="2"><b>Turno</b></td> <?php if ($reason != 1) { ?> <td align="center" width="120" bgcolor="#FFCC33" rowspan="2"><b>Código Scrap</b></td><?php } ?> <?php if ($reason == 1) { ?> <td align="center" width="120" bgcolor="#FFCC33" rowspan="2"><b>Reason Code</b></td><?php } ?> <td align="center" width="100" bgcolor="#FFCC33" rowspan="2"><b>Valor</b></td> <td align="center" width="100" bgcolor="#FFCC33" rowspan="2"><b>Proceso</b></td> <td align="center" width="100" bgcolor="#FFCC33" rowspan="2"><b>Proyecto</b></td> <td align="center" width="100" bgcolor="#FFCC33" rowspan="2"><b>Capturista</b></td> <td align="center" width="200" bgcolor="#FFCC33" rowspan="2"><b>Defecto</b></td> <td align="center" bgcolor="#FFCC33" colspan="6"><b>Cod.Causa Original</b></td> <td align="center" width="120" bgcolor="#FFCC33" rowspan="2"><b>Posición</b></td> <td align="center" width="90" bgcolor="#FFCC33" rowspan="2"><b>Información Obligatoria</b></td> <td align="center" width="90" bgcolor="#FFCC33" rowspan="2"><b>Supervisor</b></td> <?php if ($tipo == 'cancelados') { ?> <td align="center" width="150" bgcolor="#FFCC33" rowspan="2"><b>Motivo</b></td><?php } ?> <td align="center" colspan="11" bgcolor="#FFCC33"><b>Autorizaciones</b></td> </tr> <tr> <td align="center" width="180" bgcolor="#FFCC33"><b>Área</b></td> <td align="center" width="120" bgcolor="#FFCC33"><b>Estación</b></td> <td align="center" width="100" bgcolor="#FFCC33"><b>Línea</b></td> <td align="center" width="100" bgcolor="#FFCC33"><b>Defecto</b></td> <td align="center" width="100" bgcolor="#FFCC33"><b>Causa</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>Código Scrap</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>LO</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>LOA</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>LPL</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>FFM</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>FFC</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>PROD</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>SQM</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>Finanzas</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>ESP</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>OES</b></td> <td align="center" width="90" bgcolor="#FFCC33"><b>INV</b></td> </tr> </thead> <tbody> <?php $s_f = "select * from (select folios.*, partes.no_parte, partes.descripcion, partes.cantidad, partes.total as costo_total, (select motivo from aut_bitacora where "; $s_f .= "aut_bitacora.no_folio=folios.no_folio and aut_bitacora.status='3' order by id desc limit 0,1) as motivo, partes.ubicacion from scrap_partes as partes, "; $s_f .= "scrap_folios as folios, autorizaciones where folios.no_folio = partes.no_folio and autorizaciones.no_folio = folios.no_folio "; if ($_SESSION["DEPTO"] != 'esp') { $s_f .= " and autorizaciones.depto='{$_SESSION['DEPTO']}' "; } else { $s_f .= " and (autorizaciones.depto='esp_1' or autorizaciones.depto='esp_2') "; } if ($editada == '1') { $s_f .= "and editada='1' "; } if ($aplica_oes == 'si') { $s_1 .= " and autorizaciones.depto = 'oes' "; } if ($fechai != '' && $fechaf != '') { $s_f .= "and (fecha>='{$fechai}' and fecha<='{$fechaf}') "; } for ($i = 0; $i <= 2; $i++) { if ($buscar[$i] != '' && $filtros[$i] != '') { $s_f .= " and ( "; $data = split(",", $buscar[$i]); for ($j = 0; $j < count($data); $j++) { $s_f .= get_operador($filtros[$i], $data[$j]) . " or "; } $s_f = substr($s_f, 0, -3) . " ) "; } } switch ($tipo) { case "proceso": $s_f .= " and folios.status='0' and folios.activo='1' "; break; case "rechazados": $s_f .= " and folios.status='2' and folios.activo='1' "; break; case "cancelados": $s_f .= " and folios.activo='2' "; break; case "aprobados": $s_f .= " and folios.status='1' and folios.activo='1' "; break; } $s_f .= filtros_autorizador(); $s_f .= " group by folios.no_folio order by folios.no_folio ASC) as general "; if ($motivo != '') { $s_f .= " where motivo like '{$motivo}' "; } $r_1 = mysql_query($s_f); while ($d_1 = mysql_fetch_array($r_1)) { $qty = $qty + $d_1['cantidad']; $cost = $cost + $d_1['costo_total']; ?> <tr> <td align="center"><?php echo $d_1['no_folio']; ?> </td> <td align="center"><?php echo $d_1['fecha']; ?> </td> <td align="center"><?php echo $d_1['no_parte']; ?> </td> <td align="left"><?php echo $d_1['descripcion']; ?> </td> <td align="center"><?php echo $d_1['cantidad']; ?> </td> <td align="center"><?php echo $d_1['turno']; ?> </td> <?php if ($reason != 1) { ?> <td align="center"><?php echo $d_1['codigo_scrap']; ?> </td><?php } ?> <?php if ($reason == 1) { ?> <td align="center"><?php echo $d_1['reason_code']; ?> </td><?php } ?> <td align="right" class="small"><?php echo number_format($d_1['costo_total'], 2); ?> </td> <td align="left"><?php echo $d_1['estacion']; ?> </td> <td align="left"><?php echo $d_1['proyecto']; ?> </td> <td align="left"><?php echo $d_1['empleado']; ?> </td> <td align="left"><?php echo $d_1['defecto']; ?> </td> <?php $data = data_codigo_original($d_1['no_folio'], $d_1['financiero']); ?> <td align="left"><?php echo $data['area']; ?> </td> <td align="left"><?php echo $data['estacion']; ?> </td> <td align="left"><?php echo $data['linea']; ?> </td> <td align="left"><?php echo $data['defecto']; ?> </td> <td align="left"><?php echo $data['causa']; ?> </td> <td align="center"><?php echo $data['codigo']; ?> </td> <td align="center"><?php echo $d_1['ubicacion']; ?> </td> <td align="center"><?php echo $d_1['info_1'] . $d_1['info_2']; ?> </td> <td align="left"><?php echo $d_1['supervisor']; ?> </td> <?php if ($tipo == 'cancelados') { ?> <td align="left"> <?php echo $d_1['motivo']; ?> </td><?php } ?> <td align="center"><?php echo get_datos("lo", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("loa", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("lpl", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("ffm", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("ffc", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("prod", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("sqm", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("fin", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("esp", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("oes", $d_1['no_folio']); ?> </td> <td align="center"><?php echo get_datos("inv", $d_1['no_folio']); ?> </td> </tr> <?php } ?> <tr> <td align="right" colspan="4"><b>Totales </b></td> <td align="center" bgcolor="#FFCC33"><b><?php echo $qty; ?> </b></td> <td align="center" colspan="2"> </td> <td align="center" bgcolor="#FFCC33"><b><?php echo number_format($cost, 2); ?> </b></td> <td align="center" colspan="24"> </td> </tr> </tbody> </table> <?php }