本文整理汇总了PHP中DataFilter::button方法的典型用法代码示例。如果您正苦于以下问题:PHP DataFilter::button方法的具体用法?PHP DataFilter::button怎么用?PHP DataFilter::button使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataFilter
的用法示例。
在下文中一共展示了DataFilter::button方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filteredgrid
function filteredgrid()
{
$this->load->helper('fecha');
$this->rapyd->load('datafilter', 'datagrid');
$filter = new DataFilter('Metas');
$filter->db->select(array('a.*', 'c.descrip', 'c.peso AS pesosinv'));
$filter->db->from('metas AS a');
$filter->db->join('sinv AS c', 'a.codigo=c.codigo');
$filter->fecha = new dateonlyField('Fecha', 'fecha', 'm/Y');
$filter->fecha->clause = 'where';
$filter->fecha->db_name = 'fecha';
$filter->fecha->operator = '=';
$filter->fecha->dbformat = 'Ym';
$filter->fecha->size = 7;
$filter->fecha->append(' mes/año');
$filter->fecha->rule = 'required';
$filter->codigo = new dropdownField('Producto', 'codigo');
$filter->codigo->option('', 'Todos');
$filter->codigo->options('SELECT TRIM(codigo),CONCAT_WS("-",TRIM(codigo),TRIM(descrip)) AS valor FROM sinv ORDER BY codigo');
$filter->codigo->style = 'width:150px';
$accion = "javascript:window.location='" . site_url('ventas/metas/load') . "'";
$filter->button('btn_load', 'Cargar desde Excel', $accion, 'TR');
$accion = "javascript:window.location='" . site_url('ventas/metas/cmetas') . "'";
$filter->button('btn_load', 'Ajustar metas a vendedores', $accion, 'TR');
$filter->buttons('reset', 'search');
$filter->build();
function formfecha($mes)
{
$anio = substr($mes, 0, 4);
$nom = mesLetra(substr($mes, 4));
return "{$nom}-{$anio}";
}
$uri = anchor('ventas/metas/dataedit/show/<#id#>', '<formfecha><#fecha#></formfecha>');
$grid = new DataGrid('Lista de Metas');
$grid->order_by('fecha', 'desc');
$grid->use_function('formfecha');
$grid->per_page = 15;
$grid->column_orderby('Fecha', $uri, 'fecha');
$grid->column_orderby('Producto', 'codigo', '<#codigo#>-<#descrip#>');
$grid->column_orderby('Descripción', 'descrip', 'descrip');
$grid->column_orderby('Peso U.', '<nformat><#pesosinv#></nformat>', 'pesosinv', 'align="right"');
$grid->column_orderby('Peso Meta', '<nformat><#peso#></nformat>', 'peso', 'align="right"');
$grid->column_orderby('Cant. Meta', '<nformat><#cantidad#></nformat>', 'cantidad', 'align="right"');
$action = "javascript:window.location='" . site_url('ventas/metas/compara') . "'";
$grid->button('btn_compa', 'Comparativo', $action, 'BL');
$grid->add('ventas/metas/dataedit/create');
$grid->build();
$data['content'] = $filter->output . $grid->output;
$data['title'] = heading('Metas propuestas');
$data['head'] = $this->rapyd->get_head();
$this->load->view('view_ventanas', $data);
}
示例2: index
function index()
{
$this->rapyd->load('datagrid');
$this->rapyd->load('datafilter');
$control = array(false, false);
$filter = new DataFilter('Filtro de Facturas');
$filter->fechad = new dateField('Desde', 'fechad', 'd/m/Y');
$filter->fechad->operator = '>=';
$filter->fechah = new dateField('Hasta', 'fechah', 'd/m/Y');
$filter->fechah->operator = '<=';
$filter->fechah->clause = $filter->fechad->clause = 'where';
$filter->fechah->db_name = $filter->fechad->db_name = 'fecha';
$filter->fechah->size = $filter->fechad->size = 10;
$filter->fechah->insertValue = $filter->fechad->insertValue = date('Y/m/d');
$filter->fechah->group = $filter->fechad->group = 'Fecha';
$filter->nombre = new inputField('Nombre', 'nombre');
$filter->nombre->db_name = "CONCAT(b.nombres,' ',b.apellidos)";
$filter->cedula = new inputField('Cédula/RIF', 'cedula');
$filter->buttons('reset', 'search');
$action = "javascript:window.location='" . site_url('supermercado/poscuadre') . "'";
$filter->button('btn_regresa', 'Regresar', $action, 'TR');
$filter->build();
if (empty($filter->fechah->value) or $filter->fechah->value == date('Y/m/d')) {
$control[0] = true;
}
if (empty($filter->fechah->value) or $filter->fechah->value == date('Y/m/d')) {
$control[1] = true;
}
$grid = new DataGrid();
$grid->per_page = 10;
$select = array('b.cedula', "DATE_FORMAT(a.fecha, '%d/%m/%Y') fecha", 'a.cajero', 'a.caja', 'a.tipo', 'a.numero', "DATE_FORMAT(a.fecha, '%Y%m%d') qfecha", "IF(b.nombres IS NULL,a.nombres,CONCAT(b.nombres,' ',b.apellidos)) nombres", 'a.impuesto', 'a.gtotal', 'a.hora');
$grid->db->select($select);
$grid->db->from('viefac a');
$grid->db->join('club b', 'a.cliente=b.cod_tar', 'LEFT');
if ($control[0]) {
$grid->db->where('a.fecha>=', 'NOW()');
}
if ($control[1]) {
$grid->db->where('a.fecha<=', 'NOW()');
}
$grid->db->orderby('a.fecha, a.caja, a.numero');
$grid->column_detail('Caja', 'caja', site_url("supermercado/buscafac/verfactura/<#caja#>/<#cajero#>/<#qfecha#>/<#numero#>"));
$grid->column('Cajero', 'cajero');
$grid->column('Tipo', 'tipo');
$grid->column('Número', 'numero');
$grid->column('Fecha', 'fecha');
$grid->column('Cedula', 'cedula');
$grid->column('Nombres', 'nombres');
$grid->column('Impuesto', 'impuesto');
$grid->column('Total', 'gtotal');
$grid->build();
//echo $grid->db->last_query();
$data['content'] = $filter->output . $grid->output;
$data['title'] = '<h1>Consulta de facturas</h1>';
$data['head'] = $this->rapyd->get_head();
$this->load->view('view_ventanas', $data);
}
示例3: gserchi
function gserchi()
{
$this->rapyd->load('datafilter', 'datagrid');
$this->rapyd->uri->keep_persistence();
$filter = new DataFilter('Filtro de gastos de cajas chicas', 'gserchi');
$select = array('numfac', 'fechafac', 'proveedor', 'tasa + sobretasa + reducida AS totiva', 'exento + montasa + monadic + monredu AS totneto');
$filter->db->select($select);
$filter->codbanc = new dropdownField('Código de la caja', 'codbanc');
$filter->codbanc->option('', 'Todos');
$filter->codbanc->options("SELECT codbanc, CONCAT_WS('-',codbanc,banco) AS label FROM banc WHERE tbanco='CAJ' ORDER BY codbanc");
$filter->fechad = new dateonlyField('Fecha desde', 'fechad', 'd/m/Y');
$filter->fechah = new dateonlyField('Fecha hasta', 'fechah', 'd/m/Y');
$filter->fechad->clause = $filter->fechah->clause = 'where';
$filter->fechad->db_name = $filter->fechah->db_name = 'fechafac';
$filter->fechah->size = $filter->fechad->size = 10;
$filter->fechad->operator = '>=';
$filter->fechah->operator = '<=';
$filter->numero = new inputField('Número', 'numfac');
$filter->proveed = new inputField('Proveedor', 'proveedor');
//$filter->proveed->append($boton);
$filter->proveed->db_name = 'proveedor';
$filter->aceptado = new dropdownField('Aceptados', 'aceptado');
$filter->aceptado->option('', 'Todos');
$filter->aceptado->option('S', 'Aceptados');
$filter->aceptado->option('N', 'No aceptados');
$filter->aceptado->style = 'width:120px';
//$action = "javascript:window.location='".site_url('finanzas/gser/gserchipros')."'";
//$filter->button('btn_pross', 'Procesar gatos', $action, 'TR');
$action = "javascript:window.location='" . site_url('finanzas/gser/agregar') . "'";
$filter->button('btn_regresa', 'Regresar', $action, 'TR');
$filter->buttons('reset', 'search');
$filter->build();
$uri = anchor('finanzas/gser/datagserchi/show/<#id#>', '<#numfac#>');
function checker($id, $conci)
{
if ($conci == 'S') {
return form_checkbox('nn' . $id, $id, true);
} else {
return form_checkbox('nn' . $id, $id, false);
}
}
$grid = new DataGrid();
$grid->use_function('checker');
$grid->order_by('numfac', 'desc');
$grid->per_page = 15;
$grid->column_orderby('Caja', 'codbanc', 'caja');
$grid->column_orderby('Número', $uri, 'numfac');
$grid->column_orderby('Fecha', '<dbdate_to_human><#fechafac#></dbdate_to_human>', 'fechafac', 'align=\'center\'');
$grid->column_orderby('Proveedor', 'proveedor', 'proveedor');
$grid->column_orderby('IVA', 'totiva', 'totiva', 'align=\'right\'');
$grid->column_orderby('Monto', 'totneto', 'totneto', 'align=\'right\'');
$grid->column_orderby('Aceptado', '<checker><#id#>|<#aceptado#></checker>', 'aceptado', 'align=\'center\'');
$grid->add('finanzas/gser/datagserchi/create', 'Agregar nueva factura');
$grid->build();
//echo $grid->db->last_query();
$this->rapyd->jquery[] = '$(":checkbox").change(function(){
name=$(this).attr("name");
$.post("' . site_url('finanzas/gser/gserchiajax') . '",{ id: $(this).val()},
function(data){
if(data=="1"){
return true;
}else{
$("input[name=\'"+name+"\']").removeAttr("checked");
alert("Hubo un error, comuniquese con soporte tecnico: "+data);
return false;
}
});
});';
$data['content'] = $filter->output . $grid->output;
$data['head'] = script('jquery.js');
$data['head'] .= $this->rapyd->get_head();
$data['title'] = heading('Agregar/Modificar facturas de Caja Chica');
$this->load->view('view_ventanas', $data);
}
示例4: filterscli
function filterscli()
{
$url = $this->url . 'filteredgrid';
$ven = $this->secu->getvendedor();
$this->rapyd->uri->keep_persistence();
$persistence = $this->rapyd->session->get_persistence($url, $this->rapyd->uri->gfid);
$back = isset($persistence['back_uri']) ? $persistence['back_uri'] : $url;
$this->rapyd->load('datafilter', 'datagrid');
$filter = new DataFilter('Selección de Clientes', 'scli');
//$filter->db->where('vendedor',$ven);
$filter->button('btn_back', RAPYD_BUTTON_BACK, "javascript:window.location='" . site_url($back) . "'", 'BL');
$filter->nombre = new inputField('Nombre', 'nombre');
$filter->rifci = new inputField('CI/RIF', 'rifci');
$filter->rifci->size = 15;
$filter->vd = new dropdownField('Vendedor', 'vendedor');
$filter->vd->option('', 'Todos');
$filter->vd->options('SELECT vendedor, CONCAT(vendedor,\' \',nombre) nombre FROM vend ORDER BY vendedor');
$filter->vd->style = 'width:200px;';
$filter->vd->insertValue = $ven;
$filter->buttons('reset', 'search');
$filter->build();
$uri = anchor($this->url . 'dataedit/<raencode><#cliente#></raencode>/create', '<#cliente#>');
$grid = new DataGrid('Seleccione el clientes');
$grid->order_by('nombre', 'asc');
$grid->per_page = 20;
$grid->column_orderby('Cliente', $uri, 'cliente');
$grid->column_orderby('Nombre', 'nombre', 'nombre');
$grid->column_orderby('RIF/CI', 'rifci');
$grid->build();
$data['content'] = $filter->output . $grid->output;
$data['title'] = heading('Clientes');
$data['head'] = $this->rapyd->get_head();
$data['extras'] = '';
$this->load->view('view_ventanas', $data);
}
示例5: genelibro
function genelibro()
{
$this->rapyd->load('datafilter', 'datagrid', 'fields');
$this->rapyd->uri->keep_persistence();
$filter = new DataFilter('', 'view_invresutotal');
$mes = $this->datasis->dameval('SELECT MID(MAX(mes),1,4) FROM invresu');
$estFecha = $this->datasis->dameval('SELECT MAX(fecha) AS fecha FROM costos');
if (empty($estFecha)) {
$estMsj = 'No existen estadísticas generadas, debe generarse primero para usar este modulo.';
} else {
$estMsj = 'Por favor tenga en cuenta que este modulo utiliza las estadísticas del sistema, por lo tanto los movimientos se podrán generar solo hasta el ' . dbdate_to_human($estFecha) . '.';
}
$filter->container = new containerField('alert', "<b style='color:#E50E0E;'>{$estMsj}</b>");
$filter->container->clause = '';
$filter->fecha = new inputField('Año', 'anno');
$filter->fecha->size = 4;
$filter->fecha->operator = '=';
$filter->fecha->clause = 'where';
$filter->fecha->insertValue = $mes;
$actionb = 'bobo(\'' . site_url('finanzas/invresu/calcula') . '/\'+$(\'#anno\').val()+\'01\');return true;';
$filter->button('btn_recalculo', 'Generar todo', $actionb, 'BR', 'show');
$filter->buttons('search');
$filter->build();
$monto = new inputField('Monto', 'monto');
$monto->grid_name = 'monto[<#anno#>][<#mes#>]';
$monto->size = 14;
$monto->css_class = 'inputnum';
$monto->autocomplete = false;
$grid = new DataGrid('Lista');
$grid->per_page = 12;
$uri2 = anchor('#', img(array('src' => 'images/engrana.png', 'border' => '0', 'alt' => 'Calcula', 'title' => 'Calcular')), array('onclick' => 'bobo(\'' . base_url() . 'finanzas/invresu/calcula/<#anno#><#mes#>\');return false;'));
$uri2 .= " ";
$uri2 .= anchor('#', img(array('src' => 'images/refresh.png', 'border' => '0', 'alt' => 'Rebaja', 'title' => 'Rebajar')), array('onclick' => 'foo(\'' . base_url() . 'finanzas/invresu/recalcula/<#anno#><#mes#>\');return false;'));
$uri2 .= " ";
$uri2 .= anchor('#', img(array('src' => 'images/ojo.png', 'border' => '0', 'alt' => 'Consulta', 'title' => 'Consultar', 'height' => '18')), array('onclick' => 'fconsulta(\'<#anno#><#mes#>\'); return false;'));
$grid->column('Accion', $uri2, 'align=\'center\' bgcolor=\'#041C87\'');
$grid->column('Año', 'anno', 'align="center"');
$grid->column('Mes', 'mes', 'align="center"');
$grid->column('Inicial', '<nformat><#inicial#></nformat>', 'align=\'right\'');
$grid->column('Compras', '<nformat><#compras#></nformat>', 'align=\'right\'');
$grid->column('Ventas', '<nformat><#ventas#></nformat>', 'align=\'right\'');
$grid->column('Retiros', '<nformat><#retiros#></nformat>', 'align=\'right\'');
$grid->column('Por Despachar', '<nformat><#despachar#></nformat>', 'align=\'right\'');
$grid->column('Final', '<nformat><#final#></nformat>', 'align=\'right\'');
$grid->build();
$ggrid = form_open('finanzas/invresu/index/search');
$ggrid .= form_hidden('fecha', $filter->fecha->newValue);
$ggrid .= $grid->output;
$ggrid .= form_close();
$script = '
<script type="text/javascript">
$(function() {
$(".inputnum").numeric(".");
$("#consulta").dialog({
autoOpen: false, height: 400, width: 600, modal: true,
buttons: {
"Salir": function() {
$("#consulta").html("");
$( this ).dialog( "close" );
}
},
close: function() {
$("#consulta").html("");
}
});
});
function foo(url){
valor=$("#porcent").val();
uurl=url+"/"+valor;' . "\n\t\t\t\$.blockUI({\n\t\t\t\tmessage: \$('#displayBox'),\n\t\t\t\tcss: {\n\t\t\t\ttop: (\$(window).height() - 400) /2 + 'px',\n\t\t\t\tleft: (\$(window).width() - 400) /2 + 'px',\n\t\t\t\twidth: '400px'\n\t\t\t\t}" . '
});
$.get(uurl, function(data) {
setTimeout($.unblockUI, 2);
alert(data);
});
return false;
}
function bobo(url){' . "\n\t\t\tif(confirm('Al generar de nuevo el libro se perderan las rebajas, esta consciente de eso?')){\n\t\t\t\t\$.blockUI({\n\t\t\t\t\tmessage: \$('#displayBox'),\n\t\t\t\t\tcss: {\n\t\t\t\t\ttop: (\$(window).height() - 400) /2 + 'px',\n\t\t\t\t\tleft: (\$(window).width() - 400) /2 + 'px',\n\t\t\t\t\twidth: '400px'\n\t\t\t\t\t}" . '
});
$.get(url, function(data) {
setTimeout($.unblockUI, 2);
alert(data);
});
}
return false;
}
function fconsulta( mes ) {
$.post("' . site_url($this->url . 'consulta/') . '"+\'/\'+mes,
function(data){
$("#consulta").html(data);
$("#consulta").dialog("open");
})
};
</script>';
$espera = "\n" . '<div id="displayBox" style="display:none" ><p>Espere.....</p><img src="' . base_url() . 'images/doggydig.gif" width="131px" height="79px" /></div>';
$espera .= "\n" . '<div id="consulta" name="consulta" title="Detalle del Mes"></div>';
$porcent = "\n<div align='center' style='font-size:16pt;'><a href='" . base_url() . "reportes/ver/INVENTA/SINV'>Emitir Listado</a></div> ";
//.........这里部分代码省略.........
示例6: gserestima
function gserestima($ordi)
{
$this->rapyd->load('datagrid', 'datafilter');
$modbus = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'Código Proveedor', 'nombre' => 'Nombre', 'rif' => 'RIF'), 'filtro' => array('proveed' => 'Código Proveedor', 'nombre' => 'Nombre'), 'retornar' => array('proveed' => 'proveed'), 'titulo' => 'Buscar Proveedor');
$boton = $this->datasis->modbus($modbus);
$filter = new DataFilter('Filtro de Egresos');
$filter->db->select(array('b.id', 'a.id AS gser_id', 'a.numero', 'a.fecha', 'a.vence', 'a.nombre', 'a.totiva', 'a.totneto', 'a.totpre', 'a.proveed'));
$filter->db->from('gser AS a');
$filter->db->join('ordiestgser AS b', 'a.id=b.id_gser AND b.id_ordi=' . $this->db->escape($ordi), 'left');
$filter->db->where("(a.ordeni IS NULL OR a.ordeni=0)");
$filter->db->where('a.tipo_doc <>', 'XX');
$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 = date('Y-m-d');
//$filter->fechah->insertValue = date('Y-m-d');
$filter->fechah->size = $filter->fechad->size = 10;
$filter->fechad->operator = '>=';
$filter->fechah->operator = '<=';
$filter->numero = new inputField('Número', 'numero');
$filter->numero->size = 20;
$filter->proveedor = new inputField('Proveedor', 'proveed');
$filter->proveedor->append($boton);
$filter->proveedor->db_name = 'proveed';
$filter->proveedor->size = 20;
$filter->monto = new inputField2('Monto ', 'totpre');
$filter->monto->clause = 'where';
$filter->monto->operator = '=';
$filter->monto->size = 20;
$filter->monto->css_class = 'inputnum';
$action = "javascript:window.location='" . site_url('import/ordi/dataedit/show/' . $ordi) . "'";
$filter->button('btn_regresa', 'Regresar', $action, 'TR');
$filter->buttons('reset', 'search');
$filter->build();
$uri = anchor('finanzas/gser/dataedit/show/<#fecha#>/<#numero#>/<#proveed#>', '<#numero#>');
$grid = new DataGrid();
$grid->order_by('numero', 'desc');
$grid->use_function('checker');
$grid->per_page = 15;
function checker($id, $gser_id, $ordi)
{
$arr = array($gser_id, $ordi);
if (empty($id)) {
$sel = false;
} else {
$sel = true;
}
return form_checkbox($gser_id, serialize($arr), $sel);
}
$grid->column_orderby('Número', 'numero', 'numero');
$grid->column_orderby('Fecha', '<dbdate_to_human><#fecha#></dbdate_to_human>', 'fecha', 'align=\'center\'');
$grid->column_orderby('Vence', '<dbdate_to_human><#vence#></dbdate_to_human>', 'vence', 'align=\'center\'');
$grid->column_orderby('Nombre', 'nombre', 'nombre');
$grid->column_orderby('Monto', '<nformat><#totpre#></nformat>', 'totpre', 'align=\'right\'');
$grid->column_orderby('Enlace', '<checker><#id#>|<#gser_id#>|' . $ordi . '</checker>', 'ordeni', 'align=\'center\'');
$grid->build();
$this->rapyd->jquery[] = '$(":checkbox:not(#ordeni)").change(function(){
name=$(this).attr("name");
$.post("' . site_url('import/ordi/agordiesti') . '",{ data: $(this).val()},
function(data){
if(data=="1"){
return true;
}else{
$("input[name=\'"+name+"\']").removeAttr("checked");
alert("Hubo un error, comuniquese con soporte tecnico: "+data);
return false;
}
});
});';
$data['content'] = $filter->output . $grid->output;
$data['head'] = $this->rapyd->get_head();
$data['title'] = heading('Conciliación de gastos nacionales');
$this->load->view('view_ventanas', $data);
}
示例7: filterscli
function filterscli()
{
$this->datasis->modulo_id(143, 1);
$vd = trim($this->secu->getvendedor());
$caub = trim($this->secu->getalmacen());
if (empty($vd) || empty($caub)) {
show_error('Usuario no tiene asignado vendedor, cajero o almacen, debe asignarlo primero para poder usar este modulo');
}
$url = $this->url . 'filteredgrid';
$this->rapyd->uri->keep_persistence();
$persistence = $this->rapyd->session->get_persistence($url, $this->rapyd->uri->gfid);
$back = isset($persistence['back_uri']) ? $persistence['back_uri'] : $url;
$vd = $this->secu->getvendedor();
$this->rapyd->load('datafilter', 'datagrid');
$filter = new DataFilter('Lista de clientes asignados al vendedor ' . $vd);
$filter->button('btn_back', RAPYD_BUTTON_BACK, "javascript:window.location='" . site_url($back) . "'", 'BL');
$dbvd = $this->db->escape($vd);
$dbfini = $this->db->escape(date('Y-m-d', mktime(0, 0, 0, date('n'), 1)));
$sel = array('a.cliente', 'a.nombre', 'a.rifci', 'COUNT(DISTINCT b.numero) AS rayado');
$filter->db->select($sel);
$filter->db->from('scli AS a');
$filter->db->join('sfac AS b', "b.cod_cli=a.cliente AND b.vd={$dbvd} AND b.fecha>={$dbfini} AND b.tipo_doc='F' AND b.entregable = 'S'", 'left');
$filter->db->join('sclitrut AS c', 'a.cliente=c.cliente', 'left');
$filter->db->join('sclirut AS d', 'c.ruta=d.ruta', 'left');
$filter->db->where("( a.vendedor = {$dbvd} OR a.cobrador={$dbvd} OR d.vende={$dbvd})");
$filter->db->where('a.tipo <>', '0');
$filter->db->groupby('a.cliente');
$filter->cliente = new inputField('Código', 'cliente');
$filter->cliente->size = 8;
$filter->cliente->db_name = 'a.cliente';
$filter->nombre = new inputField('Nombre', 'nombre');
$filter->nombre->db_name = 'a.nombre';
$filter->rifci = new inputField('CI/RIF', 'rifci');
$filter->rifci->db_name = 'a.rifci';
$filter->rifci->size = 15;
$filter->buttons('reset', 'search');
$filter->build();
if (!empty($vd)) {
$mSQL = "SELECT COUNT(DISTINCT a.cliente) AS cana\n\t\t\t\tFROM scli AS a\n\t\t\t\tLEFT JOIN sclitrut AS c ON a.cliente=c.cliente\n\t\t\t\tLEFT JOIN sclirut AS d ON c.ruta=d.ruta\n\t\t\t\tWHERE ( vendedor = {$dbvd} OR cobrador={$dbvd} OR d.vende={$dbvd}) AND a.tipo<>0";
$clientes = intval($this->datasis->dameval($mSQL));
$mSQL = "SELECT COUNT(*) AS cana\n\t\t\t\tFROM sfac\n\t\t\t\tWHERE vd = {$dbvd} AND fecha>={$dbfini} AND referen<>'P' AND tipo_doc<>'X' AND tipo_doc='F' AND entregable='S' AND MID(numero,1,1) <> '_'";
$facturas = intval($this->datasis->dameval($mSQL));
$mSQL = "SELECT COUNT(DISTINCT aa.cliente) AS cca FROM (\n\t\t\t\tSELECT a.cliente\n\t\t\t\tFROM scli AS a\n\t\t\t\tJOIN sfac AS b ON b.cod_cli=a.cliente\n\t\t\t\tLEFT JOIN sclitrut AS d ON a.cliente=d.cliente\n\t\t\t\tLEFT JOIN sclirut AS e ON d.ruta=e.ruta AND e.vende=b.vd\n\t\t\t\tWHERE b.fecha>={$dbfini} AND b.vd={$dbvd} AND (b.vd IN (a.vendedor,a.cobrador) OR e.ruta IS NOT NULL)\n\t\t\t\t\tAND b.tipo_doc='F' AND b.entregable='S' AND MID(b.numero,1,1) <> '_'\n\t\t\t\tGROUP BY a.cliente\n\t\t\t) AS aa";
$atendidos = intval($this->datasis->dameval($mSQL));
$mSQL = "SELECT SUM(c.peso*a.cana*IF(a.tipoa='F',1,-1)) AS peso\n\t\t\t\tFROM sitems AS a\n\t\t\t\tJOIN sfac AS b ON a.numa=b.numero AND a.tipoa=b.tipo_doc\n\t\t\t\tJOIN sinv AS c ON a.codigoa=c.codigo\n\t\t\t\tWHERE b.vd = {$dbvd} AND a.tipoa<>'X' AND b.fecha>={$dbfini} AND MID(b.numero,1,1) <> '_'";
$ttpeso = nformat(floatval($this->datasis->dameval($mSQL)) / 1000, 3);
$vmonto = $this->datasis->traevalor('PFACLITEMONTO', 'Muestra o no el monto que ha facturado el vendedor');
if ($vmonto == 'S') {
$mSQL = "SELECT SUM(totals*IF(tipo_doc='F',1,-1)) AS total FROM sfac WHERE vd = {$dbvd} AND fecha>={$dbfini} AND tipo_doc<>'X' AND MID(numero,1,1) <> '_'";
$monto = nformat(floatval($this->datasis->dameval($mSQL)));
$smonto = "Monto: {$monto}";
} else {
$smonto = '';
}
if ($clientes > 0) {
$efe = htmlnformat($atendidos * 100 / $clientes);
} else {
$efe = htmlnformat(0);
}
$frace = "<p style='text-align:center;font-weight: bold;'>Clientes atendidos: <span style='font-size:1.5em; color:#000063'>{$atendidos}</span>/{$clientes} Efectividad: <span style='font-size:1.5em; color:#000063'>{$efe}%</span> Facturas: {$facturas} Peso: {$ttpeso}T {$smonto}</p>";
} else {
$frace = '';
}
$uri = anchor($this->url . 'dataedit/<raencode><#cliente#></raencode>/create', '<#cliente#>');
$grid = new DataGrid('Seleccione el cliente al cual se le va a realizar el pedido');
$grid->use_function('htmlspecialchars');
$grid->table_id = 'sclilist';
$grid->order_by('nombre', 'asc');
$grid->per_page = 20;
$grid->column_orderby('#Fact.', 'rayado', 'rayado', 'align=\'right\'');
$grid->column_orderby('Cliente', $uri, 'cliente');
$grid->column_orderby('Nombre', '<htmlspecialchars><#nombre#>|2|ISO-8859-1</htmlspecialchars>', 'nombre');
$grid->column_orderby('RIF/CI', 'rifci');
$grid->build();
$data['script'] = '<style type="text/css">#sclilist tr:hover { background-color: #ffff99; }</style>';
$data['content'] = $filter->output . $frace . $grid->output;
$data['title'] = heading('Clientes');
$data['head'] = $this->rapyd->get_head();
$data['extras'] = '';
$this->load->view('view_ventanas', $data);
}
示例8: datafilter
function datafilter()
{
$this->rapyd->load('datagrid', 'datafilter');
$this->rapyd->uri->keep_persistence();
$content_id = md5(uniqid(time()));
$ttabla = 'fsisu_' . $content_id;
$columnas = array('b.codigo AS codigoa', 'd.barras', 'b.descrip AS desca', 'b.existen', 'b.exmin', 'b.exmax', 'SUM(c.cana*(IF(c.tipoa=\'F\',1,-1))) AS trimestral', 'b.exmax-IF(existen<0,0,b.existen) AS pedir');
$filter = new DataFilter('Fallas de productos vendidos en el día');
$filter->db->select($columnas);
$filter->db->from('sinv AS b');
$filter->db->join('sitems AS c', 'b.codigo=c.codigoa AND c.tipoa="F" AND c.fecha >= DATE_ADD(CURDATE(), INTERVAL -90 DAY)', 'left');
$filter->db->join($ttabla . ' AS d', 'b.codigo=d.abarras');
$filter->db->where('b.existen <= b.exmin');
$filter->db->groupby('b.codigo');
$filter->db->having('pedir > 0');
$filter->fecha = new dateonlyField('Fecha', 'fecha');
$filter->fecha->clause = '';
$filter->fecha->db_name = 'a.fecha';
$filter->fecha->size = 12;
$filter->fecha->operator = '=';
$filter->fecha->rule = 'required';
$filter->fecha->insertValue = date('Y-m-d');
$action = "javascript:window.location='" . site_url($this->url . 'especialxls') . "'";
$filter->button('btn_especial', 'Pedido Especial', $action, 'BR', 'show');
$filter->buttons('reset', 'search');
//$filter->submit('btn_cambio_2', 'Mandar pedido FarmaSIS', 'BR');
$filter->build();
function descheck($numero, $pedir)
{
$data = array('name' => 'apedir[]', 'id' => $numero, 'value' => $numero . '#' . $pedir, 'checked' => true);
return form_checkbox($data);
}
function pinta($cana)
{
$ncana = nformat($cana);
return $cana < 0 ? "<b style='color:red'>{$ncana}</b>" : $ncana;
}
function divi($dividendo, $divisor)
{
if ($divisor > 0) {
return ceil($dividendo / $divisor);
} else {
return 0;
}
}
$seltod = 'Seleccionar <a id="todos" href=# >Todos</a> <a id="nada" href=# >Ninguno</a> <a id="alter" href=# >Invertir</a>';
$bfecha = $filter->fecha->newValue;
if (!empty($bfecha)) {
$dbbfecha = $this->db->escape($bfecha);
} else {
$dbbfecha = 'CURDATE()';
}
$mSQL = "CREATE TEMPORARY TABLE {$ttabla} (abarras VARCHAR(15) NOT NULL, PRIMARY KEY (abarras))\n\t\tSELECT a.barras,a.abarras\n\t\tFROM farmaxasig AS a\n\t\tJOIN sitems AS b ON a.abarras=b.codigoa\n\t\tWHERE b.fecha={$dbbfecha}\n\t\tGROUP BY abarras";
$this->db->simple_query($mSQL);
$grid = new DataGrid($seltod);
$grid->use_function('descheck', 'pinta', 'divi');
$grid->order_by('desca', 'asc');
$grid->per_page = 400;
$grid->column('Pedir', '<descheck><#barras#>|<#pedir#></descheck>');
$grid->column('Código', '<span title="<#barras#>"><#codigoa#></span');
$grid->column_orderby('Descripción', 'desca', 'desca');
$grid->column('Trim.', '<nformat><#trimestral#>|0</nformat>', 'align=\'right\'');
$grid->column('Mens.', '<nformat><divi><#trimestral#>|3</divi>|0</nformat>', 'align=\'right\'');
$grid->column('Quin.', '<nformat><divi><#trimestral#>|6</divi>|0</nformat>', 'align=\'right\'');
$grid->column('Sema.', '<b><nformat><divi><#trimestral#>|12</divi>|0</nformat></b>', 'align=\'right\'');
$grid->column('Actual', '<pinta><#existen#>|0</pinta>', 'align=\'right\'');
$grid->column('Min-Max', '<nformat><#exmin#>|0</nformat>-<nformat><#exmax#>|0</nformat>', 'align=\'center\'');
$grid->column('<b>Sugerido</b>', '<b style="color:green"><nformat><#pedir#>|0</nformat></b>', 'align=\'right\'');
$grid->build();
//$grid->column('Rango' ,'[<nformat><#exmin#></nformat>-<nformat><#exmax#></nformat>]' ,'align=\'center\'');
if ($grid->recordCount > 0) {
$tabla = $grid->output . form_submit('mysubmit', 'Mandar pedido a FarmaSIS');
//echo $grid->db->last_query();
} else {
$tabla = '';
}
$script = '<script type="text/javascript">
$(document).ready(function() {
$("#todos").click(function() { $("#apedir").checkCheckboxes(); });
$("#nada").click(function() { $("#apedir").unCheckCheckboxes(); });
$("#alter").click(function() { $("#apedir").toggleCheckboxes(); });
$(\'input[name="btn_cambio_2"]\').click(function() {
var md = document.getElementById("apedir");
md.submit();
});
});</script>';
$data['content'] = $filter->output;
$data['content'] .= form_open('farmacia/pedidos/guardapedido', array('id' => 'apedir')) . $tabla . form_close();
$data['script'] = $script;
$data['head'] = script('jquery-1.2.6.pack.js');
$data['head'] .= script('plugins/jquery.checkboxes.pack.js');
$data['head'] .= $this->rapyd->get_head();
$data['title'] = heading('Compras a droguerias');
$this->load->view('view_ventanas', $data);
}