Example #1
0
 function filteredgrid()
 {
     $this->bSINV = $this->datasis->modbus($this->sinv);
     $this->rapyd->load("datafilter2", "datagrid");
     //$this->rapyd->uri->keep_persistence();
     rapydlib("prototype");
     $filter = new DataFilter2("Filtro por Producto", 'catalogo');
     $filter->codigo = new inputField("Código", "codigo");
     $filter->codigo->size = 15;
     $filter->codigo->append($this->bSINV);
     $filter->buttons("reset", "search");
     $filter->build();
     $grid = new DataGrid("Lista de Artículos");
     $grid->add("inventario/catalogo/dataedit/create");
     $grid->order_by("codigo", "asc");
     $grid->per_page = 20;
     $link = anchor('/inventario/catalogo/dataedit/show/<#id#>', '<#codigo#>');
     $grid->use_function('str_replace');
     $grid->column("C&oacute;digo", $link);
     $grid->column("Fecha", "<dbdate_to_human><#estampa#></dbdate_to_human>");
     $grid->build();
     $data['content'] = $filter->output . $grid->output;
     $data["head"] = script("tabber.js") . script("prototype.js") . $this->rapyd->get_head() . script("scriptaculous.js") . script("effects.js");
     $data['title'] = ' Lista de Art&iacute;culos ';
     $this->load->view('view_ventanas', $data);
 }
