예제 #1
0
 function index()
 {
     $this->datasis->modulo_id($this->modulo, 1);
     $this->rapyd->load("datagrid", "dataform", "fields");
     $control = $this->uri->segment(4);
     $checkbox = '<input type="checkbox" name="genera[]" value="<#modulo#>" CHECKED>';
     $grid = new DataGrid('Seleccione los m&oacute;dulos que desea generar');
     $grid->db->select('modulo, descripcion');
     $grid->db->from('`reglascont`');
     $grid->db->groupby('modulo');
     $grid->db->orderby('modulo,regla');
     $grid->column("M&oacute;dulo", "modulo");
     $grid->column("Descripci&oacute;n", "descripcion");
     $grid->column('Generar', $checkbox, 'align="center"');
     $grid->build();
     $form = new DataForm('contabilidad/generar/procesar');
     $form->title('Rango de fecha para la Generaci&oacute;n');
     $form->fechai = new dateonlyField("Fecha Desde", "fechai", "d/m/Y");
     $form->fechaf = new dateonlyField("Fecha Hasta", "fechaf", "d/m/Y");
     $form->fechaf->size = $form->fechai->size = 10;
     $form->fechai->insertValue = $this->input->post('fechai') ? $this->input->post('fechai') : date("Ymd");
     $form->fechaf->insertValue = $this->input->post('fechaf') ? $this->input->post('fechaf') : date("Ymd");
     $form->tabla = new containerField('tabla', $grid->output);
     if ($control) {
         $form->control = new containerField('control', 'Contabilidad Generada');
     }
     //$form->submit("btn_submit","Generar Depurado");
     $form->build_form();
     $data['script'] = "<script type='text/javascript'>\n\t\tvar handlerFunc = function(t) {\n\t\t\tdocument.getElementById('preloader').style.display='none';\n\t\t\tnew Effect.Opacity('contenido', {duration:0.5, from:0.3, to:1.0});\n\t\t\talert(t.responseText);\n\t\t}\n\n\t\tvar errFunc = function(t) {\n\t\t\tdocument.getElementById('preloader').style.display='none';\n\t\t\tnew Effect.Opacity('contenido', {duration:0.5, from:0.3, to:1.0});\n\t\t\talert('Error ' + t.status + ' -- ' + t.statusText);\n\t\t}\n\n\t\tfunction generar() {\n\t\t\tnew Effect.toggle('preloader', 'appear');\n\t\t\tnew Effect.Opacity('contenido', {duration:0.5, from:1.0, to:0.3});\n\t\t\tnew Ajax.Request('" . site_url('contabilidad/generar/procesar') . "',{\n\t\t\t method: 'post',\n\t\t\t parameters : Form.serialize('df1'),\n\t\t\t onSuccess:handlerFunc,\n\t\t\t onFailure:errFunc});\n\t\t}\n\t\t</script>";
     $data['extras'] = "<div id='preloader' style='display: none;\tposition:absolute; left:40%; top:40%; font-family:Verdana, Arial, Helvetica, sans-serif;'>\n\t\t\t<center>" . image("loading4.gif") . "<br>" . image("loadingBarra.gif") . "<br>\n\t\t\t<b>Generando . . . </b>\n\t\t\t</center>\n\t\t</div>";
     $data['content'] = $form->output . "<input type=button value='Generar' onclick='generar()'>";
     $data["head"] = $this->rapyd->get_head() . script("prototype.js") . script("scriptaculous.js") . script("effects.js");
     $data['title'] = "<h1>Generar Contabilidad</h1>";
     $this->load->view('view_ventanas', $data);
 }
예제 #2
0
 function index()
 {
     $this->rapyd->load("dataform");
     $this->load->helper('openflash');
     if ($this->uri->segment(4)) {
         $anio = $this->uri->segment(4);
     } elseif (isset($_POST['anio'])) {
         $anio = $_POST['anio'];
     }
     if (empty($anio)) {
         $anio = date("Y");
     }
     $filter = new DataForm('ventas/vendedoresanuales');
     $filter->title('Filtro de Ventas Anuales');
     $filter->anio = new inputField("A&ntilde;o", "anio");
     $filter->anio->size = 4;
     $filter->anio->insertValue = $anio;
     $filter->anio->rule = "max_length[4]";
     $filter->button("btnsubmit", "Buscar", form2uri(site_url('ventas/vendedoresanuales /index'), array('anio')), $position = "BL");
     $filter->build_form();
     $grafico = open_flash_chart_object(760, 300, site_url("ventas/vendedoresanuales/grafico/{$anio}/"));
     $data['content'] = $grafico;
     $data['content'] .= $filter->output;
     $data["head"] = $this->rapyd->get_head();
     $data['title'] = $this->rapyd->get_head() . "<h1>Ventas</h1>";
     $this->load->view('view_ventanas', $data);
 }
예제 #3
0
 function index()
 {
     $this->rapyd->load('dataform');
     $this->load->helper('openflash');
     $dolar = $this->datasis->dameval("SELECT valor FROM valores WHERE nombre='dolar'");
     $filter = new DataForm("inventario/cambioprecio/consulta/");
     $filter->attributes = array('onsubmit' => "this.action='index/'+this.form.mes.value+'/'+this.form.anio.value+'/';return FALSE;");
     $filter->title('¿Desea cambiar el precio de sus art&iacute;culos en el inventario seg&uacute;n el precio del d&oacute;lar?');
     $filter->dolar = new inputField("Precio del D&oacute;lar", "dolar");
     $filter->dolar->size = 12;
     $filter->dolar->maxlength = 10;
     $filter->dolar->insertValue = $dolar;
     $filter->desc2 = new inputField("Descuento Precio2", "desc2");
     $filter->desc2->size = 12;
     $filter->desc2->maxlength = 10;
     $filter->desc2->insertValue = '3';
     $filter->desc3 = new inputField("Descuento Precio3", "desc3");
     $filter->desc3->size = 12;
     $filter->desc3->maxlength = 10;
     $filter->desc3->insertValue = '5';
     $filter->desc4 = new inputField("Descuento Precio4", "desc4");
     $filter->desc4->size = 12;
     $filter->desc4->maxlength = 10;
     $filter->desc4->insertValue = '7';
     $filter->button("btnsubmit", "Aceptar", form2uri(site_url('inventario/cambioprecio/cambio'), array('dolar', 'desc2', 'desc3', 'desc4')), $position = "BL");
     $filter->build_form();
     $data['content'] = $filter->output;
     $data['head'] = $this->rapyd->get_head();
     $data['title'] = "<h1>Cambio de Precio</h1>";
     $this->load->view('view_ventanas', $data);
 }
