<?php

include "../ReglasNegocio/tipo_obra.php";
$tipo_obra = new tipo_obra();
$editar = $_GET["editar"];
$boton = "verifica()";
if (!empty($editar)) {
    $nombre_tipo_obra = $tipo_obra->Select($editar);
    $row = mysql_fetch_array($nombre_tipo_obra);
    $codigo_tipo_obra = $row['CODIGO_TIPO_OBRA'];
    $nombre_tipo_obra = $row['NOMBRE_TIPO_OBRA'];
    $boton = "VerificaUpdate()";
}
//$nombre_direccion = "Hola";
?>
<script LANGUAGE="JavaScript">

function verifica()
{
	if (document.form.codigo_tipo_obra.value.length==0)
   {
		alert("Debe ingresar un Codigo");
		document.form.codigo_tipo_obra.focus();
      return 0;
	}
	if (document.form.nombre_tipo_obra.value.length==0)
   {
		alert("Debe ingresar un Nombre");
		document.form.nombre_tipo_obra.focus();
      return 0;
	}
예제 #2
0
<?php

//esto es un comm de ppalma
include "../ReglasNegocio/departamento.php";
include "../ReglasNegocio/tipo_obra.php";
include "../ReglasNegocio/obra.php";
$tipo_obra = new tipo_obra();
$departamento = new departamento();
$obra = new obra();
$editar = $_GET["editar"];
$cerrar = $_GET["cerrar"];
$boton = "verifica()";
$fecha = time();
$fecha_inicio_obra = date("d-m-Y", $fecha);
$visible = false;
if (!empty($editar)) {
    $id_obra = $obra->Select($editar);
    $row = mysql_fetch_array($id_obra);
    $id_tipo_obra = $row['ID_TIPO_OBRA'];
    $id_departamento = $row['ID_DEPARTAMENTO'];
    $nombre_obra = $row['NOMBRE_OBRA'];
    $encargado_obra = $row['ENCARGADO_OBRA'];
    $sFechaMySQL = $row['FECHA_INICIO_OBRA'];
    $fecha_inicio_obra = implode('/', array_reverse(explode('-', $sFechaMySQL)));
    $comentario_obra = $row['COMENTARIO_OBRA'];
    $boton = "VerificaUpdate()";
} elseif (!empty($cerrar)) {
    $id_obra = $obra->Select($cerrar);
    $row = mysql_fetch_array($id_obra);
    $id_tipo_obra = $row['ID_TIPO_OBRA'];
    $id_departamento = $row['ID_DEPARTAMENTO'];
<?php

include "../ReglasNegocio/tipo_obra.php";
$codigo_tipo_obra = $_POST["codigo_tipo_obra"];
$nombre_tipo_obra = $_POST["nombre_tipo_obra"];
$hd_variable = $_POST["hd_variable"];
$id_variable = $_POST["id_variable"];
//echo $hd_variable."<br>";
$address = new tipo_obra();
if (empty($codigo_tipo_obra)) {
    header("Location: paso.php?c=v");
} elseif ($hd_variable == "ingresar") {
    $value = $address->Select2($codigo_tipo_obra);
    if (empty($value)) {
        $value = $address->Add($codigo_tipo_obra, $nombre_tipo_obra);
    }
    header("Location: paso.php?c=v");
} elseif ($hd_variable == "editar") {
    $value = $address->Update($id_variable, $codigo_tipo_obra, $nombre_tipo_obra);
    header("Location: paso.php?c=v");
    //echo "edicion";
}