$btn_eliminar->onApiCallSuccessRedirect("sucursales.lista.tipo_almacen.php");
    $btn_eliminar->addName("eliminar");
    $funcion_eliminar = " function eliminar_sucursal(btn){" . "if(btn == 'yes')" . "{" . "var p = {};" . "p.id_tipo_almacen = " . $_GET["tid"] . ";" . "sendToApi_eliminar(p);" . "}" . "}" . "      " . "function confirmar(){" . " Ext.MessageBox.confirm('Eliminar', 'Desea eliminar este tipo de almacen?', eliminar_sucursal );" . "}";
    $btn_eliminar->addOnClick("confirmar", $funcion_eliminar);
    $menu->addMenuItem($btn_eliminar);
}
$page->addComponent($menu);
//
// Forma de producto
//
$form = new DAOFormComponent($este_tipo_almacen);
$form->setEditable(false);
$form->hideField(array("id_tipo_almacen", "activo"));
$page->addComponent($form);
$page->addComponent(new TitleComponent("Almacenes con este tipo de almacen"));
$r = AlmacenesController::Buscar(null, null, null, $_GET["tid"]);
$tabla = new TableComponent(array("nombre" => "Nombre", "id_sucursal" => "Sucursal", "id_empresa" => "Empresa", "activo" => "Activo"), $r['resultados']);
function funcion_sucursal($id_sucursal)
{
    return SucursalDAO::getByPK($id_sucursal) ? SucursalDAO::getByPK($id_sucursal)->getRazonSocial() : "------";
}
function funcion_empresa($id_empresa)
{
    return EmpresaDAO::getByPK($id_empresa) ? EmpresaDAO::getByPK($id_empresa)->getRazonSocial() : "------";
}
function funcion_activo($activo)
{
    return $activo ? "Activo" : "Inactivo";
}
$tabla->addColRender("id_sucursal", "funcion_sucursal");
$tabla->addColRender("id_empresa", "funcion_empresa");
Beispiel #2
0
 * Tab Cajas
 */
$page->nextTab("Cajas");
$page->addComponent(new TitleComponent("Cajas", 3));
$tabla = new TableComponent(array("descripcion" => "Descripcion", "abierta" => "Abierta", "activa" => "Activa"), SucursalesController::ListaCaja(NULL, $_GET["sid"]));
$tabla->addColRender("abierta", "funcion_abierta");
$tabla->addColRender("activa", "funcion_activa");
$tabla->addOnClick("id_caja", "(function(a){window.location = 'sucursales.caja.ver.php?cid='+a;})");
$tabla->addNoData("No hay ninguna caja asociada a esta sucursal. <a href='sucursales.nueva.caja.php'>&iquest; Desea agregar un elemento?.</a>");
$page->addComponent($tabla);
/*
 * Tab Almacenes
 */
$page->nextTab("Almacenes");
$page->addComponent(new TitleComponent("Almacenes", 3));
$sucs = AlmacenesController::Buscar();
$tabla = new TableComponent(array("nombre" => "Nombre", "id_empresa" => "Empresa", "id_tipo_almacen" => "Tipo de almacen", "activo" => "Activo"), $sucs["resultados"]);
$tabla->addColRender("id_empresa", "funcion_empresa");
$tabla->addColRender("id_tipo_almacen", "funcion_tipo_almacen");
$tabla->addColRender("activo", "funcion_activo");
$tabla->addOnClick("id_almacen", "(function(a){window.location = '#';})");
$tabla->addNoData("No hay ningun almacen asociado a esta sucursal. <a href='#'>&iquest; Desea agregar un elemento?.</a>");
$page->addComponent($tabla);
/*$page->addComponent(new TitleComponent("Nuevo almacen en esta sucursal", 2 ));

	$nalmacen_obj = new Almacen();
	$nalmacen_obj->setIdSucursal($esta_sucursal->getIdSucursal());

	$nalmacen = new DAOFormComponent($nalmacen_obj);
	$nalmacen->hideField(array(
		"id_sucursal",
Beispiel #3
0
 protected function GenerateResponse()
 {
     try {
         $this->response = AlmacenesController::Buscar(isset($_GET['id_empresa']) ? $_GET['id_empresa'] : null);
     } catch (Exception $e) {
         //Logger::error($e);
         throw new ApiException($this->error_dispatcher->invalidDatabaseOperation($e->getMessage()));
     }
 }
 /**
  *
  *
  *	Lotes
  *
  **/
 public function testLotes()
 {
     $almacenes = AlmacenesController::Buscar(true);
     $almacenId = $almacenes["resultados"][0]->getIdAlmacen();
     //nuevo lote
     $nLote = AlmacenesController::NuevoLote($almacenId);
     $this->assertNotNull($l = LoteDAO::getByPK($nLote["id_lote"]));
     $producto = new Producto(array("compra_en_mostrador" => false, "metodo_costeo" => "precio", "precio" => 123.123, "activo" => true, "codigo_producto" => time() . "tp", "nombre_producto" => time() . "np", "costo_estandar" => 12.3123, "id_unidad" => 1));
     ProductoDAO::save($producto);
     $r = AlmacenesController::EntradaLote($nLote["id_lote"], array(array("id_producto" => $producto->getIdProducto(), "cantidad" => 23)));
     //Vamos a validar estas tablas
     $this->assertNotNull(LoteEntradaDAO::getByPK($r["id_entrada_lote"]));
     $this->assertNotNull(LoteProductoDAO::getByPK($nLote["id_lote"], $producto->getIdProducto()));
     $this->assertNotNull(LoteEntradaProductoDAO::getByPK($r["id_entrada_lote"], $producto->getIdProducto(), 1));
     //sacar de ese lote, uno por uno hasta llegar a retirar todo
     for ($i = 0; $i < 23; $i++) {
         AlmacenesController::SalidaLote($nLote["id_lote"], array(array("id_producto" => $producto->getIdProducto(), "cantidad" => 1, "id_unidad" => 1)));
     }
     Logger::log("la siguiente vez que retire algo, debe de arrojar una exception");
     try {
         AlmacenesController::SalidaLote($nLote["id_lote"], array(array("id_producto" => $producto->getIdProducto(), "cantidad" => 1, "id_unidad" => 1)));
         //esto nunca se deberia de ejecutar
         $this->assertTrue(false);
     } catch (InvalidDataException $ivde) {
         $this->assertNotNull($ivde);
     }
 }