<?php

include "../ReglasNegocio/bodega.php";
$bodega = new bodega();
$editar = $_GET["editar"];
$boton = "verifica()";
if (!empty($editar)) {
    $nombre_bodega = $bodega->Select($editar);
    $row = mysql_fetch_array($nombre_bodega);
    $nombre_bodega = $row['NOMBRE_BODEGA'];
    $boton = "VerificaUpdate()";
}
?>
<script LANGUAGE="JavaScript">

function verifica()
{
	if (document.form.bodega.value.length==0)
   {
		alert("Debe ingresar un Nombre");
      return 0;
	}
   document.form.hd_variable.value="ingresar";
	document.form.submit();
}

function verifica2()
{
   document.form.bodega.value = "";
   document.form.submit();
}
<?php

include '../ReglasNegocio/bodega.php';
include '../ReglasNegocio/unidad.php';
include "../ReglasNegocio/asociado.php";
$asociado = new asociado();
$folio = $asociado->GetMayor() + 1;
$unidad = new unidad();
$bodega = new bodega();
$boton = "verifica()";
$boton2 = "verifica2()";
?>
<script LANGUAGE="JavaScript">

function verifica()
{
	if (document.miform.NInventario.value.length==0)
   {
		alert("Debe ingresar un Numero de Inventario");
		document.miform.MInventario.focus();
      	return 0;
	}
	if(document.miform.NombreI.value.length==0){
		alert("Debe ingresar un Nombre de Inventario");
		document.miform.NombreI.focus();
      	return 0;
	}
	if(document.miform.periodo.value.length==0){
		alert("Debe ingresar un Periodo, si es indefinido ingrese '-1'");
		document.miform.periodo.focus();
      	return 0;
<?php

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