public function buildDashboard() { $this->setDashboardTitle("Genresman Dashboard"); $form = new FormComponent('form1'); $form->setCaption("Form Employees"); $form->setDimensions(12, 3); $form->addDateRangeField('datebtw', 'Select Date', array("defaultStartDate" => "2014-04-23", "defaultEndDate" => "2014-05-01")); $this->addComponent($form); $dailySales = new ChartComponent('c1'); $dailySales->setDimensions(7, 6); $dailySales->setCaption("Daily Sales"); $dailySalesData = $this->getDailySales('2014-04-23', '2014-05-01'); $dailySales->setYAxis("Revenue", array("numberHumanize" => true)); $dailySales->addYAxis("covers", "Covers", array()); $dailySales->setLabels(ArrayUtils::pluck($dailySalesData, "tarih2")); $dailySales->addSeries('food', "Food", ArrayUtils::pluck($dailySalesData, "cikis")); $dailySalesFoodData = $this->getDailySalesFood('2014-04-23', '2014-05-01'); $dailySales->addSeries('covers', "Covers", ArrayUtils::pluck($dailySalesFoodData, "cikis"), array("yAxis" => "covers", "seriesDisplayType" => "line")); $this->addComponent($dailySales); $monthlySales = new ChartComponent('c2'); $monthlySales->setDimensions(5, 6); $monthlySales->setCaption("Monthly Sales"); $monthlySalesData = $this->getMonthlySales(); $monthlySales->setYAxis("Revenue", array("numberHumanize" => true)); $monthlySales->addYAxis("covers", "Covers", array()); $monthlySales->setLabels(ArrayUtils::pluck($monthlySalesData, "ay")); $monthlySales->addSeries('food', "Food", ArrayUtils::pluck($monthlySalesData, "cikis")); $monthlySalesFood = $this->getMonthlySalesFood(); $monthlySales->addSeries('covers', "Covers", ArrayUtils::pluck($monthlySalesFood, "cikis"), array("yAxis" => "food", "seriesDisplayType" => "line")); $this->addComponent($monthlySales); $item = new ChartComponent('c3'); $item->setDimensions(7, 6); $item->setCaption("Item Categories"); $item->setYAxis("", array("numberHumanize" => true)); $itemCategories = $this->getItemCategories('2014-04-23', '2014-05-01'); $item->setLabels(ArrayUtils::pluck($itemCategories, "grupadi")); $item->addSeries('items', "Items", ArrayUtils::pluck($itemCategories, "cikis")); $this->addComponent($item); $chart = new ChartComponent("pie_chart"); $chart->setCaption("Clerk Sales"); $chart->setDimensions(5, 6); $clerkData = $this->getClerkSales('2014-04-23', '2014-05-01'); $chart->setLabels(ArrayUtils::pluck($clerkData, "garson")); $chart->setPieValues(ArrayUtils::pluck($clerkData, "cikis"), array("numberHumanize" => true)); $this->addComponent($chart); $hour = new ChartComponent('c4'); $hour->setDimensions(12, 6); $hour->setCaption("Hourly Sales"); $hour->setYAxis("", array("numberHumanize" => true)); $hourlySales = $this->getHourlySales('2014-04-23', '2014-05-01'); $hour->setLabels(ArrayUtils::pluck($hourlySales, "SAAT")); $hour->addSeries('items', "Items", ArrayUtils::pluck($hourlySales, "CIKIS")); $this->addComponent($hour); $form->onApplyClick(array($dailySales, $item, $chart, $hour), "handleForm", $this); }
public function buildDashboard() { $form = new FormComponent("form"); $form->setCaption("Test Form Component"); $form->setDimensions(4, 4); $form->addTextField('name', 'Name'); $form->addSelectField('products', 'Products', array('Beverages', 'Chips', 'Cookies', 'Cakes', 'Dairy Products', 'Poultry'), array('defaultSelectedIndex' => 2)); $form->addMultiSelectField('cities', 'Cities', array('Bangalore', 'San Fransisco', 'New York', 'Melbourne', 'London', 'Rio De Jeneiro'), array('defaultSelectedOptions' => array(2, 4))); $form->addDateField('delivery_date', 'Delivery Date', array()); $form->addDateRangeField('grace_period', 'Grace Period', array()); $form->addNumericRangeField('units', 'Units in Stock', array(1, 2, 3)); $this->addComponent($form); }
function __construct($id, $css, $label, $type, $text = "") { parent::__construct($id, $css); $this->text = $text; $this->type = $type; $this->label = $label; }
/** * @param array $params */ public function __construct(array $params) { $requiredParams = ['text' => '', 'type' => '', 'classes' => []]; extract(array_merge($requiredParams, $params)); parent::__construct($classes); $this->text = $text; $this->type = $type; }
public function buildDashboard() { $this->setDashboardTitle("Stock Dashboard"); $this->setActionPath("/static/transfer/build/tour/motherboard_stock_action.php"); $kpi = new KPIGroupComponent('kpi'); $kpi->setDimensions(12, 2); $kpi->setCaption('Units stock by Category'); $Units = $this->get_units(true); foreach ($Units as $key => $value) { $kpi->addKPI($value['id'], array('caption' => $value['CategoryName'], 'value' => $value['Quantity'], 'numberSuffix' => ' units', 'numberHumanize' => true)); } $this->addComponent($kpi); $table = new TableComponent('table'); $table->setCaption("List of Item in Stock"); $table->setDimensions(6, 5); $stock = $this->get_stock(); $table->addColumn('id', 'Product Id'); $table->addColumn('name', 'Product Name'); $table->addColumn('category', 'Category'); $table->addColumn('price', 'Price', array("numberPrefix" => "\$", "dataType" => "number")); $table->addColumn('stock', 'Stock'); $table->addMultipleRows($this->PolulateData($stock)); $this->addComponent($table); $c12 = new FormComponent('filter'); $c12->setDimensions(6, 5); $c12->setCaption('Filter items in stock'); $category = $this->get_category(); $c12->addSelectField('category', 'Select Category', array_merge(['no selection'], ArrayUtils::pluck($category, 'CategoryName'))); $c12->addTextField('contains', 'Product Name Contains'); $c12->addNumericRangeField('stock', 'Units In Stock', array(0, 100)); $this->addComponent($c12); $c12->onApplyClick(array($table), 'handleApply', $this); }
public function buildDashboard() { $form = new FormComponent('form'); $form->setDimensions(8, 6); $form->setCaption('Form items in stock'); $form->addSelectField('category', 'Select Category', ['No Selection', 'Beverages', 'Condiments', 'Confections', 'Dairy Products', 'Grains/Cereal', 'Meat/Poultry', 'Produce', 'Seafood']); $form->addTextField('contains', 'Product Name Contains'); $form->addNumericRangeField('stock', 'Units In Stock', array(10, 100)); $form->addCheckboxField('discontinued', 'Exclude Discontinued Items', false); $this->addComponent($form); }
public function buildDashboard() { $c1 = new FormComponent("c1"); $c1->setCaption("Test Form Component"); $c1->setDimensions(6, 6); $c1->addTextField('name', 'Name'); $c1->addSelectField('products', 'Products', array('Beverages', 'Chips', 'Cookies', 'Cakes', 'Dairy Products', 'Poultry'), array()); $c1->addMultiSelectField('cities', 'Cities', array('Bangalore', 'San Fransisco', 'New York', 'Melbourne', 'London', 'Rio De Jeneiro'), array()); $c1->addDateField('delivery_date', 'Delivery Date', array()); $c1->addDateRangeField('grace_period', 'Grace Period', array()); $c1->addNumericRangeField('units', 'Units in Stock', array(0, 100)); $kpi = new KPIComponent('kpi1'); $kpi->setCaption('Stock'); $kpi->setDimensions(4, 4); $kpi->setValue(24); $this->addComponent($kpi); $this->addComponent($c1); $c1->onApplyClick(array($kpi), 'handleApply', $this); }
protected function onComponentTag(ComponentTag $tag) { parent::onComponentTag($tag); $this->checkComponentTag($tag, 'input'); $this->checkComponentTagAttribute($tag, 'type', 'checkbox'); $tag->put('value', $this->getValue()); if ($this->isSelected($this->getValue())) { $tag->put('checked', 'checked'); } }
/** * @param array $params */ public function __construct(array $params) { $requiredParams = ['type' => 'text', 'label' => '', 'placeholder' => '', 'templateName' => '', 'required' => false, 'classes' => []]; extract(array_merge($requiredParams, $params)); parent::__construct($classes); $this->type = $type; $this->label = $label; $this->placeholder = $placeholder; $this->templateName = $templateName; $this->required = $required === 'true' ? 'required' : ''; }
/** * @param array $params */ public function __construct(array $params) { $requiredParams = ['type' => 'checkbox', 'label' => '', 'templateName' => '', 'required' => false, 'multiple' => false, 'classes' => []]; extract(array_merge($requiredParams, $params)); parent::__construct($classes); $this->type = $type; $this->label = $label; $this->values = $values; $this->required = $required === 'true' ? 'required' : ''; $this->multiple = $multiple === 'true' ? 'multiple' : ''; $this->templateName = $templateName; }
/** * * @param string $id * @param callback $onSubmit Called when the form is valid * @param callback $onError Called when the form is not valid */ public function __construct($id, $onSubmit = null, $onError = null) { parent::__construct($id); if ($onSubmit != null) { Args::callBack($onSubmit, 'onSubmit'); } if ($onError != null) { Args::callBack($onError, 'onError'); } $this->onSubmit = $onSubmit; $this->onError = $onError; }
/** * * @param string $id * @param array $choices * @param Model $model */ public function __construct($id, $choices, ChoiceRenderer $choiceRenderer = null, Model $model = null, $isDisabled = null) { parent::__construct($id, $model); Args::isArray($choices, 'choices'); $this->choices = $choices; if ($choiceRenderer == null) { $choiceRenderer = new ChoiceRenderer(); } $this->choiceRenderer = $choiceRenderer; if ($isDisabled != null) { Args::callBackArgs($isDisabled, 2, 'isDisabled'); $this->isDisabled = $isDisabled; } }
/** * @param array $params */ public function __construct(array $params) { $requiredParams = ['type' => 'checkbox', 'label' => '', 'value' => '', 'templateName' => '', 'required' => false, 'classes' => []]; extract(array_merge($requiredParams, $params)); if (!is_array($classes)) { $classes = []; } //$classes[] = 'form-control'; parent::__construct($classes); $this->type = $type; $this->label = $label; $this->value = $value; $this->required = $required === 'true' ? 'required' : ''; $this->templateName = $templateName; $this->classes = implode(' ', $classes); }
public function buildDashboard() { $quarterlySales = new ChartComponent('quarterlySales'); $quarterlySales->setDimensions(6, 6); $quarterlySales->setCaption("Quarterly Sales"); $quarterlySales->setLabels(array("Q1", "Q2", "Q3", "Q4")); $quarterlySales->addYAxis('quantity', "Quantity"); $quarterlySales->addSeries('sales', "Sales", array(13122, 41312, 46132, 51135), array('numberPrefix' => "\$")); $quarterlySales->addSeries('quantity', "Quantity", array(121, 392, 420, 489), array('yAxis' => 'quantity')); $quarterlySales->addComponentKPI('beverage', array('caption' => 'Beverages', 'value' => 22900, 'numberPrefix' => ' $', 'numberHumanize' => true)); $quarterlySales->addComponentKPI('vegetable', array('caption' => 'Vegetables', 'value' => 10401, 'numberPrefix' => ' $', 'numberHumanize' => true)); $quarterlySales->addComponentKPI('dairy', array('caption' => 'Dairy', 'value' => 27700, 'numberPrefix' => ' $', 'numberHumanize' => true)); $quarterlySales->addDrillStep('drillIntoMonths', $this); $this->addComponent($quarterlySales); $numTickets = new KPIComponent('numTickets'); $numTickets->setDimensions(3, 3); $numTickets->setCaption("Open Support Tickets"); $numTickets->setValue(42); $this->addComponent($numTickets); $satisfactionGauge = new GaugeComponent('satisfactionGauge'); $satisfactionGauge->setDimensions(3, 3); $satisfactionGauge->setCaption('Customer Satisfaction'); $satisfactionGauge->setValue(8); $satisfactionGauge->setLimits(0, 10); $this->addComponent($satisfactionGauge); $ticketPriorities = new KPIGroupComponent('ticketPriorities'); $ticketPriorities->setDimensions(6, 3); $ticketPriorities->setCaption('Ticket Priorities'); $ticketPriorities->addKPI('high', array('caption' => 'High Priority', 'value' => 6)); $ticketPriorities->addKPI('normal', array('caption' => 'Normal Priority', 'value' => 36)); $this->addComponent($ticketPriorities); $productsTable = new TableComponent('productsTable'); $productsTable->setDimensions(6, 6); $productsTable->setCaption('Products'); $productsTable->addColumn('name', 'Name'); $productsTable->addColumn('category', 'Category'); $productsTable->addColumn('price', 'Price', array('dataType' => "number", 'numberPrefix' => "\$", 'textAlign' => "right", 'numberForceDecimals' => true)); $productsTable->addMultipleRows($this->tableData); $this->addComponent($productsTable); $productFilterForm = new FormComponent('productFilterForm'); $productFilterForm->setDimensions(6, 6); $productFilterForm->setCaption('Filter Products'); $productFilterForm->addMultiSelectField('category', 'Select Category', array('Vegetables', 'Dairy', 'Beverages')); $productFilterForm->addTextField('name', 'Product Name Contains'); $productFilterForm->addNumericRangeField('price', 'Price', array(5, 20)); $this->addComponent($productFilterForm); $productFilterForm->onApplyClick(array($productsTable), 'handleApplyClick', $this); }
public function buildDashboard() { $categories = ['Beverages', 'Condiments', 'Confections', 'Dairy Products', 'Grains/Cereal', 'Meat/Poultry', 'Produce', 'Seafood']; $c1 = new TableComponent("table1"); $c1->setCaption("List of items in stock"); $c1->setDimensions(6, 6); $c1->addColumn('ProductID', 'Product ID'); $c1->addColumn('ProductName', 'Product Name'); $c1->addColumn('CategoryName', 'Category'); $c1->addColumn('UnitPrice', 'Price', array('dataType' => 'number', 'numberPrefix' => '$', 'numberForceDecimals' => true, 'numberDecimalPoints' => 2)); $c1->addColumn('UnitsInStock', 'Stock'); $c1->addColumn('Discontinued', 'Discontinued?'); $this->addComponent($c1); $c2 = new FormComponent('form1'); $c2->setCaption("Form items in stock"); $c2->setDimensions(6, 6); $c2->addTextField('contains', 'Product Name Contains'); $c2->addNumericRangeField('stock', 'Units In Stock', array(10, 100)); $c2->addCheckboxField('discontinued', 'Exclude Discontinued Items', false); $this->addComponent($c2); }
function __construct($vo) { if (is_null($vo)) { throw new InvalidDataException(); } parent::__construct(); $this->api_method_to_call = NULL; if (is_array($vo)) { for ($a = 0; $a < sizeof($vo); $a++) { $fields = json_decode($vo[$a]->__toString()); foreach ($fields as $k => $v) { $caption = ucwords(str_replace("_", " ", $k)); parent::addField($k, $caption, "text", $v, $k); } } } else { $fields = json_decode($vo->__toString()); foreach ($fields as $k => $v) { $caption = ucwords(str_replace("_", " ", $k)); parent::addField($k, $caption, "text", $v, $k); } } }
public function buildDashboard() { $table = new TableComponent('table1'); $table->setCaption("Movies & Ratings"); $table->setDimensions(6, 6); $table->setRowsPerPage(8); $table->addColumn('rank', "Rank"); $table->addColumn('title', "Title"); $table->addColumn('rating', "Rating"); $table->addMultipleRows($this->rows); // Adding multiple rows at once $filter = new FormComponent('form'); $filter->setCaption('Filter'); $filter->setDimensions(5, 3); $filter->addSelectField('rating_filter', 'Rating Greater Than', array(5, 6, 7, 8, 9)); $filter->onApplyClick(array($table), 'handleApplyClick', $this); $this->addComponent($table); $this->addComponent($filter); }
public function buildDashboard() { $table = new TableComponent('table1'); $table->setCaption("List of Employees"); $table->setDimensions(6, 6); $employees = $this->getEmployees(); $table->addColumn('FirstName', "First Name"); $table->addColumn('LastName', "Last Name"); $table->addColumn('City', "City"); $table->addColumn('State', "State", array('textItalicFlag' => true)); $table->addColumn('Country', "Country"); $table->addMultipleRows($this->populateData($employees)); $this->addComponent($table); $form = new FormComponent('form1'); $form->setCaption("Form Employees"); $form->setDimensions(4, 4); $form->addTextField("contains", "City Contains"); $form->onApplyClick(array($table), "handleEmployeesSubmit", $this); $this->addComponent($form); }
public function isRequired() { $choice = $this->getChoiceGroup(); return $choice == null && parent::isRequired(); }
/** * @return Form */ final function addComponent(FormComponent $object) { Assert::isTrue(isset($this->components[$object->GetName()]), sprintf('Duplicate form element %s with %s name', get_class($object), $object->getName())); $this->components[$object->getName()] = $object; return $this; }
protected function onComponentTag(ComponentTag $tag) { parent::onComponentTag($tag); $this->checkComponentTag($tag, 'input'); $this->checkComponentTagAttribute($tag, 'type', 'file'); }
function __construct($id, $css, $text) { parent::__construct($id, $css); $this->text = $text; }
function __construct($id, $css, $label, $items) { parent::__construct($id, $css); $this->items = $items; $this->label = $label; }
protected function onComponentTag(ComponentTag $tag) { parent::onComponentTag($tag); $tag->remove('name'); }
} /*** * * Page Rendering * * * */ $p = new JediComponentPage(); /** * * Nueva instancia * **/ $p->addComponent(new TitleComponent("Nueva instancia")); $p->addComponent(new FreeHtmlComponent('<input type="text" style="font-size: 17px;" placeholder="Token" id="_new_instance_toke"> ')); $p->addComponent(new FreeHtmlComponent('<input type="text" style="font-size: 17px;" placeholder="Descripcion" id="_new_instance_desc"> ')); //$p->addComponent( new FreeHtmlComponent( '<div class="POS Boton OK" onclick="window.location=\'instancias.nueva.php?do=nueva&d=\'+HtmlEncode(Ext.get(\'_new_instance_desc\').getValue());">Nueva Instancia</div>') ); $p->addComponent(new FreeHtmlComponent('<div class="POS Boton OK" onclick="window.location=\'instancias.nueva.php?do=nueva&d=\'+ HtmlEncode(Ext.get(\'_new_instance_desc\').getValue()) + \'&t=\'+HtmlEncode(Ext.get(\'_new_instance_toke\').getValue());">Nueva Instancia</div>')); $p->addComponent(new FreeHtmlComponent("<hr>")); $p->addComponent(new TitleComponent("Utilizando una base de datos externa", 2)); $form = new FormComponent(); $form->addField("descripcion", "Descripcion", "text"); $form->addField("instance_token", "instance_token", "text"); $form->addField("db_user", "db_user", "text"); $form->addField("db_password", "db_password", "text"); $form->addField("db_name", "db_name", "text"); $form->addField("db_driver", "db_driver", "text"); $form->addField("db_host", "db_host", "text"); $form->addField("db_debug", "db_debug", "text"); $p->addComponent($form); $p->render();
$configuracion_ejercicio_form = new FormComponent(); $configuracion_ejercicio_form->addField("ejercicio", "Año del Ejercicio", "text", date("Y"), "ejercicio"); $page->addComponent($configuracion_ejercicio_form); $page->addComponent(new TitleComponent("Periodo", 3)); $configuracion_periodo_form = new FormComponent(); $configuracion_periodo_form->addField("duracion_periodo", "Duracion de periodos (meses)", "number", "1", "duracion_periodo"); $configuracion_periodo_form->addField("periodo_actual", "Periodo Actual", "number", "1", "periodo_actual"); $page->addComponent($configuracion_periodo_form); $page->addComponent(new TitleComponent("Impuestos", 2)); $impuestos_compra_form = new FormComponent(); $valores = array(); foreach (ImpuestoDAO::getAll() as $impuesto) { array_push($valores, array("id" => $impuesto->getIdImpuesto(), "caption" => $impuesto->getNombre())); } $impuestos_compra_form->addField('impuestos_compra', 'Impuestos Compra', 'listbox', $valores, 'impuestos_compra'); $impuestos_compra_form->addField('impuestos_venta', 'Impuestos Venta', 'listbox', $valores, 'impuestos_venta'); $page->addComponent($impuestos_compra_form); /* * Tab Pagos */ $page->nextTab("Pagos fuera de plazo"); $msj = "Estimado/a señor/señora,\n\nNuestros registros indican que algunos pagos en nuestra cuenta están aún pendientes. Puede encontrar los detalles a continuación.\n\n%s\n\nSi la cantidad ha sido ya pagada, por favor, descarte esta notificación. En otro caso, por favor remítanos el importe total abajo indicado.\n\n%s\n\nSi tiene alguna pregunta con respecto a su cuenta, por favor contáctenos.\n\nGracias de antemano por su colaboración.\nSaludos cordiales,"; $mensaje_form = new FormComponent(); $mensaje_form->addField("mensaje", "Mensaje pagos vencidos", "textarea", $msj, "mensaje"); $page->addComponent($mensaje_form); /* * Logica de envio de informacion */ $html = "<script>" . "\tvar impuestosSeleccionados = function(id_select){" . "\t\tvar select = Ext.get(id_select);" . "\t\tvar impuestos = [];" . "\t\tfor(var i = 0; i < select.dom.options.length; i++){" . "\t\t\tif(select.dom.options[i].selected === true){" . "\t\t\t\timpuestos[impuestos.length] = select.dom.options[i].value" . "\t\t\t}" . "\t\t}" . "\t\treturn impuestos;" . "\t};" . "" . "\tvar crearEmpresa = function(){" . "\t\tPOS.API.POST(" . "\t\t\t\"api/empresa/nuevo\"," . "\t\t\t{" . "\t\t\t\t\"razon_social\": Ext.get(\"razon_social\").getValue()," . "\t\t\t\t\"rfc\": Ext.get(\"rfc\").getValue()," . "\t\t\t\t\"representante_legal\": \"\"," . "\t\t\t\t\"direccion_web\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "sitio_web\").getValue()," . "\t\t\t\t\"direccion\": Ext.JSON.encode({" . "\t\t\t\t\t\"calle\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "calle\").getValue()," . "\t\t\t\t\t\"numero_exterior\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "numero_exterior\").getValue()," . "\t\t\t\t\t\"numero_interior\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "numero_interior\").getValue()," . "\t\t\t\t\t\"colonia\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "colonia\").getValue()," . "\t\t\t\t\t\"codigo_postal\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "codigo_postal\").getValue()," . "\t\t\t\t\t\"telefono1\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "telefono\").getValue()," . "\t\t\t\t\t\"telefono2\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "telefono2\").getValue()," . "\t\t\t\t\t\"id_ciudad\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "ciudad\").getValue()," . "\t\t\t\t\t\"referencia\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "referencia\").getValue()" . "\t\t\t\t})," . "\t\t\t\t\"uri_logo\": encodeURIComponent(Ext.get(\"img_logo\").dom.src)," . "\t\t\t\t\"impuestos_compra\": Ext.JSON.encode(impuestosSeleccionados(\"" . $impuestos_compra_form->getGuiComponentId() . "impuestos_compra" . "\"))," . "\t\t\t\t\"impuestos_venta\": Ext.JSON.encode(impuestosSeleccionados(\"" . $impuestos_compra_form->getGuiComponentId() . "impuestos_venta" . "\"))," . "\t\t\t\t\"cuentas_bancarias\":Ext.JSON.encode([])," . "\t\t\t\t\"mensaje_morosos\": Ext.get(\"" . $mensaje_form->getGuiComponentId() . "mensaje\").getValue()," . "\t\t\t\t\"contabilidad\": Ext.JSON.encode({" . "\t\t\t\t\t\"id_moneda\": Ext.get(\"" . $configuracion_moneda_form->getGuiComponentId() . "id_moneda\").getValue()," . "\t\t\t\t\t\"ejercicio\": Ext.get(\"" . $configuracion_ejercicio_form->getGuiComponentId() . "ejercicio\").getValue()," . "\t\t\t\t\t\"periodo_actual\": Ext.get(\"" . $configuracion_periodo_form->getGuiComponentId() . "periodo_actual\").getValue()," . "\t\t\t\t\t\"duracion_periodo\": Ext.get(\"" . $configuracion_periodo_form->getGuiComponentId() . "duracion_periodo\").getValue()" . "\t\t\t\t})" . "\t\t\t}," . "\t\t\t{" . "\t\t\t\tcallback:function(a){" . "\t\t\t\t\tif(a.status === \"ok\"){" . "\t\t\t\t\t\tExt.Msg.alert(\"Nueva Empresa\",\"Empresa creada correctamente\", function(){location.href=\"empresas.lista.php\"});" . "\t\t\t\t\t}else{" . "\t\t\t\t\t\tExt.Msg.alert(\"Nueva Empresa\",\"a.error\");" . "\t\t\t\t\t}" . "\t\t\t\t}" . "\t\t\t}" . "\t\t);" . "\t}" . "</script>"; $page->addComponent($html); $page->render();
$clasificaciones[$key] = $clasificacion->asArray(); } $form->createComboBoxJoin('id_categoria_contacto', 'nombre', $clasificaciones); $form->createComboBoxJoin("id_sucursal", "razon_social", SucursalDAO::search(new Sucursal(array("activa" => 1))), $este_cliente->getIdSucursal()); $form->createComboBoxJoinDistintName("id_tarifa_venta", "id_tarifa", "nombre", TarifaDAO::search(new Tarifa(array("tipo_tarifa" => "venta")))); $form->createComboBoxJoin("id_tarifa_compra", "nombre", TarifaDAO::search(new Tarifa(array("tipo_tarifa" => "compra")))); $form->createComboBoxJoin("tarifa_compra_obtenida", "tarifa_compra_obtenida", array("rol", "proveedor", "cliente", "usuario")); $form->createComboBoxJoin("tarifa_venta_obtenida", "tarifa_venta_obtenida", array("rol", "proveedor", "cliente", "usuario")); $form->addApiCall("api/cliente/editar/", "POST"); $form->onApiCallSuccessRedirect("clientes.ver.php?cid=" . $_GET["cid"]); $form->renameField(array("nombre" => "razon_social", "codigo_usuario" => "codigo_cliente", "correo_electronico" => "email", "id_categoria_contacto" => "clasificacion_cliente", "id_moneda" => "moneda_del_cliente", "pagina_web" => "sitio_web", "id_sucursal" => "sucursal")); $page->addComponent($form); $page->nextTab("Otros"); //buscar los parametros extra $out = ExtraParamsValoresDAO::getVals("usuarios", $este_cliente->getIdUsuario()); $epform = new FormComponent(); $epform->setEditable(true); foreach ($out as $ep) { $epform->addField($ep["campo"], $ep["caption"], $ep["tipo"], $ep["val"]); if (!is_null($ep["descripcion"])) { $epform->setHelp($ep["campo"], $ep["descripcion"]); } } $epform->beforeSend("editar_extra_p"); $page->addComponent(' <script> var cliente = ' . $_GET["cid"] . '; function editar_extra_p(obj){ return { id_cliente : cliente, extra_params : Ext.JSON.encode(obj)
$configuracion_periodo_form->addField("periodo_actual", "Periodo Actual", "text", $empresa["contabilidad"]["ejercicio"]["periodo"], "periodo_actual"); $configuracion_periodo_form->addField("periodo_inicio", "Inicio", "text", FormatTime($empresa["contabilidad"]["ejercicio"]["periodo_inicio"]), "periodo_inicio"); $configuracion_periodo_form->addField("periodo_fin", "Fin", "text", FormatTime($empresa["contabilidad"]["ejercicio"]["periodo_fin"]), "periodo_fin"); $configuracion_periodo_form->setEditable(false); $page->addComponent($configuracion_periodo_form); $page->addComponent(new TitleComponent("Impuestos", 2)); $impuestos_compra_form = new FormComponent(); $impuestos_compra = array(); foreach ($empresa["impuestos_compra"] as $impuesto) { array_push($impuestos_compra, array("id" => $impuesto->getIdImpuesto(), "caption" => $impuesto->getNombre())); } $impuestos_venta = array(); foreach ($empresa["impuestos_venta"] as $impuesto) { array_push($impuestos_venta, array("id" => $impuesto->getIdImpuesto(), "caption" => $impuesto->getNombre())); } $impuestos_compra_form->addField('impuestos_compra', 'Impuestos Compra', 'listbox', $impuestos_compra, 'impuestos_compra'); $impuestos_compra_form->addField('impuestos_venta', 'Impuestos Venta', 'listbox', $impuestos_venta, 'impuestos_venta'); $page->addComponent($impuestos_compra_form); /* * Tab Pagos */ $page->nextTab("Pagos fuera de plazo"); $mensaje_form = new FormComponent(); $mensaje_form->addField("mensaje", "Mensaje pagos vencidos", "textarea", $empresa["detalles"]->getMensajeMorosos(), "mensaje"); $page->addComponent($mensaje_form); /* * Logica de envio de informacion */ $html = "<script>" . "\tvar impuestosSeleccionados = function(id_select){" . "\t\tvar select = Ext.get(id_select);" . "\t\tvar impuestos = [];" . "\t\tfor(var i = 0; i < select.dom.options.length; i++){" . "\t\t\tif(select.dom.options[i].selected === true){" . "\t\t\t\timpuestos[impuestos.length] = select.dom.options[i].value" . "\t\t\t}" . "\t\t}" . "\t\treturn impuestos;" . "\t};" . "" . "\tvar editarEmpresa = function(){" . "\t\tPOS.API.POST(" . "\t\t\t\"api/empresa/editar\"," . "\t\t\t{" . "\t\t\t\t\"id_empresa\" : \"" . $_GET["eid"] . "\"," . "\t\t\t\t\"razon_social\": Ext.get(\"razon_social\").getValue()," . "\t\t\t\t\"rfc\": Ext.get(\"rfc\").getValue()," . "\t\t\t\t\"representante_legal\": \"\"," . "\t\t\t\t\"direccion_web\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "sitio_web\").getValue()," . "\t\t\t\t\"direccion\": Ext.JSON.encode({" . "\t\t\t\t\t\"calle\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "calle\").getValue()," . "\t\t\t\t\t\"numero_exterior\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "numero_exterior\").getValue()," . "\t\t\t\t\t\"numero_interior\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "numero_interior\").getValue()," . "\t\t\t\t\t\"colonia\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "colonia\").getValue()," . "\t\t\t\t\t\"codigo_postal\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "codigo_postal\").getValue()," . "\t\t\t\t\t\"telefono1\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "telefono\").getValue()," . "\t\t\t\t\t\"telefono2\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "telefono2\").getValue()," . "\t\t\t\t\t\"id_ciudad\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "ciudad\").getValue()," . "\t\t\t\t\t\"referencia\": Ext.get(\"" . $direccion_form->getGuiComponentId() . "referencia\").getValue()" . "\t\t\t\t})," . "\t\t\t\t\"uri_logo\": encodeURIComponent(Ext.get(\"img_logo\").dom.src)," . "\t\t\t\t\"impuestos_compra\": Ext.JSON.encode(impuestosSeleccionados(\"" . $impuestos_compra_form->getGuiComponentId() . "impuestos_compra" . "\"))," . "\t\t\t\t\"impuestos_venta\": Ext.JSON.encode(impuestosSeleccionados(\"" . $impuestos_compra_form->getGuiComponentId() . "impuestos_venta" . "\"))," . "\t\t\t\t\"cuentas_bancarias\":Ext.JSON.encode([])," . "\t\t\t\t\"mensaje_morosos\": Ext.get(\"" . $mensaje_form->getGuiComponentId() . "mensaje\").getValue()," . "\t\t\t}," . "\t\t\t{" . "\t\t\t\tcallback:function(a){" . "\t\t\t\t\tif(a.status === \"ok\"){" . "\t\t\t\t\t\tExt.Msg.alert(\"Modificar Empresa\",\"Empresa modificada correctamente\", function(){location.href=\"empresas.ver.php?eid=" . $_GET["eid"] . "\"});" . "\t\t\t\t\t}else{" . "\t\t\t\t\t\tExt.Msg.alert(\"Modificar Empresa\",\"a.error\");" . "\t\t\t\t\t}" . "\t\t\t\t}" . "\t\t\t}" . "\t\t);" . "\t}" . "</script>"; $page->addComponent($html); $page->render();
return $lvo->getFolio() . " <div style='font-size:11px; color: gray;'>Almacen " . $avo->getNombre() . "</div>"; } function unidadname($l) { $ll = UnidadMedidaDAO::GetByPK($l); if (is_null($ll)) { return "ERROR"; } return $ll->getAbreviacion(); } $page->addComponent($table_e); $table_e->addColRender("id_lote", "lotename"); $table_e->addColRender("id_unidad", "unidadname"); $page->addComponent("<hr>"); $page->addComponent(new TitleComponent("Nueva entrada", 2)); $entrada_lote = new FormComponent(); $entrada_lote->addField("id_lote", "Lote", "combobox"); //$entrada_lote->createComboBoxJoin("id_lote", "id_lote", LoteDAO::getAll( ) ); $entrada_lote->createComboBoxJoinDistintName("id_lote", "id_lote", "folio", LoteDAO::getAll()); $entrada_lote->setHelp("id_lote", "Lote a donde se insertara este arrivo"); $entrada_lote->addField("cantidad", "Cantidad", "text"); $este_producto = ProductoDAO::GetByPK($_GET["pid"]); $um = UnidadMedidaDAO::getByPK($este_producto->getIdUnidad()); if (!is_null($um)) { $entrada_lote->setHelp("cantidad", "Cantidad en " . $um->getDescripcion()); } else { $entrada_lote->setHelp("cantidad", "Error!"); } $entrada_lote->addField("productos", "", "text", "\" [ { \\\"id_producto\\\" : " . $_GET["pid"] . ", \\\"cantidad\\\" : 0 } ] \""); $entrada_lote->sendHidden("productos"); $entrada_lote->makeObligatory(array("id_lote", "cantidad"));
array_push($enum_array, array("caption" => $enum_string[$k], "id" => $enum_string[$k], "selected" => 0)); } $f->addField($values[$i]["campo"], $values[$i]["caption"], $values[$i]["tipo"], $enum_array); } else { $f->addField($values[$i]["campo"], $values[$i]["caption"], $values[$i]["tipo"], $values[$i]["val"]); } } $f->setEditable(false); $f->setStyle("big"); $page->addComponent($f); /** * * **/ $page->nextTab("Editar"); $f = new FormComponent(); for ($i = 0; $i < sizeof($values); $i++) { $f->addField($values[$i]["campo"], $values[$i]["caption"], $values[$i]["tipo"], utf8_decode($values[$i]["val"])); } $f->setEditable(true); $f->setStyle("big"); $f->addApiCall("api/documento/editar", "POST"); $f->beforeSend("attachExtraParams"); $html = " <script>\n\t\t\tfunction attachExtraParams( a ) {\n\t\t\t\ta.id_documento = " . $documento->getIdDocumento() . ";\n\t\t\t\ta.extra_params = Ext.JSON.encode({ "; for ($i = 0; $i < sizeof($values); $i++) { $html .= $values[$i]["campo"] . " : Ext.get(\"" . $f->getGuiComponentId() . $values[$i]["campo"] . "\" ).getValue() , "; } $html .= "});\n\t\t\t\treturn a;\n\t\t\t}\n\t\t</script>"; $page->addComponent($html); $page->addComponent($f); /**