Example #2
0
 function build()
 {
     $this->_getValue();
     $output = "";
     rapydlib("jscalendar");
     if (!isset($this->size)) {
         $this->size = 25;
     }
     switch ($this->status) {
         case "show":
             if (!isset($this->value)) {
                 $value = RAPYD_FIELD_SYMBOL_NULL;
             } elseif ($this->value == "") {
                 $value = "";
             } else {
                 $value = dbdate_to_human($this->value, $this->format);
             }
             $output = $value;
             break;
         case "create":
         case "modify":
             $value = "";
             //jscalendar integration
             if ($this->value != "") {
                 if ($this->is_refill) {
                     $value = $this->value;
                 } else {
                     $value = dbdate_to_human($this->value, $this->format);
                 }
             }
             $attributes = array('name' => $this->name, 'id' => $this->name, 'value' => $value, 'size' => $this->size, 'onclick' => $this->onclick, 'onchange' => $this->onchange, 'class' => $this->css_class, 'style' => $this->style);
             if ($this->readonly) {
                 $attributes['readonly'] = 'readonly';
             }
             $output = form_input($attributes);
             //'<div>'.
             $output .= ' <img src="' . RAPYD_LIBRARIES . 'jscalendar/calender_icon.gif" id="' . $this->name . '_button" border="0" style="vertical-align:middle;" />' . $this->extra_output;
             $output .= $this->html->javascriptTag('
      Calendar.setup({
     inputField  : "' . $this->name . '",
     ifFormat    : "' . datestamp_from_format($this->format) . '",
     button      : "' . $this->name . '_button",
     align       : "Bl",
     singleClick : false,
     mondayFirst : true,
     weekNumbers : false
    });');
             break;
         case "disabled":
             //versione encoded
             $output = dbdate_to_human($this->value, $this->format);
             break;
         case "hidden":
             $output = form_hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = $output;
 }
Example #3
0
 function build()
 {
     $this->html = new Html();
     if (!isset($this->size)) {
         $this->size = 45;
     }
     //$this->style .= ";display:none";
     $this->_getValue();
     $output = "";
     switch ($this->status) {
         case "disabled":
         case "show":
             if (!isset($this->value)) {
                 $output = $this->show_null;
             } elseif ($this->value == '') {
                 $output = $this->show_empty;
             } else {
                 $output = $this->encrypt ? $this->show_mask_encrypted : $this->show_mask_hidden;
             }
             break;
         case "create":
             $value = '';
             $attributes = array('name' => $this->name, 'id' => $this->name, 'type' => $this->type, 'value' => '', 'maxlength' => $this->maxlength, 'size' => $this->size, 'onclick' => $this->onclick, 'onchange' => $this->onchange, 'class' => $this->css_class, 'style' => $this->style);
             $output = form_input($attributes) . $this->extra_output;
             break;
         case "modify":
             rapydlib("prototype");
             $value = '';
             $output = '<span id="' . $this->name . '_message">' . ($this->encrypt ? $this->show_mask_encrypted : $this->show_mask_hidden) . "</span>";
             $attributes = array('name' => $this->name, 'id' => $this->name, 'type' => $this->type, 'value' => '', 'maxlength' => $this->maxlength, 'size' => $this->size, 'onclick' => $this->onclick, 'onchange' => $this->onchange, 'class' => $this->css_class, 'style' => $this->style);
             $output .= '<span id="' . $this->name . '_field">' . form_input($attributes) . "</span>";
             unset($attributes);
             $attributes = array('name' => $this->name . "CheckBox", 'id' => $this->name . "CheckBox", 'value' => 'True', 'checked' => isset($_POST[$this->name . "CheckBox"]), 'style' => "vertical-align:middle;", 'onchange' => "javascript:" . $this->name . "_swich();");
             $output .= '<span id="' . $this->name . '_checkbox">' . form_checkbox($attributes) . " " . RAPYD_FIELD_TEXT_PASSWORD_CHANGE . "</span>";
             $func = $this->name . "_swich()";
             $massege_span = $this->name . "_message";
             $field_span = $this->name . "_field";
             $checkbox_span = $this->name . "_checkbox";
             $checkbox = $this->name . "CheckBox";
             $output .= $this->html->javascriptTag("function {$func} {\r\n             if (\$('{$checkbox}').checked) {\r\n              \$('{$massege_span}').hide()\r\n              \$('{$field_span}').show()\r\n             } else {\r\n              \$('{$massege_span}').show()\r\n              \$('{$field_span}').hide()\r\n             }\r\n           }\r\n          {$func}");
             $output .= $this->extra_output;
             break;
         case "hidden":
             $output = form_hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = "\n" . $output . "\n";
 }
Example #4
0
 function build()
 {
     $this->_getValue();
     $output = "";
     rapydlib("colorpicker");
     if (!isset($this->size)) {
         $this->size = 25;
     }
     switch ($this->status) {
         case "show":
             if (!isset($this->value)) {
                 $value = RAPYD_FIELD_SYMBOL_NULL;
             } elseif ($this->value == "") {
                 $value = "";
             } else {
                 $value = $this->value;
             }
             $output = $value;
             break;
         case "create":
         case "modify":
             $value = "";
             //integrazione con jscalendar
             if ($this->value != "") {
                 if ($this->is_refill) {
                     $value = $this->value;
                 } else {
                     $value = $this->value;
                 }
             }
             $attributes = array('name' => $this->name, 'id' => $this->name, 'type' => $this->type, 'value' => $value, 'maxlength' => $this->maxlength, 'size' => $this->size, 'onclick' => $this->onclick, 'onchange' => $this->onchange, 'class' => $this->css_class, 'style' => $this->style);
             $output = form_input($attributes);
             //$output .= '<img src="'.RAPYD_DIR.'images/spacer.gif" style="width:15px;height:15px;background-color:'.$value.';vertical-align:middle;" id="'.$this->name.'_image_pick" /> <A HREF="#" onClick="cp2.select(document.getElementById(\''.$this->name.'\'),\''.$this->name.'_pick\');return false;" NAME="'.$this->name.'_pick" ID="'.$this->name.'_pick">Paleta</A>' . $this->extra_output;
             $output .= '<A HREF="#" onClick="cp2.select(document.getElementById(\'' . $this->name . '\'),\'' . $this->name . '_pick\');return false;" NAME="' . $this->name . '_pick" ID="' . $this->name . '_pick">Paleta</A>' . $this->extra_output;
             $output .= HTML::javascriptTag('cp2.writeDiv()');
             break;
         case "disabled":
             //versione encoded
             $output = dbdate_to_human($this->value, $this->format);
             break;
         case "hidden":
             $output = form_hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = $output;
 }
Example #5
0
 /**
  * build (only) the field (widhout labels or borders)
  *
  * @access   public
  * @return   void
  */
 function build()
 {
     $output = "";
     $GLOBALS["Editor_UserFilesPath"] = $this->upload_path;
     $GLOBALS["content_css"] = $this->content_css != "" ? $this->content_css : RAPYD_LIBRARIES . 'tinymce/custom.css';
     rapydlib("tinymce");
     if (!isset($this->cols)) {
         $this->cols = 42;
     }
     if (!isset($this->rows)) {
         $this->rows = 15;
     }
     $this->_getValue();
     switch ($this->status) {
         case "disabled":
         case "show":
             if (!isset($this->value)) {
                 $output = RAPYD_FIELD_SYMBOL_NULL;
             } elseif ($this->value == "") {
                 $output = "";
             } else {
                 $output = '<div style="font-size:9px; width: 100%; height:100px; overflow: auto">' . htmlspecialchars($this->value) . '</div>';
             }
             break;
         case "create":
         case "modify":
             $attributes = array('name' => $this->name, 'id' => $this->name, 'cols' => $this->cols, 'rows' => $this->rows, 'onclick' => $this->onclick, 'onchange' => $this->onchange, 'class' => "mceEditor", 'style' => $this->style);
             $output = form_textarea($attributes, $this->value);
             break;
         case "hidden":
             $output = form_hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = $output;
 }
Example #6
0
 function ajaxsearch()
 {
     //filteredgrid//
     $this->rapyd->load("datafilter");
     //filter
     $filter = new DataFilter("Article Search", "articles");
     $filter->title = new inputField("Title", "title");
     $filter->title->insertValue = $this->rapyd->session->get("title");
     $filter->build();
     //offset
     $osp = "/osp";
     $osp .= $this->rapyd->uri->is_set("osp") ? "/" . $this->rapyd->uri->get("osp", 1) : "0";
     //prototype
     rapydlib("prototype");
     $this->rapyd->script[] = "\n    Event.observe(window, 'load', init, false);\n\n    function init(){\n      Event.observe('title', 'keyup', do_search, false);\n      do_search();\n    }\n\n    function do_search() \n    { \n      var url = '" . site_url('rapyd/ajaxsamples/ajaxgrid' . $osp) . "'; \n      var pars = 'title='+escape(\$F('title'));  \n      var myUdater = new Ajax.Updater('search_results', url,{method:'post',parameters:pars});\n    }\n    ";
     $data["content"] = $filter->output . '<div id="search_results" style="height:200px"></div>';
     //endfilteredgrid//
     $content["content"] = $this->load->view('rapyd/ajaxsearch', $data, true);
     $content["rapyd_head"] = $this->rapyd->get_head();
     $content["code"] = highlight_code_file(THISFILE, "//filteredgrid//", "//endfilteredgrid//");
     $content["code"] .= '<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #FF8000">//ajax callback <br /></span><br/>';
     $content["code"] .= highlight_code_file(THISFILE, "//ajaxgrid//", "//endajaxgrid//");
     $this->load->view('rapyd/template', $content);
 }
Example #7
0
    function filteredgrid()
    {
        $this->rapyd->load("datafilter2", "datagrid");
        //$this->rapyd->uri->keep_persistence();
        rapydlib("prototype");
        $ajax_onchange = '
			  function get_linea(){
			    var url = "' . site_url('reportes/sinvlineas') . '";
			    var pars = "dpto="+$F("depto");
			    var myAjax = new Ajax.Updater("td_linea", url, { method: "post", parameters: pars });
		  			    
			  }
			  
			  function get_grupo(){
			    var url = "' . site_url('reportes/sinvgrupos') . '";
			    var pars = "dpto="+$F("depto")+"&linea="+$F("linea");
			    var myAjax = new Ajax.Updater("td_grupo", url, { method: "post", parameters: pars });
			  }';
        $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'C&oacute;odigo', 'nombre' => 'Nombre', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'C&oacute;digo', 'nombre' => 'Nombre'), 'retornar' => array('proveed' => 'proveed'), 'titulo' => 'Buscar Beneficiario');
        $bSPRV = $this->datasis->modbus($mSPRV);
        //filter
        $filter = new DataFilter2("Filtro por Producto", 'sinv');
        $filter->codigo = new inputField("C&oacute;digo", "codigo");
        $filter->script($ajax_onchange);
        $filter->descrip = new inputField("Descripci&oacute;n", "descrip");
        $filter->descrip->db_name = 'CONCAT_WS(" ",descrip,descrip2)';
        $filter->tipo = new dropdownField("Tipo", "tipo");
        $filter->tipo->option("", "Todos");
        $filter->tipo->option("Articulo", "Art&iacute;culo");
        $filter->tipo->option("Servicio", "Servicio");
        $filter->tipo->option("Descartar", "Descartar");
        $filter->tipo->option("Consumo", "Consumo");
        $filter->tipo->option("Fraccion", "Fracci&oacute;n");
        $filter->clave = new inputField("Clave", "clave");
        $filter->activo = new dropdownField("Activo", "activo");
        $filter->activo->option("", "");
        $filter->activo->option("S", "Si");
        $filter->activo->option("N", "No");
        $filter->proveed = new inputField("Beneficiario", "proveed");
        $filter->proveed->append($bSPRV);
        $filter->proveed->clause = "in";
        $filter->proveed->db_name = '( s.prov1, s.prov2, s.prov3 )';
        $filter->dpto = new dropdownField("Departamento", "depto");
        $filter->dpto->option("", "");
        $filter->dpto->options("SELECT depto, descrip FROM dpto ORDER BY descrip");
        $filter->dpto->onchange = "get_linea();";
        $filter->linea = new dropdownField("Linea", "linea");
        $filter->linea->option("", "Seleccione un departamento");
        $filter->linea->onchange = "get_grupo();";
        $filter->grupo = new dropdownField("Grupo", "grupo");
        $filter->grupo->option("", "Seleccione una L&iacute;nea");
        $filter->marca = new dropdownField("Marca", "marca");
        $filter->marca->option("", "");
        $filter->marca->options("SELECT TRIM(marca) AS clave, TRIM(marca) AS valor FROM marc ORDER BY marca");
        $filter->buttons("reset", "search");
        $filter->build();
        $uri = "inventario/sinv/dataedit/show/<#codigo#>";
        $grid = new DataGrid("Lista de Art&iacute;culos");
        $grid->order_by("codigo", "asc");
        $grid->per_page = 20;
        $link = anchor('/inventario/sinv/dataedit/show/<#id#>', '<#codigo#>');
        $grid->column("c&oacute;digo", $link);
        $grid->column("Descripci&oacute;n", "descrip");
        $grid->column("Precio 1", "precio1");
        $grid->column("Precio 2", "precio2");
        $grid->column("Precio 3", "precio3");
        $grid->column("Precio 4", "precio4");
        $grid->add("inventario/sinv/dataedit/create");
        $grid->build();
        //grid
        $data["crud"] = $filter->output . $grid->output;
        $data["titulo"] = 'Lista de Artículos';
        $content["content"] = $this->load->view('rapyd/crud', $data, true);
        $content["rapyd_head"] = $this->rapyd->get_head();
        $content["code"] = '';
        $content["lista"] = "\r\n\t\t\t<h3>Editar o Agregar</h3>\r\n\t\t\t<div>Con esta pantalla se puede editar o agregar datos a los Departamentos del M&oacute;dulo de Inventario</div>\r\n\t\t\t<div class='line'></div>\r\n\t\t\t<a href='#' onclick='window.close()'>Cerrar</a>\r\n\t\t\t<div class='line'></div>\n<br><br><br>\n";
        $this->load->view('rapyd/tmpsolo', $content);
    }
Example #8
0
    function dataedit()
    {
        $this->rapyd->load('dataedit');
        rapydlib("prototype");
        $ajax_onchange = '
			  function get_linea(){
			    var url = "' . site_url('reportes/sinvlineas') . '";
			    var pars = "dpto="+$F("depto");
			    var myAjax = new Ajax.Updater("td_linea", url, { method: "post", parameters: pars });
		  			    
			  }
			  function get_grupo(){
			    var url = "' . site_url('reportes/sinvgrupos') . '";
			    var pars = "dpto="+$F("depto")+"&linea="+$F("linea");
			    var myAjax = new Ajax.Updater("td_grupo", url, { method: "post", parameters: pars });
			  }';
        $edit = new DataEdit("Maestro de Inventario", "sinv");
        $edit->script($ajax_onchange);
        $edit->back_url = site_url("inventario/sinv/filteredgrid");
        $edit->codigo = new inputField("C&oacute;digo", "codigo");
        $edit->codigo->size = 17;
        $edit->codigo->maxlength = 15;
        $edit->codigo->rule = "trim|required|strtoupper";
        $edit->codigo->mode = "autohide";
        $edit->alterno = new inputField("C&oacute;digo Alterno", "alterno");
        $edit->alterno->size = 17;
        $edit->alterno->maxlength = 15;
        $edit->alterno->rule = "trim";
        $edit->enlase = new inputField("C&oacute;digo Caja", "enlace");
        $edit->enlase->size = 17;
        $edit->enlase->maxlength = 15;
        $edit->enlase->rule = "trim";
        $edit->barras = new inputField("C&oacute;digo Barras", "barras");
        $edit->barras->size = 17;
        $edit->barras->maxlength = 15;
        $edit->barras->rule = "trim";
        $edit->descrip = new inputField("Descripci&oacute;n", "descrip");
        $edit->descrip->size = 48;
        $edit->descrip->maxlength = 45;
        $edit->descrip->rule = "trim|required|strtoupper";
        $edit->marca = new dropdownField("Marca", "marca");
        $edit->marca->style = 'width:150px;';
        $edit->marca->option("", "");
        $edit->marca->options("SELECT marca as codigo, marca FROM marc ORDER BY marca");
        $edit->tipo = new dropdownField("Tipo", "tipo");
        $edit->tipo->style = 'width:150px;';
        $edit->tipo->option("Articulo", "Art&iacute;culo");
        $edit->tipo->option("Servicio", "Servicio");
        $edit->tipo->option("Descartar", "Descartar");
        $edit->tipo->option("Consumo", "Consumo");
        $edit->tipo->option("Fraccion", "Fracci&oacute;n");
        $edit->tipo->option("Lote", "Lote");
        $edit->grupo = new dropdownField("Grupo", "grupo");
        $edit->descrip2 = new inputField("Descripci&oacute;n Corta", "descrip2");
        $edit->descrip2->size = 20;
        $edit->clave = new inputField("Clave", "clave");
        $edit->clave->size = 17;
        $edit->clave->maxlength = 15;
        $edit->clave->rule = "trim";
        $edit->serial = new dropdownField("Serial", "serial");
        $edit->serial->style = 'width:80px;';
        $edit->serial->option("S", "Si");
        $edit->serial->option("N", "No");
        $edit->unidad = new dropdownField("Unidad", "unidad");
        $edit->unidad->style = 'width:150px;';
        $edit->unidad->option("", "");
        $edit->unidad->options("SELECT unidades, unidades as valor FROM unidad ORDER BY unidades");
        $edit->tdecimal = new dropdownField("Unidad Decimal", "tdecimal");
        $edit->tdecimal->style = 'width:80px;';
        $edit->tdecimal->option("S", "Si");
        $edit->tdecimal->option("N", "No");
        $edit->exmin = new inputField("Existencia Minima", "exmin");
        $edit->exmin->size = 15;
        $edit->exmin->when = array("show");
        $edit->exmax = new inputField("Existencia Maxima", "exmax");
        $edit->exmax->size = 15;
        $edit->exmax->when = array("show");
        $edit->exord = new inputField("Existencia Ordenada", "exord");
        $edit->exord->size = 15;
        $edit->exord->when = array("show");
        $edit->exdes = new inputField("Pedido", "exdes");
        $edit->exdes->size = 15;
        $edit->exdes->when = array("show");
        $edit->ultimo = new inputField("Ultimo", "ultimo");
        $edit->ultimo->css_class = 'inputnum';
        $edit->ultimo->size = 15;
        $edit->iva = new inputField("Iva", "iva");
        $edit->iva->css_class = 'inputnum';
        $edit->iva->size = 15;
        $edit->iva->onchange = "calculos('I');";
        $edit->pond = new inputField("Promedio", "pond");
        $edit->pond->css_class = 'inputnum';
        $edit->pond->size = 15;
        $edit->formcal = new dropdownField("Base C&aacute;lculo", "formcal");
        $edit->formcal->style = 'width:110px;';
        $edit->formcal->option("U", "Ultimo");
        $edit->formcal->option("P", "Promedio");
        $edit->formcal->option("M", "Mayor");
        $edit->formcal->onchange = "calculos('I');";
        $edit->redecen = new dropdownField("Redondear", "redecen");
        $edit->redecen->style = 'width:110px;';
        $edit->redecen->option("NO", "No");
        $edit->redecen->option("F", "Fracci&oacute;n");
        $edit->redecen->option("D", "Decena");
        $edit->redecen->option("C", "Centena");
        $edit->redecen->onchange = "redon();";
        $edit->activo = new dropdownField("Activo", "activo");
        $edit->activo->style = 'width:80px;';
        $edit->activo->option("S", "Si");
        $edit->activo->option("N", "No");
        $edit->fracci = new inputField("Unidad por Caja", "fracci");
        $edit->fracci->size = 15;
        $edit->comision = new inputField("Comisi&oacute;n", "comision");
        $edit->comision->size = 5;
        $edit->comision->rule = 'numeric';
        $edit->comision->maxlength = 5;
        $edit->peso = new inputField("Peso Kg.", "peso");
        $edit->peso->rule = 'numeric';
        $edit->peso->size = 15;
        $edit->peso->maxlength = 12;
        $edit->modelo = new inputField("Modelo", "alterno");
        $edit->modelo->size = 17;
        $edit->modelo->maxlength = 15;
        $edit->modelo->rule = "trim";
        $edit->clase = new dropdownField("Clase", "clase");
        $edit->clase->style = 'width:150px;';
        $edit->clase->option("A", "Alta Rotacion");
        $edit->clase->option("B", "Media Rotacion");
        $edit->clase->option("C", "Baja Rotacion");
        $edit->clase->option("I", "Importacion Propia");
        $edit->us = new inputField("US\$", "dolar");
        $edit->us->size = 15;
        $edit->existen = new inputField("Existencia Actual", "existen");
        $edit->existen->size = 15;
        $edit->existen->when = array("show");
        $edit->garantia = new inputField("Dias de Garantia", "garantia");
        $edit->garantia->size = 5;
        $edit->garantia->maxlength = 3;
        $edit->garantia->rule = 'numeric';
        $edit->fechav = new dateonlyField("Ultima Venta", "fechav");
        $edit->fechav->size = 15;
        for ($i = 1; $i <= 4; $i++) {
            $objeto = "margen{$i}";
            $edit->{$objeto} = new inputField("Margen {$i}", $objeto);
            $edit->{$objeto}->css_class = 'inputnum';
            $edit->{$objeto}->size = 15;
            $edit->{$objeto}->onchange = "calculos('I');";
            $objeto = "base{$i}";
            $edit->{$objeto} = new inputField("Base {$i}", $objeto);
            $edit->{$objeto}->css_class = 'inputnum';
            $edit->{$objeto}->size = 15;
            $edit->{$objeto}->onchange = "cambiobase('I');";
            $objeto = "precio{$i}";
            $edit->{$objeto} = new inputField("Precio {$i}", $objeto);
            $edit->{$objeto}->css_class = 'inputnum';
            $edit->{$objeto}->size = 15;
            $edit->{$objeto}->onchange = "cambioprecio('I');";
        }
        for ($i = 1; $i <= 4; $i++) {
            $objeto = "prov{$i}";
            $edit->{$objeto} = new inputField("Proveedor {$i}", $objeto);
            $edit->{$objeto}->size = 15;
            $edit->{$objeto}->when = array("show");
            $objeto = "pfecha{$i}";
            $edit->{$objeto} = new dateonlyField("Fecha Prv {$i}", $objeto);
            $edit->{$objeto}->size = 10;
            $edit->{$objeto}->when = array("show");
            $objeto = "prepro{$i}";
            $edit->{$objeto} = new inputField("Precio Prv {$i}", $objeto);
            $edit->{$objeto}->css_class = 'inputnum';
            $edit->{$objeto}->size = 10;
            $edit->{$objeto}->when = array("show");
        }
        $codigo = $edit->_dataobject->get("codigo");
        $edit->almacenes = new containerField('almacenes', $this->_detalle($codigo));
        $edit->almacenes->when = array("show", "modify");
        $edit->dpto = new dropdownField("Departamento", "depto");
        $edit->dpto->option("", "");
        $edit->dpto->options("SELECT depto, descrip FROM dpto ORDER BY descrip");
        $edit->dpto->onchange = "get_linea();";
        $edit->linea = new dropdownField("Linea", "linea");
        $edit->linea->option("", "Seleccione un departamento");
        $edit->linea->onchange = "get_grupo();";
        $edit->grupo = new dropdownField("Grupo", "grupo");
        $edit->grupo->option("", "Seleccione una L&iacute;nea");
        $edit->build();
        //echo $edit->codigo->value;
        $link = site_url('inventario/sinv');
        $data['script'] = <<<script
\t\t<script language="javascript" type="text/javascript">
\t\t\$(document).ready(function(){
\t\t\t\$.ajax({
\t\t\ttype: "POST",
\t\t\turl: {$link}+"/sinvlineas",
\t\t\tdata: "dpto="+\$('#depto').val(),
\t\t\tsuccess: function(msg){
\t\t\t\talert( "Data Saved: " + msg );
\t\t\t}
\t\t});
\t\t</script>
script;
        $conten["form"] =& $edit;
        $data['content'] = $this->load->view('view_sinvmaestro', $conten, true);
        $data["head"] = script("tabber.js") . script("jquery.pack.js") . script("plugins/jquery.numeric.pack.js") . script("plugins/jquery.floatnumber.js") . script("sinvmaes.js") . $this->rapyd->get_head();
        //$data["head"]    = script("jquery.pack.js").script("plugins/jquery.numeric.pack.js").script("plugins/jquery.floatnumber.js").$this->rapyd->get_head();
        $data['title'] = '<h1>Maestro de Inventario</h1>';
        $this->load->view('view_ventanas', $data);
    }
Example #9
0
    function filteredgrid()
    {
        $this->rapyd->load("datafilter2", "datagrid");
        rapydlib("prototype");
        $ajax_onchange = '
			  function get_linea(){
			    var url = "' . site_url('reportes/sinvlineas') . '";
			    var pars = "dpto="+$F("depto");
			    var myAjax = new Ajax.Updater("td_linea", url, { method: "post", parameters: pars });
			  }
			  function get_grupo(){
			    var url = "' . site_url('reportes/sinvgrupos') . '";
			    var pars = "dpto="+$F("depto")+"&linea="+$F("linea");
			    var myAjax = new Ajax.Updater("td_grupo", url, { method: "post", parameters: pars });
			  }';
        $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'C&oacute;digo', 'nombre' => 'Nombre', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'C&oacute;digo', 'nombre' => 'Nombre'), 'retornar' => array('proveed' => 'proveed'), 'titulo' => 'Buscar Proveedor');
        $bSPRV = $this->datasis->modbus($mSPRV);
        $filter = new DataFilter2("Filtro por Producto");
        if ($this->input->post("fotos")) {
            $ddire = '';
        } else {
            $ddire = 'left';
        }
        $filter->db->select("a.codigo as scodigo,a.descrip,a.grupo,b.codigo,a.id,a.precio1,a.precio2,a.precio3,a.precio4");
        $filter->db->from("sinv AS a");
        $filter->db->join("sinvfot AS b", "a.codigo=b.codigo", $ddire);
        $filter->db->groupby("a.codigo");
        $filter->script($ajax_onchange);
        $filter->codigo = new inputField("C&oacute;digo", "a.codigo");
        $filter->codigo->size = 15;
        $filter->clave = new inputField("Clave", "clave");
        $filter->clave->size = 15;
        $filter->proveed = new inputField("Proveedor", "proveed");
        $filter->proveed->append($bSPRV);
        $filter->proveed->clause = "in";
        $filter->proveed->db_name = '( a.prov1, a.prov2, a.prov3 )';
        $filter->proveed->size = 15;
        $filter->descrip = new inputField("Descripci&oacute;n", "a.descrip");
        $filter->descrip->db_name = 'CONCAT_WS(" ",descrip,descrip2)';
        $filter->descrip->size = 34;
        $filter->dpto = new dropdownField("Departamento", "depto");
        $filter->dpto->clause = '';
        $filter->dpto->option("", "");
        $filter->dpto->options("SELECT depto, descrip FROM dpto ORDER BY descrip");
        $filter->dpto->onchange = "get_linea();";
        //$filter->dpto->style = "width:220px";
        $filter->linea = new dropdownField("Linea", "linea");
        $filter->linea->clause = '';
        $filter->linea->option("", "Seleccione un departamento");
        $filter->linea->onchange = "get_grupo();";
        //$filter->linea->style = "width:300px";
        $filter->grupo = new dropdownField("Grupo", "grupo");
        $filter->grupo->db_name = "a.grupo";
        $filter->grupo->option("", "Seleccione una Linea");
        //$filter->grupo->style = "width:220px";
        $filter->marca = new dropdownField("Marca", "marca");
        $filter->marca->option("", "");
        $filter->marca->options("SELECT TRIM(marca) AS clave, TRIM(marca) AS valor FROM marc ORDER BY marca");
        $filter->marca->style = "width:140px";
        $filter->fotos = new checkboxField("Mostrar solo productos con fotos", "fotos", "y", "n");
        $filter->fotos->clause = '';
        $filter->fotos->insertValue = "n";
        $filter->buttons("reset", "search");
        $filter->build();
        $grid = new DataGrid("Lista de Art&iacute;culos");
        $grid->order_by("a.codigo", "asc");
        $grid->per_page = 15;
        $link = anchor('/inventario/fotos/dataedit/<#id#>/create/', '<#scodigo#>');
        $grid->use_function('str_replace');
        $grid->column("C&oacute;digo", $link);
        $grid->column("Descripci&oacute;n", "descrip");
        $grid->column("Precio 1", "<number_format><#precio1#>|2|,|.</number_format>", 'align=Right');
        $grid->column("Precio 2", "<number_format><#precio2#>|2|,|.</number_format>", 'align=Right');
        $grid->column("Precio 3", "<number_format><#precio3#>|2|,|.</number_format>", 'align=Right');
        $grid->column("Precio 4", "<number_format><#precio4#>|2|,|.</number_format>", 'align=Right');
        $grid->build();
        //echo $grid->db->last_query();
        $data['content'] = $filter->output . $grid->output;
        $data["head"] = script("tabber.js") . script("prototype.js") . $this->rapyd->get_head() . script("scriptaculous.js") . script("effects.js");
        $data['title'] = '<h1>Lista de Art&iacute;culos</h1>';
        $this->load->view('view_ventanas', $data);
    }
Example #10
0
    function build()
    {
        $this->_getValue();
        $output = '';
        rapydlib('jscalendar');
        if (!isset($this->size)) {
            $this->size = 25;
        }
        switch ($this->status) {
            case 'show':
                if (!isset($this->value)) {
                    $value = RAPYD_FIELD_SYMBOL_NULL;
                } elseif ($this->value == '') {
                    $value = '';
                } else {
                    $value = dbdate_to_human($this->value, $this->format);
                }
                $output = $value;
                break;
            case 'create':
            case 'modify':
                $value = '';
                //jscalendar integration
                if ($this->value != '') {
                    if ($this->is_refill) {
                        $value = $this->value;
                    } else {
                        $value = dbdate_to_human($this->value, $this->format);
                    }
                }
                $attributes = array('name' => $this->name, 'id' => $this->name, 'value' => $value, 'size' => $this->size, 'onclick' => $this->onclick, 'onchange' => $this->onchange, 'class' => $this->css_class, 'style' => $this->style);
                if (strlen($this->title) > 0) {
                    $attributes['title'] = $this->title;
                }
                if ($this->readonly) {
                    $attributes['readonly'] = 'readonly';
                }
                if ($this->type == 'inputhidden') {
                    $attributes['type'] = 'hidden';
                    $this->calendar = false;
                }
                $output = form_input($attributes);
                if ($this->type == 'inputhidden') {
                    $output = "<span id='" . $this->name . "_val'>{$value}</span>" . $output;
                }
                if ($this->calendar) {
                    $output .= ' <img src="' . RAPYD_LIBRARIES . 'jscalendar/calender_icon.gif" id="' . $this->name . '_button" border="0" style="vertical-align:middle;" />' . $this->extra_output;
                    $output .= HTML::javascriptTag('
					 Calendar.setup({
					inputField  : "' . $this->name . '",
					ifFormat    : "' . datestamp_from_format($this->format) . '",
					button      : "' . $this->name . '_button",
					align       : "Bl",
					singleClick : false,
					mondayFirst : true,
					weekNumbers : false
				 });');
                }
                break;
            case 'disabled':
                //versione encoded
                $output = dbdate_to_human($this->value, $this->format);
                break;
            case 'hidden':
                $output = form_hidden($this->name, $this->value);
                break;
            default:
        }
        $this->output = $output;
    }
Example #11
0
 function importitem_edit()
 {
     //commentsedit//
     $this->rapyd->load("dataedit");
     $numero = $this->uri->segment(4);
     $codigo = $this->uri->segment(6);
     $edit = new DataEdit("Productos Importados", 'importitem');
     $edit->back_uri = "import/importa/importitem_grid/{$numero}/list";
     $edit->numero = new autoUpdateField("n&uacute;mero", $numero);
     $edit->codigo = new inputField("C&oacute;digo", "codigo");
     $edit->sr = new containerField("BuscaCod", "<div id='search_results' class='autocomplete'></div>");
     $edit->cantidad = new inputField("Cant.", "cantidad");
     $edit->precio = new inputField("Precio", "precio");
     $edit->importe = new inputField("Importe", "importe");
     $edit->back_save = true;
     $edit->back_cancel_save = true;
     $edit->back_cancel_delete = true;
     $edit->buttons("modify", "save", "undo", "delete", "back");
     $edit->build();
     $data['content'] = $edit->output;
     $data['title'] = "<h1>Carta</h1>";
     $data["head"] = $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
     //Prototype
     rapydlib("prototype", "scriptaculous");
     $this->rapyd->script[] = "\n\t\tEvent.observe(window, 'load', init, false);\n\n\t\tfunction init() {\n\t\t\tnew Ajax.Autocompleter('codigo','search_results','" . site_url("import/importa/ajaxbus") . "', {} );\n\t\t\tEvent.observe('codigo', 'keyup', do_search, false );\n\t\t\tdo_search();\n\t\t}\n\t\t\n\t\tfunction do_search()\n\t\t{\n\t\t\tvar url  = '" . site_url('import/importa/ajaxbus') . "';\n\t\t\tvar pars = 'codigo='+escape(\$F('codigo'));\n\t\t\tnew Ajax.Updater('search_results', url, {method:'post', parameters:pars});\n\t\t\tnew Effect.Appear('saerch_results');\n\t\t} ";
     $head = $this->rapyd->get_head();
     $this->loadiframe($edit->output, $head, "related");
 }
Example #12
0
    function producto($anio = '', $departamento = '', $linea = '', $grupo = '')
    {
        $this->rapyd->load("datagrid2");
        $this->rapyd->load("dataform");
        $this->load->helper('openflash');
        rapydlib("prototype");
        $ajax_onchange = '
	  function get_linea(){
	    var url = "' . site_url('reportes/sinvlineas') . '";
	    var pars = "dpto="+$F("depto");
	    var myAjax = new Ajax.Updater("td_linea", url, { method: "post", parameters: pars });
	    get_grupo();
	  }
	  function get_grupo(){
	    var url = "' . site_url('reportes/sinvgrupos') . '";
	    var pars = "dpto="+$F("depto")+"&linea="+$F("linea");
	    var myAjax = new Ajax.Updater("td_grupo", url, { method: "post", parameters: pars });
	  }
	  ';
        if (isset($_POST['anio']) and empty($anio)) {
            $anio = $_POST['anio'];
        }
        if (isset($_POST['depto']) and empty($departamento)) {
            $departamento = $_POST['depto'];
        }
        if (isset($_POST['linea']) and empty($linea)) {
            $linea = $_POST['linea'];
        }
        if (isset($_POST['grupo']) and empty($grupo)) {
            $grupo = $_POST['grupo'];
        }
        if (empty($anio) or empty($departamento)) {
            redirect("ventas/ganancias/departamento");
        }
        if (empty($linea)) {
            redirect("ventas/ganancias/linea/{$anio}/{$departamento}");
        }
        if (empty($grupo)) {
            redirect("ventas/ganancias/grupo/{$anio}/{$departamento}/{$linea}");
        }
        $fechai = $anio . '0101';
        $fechaf = $anio . '1231';
        $filter = new DataForm('ventas/ganancias/producto');
        $filter->script($ajax_onchange);
        $filter->title('Filtro de Ganancias');
        $filter->anio = new inputField("A&ntilde;o", "anio");
        $filter->anio->size = 4;
        $filter->anio->insertValue = $anio;
        $filter->anio->rule = "max_length[4]";
        $filter->anio->maxlength = 4;
        $filter->departamento = new dropdownField("Departamento", "depto");
        $filter->departamento->insertValue = $departamento;
        $filter->departamento->options("SELECT depto, descrip FROM dpto WHERE tipo='I' ORDER BY depto");
        $filter->departamento->onchange = "get_linea();";
        $filter->linea = new dropdownField("Linea", "linea");
        $filter->linea->insertValue = $linea;
        $filter->linea->options("SELECT linea, descrip FROM line WHERE depto='{$departamento}'");
        $filter->linea->onchange = "get_grupo();";
        $filter->grupo = new dropdownField("Grupo", "grupo");
        $filter->grupo->insertValue = $grupo;
        $filter->grupo->options("SELECT grupo, nom_grup FROM grup WHERE depto='{$departamento}' AND linea='{$linea}'");
        $filter->button("btnsubmit", "Buscar", form2uri(site_url('ventas/ganancias/producto/'), array('anio', 'depto', 'linea', 'grupo')), $position = "BL");
        $filter->build_form();
        $grid = new DataGrid2();
        $select = array("a.fecha", "b.codigo", "b.descrip AS nombre", "e.depto", "e.descrip", "d.linea", "d.descrip", "b.grupo", "b.descrip", "c.nom_grup as ngrupo", "SUM(a.promedio*a.cantidad) AS costo", "SUM(a.venta) AS ventas", "SUM(a.venta)/COUNT(*)AS porcentaje", "SUM(a.venta)-SUM(a.promedio*a.cantidad) AS ganancias", "COUNT(*) AS numfac");
        $grid->db->select($select);
        $grid->db->from($this->from);
        foreach ($this->join as $valor) {
            $grid->db->join($valor[0], $valor[1], $valor[2]);
        }
        $grid->db->where("a.origen IN ('3I','3M')");
        $grid->db->where('fecha >= ', $fechai);
        $grid->db->where('fecha <= ', $fechaf);
        $grid->db->where('e.depto', $departamento);
        $grid->db->where('b.grupo', $grupo);
        $grid->db->groupby("a.codigo");
        $grid->db->orderby("ganancias DESC");
        $grid->column("Producto", "nombre", "align='left'");
        $grid->column("Costo", "<number_format><#costo#>|2|,|.</number_format>", 'align=right');
        $grid->column("Ventas", "<number_format><#ventas#>|2|,|.</number_format>", 'align=right');
        $grid->column("Ganancias", "<number_format><#ganancias#>|2|,|.</number_format>", 'align=right');
        $grid->column("% Ventas", "<number_format><#porcentaje#>|2|,|.</number_format>", 'align=right');
        $grid->column("Cant. Fact", "numfac", 'align=right');
        $grid->totalizar('costo', 'ganancias', 'ventas');
        $grid->build();
        $grafico = open_flash_chart_object(680, 500, site_url("ventas/ganancias/gproducto/{$anio}/{$departamento}/{$linea}/{$grupo}"));
        $data['content'] = $grafico;
        $data['content'] .= $filter->output . $grid->output;
        $data["head"] = $this->rapyd->get_head();
        $data['title'] = $this->rapyd->get_head() . "<h1>Ganancias por Producto</h1>";
        $this->load->view('view_ventanas', $data);
    }