本文整理汇总了PHP中DataForm::is_valid方法的典型用法代码示例。如果您正苦于以下问题:PHP DataForm::is_valid方法的具体用法?PHP DataForm::is_valid怎么用?PHP DataForm::is_valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataForm
的用法示例。
在下文中一共展示了DataForm::is_valid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: despacha
function despacha()
{
//filteredgrid//
$this->rapyd->load("datafilter", "datagrid");
//filter search/osp
$filter = new DataForm("ventas/terminal/despacha/search");
$filter->numero = new inputField("Numero", "numero");
$filter->numero->rule = "required";
$filter->numero->size = 15;
//$filter->buttons("search");
$filter->build_form();
$sal = $filter->output;
//_0040024
if ($this->rapyd->uri->is_set("search") and $filter->is_valid()) {
$numero = $_POST['numero'];
$mSQL = "SELECT DATE_FORMAT(fecha,'%d/%m/%Y') fecha, cod_cli,nombre, totalg FROM sfac WHERE numero='{$numero}'";
$query = $this->db->query($mSQL);
if ($query->num_rows() > 0) {
$this->_procesar($numero);
$row = $query->row_array();
$sal .= '<center><table id="tabledespa">';
$sal .= '<tr><td>Número</td><td align="right">' . $numero . '</td></tr>';
$sal .= '<tr><td>Fecha </td><td align="right">' . $row['fecha'] . '</td></tr>';
$sal .= '<tr><td>Cliente </td><td align="right">' . '(' . $row['cod_cli'] . ') ' . $row['nombre'] . '</td></tr>';
$sal .= '<tr><td>Monto </td><td align="right">' . number_format($row['totalg'], 2, ',', '.') . '</td></tr></table></center>';
} else {
$sal .= 'Número de Factura no valido';
}
//$sal .= 'Pase Por aqui'.$mSQL;
//grid
/*
$grid = new DataGrid('');
$grid->order_by("numero","desc");
$grid->per_page = 10;
$grid->use_function("substr");
$grid->column("Numero","numero");
$grid->column("fecha","fecha");
$grid->column("Nombre","nombre");
$grid->column("total","<number_format><#totalg#>|2|,|.</number_format>","align=right");
$grid->build();
$sal .= $grid->output;*/
}
$content["body"] = $sal;
$content["titu"] = 'Despacho por terminal';
$content["rapyd_head"] = $this->rapyd->get_head();
$this->load->view('view_terminal', $content);
}
示例2: array
function is_valid()
{
$result = parent::is_valid();
if (!$this->check_pk) {
return $result;
}
if ($this->_action == "update" || $this->_action == "insert") {
$pk_check = array();
$pk_error = "";
$hiddens = array();
//pk fields mode can setted to "autohide" or "readonly" (so pk integrity violation check isn't needed)
foreach ($this->_fields as $field_name => $field_copy) {
//reference
$field =& $this->{$field_name};
$field->_getValue();
if (!$field->apply_rules) {
$hiddens[$field->db_name] = $field->value;
}
}
//We build a pk array from the form value that is submit if its a writing action (update & insert)
foreach ($this->_dataobject->pk as $keyfield => $keyvalue) {
if (isset($this->validation->{$keyfield})) {
$pk_check[$keyfield] = $this->validation->{$keyfield};
// detect that a pk is hidden, so no integrity check needed
} elseif (array_key_exists($keyfield, $hiddens)) {
$pk_check[$keyfield] = $hiddens[$keyfield];
}
}
if (sizeof($pk_check) != $this->_pkey) {
//If PK is Autoincrement we don't need to check PK integrity, But its supose that for a none AutoIcrement PK the form always contain the right PK fields
if (sizeof($this->_dataobject->pk) == 1 && sizeof($pk_check) == 0) {
return $result;
}
}
// this check the unicity of PK with the new DO function
$pk_check_unique = array();
foreach ($pk_check as $keyfield => $keyvalue) {
if (!array_key_exists($keyfield, $hiddens)) {
$pk_check_unique[$keyfield] = $keyvalue;
}
}
if (count($pk_check_unique) > 0) {
if ($result && !$this->_dataobject->are_unique($pk_check_unique)) {
$result = false;
$pk_error .= RAPYD_MSG_0210 . "<br />";
}
}
}
$this->error_string = $pk_error . $this->error_string;
return $result;
}
示例3: compara
function compara()
{
$this->rapyd->load("datafilter", "datagrid");
$this->db->_escape_char = '';
$this->db->_protect_identifiers = false;
function colum($diferen)
{
if ($diferen < 0) {
return '<b style="color:red;">' . $diferen . '</b>';
} else {
return '<b style="color:green;">' . $diferen . '</b>';
}
}
function dif($a, $b)
{
return number_format($a - $b, 2, ',', '.');
}
$modbus = array('tabla' => 'vend', 'columnas' => array('vendedor' => 'Código Vendedor', 'nombre' => 'Nombre'), 'filtro' => array('vendedor' => 'Código Vendedor', 'nombre' => 'Nombre'), 'retornar' => array('vendedor' => 'vendedor'), 'titulo' => 'Buscar Vendedor');
$boton = $this->datasis->modbus($modbus);
$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('Filtro');
$filter->attributes = array('onsubmit' => 'is_loaded()');
$filter->fecha = new dateonlyField("Fecha", "d.fecha", 'm/Y');
$filter->fecha->clause = 'where';
$filter->fecha->insertValue = date("mY");
$filter->fecha->operator = "=";
$filter->fecha->dbformat = 'Ym';
$filter->fecha->size = 7;
$filter->fecha->append('mes/año');
$filter->fecha->rule = "required";
$filter->public = new checkboxField("Agrupado por Vendedor", "public", "1", "0");
$filter->vendedor = new inputField("Vendedor", "vendedor");
$filter->vendedor->size = 10;
$filter->vendedor->maxlength = 10;
$filter->vendedor->append($boton);
$filter->submit("btnsubmit", "Descargar");
$filter->build_form();
if ($this->rapyd->uri->is_set("search") and $filter->is_valid()) {
$fecha = $filter->fecha->newValue;
$vendedor = $filter->vendedor->newValue;
$agrupar = $filter->public->newValue;
//ECHO 'AQUIII: '.$agrupar;
$fechai = $fecha . '01';
$fechaf = $fecha . '31';
$mSQL = "(SELECT\n\t\t\td.cantidad as metasv, b.clave, c.vd as vendedor, e.nombre as nombrev, \n\t\t\tSUM(a.cana*b.peso*(d.tipo='P'))+ a.cana*(d.tipo='C')+ a.cana*(d.tipo='P')* (b.peso=0 OR b.peso IS NULL) AS ventas \n\t\t\tFROM (sitems AS a) JOIN sinv AS b ON a.codigoa=b.codigo \n\t\t\tJOIN sfac AS c ON a.tipoa=c.tipo_doc AND a.numa=c.numero \n\t\t\tJOIN metas AS d ON b.clave=d.codigo AND d.fecha='201004' \n\t\t\tAND c.vd=d.vendedor JOIN vend AS e ON d.vendedor=e.vendedor \n\t\t\tWHERE a.fecha >= '20100401' AND a.fecha <= '20100431' \n\t\t\tGROUP BY b.clave,c.vd) as h";
$grid = new DataGrid("Resultados");
$grid->use_function('colum');
$select = array("h.clave as codigo", "sum(h.metasv)as metas", "sum(h.ventas)as ventas", "sum(h.ventas)-sum(h.metasv)as diferen", "h.vendedor", "h.nombrev");
$grid->db->select($select);
$grid->db->from("{$mSQL}");
if (!empty($vendedor)) {
$grid->db->where("h.vendedor", $vendedor);
} else {
$grid->db->orderby("h.vendedor");
}
if ($agrupar == '0') {
$grid->db->groupby("h.clave");
} else {
$grid->db->groupby("h.clave,h.vendedor");
}
if ($agrupar == '0') {
$grid->column("Codigo", "codigo");
$grid->column("Venta", "<nformat><#ventas#></nformat>", "align='right'");
$grid->column("Metas", "<#metas#>", "align='right'");
$grid->column("Diferencia", "<colum><nformat><#diferen#></nformat></colum>", "align='right'");
} else {
$grid->column("Codigo", "codigo");
$grid->column("Vendedor", "<#vendedor#>", "align='center'");
$grid->column("Nombre", "<#nombrev#>", "align='left'");
$grid->column("Venta", "<nformat><#ventas#></nformat>", "align='right'");
$grid->column("Metas", "<nformat><#metas#></nformat>", "align='right'");
$grid->column("Diferencia", "<colum><nformat><#diferen#></nformat></colum>", "align='right'");
}
$grid->build();
$tabla = $grid->output;
//echo $grid->db->last_query();
} else {
$tabla = '';
}
$data['content'] = $filter->output . $tabla;
$data['title'] = "<h1>Estado de Metas</h1>";
$data["head"] = $this->rapyd->get_head();
$this->load->view('view_ventanas', $data);
}
示例4: compara
function compara()
{
$this->load->helper('fecha');
$this->rapyd->load('datafilter', 'datagrid');
$this->db->_escape_char = '';
$this->db->_protect_identifiers = false;
function colum($diferen)
{
if ($diferen < 0) {
return '<b style="color:red;">' . $diferen . '</b>';
} else {
return '<b style="color:green;">' . $diferen . '</b>';
}
}
function dif($a, $b)
{
return nformat($a - $b);
}
function formfecha($mes)
{
$anio = substr($mes, 0, 4);
$nom = mesLetra(substr($mes, 4));
return "{$nom}-{$anio}";
}
$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('Filtro');
//$filter->attributes=array('onsubmit'=>'is_loaded()');
$filter->fecha = new dateonlyField('Fecha', 'd.fecha', 'm/Y');
$filter->fecha->clause = 'where';
$filter->fecha->insertValue = date('mY');
$filter->fecha->operator = '=';
$filter->fecha->dbformat = 'Ym';
$filter->fecha->size = 7;
$filter->fecha->append('mes/año');
$filter->fecha->rule = 'required';
$filter->vendedor = new dropdownField('Vendedor', 'vendedor');
$filter->vendedor->option('', 'Todos');
$filter->vendedor->options("SELECT vendedor, CONCAT(vendedor,'-',nombre) AS nom FROM vend WHERE tipo IN ('V','A') ORDER BY vendedor");
$accion = "javascript:window.location='" . site_url('ventas/metas/filteredgrid') . "'";
$filter->button('btn_pfl', 'Regresar', $accion, 'TR');
$filter->submit('btnsubmit', 'Buscar');
$filter->build_form();
if ($this->rapyd->uri->is_set('search') and $filter->is_valid()) {
$fecha = $filter->fecha->newValue;
$vendedor = $filter->vendedor->newValue;
$udia = days_in_month(substr($fecha, 4), substr($fecha, 0, 4));
$fechai = $fecha . '01';
$fechaf = $fecha . $udia;
$grid = new DataGrid('Resultados');
$grid->use_function('colum', 'dif', 'formfecha');
$sel = array('a.codigo', 'a.descrip', 'SUM(d.cana*IF(tipoa=\'D\',-1,1)) AS ventas');
if (!empty($vendedor)) {
$dbvd = $this->db->escape($vendedor);
$sel[] = $dbvd . ' AS vendedor';
$sel[] = $this->db->escape($filter->vendedor->options[$vendedor]) . ' AS nombrev';
$sel[] = 'c.cantidad AS meta';
$pmargen = $this->datasis->dameval('SELECT pmargen FROM vend WHERE vendedor=' . $dbvd);
if (empty($pmargen)) {
$pmargen = 0;
} else {
$pmargen = $pmargen / 100;
}
$sel[] = 'c.cantidad*' . $pmargen . ' AS meta';
$ww = ' AND d.vendedor=' . $dbvd;
} else {
$sel[] = 'c.cantidad AS meta';
$ww = '';
}
$grid->db->from('sinv AS a');
$grid->db->join('metas AS c', 'a.codigo=c.codigo AND c.fecha=' . $fecha);
$grid->db->join('sitems AS d', "d.codigoa=c.codigo AND d.fecha BETWEEN {$fechai} AND {$fechaf} {$ww}", 'left');
$grid->db->join('vend AS e', 'd.vendedor=e.vendedor', 'left');
$grid->db->group_by('a.codigo');
$grid->db->select($sel);
$grid->column('Código', 'codigo');
$grid->column('Descripción', 'descrip');
if (!empty($vendedor)) {
$grid->column('Vendedor', 'vendedor', "align='center'");
$grid->column('Nombre', 'nombrev', "align='left'");
}
$grid->column('Venta', '<nformat><#ventas#></nformat>', "align='right'");
$grid->column('Meta', '<nformat><#meta#></nformat>', "align='right'");
$grid->column('Diferencia', '<colum><dif><#ventas#>|<#meta#></dif></colum>', "align='right'");
$grid->build();
$tabla = $grid->output;
//echo $grid->db->last_query();
} else {
$tabla = '';
}
$data['content'] = $filter->output . $tabla;
$data['title'] = heading('Estado de Metas');
$data['head'] = $this->rapyd->get_head();
$this->load->view('view_ventanas', $data);
}