} } } if (!feof($script)) { fwrite($texto, $char); if ($flag_fim_string === true) { break; } } else { break; } } while ($byte != 'FE'); //var_dump(dechex($ponteiro)); if ($flag_fim_string === true) { break; } else { $i = $i + 2; } } if (isset($flag_fim_string) && $flag_fim_string === false) { $char = '<FIM>'; fwrite($texto, $char); } fclose($script); fclose($texto); aviso("OK!"); } aviso('Scripts extraídos com sucesso!'); } else { aviso('Nenhum script encontrado!'); }
echo '<br/>'; echo 'Apellido : ' . $_SESSION['apellido']; echo '<br/>'; echo 'Movil : ' . $_SESSION['movil']; echo '<br/>'; echo 'Correo : ' . $_SESSION['mail']; echo '<hr/>'; echo '<h3 align = "center"> Libro en Depósito : </h3>'; echo 'hr/>'; echo 'ISBN : ' . $_SESSION['isbn']; echo '<br/>'; echo 'Descripcion : ' . $_SESSION['descripcion']; echo '<br/>'; echo 'Cantidad : ' . $_SESSION['cantidad']; echo '<br/>'; aviso(); insertlibro($_SESSION['isbn'], $_SESSION['descripcion'], $_SESSION['cantidad']); addcompra($_SESSION['isbn'], $id); echo '<button onclick="imprimir();"> Imprimir Deposito </button>'; } ?> </div> <div id = "ventaprecio"> <?php if (isset($_POST['vender'])) { // Inserccion en la base de datos de las ventas de Segunda Mano echo '<h3 aling = "center">Libros vendidos</h3>'; for ($i = 0; $i < $_SESSION['filas']; $i++) { echo 'ISBN : ' . $_SESSION['isbn' . $i]; echo '<br/>'; echo 'Descripcion : ' . $_SESSION['descripcion' . $i];
function fichaM($movil) { $query = "SELECT id_persona,nombre,apellido,movil,mail,descripcion,libros.isbn,estado FROM libros,personas,compraventa\r\n\t\tWHERE libros.isbn = compraventa.isbn AND id_persona = id_vendedor and movil = " . $movil . ";"; $result = mysql_query($query); $pos = 0; while ($row = mysql_fetch_assoc($result)) { $id = $row['id_persona']; $nombre = $row['nombre']; $apellido = $row['apellido']; $movil = $row['movil']; $correo = $row['mail']; $descripcion[$pos] = $row['descripcion']; $isbn[$pos] = $row['isbn']; $estado[$pos] = $row['estado']; $pos = $pos + 1; } echo '<h3 align = "center">Ficha personal Segunda Mano </h3>'; echo '<h3>Datos Personales :</h3>'; echo '<h4>ID : ' . $id . '</h4>'; echo 'Nombre : ' . $nombre; echo '<br/>'; echo '<br/>'; echo 'Apellidos : ' . $apellido; echo '<br/>'; echo '<br/>'; echo 'Movil : ' . $movil; echo '<br/>'; echo '<br/>'; echo 'Correo : ' . $correo; echo '<hr/>'; echo '<h3>Libros en Depósito : </h3>'; $len = mysql_num_rows($result); echo '<ol>'; for ($i = 0; $i < $len; $i++) { echo '<li>'; echo 'ISBN : ' . $isbn[$i]; echo '<br/>'; echo 'Descripcion : ' . $descripcion[$i]; echo '<br/>'; echo 'Estado : ' . $estado[$i]; echo '<br/>'; echo '<br/>'; echo '</li>'; } echo '</ol>'; echo '<hr/>'; aviso(); }
function enviar_mails_auto() { $hoy = date("Y-m-d"); $hora = date("H:i:s"); $s_1 = "select * from configuracion where variable = 'dias_atraso'"; $r_1 = mysql_query($s_1); $d_1 = mysql_fetch_array($r_1); $limite = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - $d_1['valor'], date("Y"))); $s_1 = "select * from configuracion where variable = 'dias_aviso'"; $r_1 = mysql_query($s_1); $d_1 = mysql_fetch_array($r_1); $avisos = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - $d_1['valor'], date("Y"))); $sheader = $sheader . "From: Sistema Scrap\n"; $sheader = $sheader . "X-Mailer:PHP/" . phpversion() . "\n"; $sheader = $sheader . "Mime-Version: 1.0\n"; $sheader = $sheader . "Content-Type: text/html"; $s_g = "CREATE OR REPLACE VIEW vw_mails as (SELECT folios.no_folio, folios.fecha, folios.id_planta, folios.planta, folios.id_area, folios.area, "; $s_g .= "folios.id_division, folios.division, folios.id_pc, folios.profit_center, folios.id_proyecto, folios.proyecto, aut.depto, aut2.id_emp, emp.nombre, "; $s_g .= "emp.apellidos, emp.mail "; $s_g .= "FROM scrap_folios folios, autorizaciones aut, autorizadores aut2, empleados emp "; $s_g .= "WHERE folios.fecha<='{$limite}' and folios.status='0' and folios.activo='1' and aut.status='0' and aut.aviso<='{$avisos}' and depto='{$_SESSION['DEPTO']}' "; $s_g .= "and aut2.tipo='{$_SESSION['DEPTO']}' and folios.id_planta!='0' and folios.id_planta!='' and folios.id_area!='0' and folios.id_area!='' and "; $s_g .= "folios.id_division!='0' and folios.id_division!='' and folios.id_pc!='0' and folios.id_pc!='' and folios.id_proyecto!='0' and folios.proyecto!='' and "; $s_g .= "folios.no_folio = aut.no_folio and emp.id = aut2.id_emp and emp.autorizador = '{$_SESSION['DEPTO']}' and emp.activo='1' "; if ($_SESSION["DEPTO"] == 'inv') { $s_g .= " and aut2.id_division=folios.id_division "; } elseif ($_SESSION["DEPTO"] == 'lpl' || $_SESSION["DEPTO"] == 'ffc' || $_SESSION["DEPTO"] == 'ffm') { $s_g .= " and aut2.id_division=folios.id_division and (aut2.id_pc='%' or aut2.id_pc=folios.id_pc) and (aut2.id_proyecto='%' or "; $s_g .= "aut2.id_proyecto=folios.id_proyecto)"; } elseif ($_SESSION["DEPTO"] == 'lo' || $_SESSION["DEPTO"] == 'loa' || $_SESSION["DEPTO"] == 'sqm' || $_SESSION["DEPTO"] == 'inv') { $s_g .= " and aut2.id_area=folios.id_area "; } else { $s_g .= " and aut2.id_division=folios.id_division and (aut2.id_area='%' or aut2.id_area=folios.id_area) and (aut2.id_proyecto='%' or "; $s_g .= "aut2.id_proyecto=folios.id_proyecto)"; } $s_g .= " order by id_emp, no_folio desc)"; $r_g = mysql_query($s_g); $s_a = "SELECT count(no_folio) as total, vw_mails.id_planta, planta, id_division, division, vw_mails.nombre, vw_mails.apellidos, vw_mails.mail, vw_mails.id_emp, "; $s_a .= "depto, tabla.jefe, emp.nombre as nombre2, emp.apellidos as apellidos2, emp.mail as mail2 FROM vw_mails, empleados emp, "; switch ($_SESSION["DEPTO"]) { case "lpl": $s_a .= "divisiones as tabla where tabla.id = vw_mails.id_division and emp.id = tabla.jefe "; $s_a .= "group by id_division, id_pc, id_proyecto order by id_division, id_pc, id_proyecto, id_emp"; break; case "ffc": $s_a .= "divisiones as tabla where tabla.id = vw_mails.id_division and emp.id = tabla.jefe "; $s_a .= "group by id_division, id_pc, id_proyecto order by id_division, id_pc, id_proyecto, id_emp"; break; case "ffm": $s_a .= "divisiones as tabla where tabla.id = vw_mails.id_division and emp.id = tabla.jefe "; $s_a .= "group by id_division, id_pc, id_proyecto order by id_division, id_pc, id_proyecto, id_emp"; break; case "lo": $s_a .= "plantas as tabla where tabla.id = vw_mails.id_division and emp.id = tabla.jefe "; $s_a .= "group by id_planta order by id_planta, id_emp"; break; case "loa": $s_a .= "plantas as tabla where tabla.id = vw_mails.id_division and emp.id = tabla.jefe "; $s_a .= "group by id_planta order by id_planta, id_emp"; break; case "sqm": $s_a .= "plantas as tabla where tabla.id = vw_mails.id_division and emp.id = tabla.jefe "; $s_a .= "group by id_planta order by id_planta, id_emp"; break; case "fin": $s_a .= "plantas as tabla where tabla.id = vw_mails.id_division and emp.id = tabla.jefe "; $s_a .= "group by id_planta order by id_planta, id_emp"; break; case "prod": $s_a .= "divisiones as tabla where tabla.id = vw_mails.id_division and emp.id = tabla.jefe "; $s_a .= "group by id_division, id_area, id_proyecto order by id_division, id_area, id_proyecto, id_emp"; break; case "inv": $s_a .= "divisiones as tabla where tabla.id = vw_mails.id_division and emp.id = tabla.jefe "; $s_a .= "group by id_division, id_emp order by id_division, id_emp"; break; } //Enviar los correos que corresponda a los autorizadores $r_a = mysql_query($s_a); $i = 0; while ($d_a = mysql_fetch_array($r_a)) { $id_e_p = $d_a['id_emp']; $mail_p = $d_a['mail']; $nombre_p = $d_a['nombre'] . " " . $d_a['apellidos']; $id_e_c = $d_a['jefe']; $mail_c = $d_a['mail2']; $nombre_c = $d_a['nombre2'] . " " . $d_a['apellidos2']; $subject = utf8_encode("Scrap en espera de autorización - {$d_a['depto']}"); $msj = aviso($mail_c, $mail_p, $nombre_p, $d_a['total'], $d_a['planta'], $d_a['division'], $limite); $s_m = "insert into mails values('','{$empleado}', '{$nombre}', '{$mail}', '{$subject}', '{$msj}', '{$hoy}', '{$hora}', '', '')"; $r_m .= mysql_query($s_m); //echo html_entity_decode($msj)."<br>"; if ($mail_p != '') { //mail($mail_p,$subject,html_entity_decode($msj),$sheader); $s_m = "insert into mails values('','{$id_e_p}', '{$nombre_p}', '{$mail_p}', '{$subject}', '{$msj}', '{$hoy}', '{$hora}', '', '')"; $r_m .= mysql_query($s_m); } if ($mail_c != '') { //mail($mail_c,$subject,html_entity_decode($msj),$sheader); $s_m = "insert into mails values('','{$id_e_c}', '{$nombre_c}', '{$mail_c}', '{$subject}', '{$msj}', '{$hoy}', '{$hora}', '', '')"; $r_m .= mysql_query($s_m); } } $s_ = "update autorizaciones set aviso='{$hoy}' where status='0' and depto='{$_SESSION['DEPTO']}'"; $r_ = mysql_query($s_); }