<?php require_once '../../../server/bootstrap.php'; $page = new GerenciaComponentPage(); $page->addComponent(new TitleComponent("Categorias de Productos")); $page->addComponent("<div class='POS Boton' onClick='window.location=\"productos.categoria.nueva.php\"'>Crear</div>"); // Lista $categorias = ProductosController::BuscarCategoria(); $table = new TableComponent(array('nombre_completo' => '<b>Nombre completo</b>'), $categorias['categorias']); $table->addOnClick("id_clasificacion_producto", "(function(a){window.location = 'productos.categoria.ver.php?id='+a;})"); $page->addComponent($table); $page->render();
<?php define("BYPASS_INSTANCE_CHECK", false); require_once "../../../server/bootstrap.php"; $page = new GerenciaComponentPage(); $page->addComponent(new TitleComponent("Recalcular Existencias")); $page->addComponent("<p>Este apartado sirve para recalcular la cantidad de producto que hay por Empresa, Almacen y Lote.</p>"); $page->partialRender(); $company = ProductosController::listarProductosLote(); ?> <div><center><input type="button" value="Recalcular Todo" onClick="recalculaTodo();"/></center></div> <?php $productos = "["; foreach ($company->empresas as $empresa) { ?> <h1>Empresa : </h1> <h2>-<?php echo utf8_decode($empresa->nombre); ?> -</h2> <?php foreach ($empresa->almacenes as $almacen) { foreach ($almacen->lotes as $lote) { ?> <h3><?php echo $almacen->nombre . " -> " . $lote->folio; ?>
public function testEditarUnidadUdm() { //se crea un nueva udm y categoria $abreviatura_Udm = self::RandomString(5, true, FALSE, FALSE); $abreviatura_Udm_editada = self::RandomString(5, true, FALSE, FALSE); $descripcion_Udm = self::RandomString(15, true, FALSE, FALSE); $descripcion_catUdm = self::RandomString(15, true, FALSE, FALSE); $cat = ProductosController::NuevaCategoriaUdm($descripcion_catUdm); $udm = ProductosController::NuevaUnidadUdm($abreviatura = $abreviatura_Udm, $descripcion = $descripcion_Udm, $factor_conversion = 1, $id_categoria_unidad_medida = $cat['id_categoria_unidad_medida'], $tipo_unidad_medida = "Referencia UdM para esta categoria"); $this->assertInternalType("int", $udm["id_unidad_medida"], "---- 'testEditarUnidadUdm' 'id_unidad_medida' NO ES UN ENTERO"); $udmObj = UnidadMedidaDAO::getByPK($udm['id_unidad_medida']); //se edita la Udm recien ingresada ProductosController::EditarUnidadUdm($id_unidad_medida = $udmObj->getIdUnidadMedida(), $id_categoria_unidad_medida = $udmObj->getIdCategoriaUnidadMedida(), $abreviacion = $abreviatura_Udm_editada, $descripcion = "descripcion", $factor_conversion = $udmObj->getFactorConversion(), $tipo_unidad_medida = $udmObj->getTipoUnidadMedida()); //se redefine el obj para comparar valores $udmObj2 = UnidadMedidaDAO::getByPK($udmObj->getIdUnidadMedida()); $this->assertEquals($udmObj2->getAbreviacion(), $abreviatura_Udm_editada, "NO SE EDITÓ LA CategoriaUdm"); }
protected function GenerateResponse() { try { $this->response = ProductosController::DesactivarUnidadUdm(isset($_GET['id_unidad_medida']) ? $_GET['id_unidad_medida'] : null); } catch (Exception $e) { //Logger::error($e); throw new ApiException($this->error_dispatcher->invalidDatabaseOperation($e->getMessage())); } }
<?php define("BYPASS_INSTANCE_CHECK", false); require_once "../../../server/bootstrap.php"; $page = new GerenciaComponentPage(); $page->addComponent(new TitleComponent("Productos")); $page->addComponent(new MessageComponent("Lista de productos en sus empresas")); $tabla = new TableComponent(array("codigo_producto" => "codigo_producto", "nombre_producto" => "nombre_producto", "descripcion" => "descripcion", "activo" => "activo"), ProductosController::Lista()); $tabla->addColRender("activo", "funcion_activo"); $tabla->addOnClick("id_producto", "(function(a){ window.location = 'productos.ver.php?pid=' + a; })"); $page->addComponent($tabla); $page->render();
public function testEditar() { ProductosController::EditarUnidadUdm(1, null, null, 'Metro'); ProductosController::EditarUnidadUdm(1, null, null, 'METRO'); }
function calcExistencias($id_unidad, $row) { $unidadM = UnidadMedidaDAO::getByPK($id_unidad); if (is_null($unidadM)) { return ProductoDAO::ExistenciasTotales($row["id_producto"]); } return ProductoDAO::ExistenciasTotales($row["id_producto"]) . " " . $unidadM->getAbreviacion(); } $tabla->addColRender("activo", "funcion_activo"); $tabla->addColRender("precio", "precio"); $tabla->addColRender("id_unidad", "calcExistencias"); $tabla->addOnClick("id_producto", "(function(a){ window.location = 'productos.ver.php?pid=' + a; })"); $page->addComponent($tabla); $page->nextTab("Unidades"); $page->addComponent(new TitleComponent("Lista de unidades existentes", 2)); $u = ProductosController::BuscarUnidadUdm(); $tUnidades = new TableComponent(array("id_categoria_unidad_medida" => "Categoria", "abreviacion" => "Nombre", "factor_conversion" => "Factor de conversion", "activa" => "Activa"), $u["resultados"]); function nombreRender($v, $obj) { return $obj["descripcion"] . " (" . $v . ")"; } function uCatRender($v, $obj) { $c = CategoriaUnidadMedidaDAO::getByPK($v); return $c->getDescripcion(); } function uFactorConversion($fConversion, $obj) { //if($fConversion == 1) return "-"; //de lo contrario, buscar a que categoria pertenece //y poner $fConversion . unidad_referencia
// sacar las propiedades indicadas $campos = ConfiguracionDAO::Propiedades(); $columns = array(); foreach ($campos as $key => $value) { if ($value == "foto_del_producto") { unset($campos[$key]); } else { $columns[$value] = ucwords(str_replace('_', ' ', $value)); } } // sacar los productos correspondientes function filter($product) { return $product->getVisibleEnVc(); } $products = array_filter(ProductosController::Lista(), "filter"); // dar formato a los campos como corresponda foreach ($products as $product) { $product->setPrecio(FormatMoney($product->getPrecio())); $product->setCostoEstandar(FormatMoney($product->getCostoEstandar())); $product->setCostoExtraAlmacen(FormatMoney($product->getCostoExtraAlmacen())); if ($product->getCompraEnMostrador()) { $product->setCompraEnMostrador("Sí"); } else { $product->setCompraEnMostrador("No"); } $unidad = UnidadMedidaDAO::getByPK($product->getIdUnidadCompra()); if (!is_null($unidad)) { $product->setIdUnidadCompra($unidad->getDescripcion()); } $unidad = UnidadMedidaDAO::getByPK($product->getIdUnidad());
public function testEditarTodo() { $categoria = self::$categoria_peso; ProductosController::EditarCategoriaUdm($categoria->getIdCategoriaUnidadMedida(), false, 'Peso'); $categoria = CategoriaUnidadMedidaDAO::getByPK($categoria->getIdCategoriaUnidadMedida()); $this->assertEquals($categoria->getDescripcion(), 'Peso'); $this->assertEquals($categoria->getActiva(), 0); }
<?php define("BYPASS_INSTANCE_CHECK", false); require_once "../../../server/bootstrap.php"; $page = new GerenciaComponentPage(); $page->addComponent(new TitleComponent("Equivalencias entre unidades")); $page->addComponent(new MessageComponent("Lista de equivalencias entre unidades")); $tabla = new TableComponent(array("id_unidad" => "Una unidad de", "equivalencia" => "Equivale a ", "id_unidades" => "Unidades"), ProductosController::Lista_equivalenciaUnidad()); function funcion_unidad($unidad) { return UnidadDAO::getByPK($unidad) ? UnidadDAO::getByPK($unidad)->getNombre() : "????"; } $tabla->addColRender("id_unidad", "funcion_unidad"); $tabla->addColRender("id_unidades", "funcion_unidad"); $tabla->addOnClick("id_unidad", "(function(a){ window.location = 'productos.unidad.ver.php?uid=' + a; })"); $page->addComponent($tabla); $page->render();
<?php require_once '../../../server/bootstrap.php'; $page = new GerenciaComponentPage(); $page->requireParam("id", "GET", "Esta categoría no existe."); // si no existe la categoria $response = ProductosController::DetallesCategoria($_GET['id']); if (is_null($response['categoria'])) { print "XD"; // temp } $categoria = $response['categoria']; // detalles $form = new DAOFormComponent($categoria); $form->setEditable(false); $form->setValueField('nombre', $categoria->getNombre()); $form->setValueField('descripcion', $categoria->getDescripcion()); $form->setValueField('activa', $categoria->getActiva() ? 'Sí' : 'No'); $form->setCaption('id_categoria_padre', 'Categoría Padre'); $form->hideField(array('id_clasificacion_producto')); // mostrar el nombre del padre si tiene $response = ProductosController::DetallesCategoria($categoria->getIdCategoriaPadre()); if (!is_null($response['categoria'])) { $form->setValueField('id_categoria_padre', $response['categoria']->getNombre()); } $page->addComponent(new TitleComponent($categoria->nombre_completo)); $page->addComponent("<div class='POS Boton' onClick='window.location=\"productos.categoria.editar.php?id=" . $categoria->getIdClasificacionProducto() . "\"'>Editar</div>"); $page->addComponent("<div class='POS Boton' onClick='window.location=\"productos.categoria.nueva.php\"'>Crear</div>"); $page->addComponent($form); $page->render();
<?php define("BYPASS_INSTANCE_CHECK", false); require_once "../../../server/bootstrap.php"; $page = new GerenciaComponentPage(); $page->addComponent(new TitleComponent("Categorias Unidades de Medida")); $page->addComponent(new MessageComponent("Lista Categorias Unidades de Medida")); $resultados = ProductosController::BuscarCategoriaUdm(); $tabla = new TableComponent(array("descripcion" => "Descripcion", "activa" => "Activa"), $resultados['resultados']); $tabla->addColRender("activa", "funcion_activa"); $tabla->addOnClick("id_categoria_unidad_medida", "(function(a){ window.location = 'productos.categoria_unidad_medida.ver.php?cuid=' + a; })"); $page->addComponent($tabla); $page->render();
define("BYPASS_INSTANCE_CHECK", false); require_once "../../../server/bootstrap.php"; if (!empty($_FILES)) { if (!SesionController::isLoggedIn()) { throw new ApiException($this->error_dispatcher->invalidAuthToken()); } set_time_limit(600); Logger::log("Subiendo archivo ... "); if ($_REQUEST["type"] == "csv-clientes") { move_uploaded_file($_FILES["logo"]["tmp_name"], "../../../static_content/" . IID . "-clientes.csv"); ClientesController::Importar(file_get_contents("../../../static_content/" . IID . "-clientes.csv")); } if ($_REQUEST["type"] == "csv-productos") { move_uploaded_file($_FILES["logo"]["tmp_name"], "../../../static_content/" . IID . "-productos.csv"); ProductosController::Importar(file_get_contents("../../../static_content/" . IID . "-productos.csv")); } if ($_REQUEST["type"] == "csv-proveedores") { move_uploaded_file($_FILES["logo"]["tmp_name"], "../../../static_content/" . IID . "-proveedores.csv"); ProveedoresController::Importar(file_get_contents("../../../static_content/" . IID . "-proveedores.csv")); } if ($_REQUEST["type"] == "logo") { move_uploaded_file($_FILES["logo"]["tmp_name"], "../static/" . IID . ".jpg"); } echo '{"status":"ok"}'; exit; } $page = new GerenciaTabPage(); $page->addComponent("<script>Ext.Ajax.timeout = 5 * 60 * 1000; /* 5 minutos */ </script>"); $page->addComponent(new TitleComponent("Configuracion de POS ERP")); if (!is_writable("../../../static_content/")) {
/** * * Busca en el erp * * @param query string * @return numero_de_resultados int * @return resultados json * */ static function Buscar($query) { $out = array(); //buscar clientes $c = ClientesController::Buscar(null, null, 5000, null, $query); foreach ($c["resultados"] as $cliente) { array_push($out, array("texto" => $cliente["nombre"], "rfc" => $cliente["rfc"], "id" => $cliente["id_usuario"], "tipo" => "cliente")); } //buscar productos $p = ProductosController::Buscar($query); foreach ($p["resultados"] as $cliente) { array_push($out, array("texto" => $cliente["nombre_producto"], "id" => $cliente["id_producto"], "tipo" => "producto")); } //buscar servicios $s = ServiciosController::Buscar($query); foreach ($s["resultados"] as $cliente) { array_push($out, array("texto" => $cliente["nombre_servicio"], "id" => $cliente["id_servicio"], "tipo" => "servicio")); } /* array_push($out, array( "texto" => "¿ Como crear un cliente ?", "id" => 0, "tipo" => "Ayuda" )); */ return array("numero_de_resultados" => sizeof($c) + sizeof($p) + sizeof($s), "resultados" => $out); }