/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Autores: Pedro Obregón Mejías
Rubén D. Mancera Morán
Luis Ignacio Albacete
Fecha Liberación del código: 25/10/2007
Factusyn 2007 -- Murcia
*/
?>
Factusyn
include ("conectar.php");
if ($pase=="")
{
?>
¡¡¡ Está Usted completamente seguro de eliminar el ejercicio económico: ¡¡¡
}
else
{
$error="";
//comprobamos que no hay caracteres
if (!ereg("^[0-9]+[0-9]*$",$ejercicio)) $error = $error . "
El ejercicio contiene caracteres. Introdúzcalo correctamente.
";
if (($ejercicio==date(Y)) or ($ejercicio==date(Y)-1) or ($ejercicio==date(Y)-2) or ($ejercicio==date(Y)-3) or ($ejercicio==date(Y)-4) or ($ejercicio==date(Y)-5) or ($ejercicio==date(Y)-6))
{
$error=$error . "
Este Ejercicio económico no se puede eliminar. Puede eliminar aquellos que tienen una antigüedad de más de 6 años.
";
};
if ($error=="")
{
//borro las líneas de las facturas del anyo seleccionado
$consulta = "select * from facturas where anyo=$ejercicio";
$query = mysql_query($consulta);
while ($row=mysql_fetch_array($query))
{
$codigo=$row["codfactura"];
$consulta2 = "delete from factulinea where codfactura=$codigo";
$query2 = mysql_query($consulta2);
$codigo=$row["codfactura"];
$consulta2 = "delete from factulineatmp where codfactura=$codigo";
$query2 = mysql_query($consulta2);
}
//
//borro las líneas de los albaranes del anyo seleccionado
//
$consulta = "select * from albaranes where anyo=$ejercicio";
$query = mysql_query($consulta);
while ($row=mysql_fetch_array($query))
{
$codigo=$row["codalbaran"];
$consulta2 = "delete from albalinea where codalbaran=$codigo";
$query2 = mysql_query($consulta2);
$codigo=$row["codalbaran"];
$consulta2 = "delete from albalineatmp where codalbaran=$codigo";
$query2 = mysql_query($consulta2);
}
//Borro las facturas del anyo seleccionado
$consulta="delete from facturas where anyo=$ejercicio";
$query = mysql_query($consulta);
$consulta="delete from facturastmp where anyo=$ejercicio";
$query = mysql_query($consulta);
$consulta="delete from albaranes where anyo=$ejercicio";
$query = mysql_query($consulta);
$consulta="delete from albaranestmp where anyo=$ejercicio";
$query = mysql_query($consulta);
//
//mostramos el mensaje de errores
//
$loguito="logo.jpg";
$cabecera="ejercicioseconomicos.jpg";
$texto="Ejercicio económico borrado satisfactoriamente.";
$actionv="eliminar_ejercicio_economico.php";
$valuev="Ejercicios Económicos";
include ("mensaje.php");
}
else
{
//
//mostramos el mensaje de errores
//
$loguito="logo.jpg";
$cabecera="ejercicioseconomicos.jpg";
$texto="Error: " . $error;
$actionv="eliminar_ejercicio_economico.php";
$valuev="Ejercicios Económicos";
include ("mensaje.php");
}
?>