예제 #4
0
 function carga()
 {
     $this->rapyd->load("dataform");
     $form = new DataForm("sincro/cargasinv/carga/procesa");
     $form->title('Cargar Archivo de Productos (*.txt)');
     $form->archivo = new uploadField("Archivo", "archivo1");
     $form->archivo->upload_path = $this->upload_path;
     $form->archivo->allowed_types = "TXT";
     $form->archivo->delete_file = false;
     $form->archivo->rule = "required";
     $form->archivo->file_name = 'precios.txt';
     $form->submit("btnsubmit", "Cargar");
     $form->build_form();
     if ($form->on_success()) {
         set_time_limit(600);
         $nombre = $form->archivo->upload_data['file_name'];
         $dir = './uploads/archivos/' . $nombre;
         $msg = 'Carga &Eacute;xitosa';
         redirect("sincro/cargasinv/procesa/{$nombre}");
         //$this->procesa();
     }
     $data['content'] = $form->output;
     $data['title'] = "<h1>Actualizaci&oacute;n de Inventario</h1>";
     $data["head"] = script("jquery.pack.js") . $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
예제 #5
0
 function imprimir()
 {
     $this->rapyd->load("dataform");
     $scli = array('tabla' => 'scli', 'columnas' => array('cliente' => 'C&oacute;digo Cliente', 'nombre' => 'Nombre', 'contacto' => 'Contacto'), 'filtro' => array('cliente' => 'C&oacute;digo Cliente', 'nombre' => 'Nombre'), 'retornar' => array('cliente' => 'cliente'), 'titulo' => 'Buscar Cliente');
     $cboton = $this->datasis->modbus($scli);
     $filter = new DataForm('/tiketimp/index');
     $filter->title('Filtro de Impresion de Tiket');
     $filter->fechad = new dateonlyField("Desde", "fechad", 'Ymd');
     $filter->fechah = new dateonlyField("Hasta", "fechah", 'Ymd');
     $filter->fechad->clause = $filter->fechah->clause = "where";
     $filter->fechad->db_name = $filter->fechah->db_name = "fecha";
     //$filter->fechad->insertValue = $fechad;
     //$filter->fechah->insertValue = $fechah;
     $filter->fechah->size = $filter->fechad->size = 10;
     $filter->fechad->operator = ">=";
     $filter->fechah->operator = "<=";
     $filter->cliente = new inputField("Cliente", "cliente");
     $filter->cliente->size = 10;
     //$filter->cliente->insertValue=$cliente;
     $filter->cliente->maxlength = 10;
     $filter->cliente->append($cboton);
     $filter->button("btnsubmit", "Buscar", form2uri(site_url("/formatos/ver/TIKET/"), array('cliente', 'fechad', 'fechah')), $position = "BL");
     //
     $filter->build_form();
     $data['content'] = $filter->output;
     $data['title'] = "<h1>Imprimir</h1>";
     $data["head"] = script("jquery.pack.js") . script("plugins/jquery.numeric.pack.js") . script("plugins/jquery.floatnumber.js") . $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
예제 #6
0
 function mensuales($anio = '', $mes = '')
 {
     $this->rapyd->load("datagrid2");
     $this->rapyd->load("dataform");
     $this->load->helper('openflash');
     if ($this->uri->segment(4)) {
         $mes = $this->uri->segment(4);
     } elseif (isset($_POST['mes'])) {
         $mes = $_POST['mes'];
     }
     if ($this->uri->segment(5)) {
         $anio = $this->uri->segment(5);
     } elseif (isset($_POST['anio'])) {
         $anio = $_POST['anio'];
     }
     if (empty($mes)) {
         $mes = date("m");
     }
     if (empty($anio)) {
         $anio = date("Y");
     }
     $fechai = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01';
     $fechaf = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31';
     $filter = new DataForm('nomina/gprestamos/mensuales');
     $filter->attributes = array('onsubmit' => "this.action='index/'+this.form.mes.value+'/'+this.form.anio.value+'/';return FALSE;");
     $filter->title('Filtro de Prestamos mensuales');
     $filter->mes = new dropdownField("Mes/A&ntilde;o", "mes");
     for ($i = 1; $i < 13; $i++) {
         $filter->mes->option(str_pad($i, 2, '0', STR_PAD_LEFT), str_pad($i, 2, '0', STR_PAD_LEFT));
     }
     $filter->mes->size = 2;
     $filter->mes->style = '';
     $filter->mes->insertValue = $mes;
     $filter->anio = new inputField("A&ntilde;o", "anio");
     $filter->anio->in = 'mes';
     $filter->anio->size = 4;
     $filter->anio->insertValue = $anio;
     $filter->anio->maxlength = 4;
     $filter->button("btnsubmit", "Buscar", form2uri(site_url('nomina/gprestamos/mensuales/'), array('mes', 'anio')), $position = "BL");
     $filter->build_form();
     $grid = new DataGrid2();
     $select = array("fecha", "DAYOFMONTH(fecha)AS dia", "SUM(monto)AS grantotal", "COUNT(*) AS numfac");
     $grid->db->select($select);
     $grid->db->from("pres ");
     $grid->db->where('fecha >= ', $fechai);
     $grid->db->where('fecha <= ', $fechaf);
     $grid->db->groupby("fecha");
     $grid->column("Dia", "dia", "align='left'");
     $grid->column("Total", "<number_format><#grantotal#>|2|,|.</number_format>", 'align=right');
     $grid->column("Cant. Prest", "numfac", 'align=right');
     $grid->totalizar('grantotal');
     $grid->build();
     $grafico = open_flash_chart_object(680, 350, site_url("nomina/gprestamos/gmensuales/{$mes}/{$anio}"));
     $data['content'] = $grafico;
     $data['content'] .= $filter->output . $grid->output;
     $data["head"] = $this->rapyd->get_head();
     $data['title'] = $this->rapyd->get_head() . " Prestamos Mensuales ";
     $this->load->view('view_ventanas', $data);
 }
예제 #7
0
 function index()
 {
     $this->rapyd->load('datagrid2');
     $this->rapyd->load('datafilter');
     $diai = $this->uri->segment(4);
     $mesi = $this->uri->segment(5);
     $anoi = $this->uri->segment(6);
     if ($diai === FALSE or $mesi === FALSE or $anoi === FALSE) {
         $fechai = date('Y/m/d');
         $qfechai = date('Ymd');
     } else {
         $fechai = "{$anoi}/{$mesi}/{$diai}";
         $qfechai = $anoi . $mesi . $diai;
     }
     $filter = new DataForm('supermercado/poscuadre/index');
     $filter->title('Filtro de cajas');
     $filter->fechai = new dateField("Fecha", "fechai", "d/m/Y");
     $filter->fechai->insertValue = $fechai;
     $filter->fechai->size = 10;
     $filter->button("btnsubmit", "Buscar", form2uri(site_url('supermercado/poscuadre/index'), 'fechai'), $position = "BL");
     $filter->build_form();
     $grid = new DataGrid2();
     $select = array('a.caja caja', "IFNULL(b.nombre,'N/A') nombre", 'a.cajero AS cajero', 'SUM(a.gtotal) AS monto');
     $cupon = floatval($this->datasis->traevalor('FMAYCUPON'));
     if ($cupon > 0) {
         $select[] = "SUM(TRUNCATE(a.gtotal/{$cupon},0)) AS cupones";
     } else {
         $select[] = '(0) AS  cupones';
     }
     $grid->db->select($select);
     $grid->db->from('posfact AS a');
     $grid->db->where('SUBSTRING(numero,1,1)!=', 'X');
     $grid->db->where('fecha', $qfechai);
     $grid->db->join('scaj b', 'a.cajero=b.cajero', 'LEFT');
     $grid->db->groupby('a.caja,a.cajero');
     $link = anchor("supermercado/poscuadre/concaja/<#caja#>/<#cajero#>/{$qfechai}", '<#caja#>');
     $grid->column('Caja', $link);
     $grid->column('Nombre', 'nombre');
     $grid->column('Cajero', 'cajero', 'align="center"');
     $grid->column('Cupones', 'cupones', 'align="center"');
     $grid->column('Monto', '<nformat><#monto#></nformat>', 'align="right"');
     $grid->totalizar('monto');
     $grid->build();
     //echo $grid->db->last_query();
     $consul = new DataForm('supermercado/buscafac/index/search/osp');
     $consul->title('Buscar Factura');
     $consul->fechad = new dateField("Desde", "fechad", "d/m/Y");
     $consul->fechah = new dateField("Hasta", "fechah", "d/m/Y");
     $consul->nombre = new inputField("Nombre", "nombre");
     $consul->cedula = new inputField("C&eacute;dula/RIF", "cedula");
     $consul->fechad->insertValue = $consul->fechah->insertValue = date("Y/m/d");
     $consul->fechah->size = $consul->fechad->size = 10;
     $consul->submit("btn_submit", "Buscar");
     $consul->build_form();
     $data['content'] = $filter->output . $grid->output . $consul->output;
     $data['title'] = '<h1>Consulta de Cajas</h1>';
     $data['head'] = $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
예제 #8
0
 function index()
 {
     $this->rapyd->load('dataform', 'datatable', 'datagrid');
     $this->load->library('table');
     $base_process_uri = $this->rapyd->uri->implode_uri("base_uri", "gfid", "orderby");
     $filter = new DataForm($this->rapyd->uri->add_clause($base_process_uri, "search"));
     $filter->title('Elija una tabla');
     $filter->attributes = array('onsubmit' => 'is_loaded()');
     $filter->tabla = new dropdownField("Tabla", "tabla");
     $filter->tabla->option("pers", "Personal");
     $filter->tabla->option("nomina", "Nomina");
     $filter->tabla->option("sprv", "Proveedores");
     $filter->tabla->option("abonotros", "Abono Otros");
     $filter->tabla->clause = "";
     //$filter->obra = new dropdownField("Obra", "depto");
     //$filter->obra->db_name='depto';
     //$filter->obra->clause="where";
     //$filter->obra->option(" ","Todos");
     //$filter->obra->options("SELECT depto, descrip FROM dpto ORDER BY depto ");
     //$filter->obra->operator="=";
     //$filter->status = new dropdownField("Status","status");
     //$filter->status->option("","Todos");
     //$filter->status->option("A","Activos");
     //$filter->status->option("I","Inactivos");
     //$filter->status->style='width:100px';
     $filter->submit('btnsubmit', 'Descargar');
     $filter->build_form();
     if ($this->rapyd->uri->is_set("search")) {
         $table = $filter->tabla->newValue;
         $mSQL = "DESCRIBE {$table}";
         $query = $this->db->query($mSQL);
         if ($query->num_rows() > 0) {
             foreach ($query->result_array() as $row) {
                 $data[] = $row;
             }
         }
         function ractivo($field)
         {
             $data2 = array('name' => 'campos[]', 'id' => 'c' . $field, 'value' => $field, 'checked' => FALSE, 'style' => 'margin:5px');
             $retorna = form_checkbox($data2);
             return $retorna;
         }
         $grid = new DataGrid("Resultados", $data);
         $grid->use_function('ractivo', 'ucwords');
         $grid->column('Campos', '<ucwords><#Field#></ucwords>');
         $grid->column('Mostrar', "<ractivo><#Field#></ractivo>", 'align="center"');
         $grid->build();
         $tabla = $grid->output;
         $filter->build_form();
         $conten = $filter->output . form_open("nomina/rpers/crear/{$table}") . $tabla . form_submit('mysubmit', 'Generar') . form_close();
     } else {
         $conten = $filter->output;
     }
     $data['content'] = $conten;
     $data['title'] = heading('Reporte');
     $data["head"] = script("jquery.js") . $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
예제 #9
0
    function index()
    {
        $this->rapyd->load("datagrid2");
        $this->rapyd->load("dataform");
        $this->load->helper('openflash');
        if ($this->uri->segment(4)) {
            $anio = $this->uri->segment(4);
        } elseif (isset($_POST['anio'])) {
            $anio = $_POST['anio'];
        }
        if (empty($anio)) {
            $anio = date("Y");
        }
        $fechai = $anio . '0101';
        $fechaf = $anio . '1231';
        $filter = new DataForm('hospitalidad/anuales');
        $filter->title('Filtro de ventas Anuales');
        $filter->anio = new inputField("A&ntilde;o", "anio");
        $filter->anio->size = 4;
        $filter->anio->insertValue = $anio;
        $filter->anio->maxlength = 4;
        //$filter->anio->onkeypress="return acceptNum(event)";
        $filter->button("btnsubmit", "Buscar", form2uri(site_url('hospitalidad/anuales/index'), array('anio')), $position = "BL");
        $filter->build_form();
        $data = $this->_sincrodata($fechai, $fechaf);
        $grid = new DataGrid2('', $data);
        $grid->totalizar('impuesto', 'cobrado', 'contado', 'credito', 'subtotal', 'numfac');
        $grid->column("Mes", "mes");
        $grid->column("Sub-Total", "<number_format><#subtotal#>|2|,|.</number_format>", 'align=right');
        $grid->column("Impuesto", "<number_format><#impuesto#>|2|,|.</number_format>", 'align=right');
        $grid->column("Contado", "<number_format><#contado#>|2|,|.</number_format>", 'align=right');
        $grid->column("Credito", "<number_format><#credito#>|2|,|.</number_format>", 'align=right');
        $grid->column("Cobrado", "<number_format><#cobrado#>|2|,|.</number_format>", 'align=right');
        $grid->column("% Ventas", "<number_format><#porcentaje#>|2|,|.</number_format>", 'align=right');
        $grid->column("Cant. Fact", "numfac", 'align=right');
        $grid->build();
        $data['content'] = open_flash_chart_object(680, 300, site_url("hospitalidad/anuales/grafico/{$anio}"));
        $data['content'] .= $filter->output . $grid->output;
        $data['title'] = $this->rapyd->get_head() . "<h1>Ventas Anuales</h1>";
        $data['script'] = '<script type="text/javascript">
		$(document).ready(function() {
			$("#anio").keypress(function(event) {
				acceptNum(evt);
				return false;
			});
		});
	  var nav4 = window.Event ? true : false;
	  function acceptNum(evt)
    {	
    		var key = nav4 ? evt.which : evt.keyCode;	
    		return (key <= 13 || (key >= 48 && key <= 57));
    		
    }
		</script>';
        $data["head"] = script("jquery-1.2.6.pack.js") . $this->rapyd->get_head();
        $this->load->view('view_ventanas', $data);
    }
예제 #10
0
 function mensuales($anio = '', $mes = '')
 {
     $this->rapyd->load("datagrid2");
     $this->rapyd->load("dataform");
     $this->load->helper('openflash');
     if (isset($_POST['anio']) and empty($anio)) {
         $anio = $_POST['anio'];
     }
     if (isset($_POST['mes']) and empty($mes)) {
         $mes = $_POST['mes'];
     }
     if (empty($mes)) {
         redirect("compras/gcompras/anuales/{$anio}");
     }
     $fechai = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01';
     $fechaf = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31';
     $filter = new DataForm('compras/gcompras/mensuales');
     $filter->attributes = array('onsubmit' => "this.action='index/'+this.form.mes.value+'/'+this.form.anio.value+'/';return FALSE;");
     $filter->title('Filtro de Compras Mensuales');
     $filter->mes = new dropdownField("Mes/A&ntilde;o", "mes");
     for ($i = 1; $i < 13; $i++) {
         $filter->mes->option(str_pad($i, 2, '0', STR_PAD_LEFT), str_pad($i, 2, '0', STR_PAD_LEFT));
     }
     $filter->mes->size = 2;
     $filter->mes->style = '';
     $filter->mes->insertValue = $mes;
     $filter->anio = new inputField("A&ntilde;o", "anio");
     $filter->anio->in = 'mes';
     $filter->anio->size = 4;
     $filter->anio->insertValue = $anio;
     $filter->anio->maxlength = 4;
     $filter->button("btnsubmit", "Buscar", form2uri(site_url('compras/gcompras/mensuales'), array('anio', 'mes')), $position = "BL");
     $filter->build_form();
     $grid = new DataGrid2();
     $select = array("fecha", "DAYOFMONTH(fecha) as dia", "SUM(montonet*IF(tipo_doc='D', -1, 1)) AS grantotal", "SUM(credito*IF(tipo_doc='D', -1, 1)) as contado", "SUM(inicial*IF(tipo_doc='D', -1, 1)) as credito", "SUM(montotot*IF(tipo_doc='D',-1,1))AS subtotal", "SUM(montoiva*IF(tipo_doc='D',-1,1))AS impuesto", "COUNT(*) AS numfac");
     $grid->db->select($select);
     $grid->db->from("scst");
     $grid->db->where("tipo_doc <> ", 'X');
     $grid->db->where('fecha >= ', $fechai);
     $grid->db->where('fecha <= ', $fechaf);
     $grid->db->groupby("fecha");
     $grid->column("Dia", "dia");
     $grid->column("Sub-Total", "<number_format><#subtotal#>|2</number_format>", 'align=right');
     $grid->column("Impuesto", "<number_format><#impuesto#>|2</number_format>", 'align=right');
     $grid->column("Total", "<number_format><#grantotal#>|2</number_format>", 'align=right');
     $grid->column("Contado", "<number_format><#contado#>|2</number_format>", 'align=right');
     $grid->column("Credito", "<number_format><#credito#>|2</number_format>", 'align=right');
     $grid->column("N&uacute;mero", "numfac", 'align=right');
     $grid->totalizar('impuesto', 'grantotal', 'contado', 'credito', 'subtotal');
     $grid->build();
     $grafico = open_flash_chart_object(680, 350, site_url("compras/gcompras/gmensuales/{$anio}/{$mes}"));
     $data['content'] = $grafico;
     $data['content'] .= $filter->output . $grid->output;
     $data["head"] = $this->rapyd->get_head();
     $data['title'] = $this->rapyd->get_head() . "<h1>Compras Mensuales</h1>";
     $this->load->view('view_ventanas', $data);
 }
예제 #11
0
 function index()
 {
     $this->rapyd->load('datatable', 'dataform');
     $form = new DataForm('supermercado/cargahisto/index/process');
     $form->title('Este modulo permite cargar manual las ventas sacadas de los historicos de las cajas');
     $form->fecha = new dateonlyField('Fecha', 'fecha', 'd/m/Y');
     $form->fecha->db_format = 'Ymd';
     $form->fecha->insertValue = date('Y-m-d');
     $form->fecha->size = 11;
     $form->fecha->autocomplete = false;
     $form->fecha->rule = 'required|chfecha';
     $form->hf = new uploadField('Facturas (<b>hf</b>YYYYMMCCCAAA.dbf)', 'hf');
     $form->hf->upload_path = 'tmp';
     $form->hf->upload_root = '/';
     $form->hf->rule = 'required';
     $form->hf->allowed_types = 'csv|dbf';
     $form->hi = new uploadField('Art&iacute;culos (<b>hi</b>YYYYMMCCCAAA.dbf)', 'hi');
     $form->hi->upload_path = 'tmp';
     $form->hi->upload_root = '/';
     $form->hi->rule = 'required';
     $form->hi->allowed_types = 'csv|dbf';
     $form->hs = new uploadField('Pagos (<b>hs</b>YYYYMMCCCAAA.dbf)', 'hs');
     $form->hs->upload_path = 'tmp';
     $form->hs->upload_root = '/';
     $form->hs->rule = 'required';
     $form->hs->allowed_types = 'csv|dbf';
     $form->submit('btnsubmit', 'Procesar');
     $form->build_form();
     if ($form->on_success()) {
         $fecha = $form->fecha->newValue;
         $encab = false;
         if (!empty($form->hf->upload_data['full_path'])) {
             if (substr($form->hf->upload_data['file_name'], 0, 2) == 'hf') {
                 $encab = true;
                 $this->_cargadbf($form->hf->upload_data['full_path'], $fecha);
                 unlink($form->hf->upload_data['full_path']);
             } else {
                 $form->error = 'Encabezado primero';
                 $form->build_form();
             }
         }
         if (!empty($form->hi->upload_data['full_path']) && $encab) {
             $this->_cargadbf($form->hi->upload_data['full_path'], $fecha);
             unlink($form->hi->upload_data['full_path']);
         }
         if (!empty($form->hs->upload_data['full_path']) && $encab) {
             $this->_cargadbf($form->hs->upload_data['full_path'], $fecha);
             unlink($form->hs->upload_data['full_path']);
         }
     }
     $data['content'] = $form->output;
     $data['title'] = heading('Cargar ventas de los hist&oacute;ricos de cajas');
     $data['script'] = script('jquery-1.2.6.js');
     $data['head'] = $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
예제 #12
0
 function index()
 {
     $this->rapyd->load("dataform", "datatable", 'datagrid');
     $this->load->library('table');
     //$mSQL=$this->db->query("SHOW tables");
     //$row = $mSQL->result_array();
     //$tables =$row;
     //$base_process_uri= $this->rapyd->uri->implode_uri("base_uri","gfid","orderby");
     //$filter = new DataForm($this->rapyd->uri->add_clause($base_process_uri, "search"));
     $filter = new DataForm('nomina/rpers/process');
     $filter->title('Filtro del Reporte');
     //$filter->attributes=array('onsubmit'=>'is_loaded()');
     $filter->tabla = new dropdownField("Tabla", "tabla");
     $filter->tabla->option("pers", "Personal");
     $filter->tabla->clause = "";
     $filter->obra = new dropdownField("Obra", "depto");
     $filter->obra->db_name = 'depto';
     $filter->obra->clause = "where";
     $filter->obra->option(" ", "Todos");
     $filter->obra->options("SELECT depto, descrip FROM dpto ORDER BY depto ");
     $filter->obra->operator = "=";
     $filter->status = new dropdownField("Status", "status");
     $filter->status->option("", "Todos");
     $filter->status->option("A", "Activos");
     $filter->status->option("I", "Inactivos");
     $filter->status->style = 'width:100px';
     //if($this->rapyd->uri->is_set("search")){
     $mSQL = 'DESCRIBE pers';
     $query = $this->db->query($mSQL);
     if ($query->num_rows() > 0) {
         foreach ($query->result_array() as $row) {
             $data[] = $row;
         }
     }
     function ractivo($field)
     {
         $data2 = array('name' => 'campos[]', 'id' => 'c' . $field, 'value' => $field, 'checked' => FALSE, 'style' => 'margin:5px');
         $retorna = form_checkbox($data2);
         return $retorna;
     }
     $grid = new DataGrid("Resultados", $data);
     $grid->use_function('ractivo');
     $grid->column("Campos", 'Field');
     $grid->column("Mostrar", "<ractivo><#Field#></ractivo>", 'align="center"');
     $grid->build();
     $tabla = $grid->output;
     //$filter->button("btnsubmit", "Consultar",'', $position="BL");
     //$filter->button("btnsubmit", "Traer Tikets", form2uri(site_url("/supervisor/tiket/traertiket"),array('cliente')), $position="BL");//
     //$filter->button("btnsubmit", "Traer Tikets", form2uri(site_url("/supervisor/tiket/traertiket"), $position="BL");//
     $filter->build_form();
     $obra = 'hola';
     $data['content'] = $filter->output . form_open("nomina/rpers/crear/{$obra}") . $tabla . form_submit('mysubmit', 'Generar') . form_close();
     $data['title'] = " Reporte ";
     $data["head"] = script("jquery.js") . $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
예제 #13
0
 function detalle()
 {
     $this->rapyd->load('datagrid', 'dataform');
     $modulo = $this->uri->segment(4) ? $this->uri->segment(4) : $this->input->post('modulo');
     if (!$modulo) {
         redirect('/contabilidad/reglas');
     }
     $form = new DataForm('contabilidad/reglas/ejecutar');
     $form->title('Fecha para la ejecuci&oacute;n');
     $form->fecha = new dateonlyField('Fecha', 'fecha', 'd/m/Y');
     $form->fecha->size = 10;
     $form->fecha->insertValue = $this->input->post('fecha') ? $this->input->post('fecha') : date('Ymd');
     $form->fecha->append("<input type='hidden' name='modulo' value='{$modulo}' id='modulo'>");
     $form->submit = new submitField('Ejecutar', 'btn_submit');
     $form->submit->in = 'fecha';
     $form->build_form();
     function marca($encab, $val)
     {
         if ($encab == 'CASI') {
             return '';
         }
         if (!empty($val)) {
             if (is_numeric($val) && floatval($val) == 0) {
                 return '';
             } else {
                 return '<div style="background:green"> - </div>';
             }
         }
         return '';
     }
     $sel = array('modulo', 'descripcion', 'regla', 'tabla', 'debe', 'haber');
     $link = anchor('/contabilidad/reglas/dataedit/<#modulo#>/show/<#modulo#>/<#regla#>', 'Ver regla');
     $link2 = anchor('/contabilidad/reglas/duplicar/<#modulo#>/<#regla#>', 'Duplicar');
     $action = "javascript:window.location='" . site_url('contabilidad/reglas') . "'";
     $grid = new DataGrid();
     $grid->use_function('marca');
     $grid->add("contabilidad/reglas/dataedit/{$modulo}/create", 'Agregar Regla');
     $grid->button('cancelar', RAPYD_BUTTON_BACK, $action);
     $grid->db->select($sel);
     $grid->db->from('`reglascont`');
     $grid->db->where('modulo', $modulo);
     $grid->db->orderby('modulo,tabla,regla');
     $grid->column('Modulo', 'modulo');
     $grid->column('Regla', 'regla');
     $grid->column('Tabla', 'tabla');
     $grid->column('Descripcion', 'descripcion');
     $grid->column('Debe', '<marca><#tabla#>|<#debe#></marca>', 'align="center"');
     $grid->column('Haber', '<marca><#tabla#>|<#haber#></marca>', 'align="center"');
     $grid->column('', $link, 'align="center"');
     $grid->column('', $link2, 'align="center"');
     $grid->build();
     $data['content'] = $form->output . $grid->output;
     $data['head'] = $this->rapyd->get_head();
     $data['title'] = "<h1>Detalle de regla {$modulo}</h1>";
     $this->load->view('view_ventanas', $data);
 }
예제 #14
0
 function index()
 {
     $this->rapyd->load("datagrid2");
     $this->rapyd->load("dataform");
     $this->load->helper('openflash');
     if ($this->uri->segment(4)) {
         $mes = $this->uri->segment(4);
     } elseif (isset($_POST['mes'])) {
         $mes = $_POST['mes'];
     }
     if ($this->uri->segment(5)) {
         $anio = $this->uri->segment(5);
     } elseif (isset($_POST['anio'])) {
         $anio = $_POST['anio'];
     }
     if (empty($mes) or empty($anio)) {
         $mes = date("n");
     }
     $anio = date("Y");
     $fechai = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01';
     $fechaf = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31';
     $filter = new DataForm('ventas/mensuales');
     $filter->attributes = array('onsubmit' => "this.action='index/'+this.form.mes.value+'/'+this.form.anio.value+'/';return FALSE;");
     $filter->title('Filtro de ventas mensuales');
     $filter->mes = new dropdownField("Mes/A&ntilde;o", "mes");
     for ($i = 1; $i < 13; $i++) {
         $filter->mes->option(str_pad($i, 2, '0', STR_PAD_LEFT), str_pad($i, 2, '0', STR_PAD_LEFT));
     }
     $filter->mes->size = 2;
     $filter->mes->style = '';
     $filter->mes->insertValue = $mes;
     $filter->anio = new inputField("A&ntilde;o", "anio");
     $filter->anio->in = 'mes';
     $filter->anio->size = 4;
     $filter->anio->insertValue = $anio;
     $filter->anio->maxlength = 4;
     $filter->button("btnsubmit", "Buscar", form2uri(site_url('hospitalidad/mensuales/index'), array('mes', 'anio')), $position = "BL");
     $filter->build_form();
     $data = $this->_sincrodata($fechai, $fechaf);
     $grid = new DataGrid2('', $data);
     $grid->totalizar('impuesto', 'cobrado', 'contado', 'credito', 'subtotal', 'numfac');
     $grid->column("Dia", "dia");
     $grid->column("Sub-Total", "<number_format><#subtotal#>|2|,|.</number_format>", 'align=right');
     $grid->column("Impuesto", "<number_format><#impuesto#>|2|,|.</number_format>", 'align=right');
     $grid->column("Contado", "<number_format><#contado#>|2|,|.</number_format>", 'align=right');
     $grid->column("Credito", "<number_format><#credito#>|2|,|.</number_format>", 'align=right');
     $grid->column("Cobrado", "<number_format><#cobrado#>|2|,|.</number_format>", 'align=right');
     $grid->column("% Ventas", "<number_format><#porcentaje#>|2|,|.</number_format>", 'align=right');
     $grid->column("Cant. Fact", "numfac", 'align=right');
     $grid->build();
     $data['content'] = open_flash_chart_object(680, 300, site_url("hospitalidad/mensuales/grafico/{$mes}/{$anio}"));
     $data['content'] .= $filter->output . $grid->output;
     $data['title'] = $this->rapyd->get_head() . "<h1>Ventas Mensuales</h1>";
     $data["head"] = $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
예제 #15
0
 function index()
 {
     //$this->rapyd->load("datagrid");
     $this->rapyd->load("dataform");
     $this->load->helper('openflash');
     if ($this->uri->segment(4)) {
         $anio = $this->uri->segment(4);
     } elseif (isset($_POST['anio'])) {
         $anio = $_POST['anio'];
     }
     if (empty($anio)) {
         $anio = date("Y");
     }
     $fechai = $anio . '0101';
     $fechaf = $anio . '1231';
     $filter = new DataForm('nomina/promediosueldos');
     $filter->title('Filtro de Promedio de Sueldos');
     $filter->anio = new inputField("A&ntilde;o", "anio");
     $filter->anio->size = 4;
     $filter->anio->insertValue = $anio;
     $filter->anio->rule = "max_length[4]";
     $filter->button("btnsubmit", "Buscar", form2uri(site_url('nomina/promediosueldos /index'), array('anio')), $position = "BL");
     $filter->build_form();
     /*
     		$grid = new DataGrid();
     		$select=array( "fecha","MONTH(fecha)as mes",                                            
     		"SUM(montonet*IF(tipo_doc='D', -1, 1)) AS anterior",                             
     		"SUM(credito*IF(tipo_doc='D', -1, 1)) as contado",        
     		"SUM(inicial*IF(tipo_doc='D', -1, 1)) as credito", 
         "FORMAT(sum(montotot*IF(tipo_doc='D',-1,1)),2) AS subtotal", 
         "FORMAT(sum(montoiva*IF(tipo_doc='D',-1,1)),2) AS impuesto", 
         "COUNT(*) AS numfac"); 
                  		
     		$grid->db->select($select);  
     		$grid->db->from("scst");
     		$grid->db->where('a.tipo<>','X');
     		$grid->db->where('fecha >= ', $fechai);  
     		$grid->db->where('fecha <= ',$fechaf); 
     		$grid->db->groupby("mes");
     		
     		$grid->column("Fecha"          , "fecha"    );
     		$grid->column("Sub-Total"      , "subtotal" ,'align=right');
     		$grid->column("Impuesto"       , "impuesto" ,'align=right');
     		$grid->column("Total"          , "anterior",'align=right');
     		$grid->column("Contado"        , "contado"  ,'align=right');
     		$grid->column("Credito"        , "credito"  ,'align=right');
     		$grid->column("N&uacute;mero"  , "numfac"   ,'align=right');
     		$grid->build();*/
     $grafico = open_flash_chart_object(760, 300, site_url("nomina/promediosueldos/grafico/{$anio}/"));
     $data['content'] = $grafico;
     $data['content'] .= $filter->output;
     $data["head"] = $this->rapyd->get_head();
     $data['title'] = $this->rapyd->get_head() . " Nomina ";
     $this->load->view('view_ventanas', $data);
 }
예제 #16
0
    function index()
    {
        $this->rapyd->load('dataform');
        $lscst = site_url('compras/scst/autocomplete/control');
        $script = '
		function formato(row) {
			return row[0]+" "+row[1]+" "+row[3];
		}

		$(function() {
			$("#control").autocomplete("' . $lscst . '",{
				delay:10,
				//minChars:2,
				matchSubset:1,
				matchContains:1,
				cacheLength:10,
				formatItem:formato,
				width:450,
				autoFill:true
				}
			);
		});';
        $form = new DataForm($this->url . 'index/process');
        $form->title('Pasar precios a cajas');
        $form->script($script);
        $form->control = new inputField('Control de compra', 'control');
        $form->control->rule = 'required|callback_chcontrol';
        $form->control->size = 12;
        $form->control->maxlength = 10;
        $form->control->append('Dejar vacio para enviar un masivo');
        $form->submit("btnsubmit", "Pasar precios a caja");
        $form->build_form();
        $error = '';
        if ($form->on_success()) {
            $control = $form->control->newValue;
            $usr = $this->session->userdata('usuario');
            $join = '';
            if (strlen($control > 0)) {
                $join = 'JOIN `itscst` AS b ON a.codigo=b.codigo AND b.codigo=' . $this->db->escape($control);
            }
            $mSQL = "INSERT INTO `enviapos` (codigo,numero,precio1,fecha,hora,usuario)\n\t\t\t\t  SELECT a.codigo,'INVENTAR',a.precio1,CURDATE(),CURTIME(),'{$usr}' FROM `maes` AS a {$join}";
            $ban = $this->db->simple_query($mSQL);
            if (!$ban) {
                $error .= "Hubo problemas al pasar los precios, comuniquese con servicio t&eacute;cnico";
                memowrite($mSQL, 'ENVIACAJA');
            } else {
                logusu('ENVIACAJA', "Fue enviado una actualizacion de precios");
            }
        }
        $data['content'] = "<div class='alert'>{$error}</div>";
        $data['content'] .= $form->output;
        $data['title'] = '<h1>Env&iacute;o de precios para las cajas</h1>';
        $data["head"] = script('jquery.pack.js') . script('plugins/jquery.autocomplete.js') . style('jquery.autocomplete.css') . $this->rapyd->get_head();
        $this->load->view('view_ventanas', $data);
    }
예제 #17
0
 function mensuales($anio = '', $cliente = '')
 {
     $this->rapyd->load("datagrid2");
     $this->rapyd->load("dataform");
     $this->load->helper('openflash');
     if (isset($_POST['anio']) and empty($anio)) {
         $anio = $_POST['anio'];
     }
     if (isset($_POST['cod_cli']) and empty($cliente)) {
         $cliente = $_POST['cod_cli'];
     }
     if (empty($anio) or empty($cliente)) {
         redirect("supermercado/clientes/anuales/{$anio}");
     }
     $fechai = $anio . '0101';
     $fechaf = $anio . '1231';
     $scli = array('tabla' => 'scli', 'columnas' => array('cliente' => 'C&oacute;digo Cliente', 'nombre' => 'Nombre', 'contacto' => 'Contacto'), 'filtro' => array('cliente' => 'C&oacute;digo Cliente', 'nombre' => 'Nombre'), 'retornar' => array('cliente' => 'cod_cli'), 'titulo' => 'Buscar Cliente');
     $cboton = $this->datasis->modbus($scli);
     $filter = new DataForm('supermercado/clientes/mensuales');
     $filter->title('Filtro de ventas Mensuales');
     $filter->anio = new inputField("A&ntilde;o", "anio");
     $filter->anio->size = 4;
     $filter->anio->insertValue = $anio;
     $filter->anio->maxlength = 4;
     $filter->cliente = new inputField("Cliente", "cod_cli");
     $filter->cliente->size = 10;
     $filter->cliente->insertValue = $cliente;
     $filter->cliente->rule = "max_length[4]";
     $filter->cliente->append($cboton);
     $filter->button("btnsubmit", "Buscar", form2uri(site_url('supermercado/clientes/mensuales'), array('anio', 'cod_cli')), $position = "BL");
     $filter->build_form();
     $grid = new DataGrid2();
     $select = array("cliente,nombres,DATE_FORMAT(fecha,'%m')AS mes,\n\t\tSUM(gtotal)AS grantotal,\n\t\tSUM(impuesto)AS impuesto");
     $grid->db->select($select);
     $grid->db->from("viefac");
     $grid->db->where('tipo<>', 'X');
     $grid->db->where('fecha >= ', $fechai);
     $grid->db->where('fecha <= ', $fechaf);
     $grid->db->where('cliente', $cliente);
     $grid->db->groupby("MONTH(fecha)");
     $grid->db->orderby("mes");
     $grid->column("Mes", "mes", "align='left'");
     $grid->column("Impuesto", "<number_format><#impuesto#>|2|,|.</number_format>", 'align=right');
     $grid->column("Total", "<number_format><#grantotal#>|2|,|.</number_format>", 'align=right');
     $grid->totalizar('impuesto', 'grantotal');
     $grid->build();
     //echo $grid->db->last_query();
     $grafico = open_flash_chart_object(750, 350, site_url("supermercado/clientes/gmensuales/{$anio}/{$cliente}"));
     $data['content'] = $grafico;
     $data['content'] .= $filter->output . $grid->output;
     $data["head"] = $this->rapyd->get_head();
     $data['title'] = $this->rapyd->get_head() . "<h1>Clientes</h1>";
     $this->load->view('view_ventanas', $data);
 }
예제 #18
0
 function index()
 {
     $this->rapyd->load("datagrid");
     $this->rapyd->load("datafilter");
     $diai = $this->uri->segment(4);
     $mesi = $this->uri->segment(5);
     $anoi = $this->uri->segment(6);
     if ($diai === FALSE or $mesi === FALSE or $anoi === FALSE) {
         $fechai = date('Y/m/d');
         $qfechai = date('Ymd');
     } else {
         $fechai = "{$anoi}/{$mesi}/{$diai}";
         $qfechai = $anoi . $mesi . $diai;
     }
     $filter = new DataForm('supermercado/poscuadre/index');
     $filter->title('Filtro de cajas');
     $filter->fechai = new dateField("Fecha", "fechai", "d/m/Y");
     $filter->fechai->insertValue = $fechai;
     $filter->fechai->size = 10;
     $filter->button("btnsubmit", "Buscar", form2uri(site_url('supermercado/poscuadre/index'), 'fechai'), $position = "BL");
     $filter->build_form();
     $grid = new DataGrid();
     //$grid->db->select("a.caja caja,IFNULL(b.nombre,'N/A') nombre, a.cajero as cajero,FORMAT(SUM(a.gtotal),2) monto, sum(TRUNCATE(a.gtotal/50000,0)) cupones ");
     $select = array("a.caja caja", "IFNULL(b.nombre,'N/A') nombre", "a.cajero as cajero", "FORMAT(SUM(a.gtotal),2) monto", "sum(TRUNCATE(a.gtotal/50000,0)) cupones");
     $grid->db->select($select);
     $grid->db->from("posfact a");
     $grid->db->where("substring(numero,1,1)!=", 'X');
     $grid->db->where("fecha", $qfechai);
     $grid->db->join("scaj b", "a.cajero=b.cajero", "LEFT");
     $grid->db->groupby('a.caja,a.cajero');
     $grid->column_detail("Caja", "caja", site_url("supermercado/poscuadre/concaja/<#caja#>/<#cajero#>/{$qfechai}"));
     $grid->column("Nombre", "nombre");
     $grid->column("Cajero", "cajero", 'align="center"');
     $grid->column("Cupones", "cupones", 'align="center"');
     $grid->column("Monto", "monto", 'align="right"');
     $grid->build();
     //echo $grid->db->last_query();
     $consul = new DataForm('supermercado/buscafac/index/search/osp');
     $consul->title('Buscar Factura');
     $consul->fechad = new dateField("Desde", "fechad", "d/m/Y");
     $consul->fechah = new dateField("Hasta", "fechah", "d/m/Y");
     $consul->nombre = new inputField("Nombre", "nombre");
     $consul->cedula = new inputField("C&eacute;dula/RIF", "cedula");
     $consul->fechad->insertValue = $consul->fechah->insertValue = date("Y/m/d");
     $consul->fechah->size = $consul->fechad->size = 10;
     $consul->submit("btn_submit", "Buscar");
     $consul->build_form();
     $data['content'] = $filter->output . $grid->output . $consul->output;
     $data['title'] = "<h1>Consulta de Cajas</h1>";
     $data["head"] = $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
예제 #19
0
    function index()
    {
        //$this->datasis->modulo_id(123,1);
        $this->rapyd->load("dataform", "datatable");
        $this->load->library('table');
        $modbus = array('tabla' => 'maes', 'columnas' => array('codigo' => 'C&oacute;digo', 'descrip' => 'Descripci&oacute;n', 'precio1' => 'Precio 1', 'precio2' => 'Precio 2', 'precio3' => 'Precio 3', 'precio4' => 'Precio 4', 'precio5' => 'Precio 5'), 'filtro' => array('codigo' => 'C&oacute;digo', 'descrip' => 'Descripci&oacute;n'), 'retornar' => array('codigo' => 'codigo'), 'titulo' => 'Buscar en inventario');
        $boton = $this->datasis->modbus($modbus);
        $filter = new DataForm('supermercado/consulcajas/index/process');
        $filter->title('Seleccione un producto');
        $filter->codigo = new inputField("Codigo", "codigo");
        $filter->codigo->append($boton);
        $filter->codigo->size = 10;
        $filter->button("btnsubmit", "Consultar", '', $position = "BL");
        $filter->build_form();
        $table = new DataTable(null);
        $table->cell_attributes = 'style="vertical-align:middle;"';
        $table->db->select(array('caja', 'ubica'));
        $table->db->from("caja");
        $table->db->where("ubica REGEXP  '^([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.(([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){2}([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])\$' ");
        $table->db->orderby('caja');
        $table->per_row = 2;
        $table->per_page = 30;
        $celda = array(array(image('caja_abierta.gif', "Caja  <#caja#>", array('border' => 0, 'align' => 'center')) . '<br>Caja <#caja#>', '<div name="cc<#caja#>" id="<#ubica#>"></div>'));
        $table->cell_template = $this->table->generate($celda);
        $table->build();
        $link = site_url('supermercado/consulcajas/preciocaj');
        $script = <<<script
\t\t<script type='text/javascript'>

\t\t\$(document).ready(function() {
\t\t\t\$("input[name='btnsubmit']").click(function () { 
\t\t\t  
\t\t\t  var producto=jQuery.trim(\$('#codigo').val());
\t\t\t\tif (producto.length==0){
\t\t\t\t\talert('Debe introducir un producto');
\t\t\t\t\treturn false;
\t\t\t\t}
\t\t\t\t\$("div[name^='cc']").each(function (i) {
\t\t\t    \$(this).load("{$link}"+'/'+this.id+'/'+producto);
\t\t\t  });
\t\t\t  
\t\t\t});
\t\t});

\t\t</script>
script;
        $data['content'] = $filter->output . $table->output;
        $data['title'] = "<h1>Consulta de productos en cajas</h1>";
        $data["head"] = $this->rapyd->get_head() . script("jquery.js") . $script;
        $this->load->view('view_ventanas', $data);
    }
예제 #20
0
 function dias()
 {
     $this->rapyd->load("datagrid2", "dataform");
     $fechad = $this->uri->segment(4);
     if (empty($fechad)) {
         $fechad = date("Y-m-d");
         $date = new DateTime();
         $date->setDate(substr($fechad, 0, 4), substr($fechad, 5, 2), substr($fechad, 8, 2));
         $date->modify("-6 month");
         $fechad = $date->format("j-n-Y");
     }
     $fechah = $this->uri->segment(5);
     if (empty($fechah)) {
         $fechah = date("d-m-Y");
     }
     $filter = new DataForm();
     $filter->title('Filtro de Analisis de Gastos');
     $filter->fechad = new dateonlyField("Desde", "fechad", 'd-m-Y');
     $filter->fechah = new dateonlyField("Hasta", "fechah", 'd-m-Y');
     $filter->fechad->clause = $filter->fechah->clause = "where";
     $filter->fechad->db_name = $filter->fechah->db_name = "fecha";
     $filter->fechad->insertValue = $fechad;
     $filter->fechah->insertValue = $fechah;
     $filter->fechah->size = $filter->fechad->size = 10;
     $filter->fechad->operator = ">=";
     $filter->fechah->operator = "<=";
     $filter->button("btnsubmit", "Buscar", form2uri(site_url('/ventas/analisisventas/dias'), array('fechad', 'fechah')), $position = "BL");
     $filter->build_form();
     $link = "ventas/analisisventas/dia/<#fecha#>";
     $grid = new DataGrid2("Ventas Por D&iacute;as");
     $grid->column("Fecha", anchor($link, "<dbdate_to_human><#fecha#></dbdate_to_human>"), "align=center");
     $grid->column("Ventas", "<number_format><#ventas#>|2|,|.</number_format>", 'align=right');
     $grid->column("Anulaciones", "<number_format><#anulaciones#>|2|,|.</number_format>", 'align=right');
     $select = array("fecha", "sum(tota*(tipoa<>'X')) as ventas", "sum(tota*(tipoa='X')) as anulaciones");
     $grid->db->select($select);
     $grid->db->from('sitems');
     $fechad2 = substr($fechad, 6, 4) . substr($fechad, 3, 2) . substr($fechad, 0, 2);
     $fechah2 = substr($fechah, 6, 4) . substr($fechah, 3, 2) . substr($fechah, 0, 2);
     $grid->db->where('fecha >= ', $fechad2);
     $grid->db->where('fecha <= ', $fechah2);
     $grid->db->groupby("fecha");
     $grid->build();
     //echo $grid->db->last_query();
     $data['content'] = $filter->output . '<div style="overflow: auto; width: 100%;">' . $grid->output . '</div>';
     $data['title'] = "<h1>Analisis de Ventas</h1>";
     $data["head"] = script("jquery.pack.js") . script("plugins/jquery.numeric.pack.js") . script("plugins/jquery.floatnumber.js") . $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
예제 #21
0
    function index()
    {
        $this->rapyd->load("datagrid", "dataform");
        $this->load->helper('openflash');
        $anio = $this->uri->segment(4);
        if (empty($anio)) {
            $anio = date("Y");
        }
        $script = '
			$(function() {
				$(".inputnum").numeric(".");
			});
			';
        $filter = new DataForm();
        $filter->title('Filtro de An&aacute;lisis de Ventas');
        $filter->script($script, "create");
        $filter->script($script, "modify");
        $filter->anio = new inputField("A&ntilde;o", "anio");
        $filter->anio->size = 4;
        $filter->anio->insertValue = $anio;
        $filter->anio->maxlength = 4;
        $filter->anio->rule = "trim";
        $filter->anio->css_class = 'inputnum';
        $filter->button("btnsubmit", "Buscar", form2uri(site_url('/supermercado/analisis/index'), array('anio')), $position = "BL");
        $filter->build_form();
        $link = "supermercado/analisis/departamento/<#depto#>/{$anio}";
        $select = array('a.fecha', 'a.depto', 'a.familia', 'a.grupo', 'a.codigo', 'a.impuesto', 'a.monto', 'a.cantidad', 'a.transac', 'a.tipo', 'b.descrip');
        $grid = new DataGrid('Ventas por Departamentos');
        $grid->column("Departamento", anchor($link, '<#descrip#>'), 'nowrap=yes');
        for ($i = 1; $i <= 12; $i++) {
            $nmes = $this->calendar->get_month_name(str_pad($i, 2, "0", STR_PAD_LEFT));
            $grid->column($nmes, "<nformat><#m{$i}#></nformat>", 'align=right');
            $select[] = "sum(a.monto*(month(a.fecha)={$i}))  AS m{$i}";
        }
        $grid->db->select($select);
        $grid->db->from('est_item  AS a');
        $grid->db->join('dpto  AS b', 'a.depto=b.depto');
        $grid->db->where('YEAR(a.fecha)', $anio);
        $grid->db->where("a.tipo", 'I');
        $grid->db->groupby('a.depto');
        $grid->build();
        //echo  $grid->db->last_query();
        $data['content'] = $filter->output . '<div style="overflow: auto; width: 100%;">' . $grid->output . '</div>';
        $data['title'] = "<h1>An&aacute;lisis de Ventas</h1>";
        $data["head"] = script("jquery.pack.js") . script("plugins/jquery.numeric.pack.js") . script("plugins/jquery.floatnumber.js") . $this->rapyd->get_head();
        $this->load->view('view_ventanas', $data);
    }
예제 #22
0
 function index()
 {
     $this->rapyd->load("datagrid", "dataform");
     $fecha = $this->uri->segment(4);
     $form = new DataForm();
     $form->title('Fecha para la ejecuci&oacute;n');
     $form->fecha = new dateonlyField("Fecha de Cierre", "fecha", "d/m/Y");
     $form->fecha->size = 10;
     $form->fecha->insertValue = $fecha ? $fecha : date("Ymd", mktime(0, 0, 0, 12, 31, date('Y') - 1));
     $form->submit("btnsubmit", "Cerrar");
     $form->build_form();
     $link = site_url('contabilidad/cierre/ejecutar');
     $data['script'] = "<script type='text/javascript'>\n\t\tfunction generar(){\n\t\t\t\$('#preloader').show();\n\t\t\t\$('#contenido').hide();\n\t\t\t\$.ajax({\n\t\t\t\ttype: 'POST',\n\t\t\t\turl: '{$link}',\n\t\t\t\tdata: \$('input,select').serialize(),\n\t\t\t\tsuccess: function(msg){\n\t\t\t\t\t\$('#preloader').hide();\n\t\t\t\t\t\$('#contenido').show('slow');\n\t\t\t\t\talert(msg);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t\$(document).ready(function(){\n\t\t\t\$('#preloader').hide();\n\t\t\t\$('form').submit(function() {\n\t\t\t\tgenerar();\n\t\t\t\treturn false;\n\t\t\t});\n\t\t});\n\t\t</script>";
     $data['extras'] = "<div id='preloader' style='display: none;\tposition:absolute; left:40%; top:40%; font-family:Verdana, Arial, Helvetica, sans-serif;'>\n\t\t\t<center>" . image("loading4.gif") . "<br>" . image("loadingBarra.gif") . "<br>\n\t\t\t<b>Generando . . . </b>\n\t\t\t</center>\n\t\t</div>";
     $data['content'] = $form->output;
     $data["head"] = script("jquery.pack.js") . $this->rapyd->get_head();
     $data['title'] = '<h1>Cierre Contable</h1>';
     $this->load->view('view_ventanas', $data);
 }
예제 #23
0
 function detalle()
 {
     $this->rapyd->load("datagrid", "dataform");
     $modulo = $this->uri->segment(4) ? $this->uri->segment(4) : $this->input->post('modulo');
     if (!$modulo) {
         redirect('/contabilidad/reglas');
     }
     $form = new DataForm('contabilidad/reglas/ejecutar');
     $form->title('Fecha para la ejecuci&oacute;n');
     $form->fecha = new dateonlyField("Fecha", "fecha", "d/m/Y");
     $form->fecha->size = 10;
     $form->fecha->insertValue = $this->input->post('fecha') ? $this->input->post('fecha') : date("Ymd");
     $form->fecha->append("<input type='hidden' name='modulo' value='{$modulo}' id='modulo'>");
     $form->submit = new submitField("Ejecutar", "btn_submit");
     $form->submit->in = 'fecha';
     $form->build_form();
     $link = anchor('/contabilidad/reglas/dataedit/<#modulo#>/show/<#modulo#>/<#regla#>', 'Ver regla');
     $link2 = anchor('/contabilidad/reglas/duplicar/<#modulo#>/<#regla#>', 'Duplicar');
     $action = "javascript:window.location='" . site_url('contabilidad/reglas') . "'";
     $grid = new DataGrid();
     $grid->add("contabilidad/reglas/dataedit/{$modulo}/create", 'Agregar Regla');
     $grid->button('cancelar', RAPYD_BUTTON_BACK, $action);
     $grid->db->select('modulo, regla, tabla, descripcion,condicion');
     $grid->db->from('`reglascont`');
     $grid->db->where('modulo', $modulo);
     $grid->db->orderby('modulo,tabla,regla');
     $grid->column("Modulo", "modulo");
     $grid->column("Regla", "regla");
     $grid->column("Tabla", "tabla");
     $grid->column("Descripcion", "descripcion");
     //$grid->column("Condicion", "condicion");
     $grid->column('', $link, 'align="center"');
     $grid->column('', $link2, 'align="center"');
     $grid->build();
     $data['content'] = $form->output . $grid->output;
     $data["head"] = $this->rapyd->get_head();
     $data['title'] = "Detalle de regla {$modulo}";
     $this->load->view('view_ventanas', $data);
 }
예제 #24
0
 function index()
 {
     $this->rapyd->load("dataform");
     $this->load->helper('openflash');
     $mes = $this->uri->segment(4);
     $anio = $this->uri->segment(5);
     if (empty($mes)) {
         $mes = date("m");
     }
     if (empty($anio)) {
         $anio = date("Y");
     }
     $fechai = $anio . $mes . '01';
     $fechaf = $anio . $mes . '31';
     $filter = new DataForm();
     $filter->title('Filtro de ventas mensuales');
     $filter->mes = new dropdownField("Mes/A&ntilde;o", "mes");
     for ($i = 1; $i < 13; $i++) {
         $filter->mes->option(str_pad($i, 2, '0', STR_PAD_LEFT), str_pad($i, 2, '0', STR_PAD_LEFT));
     }
     $filter->mes->size = 2;
     $filter->mes->style = '';
     $filter->mes->insertValue = $mes;
     $filter->anio = new inputField("A&ntilde;o", "anio");
     $filter->anio->in = 'mes';
     $filter->anio->size = 4;
     $filter->anio->insertValue = $anio;
     $filter->anio->rule = "max_length[4]";
     $filter->button("btnsubmit", "Buscar", form2uri(site_url('compras/analisis/index'), array('mes', 'anio')), $position = "BL");
     $filter->build_form();
     $data['forma'] = '';
     $data['lista'] = $filter->output;
     $data['lista'] .= open_flash_chart_object(800, 300, site_url("compras/analisis/departa/{$mes}/{$anio}"));
     $data['titulo'] = $this->rapyd->get_head() . "<center><h2>VENTAS MENSUALES</h2></center>";
     $this->layout->buildPage('ventas/view_ventas', $data);
 }
예제 #25
0
    function load()
    {
        $this->rapyd->load("dataform");
        $link = site_url('inventario/sinvactu/deshacer');
        $script = '
		function deshacer(){
			a=confirm("¿Esta Seguro que de desea deshacer la ultima actualizaci&oacute;n realizada?");
			if(a){
				$.ajax({
					url: "' . $link . '",
					success: function(msg){
						if(msg){
							alert("Fue realizada exitosamente la operaci&oacute;n");
						}
						else{
							alert("La operaci&oacute;n no pudo ser completada. Intente mas tarde");
						}
					}
				});
			}
		}
		';
        $form = new DataForm("inventario/sinvactu/read");
        $form->title('Cargar Archivo de Productos (xls)');
        $form->script($script);
        $form->archivo = new uploadField("Archivo", "archivo");
        $form->archivo->upload_path = $this->upload_path;
        $form->archivo->allowed_types = "xls";
        $form->archivo->delete_file = false;
        $form->archivo->rule = "required";
        $form->submit("btnsubmit", "Cargar");
        $form->build_form();
        $salida = '<a href="javascript:deshacer();" title="Haz Click para Deshacer La Ultima Actualizaci&oacute;n" onclick="">Deshacer La Ultima Actualizaci&oacute;n</a>';
        $data['content'] = $form->output . $salida;
        $data['title'] = "<h1>Actualizaci&oacute;n de Inventario</h1>";
        $data["head"] = script("jquery.pack.js") . $this->rapyd->get_head();
        $this->load->view('view_ventanas', $data);
    }
예제 #26
0
 function diarias($anio = '', $cliente = '', $mes = '')
 {
     $this->rapyd->load("datagrid2");
     $this->rapyd->load("dataform");
     $this->load->helper('openflash');
     if (isset($_POST['anio']) and empty($anio)) {
         $anio = $_POST['anio'];
     }
     if (isset($_POST['mes']) and empty($mes)) {
         $mes = $_POST['mes'];
     }
     if (isset($_POST['cod_cli']) and empty($cliente)) {
         $cliente = $_POST['cod_cli'];
     }
     if (empty($mes)) {
         redirect("hospitalidad/clientes/mensuales/{$anio}/{$cliente}");
     }
     $fechai = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01';
     $fechaf = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31';
     $scli = array('tabla' => 'scli', 'columnas' => array('cliente' => 'C&oacute;digo Cliente', 'nombre' => 'Nombre', 'contacto' => 'Contacto'), 'filtro' => array('cliente' => 'C&oacute;digo Cliente', 'nombre' => 'Nombre'), 'retornar' => array('cliente' => 'cod_cli'), 'titulo' => 'Buscar Cliente');
     $cboton = $this->datasis->modbus($scli);
     $filter = new DataForm('hospitalidad/clientesdiarias');
     $filter->attributes = array('onsubmit' => "this.action='index/'+this.form.mes.value+'/'+this.form.anio.value+'/';return FALSE;");
     $filter->title('Filtro de Ventas Diarias');
     $filter->mes = new dropdownField("Mes/A&ntilde;o", "mes");
     for ($i = 1; $i < 13; $i++) {
         $filter->mes->option(str_pad($i, 2, '0', STR_PAD_LEFT), str_pad($i, 2, '0', STR_PAD_LEFT));
     }
     $filter->mes->size = 2;
     $filter->mes->style = '';
     $filter->mes->insertValue = $mes;
     $filter->anio = new inputField("A&ntilde;o", "anio");
     $filter->anio->in = 'mes';
     $filter->anio->size = 4;
     $filter->anio->insertValue = $anio;
     $filter->anio->maxlength = 4;
     $filter->cliente = new inputField("Cliente", "cod_cli");
     $filter->cliente->size = 10;
     $filter->cliente->insertValue = $cliente;
     $filter->cliente->rule = "max_length[4]";
     $filter->cliente->append($cboton);
     $filter->button("btnsubmit", "Buscar", form2uri(site_url('hospitalidad/clientes/diarias/'), array('anio', 'cod_cli', 'mes')), $position = "BL");
     $filter->build_form();
     $grid = new DataGrid2();
     $select = array("cod_cli,nombre", "DATE_FORMAT(fecha,'%d/%m/%Y') AS fecha", "SUM(gtotal*IF(tipo='D', -1, 1)) AS grantotal", "SUM(gtotal*IF(tipo='D', -1, 1))/ COUNT(*) AS porcentaje", "SUM(gtotal*IF(tipo='D', -1, 1)) AS contado", "SUM(gtotal*IF(tipo='D', -1, 1)) AS credito", "SUM(stotal*IF(tipo='D',-1,1))AS subtotal", "SUM(impuesto*IF(tipo='D',-1,1))AS impuesto", "COUNT(*) AS numfac");
     $grid->db->select($select);
     $grid->db->from("fmay");
     $grid->db->where('tipo<>', 'X');
     $grid->db->where('fecha >= ', $fechai);
     $grid->db->where('fecha <= ', $fechaf);
     $grid->db->where('cod_cli', $cliente);
     $grid->db->groupby("fecha");
     $grid->column("Dia", "fecha", "align='center'");
     $grid->column("Sub-Total", "<number_format><#subtotal#>|2|,|.</number_format>", 'align=right');
     $grid->column("Impuesto", "<number_format><#impuesto#>|2|,|.</number_format>", 'align=right');
     $grid->column("Total", "<number_format><#grantotal#>|2|,|.</number_format>", 'align=right');
     $grid->column("Contado", "<number_format><#contado#>|2|,|.</number_format>", 'align=right');
     $grid->column("Credito", "<number_format><#credito#>|2|,|.</number_format>", 'align=right');
     $grid->column("Participaci&oacute;n", "<number_format><#porcentaje#>|2|,|.</number_format>", 'align=right');
     $grid->column("Cant. Fact", "numfac", 'align=right');
     $grid->totalizar('impuesto', 'grantotal', 'contado', 'credito', 'subtotal');
     $grid->build();
     $grafico = open_flash_chart_object(720, 350, site_url("hospitalidad/clientes/gdiarias/{$anio}/{$cliente}/{$mes}"));
     $data['content'] = $grafico;
     $data['content'] .= $filter->output . $grid->output;
     $data["head"] = $this->rapyd->get_head();
     $data['title'] = $this->rapyd->get_head() . "<h1>Clientes</h1>";
     $this->load->view('view_ventanas', $data);
 }
예제 #27
0
<?php

$base_process_uri = $this->rapyd->uri->implode_uri("base_uri", "gfid", "orderby");
$filter = new DataForm($this->rapyd->uri->add_clause($base_process_uri, "search"));
$filter->title('Elija un formato de salida');
$filter->attributes = array('onsubmit' => 'is_loaded()');
$filter->salformat = new radiogroupField("Formato de salida", "salformat");
$filter->salformat->options($this->opciones);
$filter->salformat->insertValue = 'PDF';
$filter->salformat->clause = '';
$filter->submit("btnsubmit", "Descargar");
$filter->build_form();
//$mContrato = $this->datasis->dameval("SELECT CONCAT(b.codigo,' ',b.nombre) FROM prenom a JOIN noco b ON a.contrato=b.codigo LIMIT 1");
if ($this->rapyd->uri->is_set("search")) {
    $mSQLs = array();
    $sql = $this->db->query("SHOW TABLES LIKE 'PRENOM%'");
    foreach ($sql->result_array() as $row) {
        foreach ($row as $key => $tabla) {
            $fecha = $this->datasis->dameval("SELECT DATE_FORMAT(fecha, '%d/%m/%Y') FROM {$tabla} ORDER BY fecha desc limit 1");
            $valor = $this->datasis->dameval("select IF(b.tipo='Q','15',IF(b.tipo='S','7',IF(b.tipo='M','30','0')))as periodo FROM {$tabla} AS a JOIN noco as b on a.contrato=b.codigo limit 1");
            $fechad = $this->datasis->dameval("SELECT SUBDATE('{$fecha}', INTERVAL  '{$valor}' DAY) ");
            $mSQL = "(SELECT b.divi, b.depto, a.codigo, CONCAT(RTRIM(b.nombre),' ' ,b.apellido)  nombre, CONCAT(b.divi, b.depto) dividep ";
            $mSQL .= ", SUM(a.valor) totalnom, ";
            $mSQL .= "(SELECT SUM(IF(d.monto-d.abonos-c.cuota>0, c.cuota, d.monto-d.abonos )) neto, b.cuentab";
            $mSQL .= "FROM pres c JOIN smov d ON  c.cod_cli=d.cod_cli AND c.tipo_doc=d.tipo_doc AND c.numero=d.numero WHERE c.codigo=a.codigo AND c.apartir<=a.fecha ) prestamo, e.descrip dividesc, f.depadesc ";
            $mSQL .= "FROM {$tabla} a JOIN pers b ON a.codigo=b.codigo ";
            $mSQL .= "LEFT JOIN divi e ON b.divi  = e.division ";
            $mSQL .= "LEFT JOIN depa f ON b.depto =  f.departa ";
            $mSQL .= "WHERE MID(a.concepto,1,1) != '9' ";
            $mSQL .= "GROUP BY a.codigo)";
            $mSQLs[] = $mSQL;
예제 #28
0
 function presup($numero)
 {
     $this->rapyd->load("dataform");
     $this->load->helper('openflash');
     $filter = new DataForm("ventas/presupuesto/presupdolar/");
     $filter->attributes = array('onsubmit' => "this.action='index/'+this.form.mes.value+'/'+this.form.anio.value+'/';return FALSE;");
     $filter->title('Seleccione el Precio del D&oacute;lar con que desea Trabajar');
     $filter->dolar = new dropdownField("Precio del D&oacute;lar", "dolar");
     $filter->dolar->option("b.dolar", "Precio1");
     $filter->dolar->option("b.dolar2", "Precio2");
     $filter->dolar->option("b.dolar3", "Precio3");
     $filter->dolar->option("b.dolar4", "Precio4");
     $filter->dolar->style = 'width:150px;';
     $filter->button("btnsubmit", "Aceptar", form2uri(site_url("formatos/ver/PRESUP/{$numero}/"), array('dolar')), $position = "BL");
     $filter->build_form();
     $data['content'] = $filter->output;
     $data["head"] = $this->rapyd->get_head();
     $data['title'] = "<h1>Presupuesto en Bolivares</h1>";
     $this->load->view('view_ventanas', $data);
 }
예제 #29
0
 function diarias($anio = '', $proveed = '', $mes = '')
 {
     $this->rapyd->load('datagrid2');
     $this->rapyd->load('dataform');
     $this->load->helper('openflash');
     $proveed = radecode($proveed);
     if (isset($_POST['anio']) && empty($anio)) {
         $anio = $_POST['anio'];
     }
     if (isset($_POST['mes']) && empty($mes)) {
         $mes = $_POST['mes'];
     }
     if (isset($_POST['proveed']) && empty($proveed)) {
         $proveed = $_POST['proveed'];
     }
     if (empty($mes)) {
         redirect("compras/proveedores/mensuales/{$anio}/{$proveed}");
     }
     $fechai = $anio . str_pad($mes, 2, '0', STR_PAD_LEFT) . '01';
     $fechaf = $anio . str_pad($mes, 2, '0', STR_PAD_LEFT) . '31';
     $scli = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'Codigo proveedor', 'nombre' => 'Nombre'), 'filtro' => array('proveed' => 'Còdigo proveedor', 'nombre' => 'Nombre'), 'retornar' => array('proveed' => 'proveed'), 'titulo' => 'Buscar proveedor');
     $cboton = $this->datasis->modbus($scli);
     $filter = new DataForm('compras/proveedoresdiarios');
     $filter->attributes = array('onsubmit' => "this.action='index/'+this.form.mes.value+'/'+this.form.anio.value+'/';return FALSE;");
     $filter->title('Filtro de Compras Diarias');
     $filter->mes = new dropdownField('Mes/A&ntilde;o', 'mes');
     for ($i = 1; $i < 13; $i++) {
         $filter->mes->option(str_pad($i, 2, '0', STR_PAD_LEFT), str_pad($i, 2, '0', STR_PAD_LEFT));
     }
     $filter->mes->size = 2;
     $filter->mes->style = '';
     $filter->mes->insertValue = $mes;
     $filter->anio = new inputField('A&ntilde;o', 'anio');
     $filter->anio->in = 'mes';
     $filter->anio->size = 4;
     $filter->anio->insertValue = $anio;
     $filter->anio->rule = 'max_length[4]';
     $filter->proveedor = new inputField('Proveedor', 'proveed');
     $filter->proveedor->size = 10;
     $filter->proveedor->insertValue = $proveed;
     $filter->proveedor->rule = 'max_length[4]';
     $filter->proveedor->append($cboton);
     $filter->button('btnsubmit', 'Buscar', form2uri(site_url('compras/proveedores/diarias/'), array('anio', 'proveed', 'mes')), $position = 'BL');
     $filter->build_form();
     $grid = new DataGrid2();
     $select = array('proveed', "DATE_FORMAT(fecha,'%d/%m/%Y') AS fecha", "SUM(montonet*IF(tipo_doc='NC',-1,1)) AS grantotal", "SUM(inicial*IF( tipo_doc='NC',-1,1)) AS contado", "SUM(credito*IF( tipo_doc='NC',-1,1)) AS credito", "SUM(montotot*IF(tipo_doc='NC',-1,1)) AS subtotal", "SUM(montoiva*IF(tipo_doc='NC',-1,1)) AS impuesto", 'COUNT(*) AS numfac');
     $grid->db->select($select);
     $grid->db->from('scst');
     $grid->db->where('tipo_doc <> ', 'NE');
     $grid->db->where('fecha >= ', $fechai);
     $grid->db->where('fecha <= ', $fechaf);
     $grid->db->where('proveed', $proveed);
     $grid->db->where('actuali >= fecha');
     $grid->db->groupby('fecha');
     $grid->column('Fecha', "fecha", "align='center'");
     $grid->column('Sub-Total', "<number_format><#subtotal#>|2|,|.</number_format>", 'align=right');
     $grid->column('Impuesto', "<number_format><#impuesto#>|2|,|.</number_format>", 'align=right');
     $grid->column('Total', "<number_format><#grantotal#>|2|,|.</number_format>", 'align=right');
     $grid->column('Contado', "<number_format><#contado#>|2|,|.</number_format>", 'align=right');
     $grid->column('Credito', "<number_format><#credito#>|2|,|.</number_format>", 'align=right');
     $grid->column('Cant. Fact', "numfac", 'align=right');
     $grid->totalizar('impuesto', 'grantotal', 'contado', 'credito', 'subtotal');
     $grid->build();
     $proveed = raencode($proveed);
     $grafico = open_flash_chart_object(680, 350, site_url("compras/proveedores/gdiarias/{$anio}/{$proveed}/{$mes}"));
     $data['content'] = $grafico;
     $data['content'] .= $filter->output . $grid->output;
     $data['head'] = $this->rapyd->get_head();
     $data['title'] = '<h1>Compras Diarias</h1>';
     $this->load->view('view_ventanas', $data);
 }
예제 #30
0
 function load()
 {
     $this->load->library('path');
     $this->load->helper('html');
     $path = new Path();
     $path->setPath($this->config->item('uploads_dir'));
     $path->append('/archivos');
     $this->upload_path = $path->getPath() . '/';
     $this->rapyd->load('dataform');
     $form = new DataForm($this->url . 'load/process');
     $form->title('Importar Archivos');
     $form->explica1 = new containerField('', "<p style='color:blue;background-color:C6DAF6;align:center'>Para cargar un nuevo archivo de data seleccionelo en el el bot&oacute;n Examinar y luego presione enviar.</p>");
     $form->container = new containerField('adver', 'Solo archivos en formato EXCEL 97, asegurese de que la informacion que desea importar este en la hoja 1.');
     $form->archivo = new uploadField('Archivo', 'archivo');
     $form->archivo->upload_path = '';
     $form->archivo->allowed_types = 'xls';
     $form->archivo->delete_file = false;
     $form->archivo->upload_root = '/tmp';
     $form->archivo->rule = 'required';
     $form->archivo->append('Solo archivos en formato xls (Excel 97-2003)');
     $form->submit('btnsubmit', 'Enviar');
     $form->build_form();
     $rti = '';
     if ($form->on_success()) {
         $idtabla = intval($this->datasis->dameval('SELECT MAX(id_tabla) AS maxid FROM ' . $this->tabla));
         $idtabla++;
         $arch = '/tmp/' . $form->archivo->upload_data['file_name'];
         $rt = $this->_xlsread($arch, $idtabla);
         $rti = "<p>{$rt}</p>";
     }
     $lista = array();
     $mSQL = 'SELECT id_tabla,COUNT(*) AS cana  FROM ' . $this->tabla . ' GROUP BY id_tabla ORDER BY id_tabla DESC LIMIT 10';
     $query = $this->db->query($mSQL);
     if ($query->num_rows() > 0) {
         foreach ($query->result() as $row) {
             $lista[] = anchor($this->url . 'procesar/' . $row->id_tabla, 'Tabla: ' . $row->id_tabla . ' (' . $row->cana . ' registros).');
         }
         $listaul = '<h2>Tablas ya importadas</h2>' . ul($lista);
     } else {
         $listaul = '';
     }
     $data['content'] = $rti . $form->output . $listaul;
     $data['title'] = heading('Importaci&oacute;n de data desde archivos');
     $data['head'] = $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }