function dataedit() { $this->datasis->modulo_id(71, 1); $this->rapyd->load('dataobject', 'datadetails'); $this->rapyd->uri->keep_persistence(); $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'Cóodigo', 'rif' => 'RIF', 'nombre' => 'Nombre', 'grupo' => 'Grupo', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'Código', 'nombre' => 'Nombre', 'rif' => 'RIF', 'grupo' => 'Grupo'), 'retornar' => array('proveed' => 'cod_prov', 'nombre' => 'nombrep', 'reteiva' => 'reteiva_prov'), 'titulo' => 'Buscar Beneficiario'); $bSPRV = $this->datasis->modbus($mSPRV, "sprv"); $do = new DataObject("ocompra"); $do->rel_one_to_many('itocompra', 'itocompra', array('numero' => 'numero')); $do->pointer('sprv', 'sprv.proveed = ocompra.cod_prov', 'sprv.nombre as nombrep', 'LEFT'); $edit = new DataDetails("Orden ", $do); $edit->set_rel_title('itocompra', 'Rubro <#o#>'); $edit->back_url = "presupuesto/causacion/filteredgrid"; $status = $edit->get_from_dataobjetct('status'); $ivaplica = $this->ivaplica2(); $edit->pre_process('insert', '_valida'); $edit->pre_process('update', '_valida'); $edit->post_process('insert', '_post_insert'); $edit->post_process('update', '_post_update'); $edit->post_process('delete', '_post_delete'); $edit->numero = new inputField("Número", "numero"); $edit->numero->mode = "autohide"; $edit->numero->when = array('show'); $edit->status = new inputField("Estado", "status"); $edit->status->mode = "autohide"; $edit->status->when = array(''); $edit->factura = new inputField("Factura", "factura"); $edit->factura->size = 15; //$edit->factura->rule="required"; //if($status=='O') //$edit->factura->mode="autohide"; if ($this->datasis->traevalor("USACERTIFICADO") == 'S') { $edit->certificado = new inputField("Cert. Disp. Presupuestaria", "certificado"); $edit->certificado->size = 15; if ($status == 'O') { $edit->certificado->mode = "autohide"; } } if ($this->datasis->traevalor("USACOMPROMISO") == 'S') { $edit->compromiso = new inputField("Nro Compromiso", "compromiso"); $edit->compromiso->size = 15; if ($status == 'O') { $edit->compromiso->mode = "autohide"; } } $edit->controlfac = new inputField("Control Fiscal", "controlfac"); $edit->controlfac->size = 15; //$edit->controlfac->rule="required"; //if($status=='O') //$edit->controlfac->mode="autohide"; $edit->fechafac = new dateonlyField("Fecha de Factura", "fechafac"); $edit->fechafac->insertValue = date('Y-m-d'); $edit->fechafac->size = 12; //$edit->fechafac->rule="required"; //if($status=='O') //$edit->fechafac->mode="autohide"; $tipo = $edit->get_from_dataobjetct('tipo'); $edit->cod_prov = new inputField("Beneficiario", 'cod_prov'); $edit->cod_prov->size = 6; $edit->cod_prov->append($bSPRV); if ($tipo != 'Compromiso') { $edit->cod_prov->mode = "autohide"; } $edit->creten = new dropdownField("Cod ISLR: ", "creten"); //$edit->creten->mode = "autohide"; //$edit->creten->option("",""); $edit->creten->options("SELECT codigo,CONCAT_WS(' ',codigo,activida) FROM rete ORDER BY codigo"); $edit->creten->style = "width:350px;"; $edit->creten->onchange = 'cal_islr();'; $edit->reteiva_prov = new dropdownField("Retención de IVA %", "reteiva_prov"); $edit->reteiva_prov->option("100", "100%"); $edit->reteiva_prov->option("75", "75%"); $edit->reteiva_prov->style = "width:70px;"; $edit->reteiva_prov->onchange = 'cal_total();'; $edit->nombrep = new inputField("Nombre", "nombrep"); $edit->nombrep->size = 60; $edit->nombrep->readonly = true; $edit->nombrep->pointer = true; if ($tipo != 'Compromiso') { $edit->nombrep->mode = "autohide"; } $edit->fecha = new dateonlyField("Fecha O. Compra", 'fecha'); $edit->fecha->size = 6; $edit->fecha->mode = "autohide"; $edit->subtotal = new inputField("Sub Total", 'subtotal'); $edit->subtotal->size = 12; $edit->subtotal->readonly = true; $edit->ivaa = new inputField("IVA " . $ivaplica['sobretasa'] . "%", 'ivaa'); $edit->ivaa->size = 12; $edit->ivaa->css_class = 'inputnum'; $edit->ivaa->rule = 'numeric'; $edit->ivaa->onchange = 'cal_total();'; $edit->ivag = new inputField("IVA " . $ivaplica['tasa'] . "%", 'ivag'); $edit->ivag->size = 12; $edit->ivag->css_class = 'inputnum'; $edit->ivag->rule = 'numeric'; $edit->ivag->onchange = 'cal_total();'; $edit->ivar = new inputField("IVA " . $ivaplica['redutasa'] . "%", 'ivar'); $edit->ivar->size = 12; $edit->ivar->css_class = 'inputnum'; $edit->ivar->rule = 'numeric'; $edit->ivar->onchange = 'cal_total();'; $edit->mivaa = new inputField("Base " . $ivaplica['sobretasa'] . "%: ", 'mivaa'); $edit->mivaa->size = 12; $edit->mivaa->css_class = 'inputnum'; $edit->mivaa->rule = 'numeric'; $edit->mivaa->onchange = 'cal_mivaa();'; $edit->mivag = new inputField("Base " . $ivaplica['tasa'] . "%: ", 'mivag'); $edit->mivag->size = 12; $edit->mivag->css_class = 'inputnum'; $edit->mivag->rule = 'numeric'; $edit->mivag->onchange = 'cal_mivag();'; $edit->mivar = new inputField("Base " . $ivaplica['redutasa'] . "%: ", 'mivar'); $edit->mivar->size = 12; $edit->mivar->css_class = 'inputnum'; $edit->mivar->rule = 'numeric'; $edit->mivar->onchange = 'cal_mivar();'; $edit->mexento = new inputField("Exento a Retener: ", 'mexento'); $edit->mexento->size = 12; $edit->mexento->css_class = 'inputnum'; $edit->mexento->rule = 'numeric'; $edit->mexento->onchange = 'cal_total();'; $edit->exento = new inputField("Exento", 'exento'); $edit->exento->size = 12; $edit->exento->css_class = 'inputnum'; $edit->exento->rule = 'numeric'; $edit->exento->onchange = 'cal_total();'; //if($tipo!='Compromiso') //$edit->exento->readonly =true; $edit->reteiva = new inputField("Retencion de IVA", 'reteiva'); $edit->reteiva->size = 12; //$edit->reteiva->readonly = true; //$edit->reteiva->mode ="autohide"; $edit->reteiva->css_class = 'inputnum'; $edit->reteiva->rule = 'numeric'; $edit->reteiva->onchange = 'cal_total();'; $edit->reten = new inputField("Retencion de ISLR", 'reten'); $edit->reten->size = 12; //$edit->reten->readonly = true; //$edit->reten->mode ="autohide"; $edit->reten->css_class = 'inputnum'; $edit->reten->rule = 'numeric'; $edit->reten->onchange = 'cal_total();'; $edit->total = new inputField("Total a Pagar", 'total'); $edit->total->size = 12; $edit->total->readonly = true; $edit->total2 = new inputField("Total", 'total2'); $edit->total2->size = 12; $edit->total2->readonly = true; $edit->otrasrete = new inputField("Otras Retenciones", 'otrasrete'); $edit->otrasrete->size = 12; $edit->otrasrete->onchange = 'cal_total();'; $edit->simptimbre = new checkboxField("1X1000", "simptimbre", "S", "N"); $edit->simptimbre->insertValue = "N"; $edit->simptimbre->onchange = 'cal_timbre();'; $edit->imptimbre = new inputField("Impuesto 1X1000", 'imptimbre'); $edit->imptimbre->size = 12; $edit->imptimbre->css_class = 'inputnum'; $edit->imptimbre->onchange = 'cal_total();'; //$edit->imptimbre->readonly = true; $edit->itesiva = new inputField("P.IVA", "itesiva_<#i#>"); $edit->itesiva->rule = 'required'; $edit->itesiva->db_name = 'esiva'; $edit->itesiva->rel_id = 'itocompra'; $edit->itesiva->readonly = true; $edit->itesiva->size = 3; //detalle $edit->itfondo = new inputField("F. Financiamiento", "itfondo_<#i#>"); $edit->itfondo->size = 10; $edit->itfondo->rule = 'required'; $edit->itfondo->db_name = 'fondo'; $edit->itfondo->rel_id = 'itocompra'; $edit->itfondo->readonly = true; $edit->itcodigoadm = new inputField("Estructura\tAdministrativa", "itcodigoadm_<#i#>"); $edit->itcodigoadm->size = 10; $edit->itcodigoadm->db_name = 'codigoadm'; $edit->itcodigoadm->rel_id = 'itocompra'; $edit->itcodigoadm->rule = 'required'; $edit->itcodigoadm->readonly = true; $edit->itpartida = new inputField("(<#o#>) Partida", "partida_<#i#>"); $edit->itpartida->size = 12; $edit->itpartida->db_name = 'partida'; $edit->itpartida->rel_id = 'itocompra'; $edit->itpartida->readonly = true; $edit->itordinal = new inputField("(<#o#>) Ordinal", "ordinal_<#i#>"); $edit->itordinal->db_name = 'ordinal'; $edit->itordinal->maxlength = 3; $edit->itordinal->size = 2; $edit->itordinal->rel_id = 'itocompra'; $edit->itordinal->readonly = true; $edit->itdescripcion = new inputField("(<#o#>) Descripción", "descripcion_<#i#>"); $edit->itdescripcion->db_name = 'descripcion'; $edit->itdescripcion->size = 20; $edit->itdescripcion->rel_id = 'itocompra'; //$edit->itdescripcion->mode ='autohide'; $edit->itdescripcion->readonly = true; $edit->itunidad = new hiddenField("(<#o#>) Unidad", "unidad_<#i#>"); $edit->itunidad->db_name = 'unidad'; $edit->itunidad->rel_id = 'itocompra'; //$edit->itunidad->mode ='autohide'; $edit->itunidad->size = 10; $edit->itunidad->readonly = true; $edit->itcantidad = new hiddenField("(<#o#>) Cantidad", "cantidad_<#i#>"); $edit->itcantidad->db_name = 'cantidad'; $edit->itcantidad->rel_id = 'itocompra'; $edit->itcantidad->size = 4; //$edit->itcantidad->mode ='autohide'; $edit->itcantidad->readonly = true; $edit->itprecio = new hiddenField("(<#o#>) Precio", "precio_<#i#>"); $edit->itprecio->db_name = 'precio'; $edit->itprecio->rel_id = 'itocompra'; $edit->itprecio->size = 8; //$edit->itprecio->mode ='autohide'; $edit->itprecio->readonly = true; $edit->itusaislr = new dropdownField("(<#o#>) Islr", "usaislr_<#i#>"); $edit->itusaislr->db_name = 'usaislr'; $edit->itusaislr->rel_id = 'itocompra'; $edit->itusaislr->insertValue = "N"; $edit->itusaislr->onchange = 'cal_islr();'; $edit->itusaislr->option("N", "No"); $edit->itusaislr->option("S", "Si"); $edit->itusaislr->style = "width:45px"; $edit->itislr = new inputField("(<#o#>) Islr", "islr_<#i#>"); $edit->itislr->css_class = 'inputnum'; $edit->itislr->db_name = 'islr'; $edit->itislr->rel_id = 'itocompra'; $edit->itislr->rule = 'numeric'; $edit->itislr->readonly = true; $edit->itislr->size = 5; $edit->itiva = new inputField("(<#o#>) IVA", "iva_<#i#>"); $edit->itiva->db_name = 'iva'; $edit->itiva->rel_id = 'itocompra'; $edit->itiva->size = 8; //$edit->itiva->mode ='autohide'; $edit->itiva->readonly = true; $edit->itimporte = new inputField("(<#o#>) Importe", "importe_<#i#>"); $edit->itimporte->db_name = 'importe'; $edit->itimporte->rel_id = 'itocompra'; $edit->itimporte->size = 12; //$edit->itimporte->mode ='autohide'; $edit->itimporte->readonly = true; //$status=$edit->get_from_dataobject('status'); $status = $edit->getval('status'); if ($status == 'C') { if ($edit->_status != 'modify') { $action = "javascript:window.location='" . site_url('presupuesto/causacion/actualizar/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_status", 'Causar', $action, "TR", "show"); } $edit->buttons("modify", "save"); } elseif ($status == 'T') { if ($this->datasis->puede(361)) { $action = "javascript:window.location='" . site_url('presupuesto/causacion/reversar/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_rever", 'Anular Solo Causado', $action, "TR", "show"); } $action = "javascript:btn_anulaf('" . $edit->rapyd->uri->get_edited_id() . "')"; if ($this->datasis->puede(226)) { $edit->button_status("btn_anular", 'Anular', $action, "TR", "show"); } } elseif ($status == 'O') { $edit->buttons("modify"); $action = "javascript:window.location='" . site_url($this->url . 'camfac/dataedit/modify/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_camfac", 'Modificar Factura', $action, "TR", "show"); } elseif ($status == 'E') { //$edit->buttons("save"); $action = "javascript:window.location='" . site_url($this->url . 'camfac/dataedit/modify/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_camfac", 'Modificar Factura', $action, "TR", "show"); } $edit->buttons("save", "undo", "back"); $edit->build(); //$smenu['link']=barra_menu('103'); //$data['smenu'] = $this->load->view('view_sub_menu', $smenu,true); $query = $this->db->query('SELECT codigo,base1,tari1,pama1,tipo FROM rete'); $rt = array(); foreach ($query->result_array() as $row) { $pivot = array('base1' => $row['base1'], 'tari1' => $row['tari1'], 'pama1' => $row['pama1'], 'tipo' => $row['tipo']); $rt['_' . $row['codigo']] = $pivot; } $rete = json_encode($rt); if ($status == 'O' and $this->datasis->puede(257) || $this->datasis->essuper()) { $titulo = "Modificar Retenciones de ordenes por Pagar"; } else { $titulo = "Causar"; } $conten['rete'] = $rete; $conten['ivar'] = $ivaplica['redutasa']; $conten['ivag'] = $ivaplica['tasa']; $conten['ivaa'] = $ivaplica['sobretasa']; $conten['imptimbre'] = $this->datasis->traevalor('IMPTIMBRE'); $conten["form"] =& $edit; $data['content'] = $this->load->view('view_causacion', $conten, true); $data["head"] = script('jquery.pack.js') . script('plugins/jquery.numeric.pack.js') . script('plugins/jquery.floatnumber.js') . script('plugins/jquery.autocomplete.js') . style('jquery.autocomplete.css') . $this->rapyd->get_head(); $data['title'] = $titulo; $this->load->view('view_ventanas', $data); }
function dataedit() { //$this->datasis->modulo_id(101,1); $this->rapyd->load('dataobject', 'datadetails'); $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'Cóodigo', 'nombre' => 'Nombre', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'Código', 'nombre' => 'Nombre'), 'retornar' => array('proveed' => 'cod_prov', 'nombre' => 'nombre', 'reteiva' => 'reteiva_prov'), 'titulo' => 'Buscar Beneficiario'); $bSPRV = $this->datasis->p_modbus($mSPRV, "proveed"); $modbus = array('tabla' => 'ppla', 'columnas' => array('codigo' => 'Código', 'denominacion' => 'Denominación'), 'filtro' => array('codigo' => 'Código', 'denominacion' => 'Denominación'), 'retornar' => array('codigo' => 'partida_<#i#>'), 'p_uri' => array(4 => '<#i#>', 5 => '<#fondo#>', 6 => '<#estadmin#>'), 'where' => 'tipo=<#fondo#> AND codigoadm=<#estadmin#> AND LENGTH(ppla.codigo)=' . $this->flongpres, 'join' => array('presupuesto', 'presupuesto.codigopres=ppla.codigo', ''), 'titulo' => 'Busqueda de partidas'); $btn = $this->datasis->p_modbus($modbus, '<#i#>/<#fondo#>/<#estadmin#>'); $mMOVI = array('tabla' => 'movi', 'columnas' => array('numero' => 'Nu´mero', 'codbanc' => 'Banco', 'monto' => 'Monto', 'saldo' => 'Demostrado'), 'filtro' => array('numero' => 'Nu´mero', 'cod_banc' => 'Banco'), 'retornar' => array('numero' => 'movi'), 'titulo' => 'Buscar Anticipo'); $pMOVI = $this->datasis->p_modbus($mMOVI, 'movi'); $do = new DataObject("odirect"); $do->rel_one_to_many('itodirect', 'itodirect', array('numero' => 'numero')); $edit = new DataDetails($this->t**s, $do); $edit->back_url = site_url($this->url . "/filteredgrid"); $edit->set_rel_title('itodirect', 'Rubro <#o#>'); $edit->pre_process('insert', '_valida'); $edit->pre_process('update', '_valida'); //$edit->post_process('insert' ,'_paiva'); //$edit->post_process('update' ,'_paiva'); $edit->numero = new inputField("Número", "numero"); $edit->numero->mode = "autohide"; $edit->numero->when = array('show'); $edit->movi = new inputField("Anticipo", "movi"); $edit->movi->size = 10; $edit->movi->rule = "required"; $edit->movi->append($pMOVI); $edit->tipo = new dropdownField("Orden de ", "tipo"); $edit->tipo->option("Compra", "Compra"); $edit->tipo->option("Servicio", "Servicio"); $edit->tipo->style = "width:100px;"; $edit->fecha = new dateonlyField("Fecha", "fecha"); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->size = 12; $edit->factura = new inputField("Factura", "factura"); $edit->factura->size = 15; $edit->factura->rule = "required"; $edit->controlfac = new inputField("Control Factura", "controlfac"); $edit->controlfac->size = 15; $edit->controlfac->rule = "required"; $edit->uejecutora = new dropdownField("Unidad Ejecutora", "uejecutora"); $edit->uejecutora->option("", "Seccionar"); $edit->uejecutora->options("SELECT codigo, nombre FROM uejecutora ORDER BY nombre"); //$edit->uejecutora->onchange = "get_uadmin();"; $edit->uejecutora->rule = "required"; $edit->estadmin = new dropdownField("Estructura Administrativa", "estadmin"); $edit->estadmin->option("", "Seleccione"); $edit->estadmin->rule = 'required'; $edit->estadmin->options("SELECT b.codigo, CONCAT_WS(' ',b.codigo,b.denominacion) AS val FROM presupuesto AS a JOIN estruadm AS b ON a.codigoadm=b.codigo GROUP BY b.codigo"); $edit->fondo = new dropdownField("Fondo", "fondo"); $edit->fondo->rule = "required"; $estadmin = $edit->getval('estadmin'); if ($estadmin !== false) { $edit->fondo->options("SELECT tipo,tipo a FROM presupuesto WHERE codigoadm='{$estadmin}' GROUP BY tipo"); } else { $edit->fondo->option("", "Seleccione una estructura administrativa primero"); } $edit->cod_prov = new inputField("Beneficiario", 'cod_prov'); $edit->cod_prov->size = 6; $edit->cod_prov->rule = "required"; $edit->cod_prov->append($bSPRV); $edit->cod_prov->readonly = true; $edit->nombre = new inputField("Nombre", 'nombre'); $edit->nombre->size = 50; $edit->nombre->readonly = true; $edit->reteiva_prov = new inputField("reteiva_prov", "reteiva_prov"); $edit->reteiva_prov->size = 1; //$edit->reteiva_prov->mode="autohide"; $edit->reteiva_prov->when = array('modify', 'create'); $edit->beneficiario = new inputField("Beneficiario", 'beneficiario'); $edit->beneficiario->size = 50; //$edit->beneficiario->rule = "required"; $edit->creten = new dropdownField("Codigo ISLR", "creten"); $edit->creten->option("", ""); $edit->creten->options("SELECT codigo,CONCAT_WS(' ',codigo,activida) FROM rete ORDER BY codigo"); $edit->creten->style = "width:300px;"; $edit->creten->onchange = 'cal_islr();'; $edit->observa = new textAreaField("Observaciones", 'observa'); $edit->observa->cols = 106; $edit->observa->rows = 3; //$edit->tcantidad = new inputField("tcantidad", 'tcantidad'); //$edit->tcantidad->size = 8; $edit->subtotal = new inputField("Sub Total", 'subtotal'); $edit->subtotal->css_class = 'inputnum'; $edit->subtotal->size = 8; $edit->ivaa = new inputField("IVA Sobre Tasa", 'ivaa'); $edit->ivaa->css_class = 'inputnum'; $edit->ivaa->size = 8; $edit->ivag = new inputField("IVA Tasa General", 'ivag'); $edit->ivag->css_class = 'inputnum'; $edit->ivag->size = 8; $edit->ivar = new inputField("IVA Tasa reducida", 'ivar'); $edit->ivar->css_class = 'inputnum'; $edit->ivar->size = 8; $edit->exento = new inputField("Exento", 'exento'); $edit->exento->css_class = 'inputnum'; $edit->exento->size = 8; $edit->reteiva = new inputField("Retencion de IVA", 'reteiva'); $edit->reteiva->css_class = 'inputnum'; $edit->reteiva->size = 8; $edit->reten = new inputField("Retencion de ISLR", 'reten'); $edit->reten->css_class = 'inputnum'; $edit->reten->size = 8; $edit->total = new inputField("Total", 'total'); $edit->total->css_class = 'inputnum'; $edit->total->size = 8; $edit->itpartida = new inputField("(<#o#>) Partida", "partida_<#i#>"); $edit->itpartida->rule = 'callback_repetido|required|callback_itpartida'; $edit->itpartida->size = 15; $edit->itpartida->append('<img src="/tortuga/assets/default/images/system-search.png" alt="Busqueda de partidas" title="Busqueda de partidas" border="0" onclick="modbusdepen(<#i#>)"/>'); $edit->itpartida->db_name = 'partida'; $edit->itpartida->rel_id = 'itodirect'; //$edit->itpartida->readonly =true; $edit->itdescripcion = new inputField("(<#o#>) Descripción", "descripcion_<#i#>"); $edit->itdescripcion->db_name = 'descripcion'; $edit->itdescripcion->maxlength = 80; $edit->itdescripcion->size = 30; $edit->itdescripcion->rule = 'required'; $edit->itdescripcion->rel_id = 'itodirect'; $edit->itunidad = new dropdownField("(<#o#>) Unidad", "unidad_<#i#>"); $edit->itunidad->db_name = 'unidad'; $edit->itunidad->rule = 'required'; $edit->itunidad->rel_id = 'itodirect'; $edit->itunidad->options("SELECT unidades AS id,unidades FROM unidad ORDER BY unidades"); $edit->itunidad->style = "width:80px"; $edit->itcantidad = new inputField("(<#o#>) Cantidad", "cantidad_<#i#>"); $edit->itcantidad->css_class = 'inputnum'; $edit->itcantidad->db_name = 'cantidad'; $edit->itcantidad->rel_id = 'itodirect'; $edit->itcantidad->rule = 'numeric'; $edit->itcantidad->onchange = 'cal_importe(<#i#>);'; $edit->itcantidad->size = 4; //$edit->itcantidad->insertValue=0; $edit->itprecio = new inputField("(<#o#>) Precio", "precio_<#i#>"); $edit->itprecio->css_class = 'inputnum'; $edit->itprecio->db_name = 'precio'; $edit->itprecio->rel_id = 'itodirect'; $edit->itprecio->rule = 'numeric'; $edit->itprecio->onchange = 'cal_importe(<#i#>);'; $edit->itprecio->size = 8; //$edit->itprecio->insertValue=0; $edit->itiva = new dropdownField("(<#o#>) IVA", "iva_<#i#>"); $edit->itiva->db_name = 'iva'; $edit->itiva->rel_id = 'itodirect'; $edit->itiva->onchange = 'cal_importe(<#i#>);'; $edit->itiva->option("0", "Excento"); $edit->itiva->options($this->_ivaplica()); $edit->itiva->style = "width:80px"; $edit->itimporte = new inputField("(<#o#>) Importe", "importe_<#i#>"); $edit->itimporte->css_class = 'inputnum'; $edit->itimporte->db_name = 'importe'; $edit->itimporte->rel_id = 'itodirect'; $edit->itimporte->rule = 'numeric'; $edit->itimporte->readonly = true; $edit->itimporte->size = 8; $status = $edit->get_from_dataobjetct('status'); if ($status == 'P') { $action = "javascript:window.location='" . site_url($this->url . '/actualizar/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_status", 'Actualizar', $action, "TR", "show"); $edit->buttons("modify", "delete", "save"); } elseif ($status == 'C') { $action = "javascript:window.location='" . site_url($this->url . '/reversar/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_rever", 'Reversar', $action, "TR", "show"); } else { $edit->buttons("save"); } $edit->buttons("undo", "back", "add_rel"); $edit->build(); //SELECT codigo,base1,tari1,pama1 FROM rete $query = $this->db->query('SELECT codigo,base1,tari1,pama1 FROM rete'); $rt = array(); foreach ($query->result_array() as $row) { $pivot = array('base1' => $row['base1'], 'tari1' => $row['tari1'], 'pama1' => $row['pama1']); $rt['_' . $row['codigo']] = $pivot; } $rete = json_encode($rt); $conten['rete'] = $rete; $ivaplica = $this->ivaplica2(); $conten['ivar'] = $ivaplica['redutasa']; $conten['ivag'] = $ivaplica['tasa']; $conten['ivaa'] = $ivaplica['sobretasa']; $smenu['link'] = barra_menu('101'); $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true); $conten["form"] =& $edit; $data['content'] = $this->load->view('view_odirect', $conten, true); //$data['content'] = $edit->output; $data['title'] = " {$this->t**s} "; $data["head"] = $this->rapyd->get_head() . script('jquery.js') . script("plugins/jquery.numeric.pack.js") . script("plugins/jquery.json.min.js"); $this->load->view('view_ventanas', $data); }
function dataedit() { //$this->datasis->modulo_id(119,1); $this->rapyd->load('dataobject', 'datadetails'); $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'Cóodigo', 'nombre' => 'Nombre', 'rif' => 'Rif', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'Código', 'nombre' => 'Nombre', 'rif' => 'Rif'), 'p_uri' => array(4 => '<#i#>'), 'retornar' => array('proveed' => 'codprov_<#i#>', 'nombre' => 'nombrep', 'reteiva' => 'reteiva_prov'), 'titulo' => 'Buscar Proveedor'); $bSPRV = $this->datasis->p_modbus($mSPRV, "<#i#>"); $bSPRV2 = $this->datasis->p_modbus($mSPRV, "sprv"); $modbus = array('tabla' => 'v_presaldo', 'columnas' => array('codigo' => 'Código', 'ordinal' => 'Ord', 'denominacion' => 'Denominación', 'saldo' => 'Saldo'), 'filtro' => array('codigo' => 'Código', 'denominacion' => 'Denominación'), 'retornar' => array('codigo' => 'partida_<#i#>', 'ordinal' => 'ordinal_<#i#>'), 'p_uri' => array(4 => '<#i#>', 5 => '<#fondo#>', 6 => '<#estadmin#>'), 'where' => 'fondo = <#fondo#> AND codigoadm = <#estadmin#> AND movimiento = "S" AND saldo > 0', 'titulo' => 'Busqueda de partidas'); $btn = $this->datasis->p_modbus($modbus, '<#i#>/<#fondo#>/<#estadmin#>'); $mMBANC = array('tabla' => 'mbanc', 'columnas' => array('id' => 'Cóodigo', 'codbanc' => 'Banco', 'monto' => 'Monto'), 'filtro' => array('id' => 'Cóodigo', 'codbanc' => 'Banco', 'monto' => 'Monto'), 'retornar' => array('id' => 'mbanc'), 'where' => 'tipo = "C"', 'titulo' => 'Buscar Anticipos de Gastos'); $bMBANC = $this->datasis->p_modbus($mMBANC, "mbanc"); $do = new DataObject("odirect"); $do->pointer('sprv', 'sprv.proveed = odirect.cod_prov', 'sprv.nombre as nombrep', 'LEFT'); $do->rel_one_to_many('itodirect', 'itodirect', array('numero' => 'numero')); $do->rel_one_to_many('itfac', 'itfac', array('numero' => 'numero')); $edit = new DataDetails($this->t**s, $do); $edit->back_url = site_url($this->url . "filteredgrid/index"); $edit->set_rel_title('itodirect', 'Rubro <#o#>'); $edit->pre_process('update', '_valida'); $edit->pre_process('insert', '_valida'); $edit->post_process('insert', '_post_insert'); $edit->post_process('update', '_post_update'); $edit->post_process('delete', '_post_delete'); $edit->numero = new inputField("Número", "numero"); $edit->numero->mode = "autohide"; $edit->numero->when = array('show'); $edit->tipo = new dropdownField("Orden de ", "tipo"); $edit->tipo->option("Compra", "Compra"); $edit->tipo->option("Servicio", "Servicio"); $edit->tipo->option("T", "Transferencia"); $edit->tipo->style = "width:100px;"; $edit->fecha = new dateonlyField("Fecha", "fecha"); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->size = 12; $edit->uejecutora = new dropdownField("Unidad Ejecutora", "uejecutora"); $edit->uejecutora->option("", "Seccionar"); $edit->uejecutora->options("SELECT codigo, nombre FROM uejecutora ORDER BY nombre"); //$edit->uejecutora->onchange = "get_uadmin();"; $edit->uejecutora->rule = "required"; $edit->uejecutora->style = "width:200px"; $edit->estadmin = new dropdownField("Estructura Administrativa", "estadmin"); $edit->estadmin->option("", "Seleccione"); $edit->estadmin->rule = 'required'; $edit->estadmin->options("SELECT b.codigo, CONCAT_WS(' ',b.codigo,b.denominacion) AS val FROM presupuesto AS a JOIN estruadm AS b ON a.codigoadm=b.codigo GROUP BY b.codigo"); $edit->estadmin->style = "width:200px"; $edit->fondo = new dropdownField("Fondo", "fondo"); $edit->fondo->rule = "required"; $edit->fondo->style = "width:220px"; $estadmin = $edit->getval('estadmin'); if ($estadmin !== false) { $edit->fondo->options("SELECT tipo,tipo a FROM presupuesto WHERE codigoadm='{$estadmin}' GROUP BY tipo"); } else { $edit->fondo->option("", "Seleccione Estructura Administrativa"); } $edit->codprov_sprv = new inputField("Proveedor", 'codprov_sprv'); $edit->codprov_sprv->db_name = "cod_prov"; $edit->codprov_sprv->size = 4; $edit->codprov_sprv->append($bSPRV2); $edit->nombrep = new inputField("Nombre", 'nombrep'); $edit->nombrep->size = 20; $edit->nombrep->readonly = true; $edit->nombrep->pointer = true; $edit->reteiva_prov = new inputField("reteiva_prov", "reteiva_prov"); $edit->reteiva_prov->size = 1; $edit->reteiva_prov->when = array('modify', 'create'); $edit->observa = new textAreaField("Observaciones", 'observa'); $edit->observa->cols = 70; $edit->observa->rows = 3; $edit->fechafac = new dateonlyField("Fecha de Factura", "fechafac"); $edit->fechafac->insertValue = date('Y-m-d'); $edit->fechafac->size = 12; $edit->simptimbre = new checkboxField("1X1000", "simptimbre", "S", "N"); $edit->simptimbre->insertValue = "N"; $edit->simptimbre->onchange = 'cal_timbre();'; $edit->simpmunicipal = new checkboxField("I.Municipal", "simpmunicipal", "S", "N"); $edit->simpmunicipal->insertValue = "N"; $edit->simpmunicipal->onchange = 'cal_municipal();'; $edit->imptimbre = new inputField("Impuesto 1X1000", 'imptimbre'); $edit->imptimbre->size = 8; $edit->imptimbre->css_class = 'inputnum'; $edit->total = new inputField("Monto a Pagar", 'total'); $edit->total->size = 8; $edit->total->css_class = 'inputnum'; $edit->retenomina = new inputField("Deducciones Nomina", 'retenomina'); $edit->retenomina->size = 8; $edit->retenomina->css_class = 'inputnum'; $edit->retenomina->onchange = 'cal_total();'; $edit->retenomina->value = 0; $edit->impmunicipal = new inputField("Impuesto Municipal", 'impmunicipal'); $edit->impmunicipal->size = 8; $edit->impmunicipal->css_class = 'inputnum'; $edit->subtotal = new inputField("Sub Total", 'subtotal'); $edit->subtotal->css_class = 'inputnum'; $edit->subtotal->size = 5; $edit->subtotal->readonly = true; $edit->iva = new inputField("IVA", 'iva'); $edit->iva->css_class = 'inputnum'; $edit->iva->size = 8; $edit->iva->readonly = true; $edit->ivaa = new inputField("IVA Adicional", 'ivaa'); $edit->ivaa->css_class = 'inputnum'; $edit->ivaa->size = 8; $edit->ivag = new inputField("IVA General", 'ivag'); $edit->ivag->css_class = 'inputnum'; $edit->ivag->size = 8; $edit->ivar = new inputField("IVA Reducido", 'ivar'); $edit->ivar->css_class = 'inputnum'; $edit->ivar->size = 8; $edit->exento = new inputField("Exento", 'exento'); $edit->exento->css_class = 'inputnum'; $edit->exento->size = 8; $edit->reteiva = new inputField("Retencion IVA", 'reteiva'); $edit->reteiva->css_class = 'inputnum'; $edit->reteiva->size = 8; $edit->creten = new dropdownField("Codigo ISLR", "creten"); $edit->creten->option("", ""); $edit->creten->options("SELECT codigo,CONCAT_WS(' ',codigo,activida) FROM rete ORDER BY codigo"); $edit->creten->style = "width:150px;"; $edit->creten->onchange = 'cal_islr();'; $edit->reten = new inputField("Retención ISLR", 'reten'); $edit->reten->css_class = 'inputnum'; $edit->reten->size = 8; $edit->total2 = new inputField("Total", 'total2'); $edit->total2->css_class = 'inputnum'; $edit->total2->size = 8; $edit->multiple = new autoupdateField('S', 'multiple'); $edit->itpartida = new inputField("(<#o#>) Partida", "partida_<#i#>"); $edit->itpartida->rule = 'callback_itpartida'; $edit->itpartida->size = 12; $edit->itpartida->append('<img src="/tortuga/assets/default/images/system-search.png" alt="Busqueda de partidas" title="Busqueda de partidas" border="0" onclick="modbusdepen(<#i#>)"/>'); $edit->itpartida->db_name = 'partida'; $edit->itpartida->rel_id = 'itodirect'; $edit->itordinal = new inputField("(<#o#>) Ordinal", "ordinal_<#i#>"); $edit->itordinal->db_name = 'ordinal'; $edit->itordinal->maxlength = 3; $edit->itordinal->size = 5; $edit->itordinal->rel_id = 'itodirect'; $edit->itdescripcion = new inputField("(<#o#>) Descripción", "descripcion_<#i#>"); $edit->itdescripcion->db_name = 'descripcion'; $edit->itdescripcion->maxlength = 80; $edit->itdescripcion->size = 15; $edit->itdescripcion->rel_id = 'itodirect'; $edit->itunidad = new dropdownField("(<#o#>) Unidad", "unidad_<#i#>"); $edit->itunidad->db_name = 'unidad'; $edit->itunidad->rel_id = 'itodirect'; $edit->itunidad->options("SELECT unidades AS id,unidades FROM unidad ORDER BY unidades"); $edit->itunidad->style = "width:80px"; $edit->itcantidad = new inputField("(<#o#>) Cantidad", "cantidad_<#i#>"); $edit->itcantidad->css_class = 'inputnum'; $edit->itcantidad->db_name = 'cantidad'; $edit->itcantidad->rel_id = 'itodirect'; $edit->itcantidad->rule = 'numeric'; $edit->itcantidad->onchange = 'cal_importe(<#i#>);'; $edit->itcantidad->size = 5; $edit->itprecio = new inputField("(<#o#>) Precio", "precio_<#i#>"); $edit->itprecio->css_class = 'inputnum'; $edit->itprecio->db_name = 'precio'; $edit->itprecio->rel_id = 'itodirect'; $edit->itprecio->rule = 'callback_positivo'; $edit->itprecio->onchange = 'cal_importe(<#i#>);'; $edit->itprecio->size = 8; $edit->itiva = new dropdownField("(<#o#>) IVA", "iva_<#i#>"); $edit->itiva->db_name = 'iva'; $edit->itiva->rel_id = 'itodirect'; $edit->itiva->onchange = 'cal_importe(<#i#>);'; $edit->itiva->options($this->_ivaplica()); $edit->itiva->option("0", "Excento"); $edit->itiva->style = "width:80px"; $edit->itimporte = new inputField("(<#o#>) Importe", "importe_<#i#>"); $edit->itimporte->css_class = 'inputnum'; $edit->itimporte->db_name = 'importe'; $edit->itimporte->rel_id = 'itodirect'; $edit->itimporte->rule = 'numeric'; $edit->itimporte->readonly = true; $edit->itimporte->size = 8; //relacion itfac $status = $edit->get_from_dataobjetct('status'); $edit->tivag = new inputField("", "tivag"); $edit->tivag->mode = "autohide"; $edit->tivag->size = 5; $edit->tivar = new inputField("", "tivar"); $edit->tivar->mode = "autohide"; $edit->tivar->size = 5; $edit->tivaa = new inputField("", "tivaa"); $edit->tivaa->mode = "autohide"; $edit->tivaa->size = 5; $edit->tsubtotal = new inputField("", "tsubtotal"); $edit->tsubtotal->readonly = true; $edit->tsubtotal->size = 8; $edit->tsubtotal->when = array('modify'); $edit->texento = new inputField("", "texento"); $edit->texento->readonly = true; $edit->texento->size = 8; $edit->texento->when = array('modify'); $edit->trivag = new inputField("", "trivag"); $edit->trivag->readonly = true; $edit->trivag->size = 8; $edit->trivag->when = array('modify'); $edit->trivar = new inputField("", "trivar"); $edit->trivar->readonly = true; $edit->trivar->size = 8; $edit->trivar->when = array('modify'); $edit->trivaa = new inputField("", "trivaa"); $edit->trivaa->readonly = true; $edit->trivaa->size = 8; $edit->trivaa->when = array('modify'); $edit->treteiva = new inputField("", "treteiva"); $edit->treteiva->readonly = true; $edit->treteiva->size = 8; $edit->treteiva->when = array('modify'); $edit->ttotal = new inputField("", "ttotal"); $edit->ttotal->readonly = true; $edit->ttotal->size = 8; $edit->ttotal->when = array('modify'); $edit->ttotal2 = new inputField("", "ttotal2"); $edit->ttotal2->readonly = true; $edit->ttotal2->size = 8; $edit->ttotal2->when = array('modify'); $edit->itfactura = new inputField("(<#o#>) Factura", "factura_<#i#>"); $edit->itfactura->size = 10; $edit->itfactura->db_name = 'factura'; $edit->itfactura->rel_id = 'itfac'; $edit->itfactura->rule = 'required'; $edit->itcontrolfac = new inputField("(<#o#>) Control Fiscal", "controlfac_<#i#>"); $edit->itcontrolfac->db_name = 'controlfac'; $edit->itcontrolfac->size = 10; $edit->itcontrolfac->rel_id = 'itfac'; $edit->itcontrolfac->rule = 'required'; $edit->itfechafac = new dateonlyField("(<#o#>) Fecha Factura", "fechafac_<#i#>"); $edit->itfechafac->db_name = 'fechafac'; $edit->itfechafac->insertValue = date('Y-m-d'); $edit->itfechafac->size = 10; $edit->itfechafac->rule = 'required'; $edit->itfechafac->rel_id = 'itfac'; $edit->itsubtotal = new inputField("(<#o#>) Total", "subtotal_<#i#>"); $edit->itsubtotal->size = 8; $edit->itsubtotal->db_name = 'subtotal'; $edit->itsubtotal->rel_id = 'itfac'; $edit->itsubtotal->onchange = 'cal_subtotal(<#i#>);'; $edit->itsubtotal->css_class = "inputnum"; if ($status == "B3") { $edit->itsubtotal->mode = "autohide"; } $edit->itexento = new inputField("(<#o#>) Exento", "exento_<#i#>"); $edit->itexento->size = 8; $edit->itexento->db_name = 'exento'; $edit->itexento->rel_id = 'itfac'; $edit->itexento->css_class = "inputnum"; if ($status == "B3") { $edit->itexento->mode = "autohide"; } $edit->itivag = new inputField("(<#o#>) % IVA General", "ivag_<#i#>"); $edit->itivag->size = 8; $edit->itivag->db_name = 'ivag'; $edit->itivag->rel_id = 'itfac'; $edit->itivag->onchange = 'cal_itivag(<#i#>);'; $edit->itivag->css_class = "inputnum"; if ($status == "B3") { $edit->itivag->mode = "autohide"; } $edit->itivar = new inputField("(<#o#>) % IVA Reducido", "ivar_<#i#>"); $edit->itivar->size = 8; $edit->itivar->db_name = 'ivar'; $edit->itivar->rel_id = 'itfac'; $edit->itivar->onchange = 'cal_itivar(<#i#>);'; $edit->itivar->css_class = "inputnum"; if ($status == "B3") { $edit->itivar->mode = "autohide"; } $edit->itivaa = new inputField("(<#o#>) % IVA Adicional", "ivaa_<#i#>"); $edit->itivaa->size = 8; $edit->itivaa->db_name = 'ivaa'; $edit->itivaa->rel_id = 'itfac'; $edit->itivaa->onchange = 'cal_itivaa(<#i#>);'; $edit->itivaa->css_class = "inputnum"; if ($status == "B3") { $edit->itivaa->mode = "autohide"; } $edit->itreteiva = new inputField("(<#o#>) % IVA Adicional", "reteiva_<#i#>"); $edit->itreteiva->size = 8; $edit->itreteiva->db_name = 'reteiva'; $edit->itreteiva->rel_id = 'itfac'; $edit->itreteiva->readonly = true; if ($status == "B3") { $edit->itreteiva->mode = "autohide"; } $edit->ittotal = new inputField("(<#o#>) % IVA Adicional", "total_<#i#>"); $edit->ittotal->size = 8; $edit->ittotal->db_name = 'total'; $edit->ittotal->rel_id = 'itfac'; $edit->ittotal->readonly = true; if ($status == "B3") { $edit->ittotal->mode = "autohide"; } $edit->ittotal2 = new inputField("(<#o#>) % IVA Adicional", "total2_<#i#>"); $edit->ittotal2->size = 8; $edit->ittotal2->db_name = 'total2'; $edit->ittotal2->rel_id = 'itfac'; $edit->ittotal2->readonly = true; if ($status == "B3") { $edit->ittotal2->mode = "autohide"; } //fin relacion itfac if ($status == 'B1') { $action = "javascript:window.location='" . site_url($this->url . 'actualizar/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_status", 'Actualizar', $action, "TR", "show"); $edit->buttons("modify", "save"); } elseif ($status == 'B2') { $action = "javascript:window.location='" . site_url('presupuesto/common/pd_anular/' . $edit->rapyd->uri->get_edited_id()) . "'"; if ($this->datasis->puede('1015')) { $edit->button_status("btn_anular", 'Anular', $action, "TR", "show"); } } elseif ($status == 'B3') { $multiple = $edit->get_from_dataobjetct('multiple'); if ($multiple == "N") { $action = "javascript:window.location='" . site_url($this->url . 'camfac/dataedit/modify/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_camfac", 'Modificar Factura', $action, "TR", "show"); } } else { $edit->buttons("save"); } $edit->buttons("undo", "back", "add_rel"); $edit->build(); $query = $this->db->query('SELECT codigo,base1,tari1,pama1 FROM rete'); $rt = array(); foreach ($query->result_array() as $row) { $pivot = array('base1' => $row['base1'], 'tari1' => $row['tari1'], 'pama1' => $row['pama1']); $rt['_' . $row['codigo']] = $pivot; } $rete = json_encode($rt); $conten['rete'] = $rete; $ivaplica = $this->ivaplica2(); $conten['status'] = $status; $conten['ivar'] = $ivaplica['redutasa']; $conten['ivag'] = $ivaplica['tasa']; $conten['ivaa'] = $ivaplica['sobretasa']; $conten['imptimbre'] = $this->datasis->traevalor('IMPTIMBRE'); $conten['impmunicipal'] = $this->datasis->traevalor('IMPMUNICIPAL'); $smenu['link'] = barra_menu('119'); $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true); $conten["form"] =& $edit; $data['content'] = $this->load->view('view_odirectmulti', $conten, true); $data['title'] = " {$this->t**s} "; $data["head"] = $this->rapyd->get_head() . script('jquery.js') . script("plugins/jquery.numeric.pack.js") . script("plugins/jquery.json.min.js"); $this->load->view('view_ventanas', $data); }
function dataedit() { //$this->datasis->modulo_id(115,1); $this->rapyd->load('dataobject', 'datadetails'); //$this->rapyd->uri->keep_persistence(); $modbus = array('tabla' => 'v_presaldo', 'columnas' => array('codigoadm' => 'Est. Admin', 'codigo' => 'Partida', 'denominacion' => 'Denominación', 'apartado' => 'Pre-Comprometido', 'saldo' => 'Saldo'), 'filtro' => array('codigoadm' => 'Est. Admin', 'codigo' => 'Partida', 'denominacion' => 'Denominacion'), 'retornar' => array('codigoadm' => 'itcodigoadm_<#i#>', 'codigo' => 'itcodigopres_<#i#>', 'denominacion' => 'itdenomi_<#i#>', 'saldo' => 'itdisp_<#i#>'), 'p_uri' => array(4 => '<#i#>', 5 => '<#fondo#>'), 'where' => 'movimiento = "S" AND saldo >0 AND fondo=<#fondo#> AND codigo LIKE "4.%"', 'script' => array('cal_soli()'), 'titulo' => 'Busqueda de partidas'); $btn = $this->datasis->p_modbus($modbus, '<#i#>/<#fondo#>'); $btn = '<img src="' . base_url() . 'assets/default/images/system-search.png" alt="Busqueda de partidas" title="Busqueda de partidas" border="0" onclick="modbusdepen(<#i#>)"/>'; $do = new DataObject("cdisp"); $do->rel_one_to_many('itcdisp', 'itcdisp', array('numero' => 'numero')); $do->rel_pointer('itcdisp', 'v_presaldo', 'itcdisp.codigoadm=v_presaldo.codigoadm AND itcdisp.fondo=v_presaldo.fondo AND itcdisp.codigopres=v_presaldo.codigo ', "v_presaldo.denominacion as denomi"); //$do->rel_pointer('itcdisp','ppla' ,'ppla.codigo=itcdisp.codigopres',"ppla.denominacion as denomi"); $edit = new DataDetails($this->t**s, $do); $edit->back_url = site_url($this->url . "filteredgrid"); $edit->set_rel_title('itcdisp', 'Rubro <#o#>'); $status = $edit->get_from_dataobjetct('status'); $edit->pre_process('insert', '_valida'); $edit->pre_process('update', '_valida'); $edit->post_process('insert', '_post_insert'); $edit->post_process('update', '_post_update'); $edit->post_process('delete', '_post_delete'); //**************************INICIO ENCABEZADO******************************************************************** $edit->numero = new inputField("Número", "numero"); //$edit->numero->rule = "callback_chexiste"; $edit->numero->mode = "autohide"; $edit->numero->when = array('show'); $edit->fecha = new dateonlyField("Fecha", "fecha", "d/m/Y"); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->size = 12; $edit->fecha->mode = "autohide"; //$edit->fecha->when =array('show'); $edit->status = new dropdownField("Estado", "status"); $edit->status->option('C', 'Pre-Comprometido'); $edit->status->option('A', 'Anulado'); $edit->status->option('F', 'Finalizado Pre-Compromiso'); $edit->status->option('P', 'Pendiente'); $edit->status->when = array('show'); $edit->ano = new dateonlyField("Año", "ano", "Y"); $edit->ano->insertValue = date('Y'); $edit->ano->size = 12; $edit->ano->mode = "autohide"; $edit->ano->when = array('show'); $edit->reque = new textareaField("Requerimientos", 'reque'); $edit->reque->rows = 3; $edit->reque->cols = 60; $edit->uejecuta = new dropdownField("U.Ejecutora", "uejecuta"); $edit->uejecuta->option("", "Seccionar"); $edit->uejecuta->options("SELECT codigo,nombre FROM uejecutora ORDER BY nombre"); $edit->uejecuta->onchange = "get_uadmin();"; $edit->uejecuta->rule = "required"; $edit->uadministra = new dropdownField("U.Administrativa", "uadministra"); $edit->uadministra->option("", "Ninguna"); $ueje = $edit->getval('uejecuta'); if ($ueje !== false) { $edit->uadministra->options("SELECT codigo,nombre FROM uadministra WHERE codigoejec='{$ueje}' ORDER BY nombre"); } else { $edit->uadministra->option("", "Seleccione una unidad ejecutora primero"); } $edit->fondo = new dropdownField("F. Financiamiento", "fondo"); $edit->fondo->rule = 'required'; $edit->fondo->db_name = 'fondo'; $edit->fondo->options("SELECT tipo,tipo a FROM presupuesto WHERE tipo<>'' GROUP BY tipo ORDER BY tipo desc"); $edit->fondo->style = "width:100px;"; $edit->tdisp = new inputField("Total Disponibilidad", "tdisp"); $edit->tdisp->size = 10; $edit->tdisp->readonly = true; $edit->tdisp->css_class = 'inputnum'; //$edit->tdisp->mode ="autohide"; $edit->tsoli = new inputField("Total Solicitado", "tsoli"); $edit->tsoli->size = 10; $edit->tsoli->readonly = true; $edit->tsoli->css_class = 'inputnum'; //************************** FIN ENCABEZADO******************************************************************** //**************************INICIO DETALLE DE ASIGNACIONES ***************************************************** $edit->itcodigoadm = new inputField("Estructura\tAdministrativa", "itcodigoadm_<#i#>"); $edit->itcodigoadm->db_name = 'codigoadm'; $edit->itcodigoadm->rel_id = 'itcdisp'; $edit->itcodigoadm->rule = 'required'; $edit->itcodigoadm->size = 10; $edit->itcodigoadm->autocomplete = false; if ($status == 'O') { $edit->itcodigoadm->readonly = true; } //$edit->itcodigoadm->mode ="autohide"; $edit->itcodigopres = new inputField("(<#o#>) ", "itcodigopres_<#i#>"); $edit->itcodigopres->rule = 'required|callback_itorden'; $edit->itcodigopres->size = 15; $edit->itcodigopres->db_name = 'codigopres'; $edit->itcodigopres->rel_id = 'itcdisp'; $edit->itcodigopres->autocomplete = false; //$edit->itcodigopres->readonly =true; $edit->itcodigopres->append($btn); if ($status == 'O') { $edit->itcodigopres->readonly = true; } //$edit->itcodigopres->mode ="autohide"; //$edit->itfondo = new inputField("(<#o#>) Fondo","itfondo_<#i#>"); //$edit->itfondo->rule ='required'; //$edit->itfondo->db_name='fondo'; //$edit->itfondo->rel_id ='itcdisp'; //$edit->itfondo->size =10; //if($status=='O' ) //$edit->itfondo->readonly = true; //$edit->itfondo->mode ="autohide"; $edit->itdenomi = new inputField("(<#o#>) Denominacion", "itdenomi_<#i#>"); //$edit->itdenomi->rule ='required'; $edit->itdenomi->db_name = 'denomi'; $edit->itdenomi->rel_id = 'itcdisp'; $edit->itdenomi->pointer = true; $edit->itdenomi->size = 40; $edit->itdenomi->readonly = true; //$edit->itdenomi->mode ="autohide"; $edit->itdisp = new inputField("(<#o#>) Disponible", 'itdisp_<#i#>'); $edit->itdisp->db_name = 'disp'; $edit->itdisp->size = 10; $edit->itdisp->rel_id = 'itcdisp'; $edit->itdisp->css_class = 'inputnum'; $edit->itdisp->readonly = true; $edit->itsoli = new inputField("(<#o#>) Solicitado", 'itsoli_<#i#>'); $edit->itsoli->db_name = 'soli'; $edit->itsoli->size = 10; $edit->itsoli->rule = 'callback_positivo'; $edit->itsoli->rel_id = 'itcdisp'; $edit->itsoli->css_class = 'inputnum'; $edit->itsoli->onchange = 'cal_soli();'; if ($status == 'O') { $edit->itsoli->readonly = true; } //$edit->itmontoa->mode ="autohide"; //************************** FIN DETALLE DE ORDENES DEPAGO***************************************************** $status = $edit->get_from_dataobjetct('status'); if ($status == 'P') { $action = "javascript:window.location='" . site_url($this->url . 'cd_precomprometer/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_termina", 'Pre-Comprometer', $action, "TR", "show"); $edit->buttons("add_rel", "modify", "save", "delete"); } elseif ($status == 'C') { $action = "javascript:btn_anular('" . $edit->rapyd->uri->get_edited_id() . "')"; $edit->button_status("btn_anula", 'Anular Pre-Compromiso', $action, "TR", "show"); $action = "javascript:window.location='" . site_url($this->url . 'cd_finalizar/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_deshapartar", 'Finalizar Pre-Compromiso', $action, "TR", "show"); } $edit->buttons("add", "add_rel", "save", "undo", "back"); $edit->build(); $smenu['link'] = barra_menu('304'); $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true); $conten["form"] =& $edit; $data['content'] = $this->load->view('view_cdisp', $conten, true); //$data['content'] = $edit->output; $data['title'] = $this->t**s; $data["head"] = script('jquery.js') . script('jquery-ui.js') . script('plugins/jquery.numeric.pack.js') . script('plugins/jquery.floatnumber.js') . script('plugins/jquery.meiomask.js') . style('vino/jquery-ui.css') . $this->rapyd->get_head(); //.script('plugins/jquery.autocomplete.js').style('jquery.autocomplete.css') $this->load->view('view_ventanas', $data); }
function dataedit() { //$this->datasis->modulo_id(101,1); $this->rapyd->load('dataobject', 'datadetails'); $modbus = array('tabla' => 'v_presaldo', 'columnas' => array('codigo' => 'Código', 'denominacion' => 'Denominación', 'saldo' => 'Saldo'), 'filtro' => array('codigo' => 'Código', 'denominacion' => 'Denominación'), 'retornar' => array('codigo' => 'partida_<#i#>', 'denominacion' => 'denomi_<#i#>'), 'p_uri' => array(4 => '<#i#>', 5 => '<#fondo#>', 6 => '<#estadmin#>'), 'where' => 'fondo=<#fondo#> AND codigoadm=<#estadmin#> AND LENGTH(codigo)=' . $this->flongpres, 'titulo' => 'Busqueda de partidas'); $btn = $this->datasis->p_modbus($modbus, '<#i#>/<#fondo#>/<#estadmin#>'); $do = new DataObject("pmov"); $do->rel_one_to_many($this->id_rel, 'itpmov', array('numero' => 'numero')); $edit = new DataDetails($this->t**s, $do); $edit->back_url = site_url($this->url . "/filteredgrid"); $edit->set_rel_title($this->id_rel, 'Rubro <#o#>'); //$edit->pre_process('insert' ,'_valida'); //$edit->pre_process('update' ,'_valida'); //$edit->post_process('insert' ,'_paiva'); //$edit->post_process('update' ,'_paiva'); $edit->numero = new inputField("Número", "numero"); $edit->numero->mode = "autohide"; $edit->numero->when = array('show'); $edit->fecha = new dateonlyField("Fecha", "fecha"); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->size = 12; $edit->estadmin = new dropdownField("Estructura Administrativa", "estadmin"); $edit->estadmin->option("", "Seleccione"); $edit->estadmin->rule = 'required'; $edit->estadmin->options("SELECT b.codigo, CONCAT_WS(' ',b.codigo,b.denominacion) AS val FROM presupuesto AS a JOIN estruadm AS b ON a.codigoadm=b.codigo GROUP BY b.codigo"); $edit->fondo = new dropdownField("Fondo", "fondo"); $edit->fondo->rule = "required"; $estadmin = $edit->getval('estadmin'); if ($estadmin !== false) { $edit->fondo->options("SELECT tipo,tipo a FROM presupuesto WHERE codigoadm='{$estadmin}' GROUP BY tipo"); } else { $edit->fondo->option("", "Seleccione una estructura administrativa primero"); } $edit->observa = new textAreaField("Observaciones", 'observa'); $edit->observa->cols = 80; $edit->observa->rows = 3; $edit->monto = new inputField("Total", 'monto'); $edit->monto->css_class = 'inputnum'; $edit->monto->size = 10; $edit->itpartida = new inputField("(<#o#>) Partida", "partida_<#i#>"); $edit->itpartida->rule = 'callback_repetido|required|callback_itpartida'; $edit->itpartida->size = 15; $edit->itpartida->db_name = 'partida'; $edit->itpartida->rel_id = $this->id_rel; //$edit->itpartida->readonly = true; $edit->itpartida->append('<img src="/tortuga/assets/default/images/system-search.png" alt="Busqueda de partidas" title="Busqueda de partidas" border="0" onclick="modbusdepen(<#i#>)"/>'); $edit->itdenomi = new inputField("(<#o#>) Denominación", "denomi_<#i#>"); $edit->itdenomi->db_name = 'denomi'; $edit->itdenomi->maxlength = 250; $edit->itdenomi->size = 40; //$edit->itdenomi->rule = 'required'; $edit->itdenomi->rel_id = $this->id_rel; $edit->itmonto = new inputField("(<#o#>) Monto", "monto_<#i#>"); $edit->itmonto->css_class = 'inputnum'; $edit->itmonto->db_name = 'monto'; $edit->itmonto->rel_id = $this->id_rel; $edit->itmonto->rule = 'numeric'; $edit->itmonto->size = 8; $edit->itmonto->onchange = 'cal_total(<#i#>);'; $status = $edit->get_from_dataobjetct('status'); if ($status == 'C') { $action = "javascript:window.location='" . site_url($this->url . 'actualizar/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_status", 'Actualizar', $action, "TR", "show"); $edit->buttons("modify", "save"); } elseif ($status == 'T') { $action = "javascript:window.location='" . site_url($this->url . 'reversar/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_rever", 'Reversar', $action, "TR", "show"); } else { $edit->buttons("save"); } $edit->buttons("undo", "back", "add_rel"); $edit->build(); $smenu['link'] = barra_menu('101'); $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true); $conten["form"] =& $edit; $data['content'] = $this->load->view('view_pmov2', $conten, true); //$data['content'] = $edit->output; $data['title'] = " {$this->t**s} "; $data["head"] = $this->rapyd->get_head() . script('jquery.js') . script("plugins/jquery.numeric.pack.js") . script("plugins/jquery.json.min.js"); $this->load->view('view_ventanas', $data); }
function dataedit($status = '', $numero = '') { $this->datasis->modulo_id(102, 1); $this->rapyd->load('dataobject', 'datadetails'); $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'Cóodigo', 'nombre' => 'Nombre', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'Código', 'nombre' => 'Nombre'), 'retornar' => array('proveed' => 'cod_prov'), 'titulo' => 'Buscar Beneficiario'); $bSPRV = $this->datasis->p_modbus($mSPRV, "proveed"); $mOCOMPRA = array('tabla' => 'ocompra', 'columnas' => array('numero' => 'Cóodigo', 'tipo' => 'Tipo', 'uejecutora' => 'U. Ejecutora', 'cod_prov' => 'Beneficiario', 'beneficiario' => 'Beneficiario'), 'filtro' => array('numero' => 'Cóodigo', 'tipo' => 'Tipo', 'uejecutora' => 'U. Ejecutora', 'beneficiario' => 'Beneficiario'), 'p_uri' => array(4 => '<#i#>', 5 => '<#cod_prov#>'), 'where' => 'status="T" AND cod_prov=<#cod_prov#>', 'script' => array('cal_pago(<#i#>)'), 'retornar' => array('numero' => 'orden_<#i#>', 'total' => 'total_<#i#>', 'abono' => 'abono_<#i#>', 'reten' => 'treten', 'reteiva' => 'treteiva'), 'titulo' => 'Buscar Orden de Compra'); $bOCOMPRA = $this->datasis->p_modbus($mOCOMPRA, "<#i#>/<#cod_prov#>"); $modbus = array('tabla' => 'ppla', 'columnas' => array('codigo' => 'Código', 'denominacion' => 'Denominación'), 'filtro' => array('codigo' => 'Código', 'denominacion' => 'Denominación'), 'retornar' => array('codigo' => 'partida_<#i#>', 'denominacion' => 'descripcion_<#i#>'), 'p_uri' => array(4 => '<#i#>', 5 => '<#fondo#>', 6 => '<#estadmin#>'), 'where' => 'tipo=<#fondo#> AND codigoadm=<#estadmin#> AND LENGTH(ppla.codigo)=' . $this->flongpres, 'join' => array('presupuesto', 'presupuesto.codigopres=ppla.codigo', ''), 'titulo' => 'Busqueda de partidas'); $btn = $this->datasis->p_modbus($modbus, '<#i#>/<#fondo#>/<#estadmin#>'); $do = new DataObject("opago"); //if($status=="create" &&!empty($numero)){ // // $temp = new DataObject("ocompra"); // $temp->load($numero); // $numero; // $estadmin = $temp->get('estadmin'); // $fondo = $temp->get('fondo'); // $beneficiario = $temp->get('beneficiario'); // $do->load(99999999); // // $do->set('estadmin' ,$estadmin ); // $do->set('fondo' ,$fondo ); // $do->set('beneficiario' ,$beneficiario); // $do->set('cod_prov' ,$cod_prov ); // // for($i=0;$i < $do->count_rel('itocompra');$i++){ // $codigopres = $do->get_rel('itopago','partida',$i); // $pago = $do->get_rel('itopago','pago',$i); // // $pk['codigopres'] = $codigopres; // $presup->load($pk); // $causado=$presup->get("causado"); // if($pago > $causado) // $error.="<div class='alert'><p>El monto a pagar ($pago) es mayor al monto causado ($causado)</p></div>"; // } // //} $do->rel_one_to_many('itopago', 'itopago', array('numero' => 'numero')); $edit = new DataDetails("Orden de Pago", $do); $edit->pre_process('insert', '_valida'); $edit->pre_process('update', '_valida'); $edit->back_url = site_url("presupuesto/opago2/filteredgrid"); $edit->set_rel_title('itopago', 'Rubro <#o#>'); $edit->numero = new inputField("Número", "numero"); $edit->numero->mode = "autohide"; $edit->numero->when = array('show'); $edit->fecha = new dateonlyField("Fecha", "fecha"); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->size = 12; //$edit->uejecutora = new dropdownField("Unidad Ejecutora", "uejecutora"); //$edit->uejecutora->option("","Seccionar"); //$edit->uejecutora->options("SELECT codigo, nombre FROM uejecutora ORDER BY nombre"); //$edit->uejecutora->onchange = "get_uadmin();"; //$edit->uejecutora->rule = "required"; $edit->estadmin = new dropdownField("Estructura Administrativa", "estadmin"); $edit->estadmin->option("", "Seleccione"); //$edit->estadmin->rule='required'; $edit->estadmin->options("SELECT b.codigo, CONCAT_WS(' ',b.codigo,b.denominacion) AS val FROM presupuesto AS a JOIN estruadm AS b ON a.codigoadm=b.codigo GROUP BY b.codigo"); $edit->fondo = new dropdownField("Fondo", "fondo"); //$edit->fondo->rule = "required"; $estadmin = $edit->getval('estadmin'); if ($estadmin !== false) { $edit->fondo->options("SELECT tipo,tipo a FROM presupuesto WHERE codigoadm='{$estadmin}' GROUP BY tipo"); } else { $edit->fondo->option("", "Seleccione una estructura administrativa primero"); } $edit->observa = new textareaField("Observación", "observa"); $edit->observa->rows = 4; $edit->observa->cols = 100; $edit->cod_prov = new inputField("Beneficiario", 'cod_prov'); $edit->cod_prov->size = 15; $edit->cod_prov->append($bSPRV); $edit->cod_prov->rule = "required"; $edit->beneficiario = new inputField("Beneficiario", 'beneficiario'); $edit->beneficiario->size = 100; //$edit->beneficiario->rule = "required"; $edit->total = new inputField("Total", 'total'); $edit->total->css_class = 'inputnum'; $edit->total->size = 8; //$edit->itpartida = new inputField("(<#o#>) Partida", "partida_<#i#>"); //$edit->itpartida->rule='callback_repetido|required|callback_itpartida'; //$edit->itpartida->size=15; //$edit->itpartida->append('<img src="/tortuga/assets/default/images/system-search.png" alt="Busqueda de partidas" title="Busqueda de partidas" border="0" onclick="modbusdepen(<#i#>)"/>'); //$edit->itpartida->db_name='partida'; //$edit->itpartida->rel_id ='itopago'; ////$edit->itpartida->readonly =true; $edit->itorden = new inputField("(<#o#>) Orden", "orden_<#i#>"); $edit->itorden->rule = 'callback_repetido|required|callback_itocompra'; $edit->itorden->size = 15; $edit->itorden->append('<img src="/tortuga/assets/default/images/system-search.png" alt="Busqueda de Ordenes de Compra" title="Busqueda de Ordenes de Compra" border="0" onclick="modbusdepen(<#i#>)"/>'); $edit->itorden->db_name = 'orden'; $edit->itorden->rel_id = 'itopago'; //$edit->itorden->append($bOCOMPRA); $edit->itdescripcion = new inputField("(<#o#>) Descripción", "descripcion_<#i#>"); $edit->itdescripcion->db_name = 'descripcion'; $edit->itdescripcion->maxlength = 80; $edit->itdescripcion->size = 40; $edit->itdescripcion->rule = 'required'; $edit->itdescripcion->rel_id = 'itopago'; //$edit->itdescripcion->readonly =true; $edit->itreten = new inputField("(<#o#>) reten", "treten"); //$edit->itreten->css_class='inputnum'; $edit->itreten->db_name = null; //$edit->itreten->rel_id ='itopago'; //$edit->itreten->mode ='autohide'; $edit->itreten->size = 1; $edit->itreten->when = array('modify', "create"); $edit->itreteiva = new inputField("(<#o#>) Pago", "treteiva"); //$edit->itreteiva->css_class='inputnum'; $edit->itreteiva->db_name = null; //$edit->itreteiva->rel_id ='itopago'; //$edit->itreteiva->mode ='autohide'; $edit->itreteiva->size = 1; $edit->itreteiva->when = array('modify', "create"); //$edit->ittotal = new inputField("(<#o#>) Pago", "ttotal"); ////$edit->ittotal->css_class='inputnum'; //$edit->ittotal->db_name =null; ////$edit->ittotal->rel_id ='itopago'; ////$edit->ittotal->mode ='autohide'; //$edit->ittotal->size =1; //$edit->ittotal->when =array('modify',"create"); $edit->ittotal = new inputField("(<#o#>) ", "total_<#i#>"); $edit->ittotal->db_name = null; $edit->ittotal->rel_id = 'itopago'; $edit->ittotal->readonly = true; $edit->ittotal->size = 8; $edit->itabono = new inputField("(<#o#>) ", "abono_<#i#>"); $edit->itabono->db_name = null; $edit->itabono->rel_id = 'itopago'; $edit->itabono->readonly = true; $edit->itabono->size = 8; $edit->itpago = new inputField("(<#o#>) Pago", "pago_<#i#>"); $edit->itpago->css_class = 'inputnum'; $edit->itpago->db_name = 'pago'; $edit->itpago->rel_id = 'itopago'; $edit->itpago->rule = 'numeric'; $edit->itpago->size = 8; $edit->itpago->onchange = 'cal_total(<#i#>);'; $status = $edit->get_from_dataobjetct('status'); if ($status == 'P') { $action = "javascript:window.location='" . site_url('presupuesto/opago2/actualizar/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_status", 'Ordenar Pago', $action, "TR", "show"); $edit->buttons("modify", "delete", "save"); } elseif ($status == 'C') { $action = "javascript:window.location='" . site_url('presupuesto/opago2/reversar/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_rever", 'Deshacer Ordenar Pago', $action, "TR", "show"); } else { $edit->buttons("save"); } $edit->buttons("undo", "back", "add_rel"); $edit->build(); $smenu['link'] = barra_menu('102'); $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true); $conten["form"] =& $edit; $data['content'] = $this->load->view('view_opago2', $conten, true); //$data['content'] = $edit->output; $data['title'] = " Orden de Pago "; $data["head"] = $this->rapyd->get_head() . script('jquery.js') . script("plugins/jquery.numeric.pack.js"); $this->load->view('view_ventanas', $data); }
function dataedit() { //$this->datasis->modulo_id(119,1); $this->rapyd->load('dataobject', 'datadetails'); $do = new DataObject("odirect"); $do->pointer('sprv', 'sprv.proveed=odirect.cod_prov', 'sprv.nombre as nombre', 'LEFT'); $do->rel_one_to_many('itfac', 'itfac', array('numero' => 'numero')); $edit = new DataDetails($this->t**s, $do); $edit->back_url = site_url($this->url . "filteredgrid"); $edit->set_rel_title('itodirect', 'Rubro <#o#>'); $edit->pre_process('update', '_valida'); $edit->pre_process('insert', '_insert'); //$edit->post_process('insert' ,'_paiva'); //$edit->post_process('update' ,'_paiva'); //$edit->post_process('insert','_post_insert'); $edit->post_process('update', '_post_update'); //$edit->post_process('delete','_post_delete'); $status = $edit->get_from_dataobjetct('status'); $edit->numero = new inputField("Número", "numero"); $edit->numero->mode = "autohide"; $edit->numero->when = array('show'); $edit->tipo = new dropdownField("Orden de ", "tipo"); $edit->tipo->option("Compra", "Compra"); $edit->tipo->option("Servicio", "Servicio"); $edit->tipo->option("T", "Transferencia"); $edit->tipo->style = "width:100px;"; $edit->tipo->mode = 'autohide'; //$edit->tipo->when=array('modify'); $edit->fecha = new dateonlyField("Fecha", "fecha"); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->size = 12; $edit->fecha->mode = 'autohide'; //$edit->fecha->when=array('modify'); $edit->uejecutora = new dropdownField("Unidad Ejecutora", "uejecutora"); $edit->uejecutora->option("", "Seccionar"); $edit->uejecutora->options("SELECT codigo, nombre FROM uejecutora ORDER BY nombre"); //$edit->uejecutora->onchange = "get_uadmin();"; $edit->uejecutora->rule = "required"; $edit->uejecutora->style = "width:200px"; $edit->uejecutora->mode = 'autohide'; //$edit->uejecutora->when=array('modify'); $edit->estadmin = new dropdownField("Estructura Administrativa", "estadmin"); $edit->estadmin->option("", "Seleccione"); $edit->estadmin->rule = 'required'; $edit->estadmin->options("SELECT b.codigo, CONCAT_WS(' ',b.codigo,b.denominacion) AS val FROM presupuesto AS a JOIN estruadm AS b ON a.codigoadm=b.codigo GROUP BY b.codigo"); $edit->estadmin->style = "width:200px"; $edit->estadmin->mode = 'autohide'; //$edit->estadmin->when=array('modify'); $edit->fondo = new dropdownField("Fondo", "fondo"); $edit->fondo->rule = "required"; $edit->fondo->style = "width:220px"; $edit->fondo->mode = 'autohide'; //$edit->fondo->when=array('modify'); $estadmin = $edit->getval('estadmin'); if ($estadmin !== false) { $edit->fondo->options("SELECT tipo,tipo a FROM presupuesto WHERE codigoadm='{$estadmin}' GROUP BY tipo"); } else { $edit->fondo->option("", "Seleccione Estructura Administrativa"); } $edit->codprov_sprv = new inputField("Beneficiario", 'codprov_sprv'); $edit->codprov_sprv->db_name = "cod_prov"; $edit->codprov_sprv->size = 4; //$edit->codprov_sprv->rule = "required"; //$edit->codprov_sprv->readonly =true; //$edit->codprov_sprv->append($bSPRV2); $edit->codprov_sprv->mode = 'autohide'; //$edit->codprov_sprv->when=array('modify'); $edit->nombre = new inputField("Nombre", 'nombre'); $edit->nombre->size = 20; $edit->nombre->readonly = true; $edit->nombre->pointer = TRUE; $edit->nombre->mode = 'autohide'; //$edit->nomfis->when=array('modify'); $edit->reteiva_prov = new inputField("reteiva_prov", "reteiva_prov"); $edit->reteiva_prov->size = 1; //$edit->reteiva_prov->mode="autohide"; //$edit->reteiva_prov->when=array('modify'); $edit->observa = new textAreaField("Observaciones", 'observa'); $edit->observa->cols = 70; $edit->observa->rows = 3; $edit->observa->mode = 'autohide'; //$edit->observa->when=array('modify'); $edit->reteiva = new inputField("Retencion IVA", 'reteiva'); $edit->reteiva->css_class = 'inputnum'; $edit->reteiva->size = 8; $edit->reteiva->mode = 'autohide'; $edit->total2 = new inputField("Total", 'total2'); $edit->total2->css_class = 'inputnum'; $edit->total2->size = 8; $edit->total2->mode = 'autohide'; $edit->total = new inputField("Total", 'total'); $edit->total->css_class = 'inputnum'; $edit->total->size = 8; $edit->total->mode = 'autohide'; $edit->tivag = new inputField("", "tivag"); $edit->tivag->mode = "autohide"; //$edit->tivag->when=array('modify'); $edit->tivar = new inputField("", "tivar"); $edit->tivar->mode = "autohide"; //$edit->tivar->when=array('modify'); $edit->tivaa = new inputField("", "tivaa"); $edit->tivaa->mode = "autohide"; //$edit->tivaa->when=array('modify'); $edit->ivag = new inputField("", "ivag"); $edit->ivag->mode = "autohide"; //$edit->ivag->when=array('modify'); $edit->ivar = new inputField("", "ivar"); $edit->ivar->mode = "autohide"; //$edit->ivar->when=array('modify'); $edit->ivaa = new inputField("", "ivaa"); $edit->ivaa->mode = "autohide"; //$edit->ivaa->when=array('modify'); $edit->subtotal = new inputField("", "subtotal"); $edit->subtotal->mode = "autohide"; //$edit->subtotal->when=array('modify'); $edit->exento = new inputField("", "exento"); $edit->exento->mode = "autohide"; //$edit->exento->when=array('modify'); ///////VISUALES INICIO //////////////// $edit->tsubtotal = new inputField("", "tsubtotal"); $edit->tsubtotal->readonly = true; $edit->tsubtotal->size = 8; $edit->tsubtotal->when = array('modify'); $edit->texento = new inputField("", "texento"); $edit->texento->readonly = true; $edit->texento->size = 8; $edit->texento->when = array('modify'); $edit->trivag = new inputField("", "trivag"); $edit->trivag->readonly = true; $edit->trivag->size = 8; $edit->trivag->when = array('modify'); $edit->trivar = new inputField("", "trivar"); $edit->trivar->readonly = true; $edit->trivar->size = 8; $edit->trivar->when = array('modify'); $edit->trivaa = new inputField("", "trivaa"); $edit->trivaa->readonly = true; $edit->trivaa->size = 8; $edit->trivaa->when = array('modify'); $edit->treteiva = new inputField("", "treteiva"); $edit->treteiva->readonly = true; $edit->treteiva->size = 8; $edit->treteiva->when = array('modify'); $edit->ttotal = new inputField("", "ttotal"); $edit->ttotal->readonly = true; $edit->ttotal->size = 8; $edit->ttotal->when = array('modify'); $edit->ttotal2 = new inputField("", "ttotal2"); $edit->ttotal2->readonly = true; $edit->ttotal2->size = 8; $edit->ttotal2->when = array('modify'); ///////FIN VISUALES //////////////////// $edit->itfactura = new inputField("(<#o#>) Factura", "factura_<#i#>"); $edit->itfactura->size = 10; $edit->itfactura->db_name = 'factura'; $edit->itfactura->rel_id = 'itfac'; $edit->itfactura->rule = 'required'; $edit->itcontrolfac = new inputField("(<#o#>) Control Fiscal", "controlfac_<#i#>"); $edit->itcontrolfac->db_name = 'controlfac'; //$edit->itcontrolfac->maxlength=3; $edit->itcontrolfac->size = 10; $edit->itcontrolfac->rel_id = 'itfac'; $edit->itcontrolfac->rule = 'required'; $edit->itfechafac = new dateonlyField("(<#o#>) Fecha Factura", "fechafac_<#i#>"); $edit->itfechafac->db_name = 'fechafac'; $edit->itfechafac->insertValue = date('Y-m-d'); //$edit->itfechafac->maxlength=80; $edit->itfechafac->size = 10; $edit->itfechafac->rule = 'required'; $edit->itfechafac->rel_id = 'itfac'; $edit->itsubtotal = new inputField("(<#o#>) Total", "subtotal_<#i#>"); $edit->itsubtotal->size = 8; $edit->itsubtotal->db_name = 'subtotal'; $edit->itsubtotal->rel_id = 'itfac'; $edit->itsubtotal->onchange = 'cal_subtotal(<#i#>);'; $edit->itsubtotal->css_class = "inputnum"; if ($status == "B3") { $edit->itsubtotal->mode = "autohide"; } $edit->itexento = new inputField("(<#o#>) Exento", "exento_<#i#>"); $edit->itexento->size = 8; $edit->itexento->db_name = 'exento'; $edit->itexento->rel_id = 'itfac'; $edit->itexento->css_class = "inputnum"; //$edit->itexento->rule ='required'; if ($status == "B3") { $edit->itexento->mode = "autohide"; } $edit->itivag = new inputField("(<#o#>) % IVA General", "ivag_<#i#>"); $edit->itivag->size = 8; $edit->itivag->db_name = 'ivag'; //$edit->itivag->rule = 'required'; $edit->itivag->rel_id = 'itfac'; //$edit->itivag->insertValue = 0; $edit->itivag->onchange = 'cal_itivag(<#i#>);'; $edit->itivag->css_class = "inputnum"; if ($status == "B3") { $edit->itivag->mode = "autohide"; } $edit->itivar = new inputField("(<#o#>) % IVA Reducido", "ivar_<#i#>"); $edit->itivar->size = 8; $edit->itivar->db_name = 'ivar'; //$edit->itivar->rule = 'required'; $edit->itivar->rel_id = 'itfac'; //$edit->itivar->insertValue = 0; $edit->itivar->onchange = 'cal_itivar(<#i#>);'; $edit->itivar->css_class = "inputnum"; if ($status == "B3") { $edit->itivar->mode = "autohide"; } $edit->itivaa = new inputField("(<#o#>) % IVA Adicional", "ivaa_<#i#>"); $edit->itivaa->size = 8; $edit->itivaa->db_name = 'ivaa'; $edit->itivaa->rel_id = 'itfac'; $edit->itivaa->onchange = 'cal_itivaa(<#i#>);'; $edit->itivaa->css_class = "inputnum"; if ($status == "B3") { $edit->itivaa->mode = "autohide"; } $edit->itreteiva = new inputField("(<#o#>) % IVA Adicional", "reteiva_<#i#>"); $edit->itreteiva->size = 8; $edit->itreteiva->db_name = 'reteiva'; $edit->itreteiva->rel_id = 'itfac'; $edit->itreteiva->readonly = true; //$edit->itreteiva->onchange ='cal_subtotal2(<#i#>,TRUE);'; if ($status == "B3") { $edit->itreteiva->mode = "autohide"; } $edit->ittotal = new inputField("(<#o#>) % IVA Adicional", "total_<#i#>"); $edit->ittotal->size = 8; $edit->ittotal->db_name = 'total'; $edit->ittotal->rel_id = 'itfac'; $edit->ittotal->readonly = true; if ($status == "B3") { $edit->ittotal->mode = "autohide"; } $edit->ittotal2 = new inputField("(<#o#>) % IVA Adicional", "total2_<#i#>"); $edit->ittotal2->size = 8; $edit->ittotal2->db_name = 'total2'; $edit->ittotal2->rel_id = 'itfac'; $edit->ittotal2->readonly = true; if ($status == "B3") { $edit->ittotal2->mode = "autohide"; } $status = $edit->get_from_dataobjetct('status'); if ($status == 'B1') { $edit->buttons("modify", "save", "undo", "back", "add_rel"); } elseif ($status == 'B2') { $edit->buttons("undo", "back"); } elseif ($status == 'B3') { $multiple = $edit->get_from_dataobjetct('multiple'); if ($multiple == "S") { $edit->buttons("modify", "save"); } $edit->buttons("undo", "back"); } else { $edit->buttons("save", "undo", "back"); } $edit->build(); $ivaplica = $this->ivaplica2(); $conten['ivar'] = $ivaplica['redutasa']; $conten['ivag'] = $ivaplica['tasa']; $conten['ivaa'] = $ivaplica['sobretasa']; $conten['status'] = $status; $smenu['link'] = barra_menu('119'); $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true); $conten["form"] =& $edit; $data['content'] = $this->load->view('view_itfac', $conten, true); //$data['content'] = $edit->output; $data['title'] = "{$this->t**s}"; $data["head"] = $this->rapyd->get_head() . script('jquery.js') . script("plugins/jquery.numeric.pack.js") . script("plugins/jquery.json.min.js"); $this->load->view('view_ventanas', $data); }
function dataedit() { $this->datasis->modulo_id(208, 1); $this->rapyd->load('dataobject', 'datadetails'); $this->rapyd->uri->keep_persistence(); $do = new DataObject("odirect"); $do->rel_one_to_many('pambanc', 'pambanc', array('numero' => 'pago')); $do->pointer('sprv', 'sprv.proveed=odirect.cod_prov', 'sprv.nombre as nombrep'); $do->rel_pointer('pambanc', 'mbanc', 'mbanc.id=pambanc.mbanc', "mbanc.tipo_doc as tipo_docp,mbanc.cheque as chequep,mbanc.fecha as fechap,mbanc.monto as montop,mbanc.observa as observap,mbanc.codbanc as codbancp,mbanc.status AS statusp"); $edit = new DataDetails($this->t**s, $do); $edit->back_url = site_url($this->url . "filteredgrid"); $edit->set_rel_title('pambanc', 'Rubro <#o#>'); //$edit->pre_process('insert' ,'_valida'); //$edit->pre_process('update' ,'_valida'); //$edit->post_process('insert','_post_insert'); //$edit->post_process('update','_post_update'); //$edit->post_process('delete','_post_delete'); $edit->numero = new inputField("Número", "numero"); $edit->numero->mode = "autohide"; $edit->numero->when = array('show'); $edit->tipo = new dropdownField("Orden de ", "tipo"); $edit->tipo->option("Compra", "Compra"); $edit->tipo->option("Servicio", "Servicio"); $edit->tipo->option("T", "Transferencia"); $edit->tipo->style = "width:100px;"; $edit->fecha = new dateonlyField("Fecha", "fecha"); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->size = 12; $edit->uejecutora = new dropdownField("Unidad Ejecutora", "uejecutora"); $edit->uejecutora->option("", "Seccionar"); $edit->uejecutora->options("SELECT codigo, nombre FROM uejecutora ORDER BY nombre"); $edit->uejecutora->rule = "required"; $edit->uejecutora->style = "width:200px"; $edit->estadmin = new dropdownField("Estructura Administrativa", "estadmin"); $edit->estadmin->option("", "Seleccione"); $edit->estadmin->rule = 'required'; $edit->estadmin->options("SELECT b.codigo, CONCAT_WS(' ',b.codigo,b.denominacion) AS val FROM presupuesto AS a JOIN estruadm AS b ON a.codigoadm=b.codigo GROUP BY b.codigo"); $edit->estadmin->style = "width:200px"; $edit->fondo = new dropdownField("Fondo", "fondo"); $edit->fondo->rule = "required"; $edit->fondo->style = "width:220px"; $estadmin = $edit->getval('estadmin'); if ($estadmin !== false) { $edit->fondo->options("SELECT tipo,tipo a FROM presupuesto WHERE codigoadm='{$estadmin}' GROUP BY tipo"); } else { $edit->fondo->option("", "Seleccione Estructura Administrativa"); } $edit->cod_prov = new inputField("Beneficiario", 'cod_prov'); $edit->cod_prov->db_name = "cod_prov"; $edit->cod_prov->size = 4; $edit->nombrep = new inputField("Nombre", 'nombrep'); $edit->nombrep->size = 20; $edit->nombrep->readonly = true; $edit->nombrep->pointer = true; $edit->observa = new textAreaField("Observaciones", 'observa'); $edit->observa->cols = 70; $edit->observa->rows = 3; $edit->itstatusp = new dropdownField("(<#o#>) Banco", 'statusp_<#i#>'); $edit->itstatusp->option("NC", "Nota de Crédito"); $edit->itstatusp->option("AN", "Anulado"); $edit->itstatusp->option("E2", "Activo"); $edit->itstatusp->db_name = 'statusp'; $edit->itstatusp->size = 3; $edit->itstatusp->readonly = true; $edit->itstatusp->rel_id = 'pambanc'; $edit->itstatusp->pointer = true; $edit->itcodbancp = new inputField("(<#o#>) Banco", 'codbancp_<#i#>'); $edit->itcodbancp->db_name = 'codbancp'; $edit->itcodbancp->size = 3; $edit->itcodbancp->readonly = true; $edit->itcodbancp->rel_id = 'pambanc'; $edit->itcodbancp->pointer = true; $edit->ittipo_docp = new dropdownField("(<#o#>) Tipo Documento", "tipo_docp_<#i#>"); $edit->ittipo_docp->db_name = 'tipo_docp'; $edit->ittipo_docp->option("CH", "Cheque"); $edit->ittipo_docp->option("NC", "Nota de Credito"); $edit->ittipo_docp->option("ND", "Nota de Debito"); $edit->ittipo_docp->option("DP", "Deposito"); $edit->ittipo_docp->option("CH", "Cheque"); $edit->ittipo_docp->style = "width:180px"; $edit->ittipo_docp->rel_id = 'pambanc'; $edit->ittipo_docp->pointer = true; $edit->itchequep = new inputField("(<#o#>) Cheque", 'chequep_<#i#>'); $edit->itchequep->db_name = 'chequep'; $edit->itchequep->size = 20; $edit->itchequep->rule = "required"; //callback_chexiste_cheque| $edit->itchequep->rel_id = 'pambanc'; $edit->itchequep->pointer = true; $edit->itfechap = new dateonlyField("(<#o#>) Fecha Cheque", "fechap_<#i#>"); $edit->itfechap->db_name = 'fechap'; $edit->itfechap->size = 12; $edit->itfechap->rule = 'required'; $edit->itfechap->rel_id = 'pambanc'; $edit->itfechap->pointer = true; $edit->itmontop = new inputField("(<#o#>) Total", 'montop_<#i#>'); $edit->itmontop->db_name = 'montop'; $edit->itmontop->mode = 'autohide'; $edit->itmontop->when = array('show'); $edit->itmontop->size = 8; $edit->itmontop->rel_id = 'pambanc'; $edit->itmontop->pointer = true; $edit->itobservap = new textAreaField("(<#o#>) Observaciones", 'observap_<#i#>'); $edit->itobservap->db_name = 'observap'; $edit->itobservap->cols = 30; $edit->itobservap->rows = 3; $edit->itobservap->rel_id = 'pambanc'; $edit->itobservap->pointer = true; $status = $edit->get_from_dataobjetct('status'); $numero = $edit->get_from_dataobjetct('numero'); //echo "*".$fentrega = $edit->get_from_dataobjetct('fentrega'); if (substr($status, 1, 1) == '3') { $mbanc = $this->datasis->damerow("SELECT id,fentrega FROM mbanc a JOIN pambanc b ON a.id=b.mbanc WHERE b.pago=" . $edit->rapyd->uri->get_edited_id() . " AND a.status='E2'"); if (!empty($mbanc)) { $a = $mbanc['fentrega']; $action = "javascript:window.location='" . site_url($this->url . "anula/dataedit/modify/" . $mbanc['id'] . "'"); $edit->button_status("btn_rever", 'Anular Desembolso', $action, "TR", "show"); } } elseif (substr($status, 1, 1) == '2') { $action = "javascript:window.location='" . site_url($this->url . "add/create/" . $numero) . "'"; $edit->button_status("btn_rever", 'Desembolsar', $action, "TR", "show"); $edit->buttons("save"); } $edit->buttons("undo", "back"); $edit->build(); $smenu['link'] = barra_menu('208'); $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true); $conten["form"] =& $edit; $data['content'] = $this->load->view('view_desemsant', $conten, true); //$data['content'] = $edit->output; $data['title'] = " {$this->t**s} "; $data["head"] = $this->rapyd->get_head() . script('jquery.js') . script("plugins/jquery.numeric.pack.js") . script("plugins/jquery.json.min.js"); $this->load->view('view_ventanas', $data); }
function dataedit() { $this->rapyd->load('dataobject', 'datadetails'); $do = new DataObject('edcont'); $do->pointer('scli', 'scli.cliente=edcont.cliente', 'scli.tipo AS sclitipo, scli.nombre AS nombre, dire11 AS direc, scli.rifci AS rifci', 'left'); //$do->pointer('edres' ,'edres.id=edcont.id_edres','scli.tipo AS sclitipo, scli.nombre AS edresnumero','left'); $do->rel_one_to_many('itedcont', 'itedcont', array('id' => 'id_edcont')); $do->order_rel_one_to_many('itedcont', 'id'); $edit = new DataDetails('', $do); /* $script= ' $(function() { $("#fecha").datepicker({dateFormat:"dd/mm/yy"}); $(".inputnum").numeric("."); $(".inputonlynum").numeric(); }); '; $edit->script($script,'modify'); $edit->script($script,'create'); */ $edit->on_save_redirect = false; $id = $edit->get_from_dataobjetct('id'); if ($id !== false) { $action = "javascript:window.location='" . site_url($this->url . 'formato/' . $id . '/contrato.xml') . "'"; $edit->button('btn_formato', 'Descargar formato', $action, 'TR'); } $status = $edit->get_from_dataobjetct('status'); if ($status == 'P') { $action = "javascript:window.location='" . site_url($this->url . 'actualizar/' . $id) . "'"; $edit->button('btn_actuali', 'Actualizar', $action, 'TR'); } //$edit->back_url = site_url($this->url.'filteredgrid'); $edit->post_process('insert', '_post_insert'); $edit->post_process('update', '_post_update'); $edit->post_process('delete', '_post_delete'); $edit->pre_process('insert', '_pre_insert'); $edit->pre_process('update', '_pre_update'); $edit->pre_process('delete', '_pre_delete'); $edit->id_edres = new inputField('Id_edres', 'id_edres'); $edit->id_edres->rule = 'max_length[11]|integer'; $edit->id_edres->css_class = 'inputonlynum'; $edit->id_edres->size = 13; $edit->id_edres->maxlength = 11; $edit->numero = new inputField('Número', 'numero'); $edit->numero->rule = 'max_length[8]'; $edit->numero->size = 10; $edit->numero->maxlength = 8; $edit->status = new dropdownField('Estatus', 'status'); $edit->status->option('P', 'Pendiente'); $edit->status->option('A', 'Aprobado'); $edit->status->style = 'width:180px;'; $edit->status->rule = 'max_length[1]'; $edit->status->when = array('show'); $edit->numero_edres = new inputField('Reservación', 'numero_edres'); $edit->numero_edres->rule = 'max_length[8]'; $edit->numero_edres->size = 10; $edit->numero_edres->maxlength = 8; $edit->numero = new inputField('Número', 'numero'); $edit->numero->size = 10; $edit->numero->maxlength = 8; $edit->numero->apply_rules = false; //necesario cuando el campo es clave y no se pide al usuario $edit->numero->when = array('show', 'modify'); $edit->fecha = new dateField('Fecha', 'fecha'); $edit->fecha->rule = 'chfecha'; $edit->fecha->size = 10; $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->maxlength = 8; $edit->fecha->calendar = false; $edit->cliente = new inputField('Cliente', 'cliente'); $edit->cliente->rule = 'max_length[5]|required'; $edit->cliente->size = 7; $edit->cliente->maxlength = 5; $edit->sclitipo = new hiddenField('', 'sclitipo'); $edit->sclitipo->db_name = 'sclitipo'; $edit->sclitipo->pointer = true; $edit->sclitipo->insertValue = 1; $edit->nombre = new inputField('Nombre', 'nombre'); $edit->nombre->size = 25; $edit->nombre->maxlength = 40; $edit->nombre->readonly = true; $edit->nombre->autocomplete = false; $edit->nombre->rule = 'required'; $edit->nombre->type = 'inputhidden'; $edit->nombre->pointer = true; $edit->rifci = new inputField('RIF/CI', 'rifci'); $edit->rifci->autocomplete = false; $edit->rifci->readonly = true; $edit->rifci->size = 15; $edit->rifci->type = 'inputhidden'; $edit->rifci->pointer = true; $edit->direc = new inputField('Dirección', 'direc'); $edit->direc->readonly = true; $edit->direc->size = 40; $edit->direc->type = 'inputhidden'; $edit->direc->pointer = true; $edit->edificacion = new dropdownField('Edificación', 'edificacion'); $edit->edificacion->option('', 'Seleccionar'); $edit->edificacion->options('SELECT id,TRIM(nombre) AS nombre FROM edif ORDER BY nombre'); $edit->edificacion->style = 'width:150px;'; $edit->edificacion->rule = 'max_length[11]|required'; $edit->inmueble = new dropdownField('Inmueble', 'inmueble'); $edit->inmueble->option('', 'Seleccionar'); $edif = $edit->getval('edificacion'); if ($edif !== false) { $dbedif = $this->db->escape($edif); $edit->inmueble->option('', 'Seleccionar'); $edit->inmueble->options("SELECT id,TRIM(descripcion) AS nombre FROM edinmue WHERE status='D' AND edificacion={$dbedif} ORDER BY descripcion"); } else { $edit->inmueble->option('', 'Seleccione una edificacion'); } $edit->inmueble->style = 'width:150px;'; $edit->inmueble->rule = 'max_length[11]|required'; $edit->reserva = new inputField('Reserva', 'reserva'); $edit->reserva->rule = 'max_length[17]|numeric'; $edit->reserva->css_class = 'inputnum'; $edit->reserva->size = 10; $edit->reserva->maxlength = 17; $edit->precioxmt2 = new inputField('Precio m2', 'precioxmt2'); $edit->precioxmt2->rule = 'max_length[17]|numeric|mayorcero|required'; $edit->precioxmt2->css_class = 'inputnum'; $edit->precioxmt2->size = 10; $edit->precioxmt2->maxlength = 17; $edit->precioxmt2->showformat = 'decimal'; $edit->mt2 = new inputField('Área m2', 'mt2'); $edit->mt2->rule = 'max_length[17]|numeric|mayorcero|required'; $edit->mt2->css_class = 'inputnum'; $edit->mt2->size = 7; $edit->mt2->maxlength = 17; $edit->mt2->showformat = 'decimal'; $edit->uso = new dropdownField('Uso', 'uso'); $edit->uso->option('', 'Seleccionar'); $edit->uso->options('SELECT id,uso FROM `eduso` ORDER BY uso'); $edit->uso->style = 'width:180px;'; $edit->uso->rule = 'required'; $edit->inicial = new inputField('Inicial', 'inicial'); $edit->inicial->rule = 'max_length[17]|numeric|mayorcero'; $edit->inicial->css_class = 'inputnum'; $edit->inicial->size = 19; $edit->inicial->maxlength = 17; $edit->inicial->showformat = 'decimal'; $edit->financiable = new inputField('Monto financiable', 'financiable'); $edit->financiable->rule = 'max_length[17]|numeric'; $edit->financiable->css_class = 'inputnum'; $edit->financiable->size = 19; $edit->financiable->maxlength = 17; $edit->financiable->showformat = 'decimal'; $edit->firma = new inputField('Pago final (firma)', 'firma'); $edit->firma->rule = 'max_length[17]|numeric|mayorcero'; $edit->firma->css_class = 'inputnum'; $edit->firma->size = 19; $edit->firma->type = 'inputhidden'; $edit->firma->maxlength = 17; $edit->firma->showformat = 'decimal'; $edit->monto = new inputField('Monto total', 'monto'); $edit->monto->rule = 'max_length[17]|numeric|mayorcero'; $edit->monto->css_class = 'inputnum'; $edit->monto->size = 19; $edit->monto->type = 'inputhidden'; $edit->monto->maxlength = 17; $edit->monto->showformat = 'decimal'; $edit->notas = new textareaField('Notas', 'notas'); $edit->notas->rule = 'max_length[8]'; $edit->notas->cols = 70; $edit->notas->rows = 4; //******************************* // Inicio del detalle //******************************* $edit->it_vencimiento = new dateField('Vencimiento <#o#>', 'it_vencimiento_<#i#>'); $edit->it_vencimiento->rule = 'chfecha|required'; $edit->it_vencimiento->size = 10; $edit->it_vencimiento->insertValue = date('Y-m-d'); $edit->it_vencimiento->db_name = 'vencimiento'; $edit->it_vencimiento->rel_id = 'itedcont'; $edit->it_vencimiento->maxlength = 8; $edit->it_vencimiento->calendar = false; $edit->it_especial = new dropdownField('Especial <#o#>', 'it_especial_<#i#>'); $edit->it_especial->rule = 'max_length[1]|enum[S,N]'; $edit->it_especial->db_name = 'especial'; $edit->it_especial->rel_id = 'itedcont'; $edit->it_especial->style = 'width:80px;'; $edit->it_especial->option('N', 'Normal'); $edit->it_especial->option('S', 'Especial'); $edit->it_monto = new inputField('Monto <#o#>', 'it_monto_<#i#>'); $edit->it_monto->rule = 'max_length[10]|numeric'; $edit->it_monto->db_name = 'monto'; $edit->it_monto->rel_id = 'itedcont'; //$edit->it_monto->on_keyup = 'totagiro()'; //$edit->it_monto->on_keyup ='distrib()'; $edit->it_monto->css_class = 'inputnum'; $edit->it_monto->size = 12; $edit->it_monto->maxlength = 10; $edit->it_monto->showformat = 'decimal'; //****************************** // Fin del detalle //****************************** if ($status != 'A') { $edit->buttons('modify', 'delete', 'add_rel'); //$edit->buttons('modify', 'save', 'undo', 'delete','add_rel'); } //$edit->buttons('back', 'add'); $edit->build(); if ($edit->on_success()) { $rt = array('status' => 'A', 'mensaje' => 'Registro guardado', 'pk' => $edit->_dataobject->pk); echo json_encode($rt); } else { $conten['form'] =& $edit; $data['content'] = $this->load->view('view_edcont', $conten, false); //$data['content'] = $this->load->view('view_edcont', $conten,true); //echo $edit->output; } /* $conten['form'] =& $edit; $data['content'] = $this->load->view('view_edcont', $conten,true); $data['title'] = heading($this->t**s); $data['head'] = $this->rapyd->get_head(); $data['head'] .= script('jquery.js'); $data['head'] .= script('jquery-ui.js'); $data['head'] .= script('plugins/jquery.numeric.pack.js'); $data['head'] .= script('plugins/jquery.floatnumber.js'); $data['head'] .= script('plugins/jquery.meiomask.js'); $data['head'] .= phpscript('nformat.js'); $data['head'] .= style('redmond/jquery-ui-1.8.1.custom.css'); $this->load->view('view_ventanas', $data); */ }
function asig_part() { $this->datasis->modulo_id('116', 1); $this->rapyd->load('dataobject', 'datadetails'); $link = site_url('presupuesto/requisicion/getadmin'); $partidaiva = $this->datasis->traevalor('PARTIDAIVA'); $modbus = array('tabla' => 'v_presaldo', 'columnas' => array('codigo' => 'Código', 'ordinal' => 'Ord', 'denominacion' => 'Denominación', 'saldo' => 'Saldo'), 'filtro' => array('codigo' => 'Código', 'denominacion' => 'Denominación'), 'retornar' => array('codigo' => 'partida_<#i#>'), 'p_uri' => array(4 => '<#i#>', 5 => '<#fondo#>', 6 => '<#estadmin#>'), 'where' => 'fondo = <#fondo#> AND codigoadm = <#estadmin#> AND movimiento = "S" AND saldo > 0', 'titulo' => 'Busqueda de partidas'); $btn = $this->datasis->p_modbus($modbus, '<#i#>/<#fondo#>/<#estadmin#>'); $do = new DataObject("requi"); $do->rel_one_to_many('itrequi', 'itrequi', array('numero' => 'numero')); $do = new DataObject("requi"); $do->rel_one_to_many('itrequi', 'itrequi', array('numero' => 'numero')); $edit = new DataDetails("Datos de la Requisición", $do); $edit->back_url = site_url("presupuesto/requisicion/filteredgrid2"); $edit->set_rel_title('itrequi', 'Rubro <#o#>'); $edit->makerel = false; $edit->post_process('insert', '_post_insert'); $edit->post_process('update', '_post_update'); $edit->post_process('delete', '_post_delete'); $edit->numero = new inputField("Número", "numero"); $edit->numero->mode = "autohide"; $edit->numero->when = array('show'); $edit->fecha = new dateonlyField("Fecha", "fecha"); $edit->fecha->size = 12; $edit->fecha->mode = "autohide"; $edit->responsable = new inputField("Responsable", "responsable"); $edit->responsable->size = 50; $edit->responsable->mode = "autohide"; $edit->objetivo = new textareaField("Objetivo", "objetivo"); $edit->objetivo->rows = 4; $edit->objetivo->cols = 100; $edit->objetivo->mode = "autohide"; $edit->objetivo->rule = "required"; $edit->estadmin = new dropdownField("Estructura Administrativa", "estadmin"); $edit->estadmin->option("", "Seleccione"); $edit->estadmin->rule = 'required'; $edit->estadmin->options("SELECT b.codigo, CONCAT_WS(' ',b.codigo,b.denominacion) AS val FROM presupuesto AS a JOIN estruadm AS b ON a.codigoadm=b.codigo GROUP BY b.codigo"); $edit->fondo = new dropdownField("Fondo", "fondo"); $edit->fondo->rule = "required"; $estadmin = $edit->getval('estadmin'); if ($estadmin !== false) { $edit->fondo->options("SELECT tipo,tipo a FROM presupuesto WHERE codigoadm='{$estadmin}' GROUP BY tipo"); } else { $edit->fondo->option("", "Seleccione una estructura administrativa primero"); } $edit->uejecuta = new dropdownField("U.Ejecutora", "uejecuta"); $edit->uejecuta->option("", "Seccionar"); $edit->uejecuta->options("SELECT codigo,nombre FROM uejecutora ORDER BY nombre"); $edit->uejecuta->onchange = "get_uadmin();"; $edit->uejecuta->rule = "required"; //$edit->uejecuta->readonly = true; $edit->uejecuta->mode = "autohide"; $edit->uadministra = new dropdownField("U.Administrativa", "uadministra"); $edit->uadministra->option("", "Ninguna"); $edit->uadministra->mode = "autohide"; $ueje = $edit->getval('uejecuta'); if ($ueje !== false) { $edit->uadministra->options("SELECT codigo,nombre FROM uadministra WHERE codigoejec='{$ueje}' ORDER BY nombre"); } else { $edit->uadministra->option("", "Seleccione una unidad ejecutora primero"); } $edit->tcantidad = new inputField("Total", "tcantidad"); $edit->tcantidad->size = 50; //$edit->tcantidad->readonly = true; $edit->tcantidad->mode = "autohide"; $edit->timporte = new inputField("Importe", "timporte"); $edit->timporte->size = 50; //$edit->timporte->readonly = true; $edit->timporte->mode = "autohide"; $edit->itunidad = new inputField("Unidad", "itunidad_<#i#>"); $edit->itunidad->db_name = 'unidad'; $edit->itunidad->rel_id = 'itrequi'; $edit->itunidad->size = 10; $edit->itunidad->readonly = true; //$edit->itunidad->mode="autohide"; $edit->itdescrip = new inputField("(<#o#>) Descripcion", "descrip_<#i#>"); $edit->itdescrip->size = 15; $edit->itdescrip->db_name = 'descrip'; $edit->itdescrip->rel_id = 'itrequi'; $edit->itdescrip->readonly = true; //$edit->itdescrip->mode="autohide"; $edit->itcantidad = new inputField("(<#o#>) Cantidad", "cantidad_<#i#>"); $edit->itcantidad->db_name = 'cantidad'; $edit->itcantidad->rel_id = 'itrequi'; $edit->itcantidad->size = 8; $edit->itcantidad->readonly = true; //$edit->itcantidad->mode="autohide"; $edit->itprecio = new inputField("(<#o#>) Precio", "precio_<#i#>"); $edit->itprecio->db_name = 'precio'; $edit->itprecio->rel_id = 'itrequi'; $edit->itprecio->size = 8; $edit->itprecio->readonly = true; //$edit->itprecio->mode="autohide"; $edit->itimporte = new inputField("(<#o#>) Importe", "importe_<#i#>"); $edit->itimporte->db_name = 'importe'; $edit->itimporte->rel_id = 'itrequi'; $edit->itimporte->size = 8; $edit->itimporte->readonly = true; //$edit->itimporte->mode = "autohide"; $edit->itpartida = new inputField("(<#o#>) Partida", "partida_<#i#>"); $edit->itpartida->rule = 'callback_itpartida'; $edit->itpartida->db_name = 'partida'; $edit->itpartida->rel_id = 'itrequi'; //$edit->itpartida->mode = 'autohide'; $edit->itpartida->size = 15; //$edit->itpartida->append($btn); $edit->itpartida->append('<img src="/tortuga/assets/default/images/system-search.png" alt="Busqueda de partidas" title="Busqueda de partidas" border="0" onclick="modbusdepen(<#i#>)"/>'); //Termina el detalle $status = $edit->get_from_dataobjetct('status'); if ($status != 'X') { $edit->buttons("modify", "save", "undo", "delete", "back"); } else { $edit->buttons("undo", "back"); } $edit->build(); $smenu['link'] = barra_menu('116'); $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true); $conten["form"] =& $edit; $data['content'] = $this->load->view('view_asig_part', $conten, true); //$data['content'] = $edit->output; $data['title'] = " Clasificación "; $data["head"] = $this->rapyd->get_head() . script('jquery.js') . script("plugins/jquery.numeric.pack.js"); $this->load->view('view_ventanas', $data); }
function dataedit() { $this->rapyd->load('dataobject', 'datadetails'); //SELECT a.codigopres, CONCAT_WS("-",a.codigopres,b.denominacion) AS val FROM presupuesto AS a JOIN ppla AS b ON a.codigopres=b.codigo WHERE tipo=<#fondo#> AND codigoadm=<#estadmin#> AND LENGTH(a.codigopres)='.$this->flongpres $partidaiva = $this->datasis->traevalor('PARTIDAIVA'); $modbus = array('tabla' => 'v_presaldo', 'columnas' => array('codigoadm' => 'Est. Admin', 'fondo' => 'Fondo', 'codigo' => 'Partida', 'ordinal' => 'Ordinal', 'denominacion' => 'Denominación', 'saldo' => 'Saldo'), 'filtro' => array('codigoadm' => 'Est. Admin', 'fondo' => 'Fondo', 'codigo' => 'Partida', 'ordinal' => 'Ord', 'denominacion' => 'Denominación'), 'retornar' => array('codigoadm' => 'codigoadm_<#i#>', 'fondo' => 'fondo_<#i#>', 'codigo' => 'codigopres_<#i#>', 'ordinal' => 'ordinal_<#i#>', 'denominacion' => 'denomi_<#i#>'), 'where' => 'movimiento = "S"', 'p_uri' => array(4 => '<#i#>'), 'titulo' => 'Busqueda de partidas'); $btn = $this->datasis->p_modbus($modbus, '<#i#>'); $do = new DataObject("audis"); $do->rel_one_to_many('itaudis', 'itaudis', array('numero' => 'numero')); $do->rel_pointer('itaudis', 'v_presaldo', 'itaudis.codigoadm=v_presaldo.codigoadm AND itaudis.fondo=v_presaldo.fondo AND itaudis.codigopres=v_presaldo.codigo', "v_presaldo.denominacion as denomi2"); $do->order_by('itaudis', 'itaudis.id', 'asc'); $edit = new DataDetails("Datos de Aumentos y Disminuciones", $do); $edit->back_url = site_url("presupuesto/audis/filteredgrid"); $edit->pre_process('update', '_pre_process'); $edit->pre_process('delete', '_pre_process'); $edit->set_rel_title('itaudis', 'Rubro <#o#>'); $edit->pre_process('update', '_valida'); $edit->pre_process('insert', '_valida'); $edit->status = new autoupdateField('status', 'P'); $edit->status->apply_rules = true; $edit->status->rule = 'callback_chstatus'; $edit->numero = new inputField("Número", "numero"); $edit->numero->mode = "autohide"; $edit->numero->when = array('show'); $edit->nrooficio = new inputField("Número de Decreto", "nrooficio"); $edit->nrooficio->size = 12; $edit->resolu = new inputField("Resolución", "resolu"); $edit->resolu->size = 40; $edit->fresolu = new dateonlyField("Fecha Resolución", "fresolu"); $edit->fresolu->insertValue = date('Y-m-d'); $edit->fresolu->size = 12; $edit->tipo = new dropdownField("Tipo", "tipo"); $edit->tipo->option("AUMENTO", "Aumento"); $edit->tipo->option("DISMINUCION", "Disminución"); $edit->fecha = new dateonlyField("Fecha", "fecha"); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->size = 12; $edit->motivo = new textareaField("Motivo", "motivo"); $edit->motivo->rows = 4; $edit->motivo->cols = 100; $edit->motivo->rule = 'required'; $edit->uejecutora = new dropdownField("U.Ejecutora", "uejecutora"); $edit->uejecutora->option("", "Seccionar"); $edit->uejecutora->options("SELECT codigo,nombre FROM uejecutora ORDER BY nombre"); $edit->uejecutora->onchange = "get_uadmin();"; $edit->uejecutora->rule = "required"; $edit->uadministra = new dropdownField("U.Administrativa", "uadministra"); $edit->uadministra->option("", "Ninguna"); $ueje = $edit->getval('uejecuta'); if ($ueje !== false) { $edit->uadministra->options("SELECT codigo,nombre FROM uadministra WHERE codigoejec='{$ueje}' ORDER BY nombre"); } else { $edit->uadministra->option("", "Seleccione una unidad ejecutora primero"); } $edit->fondo = new dropdownField("Fondo", "fondo_<#i#>"); $edit->fondo->size = 10; $edit->fondo->rule = 'required'; $edit->fondo->db_name = 'fondo'; $edit->fondo->rel_id = 'itaudis'; $edit->fondo->options("SELECT tipo,tipo a FROM presupuesto WHERE tipo<>'' GROUP BY tipo ORDER BY tipo desc"); //$edit->fondo->options("SELECT fondo,fondo a FROM fondo GROUP BY fondo ORDER BY fondo desc"); $edit->fondo->style = "width:100px;"; $edit->codigoadm = new inputField("Estructura\tAdministrativa", "codigoadm_<#i#>"); $edit->codigoadm->size = 10; $edit->codigoadm->db_name = 'codigoadm'; $edit->codigoadm->rel_id = 'itaudis'; $edit->codigoadm->rule = 'required'; $edit->codigopres = new inputField("(<#o#>) Partida", "codigopres_<#i#>"); $edit->codigopres->rule = 'callback_repetido|required'; $edit->codigopres->size = 10; $edit->codigopres->append($btn); $edit->codigopres->db_name = 'codigopres'; $edit->codigopres->rel_id = 'itaudis'; $edit->codigopres->insertValue = "4"; //$edit->partida->readonly =true; $edit->denomi = new inputField("(<#o#>) Denominación", "denomi_<#i#>"); $edit->denomi->db_name = 'denomi2'; $edit->denomi->rel_id = 'itaudis'; $edit->denomi->cols = 20; $edit->denomi->rows = 1; $edit->denomi->readonly = true; $edit->denomi->pointer = true; $edit->monto = new inputField("(<#o#>) monto", "monto_<#i#>"); $edit->monto->rule = 'required|callback_positivo'; $edit->monto->db_name = 'monto'; $edit->monto->rel_id = 'itaudis'; $edit->monto->size = 15; $edit->monto->css_class = 'inputnum'; $edit->monto->onchange = 'cal_total(<#i#>);'; $edit->total = new inputField("Cantidad total", "total"); $edit->total->css_class = 'inputnum'; $edit->total->readonly = true; $edit->total->rule = 'numeric'; $edit->total->size = 15; $status = $edit->get_from_dataobjetct('status'); if ($status == 'P') { $action = "javascript:window.location='" . site_url('presupuesto/audis/actualizar/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_status", 'Actualizar', $action, "TR", "show"); $edit->buttons("modify", "delete", "save"); } elseif ($status == 'C') { $action = "javascript:window.location='" . site_url('presupuesto/audis/reversar/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_rever", 'Anular', $action, "TR", "show"); } else { $edit->buttons("save"); } $edit->buttons("add", "undo", "back", "add_rel"); $edit->build(); $smenu['link'] = barra_menu('330'); $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true); $conten["form"] =& $edit; $data['content'] = $this->load->view('view_audis', $conten, true); //$data['content'] = $edit->output; $data['title'] = "Aumentos y Disminuciones"; //$data["head"] = $this->rapyd->get_head().script('jquery.js').script("plugins/jquery.numeric.pack.js").script('plugins/jquery.autocomplete.js').script('plugins/jquery.meiomask.js').style('jquery.autocomplete.css'); $data["head"] = $this->rapyd->get_head() . script('jquery.js') . script('jquery-ui.js') . script("plugins/jquery.numeric.pack.js") . script('plugins/jquery.meiomask.js') . style('vino/jquery-ui.css'); $this->load->view('view_ventanas', $data); }
function dataedit($status = '', $id = '') { $this->rapyd->load('dataedit', 'datadetails'); $modbus = array('tabla' => 'sinv', 'columnas' => array('codigo' => 'Código', 'descrip' => 'Descripción', 'precio1' => 'Precio 1', 'precio2' => 'Precio 2', 'precio3' => 'Precio 3', 'existen' => 'Existencia'), 'filtro' => array('codigo' => 'Código', 'descrip' => 'Descripción'), 'retornar' => array(array('codigo' => 'itcodigo_<#i#>'), array('descrip' => 'itdescrip_<#i#>'), array('descrip' => 'itdescrip_<#i#>_val'), array('formcal' => 'itformcal_<#i#>'), array('ultimo' => 'itultimo_<#i#>_val'), array('ultimo' => 'itultimo_<#i#>'), array('pond' => 'itpond_<#i#>'), array('pond' => 'itpond_<#i#>_val'), array('base1' => 'itprecio1_<#i#>')), 'p_uri' => array(4 => '<#i#>'), 'titulo' => 'Buscar Articulo', 'where' => '`activo` = "S"', 'script' => array('totalizarcombo()')); $bSINV_C = $this->datasis->p_modbus($modbus, '<#i#>'); $modbus = array('tabla' => 'sinv', 'columnas' => array('codigo' => 'Código', 'descrip' => 'Descripción', 'precio1' => 'Precio 1', 'precio2' => 'Precio 2', 'precio3' => 'Precio 3', 'existen' => 'Existencia'), 'filtro' => array('codigo' => 'Código', 'descrip' => 'Descripción'), 'retornar' => array(array('codigo' => 'it2codigo_<#i#>'), array('descrip' => 'it2descrip_<#i#>'), array('descrip' => 'it2descrip_<#i#>_val'), array('formcal' => 'it2formcal_<#i#>'), array('ultimo' => 'it2ultimo_<#i#>'), array('pond' => 'it2pond_<#i#>'), array('id' => 'it2id_sinv_<#i#>')), 'p_uri' => array(4 => '<#i#>'), 'titulo' => 'Buscar Articulo', 'where' => '`activo` = "S"', 'script' => array('totalizarpitem()')); $bSINV_I = $this->datasis->p_modbus($modbus, '<#i#>', 800, 600, 'sinv_i'); $do = new DataObject('sinv'); $do->pointer('grup', 'grup.grupo=sinv.grupo', 'grup.grupo AS grupgrupo', 'left'); $do->pointer('line', 'line.linea=grup.linea', 'line.linea AS linelinea', 'left'); $do->pointer('dpto', 'dpto.depto=line.depto', 'dpto.depto AS dptodepto', 'left'); $do->pointer('sinv AS csinv', 'csinv.codigo=sinv.enlace', 'csinv.formcal AS cformcal,csinv.pond AS cpond,csinv.ultimo AS cultimo,csinv.descrip AS cdescrip,csinv.base1 AS cbase1,csinv.base2 AS cbase2,csinv.base3 AS cbase3,csinv.base4 AS cbase4', 'left'); $do->rel_one_to_many('sinvcombo', 'sinvcombo', array('codigo' => 'combo')); $do->rel_one_to_many('sinvpitem', 'sinvpitem', array('codigo' => 'producto')); $do->rel_one_to_many('sinvplabor', 'sinvplabor', array('codigo' => 'producto')); $do->rel_pointer('sinvcombo', 'sinv AS p', 'p.codigo=sinvcombo.codigo', 'p.descrip AS sinvdescrip,p.pond AS sinvpond,p.ultimo sinvultimo,p.formcal sinvformcal,p.precio1 sinvprecio1'); if ($status == 'create' && !empty($id)) { $do->load($id); $do->set('codigo', ''); $do->set('alterno', ''); } $edit = new DataDetails('', $do); $edit->on_save_redirect = false; $edit->pre_process('insert', '_pre_insert'); $edit->pre_process('update', '_pre_update'); $edit->pre_process('delete', '_pre_del'); $edit->post_process('insert', '_post_insert'); $edit->post_process('update', '_post_update'); $edit->post_process('delete', '_post_delete'); $ultimo = '<a href="javascript:ultimo();" title="Consultar ultimo código ingresado">Último</a>'; $sugerir = '<a href="javascript:sugerir();" title="Sugerir un código aleatorio">Sugerir</a>'; $edit->codigo = new inputField('Código', 'codigo'); $edit->codigo->size = 15; $edit->codigo->maxlength = 15; $edit->codigo->rule = 'alpha_dash_slash|trim|strtoupper|callback_chexiste'; $edit->codigo->mode = 'autohide'; $edit->codigo->append($sugerir); //$edit->codigo->append($ultimo); $edit->alterno = new inputField('Alterno', 'alterno'); $edit->alterno->size = 15; $edit->alterno->maxlength = 15; $edit->alterno->rule = 'trim|strtoupper|callback_chalterno'; $edit->enlace = new inputField('Caja', 'enlace'); $edit->enlace->size = 15; $edit->enlace->maxlength = 15; $edit->enlace->rule = 'trim|condi_required|callback_chenlace'; $edit->cdescrip = new inputField('', 'cdescrip'); $edit->cdescrip->pointer = true; $edit->cdescrip->db_name = 'cdescrip'; $edit->cdescrip->type = 'inputhidden'; $edit->aumento = new inputField('Aumento %', 'aumento'); $edit->aumento->css_class = 'inputnum'; $edit->aumento->size = 5; $edit->aumento->maxlength = 6; $edit->aumento->rule = 'condi_required|callback_chobligafraccion'; $edit->aumento->autocomplete = false; //$edit->aumento->append('Solo si es fracción'); $edit->maxven = new inputField('Venta máxima', 'maxven'); $edit->maxven->css_class = 'inputnum'; $edit->maxven->insertValue = '0'; $edit->maxven->size = 6; $edit->maxven->rule = 'numeric'; $edit->maxven->autocomplete = false; $edit->minven = new inputField('Venta mínima', 'minven'); $edit->minven->css_class = 'inputnum'; $edit->minven->insertValue = '0'; $edit->minven->size = 6; $edit->minven->rule = 'numeric|callback_chminven'; $edit->minven->autocomplete = false; $edit->barras = new inputField('Código Barras', 'barras'); $edit->barras->size = 15; $edit->barras->maxlength = 15; $edit->barras->rule = 'trim|unique'; $edit->tipo = new dropdownField('Tipo', 'tipo'); $edit->tipo->style = 'width:100px;'; $edit->tipo->option('Articulo', 'Artículo'); $edit->tipo->option('Servicio', 'Servicio'); $edit->tipo->option('Descartar', 'Descartar'); $edit->tipo->option('Fraccion', 'Fracción'); $edit->tipo->option('Lote', 'Lote'); $edit->tipo->option('Combo', 'Combo'); $edit->tipo->rule = 'callback_chtipo'; $AddUnidad = '<a href="javascript:add_unidad();" title="Haz clic para Agregar una unidad nueva">' . image('list_plus.png', 'Agregar', array("border" => "0")) . '</a>'; $edit->unidad = new dropdownField('Unidad', 'unidad'); $edit->unidad->style = 'width:100px;'; $edit->unidad->option('', 'Seleccionar'); $edit->unidad->options('SELECT unidades, unidades AS valor FROM unidad ORDER BY unidades'); $edit->unidad->append($AddUnidad); $edit->clave = new inputField('Clave', 'clave'); $edit->clave->size = 10; $edit->clave->maxlength = 8; $edit->clave->rule = 'trim|strtoupper'; $edit->ubica = new dropdownField('Ubicación', 'ubica'); $edit->ubica->size = 9; $edit->ubica->option('', 'Seleccionar'); $edit->ubica->options('SELECT ubica, CONCAT(ubica,\'-\',descrip) descrip FROM sinvubica ORDER BY ubica'); $edit->ubica->style = 'width:100px;white-space:nowrap;'; // $edit->ubica->maxlength=9; // $edit->ubica->rule = 'trim|strtoupper'; $AddDepto = '<a href="javascript:add_depto();" title="Haz clic para Agregar un nuevo Departamento">' . image('list_plus.png', 'Agregar', array("border" => "0")) . '</a>'; $edit->depto = new dropdownField('Departamento', 'depto'); $edit->depto->rule = 'required'; $edit->depto->style = 'width:230px;white-space:nowrap;'; $edit->depto->option('', 'Seleccione un Departamento'); $edit->depto->options('SELECT depto, CONCAT(depto,\'-\',descrip) descrip FROM dpto WHERE tipo=\'I\' ORDER BY depto'); $edit->depto->db_name = 'dptodepto'; $edit->depto->pointer = true; $AddLinea = '<a href="javascript:add_linea();" title="Haz clic para Agregar una nueva Linea;">' . image('list_plus.png', 'Agregar', array("border" => "0")) . '</a>'; $edit->linea = new dropdownField('Línea', 'linea'); $edit->linea->rule = 'required'; $edit->linea->style = 'width:230px;'; $edit->linea->db_name = 'linelinea'; $edit->linea->pointer = true; $depto = $edit->getval('depto'); if ($depto !== false) { $dbdepto = $this->db->escape($depto); $edit->linea->options("SELECT linea, CONCAT(LINEA,'-',descrip) descrip FROM line WHERE depto={$dbdepto} ORDER BY descrip"); } else { $edit->linea->option('', 'Seleccione un Departamento primero'); } $AddGrupo = '<a href="javascript:add_grupo();" title="Haz clic para Agregar un nuevo Grupo;">' . image('list_plus.png', 'Agregar', array("border" => "0")) . '</a>'; $edit->grupo = new dropdownField('Grupo', 'grupo'); $edit->grupo->rule = 'required'; $edit->grupo->style = 'width:230px;'; $linea = $edit->getval('linea'); if ($linea !== false) { $dblinea = $this->db->escape($linea); $edit->grupo->options("SELECT grupo, CONCAT(grupo,'-',nom_grup) nom_grup FROM grup WHERE linea={$dblinea} ORDER BY nom_grup"); } else { $edit->grupo->option('', 'Seleccione un Departamento primero'); } $edit->comision = new inputField('Comisión %', 'comision'); $edit->comision->size = 7; $edit->comision->maxlength = 5; $edit->comision->css_class = 'inputnum'; $edit->comision->rule = 'numeric|callback_positivo|trim'; $edit->fracci = new inputField('Cant. X Empaque', 'fracci'); $edit->fracci->size = 10; $edit->fracci->maxlength = 4; $edit->fracci->css_class = 'inputnum'; $edit->fracci->rule = 'condi_required|trim|callback_chobligafraccion'; $edit->fracci->insertValue = '1'; $edit->activo = new dropdownField('Activo', 'activo'); $edit->activo->style = 'width:50px;'; $edit->activo->option('S', 'Si'); $edit->activo->option('N', 'No'); $edit->serial2 = new freeField('', 'free', 'Serial'); $edit->serial2->in = 'activo'; $edit->serial = new dropdownField('Usa Seriales', 'serial'); $edit->serial->style = 'width:80px;'; $edit->serial->option('N', 'No'); $edit->serial->option('S', 'Si'); $edit->serial->option('V', 'Vehicular'); $edit->serial->in = 'activo'; $edit->premin = new dropdownField('Precio Mínimo', 'premin'); $edit->premin->style = 'width:100px;'; $edit->premin->option('0', 'Todos'); $edit->premin->option('2', 'Precio 2'); $edit->premin->option('3', 'Precio 3'); $edit->premin->option('4', 'Precio 4'); $edit->vnega = new dropdownField('Venta Negativa', 'vnega'); $edit->vnega->style = 'width:60px;'; $edit->vnega->option('S', 'Si'); $edit->vnega->option('N', 'No'); $edit->tdecimal2 = new freeField('', 'free', 'Usa Decimales'); $edit->tdecimal2->in = 'activo'; $edit->tdecimal = new dropdownField('Usa Decimales', 'tdecimal'); $edit->tdecimal->style = 'width:80px;'; $edit->tdecimal->option('N', 'No'); $edit->tdecimal->option('S', 'Si'); $edit->tdecimal->in = 'activo'; $edit->descrip = new inputField('Descripción', 'descrip'); $edit->descrip->size = 45; $edit->descrip->maxlength = 45; $edit->descrip->rule = 'trim|required'; $edit->descrip2 = new inputField('Descripción adicional', 'descrip2'); $edit->descrip2->size = 45; $edit->descrip2->maxlength = 45; $edit->descrip2->rule = 'trim'; $edit->url = new inputField('Sitio Web', 'url'); $edit->url->size = 80; $edit->url->maxlength = 200; $edit->ficha = new textareaField('Ficha Tecnica', 'ficha'); $edit->ficha->rule = 'trim'; $edit->ficha->cols = 85; $edit->ficha->rows = 9; $edit->peso = new inputField('Peso Bruto', 'peso'); $edit->peso->size = 10; $edit->peso->maxlength = 12; $edit->peso->css_class = 'inputnum'; $edit->peso->rule = 'numeric|callback_positivo'; $edit->peso->insertValue = 0; $edit->pesoneto = new inputField('Peso Neto', 'pesoneto'); $edit->pesoneto->size = 10; $edit->pesoneto->maxlength = 12; $edit->pesoneto->css_class = 'inputnum'; $edit->pesoneto->rule = 'numeric|callback_positivo'; $edit->pesoneto->insertValue = '0'; $edit->alto = new inputField('Alto', 'alto'); $edit->alto->size = 10; $edit->alto->maxlength = 12; $edit->alto->css_class = 'inputnum'; $edit->alto->rule = 'numeric|callback_positivo'; $edit->alto->insertValue = 0; $edit->ancho = new inputField('Ancho', 'ancho'); $edit->ancho->size = 10; $edit->ancho->maxlength = 12; $edit->ancho->css_class = 'inputnum'; $edit->ancho->rule = 'numeric|callback_positivo'; $edit->ancho->insertValue = 0; $edit->largo = new inputField('Largo', 'largo'); $edit->largo->size = 10; $edit->largo->maxlength = 12; $edit->largo->css_class = 'inputnum'; $edit->largo->rule = 'numeric|callback_positivo'; $edit->largo->insertValue = 0; $edit->garantia = new inputField('Garantia', 'garantia'); $edit->garantia->size = 9; $edit->garantia->maxlength = 3; $edit->garantia->css_class = 'inputonlynum'; $edit->garantia->rule = 'numeric|callback_positivo'; $edit->garantia->insertValue = 0; $edit->marca = new dropdownField('Marca', 'marca'); $edit->marca->rule = 'required'; $edit->marca->style = 'width:180px;'; $edit->marca->option('', 'Seleccionar'); $edit->marca->options('SELECT marca AS codigo, marca FROM marc ORDER BY marca'); $edit->modelo = new inputField('Modelo', 'modelo'); $edit->modelo->size = 20; $edit->modelo->maxlength = 20; $edit->modelo->rule = 'trim|strtoupper'; $edit->clase = new dropdownField('Clase', 'clase'); $edit->clase->style = 'width:100px;'; $edit->clase->db_name = 'a.clase'; $edit->clase->clause = 'where'; $edit->clase->operator = '='; $edit->clase->option('', 'Seleccionar'); $edit->clase->options('SELECT codigo,CONCAT_WS("-",codigo,descrip) AS val FROM sinvclase ORDER BY codigo'); $ivas = $this->datasis->ivaplica(); $edit->iva = new dropdownField('IVA %', 'iva'); foreach ($ivas as $tasa => $ivamonto) { $edit->iva->option($ivamonto, nformat($ivamonto)); } $edit->iva->style = 'width:100px;'; $edit->iva->insertValue = $ivas['tasa']; $edit->iva->onchange = 'calculos(\'S\');'; $edit->exento = new dropdownField('Vender Exento', 'exento'); $edit->exento->style = 'width:50px;'; $edit->exento->option('N', 'No'); $edit->exento->option('E', 'Si'); $edit->dolar = new inputField('Precio en $', 'dolar'); $edit->dolar->css_class = 'inputnum'; $edit->dolar->size = 10; $edit->dolar->maxlength = 13; $edit->dolar->autocomplete = false; $edit->dolar->insertValue = 0; $edit->margenu = new inputField('Margen Unico', 'margenu'); $edit->margenu->css_class = 'inputnum'; $edit->margenu->size = 10; $edit->margenu->maxlength = 13; $edit->margenu->autocomplete = false; $edit->margenu->insertValue = 0; $edit->ultimo = new inputField('Último', 'ultimo'); $edit->ultimo->css_class = 'inputnum'; $edit->ultimo->size = 10; $edit->ultimo->maxlength = 13; $edit->ultimo->onkeyup = 'calculos(\'S\');'; $edit->ultimo->rule = 'required|mayorcero'; $edit->ultimo->autocomplete = false; $edit->pond = new inputField('Promedio', 'pond'); $edit->pond->css_class = 'inputnum'; $edit->pond->size = 10; $edit->pond->maxlength = 13; $edit->pond->onkeyup = 'calculos(\'S\');'; $edit->pond->rule = 'required|mayorcero'; $edit->pond->autocomplete = false; //Para el caso de las fraccciones $edit->cultimo = new hiddenField('', 'cultimo'); $edit->cultimo->pointer = true; $edit->cultimo->db_name = 'cultimo'; $edit->cpond = new hiddenField('', 'cpond'); $edit->cpond->pointer = true; $edit->cpond->db_name = 'cpond'; $edit->standard = new inputField('Estandar', 'standard'); $edit->standard->css_class = 'inputnum'; $edit->standard->size = 10; $edit->standard->maxlength = 13; $edit->standard->insertValue = 0; $edit->standard->autocomplete = false; $edit->formcal = new dropdownField('Base Cálculo', 'formcal'); $edit->formcal->style = 'width:110px;'; $edit->formcal->rule = 'required|enum[U,P,M,S]'; $edit->formcal->option('U', 'Ultimo'); $edit->formcal->option('P', 'Promedio'); $edit->formcal->option('M', 'Mayor'); $edit->formcal->option('S', 'Standard'); $edit->formcal->insertValue = 'U'; $edit->formcal->onchange = 'requeridos();calculos(\'S\');'; $edit->cformcal = new hiddenField('', 'cformcal'); $edit->cformcal->pointer = true; $edit->cformcal->db_name = 'cformcal'; $edit->redecen = new dropdownField('Redondear', 'redecen'); $edit->redecen->style = 'width:110px;'; $edit->redecen->option('N', 'No Cambiar'); $edit->redecen->option('M', 'Solo un Decimal'); $edit->redecen->option('F', 'Sin Decimales'); $edit->redecen->option('D', 'Decenas'); $edit->redecen->option('C', 'Centenas'); $edit->redecen->rule = 'enum[N,M,F,D,C]'; $edit->redecen->insertValue = 'N'; $edit->redecen->onchange = 'calculos(\'S\');'; $edit->servidor = new dropdownField('Registrar quien o que presta o fabrica este servicio', 'servidor'); $edit->servidor->style = 'width:45px;'; $edit->servidor->option('N', 'No'); $edit->servidor->option('S', 'Si'); $edit->servidor->insertValue = 'N'; //$edit->servidor->rule='enum[N,S]'; $edit->servidor->title = 'Activar si este item es instalado o realizado por alguien o utiliza algun recurso'; $edit->linfe = new dropdownField('Limitar ventas', 'linfe'); $edit->linfe->style = 'width:45px;'; $edit->linfe->option('N', 'No'); $edit->linfe->option('S', 'Si'); $edit->linfe->insertValue = 'N'; $edit->linfe->rule = 'enum[N,S]|callback_chlinfe'; $edit->linfe->title = 'Activar si desea evitar que este producto no sea vendido a la misma persona en un período de días'; $edit->lindia = new inputField('Días limite', 'lindia'); $edit->lindia->css_class = 'inputnum'; $edit->lindia->size = 3; $edit->lindia->maxlength = 5; $edit->lindia->rule = 'numeric'; $edit->lindia->insertValue = '0'; $edit->lindia->autocomplete = false; $edit->lincan = new inputField('Cantidad Limite', 'lincan'); $edit->lincan->css_class = 'inputnum'; $edit->lincan->size = 3; $edit->lincan->maxlength = 5; $edit->lincan->rule = 'numeric'; $edit->lincan->insertValue = '0'; $edit->lincan->autocomplete = false; $maxiss = 4; for ($i = 1; $i <= $maxiss; $i++) { $objeto = "margen{$i}"; $edit->{$objeto} = new inputField("Margen {$i}", $objeto); $edit->{$objeto}->css_class = 'inputnum'; $edit->{$objeto}->size = 10; $edit->{$objeto}->maxlength = 6; $edit->{$objeto}->onkeyup = 'calculos(\'I\');'; $edit->{$objeto}->autocomplete = false; $edit->{$objeto}->rule = 'required'; $edit->{$objeto}->tabindex = $i; $objeto = "base{$i}"; $edit->{$objeto} = new inputField("Base {$i}", $objeto); $edit->{$objeto}->css_class = 'inputnum'; $edit->{$objeto}->size = 10; $edit->{$objeto}->maxlength = 13; $edit->{$objeto}->autocomplete = false; $edit->{$objeto}->in = "margen{$i}"; $edit->{$objeto}->onkeyup = 'cambiobase(\'I\');'; $edit->{$objeto}->rule = 'required|mayorcero'; $edit->{$objeto}->tabindex = $i + $maxiss; $objeto = "precio{$i}"; $edit->{$objeto} = new inputField("Precio {$i}", $objeto); $edit->{$objeto}->css_class = 'inputnum'; $edit->{$objeto}->size = 10; $edit->{$objeto}->autocomplete = false; $edit->{$objeto}->maxlength = 13; $edit->{$objeto}->in = "margen{$i}"; $edit->{$objeto}->onkeyup = 'cambioprecio(\'I\');'; $edit->{$objeto}->rule = 'required|mayorcero'; $edit->{$objeto}->tabindex = $i + $maxiss * 2; //para el caso de las fraccciones $objeto = "cbase{$i}"; $edit->{$objeto} = new hiddenField('', $objeto); $edit->{$objeto}->pointer = true; $edit->{$objeto}->db_name = $objeto; //$edit->$objeto->type='inputhidden'; } $edit->existen = new inputField('Cantidad Actual', 'existen'); $edit->existen->size = 10; $edit->existen->readonly = true; $edit->existen->css_class = 'inputonlynum'; $edit->existen->style = 'background:#F5F6CE;'; $edit->exmin = new inputField('Mínimo', 'exmin'); $edit->exmin->size = 10; $edit->exmin->maxlength = 12; $edit->exmin->css_class = 'inputonlynum'; $edit->exmin->rule = 'numeric|callback_positivo|trim'; $edit->exmin->insertValue = '0'; $edit->exmax = new inputField('Máximo', 'exmax'); $edit->exmax->size = 10; $edit->exmax->maxlength = 12; $edit->exmax->css_class = 'inputonlynum'; $edit->exmax->rule = 'numeric|callback_positivo|trim'; $edit->exmax->insertValue = '0'; $edit->exord = new inputField('Orden Proveedor', 'exord'); $edit->exord->readonly = true; $edit->exord->insertValue = '0'; $edit->exord->size = 10; $edit->exord->css_class = 'inputonlynum'; $edit->exord->style = 'background:#F5F6CE;'; $edit->exdes = new inputField('Pedidos Cliente', 'exdes'); $edit->exdes->readonly = true; $edit->exdes->size = 10; $edit->exdes->css_class = 'inputonlynum'; $edit->exdes->style = 'background:#F5F6CE;'; // Exhibidores $edit->exhimin = new inputField('Mínimo', 'exhimin'); $edit->exhimin->size = 10; $edit->exhimin->maxlength = 12; $edit->exhimin->css_class = 'inputonlynum'; $edit->exhimin->rule = 'numeric|callback_positivo|trim'; $edit->exhimin->insertValue = '0'; $edit->exhimax = new inputField('Máximo', 'exhimax'); $edit->exhimax->size = 10; $edit->exhimax->maxlength = 12; $edit->exhimax->css_class = 'inputonlynum'; $edit->exhimax->rule = 'numeric|callback_positivo|trim'; $edit->exhimax->insertValue = '0'; $edit->exhalma = new dropdownField('Exhibidor', 'exhalma'); $edit->exhalma->option('', 'Seleccione'); $edit->exhalma->options('SELECT ubica, CONCAT(ubica,\' \',ubides) nombre FROM caub WHERE gasto="N" AND tipo="S" ORDER BY ubica'); $edit->exhalma->style = 'width:145px;'; $edit->fechav = new dateField('Última Venta', 'fechav', 'd/m/Y'); $edit->fechav->readonly = true; $edit->fechav->size = 10; $edit->fdesde = new dateField('Desde', 'fdesde', 'd/m/Y'); $edit->fdesde->calendar = false; $edit->fdesde->size = 10; $edit->fhasta = new dateField('Desde', 'fhasta', 'd/m/Y'); $edit->fhasta->calendar = false; $edit->fhasta->size = 10; $edit->bonicant = new inputField('Cant. Bonifica', 'bonicant'); $edit->bonicant->size = 10; $edit->bonicant->maxlength = 12; $edit->bonicant->css_class = 'inputonlynum'; $edit->bonicant->rule = 'numeric|callback_positivo|trim'; $edit->bonifica = new inputField('Bonifica', 'bonifica'); $edit->bonifica->size = 10; $edit->bonifica->maxlength = 12; $edit->bonifica->css_class = 'inputonlynum'; $edit->bonifica->rule = 'numeric|callback_positivo|trim'; $edit->sada = new dropdownField('Rubro SADA', 'sada'); $edit->sada->style = 'width:110px;'; $edit->sada->option('', 'Seleccionar'); $edit->sada->options('SELECT id,descrip FROM sadacod ORDER BY descrip'); $edit->sada->style = 'width:320px;'; $edit->color = new dropdownField('Color', 'color'); $edit->color->style = 'width:150px;'; $edit->color->option('', 'Ninguno'); $edit->color->option('FFFF00', 'Amarillo'); $edit->color->option('FFD700', 'Dorado'); $edit->color->option('0000FF', 'Azul'); $edit->color->option('00008B', 'Azul Oscuro'); $edit->color->option('FF0000', 'Rojo'); $edit->color->option('B22222', 'Ladrillo'); $edit->color->option('00FF00', 'Verde'); $edit->color->option('808000', 'Oliva'); $edit->color->add_extra(array('FFFF00' => 'style="background:#FFFF00"', 'FFD700' => 'style="background:#FFD700"', '0000FF' => 'style="background:#0000FF"', '00008B' => 'style="background:#00008B"', 'FF0000' => 'style="background:#FF0000"', 'B22222' => 'style="background:#B22222"', '00FF00' => 'style="background:#00FF00"', '808000' => 'style="background:#808000"')); if ($this->datasis->traevalor('SUNDECOP') == 'S') { $edit->mpps = new inputField('MPPS', 'mpps'); $edit->mpps->rule = 'max_length[20]'; $edit->mpps->size = 22; $edit->mpps->maxlength = 20; $edit->cpe = new inputField('CPE', 'cpe'); $edit->cpe->rule = 'max_length[20]'; $edit->cpe->size = 22; $edit->cpe->maxlength = 20; $edit->dcomercial = new dropdownField('Destino Comercial', 'dcomercial'); $edit->dcomercial->style = 'width:200px;'; $edit->dcomercial->option('', 'Seleccionar'); $edit->dcomercial->options('SELECT codigo, descrip FROM sc_dcomercial ORDER BY descrip'); $edit->rubro = new dropdownField('Rubro', 'rubro'); $edit->rubro->style = 'width:200px;'; $edit->rubro->option('', 'Seleccionar'); $edit->rubro->options('SELECT codigo, concat(codigo, " ", descrip) descrip FROM sc_rubro ORDER BY codigo'); $edit->subrubro = new dropdownField('Sub Rubro', 'subrubro'); $edit->subrubro->style = 'width:200px;'; $edit->subrubro->option('', 'Seleccionar'); $edit->subrubro->options('SELECT codigo, concat(codigo, " ", descrip) descrip FROM sc_subrubro ORDER BY codigo'); $edit->cunidad = new dropdownField('Unidad Med.', 'cunidad'); $edit->cunidad->style = 'width:200px;'; $edit->cunidad->option('', 'Seleccionar'); $edit->cunidad->options('SELECT codigo, descrip descrip FROM sc_unidad ORDER BY codigo'); $edit->cmarca = new inputField('Marca', 'cmarca'); $edit->cmarca->rule = 'max_length[6]|integer'; $edit->cmarca->css_class = 'inputonlynum'; $edit->cmarca->size = 8; $edit->cmarca->maxlength = 6; $edit->cmaterial = new dropdownField('Material', 'cmaterial'); $edit->cmaterial->style = 'width:200px;'; $edit->cmaterial->option('', 'Seleccionar'); $edit->cmaterial->options('SELECT codigo, descrip FROM sc_material ORDER BY descrip'); $edit->cforma = new dropdownField('Forma', 'cforma'); $edit->cforma->style = 'width:200px;'; $edit->cforma->option('', 'Seleccionar'); $edit->cforma->options('SELECT codigo, descrip FROM sc_forma ORDER BY descrip'); $edit->cpactivo = new inputField('Principio Act.', 'cpactivo'); $edit->cpactivo->rule = 'max_length[6]|integer'; $edit->cpactivo->css_class = 'inputonlynum'; $edit->cpactivo->size = 8; $edit->cpactivo->maxlength = 6; } //Descuentos por escala for ($i = 1; $i <= 3; $i++) { $objeto = "pescala{$i}"; $edit->{$objeto} = new inputField('Descuento por escala ' . $i, $objeto); $edit->{$objeto}->rule = 'numeric|callback_positivo|trim'; $edit->{$objeto}->insertValue = '0'; $edit->{$objeto}->css_class = 'inputnum'; $edit->{$objeto}->size = 5; $edit->{$objeto}->autocomplete = false; $objeto = "escala{$i}"; $edit->{$objeto} = new inputField('Cantidad mínima para la escala ' . $i, $objeto); $edit->{$objeto}->rule = 'numeric|callback_positivo|trim'; $edit->{$objeto}->insertValue = '0'; $edit->{$objeto}->css_class = 'inputnum'; $edit->{$objeto}->size = 10; $edit->{$objeto}->autocomplete = false; } for ($i = 1; $i <= 3; $i++) { $objeto = "pfecha{$i}"; $edit->{$objeto} = new dateField("Fecha {$i}", $objeto, 'd/m/Y'); $edit->{$objeto}->when = array('show'); $edit->{$objeto}->size = 10; $objeto = "Eprepro{$i}"; $edit->{$objeto} = new freeField('', '', 'Precio'); $edit->{$objeto}->in = "pfecha{$i}"; $edit->{$objeto}->when = array('show'); $objeto = "prepro{$i}"; $edit->{$objeto} = new inputField('', $objeto); $edit->{$objeto}->when = array('show'); $edit->{$objeto}->size = 10; $edit->{$objeto}->in = "pfecha{$i}"; $objeto = "prov{$i}"; $edit->{$objeto} = new inputField('', $objeto); $edit->{$objeto}->when = array('show'); $edit->{$objeto}->size = 10; $objeto = "Eprov{$i}"; $edit->{$objeto} = new freeField('', '', 'Proveedor'); $edit->{$objeto}->in = "pfecha{$i}"; $edit->{$objeto}->when = array('show'); if ($edit->_status == 'show') { $prov = $edit->_dataobject->get('prov' . $i); $dbprov = $this->db->escape($prov); $proveed = $this->datasis->dameval("SELECT nombre FROM sprv WHERE proveed={$dbprov} LIMIT 1"); $objeto = "proveed{$i}"; $edit->{$objeto} = new freeField('', '', $proveed); $edit->{$objeto}->in = "pfecha{$i}"; } } $codigo = $edit->_dataobject->get('codigo'); $edit->almacenes = new containerField('almacenes', $this->_detalle($codigo)); $edit->almacenes->when = array('show', 'modify'); $edit->mmargen = new inputField('Margen al Mayor', 'mmargen'); $edit->mmargen->css_class = 'inputnum'; $edit->mmargen->size = 10; $edit->mmargen->insertValue = '0'; $edit->mmargen->maxlength = 10; $edit->mmargenplus = new inputField('Descuento +', 'mmargenplus'); $edit->mmargenplus->css_class = 'inputnum'; $edit->mmargenplus->insertValue = '0'; $edit->mmargenplus->size = 10; $edit->mmargenplus->maxlength = 10; $edit->pm = new inputField('Descuento al Mayor A', 'pm'); $edit->pm->css_class = 'inputnum'; $edit->pm->rule = 'numeric'; $edit->pm->size = 10; $edit->pm->insertValue = '0'; $edit->pm->maxlength = 10; $edit->pmb = new inputField('Descuento al Mayor B', 'pmb'); $edit->pmb->css_class = 'inputnum'; $edit->pmb->rule = 'numeric'; $edit->pmb->insertValue = '0'; $edit->pmb->size = 10; $edit->pmb->maxlength = 10; /*INICIO SINV COMBO*/ $edit->itcodigo = new inputField('Código <#o#>', 'itcodigo_<#i#>'); $edit->itcodigo->size = 12; $edit->itcodigo->db_name = 'codigo'; $edit->itcodigo->rel_id = 'sinvcombo'; $edit->itcodigo->rule = 'callback_chtiposinv'; $edit->itcodigo->append($bSINV_C); $edit->itdescrip = new inputField('Descripción <#o#>', 'itdescrip_<#i#>'); $edit->itdescrip->size = 32; $edit->itdescrip->db_name = 'descrip'; $edit->itdescrip->maxlength = 50; $edit->itdescrip->readonly = true; $edit->itdescrip->rel_id = 'sinvcombo'; $edit->itdescrip->type = 'inputhidden'; $edit->itcantidad = new inputField('Cantidad <#o#>', 'itcantidad_<#i#>'); $edit->itcantidad->db_name = 'cantidad'; $edit->itcantidad->css_class = 'inputnum'; $edit->itcantidad->rel_id = 'sinvcombo'; $edit->itcantidad->maxlength = 10; $edit->itcantidad->size = 5; $edit->itcantidad->rule = 'condi_required|positive'; $edit->itcantidad->autocomplete = false; $edit->itcantidad->onkeyup = 'totalizarcombo();'; $edit->itcantidad->insertValue = '1'; $edit->itprecio = new inputField('Precio <#o#>', 'itprecio_<#i#>'); $edit->itprecio->size = 15; $edit->itprecio->db_name = 'precio'; $edit->itprecio->maxlength = 50; $edit->itprecio->rel_id = 'sinvcombo'; $edit->itprecio->onkeyup = 'totalizarcombo();'; $edit->itprecio->css_class = 'inputnum'; $edit->itultimo = new inputField('Ultimo <#o#>', 'itultimo_<#i#>'); $edit->itultimo->size = 32; $edit->itultimo->db_name = 'ultimo'; $edit->itultimo->maxlength = 50; $edit->itultimo->readonly = true; $edit->itultimo->rel_id = 'sinvcombo'; $edit->itultimo->type = 'inputhidden'; $edit->itpond = new inputField('Promedio <#o#>', 'itpond_<#i#>'); $edit->itpond->size = 32; $edit->itpond->db_name = 'pond'; $edit->itpond->maxlength = 50; $edit->itpond->readonly = true; $edit->itpond->rel_id = 'sinvcombo'; $edit->itpond->type = 'inputhidden'; $ocultos = array('precio1', 'formcal'); foreach ($ocultos as $obj) { $obj2 = 'it' . $obj; $edit->{$obj2} = new hiddenField($obj . ' <#o#>', $obj2 . '_<#i#>'); $edit->{$obj2}->db_name = 'sinv' . $obj; $edit->{$obj2}->rel_id = 'sinvcombo'; $edit->{$obj2}->pointer = true; } /*FIN SINV COMBO*/ /*INICIO SINV ITEM RECETAS*/ $edit->it2codigo = new inputField('Código <#o#>', 'it2codigo_<#i#>'); $edit->it2codigo->size = 16; $edit->it2codigo->db_name = 'codigo'; $edit->it2codigo->rel_id = 'sinvpitem'; $edit->it2codigo->append($bSINV_I); $edit->it2descrip = new inputField('Descripción <#o#>', 'it2descrip_<#i#>'); $edit->it2descrip->size = 34; $edit->it2descrip->db_name = 'descrip'; $edit->it2descrip->maxlength = 50; $edit->it2descrip->readonly = true; $edit->it2descrip->rel_id = 'sinvpitem'; $edit->it2descrip->type = 'inputhidden'; $edit->it2cantidad = new inputField('Cantidad <#o#>', 'it2cantidad_<#i#>'); $edit->it2cantidad->db_name = 'cantidad'; $edit->it2cantidad->css_class = 'inputnum'; $edit->it2cantidad->rel_id = 'sinvpitem'; $edit->it2cantidad->maxlength = 10; $edit->it2cantidad->size = 5; $edit->it2cantidad->rule = 'positive'; $edit->it2cantidad->autocomplete = false; $edit->it2cantidad->onkeyup = 'totalizarpitem(<#i#>)'; $edit->it2cantidad->insertValue = '1'; $edit->itunidad = new dropdownField('Unidad <#o#>', 'itunidad_<#i#>'); $edit->itunidad->style = 'width:100px;'; $edit->itunidad->option('', 'Seleccionar'); $edit->itunidad->options('SELECT unidades, unidades descrip FROM unidad ORDER BY unidades'); $edit->itunidad->rel_id = 'sinvpitem'; $edit->itunidad->db_name = 'unidad'; $edit->itfactor = new inputField('Factor <#o#>', 'itfactor_<#i#>'); $edit->itfactor->size = 8; $edit->itfactor->db_name = 'factor'; $edit->itfactor->maxlength = 15; $edit->itfactor->css_class = 'inputnum'; $edit->itfactor->rel_id = 'sinvpitem'; $edit->itfactor->insertValue = '0'; $edit->itfactor->autocomplete = false; $edit->it2merma = new inputField('Ultimo <#o#>', 'it2merma_<#i#>'); $edit->it2merma->size = 5; $edit->it2merma->db_name = 'merma'; $edit->it2merma->maxlength = 15; $edit->it2merma->css_class = 'inputnum'; $edit->it2merma->rel_id = 'sinvpitem'; $edit->it2merma->insertValue = '0'; $edit->it2merma->autocomplete = false; $ocultos = array('ultimo', 'pond', 'formcal', 'id_sinv'); foreach ($ocultos as $obj) { $obj2 = 'it2' . $obj; $edit->{$obj2} = new hiddenField($obj . ' <#o#>', $obj2 . '_<#i#>'); $edit->{$obj2}->db_name = $obj; $edit->{$obj2}->rel_id = 'sinvpitem'; } /*INICIO SINV LABOR ESTACIONES*/ $edit->it3estacion = new dropdownField('Estacion <#o#>', 'it3estacion_<#i#>'); $edit->it3estacion->option('', 'Seleccionar'); $edit->it3estacion->options('SELECT estacion,CONCAT(estacion,\'-\',nombre) AS lab FROM esta ORDER BY estacion'); $edit->it3estacion->style = 'width:250px;'; $edit->it3estacion->db_name = 'estacion'; $edit->it3estacion->rel_id = 'sinvplabor'; $edit->it3actividad = new inputField('Actividad <#o#>', 'it3actividad_<#i#>'); $edit->it3actividad->size = 32; $edit->it3actividad->db_name = 'actividad'; $edit->it3actividad->maxlength = 50; $edit->it3actividad->rel_id = 'sinvplabor'; $edit->it3tunidad = new dropdownField('', 'it3tunidad_<#i#>'); $edit->it3tunidad->option('H', 'Horas'); $edit->it3tunidad->option('D', 'Dias'); $edit->it3tunidad->option('S', 'Semanas'); $edit->it3tunidad->style = 'width:80px;'; $edit->it3tunidad->db_name = 'tunidad'; $edit->it3tunidad->css_class = 'inputnum'; $edit->it3tunidad->rel_id = 'sinvplabor'; $edit->it3tunidad->rule = 'enum[H,S,D]'; $edit->it3tunidad->insertValue = 'H'; $edit->it3tiempo = new inputField('', 'it3tiempo_<#i#>'); $edit->it3tiempo->db_name = 'tiempo'; $edit->it3tiempo->css_class = 'inputnum'; $edit->it3tiempo->rel_id = 'sinvplabor'; $edit->it3tiempo->maxlength = 10; $edit->it3tiempo->size = 5; $edit->it3tiempo->rule = 'positive'; $edit->it3tiempo->autocomplete = false; $edit->it3tiempo->insertValue = '1'; $inven = array(); $query = $this->db->query('SELECT TRIM(codigo) AS codigo ,TRIM(descrip) AS descrip,tipo,base1,base2,base3,base4,iva,peso,precio1,pond,ultimo FROM sinv WHERE activo=\'S\' AND tipo=\'Articulo\''); if ($query->num_rows() > 0) { foreach ($query->result() as $row) { $ind = '_' . $row->codigo; $inven[$ind] = array($row->descrip, $row->tipo, $row->base1, $row->base2, $row->base3, $row->base4, $row->iva, $row->peso, $row->precio1, $row->pond); } } $edit->button_status('btn_add_sinvcombo', 'Agregar', 'javascript:add_sinvcombo()', 'CO', 'modify', 'button_add_rel'); $edit->button_status('btn_add_sinvcombo', 'Agregar', 'javascript:add_sinvcombo()', 'CO', 'create', 'button_add_rel'); $edit->button_status('btn_add_sinvpitem', 'Agregar', 'javascript:add_sinvpitem()', 'IT', 'create', 'button_add_rel'); $edit->button_status('btn_add_sinvpitem', 'Agregar', 'javascript:add_sinvpitem()', 'IT', 'modify', 'button_add_rel'); $edit->button_status('btn_add_sinvplabor', 'Agregar', 'javascript:add_sinvplabor()', 'LA', 'create', 'button_add_rel'); $edit->button_status('btn_add_sinvplabor', 'Agregar', 'javascript:add_sinvplabor()', 'LA', 'modify', 'button_add_rel'); /* $plim = $this->datasis->sidapuede('SINVOTR', 'FIJA_MARG()'); if(!$plim){ $edit->pond->mode = 'autohide'; $edit->ultimo->mode = 'autohide'; $edit->margenu->mode = 'autohide'; //$edit->motivo->mode = 'autohide'; } */ $edit->build(); $mcodigo = $edit->codigo->value; $dbmcodigo = $this->db->escape($mcodigo); $mfdesde = $this->datasis->dameval("SELECT ADDDATE(MAX(fecha),-30) AS val FROM costos WHERE codigo={$dbmcodigo}"); $mfhasta = $this->datasis->dameval("SELECT MAX(fecha) AS val FROM costos WHERE codigo={$dbmcodigo}"); if ($edit->on_success()) { $rt = array('status' => 'A', 'mensaje' => 'Registro guardado', 'pk' => $edit->_dataobject->pk); echo json_encode($rt); } else { $conten['form'] =& $edit; $this->load->view('view_sinv', $conten); } }
function dataedit() { $this->rapyd->load('dataobject', 'datadetails'); $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'Cóodigo', 'nombre' => 'Nombre', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'Código', 'nombre' => 'Nombre'), 'retornar' => array('proveed' => 'cod_prov'), 'titulo' => 'Buscar Beneficiario'); $bSPRV = $this->datasis->p_modbus($mSPRV, "proveed"); $modbus = array('tabla' => 'ppla', 'columnas' => array('codigo' => 'Código', 'denominacion' => 'Denominación'), 'filtro' => array('codigo' => 'Código', 'denominacion' => 'Denominación'), 'retornar' => array('codigo' => 'partida_<#i#>'), 'p_uri' => array(4 => '<#i#>', 5 => '<#fondo#>', 6 => '<#estadmin#>'), 'where' => 'tipo=<#fondo#> AND codigoadm=<#estadmin#> AND LENGTH(ppla.codigo)=' . $this->flongpres, 'join' => array('presupuesto', 'presupuesto.codigopres=ppla.codigo', ''), 'titulo' => 'Busqueda de partidas'); $btn = $this->datasis->p_modbus($modbus, '<#i#>/<#fondo#>/<#estadmin#>'); $script = ' function cal_importe(i){ id=i.toString(); cana =parseFloat($("#cantidad_"+id).val()); precio=parseFloat($("#precio_"+id).val()); op=cana*precio; if(!isNaN(op)) $("#importe_"+id).val(cana*precio); $("#iva_"+id).val(); } '; $do = new DataObject("ocompra"); $do->rel_one_to_many('itocompra', 'itocompra', array('numero' => 'numero')); $edit = new DataDetails("Orden de Compra", $do); $edit->back_url = site_url("presupuesto/ocompra/filteredgrid"); $edit->set_rel_title('itocompra', 'Rubro <#o#>'); $edit->script($script, 'create'); $edit->script($script, 'modify'); $edit->numero = new inputField("Número", "numero"); $edit->numero->mode = "autohide"; $edit->numero->when = array('show'); $edit->fecha = new dateonlyField("Fecha", "fecha"); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->size = 12; $edit->uejecutora = new dropdownField("Unidad Ejecutora", "uejecutora"); $edit->uejecutora->option("", "Seccionar"); $edit->uejecutora->options("SELECT codigo, nombre FROM uejecutora ORDER BY nombre"); //$edit->uejecutora->onchange = "get_uadmin();"; $edit->uejecutora->rule = "required"; $edit->estadmin = new dropdownField("Estructura Administrativa", "estadmin"); $edit->estadmin->option("", "Seleccione"); $edit->estadmin->rule = 'required'; $edit->estadmin->options("SELECT b.codigo, CONCAT_WS(' ',b.codigo,b.denominacion) AS val FROM presupuesto AS a JOIN estruadm AS b ON a.codigoadm=b.codigo GROUP BY b.codigo"); $edit->fondo = new dropdownField("Fondo", "fondo"); $edit->fondo->rule = "required"; $estadmin = $edit->getval('estadmin'); if ($estadmin !== false) { $edit->fondo->options("SELECT tipo,tipo a FROM presupuesto WHERE codigoadm='{$estadmin}' GROUP BY tipo"); } else { $edit->fondo->option("", "Seleccione una estructura administrativa primero"); } $edit->cod_prov = new inputField("Beneficiario", 'cod_prov'); $edit->cod_prov->size = 6; $edit->cod_prov->append($bSPRV); $edit->cod_prov->rule = "required"; $edit->beneficiario = new inputField("Beneficiario", 'beneficiario'); $edit->beneficiario->size = 50; $edit->beneficiario->rule = "required"; $edit->observa = new textAreaField("Observaciones", 'observa'); $edit->observa->rows = 4; $edit->observa->cols = 60; //$edit->tcantidad = new inputField("tcantidad", 'tcantidad'); //$edit->tcantidad->size = 8; $edit->subtotal = new inputField("Sub Total", 'subtotal'); $edit->subtotal->size = 8; $edit->ivaa = new inputField("IVA aumentado", 'ivaa'); $edit->ivaa->size = 8; $edit->ivag = new inputField("IVA general", 'ivag'); $edit->ivag->size = 8; $edit->ivar = new inputField("IVA reducido", 'ivar'); $edit->ivar->size = 8; $edit->total = new inputField("Total", 'total'); $edit->total->size = 8; /*$edit->uadministra = new dropdownField("Unidad Administrativa", "uadministra"); $edit->uadministra->option("","Ninguna"); $ueje=$edit->getval('uejecuta'); if($ueje!==false){ $edit->uadministra->options("SELECT codigo,nombre FROM uadministra WHERE codigoejec='$ueje' ORDER BY nombre"); }else{ $edit->uadministra->option("","Seleccione una unidad ejecutora primero"); }*/ $edit->itpartida = new inputField("(<#o#>) Partida", "partida_<#i#>"); $edit->itpartida->rule = 'callback_repetido|required'; $edit->itpartida->size = 15; $edit->itpartida->append('<img src="/tortuga/assets/default/images/system-search.png" alt="Busqueda de partidas" title="Busqueda de partidas" border="0" onclick="modbusdepen(<#i#>)"/>'); $edit->itpartida->db_name = 'partida'; $edit->itpartida->rel_id = 'itocompra'; $edit->itdescripcion = new inputField("(<#o#>) Descripción", "descripcion_<#i#>"); $edit->itdescripcion->db_name = 'descripcion'; $edit->itdescripcion->maxlength = 80; $edit->itdescripcion->size = 30; $edit->itdescripcion->rule = 'required'; $edit->itdescripcion->rel_id = 'itocompra'; $edit->itunidad = new dropdownField("(<#o#>) Unidad", "unidad_<#i#>"); $edit->itunidad->db_name = 'unidad'; $edit->itunidad->rule = 'required'; $edit->itunidad->rel_id = 'itocompra'; $edit->itunidad->options("SELECT unidades AS id,unidades FROM unidad ORDER BY unidades"); $edit->itunidad->style = "width:80px"; $edit->itcantidad = new inputField("(<#o#>) Cantidad", "cantidad_<#i#>"); $edit->itcantidad->css_class = 'inputnum'; $edit->itcantidad->db_name = 'cantidad'; $edit->itcantidad->rel_id = 'itocompra'; $edit->itcantidad->rule = 'numeric'; $edit->itcantidad->onchange = 'cal_importe(<#i#>);'; $edit->itcantidad->size = 4; $edit->itprecio = new inputField("(<#o#>) Precio", "precio_<#i#>"); $edit->itprecio->css_class = 'inputnum'; $edit->itprecio->db_name = 'precio'; $edit->itprecio->rel_id = 'itocompra'; $edit->itprecio->rule = 'numeric'; $edit->itprecio->onchange = 'cal_importe(<#i#>);'; $edit->itprecio->size = 8; $ivas = $this->_ivaplica(); $edit->itiva = new dropdownField("(<#o#>) IVA", "iva_<#i#>"); $edit->itiva->db_name = 'iva'; $edit->itiva->rel_id = 'itocompra'; $edit->itiva->onchange = 'cal_importe(<#i#>);'; $edit->itiva->options($ivas); $edit->itiva->onchange = "cal_importe(<#i#>)"; $edit->itiva->style = "width:80px"; $edit->itimporte = new inputField("(<#o#>) Importe", "importe_<#i#>"); $edit->itimporte->css_class = 'inputnum'; $edit->itimporte->db_name = 'importe'; $edit->itimporte->rel_id = 'itocompra'; $edit->itimporte->rule = 'numeric'; $edit->itimporte->readonly = true; $edit->itimporte->size = 8; $edit->buttons("modify", "save", "undo", "delete", "back", "add_rel"); $edit->build(); $data['']; $smenu['link'] = barra_menu('101'); $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true); $conten["form"] =& $edit; $data['content'] = $this->load->view('view_ocompra', $conten, true); //$data['content'] = $edit->output; $data['title'] = " Orden de Compra "; $data["head"] = $this->rapyd->get_head() . script('jquery.js') . script("plugins/jquery.numeric.pack.js"); $this->load->view('view_ventanas', $data); }