function dataedit() { $this->rapyd->load('dataobject', 'datadetails'); $do = new DataObject("doc_tablas"); $do->rel_one_to_many('doc_campos', 'doc_campos', array('nombre' => 'tabla')); $edit = new DataDetails("Documentación de Tablas", $do); $edit->back_url = site_url($this->url . "filteredgrid"); $edit->set_rel_title('doc_campos', 'Rubro <#o#>'); $edit->pre_process('insert', '_valida'); $edit->pre_process('update', '_valida'); $edit->nombre = new inputField("Nombre", "nombre"); $edit->nombre->mode = "autohide"; $edit->nombre->size = 15; $edit->referen = new textareaField("Descripcion", "referen"); $edit->referen->size = 50; $edit->referen->rows = 2; $edit->referen->cols = 90; $edit->itcampo = new inputField("(<#o#>) Campo", "itcampo_<#i#>"); $edit->itcampo->db_name = 'campo'; $edit->itcampo->rel_id = 'doc_campos'; $edit->itcampo->rule = 'required|callback_chexiste'; $edit->itcampo->size = 15; $edit->ittype = new inputField("(<#o#>) Type", "ittype_<#i#>"); $edit->ittype->db_name = 'dtype'; $edit->ittype->rel_id = 'doc_campos'; $edit->ittype->size = 15; $edit->itnull = new inputField("(<#o#>) Null", "itnull_<#i#>"); $edit->itnull->db_name = 'dnull'; $edit->itnull->rel_id = 'doc_campos'; $edit->itnull->size = 3; $edit->itkey = new inputField("(<#o#>) key", "itkey_<#i#>"); $edit->itkey->db_name = 'dkey'; $edit->itkey->rel_id = 'doc_campos'; $edit->itkey->size = 3; $edit->itdefault = new inputField("(<#o#>) Default", "itdefault_<#i#>"); $edit->itdefault->db_name = 'ddefault'; $edit->itdefault->rel_id = 'doc_campos'; $edit->itdefault->size = 5; $edit->itextra = new inputField("(<#o#>) Extra", "itextra_<#i#>"); $edit->itextra->db_name = 'dextra'; $edit->itextra->rel_id = 'doc_campos'; $edit->itextra->size = 10; $edit->itdcomment = new textareaField("(<#o#>) Comentario", "itdcomment_<#i#>"); $edit->itdcomment->db_name = 'dcomment'; $edit->itdcomment->rel_id = 'doc_campos'; $edit->itdcomment->cols = 40; $edit->itdcomment->rows = 2; $edit->buttons("modify", "save", "undo", "back", "add_rel"); $edit->build(); $conten["form"] =& $edit; $data['content'] = $this->load->view('view_tablas', $conten, true); $data['title'] = "Documentación de Tablas"; $data["head"] = $this->rapyd->get_head() . script('jquery.js'); $this->load->view('view_ventanas', $data); }
function dataedit($status = '', $c = '') { $this->rapyd->load('datadetails', 'dataobject'); $modbus2 = array('tabla' => 'r_contribu', 'columnas' => array('id' => 'Ref.', 'rifci' => 'Rif/CI', 'nombre' => 'Nombre'), 'filtro' => array('id' => 'Ref.', 'rifci' => 'Rif/CI', 'nombre' => 'Nombre'), 'retornar' => array('id' => 'id_repre', 'nombre' => 'nombrep'), 'titulo' => 'Buscar Contribuyente', 'where' => 'rifci LIKE "V%" '); $button = $this->datasis->modbus($modbus2, 'r_contribu2'); $modbus = array('tabla' => 'r_contribu', 'columnas' => array('id' => 'Ref.', 'rifci' => 'Rif/CI', 'nombre' => 'Nombre'), 'filtro' => array('id' => 'Ref.', 'rifci' => 'Rif/CI', 'nombre' => 'Nombre'), 'retornar' => array('id' => 'itid_contribuit_<#i#>', 'rifci' => 'itrifcipit_<#i#>', 'nombre' => 'itnombrepit_<#i#>'), 'p_uri' => array(4 => '<#i#>'), 'titulo' => 'Buscar Contribuyente', 'script' => array('post_modbus_socios(<#i#>)')); $buttonsocios = $this->datasis->p_modbus($modbus, '<#i#>'); $modbusnegocio = array('tabla' => 'r_negocio', 'columnas' => array('id' => 'Ref.', 'descrip' => 'Descripcion', 'monto' => 'Monto', 'monto2' => 'Monto2', 'aforo' => 'Aforo', 'mintribu' => 'Minimo Tributable'), 'filtro' => array('id' => 'Ref.', 'descrip' => 'Descripcion', 'monto' => 'Monto', 'monto2' => 'Monto2', 'aforo' => 'Aforo', 'mintribu' => 'Minimo Tributable'), 'retornar' => array('id' => 'id_negocio', 'descrip' => 'negociop'), 'titulo' => 'Buscar Negocio'); $buttonnegocio = $this->datasis->modbus($modbusnegocio); $do = new DataObject("r_contribu"); $do->rel_one_to_many('r_contribuit', 'r_contribuit', array('id' => 'id_contribu')); $do->pointer('r_contribu b', 'r_contribu.id_repre=b.id', "b.nombre nombrep", "LEFT"); $do->pointer('r_negocio', 'r_contribu.id_negocio=r_negocio.id', "r_negocio.descrip negociop", "LEFT"); $do->rel_pointer('r_contribuit', 'r_contribu c', 'r_contribuit.id_contribuit=c.id', "c.rifci rifcipit,c.nombre nombrepit", "LEFT"); $edit = new DataDetails($this->t**s, $do); $edit->back_url = site_url($this->url . "filteredgrid"); $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->id = new inputField('id', 'id'); $edit->id->rule = 'max_length[11]'; $edit->id->size = 13; $edit->id->maxlength = 11; $edit->id->mode = 'autohide'; $edit->id->when = array('show', 'modify'); $edit->tipo = new dropDownField('Tipo', 'tipo'); $edit->tipo->option("S", "Sencillo"); $edit->tipo->option("M", "Multiple"); $edit->tipo->option("F", "Firma Personal o Sucursales"); $edit->tipo->append("Permite Guardar el RIF varias veces para uso de FIRMAS PERSONALES, la opcion MULTIPLE es utilizada para registros con varios dueƱos (no requiere RIF) "); $edit->tipo->style = "width:150px"; $edit->rifci = new inputField("RIF / Cédula", 'rifci'); $edit->rifci->size = 15; $edit->rifci->maxlenght = 12; //$edit->rifci->rule = "required"; if ($status == 'create') { $edit->rifci->value = $c; } $edit->rifci->append("Sin puntos ni guiones, Ejemplo:V18055344 o J401042970"); $edit->nombre = new inputField("Nombre", 'nombre'); $edit->nombre->size = 60; $edit->nombre->maxlenght = 100; $edit->nombre->rule = "required"; $edit->telefono = new inputField("Telefono", 'telefono'); $edit->telefono->size = 40; $edit->telefono->maxlenght = 50; $edit->telefono->css_class = 'inputonlynum'; if ($this->datasis->traevalor('R_CONTRIBU_OBLIGA_TELEFONO', 'N')) { } $edit->telefono->rule = "required"; $edit->email = new inputField("Correo Electronico", 'email'); $edit->email->size = 40; $edit->email->maxlenght = 50; if ($this->datasis->traevalor('R_CONTRIBU_OBLIGA_EMAIL', 'N') == 'S') { $edit->email->rule = "required"; } //$edit->email->css_class ='inputonlynum'; $edit->activo = new dropDownField('Activo ', 'activo'); $edit->activo->option("S", "SI"); $edit->activo->option("N", "NO"); $edit->activo->style = "width:150px"; /* $edit->rif = new inputField("RIF Firma Personal", 'rif'); $edit->rif->size = 15; $edit->rif->maxlenght = 12; //$edit->rif->rule = "required"; $edit->rif->append("Sin puntos ni guiones, Ejemplo:V180553440"); $edit->nomfis = new inputField("Nombre Firma Personal", 'nomfis'); $edit->nomfis->size = 60; $edit->nomfis->maxlenght = 100; //$edit->nomfis->rule = "required"; */ $edit->id_parroquia = new dropDownField('Parroquia', 'id_parroquia'); //$edit->id_parroquia->rule='required'; $edit->id_parroquia->option("", ""); $edit->id_parroquia->options("SELECT id,nombre FROM vi_parroquia ORDER BY nombre"); $edit->id_parroquia->group = "Datos De Ubicacion"; if ($this->datasis->traevalor('R_CONTRIBU_OBLIGA_PARROQUIA', 'N') == 'S') { $edit->id_parroquia->rule = "required"; } $edit->id_zona = new dropDownField('Zona', 'id_zona'); // $edit->id_zona->rule='required'; $edit->id_zona->option("", ""); $edit->id_zona->options("SELECT id,descrip FROM r_zona ORDER BY descrip"); $edit->id_zona->group = "Datos De Ubicacion"; if ($this->datasis->traevalor('R_CONTRIBU_OBLIGA_ZONA', 'N') == 'S') { $edit->id_zona->rule = "required"; } $edit->dir1 = new inputField('Dirección 1', 'dir1'); $edit->dir1->rule = 'max_length[255]'; $edit->dir1->size = 40; $edit->dir1->maxlength = 255; $edit->dir1->append("Urbanizacion, Barrio, Sector"); $edit->dir1->group = "Datos De Ubicacion"; if ($this->datasis->traevalor('R_CONTRIBU_OBLIGA_DIR1', 'N') == 'S') { $edit->dir1->rule = "required"; } $edit->dir2 = new inputField('Dirección 2', 'dir2'); $edit->dir2->rule = 'max_length[255]'; $edit->dir2->size = 40; $edit->dir2->maxlength = 255; $edit->dir2->append("Calle, avenida, carrera"); $edit->dir2->group = "Datos De Ubicacion"; if ($this->datasis->traevalor('R_CONTRIBU_OBLIGA_DIR2', 'N') == 'S') { $edit->dir2->rule = "required"; } $edit->dir3 = new inputField('Dirección 3', 'dir3'); $edit->dir3->rule = 'max_length[255]'; $edit->dir3->size = 40; $edit->dir3->maxlength = 255; $edit->dir3->append("Con Calle, avenida o carrera"); $edit->dir3->group = "Datos De Ubicacion"; if ($this->datasis->traevalor('R_CONTRIBU_OBLIGA_DIR3', 'N') == 'S') { $edit->dir3->rule = "required"; } $edit->dir4 = new inputField('Dirección 4', 'dir4'); $edit->dir4->rule = 'max_length[255]'; $edit->dir4->size = 40; $edit->dir4->maxlength = 255; $edit->dir4->append("Casa #, o apto #"); $edit->dir4->group = "Datos De Ubicacion"; if ($this->datasis->traevalor('R_CONTRIBU_OBLIGA_DIR4', 'N') == 'S') { $edit->dir4->rule = "required"; } $edit->id_negocio = new inputField('Negocio', 'id_negocio'); //$edit->id_negocio->option('',''); //$edit->id_negocio->options("SELECT id,descrip FROM r_negocio ORDER BY descrip"); $edit->id_negocio->size = '5'; $edit->id_negocio->group = "Datos de Patente"; $edit->id_negocio->append($buttonnegocio); $edit->id_negocio->readonly = true; $edit->negociop = new inputField('Negocio', 'negociop'); $edit->negociop->size = '60'; $edit->negociop->group = "Datos de Patente"; $edit->negociop->readonly = true; $edit->negociop->pointer = true; $edit->negociop->in = "id_negocio"; $edit->observa = new textAreaField('Observación', 'observa'); $edit->observa->rows = 2; $edit->observa->cols = 40; //$edit->observa->group="Datos de Patente"; if ($this->datasis->puede(398)) { $edit->patente = new dropDownField('Posee patente', 'patente'); $edit->patente->option('N', 'NO'); $edit->patente->option('S', 'SI'); $edit->patente->group = "Datos de Patente"; $edit->nro = new inputField('Patente Numero', 'nro'); $edit->nro->rule = 'max_length[10]'; $edit->nro->size = 12; $edit->nro->maxlength = 10; $edit->nro->group = "Datos de Patente"; $edit->p_tipo = new dropDownField('Tipo de Actividad', 'p_tipo'); $edit->p_tipo->option("", ""); $edit->p_tipo->option("Industrial", "Industrial"); $edit->p_tipo->option("Comercial", "Comercial"); $edit->p_tipo->option("Servicio", "Servicio"); $edit->p_tipo->group = "Datos de Patente"; $edit->objeto = new textAreaField('Objeto', 'objeto'); $edit->objeto->rows = 2; $edit->objeto->cols = 40; $edit->objeto->group = "Datos de Patente"; $edit->id_repre = new inputField('Representante', 'id_repre'); $edit->id_repre->rule = 'max_length[11]'; $edit->id_repre->size = 13; $edit->id_repre->maxlength = 11; $edit->id_repre->group = "Datos de Patente"; $edit->id_repre->readonly = true; $edit->nombrep = new inputField('Archivo', 'nombrep'); $edit->nombrep->size = 40; $edit->nombrep->readonly = true; $edit->nombrep->pointer = true; $edit->nombrep->in = 'id_repre'; $edit->nombrep->append($button); $edit->nombrep->group = "Datos de Patente"; $edit->archivo = new inputField('Archivo', 'archivo'); $edit->archivo->rule = 'max_length[50]'; $edit->archivo->size = 20; $edit->archivo->maxlength = 50; $edit->archivo->group = "Datos de Patente"; $edit->id_sector = new dropDownField('Sector', 'id_sector'); //$edit->id_sector->rule='required'; $edit->id_sector->option("", ""); $edit->id_sector->options("SELECT id,descrip FROM r_sector ORDER BY descrip"); $edit->id_sector->group = "Datos de Patente"; $edit->reg_nro = new inputField('Registro Numero', 'reg_nro'); $edit->reg_nro->rule = 'max_length[10]'; $edit->reg_nro->size = 12; $edit->reg_nro->maxlength = 10; $edit->reg_nro->group = "Datos de Registro"; $edit->reg_tomo = new inputField('Registro Tomo', 'reg_tomo'); $edit->reg_tomo->rule = 'max_length[10]'; $edit->reg_tomo->size = 12; $edit->reg_tomo->maxlength = 10; $edit->reg_tomo->group = "Datos de Registro"; $edit->reg_fecha = new dateOnlyField('Registro Fecha', 'reg_fecha'); $edit->reg_fecha->rule = 'chfecha'; $edit->reg_fecha->size = 10; $edit->reg_fecha->maxlength = 8; //$edit->reg_fecha->insertValue=date('Y-m-d'); $edit->reg_fecha->group = "Datos de Registro"; } $edit->itid_contribuit = new inputField('Contribuyente', 'itid_contribuit_<#i#>'); $edit->itid_contribuit->rule = 'max_length[11]'; $edit->itid_contribuit->size = 3; $edit->itid_contribuit->maxlength = 11; $edit->itid_contribuit->db_name = 'id_contribuit'; $edit->itid_contribuit->rel_id = 'r_contribuit'; $edit->itid_contribuit->type = 'inputhidden'; $edit->itrifcipit = new inputField('Nombre', 'itrifcipit_<#i#>'); $edit->itrifcipit->size = 20; //$edit->itrifcipit->readonly=true; $edit->itrifcipit->pointer = true; $edit->itrifcipit->rel_id = 'r_contribuit'; $edit->itrifcipit->db_name = 'rifcipit'; $edit->itrifcipit->append($buttonsocios); $edit->itnombrepit = new inputField('Nombre', 'itnombrepit_<#i#>'); $edit->itnombrepit->size = 60; //$edit->itnombrepit->readonly=true; $edit->itnombrepit->pointer = true; $edit->itnombrepit->rel_id = 'r_contribuit'; $edit->itnombrepit->db_name = 'nombrepit'; //$edit->itnombrepit->type ='inputhidden'; if ($this->datasis->puede(473)) { $edit->buttons('add', 'add_rel', 'save'); } if ($this->datasis->puede(474)) { $edit->buttons('modify', 'save'); } if ($this->datasis->puede(475)) { $edit->buttons('delete'); } $edit->buttons('undo', 'back'); $edit->build(); $smenu['link'] = barra_menu('G13'); $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true); $conten["form"] =& $edit; $data['content'] = $this->load->view('recaudacion/r_contribu', $conten, true); $data['title'] = $this->t**s; $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() { //$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->rapyd->load('dataobject', '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('codigo' => 'codigo_<#i#>', 'descrip' => 'descrip_<#i#>', 'ultimo' => 'costo_<#i#>', 'peso' => 'sinvpeso_<#i#>'), 'p_uri' => array(4 => '<#i#>'), 'titulo' => 'Buscar Articulo', 'where' => '`tipo` = "Articulo"', 'script' => array('post_modbus_sinv(<#i#>)')); $btn = $this->datasis->p_modbus($modbus, '<#i#>'); $do = new DataObject('conv'); $do->rel_one_to_many('itconv', 'itconv', 'numero'); $do->rel_pointer('itconv', 'sinv', 'itconv.codigo=sinv.codigo', 'sinv.descrip AS sinvdescrip', 'sinv.ultimo AS sinvultimo', 'sinv.peso AS sinvpeso'); $edit = new DataDetails('Conversiones', $do); $edit->on_save_redirect = false; $edit->set_rel_title('itconv', 'Producto <#o#>'); //$edit->script($script,'create'); //$edit->script($script,'modify'); $edit->pre_process('insert', '_pre_insert'); $edit->pre_process('update', '_pre_update'); $edit->pre_process('delete', '_pre_delete'); $edit->post_process('insert', '_post_insert'); $edit->post_process('delete', '_post_delete'); $edit->post_process('update', '_post_update'); $edit->fecha = new DateonlyField('Fecha', 'fecha', 'd/m/Y'); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->rule = 'required'; $edit->fecha->mode = 'autohide'; $edit->fecha->size = 10; $edit->fecha->calendar = false; $edit->numero = new inputField('Número', 'numero'); $edit->numero->size = 10; $edit->numero->mode = 'autohide'; $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->observa1 = new inputField('Observaciones', 'observ1'); $edit->observa1->size = 40; $edit->observa1->maxlength = 80; $edit->almacen = new dropdownField('Almacén', 'almacen'); $edit->almacen->options('SELECT ubica, CONCAT(ubica,\' \',ubides) nombre FROM caub WHERE invfis="N" AND gasto<>"S" ORDER BY ubica'); $edit->almacen->rule = 'required'; $edit->almacen->style = 'width:200px;'; $edit->almacen->size = 5; //************************** // Campos para el detalle //************************** $edit->codigo = new inputField('Código <#o#>', 'codigo_<#i#>'); $edit->codigo->size = 12; $edit->codigo->db_name = 'codigo'; $edit->codigo->rel_id = 'itconv'; $edit->codigo->rule = 'required|callback_chrepetidos|callback_chcodigoa'; $edit->codigo->append($btn); $edit->descrip = new inputField('Descripción <#o#>', 'descrip_<#i#>'); $edit->descrip->db_name = 'descrip'; $edit->descrip->rel_id = 'itconv'; $edit->descrip->type = 'inputhidden'; $edit->entrada = new inputField('Entrada <#o#>', 'entrada_<#i#>'); $edit->entrada->db_name = 'entrada'; $edit->entrada->css_class = 'inputnum'; $edit->entrada->rel_id = 'itconv'; $edit->entrada->maxlength = 10; $edit->entrada->size = 6; $edit->entrada->style = 'color:green'; $edit->entrada->rule = 'required|positive'; $edit->entrada->autocomplete = false; $edit->entrada->onkeyup = 'validaEnt(<#i#>)'; $edit->entrada->onfocus = 'this.select()'; $edit->entrada->title = 'Cantidad de productos que se suman al inventario'; $edit->salida = new inputField('Salida <#o#>', 'salida_<#i#>'); $edit->salida->db_name = 'salida'; $edit->salida->css_class = 'inputnum'; $edit->salida->rel_id = 'itconv'; $edit->salida->maxlength = 10; $edit->salida->size = 6; $edit->salida->style = 'color:red'; $edit->salida->rule = 'required|positive'; $edit->salida->autocomplete = false; $edit->salida->onkeyup = 'validaSalida(<#i#>)'; $edit->salida->onfocus = 'this.select()'; $edit->salida->title = 'Cantidad de productos que se restan al inventario'; $edit->costo = new hiddenField('', 'costo_<#i#>'); $edit->costo->db_name = 'costo'; $edit->costo->rel_id = 'itconv'; $edit->sinvpeso = new inputField('', 'sinvpeso_<#i#>'); $edit->sinvpeso->db_name = 'sinvpeso'; $edit->sinvpeso->rel_id = 'itconv'; $edit->sinvpeso->pointer = true; $edit->sinvpeso->type = 'inputhidden'; //************************** //fin de campos para detalle //************************** $edit->container = new containerField('alert', '<b style="font-size:1.2em">Advertencia</b>: el costo de los productos de <b style="color:#219F21">entrada</b> <b>serán modificados</b> en base al costos de los productos de <b style="color:red">salida</b>, si los productos de entrada son mas de uno su costo se calculara tomando en cuenta su participación en peso.'); $edit->container->when = array('create'); $edit->usuario = new autoUpdateField('usuario', $this->session->userdata('usuario'), $this->session->userdata('usuario')); $edit->buttons('save', 'undo', 'back', 'add_rel', '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_conv', $conten, false); } }
function dataedit() { $this->rapyd->load('datadetails', 'dataobject'); $do = new DataObject('rivc'); //$do->pointer('scli' ,'scli.cliente=rivc.cod_cli','sprv.tipo AS sprvtipo, sprv.reteiva AS sprvreteiva','left'); $do->rel_one_to_many('itrivc', 'itrivc', array('id' => 'idrivc')); $edit = new DataDetails($this->t**s, $do); $edit->on_save_redirect = false; $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->nrocomp = new inputField('Comprobante', 'nrocomp'); $edit->nrocomp->rule = 'max_length[8]|required'; $edit->nrocomp->size = 10; $edit->nrocomp->maxlength = '8'; $edit->nrocomp->autocomplete = false; $edit->emision = new dateField('Fecha de Emisión', 'emision'); $edit->emision->rule = 'chfecha|required'; $edit->emision->size = 12; $edit->emision->maxlength = 8; $edit->emision->calendar = false; $edit->periodo = new inputField('Período', 'periodo'); $edit->periodo->rule = 'max_length[6]|required'; $edit->periodo->size = 7; $edit->periodo->insertValue = date('Ym'); $edit->periodo->maxlength = 6; $edit->fecha = new dateField('Fecha de Recepción', 'fecha'); $edit->fecha->rule = 'chfecha|required'; $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->size = 12; $edit->fecha->maxlength = 8; $edit->fecha->calendar = false; $edit->cod_cli = new inputField('Cliente', 'cod_cli'); $edit->cod_cli->rule = 'max_length[5]|required|strtoupper|existescli'; $edit->cod_cli->size = 10; //$edit->cod_cli->maxlength =5; $edit->nombre = new hiddenField('Nombre', 'nombre'); $edit->nombre->rule = 'max_length[200]'; $edit->nombre->size = 42; $edit->nombre->maxlength = 200; $edit->rif = new hiddenField('RIF', 'rif'); $edit->rif->rule = 'max_length[14]|strtoupper'; $edit->rif->size = 16; $edit->rif->maxlength = 14; $edit->rif->autocomplete = false; $edit->operacion = new radiogroupField('Operación', 'operacion', array('R' => 'Reintegrar', 'A' => 'Crear anticipo', 'P' => 'Crear CxP')); $edit->operacion->insertValue = 'A'; $edit->operacion->rule = 'required|enum[R,A,P]'; $edit->exento = new inputField('Monto Exento', 'exento'); $edit->exento->rule = 'max_length[15]|numeric'; $edit->exento->css_class = 'inputnum'; $edit->exento->size = 17; $edit->exento->maxlength = 15; $edit->tasa = new inputField('tasa', 'tasa'); $edit->tasa->rule = 'max_length[5]|numeric'; $edit->tasa->css_class = 'inputnum'; $edit->tasa->size = 7; $edit->tasa->maxlength = 5; $edit->general = new inputField('general', 'general'); $edit->general->rule = 'max_length[15]|numeric'; $edit->general->css_class = 'inputnum'; $edit->general->size = 17; $edit->general->maxlength = 15; $edit->geneimpu = new inputField('geneimpu', 'geneimpu'); $edit->geneimpu->rule = 'max_length[15]|numeric'; $edit->geneimpu->css_class = 'inputnum'; $edit->geneimpu->size = 17; $edit->geneimpu->maxlength = 15; $edit->tasaadic = new inputField('tasaadic', 'tasaadic'); $edit->tasaadic->rule = 'max_length[5]|numeric'; $edit->tasaadic->css_class = 'inputnum'; $edit->tasaadic->size = 7; $edit->tasaadic->maxlength = 5; $edit->adicional = new inputField('adicional', 'adicional'); $edit->adicional->rule = 'max_length[15]|numeric'; $edit->adicional->css_class = 'inputnum'; $edit->adicional->size = 17; $edit->adicional->maxlength = 15; $edit->adicimpu = new inputField('adicimpu', 'adicimpu'); $edit->adicimpu->rule = 'max_length[15]|numeric'; $edit->adicimpu->css_class = 'inputnum'; $edit->adicimpu->size = 17; $edit->adicimpu->maxlength = 15; $edit->tasaredu = new inputField('tasaredu', 'tasaredu'); $edit->tasaredu->rule = 'max_length[5]|numeric'; $edit->tasaredu->css_class = 'inputnum'; $edit->tasaredu->size = 7; $edit->tasaredu->maxlength = 5; $edit->reducida = new inputField('reducida', 'reducida'); $edit->reducida->rule = 'max_length[15]|numeric'; $edit->reducida->css_class = 'inputnum'; $edit->reducida->size = 17; $edit->reducida->maxlength = 15; $edit->reduimpu = new inputField('reduimpu', 'reduimpu'); $edit->reduimpu->rule = 'max_length[15]|numeric'; $edit->reduimpu->css_class = 'inputnum'; $edit->reduimpu->size = 17; $edit->reduimpu->maxlength = 15; $edit->stotal = new hiddenField('Sub-total', 'stotal'); $edit->stotal->rule = 'max_length[15]|numeric'; $edit->stotal->css_class = 'inputnum'; $edit->stotal->size = 17; $edit->stotal->maxlength = 15; $edit->impuesto = new hiddenField('Impuesto', 'impuesto'); $edit->impuesto->rule = 'max_length[15]|numeric'; $edit->impuesto->css_class = 'inputnum'; $edit->impuesto->size = 17; $edit->impuesto->maxlength = 15; $edit->gtotal = new hiddenField('Total de facturas', 'gtotal'); $edit->gtotal->rule = 'max_length[15]|numeric'; $edit->gtotal->css_class = 'inputnum'; $edit->gtotal->size = 17; $edit->gtotal->maxlength = 15; $edit->reiva = new hiddenField('Total Retenido', 'reiva'); $edit->reiva->rule = 'max_length[15]|numeric'; $edit->reiva->css_class = 'inputnum'; $edit->reiva->size = 17; $edit->reiva->maxlength = 15; $edit->estampa = new autoUpdateField('estampa', date('Ymd'), date('Ymd')); $edit->hora = new autoUpdateField('hora', date('H:i:s'), date('H:i:s')); $edit->usuario = new autoUpdateField('usuario', $this->session->userdata('usuario'), $this->session->userdata('usuario')); $edit->origen = new autoUpdateField('origen', 'R', 'R'); $edit->modificado = new inputField('modificado', 'modificado'); $edit->modificado->rule = 'max_length[8]'; $edit->modificado->size = 10; $edit->modificado->maxlength = 8; //**************************** //Inicio del Detalle //**************************** $edit->it_tipo_doc = new hiddenField('tipo_doc', 'tipo_doc_<#i#>'); $edit->it_tipo_doc->db_name = 'tipo_doc'; $edit->it_tipo_doc->rule = 'max_length[2]|enum[NC,ND,F,D]|required'; $edit->it_tipo_doc->size = 4; $edit->it_tipo_doc->maxlength = 1; $edit->it_tipo_doc->rel_id = 'itrivc'; $edit->it_fecha = new dateonlyField('fecha', 'fecha_<#i#>'); $edit->it_fecha->db_name = 'fecha'; $edit->it_fecha->rule = 'required|chfecha'; $edit->it_fecha->size = 11; $edit->it_fecha->maxlength = 10; $edit->it_fecha->rel_id = 'itrivc'; $edit->it_fecha->type = 'inputhidden'; $edit->it_numero = new inputField('numero', 'numero_<#i#>'); $edit->it_numero->db_name = 'numero'; $edit->it_numero->rule = 'max_length[12]|required|callback_chrepetidos|callback_chfac[<#i#>]|callback_chriva[<#i#>]'; $edit->it_numero->size = 14; $edit->it_numero->maxlength = 12; $edit->it_numero->title = 'Para mejorar la búsqueda coloque el tipo de documento seguido del número, Ej D000001 si es una devolución, F12345 si es una factura o NC0001 si una nota de cre&dacute;ito'; $edit->it_numero->rel_id = 'itrivc'; $edit->it_numero->autocomplete = false; $edit->it_stotal = new inputField('stotal', 'stotal_<#i#>'); $edit->it_stotal->db_name = 'stotal'; $edit->it_stotal->rule = 'max_length[15]|numeric'; $edit->it_stotal->css_class = 'inputnum'; $edit->it_stotal->size = 17; $edit->it_stotal->maxlength = 15; $edit->it_stotal->rel_id = 'itrivc'; $edit->it_stotal->showformat = 'decimal'; $edit->it_impuesto = new hiddenField('impuesto', 'impuesto_<#i#>'); $edit->it_impuesto->db_name = 'impuesto'; $edit->it_impuesto->rule = 'max_length[15]|numeric'; $edit->it_impuesto->css_class = 'inputnum'; $edit->it_impuesto->size = 17; $edit->it_impuesto->maxlength = 15; $edit->it_impuesto->showformat = 'decimal'; $edit->it_impuesto->rel_id = 'itrivc'; $edit->it_gtotal = new hiddenField('gtotal', 'gtotal_<#i#>'); $edit->it_gtotal->db_name = 'gtotal'; $edit->it_gtotal->rule = 'max_length[15]|numeric'; $edit->it_gtotal->css_class = 'inputnum'; $edit->it_gtotal->size = 17; $edit->it_gtotal->maxlength = 15; $edit->it_gtotal->rel_id = 'itrivc'; $edit->it_gtotal->showformat = 'decimal'; $edit->it_gtotal->autocomplete = false; $edit->it_reiva = new inputField('reiva', 'reiva_<#i#>'); $edit->it_reiva->db_name = 'reiva'; $edit->it_reiva->rule = 'max_length[15]|nocero|numeric'; $edit->it_reiva->css_class = 'inputnum'; $edit->it_reiva->size = 17; $edit->it_reiva->maxlength = 15; $edit->it_reiva->rel_id = 'itrivc'; $edit->it_reiva->onkeyup = 'totalizar()'; $edit->it_reiva->autocomplete = false; $edit->it_reiva->disable_paste = true; $edit->it_reiva->showformat = 'decimal'; //**************************** //Fin del Detalle //**************************** $edit->codbanc = new dropdownField('Caja', 'codbanc'); $edit->codbanc->option('', 'Seleccionar'); $edit->codbanc->options("SELECT codbanc, CONCAT_WS('-',codbanc,banco) AS label FROM banc WHERE activo='S' AND tbanco='CAJ' ORDER BY codbanc"); $edit->codbanc->rule = 'max_length[5]|condi_required|callback_chcaja'; $edit->codbanc->style = 'width:200px;'; //$edit->buttons('save', 'undo','delete', 'back','add_rel','add'); //$edit->buttons('save', 'undo', 'back','add_rel'); //$edit->buttons('add_rel'); $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; $this->load->view('view_rivc', $conten); } }
function dataedit() { //$this->datasis->modulo_id(115,1); $this->rapyd->load('dataobject', 'datadetails'); $this->rapyd->uri->keep_persistence(); $modbus = array('tabla' => 'v_ingresos', 'columnas' => array('codigo' => 'Código', 'denominacion' => 'Denominación'), 'filtro' => array('codigo' => 'Código', 'denominacion' => 'Denominacion'), 'retornar' => array('codigo' => 'itcodigopres_<#i#>', 'denominacion' => 'itdenomi_<#i#>'), 'titulo' => 'Buscar Cuenta Presupuestaria', 'p_uri' => array(4 => '<#i#>')); $modbus2 = array('tabla' => 'mbanc', 'columnas' => array('id' => 'ID', 'codbanc' => 'Banco', 'tipo_doc' => 'Tipo Doc.', 'cheque' => 'Nro. Documento', 'monto' => 'Monto'), 'filtro' => array('cheque' => 'Nro. Documento', 'monto' => 'Monto'), 'retornar' => array('id' => 'mbanc_id'), 'titulo' => 'Buscar Movimiento Bancario'); $btn = $this->datasis->p_modbus($modbus, '<#i#>'); $bmbanc = $this->datasis->modbus($modbus2); $do = new DataObject("ingresos"); $do->rel_one_to_many('itingresos', 'itingresos', array('numero' => 'numero')); $do->rel_pointer('itingresos', 'v_ingresos', 'v_ingresos.codigo=itingresos.codigopres', "v_ingresos.denominacion as denomi"); $edit = new DataDetails($this->t**s, $do); $edit->back_url = site_url($this->url . "filteredgrid"); $edit->set_rel_title('itingresos', '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->total = new inputField("Total", "total"); $edit->total->size = 10; $edit->total->readonly = true; $edit->total->css_class = 'inputnum'; $edit->mbanc_id = new inputField("ID Cheque", "mbanc_id"); $edit->mbanc_id->size = 10; $edit->mbanc_id->css_class = 'inputnum'; $edit->mbanc_id->append($bmbanc); //************************** FIN ENCABEZADO******************************************************************** //**************************INICIO DETALLE DE ASIGNACIONES ***************************************************** $edit->itcodigopres = new inputField("(<#o#>) ", "itcodigopres_<#i#>"); $edit->itcodigopres->rule = 'required'; $edit->itcodigopres->size = 20; $edit->itcodigopres->db_name = 'codigopres'; $edit->itcodigopres->rel_id = 'itingresos'; //$edit->itcodigopres->readonly =true; $edit->itcodigopres->append($btn); $edit->itdenomi = new textareaField("(<#o#>) Denominacion", "itdenomi_<#i#>"); //$edit->itdenomi->rule ='required'; $edit->itdenomi->db_name = 'denomi'; $edit->itdenomi->rel_id = 'itingresos'; $edit->itdenomi->pointer = true; $edit->itdenomi->rows = 2; $edit->itdenomi->cols = 50; $edit->itdenomi->readonly = true; $edit->itreferen1 = new inputField("(<#o#>) Inicio", 'itreferen1_<#i#>'); $edit->itreferen1->db_name = 'referen1'; $edit->itreferen1->size = 10; $edit->itreferen1->rel_id = 'itingresos'; $edit->itreferen2 = new inputField("(<#o#>) Fin", 'itreferen2_<#i#>'); $edit->itreferen2->db_name = 'referen2'; $edit->itreferen2->size = 10; $edit->itreferen2->rel_id = 'itingresos'; $edit->itmonto = new inputField("(<#o#>) Monto", 'itmonto_<#i#>'); $edit->itmonto->db_name = 'monto'; $edit->itmonto->size = 10; $edit->itmonto->rule = 'callback_positivo'; $edit->itmonto->rel_id = 'itingresos'; $edit->itmonto->css_class = 'inputnum'; $edit->itmonto->onchange = "cal_tot();"; //$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 . 'termina/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_termina", 'Marcar Ingreso como finalizado', $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', $action, "TR", "show"); } elseif ($status == 'O') { $edit->buttons("add_rel", "modify", "save", "delete"); } $edit->buttons("add_rel", "save", "undo", "back", "add"); $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_ingresos', $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(70,1); $this->rapyd->load('dataobject', 'datadetails'); $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'Cóodigo', 'rif' => 'RIF', 'nombre' => 'Nombre', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'Código', 'nombre' => 'Nombre', 'rif' => 'RIF'), 'retornar' => array('proveed' => 'cod_prov', 'nombre' => 'nombrep', 'reteiva' => 'reteiva_prov', 'rif' => 'rif'), 'script' => array('cal_lislr()', 'cal_total()'), 'titulo' => 'Buscar Beneficiario'); $bSPRV = $this->datasis->p_modbus($mSPRV, "proveed"); $do = new DataObject("otrabajo"); $do->order_by('itotrabajo', 'itotrabajo.id', 'desc'); $do->rel_one_to_many('itotrabajo', 'itotrabajo', array('numero' => 'numero')); $do->pointer('sprv', 'sprv.proveed=otrabajo.cod_prov', 'sprv.nombre as nombrep, sprv.rif as rif', 'LEFT'); $edit = new DataDetails("Orden de Compra", $do); $edit->back_url = site_url("presupuesto/otrabajo/filteredgrid"); $edit->set_rel_title('itotrabajo', 'Rubro <#o#>'); $status = $edit->get_from_dataobjetct('status'); $edit->pre_process('insert', '_valida'); $edit->pre_process('update', '_valida'); //$edit->pre_process('delete' ,'_pre_delete'); // //$edit->post_process('insert','_post_insert'); //$edit->post_process('update','_post_update'); //$edit->post_process('delete','_post_delete'); $a = ''; switch ($status) { case 'P': $a = "Sin Comprometer"; break; case 'C': $a = "Comprometida"; break; case 'T': $a = "Causada"; break; case 'O': $a = "Ordenado Pago"; break; case 'E': $a = "Pagado"; break; case 'E': $a = "No Terminada"; break; } $edit->status = new freeField("Estado", 'estado', $a); $edit->numero = new inputField("Número", "numero"); $edit->numero->mode = "autohide"; $edit->numero->when = array('show'); $edit->fecha = new dateonlyField("Fecha", "fecha"); $edit->fecha->dbformat = 'Ymd'; $edit->fecha->insertValue = date('Ymd'); $edit->fecha->size = 12; if ($status == 'P') { $edit->fecha->readonly = true; } //$edit->fecha->readonly = true; //$edit->fecha->mode="autohide"; //$edit->fecha->when = array("show","modify"); $edit->fecha->rule = "callback_chfecha"; $edit->status = new dropdownField("Estado", "status"); $edit->status->option("", ""); $edit->status->option("P", "Sin Comprometer"); $edit->status->option("C", "Comprometido"); $edit->status->option("T", "Causado"); $edit->status->option("O", "Ordenado Pago"); $edit->status->option("E", "Pagado"); $edit->status->option("A", "Anulado"); $edit->status->option("R", "Reversado"); $edit->status->option("M", "Sin Terminar"); $edit->status->option("p", "Por Modificar"); $edit->status->when = array('show'); if ($status == 'P') { $edit->status->readonly = true; } //$edit->status->readonly = true; $edit->usolicita = new dropdownField("Unidad Solicitante", "usolicita"); $edit->usolicita->options("SELECT codigo, nombre FROM uejecutora ORDER BY nombre"); $edit->usolicita->style = "width:250px"; $lsnc = '<a href="javascript:consulsprv();" title="Proveedor" onclick="">Consulta/Agrega BENEFICIARIO</a>'; $edit->cod_prov = new inputField("Beneficiario", 'cod_prov'); $edit->cod_prov->size = 4; $edit->cod_prov->rule = "trim|required"; $edit->cod_prov->append($bSPRV); //$edit->cod_prov->readonly=true; if ($status == 'P') { $edit->cod_prov->readonly = true; } $edit->cod_prov->append($lsnc); $edit->cod_prov->onchange = "cal_nprov();"; //$edit->cod_prov->mode="autohide"; $edit->nombrep = new inputField("Nombre Beneficiario", 'nombrep'); $edit->nombrep->size = 20; //$edit->nombrep->readonly = true; $edit->nombrep->pointer = true; if ($status == 'P') { $edit->nombrep->readonly = true; } //$edit->nombrep->readonly = true; $edit->reteiva_prov = new inputField("% R.IVA", "reteiva_prov"); $edit->reteiva_prov->size = 2; //$edit->reteiva_prov->mode="autohide"; $edit->reteiva_prov->when = array('modify', 'create', 'show'); $edit->reteiva_prov->readonly = true; if ($status == 'P') { $edit->reteiva_prov->readonly = true; } $edit->rif = new inputField("RIF", "rif"); $edit->rif->size = 10; $edit->rif->pointer = true; if ($status == 'P') { $edit->rif->readonly = true; } $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_total();'; if ($status == 'P') { $edit->creten->readonly = true; } $edit->condiciones = new textAreaField("Condiciones Especiales", 'condiciones'); $edit->condiciones->rule = "trim"; $edit->condiciones->cols = 25; $edit->condiciones->rows = 2; $edit->lentrega = new textAreaField("Lugar de Entrega", 'lentrega'); $edit->lentrega->cols = 25; $edit->lentrega->rows = 2; if ($status == 'P') { $edit->lentrega->readonly = true; } if ($this->datasis->traevalor("USAOCOMPRAPROCED") == 'S') { $edit->proced = new inputField("Procedimiento", "proced"); $edit->proced->size = 20; //$edit->proced->typ;='inputhidden'; } if ($this->datasis->traevalor("USACOMPEFP") == 'S') { $edit->pentret = new dropdownField("Plazo Entrega", "pentret"); $edit->pentret->option("M", "Meses"); $edit->pentret->option("H", "Dias Habiles"); $edit->pentret->option("C", "Dias Continuos"); $edit->pentret->style = "width:150px;"; if ($status == 'P') { $edit->pentret->readonly = true; } $edit->pentrec = new inputField("", 'pentrec'); $edit->pentrec->size = 5; $edit->pentrec->css_class = 'inputnum'; $edit->pentrec->rule = 'required|numeric'; if ($status == 'P') { $edit->pentrec->readonly = true; } } $edit->subtotal = new inputField("Total Base Imponible", 'subtotal'); $edit->subtotal->css_class = 'inputnum'; $edit->subtotal->size = 8; if ($status == 'P') { $edit->subtotal->readonly = true; } //$edit->subtotal->mode="autohide"; $edit->ivaa = new inputField("IVA Sobre Tasa", 'ivaa'); $edit->ivaa->css_class = 'inputnum'; $edit->ivaa->size = 8; if ($status == 'P') { $edit->ivaa->readonly = true; } //$edit->ivaa->mode="autohide"; $edit->ivag = new inputField("IVA Tasa General", 'ivag'); $edit->ivag->css_class = 'inputnum'; $edit->ivag->size = 8; if ($status == 'P') { $edit->ivag->readonly = true; } //$edit->ivag->mode="autohide"; $edit->ivar = new inputField("IVA Tasa reducida", 'ivar'); $edit->ivar->css_class = 'inputnum'; $edit->ivar->size = 8; if ($status == 'P') { $edit->ivar->readonly = true; } //$edit->ivar->mode="autohide"; $edit->exento = new inputField("Exento", 'exento'); $edit->exento->css_class = 'inputnum'; $edit->exento->size = 8; if ($status == 'P') { $edit->exento->readonly = true; } //$edit->exento->mode="autohide"; $edit->reteiva = new inputField("Retencion de IVA", 'reteiva'); $edit->reteiva->css_class = 'inputnum'; $edit->reteiva->size = 8; if ($status == 'P') { $edit->reteiva->readonly = true; } //$edit->reteiva->mode="autohide"; $edit->reten = new inputField("Retencion de ISLR", 'reten'); $edit->reten->css_class = 'inputnum'; $edit->reten->size = 8; if ($status == 'P') { $edit->reten->readonly = true; } //$edit->reten->mode="autohide"; $edit->total2 = new inputField("Total", 'total2'); $edit->total2->css_class = 'inputnum'; $edit->total2->size = 8; if ($status == 'P') { $edit->total2->readonly = true; } //$edit->total2->mode="autohide"; $edit->itdescripcion = new textareaField("(<#o#>) Descripción", "descripcion_<#i#>"); $edit->itdescripcion->db_name = 'descripcion'; $edit->itdescripcion->cols = 30; $edit->itdescripcion->rows = 2; //$edit->itdescripcion->rule = 'required'; $edit->itdescripcion->rel_id = 'itotrabajo'; //$edit->itdescripcion->mode="autohide"; $edit->itunidad = new dropdownField("(<#o#>) Unidad", "unidad_<#i#>"); $edit->itunidad->db_name = 'unidad'; $edit->itunidad->rule = 'required'; $edit->itunidad->rel_id = 'itotrabajo'; $edit->itunidad->options("SELECT unidades AS id,unidades FROM unidad ORDER BY unidades"); $edit->itunidad->style = "width:70px"; //$edit->itunidad->mode="autohide"; $edit->itcantidad = new inputField("(<#o#>) Cantidad", "cantidad_<#i#>"); $edit->itcantidad->css_class = 'inputnum'; $edit->itcantidad->db_name = 'cantidad'; $edit->itcantidad->rel_id = 'itotrabajo'; $edit->itcantidad->rule = 'numeric'; $edit->itcantidad->onchange = 'cal_importe(<#i#>);'; $edit->itcantidad->size = 4; //$edit->itcantidad->mode="autohide"; $edit->itprecio = new inputField("(<#o#>) Precio", "precio_<#i#>"); $edit->itprecio->css_class = 'inputnum'; $edit->itprecio->db_name = 'precio'; $edit->itprecio->rel_id = 'itotrabajo'; $edit->itprecio->rule = 'callback_positivo'; $edit->itprecio->onchange = 'cal_importe(<#i#>);'; $edit->itprecio->size = 6; //$edit->itprecio->mode="autohide"; $edit->itiva = new dropdownField("(<#o#>) IVA", "iva_<#i#>"); $edit->itiva->db_name = 'iva'; $edit->itiva->rel_id = 'itotrabajo'; $edit->itiva->onchange = 'cal_importe(<#i#>);'; $edit->itiva->options($this->_ivaplica()); $edit->itiva->option("0", "0%"); $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 = 'itotrabajo'; $edit->itimporte->rule = 'numeric'; $edit->itimporte->onchange = 'cal_importep(<#i#>);'; //$edit->itimporte->readonly =true; $edit->itimporte->size = 8; if ($status == 'P') { $edit->itimporte->readonly = true; } //$edit->itimporte->mode="autohide"; $edit->redondear = new dropdownField("Redondear", "redondear"); $edit->redondear->option("R2", "Sumar Redondear 2 Decimales"); $edit->redondear->option("R0", "Sumar SIN Redondear 2 Decimales"); //$edit->redondear->onchange = "cal_total();"; if ($status == 'P') { $edit->buttons("modify"); $edit->buttons("save"); $action = "javascript:window.location='" . site_url('presupuesto/otrabajo/terminada/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_status", 'Marcar Como terminada', $action, "TR", "show"); $action = "javascript:btn_anular('" . $edit->rapyd->uri->get_edited_id() . "')"; $edit->button_status("btn_anular", 'Anular', $action, "TR", "show"); } elseif ($status == 'C') { $action = "javascript:btn_noterminada('" . $edit->rapyd->uri->get_edited_id() . "')"; $edit->button_status("btn_rever", 'Marcar como NO Terminada', $action, "TR", "show"); } elseif ($status == 'A') { $edit->buttons("delete"); } else { $edit->buttons("modify"); $edit->buttons("save"); } $edit->buttons("undo", "back", "add_rel", "add"); $edit->build(); $ivaplica = $this->ivaplica2(); $conten['ivar'] = $ivaplica['redutasa']; $conten['ivag'] = $ivaplica['tasa']; $conten['ivaa'] = $ivaplica['sobretasa']; $conten['title2'] = $this->t**s; $smenu['link'] = barra_menu('12A'); $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true); $conten["form"] =& $edit; $data['content'] = $this->load->view('view_otrabajo', $conten, true); $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(); $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 _decruc() { $this->rapyd->load('dataobject', 'datadetails'); $do = new DataObject('cruc'); $do->rel_one_to_many('itcruc', 'itcruc', 'numero'); $edit = new DataDetails($this->t**s, $do); $edit->on_save_redirect = false; $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->numero = new inputField('Número', 'numero'); $edit->numero->rule = ''; $edit->numero->size = 10; $edit->numero->maxlength = 8; $edit->numero->when = array('show'); $edit->fecha = new dateonlyField('Fecha', 'fecha'); $edit->fecha->size = 10; $edit->fecha->maxlength = 8; $edit->fecha->calendar = false; $edit->fecha->rule = 'required|chfecha|chfechafut'; $edit->fecha->insertValue = date('Y-m-d'); $edit->proveed = new inputField('Proveedor', 'proveed'); $edit->proveed->size = 10; $edit->nombre = new inputField('Nombre', 'nombre'); $edit->nombre->type = 'inputhidden'; $edit->nombre->rule = ''; $edit->nombre->size = 35; $edit->nombre->maxlength = 40; $edit->saldoa = new inputField('Saldo Acreedor', 'saldoa'); $edit->saldoa->rule = 'numeric'; $edit->saldoa->css_class = 'inputnum'; $edit->saldoa->size = 10; $edit->saldoa->maxlength = 16; $edit->saldoa->type = 'inputhidden'; $edit->saldoa->insertValue = '0'; $edit->saldoa->showformat = 'decimal'; $edit->cliente = new inputField('Cliente', 'cliente'); $edit->cliente->size = 10; $edit->nomcli = new inputField('Nomcli', 'nomcli'); $edit->nomcli->type = 'inputhidden'; $edit->nomcli->rule = ''; $edit->nomcli->size = 35; $edit->nomcli->maxlength = 40; $edit->saldod = new inputField('Saldo Deudor', 'saldod'); $edit->saldod->rule = 'numeric'; $edit->saldod->css_class = 'inputnum'; $edit->saldod->size = 10; $edit->saldod->maxlength = 16; $edit->saldod->type = 'inputhidden'; $edit->saldod->insertValue = '0'; $edit->saldod->showformat = 'decimal'; $edit->monto = new inputField('Monto Cruzado', 'monto'); $edit->monto->rule = 'numeric|positive'; $edit->monto->css_class = 'inputnum'; $edit->monto->size = 12; $edit->monto->maxlength = 16; $edit->monto->showformat = 'decimal'; $edit->monto->type = 'inputhidden'; $edit->concept1 = new inputField('Concepto', 'concept1'); $edit->concept1->rule = ''; $edit->concept1->size = 42; $edit->concept1->maxlength = 40; $edit->concept2 = new inputField(' ', 'concept2'); $edit->concept2->rule = ''; $edit->concept2->size = 42; $edit->concept2->maxlength = 40; //inicio del detalle $edit->itonumero = new inputField('Numero', 'itonumero_<#i#>'); $edit->itonumero->rule = 'max_length[10]'; $edit->itonumero->db_name = 'onumero'; $edit->itonumero->type = 'inputhidden'; $edit->itonumero->size = 13; $edit->itonumero->maxlength = 10; $edit->itonumero->rel_id = 'itcruc'; $edit->itofecha = new inputField('Fecha', 'itofecha_<#i#>'); //$edit->itofecha->rule = 'chfecha'; $edit->itofecha->db_name = 'ofecha'; $edit->itofecha->type = 'inputhidden'; $edit->itofecha->size = 10; $edit->itofecha->maxlength = 8; $edit->itofecha->rel_id = 'itcruc'; $edit->itmonto = new inputField('Monto', 'itmonto_<#i#>'); $edit->itmonto->rule = 'max_length[17]|numeric|positive|callback_chsaldo[<#i#>]'; $edit->itmonto->css_class = 'inputnum'; $edit->itmonto->db_name = 'monto'; $edit->itmonto->rel_id = 'itcruc'; $edit->itmonto->size = 19; $edit->itmonto->maxlength = 17; $edit->ittipo = new hiddenField('', 'ittipo_<#i#>'); $edit->ittipo->db_name = 'tipo'; $edit->ittipo->rel_id = 'itcruc'; //Campos comodines $edit->itpmonto = new inputField('', 'itpmonto_<#i#>'); $edit->itpmonto->db_name = 'pmonto'; $edit->itpmonto->type = 'inputhidden'; $edit->itpmonto->rel_id = 'itcruc'; $edit->itpsaldo = new inputField('', 'itpsaldo_<#i#>'); $edit->itpsaldo->db_name = 'psaldo'; $edit->itpsaldo->type = 'inputhidden'; $edit->itpsaldo->rel_id = 'itcruc'; //fin campos comodines, fin del detalle $edit->estampa = new autoUpdateField('estampa', date('Ymd'), date('Ymd')); $edit->hora = new autoUpdateField('hora', date('H:i:s'), date('H:i:s')); $edit->usuario = new autoUpdateField('usuario', $this->session->userdata('usuario'), $this->session->userdata('usuario')); return $edit; }
function dataedit() { $this->rapyd->load('dataobject', 'datadetails'); $script = ' $(function() { $("#fecha").datepicker({dateFormat:"dd/mm/yy"}); $(".inputnum").numeric("."); });'; $do = new DataObject('rcobro'); $do->rel_one_to_many('smov', 'smov', array('id' => 'rcobro')); $edit = new DataDetails($this->t**s, $do); $edit->script($script, 'modify'); $edit->script($script, 'create'); $edit->on_save_redirect = false; $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->tipo = new inputField('Tipo', 'tipo'); $edit->tipo->rule = ''; $edit->tipo->size = 3; $edit->tipo->maxlength = 1; $edit->tipo->insertValue = 'P'; $edit->fecha = new dateonlyField('Fecha', 'fecha'); $edit->fecha->rule = 'chfecha'; $edit->fecha->calendar = false; $edit->fecha->size = 10; $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->maxlength = 8; $edit->fecha->calendar = false; $edit->retorno = new dateonlyField('Recepción', 'retorno'); $edit->retorno->rule = 'chfecha'; $edit->retorno->calendar = false; $edit->retorno->size = 10; $edit->retorno->maxlength = 8; $edit->retorno->calendar = false; /* $edit->vende = new inputField('Vendedor','vende'); $edit->vende->rule=''; $edit->vende->size =5; $edit->vende->maxlength =5; */ $edit->vende = new dropdownField('Cobrador', 'vende'); $edit->vende->options('SELECT vendedor, CONCAT(vendedor," - ",nombre) nombre FROM vend WHERE tipo IN ("C","A") ORDER BY nombre'); $edit->vende->style = "width:250px;"; $edit->observa = new textareaField('Observación', 'observa'); $edit->observa->rule = ''; $edit->observa->cols = 70; $edit->observa->rows = 2; $edit->facturas = new inputField('Nro. de Facturas', 'facturas'); $edit->facturas->rule = 'integer'; $edit->facturas->css_class = 'inputonlynum'; $edit->facturas->type = 'inputhidden'; $edit->facturas->showformat = 'decimal'; $edit->facturas->readonly = true; $edit->monto = new inputField('Monto total', 'total'); $edit->monto->db_name = 'monto'; $edit->monto->rule = 'numeric'; $edit->monto->css_class = 'inputnum'; $edit->monto->type = 'inputhidden'; $edit->monto->showformat = 'decimal'; $edit->monto->readonly = true; $edit->estampa = new autoUpdateField('estampa', date('Ymd'), date('Ymd')); $edit->usuario = new autoUpdateField('usuario', $this->session->userdata('usuario'), $this->session->userdata('usuario')); $edit->hora = new autoUpdateField('hora', date('H:i:s'), date('H:i:s')); //************************************************************** // Detalle //************************************************************** $edit->itid = new hiddenField('Id', 'id_<#i#>'); $edit->itid->rule = ''; $edit->itid->db_name = 'id'; $edit->itid->rel_id = 'smov'; $edit->tipo_doc = new inputField('Tipo Doc.', 'tipo_doc_<#i#>'); $edit->tipo_doc->db_name = 'tipo_doc'; $edit->tipo_doc->rule = ''; $edit->tipo_doc->rel_id = 'smov'; $edit->tipo_doc->type = 'inputhidden'; $edit->numero = new inputField('Número', 'numero_<#i#>'); $edit->numero->db_name = 'numero'; $edit->numero->rule = ''; $edit->numero->size = 10; $edit->numero->maxlength = 8; $edit->numero->rel_id = 'smov'; $edit->fechad = new dateonlyField('Fecha', 'fechad_<#i#>'); $edit->fechad->db_name = 'fechad'; $edit->fechad->rule = 'chfecha'; $edit->fechad->rel_id = 'smov'; $edit->fechad->calendar = false; $edit->fechad->readonly = true; $edit->fechad->type = 'inputhidden'; $edit->vence = new dateonlyField('Vence', 'vence_<#i#>'); $edit->vence->db_name = 'vence'; $edit->vence->rule = 'chfecha'; $edit->vence->rel_id = 'smov'; $edit->vence->type = 'inputhidden'; $edit->vence->calendar = false; $edit->vence->readonly = true; /* $edit->vd = new inputField('Vd','vd_<#i#>'); $edit->vd->rule=''; $edit->vd->size =7; $edit->vd->maxlength =5; $edit->vd->rel_id ='smov'; $edit->cod_cli = new inputField('Cod_cli','cod_cli_<#i#>'); $edit->cod_cli->rule=''; $edit->cod_cli->size =7; $edit->cod_cli->maxlength =5; $edit->cod_cli->rel_id ='smov'; */ $edit->nombre = new inputField('Nombre', 'nombre_<#i#>'); $edit->nombre->db_name = 'nombre'; $edit->nombre->rule = ''; $edit->nombre->rel_id = 'smov'; $edit->nombre->type = 'inputhidden'; $edit->nombre->readonly = true; /* $edit->referen = new inputField('Referen','referen_<#i#>'); $edit->referen->rule=''; $edit->referen->size =3; $edit->referen->maxlength =1; $edit->referen->rel_id ='smov'; $edit->totals = new inputField('Totals','monto_<#i#>'); $edit->totals->rule='numeric'; $edit->totals->css_class='inputnum'; $edit->totals->size =14; $edit->totals->maxlength =12; $edit->totals->rel_id ='sfac'; */ $edit->totalg = new inputField('Total', 'monto_<#i#>'); $edit->totalg->db_name = 'monto'; $edit->totalg->rule = 'numeric'; $edit->totalg->css_class = 'inputnum'; $edit->totalg->size = 14; $edit->totalg->maxlength = 12; $edit->totalg->rel_id = 'smov'; $edit->totalg->type = 'inputhidden'; $edit->totalg->readonly = true; //****************************************************************** $edit->buttons('add_rel'); $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; $this->load->view('view_rcobro', $conten); } }
function dataedit() { $this->rapyd->load('dataobject', '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('codigo' => 'codigoa_<#i#>', 'descrip' => 'desca_<#i#>'), 'p_uri' => array(4 => '<#i#>'), 'titulo' => 'Buscar Artículo', 'where' => '`activo` = "S"'); $btn = $this->datasis->p_modbus($modbus, '<#i#>'); $mSCLId = array('tabla' => 'scli', 'columnas' => array('cliente' => 'Código Cliente', 'nombre' => 'Nombre', 'cirepre' => 'Rif/Cedula', 'dire11' => 'Dirección', 'tipo' => 'Tipo'), 'filtro' => array('cliente' => 'Código Cliente', 'nombre' => 'Nombre'), 'retornar' => array('cliente' => 'cod_cli', 'nombre' => 'nombre', 'rifci' => 'rifci', 'dire11' => 'direc', 'tipo' => 'sclitipo'), 'titulo' => 'Buscar Cliente'); $boton = $this->datasis->modbus($mSCLId); $do = new DataObject('sfac'); $do->rel_one_to_many('sitems', 'sitems', array('numero' => 'numa', 'tipo_doc' => 'tipoa')); $do->rel_one_to_many('sfpa', 'sfpa', array('numero', 'tipo_doc')); $edit = new DataDetails('Facturas', $do); $edit->back_url = site_url('ventas/sfacc/filteredgrid'); $edit->set_rel_title('sitems', 'Producto <#o#>'); $edit->pre_process('insert', '_pre_insert'); $edit->pre_process('update', '_pre_update'); $edit->post_process('insert', '_post_insert'); $edit->post_process('update', '_post_update'); $edit->post_process('delete', '_post_delete'); $edit->fecha = new DateonlyField('Fecha', 'fecha', 'd/m/Y'); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->rule = 'required'; $edit->fecha->mode = 'autohide'; $edit->fecha->size = 10; $edit->tipo_doc = new dropdownField('Tipo D.', 'tipo_doc'); $edit->tipo_doc->option('F', 'Factura'); $edit->tipo_doc->option('D', 'Devolución'); $edit->tipo_doc->style = 'width:200px;'; $edit->tipo_doc->size = 5; $edit->vd = new dropdownField('Vendedor', 'vd'); $edit->vd->options('SELECT vendedor, CONCAT(vendedor,\' \',nombre) nombre FROM vend ORDER BY vendedor'); $edit->vd->style = 'width:200px;'; $edit->vd->size = 5; $edit->numero = new inputField('Número', 'numero'); $edit->numero->size = 10; $edit->numero->mode = 'autohide'; $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->peso = new inputField('Peso', 'peso'); $edit->peso->css_class = 'inputnum'; $edit->peso->readonly = true; $edit->peso->size = 10; $edit->cliente = new inputField('Cliente', 'cod_cli'); $edit->cliente->size = 6; $edit->cliente->maxlength = 5; $edit->cliente->append($boton); $edit->nombre = new inputField('Nombre', 'nombre'); $edit->nombre->size = 25; $edit->nombre->maxlength = 40; $edit->nombre->autocomplete = false; $edit->nombre->rule = 'required'; $edit->rifci = new inputField('RIF/CI', 'rifci'); $edit->rifci->autocomplete = false; $edit->rifci->size = 15; $edit->direc = new inputField('Dirección', 'direc'); $edit->direc->size = 40; //************************** // Campos para el detalle 1 sitems //************************** $edit->codigoa = new inputField('Código <#o#>', 'codigoa_<#i#>'); $edit->codigoa->size = 12; $edit->codigoa->db_name = 'codigoa'; $edit->codigoa->readonly = true; $edit->codigoa->rel_id = 'sitems'; $edit->codigoa->rule = 'required'; $edit->desca = new inputField('Descripción <#o#>', 'desca_<#i#>'); $edit->desca->size = 36; $edit->desca->db_name = 'desca'; $edit->desca->maxlength = 50; $edit->desca->readonly = true; $edit->desca->rel_id = 'sitems'; $edit->cana = new inputField('Cantidad <#o#>', 'cana_<#i#>'); $edit->cana->db_name = 'cana'; $edit->cana->css_class = 'inputnum'; $edit->cana->rel_id = 'sitems'; $edit->cana->maxlength = 10; $edit->cana->size = 6; $edit->cana->rule = 'required|positive'; $edit->cana->autocomplete = false; $edit->preca = new inputField('Precio <#o#>', 'preca_<#i#>'); $edit->preca->db_name = 'preca'; $edit->preca->css_class = 'inputnum'; $edit->preca->rel_id = 'sitems'; $edit->preca->size = 10; $edit->preca->rule = 'required|positive'; $edit->preca->readonly = true; $edit->tota = new inputField('Importe <#o#>', 'tota_<#i#>'); $edit->tota->db_name = 'tota'; $edit->tota->size = 10; $edit->tota->css_class = 'inputnum'; $edit->tota->rel_id = 'sitems'; //************************** //fin de campos para detalle,inicio detalle2 sfpa //************************** $edit->tipo = new inputField('Tipo <#o#>', 'tipo_<#i#>'); $edit->tipo->size = 12; $edit->tipo->db_name = 'tipo'; $edit->tipo->readonly = true; $edit->tipo->rel_id = 'sfpa'; $edit->tipo->rule = 'required'; $edit->monto = new inputField('Monto <#o#>', 'monto_<#i#>'); $edit->monto->db_name = 'monto'; $edit->monto->css_class = 'inputnum'; $edit->monto->rel_id = 'sfpa'; $edit->monto->size = 10; $edit->monto->rule = 'required|positive'; $edit->monto->readonly = true; $edit->banco = new inputField('Banco <#o#>', 'banco_<#i#>'); $edit->banco->size = 36; $edit->banco->db_name = 'banco'; $edit->banco->maxlength = 50; $edit->banco->readonly = true; $edit->banco->rel_id = 'sfpa'; //************************** //Fin detalle 2 //************************** $edit->ivat = new inputField('Impuesto', 'iva'); $edit->ivat->css_class = 'inputnum'; $edit->ivat->readonly = true; $edit->ivat->size = 10; $edit->totals = new inputField('Sub-Total', 'totals'); $edit->totals->css_class = 'inputnum'; $edit->totals->readonly = true; $edit->totals->size = 10; $edit->totalg = new inputField('Monto Total', 'totalg'); $edit->totalg->css_class = 'inputnum'; $edit->totalg->readonly = true; $edit->totalg->size = 10; $edit->usuario = new autoUpdateField('usuario', $this->session->userdata('usuario'), $this->session->userdata('usuario')); $edit->buttons('modify', 'save', 'undo', 'delete', 'back', 'add_rel'); $edit->build(); $conten['form'] =& $edit; $data['content'] = $this->load->view('view_sfac', $conten, true); $data['title'] = heading('Facturas'); $data['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->rapyd->get_head() . phpscript('nformat.js') . script('plugins/jquery.numeric.pack.js') . script('plugins/jquery.floatnumber.js') . phpscript('nformat.js'); $this->load->view('view_ventanas', $data); }
function dataedit() { $this->rapyd->load('dataobject', 'datadetails'); $script = ' $(function() { $("#fecha").datepicker({dateFormat:"dd/mm/yy"}); $(".inputnum").numeric("."); }); '; $do = new DataObject('sinvaudit'); $do->rel_one_to_many('itsinvaudit', 'itsinvaudit', 'numero'); $edit = new DataDetails($this->t**s, $do); $edit->script($script, 'modify'); $edit->script($script, 'create'); $edit->on_save_redirect = false; $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_sinv = new inputField('Id_sinv', 'id_sinv'); $edit->id_sinv->rule = 'integer'; $edit->id_sinv->css_class = 'inputonlynum'; $edit->id_sinv->size = 13; $edit->id_sinv->maxlength = 11; $edit->status = new inputField('Status', 'status'); $edit->status->rule = ''; $edit->status->size = 3; $edit->status->maxlength = 1; $edit->codigo = new inputField('Codigo', 'codigo'); $edit->codigo->rule = ''; $edit->codigo->size = 17; $edit->codigo->maxlength = 15; $edit->corte = new dateonlyField('Corte', 'corte'); $edit->corte->rule = 'chfecha'; $edit->corte->calendar = false; $edit->corte->size = 10; $edit->corte->maxlength = 8; $edit->existen = new inputField('Existen', 'existen'); $edit->existen->rule = 'numeric'; $edit->existen->css_class = 'inputnum'; $edit->existen->size = 12; $edit->existen->maxlength = 10; $edit->estampa = new autoUpdateField('estampa', date('Ymd'), date('Ymd')); $edit->usuario = new autoUpdateField('usuario', $this->session->userdata('usuario'), $this->session->userdata('usuario')); //****************************************************************** // Detalle $edit->id_sinvaudit = new inputField('Id_sinvaudit', 'id_sinvaudit_<#i#>'); $edit->id_sinvaudit->rule = 'integer'; $edit->id_sinvaudit->css_class = 'inputonlynum'; $edit->id_sinvaudit->size = 13; $edit->id_sinvaudit->maxlength = 11; $edit->id_sinvaudit->rel_id = 'itsinvaudit'; $edit->almacen = new inputField('Almacen', 'almacen_<#i#>'); $edit->almacen->rule = ''; $edit->almacen->size = 52; $edit->almacen->maxlength = 50; $edit->almacen->rel_id = 'itsinvaudit'; $edit->existen = new inputField('Existen', 'existen_<#i#>'); $edit->existen->rule = 'numeric'; $edit->existen->css_class = 'inputnum'; $edit->existen->size = 15; $edit->existen->maxlength = 13; $edit->existen->rel_id = 'itsinvaudit'; $edit->despacho = new inputField('Despacho', 'despacho_<#i#>'); $edit->despacho->rule = 'numeric'; $edit->despacho->css_class = 'inputnum'; $edit->despacho->size = 15; $edit->despacho->maxlength = 13; $edit->despacho->rel_id = 'itsinvaudit'; $edit->reparto = new inputField('Reparto', 'reparto_<#i#>'); $edit->reparto->rule = 'numeric'; $edit->reparto->css_class = 'inputnum'; $edit->reparto->size = 15; $edit->reparto->maxlength = 13; $edit->reparto->rel_id = 'itsinvaudit'; $edit->pendiente = new inputField('Pendiente', 'pendiente_<#i#>'); $edit->pendiente->rule = 'numeric'; $edit->pendiente->css_class = 'inputnum'; $edit->pendiente->size = 15; $edit->pendiente->maxlength = 13; $edit->pendiente->rel_id = 'itsinvaudit'; $edit->contado = new inputField('Contado', 'contado_<#i#>'); $edit->contado->rule = 'numeric'; $edit->contado->css_class = 'inputnum'; $edit->contado->size = 15; $edit->contado->maxlength = 13; $edit->contado->rel_id = 'itsinvaudit'; //****************************************************************** $edit->buttons('add_rel'); $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; $this->load->view('view_sinvaudit', $conten); } }
function dataedit() { $this->rapyd->load('datadetails', 'dataobject'); $this->load->helper('form'); $mBANC = array('tabla' => 'banc', 'columnas' => array('codbanc' => 'Cóodigo', 'banco' => 'Banco', 'numcuent' => 'Cuenta', 'saldo' => 'Saldo'), 'filtro' => array('codbanc' => 'Cóodigo', 'banco' => 'Banco', 'numcuent' => 'Cuenta', 'saldo' => 'Saldo'), 'p_uri' => array(4 => '<#i#>'), 'retornar' => array('codbanc' => 'codbanc_<#i#>'), 'where' => 'activo = "S" ', 'titulo' => 'Buscar Bancos'); $bBANC = $this->datasis->p_modbus($mBANC, "<#i#>"); $mRECIBO = array('tabla' => 'recibo', 'columnas' => array('id' => 'Ref.', 'numero' => 'Numero', 'fecha' => 'Fecha', 'monto' => 'Monto', 'rifci' => 'RIF/CI', 'nombre' => 'Nombre', 'observa' => 'Observa'), 'filtro' => array('id' => 'Ref.', 'numero' => 'Numero', 'fecha' => 'Fecha', 'monto' => 'Monto', 'rifci' => 'RIF/CI', 'nombre' => 'Nombre', 'observa' => 'Observa'), 'p_uri' => array(4 => '<#i#>'), 'retornar' => array('id' => 'recibo_<#i#>', 'numero' => 'numerop_<#i#>', 'DATE_FORMAT(fecha,"%d/%m/%Y")' => 'fechap_<#i#>', 'monto' => 'montop_<#i#>', 'nombre' => 'nombrep_<#i#>', 'observa' => 'observap_<#i#>'), 'where' => 'status = "P" ', 'script' => array('cal_totr()'), 'titulo' => 'Buscar Recibos por Pagar'); $bRECIBO = $this->datasis->p_modbus($mRECIBO, "<#i#>"); $do = new DataObject("abonos"); $do->rel_one_to_many('itabonos', 'itabonos', array('id' => 'abono')); $do->rel_one_to_many('sfpa', 'sfpa', array('id' => 'abono')); $do->rel_pointer('itabonos', 'recibo', 'itabonos.recibo=recibo.id', 'recibo.numero AS numerop,recibo.fecha AS fechap,recibo.monto AS montop,recibo.observa AS observap,recibo.tipo AS tipop,recibo.nombre AS nombrep,recibo.id AS idp', 'LEFT'); $edit = new DataDetails($this->t**s, $do); $edit->back_url = site_url($this->url . "filteredgrid"); $edit->set_rel_title('itabonos', 'Rubro <#o#>'); $edit->set_rel_title('sfpa', 'Rubro <#o#>'); $edit->back_url = site_url($this->url . "filteredgrid"); $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->id = new inputField('id', 'id'); $edit->id->rule = 'max_length[11]'; $edit->id->size = 13; $edit->id->maxlength = 11; $edit->id->mode = 'autohide'; $edit->id->when = array('show', 'modify'); $edit->totr = new inputField("Total Recibos", 'totr'); $edit->totr->size = 10; $edit->totr->readonly = true; $edit->totr->css_class = 'inputnum'; $edit->totb = new inputField("Total Bancos", 'totb'); $edit->totb->size = 10; $edit->totb->readonly = true; $edit->totb->css_class = 'inputnum'; $edit->estampa = new autoUpdateField('estampa', date('Ymd'), date('Ymd')); /******** RECIBOS *************/ $edit->itrecibo = new inputField("(<#o#>) Ref. Recibo", 'recibo_<#i#>'); $edit->itrecibo->db_name = 'recibo'; $edit->itrecibo->size = 5; $edit->itrecibo->rel_id = 'itabonos'; $edit->itrecibo->readonly = true; $edit->itrecibo->append($bRECIBO); $edit->itnumerop = new inputField("(<#o#>) Numero", 'numerop_<#i#>'); $edit->itnumerop->db_name = 'numerop'; $edit->itnumerop->size = 10; $edit->itnumerop->rel_id = 'itabonos'; $edit->itnumerop->pointer = true; $edit->itnumerop->readonly = true; $edit->itfechap = new inputField("(<#o#>) Fecha", 'fechap_<#i#>'); $edit->itfechap->db_name = 'fechap'; $edit->itfechap->size = 10; $edit->itfechap->rel_id = 'itabonos'; $edit->itfechap->pointer = true; $edit->itfechap->readonly = true; $edit->itmontop = new inputField("(<#o#>) Monto", 'montop_<#i#>'); $edit->itmontop->db_name = 'montop'; $edit->itmontop->size = 10; $edit->itmontop->rel_id = 'itabonos'; $edit->itmontop->pointer = true; $edit->itmontop->readonly = true; $edit->itmontop->value = 0; $edit->itnombrep = new inputField("(<#o#>) Nombre", 'nombrep_<#i#>'); $edit->itnombrep->db_name = 'nombrep'; $edit->itnombrep->size = 20; $edit->itnombrep->rel_id = 'itabonos'; $edit->itnombrep->pointer = true; $edit->itnombrep->readonly = true; $edit->itobservap = new inputField("(<#o#>) Observación", 'observap_<#i#>'); $edit->itobservap->db_name = 'observap'; $edit->itobservap->size = 30; $edit->itobservap->rel_id = 'itabonos'; $edit->itobservap->pointer = true; $edit->itobservap->readonly = true; /****** CHEQUES *********************/ $edit->itcodbanc = new inputField("(<#o#>) Banco", 'codbanc_<#i#>'); $edit->itcodbanc->db_name = 'codbanc'; $edit->itcodbanc->size = 4; $edit->itcodbanc->rel_id = 'sfpa'; $edit->itcodbanc->rule = "required|callback_banco"; $edit->itcodbanc->append($bBANC); $edit->itcodbanc->value = $this->datasis->traevalor('ABONOCODBANCDEFECTO'); $edit->ittipo_doc = new dropdownField("(<#o#>) Tipo Documento", "tipo_doc_<#i#>"); $edit->ittipo_doc->db_name = 'tipo_doc'; $edit->ittipo_doc->rel_id = 'sfpa'; $edit->ittipo_doc->style = "width:130px;"; if ($this->datasis->traevalor('ABONOS_EF_DEFECTO') == 'S') { $edit->ittipo_doc->option("EF", "Efectivo"); $edit->ittipo_doc->option("DP", "Deposito"); $edit->ittipo_doc->option("DB", "Tarjeta Débito"); $edit->ittipo_doc->option("DF", "Diferencia"); } else { $edit->ittipo_doc->option("DP", "Deposito"); $edit->ittipo_doc->option("DB", "Tarjeta Débito"); $edit->ittipo_doc->option("DF", "Diferencia"); $edit->ittipo_doc->option("EF", "Efectivo"); } $edit->itcheque = new inputField("(<#o#>) Transacción", 'cheque_<#i#>'); $edit->itcheque->db_name = 'cheque'; $edit->itcheque->size = 20; $edit->itcheque->rel_id = 'sfpa'; $edit->itfecha = new dateonlyField("(<#o#>) Fecha Cheque", "fecha_<#i#>"); $edit->itfecha->db_name = 'fecha'; $edit->itfecha->size = 10; $edit->itfecha->rel_id = 'sfpa'; $edit->itfecha->insertValue = date('Ymd'); $edit->itfecha->rule = 'required'; $edit->itmonto = new inputField("(<#o#>) Total", 'monto_<#i#>'); $edit->itmonto->db_name = 'monto'; $edit->itmonto->size = 10; $edit->itmonto->rel_id = 'sfpa'; // $edit->itmonto->css_class ='inputnum'; $edit->itmonto->onchange = "cal_totm();"; $edit->itmonto->value = 0; /**************** POR COBRAR ******************************************/ $porcobrar = $this->db->query("SELECT a.id,a.numero,a.fecha,a.monto,a.nombre,a.observa FROM recibo a WHERE status='P' ORDER BY estampa"); $porcobrar = $porcobrar->result_array(); $edit->button_status("btn_add_sfpa", 'Agregar Pago', "javascript:add_sfpa()", "MB", 'modify', "button_add_rel"); $edit->button_status("btn_add_sfpa2", 'Agregar Pago', "javascript:add_sfpa()", "MB", 'create', "button_add_rel"); $edit->button_status("btn_add_itabonos", 'Agregar Recibo', "javascript:add_itabonos()", "PA", 'modify', "button_add_rel"); $edit->button_status("btn_add_itabonos2", 'Agregar Recibo', "javascript:add_itabonos()", "PA", 'create', "button_add_rel"); if ($this->datasis->puede(388)) { $edit->buttons('modify'); } $edit->buttons('add', 'save', 'undo', 'delete', 'back'); $edit->build(); $conten["form"] =& $edit; //$smenu['link'] =barra_menu('80B'); //$data['smenu'] = $this->load->view('view_sub_menu', $smenu,true); $conten['porcobrar'] = $porcobrar; foreach ($porcobrar as $key => $value) { $porcobrar[$key]['fecha'] = dbdate_to_human($value['fecha']); } $conten['porcobrarj'] = json_encode($porcobrar); $data['content'] = $this->load->view('view_abonos', $conten, true); $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(); $this->load->view('view_ventanas', $data); }
function dataedit() { $this->rapyd->load('datadetails', 'dataobject'); $do = new DataObject('lprod'); //$do->pointer('scli' ,'scli.cliente=rivc.cod_cli','sprv.tipo AS sprvtipo, sprv.reteiva AS sprvreteiva','left'); $do->rel_one_to_many('itlprod', 'itlprod', array('id' => 'id_lprod')); $edit = new DataDetails($this->t**s, $do); $edit->on_save_redirect = false; $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->codigo = new inputField('Producto', 'codigo'); $edit->codigo->rule = 'required'; $edit->codigo->size = 8; $edit->codigo->maxlength = 10; $edit->descrip = new inputField('Descripción', 'descrip'); $edit->descrip->type = 'inputhidden'; $edit->descrip->size = 12; $edit->descrip->maxlength = 10; $edit->fecha = new dateField('Fecha', 'fecha'); $edit->fecha->rule = 'chfecha|required'; $edit->fecha->size = 11; $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->maxlength = 8; $edit->fecha->calendar = false; $edit->inventario = new inputField('Leche de Inventario', 'inventario'); $edit->inventario->rule = 'max_length[12]|numeric|required'; $edit->inventario->css_class = 'inputnum'; $edit->inventario->size = 7; $edit->inventario->insertValue = '0'; $edit->inventario->onkeyup = 'totalizar();'; $edit->inventario->maxlength = 9; $edit->litros = new inputField('Total Lts.', 'litros'); $edit->litros->rule = 'max_length[12]|numeric'; $edit->litros->css_class = 'inputnum'; $edit->litros->type = 'inputhidden'; $edit->litros->size = 8; $edit->litros->maxlength = 12; $edit->peso = new inputField('Peso', 'peso'); $edit->peso->rule = 'max_length[12]|numeric'; $edit->peso->css_class = 'inputnum'; $edit->peso->type = 'inputhidden'; $edit->peso->size = 14; $edit->peso->maxlength = 12; $edit->grasa = new inputField('Grasa %', 'grasa'); //$edit->grasa->rule='required'; $edit->grasa->css_class = 'inputnum'; $edit->grasa->size = 4; $edit->grasa->maxlength = 10; $edit->sal = new inputField('Sal', 'sal'); //$edit->grasa->rule='required'; $edit->sal->css_class = 'inputnum'; $edit->sal->size = 4; $edit->sal->maxlength = 10; $edit->tina = new dropdownField('Tina', 'tina'); $edit->tina->rule = 'required'; $edit->tina->option('', 'Seleccionar'); $edit->tina->options("SELECT codigo, CONCAT( codigo, '-', descripcion, '-', capacidad) descrip FROM tinaq ORDER BY codigo"); $edit->tina->style = 'width:150px;'; /* $edit->reciclaje = new inputField('Reproceso','reciclaje'); $edit->reciclaje->css_class='inputnum'; $edit->reciclaje->insertValue='0'; $edit->reciclaje->size =8; $edit->reciclaje->maxlength =10; */ //Inicio del detalle $edit->itid = new hiddenField('', 'itid_<#i#>'); $edit->itid->db_name = 'id'; $edit->itid->rel_id = 'itlprod'; $edit->itcodrut = new inputField('ruta', 'codrut_<#i#>'); $edit->itcodrut->db_name = 'codrut'; $edit->itcodrut->rule = 'max_length[4]'; $edit->itcodrut->size = 7; $edit->itcodrut->maxlength = 4; $edit->itcodrut->rel_id = 'itlprod'; $edit->itnombre = new inputField('ruta', 'itnombre_<#i#>'); $edit->itnombre->db_name = 'nombre'; $edit->itnombre->type = 'inputhidden'; $edit->itnombre->size = 14; $edit->itnombre->maxlength = 12; $edit->itnombre->rel_id = 'itlprod'; $edit->itlitros = new inputField('litros', 'itlitros_<#i#>'); $edit->itlitros->db_name = 'litros'; $edit->itlitros->rule = 'max_length[12]|numeric|mayorcero|callback_chlitros[<#i#>]'; $edit->itlitros->css_class = 'inputnum'; $edit->itlitros->size = 14; $edit->itlitros->maxlength = 12; $edit->itlitros->onkeyup = 'totalizar();'; $edit->itlitros->rel_id = 'itlprod'; $edit->itbufala = new inputField('bufala', 'itbufala_<#i#>'); $edit->itbufala->db_name = 'bufala'; $edit->itbufala->rule = 'max_length[12]|numeric|mayorcero|callback_chlitros[<#i#>]'; $edit->itbufala->css_class = 'inputnum'; $edit->itbufala->size = 14; $edit->itbufala->maxlength = 12; $edit->itbufala->onkeyup = 'totalizar();'; $edit->itbufala->rel_id = 'itlprod'; //Fin del detalle $edit->usuario = new autoUpdateField('usuario', $this->secu->usuario(), $this->secu->usuario()); $edit->buttons('add_rel'); $edit->build(); if ($edit->on_success()) { $rt = array('status' => 'A', 'mensaje' => 'Registro guardado', 'pk' => $edit->_dataobject->pk); echo json_encode($rt); } else { //echo $edit->output; $conten['form'] =& $edit; $this->load->view('view_lprod', $conten); } }
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' => 'nomb_prov', 'nombre' => 'benefi'), 'titulo' => 'Buscar Beneficiario'); $bSPRV = $this->datasis->p_modbus($mSPRV, "proveed"); $modbus = array('tabla' => 'odirect', 'columnas' => array('numero' => 'Número', 'fecha' => 'fecha', 'tipo' => 'tipo'), 'filtro' => array('numero' => 'Número', 'fecha' => 'fecha', 'tipo' => 'tipo'), 'retornar' => array('numero' => 'orden_<#i#>', 'total' => 'monto_<#i#>'), 'p_uri' => array(4 => '<#i#>', 5 => '<#cod_prov#>'), 'where' => 'status = "F2" OR status = "B2" OR status = "R2" OR status = "G2" OR status = "I2" OR status = "S2" ', 'script' => array('cal_total(<#i#>)'), 'titulo' => 'Busqueda de Ordenes de Pago'); $btn = $this->datasis->p_modbus($modbus, '<#i#>/<#cod_prov#>'); $mBANC = array('tabla' => 'banc', 'columnas' => array('codbanc' => 'Cóodigo', 'banco' => 'Banco', 'saldo' => 'Saldo'), 'filtro' => array('codbanc' => 'Cóodigo', 'banco' => 'Banco', 'saldo' => 'Saldo'), 'retornar' => array('codbanc' => 'codbanc', 'banco' => 'nombanc'), 'where' => 'activo = "S"', 'titulo' => 'Buscar Bancos'); $bBANC = $this->datasis->p_modbus($mBANC, "banc"); $do = new DataObject("mbanc"); $do->rel_one_to_many('itppro', 'itppro', array('id' => 'mbanc')); $edit = new DataDetails($this->t**s, $do); $edit->back_url = site_url($this->url . "filteredgrid"); $edit->set_rel_title('itppro', 'Rubro <#o#>'); $edit->pre_process('insert', '_valida'); $edit->pre_process('update', '_valida'); //$edit->post_process('insert' ,'_paiva'); //$edit->post_process('update' ,'_paiva'); $edit->id = new inputField("Número", "id"); $edit->id->mode = "autohide"; $edit->id->when = array('show'); $edit->fecha = new dateonlyField("Fecha", "fecha"); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->size = 12; $edit->fecha->rule = 'required'; $edit->tipo = new inputField("", "tipo"); $edit->tipo->insertValue = "E"; $edit->tipo->mode = "autohide"; $edit->tipo->when = array(''); $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->nomb_prov = new inputField("Nombre", 'nomb_prov'); $edit->nomb_prov->db_name = ' '; $edit->nomb_prov->size = 50; $edit->nomb_prov->readonly = true; $edit->nomb_prov->in = "cod_prov"; $edit->benefi = new inputField("Beneficiario", 'benefi'); $edit->benefi->size = 50; $edit->benefi->maxlength = 50; $edit->benefi->rule = 'required'; $edit->observa = new textAreaField("Observaciones", 'observa'); $edit->observa->cols = 106; $edit->observa->rows = 3; $edit->codbanc = new inputField("Banco", 'codbanc'); $edit->codbanc->size = 3; $edit->codbanc->rule = "required"; $edit->codbanc->append($bBANC); $edit->codbanc->readonly = true; $edit->nombanc = new inputField("Nombre", "nombanc"); $edit->nombanc->size = 30; $edit->nombanc->readonly = true; $edit->nombanc->db_name = " "; $edit->cheque = new inputField("Cheque", 'cheque'); $edit->cheque->size = 20; $edit->cheque->rule = "required"; $edit->monto = new inputField("Total", 'monto'); $edit->monto->mode = 'autohide'; $edit->monto->when = array('show'); $edit->monto->size = 8; $edit->itorden = new inputField("(<#o#>) ", "orden_<#i#>"); $edit->itorden->rule = 'callback_repetido|required|callback_itorden'; $edit->itorden->size = 15; $edit->itorden->db_name = 'orden'; $edit->itorden->rel_id = 'itppro'; $edit->itorden->readonly = true; $edit->itorden->append('<img src="/tortuga/assets/default/images/system-search.png" alt="Busqueda de Ordenes de Pago" title="Busqueda de Ordenes de Pago" border="0" onclick="modbusdepen(<#i#>)"/>'); $edit->itmonto = new inputField("(<#o#>) Abonar", "monto_<#i#>"); $edit->itmonto->db_name = 'monto'; $edit->itmonto->rel_id = 'itppro'; //$edit->itmonto->mode = 'autohide'; $edit->itmonto->when = array('show', 'modify'); $edit->itmonto->size = 8; // $edit->itmonto->readonly = true; $status = $edit->get_from_dataobjetct('status'); if ($status == 'E1') { $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 == 'E2') { $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('208'); $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true); $conten["form"] =& $edit; $data['content'] = $this->load->view('view_ppro', $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('datadetails', 'dataobject'); $do = new DataObject('ords'); $do->rel_one_to_many('itords', 'itords', array('numero')); $edit = new DataDetails('', $do); $edit->on_save_redirect = false; $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->fecha = new DateonlyField('Fecha', 'fecha'); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->mode = 'autohide'; $edit->fecha->size = 10; $edit->fecha->calendar = false; $edit->numero = new inputField('Número', 'numero'); $edit->numero->size = 10; $edit->numero->mode = 'autohide'; $edit->numero->when = array('show', 'modify'); $edit->proveed = new inputField('Proveedor', 'proveed'); $edit->proveed->size = 6; $edit->proveed->rule = 'required|existesprv'; $edit->nombre = new inputField('Nombre', 'nombre'); $edit->nombre->type = 'inputhidden'; $edit->nombre->size = 30; $edit->nombre->maxlength = 30; //Campos para el anticipo $edit->codban = new dropdownField('Banco', 'codban'); $edit->codban->option('', 'Seleccionar'); $edit->codban->options("SELECT codbanc, CONCAT_WS('-',codbanc,banco) AS label FROM banc WHERE activo='S' ORDER BY codbanc"); $edit->codban->rule = 'max_length[5]'; $edit->codban->style = 'width:200px;'; $edit->tipo = new dropdownField('Tipo', 'tipo_op'); $edit->tipo->option('CH', 'Cheque'); $edit->tipo->option('ND', 'Nota de debito'); $edit->tipo->size = 10; $edit->tipo->style = 'width:150px;'; $edit->cheque = new inputField('Número', 'cheque'); $edit->cheque->size = 10; //$edit->cheque->rule='required'; $edit->cheque->mode = 'autohide'; $edit->comprob = new inputField2('Comprobante', 'comprob'); $edit->comprob->size = 20; $edit->benefi = new inputField('Beneficiario', 'benefi'); $edit->benefi->size = 30; //Fin de los campos anticipos $edit->condi = new textareaField('Condiciones', 'condi'); $edit->condi->cols = 70; $edit->condi->rows = 2; $edit->condi->size = 35; $edit->anticipo = new inputField('Anticipo', 'anticipo'); $edit->anticipo->size = 20; $edit->anticipo->css_class = 'inputnum'; $edit->totiva = new inputField('Impuesto', 'totiva'); $edit->totiva->type = 'inputhidden'; $edit->totiva->size = 10; $edit->totiva->css_class = 'inputnum'; $edit->totbruto = new inputField('Total', 'totbruto'); $edit->totbruto->type = 'inputhidden'; $edit->totbruto->size = 20; $edit->totbruto->css_class = 'inputnum'; $edit->totpre = new inputField('SubTotal', 'totpre'); $edit->totpre->type = 'inputhidden'; $edit->totpre->size = 10; $edit->totpre->css_class = 'inputnum'; //Campos para el detalle $edit->codigo = new inputField('Código', 'codigo_<#i#>'); $edit->codigo->size = 7; $edit->codigo->db_name = 'codigo'; //$edit->codigo->append($this->datasis->p_modbus($modbus,'<#i#>')); $edit->codigo->rel_id = 'itords'; $edit->descrip = new inputField('Descripción', 'descrip_<#i#>'); $edit->descrip->size = 25; $edit->descrip->db_name = 'descrip'; $edit->descrip->maxlength = 12; $edit->descrip->rel_id = 'itords'; $ivas = $this->datasis->ivaplica(); $edit->tasaiva = new dropdownField('IVA <#o#>', 'tasaiva_<#i#>'); $edit->tasaiva->option($ivas['tasa'], $ivas['tasa'] . '%'); $edit->tasaiva->option($ivas['redutasa'], $ivas['redutasa'] . '%'); $edit->tasaiva->option($ivas['sobretasa'], $ivas['sobretasa'] . '%'); $edit->tasaiva->option('0', '0.00%'); $edit->tasaiva->db_name = 'tasaiva'; $edit->tasaiva->rule = 'positive'; $edit->tasaiva->style = "30px"; $edit->tasaiva->rel_id = 'itords'; $edit->tasaiva->onchange = 'importe(<#i#>)'; $edit->iva = new inputField('Impuesto', 'iva_<#i#>'); $edit->iva->size = 10; $edit->iva->db_name = 'iva'; $edit->iva->maxlength = 8; $edit->iva->css_class = 'inputnum'; $edit->iva->rel_id = 'itords'; $edit->iva->showformat = 'decimal'; $edit->iva->type = 'inputhidden'; $edit->precio = new inputField('Precio', 'precio_<#i#>'); $edit->precio->css_class = 'inputnum'; $edit->precio->onkeyup = 'importe(<#i#>)'; $edit->precio->size = 9; $edit->precio->db_name = 'precio'; $edit->precio->rel_id = 'itords'; $edit->importe = new inputField('Importe', 'importe_<#i#>'); $edit->importe->db_name = 'importe'; $edit->importe->css_class = 'inputnum'; $edit->importe->size = 9; $edit->importe->rel_id = 'itords'; $edit->importe->showformat = 'decimal'; $edit->importe->type = 'inputhidden'; $edit->departa = new dropdownField('Departamento <#o#>', 'departa_<#i#>'); $edit->departa->option('', 'Seleccionar'); $edit->departa->options("SELECT TRIM(depto) AS codigo, CONCAT_WS('-',depto,TRIM(descrip)) AS label FROM dpto WHERE tipo='G' ORDER BY depto"); $edit->departa->db_name = 'departa'; $edit->departa->rule = 'required'; $edit->departa->style = 'width:100px'; $edit->departa->rel_id = 'itords'; $edit->departa->onchange = "gdeparta(this.value)"; $edit->sucursal = new dropdownField('Sucursal <#o#>', 'sucursal_<#i#>'); $edit->sucursal->options("SELECT codigo,CONCAT(codigo,'-', sucursal) AS sucursal FROM sucu ORDER BY codigo"); $edit->sucursal->db_name = 'sucursal'; $edit->sucursal->rule = 'required'; $edit->sucursal->style = 'width:100px'; $edit->sucursal->rel_id = 'itords'; $edit->sucursal->onchange = "gsucursal(this.value)"; //fin de campos para detalle $edit->usuario = new autoUpdateField('usuario', $this->secu->usuario(), $this->secu->usuario()); $edit->estampa = new autoUpdateField('estampa', date('Ymd'), date('Ymd')); $edit->hora = new autoUpdateField('hora', date('H:i:s'), date('H:i:s')); $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; $this->load->view('view_ords', $conten); } }
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->rapyd->load('dataobject', 'datadetails'); $modbus = array('tabla' => 'sumi', 'columnas' => array('codigo' => 'Código', 'descrip' => 'Descripcion', 'unidad' => 'Unidad'), 'filtro' => array('codigo' => 'Código', 'descrip' => 'Descripcion'), 'retornar' => array('codigo' => 'codigo_<#i#>', 'descrip' => 'descripcion_<#i#>'), 'p_uri' => array(4 => '<#i#>'), 'titulo' => 'Busqueda de Articulos'); $btn = $this->datasis->p_modbus($modbus, '<#i#>'); //$script=' '; // $do = new DataObject("suminr"); $do->rel_one_to_many('itsuminr', 'itsuminr', array('numero' => 'numero')); // $do->rel_pointer('itsuminr','sumi' ,'itsuminr.codigo=sumi.codigo',"sumi.descrip descrip2"); $do->order_by('itsuminr', 'itsuminr.codigo', ' '); $edit = new DataDetails("Nota de Recepción", $do); $edit->back_url = site_url("suministros/suminr/filteredgrid"); $edit->set_rel_title('itsuminr', 'Rubro <#o#>'); $edit->pre_process('insert', '_valida'); $edit->pre_process('update', '_valida'); //$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->conc = new dropdownField("Concepto", "conc"); $edit->conc->options("SELECT id,descrip FROM su_conc WHERE tipo='E'"); $edit->fecha = new dateonlyField("Fecha", "fecha"); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->size = 12; $edit->alma = new dropdownField("Receptor", "alma"); $edit->alma->options("SELECT codigo,CONCAT_WS(' ',codigo,descrip) valor FROM su_alma WHERE codigo<>'0000'"); $modbusprv = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'Codigo', 'nombre' => 'Nombre'), 'filtro' => array('proveed' => 'Codigo', 'nombre' => 'Nombre'), 'retornar' => array('proveed' => 'proveed'), 'titulo' => 'Buscar Beneficiario'); $bproveed = $this->datasis->modbus($modbusprv); $edit->proveed = new inputField("Proveedor", "proveed"); //$edit->proveed->rule='required'; $edit->proveed->append($bproveed); $edit->caub = new dropdownField("Almacen", "caub"); $edit->caub->options("SELECT codigo,CONCAT_WS(' ',codigo,descrip) valor FROM su_caub"); $edit->status = new dropdownField("Estado", "status"); $edit->status->option("A", "Anulado"); $edit->status->option("P", "Por Recibir"); $edit->status->option("C", "Recibido"); $edit->status->when = array("show"); $edit->observacion = new textareaField("Observación", "observacion"); $edit->observacion->rows = 1; $edit->observacion->cols = 80; // $edit->observacion->rule='required'; $edit->codigo = new inputField("(<#o#>) Codigo", "codigo_<#i#>"); $edit->codigo->rel_id = 'itsuminr'; //$edit->codigo->rule='callback_repetido|required'; $edit->codigo->size = 6; //$edit->codigo->append('<img src="/tortuga/assets/default/images/system-search.png" alt="Busqueda de Articulos" title="Busqueda de Articulos" border="0" onclick="modbusdepen(<#i#>)"/>'); $edit->codigo->db_name = 'codigo'; $edit->codigo->append($btn); $edit->descripcion = new inputField("Descripción", "descripcion_<#i#>"); $edit->descripcion->db_name = 'descripcion'; $edit->descripcion->rel_id = 'itsuminr'; $edit->descripcion->size = 40; $edit->descripcion->readonly = true; // $edit->descripcion->pointer=true; $edit->cantidad = new inputField("Cantidad", "cantidad_<#i#>"); $edit->cantidad->rule = 'required|numeric'; $edit->cantidad->css_class = 'inputnum'; $edit->cantidad->db_name = 'cantidad'; $edit->cantidad->rel_id = 'itsuminr'; $edit->cantidad->size = 10; $edit->cantidad->onchange = 'cal_cant(<#i#>);'; $edit->precio = new inputField("(<#o#>) Precio", "precio_<#i#>"); $edit->precio->css_class = 'inputnum'; $edit->precio->db_name = 'precio'; $edit->precio->rel_id = 'itsuminr'; $edit->precio->rule = 'numeric|required'; $edit->precio->onchange = 'cal_total(<#i#>);'; $edit->precio->size = 10; $edit->total = new inputField("(<#o#>) Total", "total_<#i#>"); $edit->total->db_name = 'total'; $edit->total->rel_id = 'itsuminr'; $edit->total->rule = 'numeric'; $edit->total->readonly = true; $edit->total->size = 10; $edit->tcantidad = new inputField("Cantidad total", "tcantidad"); $edit->tcantidad->db_name = 'tcantidad'; $edit->tcantidad->css_class = 'inputnum'; $edit->tcantidad->readonly = true; $edit->tcantidad->rule = 'numeric'; $edit->tcantidad->size = 10; $edit->ttotal = new inputField("Precio total", "ttotal"); $edit->ttotal->db_name = 'total'; $edit->ttotal->css_class = 'inputnum'; $edit->ttotal->readonly = true; $edit->ttotal->rule = 'numeric'; $edit->ttotal->size = 10; $status = $edit->get_from_dataobjetct('status'); if ($status == 'P') { $edit->buttons("save", "modify", "delete"); $action = "javascript:window.location='" . site_url($this->url . 'actualizar/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_status", 'Marcar Como terminada', $action, "TR", "show"); } elseif ($status == 'C') { $action = "javascript:btn_anula('" . $edit->rapyd->uri->get_edited_id() . "')"; $edit->button_status("btn_rever", 'Reversar', $action, "TR", "show"); } $edit->buttons("add", "save", "undo", "back", "add_rel"); $edit->build(); $smenu['link'] = barra_menu('193'); $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true); $conten["form"] =& $edit; $data['content'] = $this->load->view('view_suminr', $conten, true); //$data['content'] = $edit->output; $data['title'] = "Nota de Recepción"; $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(); $this->load->view('view_ventanas', $data); }
function dataedit($action = '', $id = '') { $this->rapyd->load('datadetails', 'dataobject'); $mCONTRIBU = array('tabla' => 'contribu', 'columnas' => array('codigo' => 'Código', 'nacionali' => '', 'rifci' => 'RIF', 'nombre' => 'Nombre', 'direccion' => 'Dirección', 'telefono' => 'Telefono'), 'filtro' => array('codigo' => 'Código', 'rifci' => 'RIF', 'nacionali' => 'Nacionalidad', 'nombre' => 'Nombre', 'direccion' => 'Dirección', 'telefono' => 'Telefono'), 'retornar' => array('codigo' => 'contribu', 'nombre' => 'nombre', 'rifci' => 'rifci', 'direccion' => 'direccion', 'telefono' => 'telefono', 'nacionali' => 'nacionalit'), 'script' => array('cal_nacionali()'), 'titulo' => 'Buscar Contribuyente'); $bCONTRIBU = $this->datasis->modbus($mCONTRIBU); $mPATENTE = array('tabla' => 'v_patente_contri', 'columnas' => array('id' => 'Ref.', 'tarjeta' => 'Tarjeta', 'local' => 'Local', 'licencia' => 'Licencia', 'razon' => 'Razon', 'dir_neg' => 'Direccion Negocio'), 'filtro' => array('id' => 'Ref.', 'tarjeta' => 'Tarjeta', 'licencia' => 'Licencia', 'razon' => 'Razon', 'dir_neg' => 'Direccion Negocio'), 'retornar' => array('id' => 'patente', 'tarjeta' => 'p_tarjeta', 'licencia' => 'p_licencia', 'razon' => 'p_razon', 'dir_neg' => 'p_dir_neg', 'oficio' => 'p_oficio', 'observa' => 'p_observa', 'capital' => 'p_capital', 'catastro' => 'p_catastro', 'publicidad' => 'p_publicidad', 'DATE_FORMAT(FECHA_ES,"%d/%m/%Y")' => 'p_fecha_es', 'local' => 'p_localt', 'clase' => 'p_claset', 'negocio' => 'p_negociot', 'tipo' => 'p_tipot', 'repre' => 'p_repre', 'repreced' => 'p_repreced', 'expclasi' => 'p_expclasi', 'exphor' => 'p_exphor', 'nro' => 'p_nro', 'c_codigo' => 'contribu', 'c_nombre' => 'nombre', 'c_rifci' => 'rifci', 'c_direccion' => 'direccion', 'c_telefono' => 'telefono', 'c_nacionali' => 'nacionalit'), 'p_uri' => array(4 => '<#contri#>'), 'where' => 'IF(<#contri#> = ".....", contribu LIKE "%" ,contribu LIKE <#contri#>)', 'script' => array('cal_patente()', 'cal_nacionali()'), 'titulo' => 'Buscar Patente'); $bPATENTE = $this->datasis->p_modbus($mPATENTE, '<#contri#>'); $bPATENTE = '<img src="/tortuga/assets/default/images/system-search.png" alt="Busqueda de Patentes" title="Busqueda de Patentes" border="0" onclick="modbusdepenp()"/>'; $mINMUEBLE = array('tabla' => 'v_inmueble_contri', 'columnas' => array('id' => 'Ref.', 'ctainos' => 'CtaInos', 'direccion' => 'Direccion', 'tipo_in' => 'Tipo'), 'filtro' => array('id' => 'Ref.', 'ctainos' => 'CtaInos', 'direccion' => 'Direccion', 'tipo_in' => 'Tipo'), 'retornar' => array('id' => 'inmueble', 'ctainos' => 'i_ctainos', 'direccion' => 'i_direccion', 'tipo_in' => 'i_tipo_int', 'no_predio' => 'i_no_predio', 'sector' => 'i_sectort', 'clase' => 'i_claset', 'tipo' => 'i_tipot', 'no_predio' => 'i_monto', 'c_codigo' => 'contribu', 'c_nombre' => 'nombre', 'c_rifci' => 'rifci', 'c_direccion' => 'direccion', 'c_telefono' => 'telefono', 'c_nacionali' => 'nacionalit'), 'p_uri' => array(4 => '<#contri#>'), 'where' => 'IF(<#contri#> = ".....", contribu LIKE "%" ,contribu LIKE <#contri#>)', 'script' => array('cal_inmueble()', 'cal_nacionali()'), 'titulo' => 'Buscar Inmueble'); $bINMUEBLE = $this->datasis->p_modbus($mINMUEBLE, '<#contri#>'); $bINMUEBLE = '<img src="/tortuga/assets/default/images/system-search.png" alt="Busqueda de Inmuebles" title="Busqueda de Inmuebles" border="0" onclick="modbusdepeni()"/>'; $mVEHICULO = array('tabla' => 'v_vehiculo_contri', 'columnas' => array('id' => 'Ref.', 'placa_act' => 'Placa', 'marca' => 'Marca', 'modelo' => 'Modelo', 'color' => 'Color'), 'filtro' => array('id' => 'Ref.', 'placa_act' => 'Placa', 'marca' => 'Marca', 'modelo' => 'Modelo', 'color' => 'Color'), 'retornar' => array('id' => 'vehiculo', 'clase' => 'v_claset', 'marca' => 'v_marca', 'tipo' => 'v_tipo', 'modelo' => 'v_modelo', 'color' => 'v_color', 'capaci' => 'v_capaci', 'serial_m' => 'v_serial_m', 'placa_act' => 'v_placa_act', 'ano' => 'v_ano', 'peso' => 'v_peso', 'serial_c' => 'v_serial_c', 'codigo' => 'contribu', 'nombre' => 'nombre', 'rifci' => 'rifci', 'direccion' => 'direccion', 'telefono' => 'telefono', 'nacionali' => 'nacionalit'), 'p_uri' => array(4 => '<#contri#>'), 'where' => 'IF(<#contri#> = ".....", contribu LIKE "%" ,contribu LIKE <#contri#>)', 'script' => array('cal_vehiculo()', 'cal_nacionali()'), 'titulo' => 'Buscar Vehiculo'); $bVEHICULO = $this->datasis->p_modbus($mVEHICULO, '<#contri#>'); $bVEHICULO = '<img src="/tortuga/assets/default/images/system-search.png" alt="Busqueda de Vehiculos" title="Busqueda de Vehiculos" border="0" onclick="modbusdepenv()"/>'; $do = new DataObject("recibo"); $do->rel_one_to_many('itrecibo', 'itrecibo', array('id' => 'id_recibo')); $do->pointer('patente', 'recibo.patente=patente.id', 'patente.tarjeta AS p_tarjeta,patente.licencia AS p_licencia,patente.razon AS p_razon,patente.dir_neg AS p_dir_neg,patente.capital AS p_capital,patente.monto AS p_monto,patente.fecha_es AS p_fecha_es,patente.oficio AS p_oficio,patente.local AS p_local,patente.negocio AS p_negocio,patente.registrado AS p_registrado,patente.observa AS p_observa,patente.clase AS p_clase,patente.tipo AS p_tipo,patente.catastro AS p_catastro,patente.publicidad AS p_publicidad,patente.recibo AS p_recibo,patente.repre AS p_repre,patente.repreced AS p_repreced,patente.expclasi AS p_expclasi,patente.exphor AS p_exphor,patente.nro AS p_nro,patente.fexpedicion p_fexpedicion,patente.fvencimiento p_fvencimiento', 'LEFT'); $do->pointer('inmueble', 'recibo.inmueble=inmueble.id', 'inmueble.ctainos AS i_ctainos,inmueble.direccion AS i_direccion,inmueble.no_predio AS i_no_predio,inmueble.sector AS i_sector,inmueble.tipo_in AS i_tipo_in,inmueble.no_hab AS i_no_hab,inmueble.clase AS i_clase,inmueble.tipo AS i_tipo', 'LEFT'); $do->pointer('vehiculo', 'recibo.vehiculo=vehiculo.id', 'vehiculo.clase AS v_clase,vehiculo.marca AS v_marca,vehiculo.tipo AS v_tipo,vehiculo.modelo AS v_modelo,vehiculo.color AS v_color,vehiculo.capaci AS v_capaci,vehiculo.serial_m AS v_serial_m,vehiculo.placa_ant AS v_placa_ant,vehiculo.placa_act AS v_placa_act,vehiculo.ano AS v_ano,vehiculo.peso AS v_peso,vehiculo.serial_c AS v_serial_c,vehiculo.monto AS v_monto,vehiculo.asovehi AS v_asovehi', 'LEFT'); $edit = new DataDetails($this->t**s, $do); $edit->back_url = site_url($this->url . "filteredgrid"); $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('Recibo Número', 'numero'); $edit->numero->when = array('show'); $edit->numero->type = 'inputhidden'; $edit->id = new inputField('', 'id'); $edit->id->mode = 'autohide'; $edit->id->when = array('show'); $edit->id->db_name = 'recibo.id'; $edit->id->type = 'inputhidden'; $edit->contribu = new inputField('Código', 'contribu'); $edit->contribu->rule = 'max_length[6]'; $edit->contribu->size = 8; $edit->contribu->maxlength = 6; $edit->contribu->append($bCONTRIBU); if ($this->recibomodificontribu != 'S') { $edit->contribu->readonly = true; $edit->contribu->rule = 'required|max_length[6]'; } $edit->fecha = new dateonlyField('Fecha', 'fecha'); $edit->fecha->rule = 'chfecha'; $edit->fecha->size = 10; $edit->fecha->maxlength = 8; $edit->fecha->insertValue = date('Y-m-d'); $edit->tipo = new dropdownField('Concepto', 'tipo'); $edit->tipo->options("SELECT codigo,CONCAT(codigo,'-',descrip) FROM tingresos ORDER BY grupo,descrip"); //WHERE activo='S' $edit->tipo->onchange = "cal_concepto()"; $edit->tipo->style = "width:350px;"; $edit->monto = new inputField('Monto', 'monto'); $edit->monto->rule = 'required|max_length[19]|numeric_positive'; $edit->monto->css_class = 'inputnum'; $edit->monto->size = 21; $edit->monto->maxlength = 19; $edit->monto->value = 0; $edit->declaracion = new inputField('Declaración', 'declaracion'); $edit->declaracion->rule = 'required'; $edit->declaracion->css_class = 'inputnum'; $edit->declaracion->size = 21; $edit->declaracion->maxlength = 19; $edit->declaracion->value = 0; $edit->declaracion->onchange = "cal_claseo()"; $edit->observa = new textareaField('Observación', 'observa'); $edit->observa->cols = 80; $edit->observa->rows = 1; //INICIO CONTRIBUYENTES $edit->direccion = new textareaField('Dirección', 'direccion'); $edit->direccion->cols = 40; $edit->direccion->rows = 1; $edit->nombre = new inputField('Nombre', 'nombre'); $edit->nombre->rule = 'required|max_length[200]'; $edit->nombre->size = 50; $edit->nombre->maxlength = 200; $edit->nombre->autocomplete = false; $crea = '<a href="javascript:creacontribu();" title="Agregar Contribuyente">' . image('add.png', '#', array("border" => 0)) . '</a>'; $edit->rifci = new inputField('Rif/CI', 'rifci'); $edit->rifci->rule = 'required|max_length[13]'; $edit->rifci->size = 15; $edit->rifci->maxlength = 13; $edit->rifci->append($crea); $edit->nacionali = new dropdownField('Nacionalidad', 'nacionali'); $edit->nacionali->option('V', 'VENEZOLANA'); $edit->nacionali->option('E', 'EXTRANJERA'); $edit->nacionali->style = "width:120px;"; $edit->telefono = new textareaField('Telefono', 'telefono'); $edit->telefono->rule = 'max_length[50]'; $edit->telefono->cols = 20; $edit->telefono->rows = 1; $edit->oper = new dropdownField('Tipo Solvencia', 'oper'); $edit->oper->option('', ''); $edit->oper->option('TRAMITES', 'TRAMITES o ADMINISTRATIVA'); $edit->oper->option('REGISTRO', 'REGISTRO'); $edit->oper->style = "width:250px;"; $edit->razonsocial = new dropdownField('Razon Social', 'razonsocial'); $edit->razonsocial->option('COMERCIAL', 'COMERCIAL'); $edit->razonsocial->option('DOMICILIARIO', 'DOMICILIARIO'); $edit->razonsocial->style = "width:120px;"; $edit->tasam = new inputField('Tasa Mensual', 'tasam'); $edit->tasam->rule = 'max_length[19]'; //$edit->tasam->css_class ='inputnum'; $edit->tasam->size = 21; $edit->tasam->maxlength = 19; $edit->tasam->value = 0; $edit->rif = new inputField('Rif', 'rif'); $edit->rif->rule = 'max_length[200]'; $edit->rif->size = 20; $edit->rif->maxlength = 200; $edit->nomfis = new inputField('Empresa', 'nomfis'); $edit->nomfis->rule = 'max_length[200]'; $edit->nomfis->size = 30; $edit->nomfis->maxlength = 200; $edit->efectos = new inputField('Efectos', 'efectos'); $edit->efectos->rule = 'max_length[200]'; $edit->efectos->size = 80; $edit->efectos->maxlength = 200; $edit->efectos2 = new inputField('Efectos Linea 2', 'efectos2'); $edit->efectos2->rule = 'max_length[200]'; $edit->efectos2->size = 80; $edit->efectos2->maxlength = 200; //INICIO DETALLE $edit->d_ano = new inputField('Año', 'd_ano_<#i#>'); $edit->d_ano->size = 6; $edit->d_ano->maxlength = 6; $edit->d_ano->db_name = 'ano'; $edit->d_ano->rel_id = 'itrecibo'; $edit->d_ano->style = 'width:100%'; $edit->d_ano->readonly = true; $edit->d_tipo = new inputField('Tipo', 'd_tipo_<#i#>'); $edit->d_tipo->size = 10; $edit->d_tipo->maxlength = 20; $edit->d_tipo->db_name = 'tipo'; $edit->d_tipo->rel_id = 'itrecibo'; $edit->d_tipo->style = 'width:100%'; $edit->d_tipo->readonly = true; $edit->d_nro = new inputField('Nro', 'd_nro_<#i#>'); $edit->d_nro->size = 2; $edit->d_nro->maxlength = 2; $edit->d_nro->db_name = 'nro'; $edit->d_nro->rel_id = 'itrecibo'; $edit->d_nro->style = 'width:100%'; $edit->d_nro->readonly = true; $edit->d_descrip = new inputField('Descripcion', 'd_descrip_<#i#>'); $edit->d_descrip->size = 20; $edit->d_descrip->db_name = 'descrip'; $edit->d_descrip->rel_id = 'itrecibo'; $edit->d_descrip->style = 'width:100%'; $edit->d_descrip->readonly = true; $edit->d_monto = new inputField('Monto', 'd_monto_<#i#>'); $edit->d_monto->size = 15; $edit->d_monto->maxlength = 10; $edit->d_monto->db_name = 'monto'; $edit->d_monto->rel_id = 'itrecibo'; $edit->d_monto->style = 'width:100%;text-align:right;'; $edit->d_monto->value = 0; $edit->d_monto->onchange = 'cal_total();'; //INICIO PATENTE $edit->patente = new inputField('Patente', 'patente'); $edit->patente->size = 6; $edit->patente->maxlength = 6; $edit->patente->append($bPATENTE); $edit->patente->db_name = 'patente'; $edit->p_tarjeta = new inputField('Tarjeta', 'p_tarjeta'); $edit->p_tarjeta->size = 6; $edit->p_tarjeta->maxlength = 6; //$edit->p_tarjeta->db_name ='tarjeta'; //$edit->p_tarjeta->rel_id ='patente'; $edit->p_tarjeta->pointer = true; $edit->p_licencia = new inputField('Licencia', 'p_licencia'); $edit->p_licencia->size = 5; $edit->p_licencia->maxlength = 6; //$edit->p_licencia->db_name ='licencia'; //$edit->p_licencia->rel_id ='patente'; $edit->p_licencia->pointer = true; $edit->p_razon = new inputField('Razón', 'p_razon'); $edit->p_razon->size = 100; //$edit->p_razon->db_name ='licencia'; //$edit->p_razon->rel_id ='patente'; $edit->p_razon->pointer = true; $edit->p_dir_neg = new inputField('Dirección', 'p_dir_neg'); $edit->p_dir_neg->size = 100; //$edit->p_dir_neg->db_name ='dir_neg'; //$edit->p_dir_neg->rel_id ='patente'; $edit->p_dir_neg->pointer = true; $edit->p_local = new dropdownField('Localización', 'p_local'); $edit->p_local->options("SELECT codigo,nombre FROM local ORDER BY nombre"); $edit->p_local->style = "width:180px;"; //$edit->p_local->rel_id ='patente'; //$edit->p_local->db_name ='tarjeta'; $edit->p_local->pointer = true; $edit->p_negocio = new dropdownField('Negocio', 'p_negocio'); $edit->p_negocio->options("SELECT codigo,nombre FROM negocio ORDER BY nombre"); $edit->p_negocio->style = "width:180px;"; //$edit->p_negocio->rel_id ='patente'; //$edit->p_negocio->db_name ='tarjeta'; $edit->p_negocio->pointer = true; $edit->p_clase = new dropdownField('Clase', 'p_clase'); $edit->p_clase->options("SELECT codigo,nombre FROM claseo ORDER BY nombre"); $edit->p_clase->style = "width:120px;"; //$edit->p_clase->rel_id ='patente'; //$edit->p_clase->db_name ='tarjeta'; $edit->p_clase->pointer = true; $edit->p_clase->onchange = "cal_claseo()"; $edit->p_tipo = new dropdownField('Tipo', 'p_tipo'); $edit->p_tipo->options(array('' => '', 'A' => 'A', 'B' => 'B')); $edit->p_tipo->style = "width:120px;"; //$edit->p_tipo->rel_id ='patente'; //$edit->p_tipo->db_name ='tarjeta'; $edit->p_tipo->pointer = true; $edit->p_oficio = new inputField('Oficio', 'p_oficio'); $edit->p_oficio->size = 20; //$edit->p_oficio->db_name ='oficio'; //$edit->p_oficio->rel_id ='patente'; $edit->p_oficio->pointer = true; $edit->p_catastro = new inputField('Catastro', 'p_catastro'); $edit->p_catastro->size = 20; //$edit->p_catastro->db_name ='catastro'; //$edit->p_catastro->rel_id ='patente'; $edit->p_catastro->pointer = true; $edit->p_publicidad = new inputField('Publicidad', 'p_publicidad'); $edit->p_publicidad->size = 20; //$edit->p_publicidad->db_name ='publicidad'; //$edit->p_publicidad->rel_id ='patente'; $edit->p_publicidad->pointer = true; $edit->p_observa = new inputField('Observación', 'p_observa'); $edit->p_observa->size = 100; //$edit->p_observa->db_name ='oficio'; //$edit->p_observa->rel_id ='patente'; $edit->p_observa->pointer = true; $edit->p_repre = new inputField('Representante', 'p_repre'); $edit->p_repre->size = 20; $edit->p_repre->pointer = true; $edit->p_expclasi = new dropdownField('Clasificacion Expendido', 'p_expclasi'); $edit->p_expclasi->option("EXPENDIDO AL MAYOR Y DETAL", "EXPENDIDO AL MAYOR Y DETAL"); $edit->p_expclasi->option("EXPENDIDO DE CONSUMO", "EXPENDIDO DE CONSUMO"); $edit->p_expclasi->size = 20; $edit->p_expclasi->pointer = true; $edit->p_exphor = new inputField('Horario Espendido', 'p_exphor'); $edit->p_exphor->size = 20; $edit->p_exphor->pointer = true; $edit->p_repre = new inputField('Representante', 'p_repre'); $edit->p_repre->size = 20; $edit->p_repre->pointer = true; $edit->p_repreced = new inputField('Ced. Representante', 'p_repreced'); $edit->p_repreced->size = 20; $edit->p_repreced->pointer = true; $edit->p_capital = new inputField('Capital', 'p_capital'); $edit->p_capital->size = 20; //$edit->p_capital->db_name ='capital'; //$edit->p_capital->rel_id ='patente'; $edit->p_capital->css_class = 'inputnum'; $edit->p_capital->pointer = true; $edit->p_fecha_es = new dateonlyField('Fecha_es', 'p_fecha_es'); $edit->p_fecha_es->rule = 'chfecha'; $edit->p_fecha_es->size = 10; $edit->p_fecha_es->maxlength = 8; $edit->p_fecha_es->insertValue = date('Y-m-d'); //$edit->p_fecha_es->db_name ='fecha_es'; //$edit->p_fecha_es->rel_id ='patente'; $edit->p_fecha_es->pointer = true; /* $edit->p_kardex = new inputField('Código Kardex','p_kardex'); $edit->p_kardex->size =20; $edit->p_kardex->css_class ='inputnum'; $edit->p_kardex->pointer =true; */ $edit->p_nro = new inputField('Nro', 'p_nro'); $edit->p_nro->size = 5; //$edit->p_nro->css_class ='inputnum'; $edit->p_nro->pointer = true; $edit->p_fexpedicion = new dateonlyField('Fecha Expedición', 'p_fexpedicion'); $edit->p_fexpedicion->rule = 'chfecha'; $edit->p_fexpedicion->size = 10; $edit->p_fexpedicion->maxlength = 8; $edit->p_fexpedicion->insertValue = date('Y-m-d'); $edit->p_fexpedicion->pointer = true; $edit->p_fvencimiento = new dateonlyField('Fecha Vencimiento', 'p_fvencimiento'); $edit->p_fvencimiento->rule = 'chfecha'; $edit->p_fvencimiento->size = 10; $edit->p_fvencimiento->maxlength = 8; $edit->p_fvencimiento->insertValue = date('Y-m-d'); $edit->p_fvencimiento->pointer = true; //INICIO INMUEBLE $edit->inmueble = new inputField('Inmueble', 'inmueble'); $edit->inmueble->size = 6; $edit->inmueble->maxlength = 6; $edit->inmueble->append($bINMUEBLE); $edit->inmueble->db_name = 'inmueble'; $edit->i_ctainos = new inputField('Cuenta Inos', 'i_ctainos'); $edit->i_ctainos->rule = 'max_length[7]'; $edit->i_ctainos->size = 9; $edit->i_ctainos->maxlength = 7; //$edit->i_ctainos->db_name ='ctainos'; //$edit->i_ctainos->rel_id ='inmueble'; $edit->i_ctainos->pointer = true; $edit->i_direccion = new inputField('Dirección', 'i_direccion'); $edit->i_direccion->rule = 'max_length[50]'; $edit->i_direccion->size = 100; $edit->i_direccion->maxlength = 50; //$edit->i_direccion->db_name ='direccion'; //$edit->i_direccion->rel_id ='inmueble'; $edit->i_direccion->pointer = true; $edit->i_no_predio = new inputField('Nro. Promedio', 'i_no_predio'); $edit->i_no_predio->rule = 'max_length[10]'; $edit->i_no_predio->size = 12; $edit->i_no_predio->maxlength = 10; //$edit->i_no_predio->db_name ='no_predio'; //$edit->i_no_predio->rel_id ='inmueble'; $edit->i_no_predio->pointer = true; $edit->i_sector = new dropdownField('Sector', 'i_sector'); $edit->i_sector->options("SELECT codigo,nombre FROM local ORDER BY nombre"); //$edit->i_sector->db_name ='sector'; //$edit->i_sector->rel_id ='inmueble'; $edit->i_sector->pointer = true; $edit->i_tipo_in = new dropdownField('Tipo Inmueble', 'i_tipo_in'); $edit->i_tipo_in->options("SELECT tipoin,tipoin d FROM tipoin ORDER BY tipoin"); //$edit->i_tipo_in->db_name ='tipo_in'; //$edit->i_tipo_in->rel_id ='inmueble'; $edit->i_tipo_in->pointer = true; $edit->i_no_hab = new inputField('Nro.Habitacion', 'i_no_hab'); $edit->i_no_hab->rule = 'max_length[11]'; $edit->i_no_hab->size = 13; $edit->i_no_hab->maxlength = 11; //$edit->i_no_hab->db_name ='no_hab'; //$edit->i_no_hab->rel_id ='inmueble'; $edit->i_no_hab->pointer = true; $edit->i_clase = new dropdownField('Clase', 'i_clase'); $edit->i_clase->options("SELECT codigo,nombre FROM claseo ORDER BY nombre"); //$edit->i_clase->db_name ='clase'; //$edit->i_clase->rel_id ='inmueble'; $edit->i_clase->pointer = true; $edit->i_clase->onchange = "cal_claseo()"; $edit->i_tipo = new dropdownField('Tipo', 'i_tipo'); $edit->i_tipo->options(array('' => '', 'A' => 'A', 'B' => 'B')); $edit->i_tipo->style = "width:120px;"; //$edit->i_tipo->db_name ='tipo'; //$edit->i_tipo->rel_id ='inmueble'; $edit->i_tipo->pointer = true; $edit->i_monto = new inputField('Monto', 'i_monto'); $edit->i_monto->rule = 'max_length[8]'; $edit->i_monto->size = 10; $edit->i_monto->maxlength = 8; //$edit->i_monto->db_name ='monto'; //$edit->i_monto->rel_id ='inmueble'; $edit->i_monto->pointer = true; //INICIO VEHICULO $edit->vehiculo = new inputField('Vehiculo', 'vehiculo'); $edit->vehiculo->size = 6; $edit->vehiculo->maxlength = 6; $edit->vehiculo->append($bVEHICULO); $edit->vehiculo->db_name = 'vehiculo'; $edit->vehiculo->readonly = true; $edit->v_clase = new dropdownField('Clase', 'v_clase'); $edit->v_clase->options("SELECT codigo,nombre FROM clase ORDER BY nombre"); $edit->v_clase->style = "width:200px;"; //$edit->v_clase->db_name ='clase'; //$edit->v_clase->rel_id ='vehiculo'; $edit->v_clase->pointer = true; $edit->v_marca = new inputField('Marca', 'v_marca'); //$edit->v_marca->options("SELECT trim(marca),marca m FROM marca ORDER BY marca"); //$edit->v_marca->style="width:120px;"; //$edit->v_marca->db_name ='marca'; //$edit->v_marca->rel_id ='vehiculo'; $edit->v_marca->pointer = true; $edit->v_marca->size = 20; $edit->v_marca->maxlength = 30; $edit->v_tipo = new inputField('Tipo', 'v_tipo'); //$edit->v_tipo->options("SELECT tipo,tipo m FROM tipo ORDER BY tipo"); //$edit->v_tipo->style="width:120px;"; //$edit->v_tipo->db_name ='tipo'; //$edit->v_tipo->rel_id ='vehiculo'; $edit->v_tipo->pointer = true; $edit->v_tipo->size = 20; $edit->v_tipo->maxlength = 30; $edit->v_modelo = new inputField('Modelo', 'v_modelo'); $edit->v_modelo->rule = 'max_length[10]'; $edit->v_modelo->size = 12; $edit->v_modelo->maxlength = 10; //$edit->v_modelo->db_name ='modelo'; //$edit->v_modelo->rel_id ='vehiculo'; $edit->v_modelo->pointer = true; $edit->v_color = new inputField('Color', 'v_color'); $edit->v_color->rule = 'max_length[20]'; $edit->v_color->size = 22; $edit->v_color->maxlength = 20; //$edit->v_color->db_name ='color'; //$edit->v_color->rel_id ='vehiculo'; $edit->v_color->pointer = true; $edit->v_capaci = new inputField('Capacidad', 'v_capaci'); $edit->v_capaci->rule = 'max_length[11]'; $edit->v_capaci->size = 13; $edit->v_capaci->maxlength = 11; //$edit->v_capaci->db_name ='capaci'; //$edit->v_capaci->rel_id ='vehiculo'; $edit->v_capaci->pointer = true; $edit->v_serial_m = new inputField('Serial Motor', 'v_serial_m'); $edit->v_serial_m->size = 40; //$edit->v_serial_m->db_name ='serial_m'; //$edit->v_serial_m->rel_id ='vehiculo'; $edit->v_serial_m->pointer = true; $edit->v_placa_ant = new inputField('Placa Anterior', 'v_placa_ant'); $edit->v_placa_ant->rule = 'max_length[7]'; $edit->v_placa_ant->size = 9; $edit->v_placa_ant->maxlength = 7; //$edit->v_placa_ant->db_name ='placa_ant'; //$edit->v_placa_ant->rel_id ='vehiculo'; $edit->v_placa_ant->pointer = true; $edit->v_placa_act = new inputField('Placa', 'v_placa_act'); $edit->v_placa_act->rule = 'max_length[9]'; $edit->v_placa_act->size = 11; $edit->v_placa_act->maxlength = 9; //$edit->v_placa_act->db_name ='placa_act'; //$edit->v_placa_act->rel_id ='vehiculo'; $edit->v_placa_act->pointer = true; $edit->v_ano = new inputField('Año', 'v_ano'); $edit->v_ano->rule = 'max_length[4]'; $edit->v_ano->size = 6; $edit->v_ano->maxlength = 4; //$edit->v_ano->db_name ='ano'; //$edit->v_ano->rel_id ='vehiculo'; $edit->v_ano->pointer = true; $edit->v_peso = new inputField('Peso', 'v_peso'); $edit->v_peso->rule = 'max_length[8]'; $edit->v_peso->size = 10; $edit->v_peso->maxlength = 8; //$edit->v_peso->db_name ='peso'; //$edit->v_peso->rel_id ='vehiculo'; $edit->v_peso->pointer = true; $edit->v_serial_c = new inputField('Serial Carroceria', 'v_serial_c'); $edit->v_serial_c->size = 40; //$edit->v_serial_c->db_name ='serial_c'; //$edit->v_serial_c->rel_id ='vehiculo'; $edit->v_serial_c->pointer = true; $edit->ano = new inputField('Año', 'ano'); $edit->ano->insertValue = $this->datasis->traevalor('EJERCICIO'); $edit->ano->size = 4; $edit->ano->maxlength = 4; $m = array('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'); for ($i = 1; $i <= 12; $i++) { $campo = 'm_' . str_pad($i, 2, '0', STR_PAD_LEFT); $edit->{$campo} = new checkboxField($m[$i - 1], $campo, 'S', 'N'); $edit->{$campo}->insertValue = "N"; $edit->{$campo}->onchange = "cal_ch('" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')"; } $m = array('Trimestre 1', 'Trimestre 2', 'Trimestre 3', 'Trimestre 4'); for ($i = 1; $i <= 4; $i++) { $campo = 't_' . str_pad($i, 2, '0', STR_PAD_LEFT); $edit->{$campo} = new checkboxField($m[$i - 1], $campo, 'S', 'N'); $edit->{$campo}->insertValue = "N"; $edit->{$campo}->onchange = "cal_ch2('" . str_pad($i, 2, '0', STR_PAD_LEFT) . "')"; } //TEMPORALES foreach ($this->temp as $k => $v) { $edit->{$v} = new hiddenField('', $v); } if ($edit->_status == 'show') { $id = $edit->get_from_dataobjetct('id'); $tipo = $edit->get_from_dataobjetct('tipo'); if ($tipo == '15') { $action = "javascript:window.location='" . site_url($this->url . '/calcomania/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_calcomania", 'Pagar Calcomania', $action, "TL", "show"); } } $status = $edit->get_from_dataobjetct('status'); if ($this->datasis->puede(387)) { $print_url = site_url($this->url . 'datarecibo/modify/' . $id); $action = "javascript:window.location='{$print_url}'"; $edit->button('btn_recibo', 'Modificar Recibo', $action, 'TR'); } if ($status == 'P') { $edit->buttons('modify', 'delete'); if ($this->datasis->traevalor('RECIBOUSABTNIMPRIMIR') == 'S') { if ($edit->_status == 'show') { $print_url = site_url($this->url . 'dataprint/modify/' . $id); $action = "javascript:window.location='{$print_url}'"; $edit->button('btn_print', 'Imprimir Recibo', $action, 'TR'); $print_url = site_url($this->url . 'dataprint_solvencia/modify/' . $id); $action = "javascript:window.location='{$print_url}'"; $edit->button('btn_print', 'Imprimir Solvencia', $action, 'TR'); } } $action = "javascript:window.location='" . site_url($this->url . '/anular/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_anular", 'Anular', $action, "TR", "show"); if ($this->datasis->puede(389)) { $edit->buttons('delete'); } } $edit->buttons('add', 'save', 'undo', 'back'); $edit->build(); $conten["form"] =& $edit; $smenu['link'] = barra_menu('80B'); $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true); $conten['temp'] = $this->temp; $data['content'] = $this->load->view('view_recibo', $conten, true); $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(); $this->load->view('view_ventanas', $data); }
function dataedit($opttipo) { $opt_key = array_search($opttipo, array('C', 'P')); if ($opt_key === false) { show_404(''); } $this->rapyd->load('dataobject', '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'), 'p_uri' => array(4 => '<#i#>'), 'where' => '`activo` = "S" AND `tipo` = "Articulo"', 'script' => array('post_modbus_sinv(<#i#>)'), 'titulo' => 'Buscar Artículo'); if ($opttipo == 'C') { $mCLIPRO = array('tabla' => 'scli', 'columnas' => array('cliente' => 'Código Cliente', 'nombre' => 'Nombre', 'cirepre' => 'Rif/Cedula', 'dire11' => 'Dirección', 'tipo' => 'Tipo'), 'filtro' => array('cliente' => 'Código Cliente', 'nombre' => 'Nombre'), 'retornar' => array('cliente' => 'clipro', 'nombre' => 'nombre', 'dire11' => 'direc1', 'tipo' => 'cliprotipo'), 'titulo' => 'Buscar Cliente', 'script' => array('post_modbus_scli()')); $modbus['retornar'] = array('codigo' => 'codigo_<#i#>', 'descrip' => 'desca_<#i#>', 'base1' => 'precio1_<#i#>', 'base2' => 'precio2_<#i#>', 'base3' => 'precio3_<#i#>', 'base4' => 'precio4_<#i#>', 'iva' => 'itiva_<#i#>', 'peso' => 'sinvpeso_<#i#>', 'tipo' => 'sinvtipo_<#i#>'); } else { $mCLIPRO = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'Código Proveedor', 'nombre' => 'Nombre', 'direc1' => 'Dirección', 'rif' => 'RIF'), 'filtro' => array('proveed' => 'Código Proveedor', 'nombre' => 'Nombre'), 'retornar' => array('proveed' => 'clipro', 'nombre' => 'nombre', 'direc1' => 'direc1'), 'titulo' => 'Buscar Proveedor'); $modbus['retornar'] = array('codigo' => 'codigo_<#i#>', 'descrip' => 'desca_<#i#>', 'base1' => 'precio1_<#i#>', 'base2' => 'precio2_<#i#>', 'base3' => 'precio3_<#i#>', 'base4' => 'precio4_<#i#>', 'iva' => 'itiva_<#i#>', 'peso' => 'sinvpeso_<#i#>', 'tipo' => 'sinvtipo_<#i#>'); } $btnc = $this->datasis->modbus($mCLIPRO); $btn = $this->datasis->p_modbus($modbus, '<#i#>'); $do = new DataObject('scon'); $do->rel_one_to_many('itscon', 'itscon', array('id' => 'id_scon')); if ($opttipo == 'C') { $do->pointer('scli', 'scli.cliente=scon.clipro', 'scli.tipo AS cliprotipo', 'left'); $do->rel_pointer('itscon', 'sinv', 'itscon.codigo=sinv.codigo', 'sinv.descrip AS sinvdescrip, sinv.base1 AS sinvprecio1, sinv.base2 AS sinvprecio2, sinv.base3 AS sinvprecio3, sinv.base4 AS sinvprecio4, sinv.iva AS sinviva, sinv.peso AS sinvpeso,sinv.tipo AS sinvtipo'); } else { //$do->pointer('sprv' ,'sprv.proveed=psinv.clipro','"1" AS `cliprotipo`','left'); $do->rel_pointer('itscon', 'sinv', 'itscon.codigo=sinv.codigo', 'sinv.descrip AS sinvdescrip, sinv.ultimo AS sinvprecio1, sinv.ultimo AS sinvprecio2, sinv.ultimo AS sinvprecio3, sinv.ultimo AS sinvprecio4, sinv.iva AS sinviva, sinv.peso AS sinvpeso,sinv.tipo AS sinvtipo'); } $edit = new DataDetails('Inventario a consignación', $do); $edit->on_save_redirect = false; $edit->set_rel_title('itscon', 'Producto <#o#>'); $edit->pre_process('insert', '_pre_insert'); $edit->pre_process('update', '_pre_update'); $edit->pre_process('delete', '_pre_delete'); $edit->post_process('insert', '_post_insert'); $edit->fecha = new DateonlyField('Fecha', 'fecha', 'd/m/Y'); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->rule = 'required'; $edit->fecha->mode = 'autohide'; $edit->fecha->size = 12; $edit->fecha->calendar = false; $edit->tipod = new dropdownField('Tipo de movimiento', 'tipod'); $edit->tipod->option('E', 'Entregado'); $edit->tipod->option('R', 'Recibido'); $edit->tipod->rule = 'required'; $edit->tipod->insertValue = $opttipo == 'C' ? 'E' : 'R'; $edit->tipod->style = 'width:120px'; $edit->numero = new inputField('Número', 'numero'); $edit->numero->size = 12; $edit->numero->mode = 'autohide'; $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->peso = new inputField('Peso', 'peso'); $edit->peso->css_class = 'inputnum'; $edit->peso->readonly = true; $edit->peso->size = 10; $edit->peso->type = 'inputhidden'; $edit->clipro = new inputField($opttipo == 'C' ? 'Cliente' : 'Proveedor', 'clipro'); $edit->clipro->size = 6; $edit->clipro->maxlength = 5; $edit->clipro->rule = 'required'; $edit->clipro->append($btnc); $edit->nombre = new inputField('Nombre', 'nombre'); $edit->nombre->size = 25; $edit->nombre->maxlength = 40; $edit->nombre->type = 'inputhidden'; $edit->nombre->autocomplete = false; $edit->dir_clipro = new inputField('Dirección', 'direc1'); $edit->dir_clipro->size = 37; $edit->dir_clipro->type = 'inputhidden'; $edit->asociado = new inputField('Doc. Asociado', 'asociado'); $edit->asociado->mode = 'autohide'; $edit->asociado->size = 10; $edit->almacen = new dropdownField('Almacén', 'almacen'); $edit->almacen->options('SELECT ubica, CONCAT(ubica,\' \',ubides) nombre FROM caub ORDER BY ubica'); $edit->almacen->rule = 'required'; $edit->almacen->style = 'width:200px;'; $edit->almacen->size = 5; $edit->observ1 = new inputField('Observación', 'observ1'); $edit->observ1->size = 37; //Para saber que precio se le va a dar al cliente $edit->cliprotipo = new hiddenField('', 'cliprotipo'); $edit->cliprotipo->db_name = 'cliprotipo'; $edit->cliprotipo->pointer = true; $edit->cliprotipo->insertValue = 1; //Campos para el detalle $edit->codigo = new inputField('Código <#o#>', 'codigo_<#i#>'); $edit->codigo->size = 12; $edit->codigo->db_name = 'codigo'; $edit->codigo->onkeyup = 'OnEnter(event,<#i#>)'; $edit->codigo->autocomplete = false; $edit->codigo->rel_id = 'itscon'; $edit->codigo->rule = 'required'; $edit->codigo->append($btn); $edit->desca = new inputField('Descripción <#o#>', 'desca_<#i#>'); $edit->desca->size = 34; $edit->desca->db_name = 'desca'; $edit->desca->maxlength = 50; $edit->desca->readonly = true; $edit->desca->rel_id = 'itscon'; $edit->cana = new inputField('Cantidad <#o#>', 'cana_<#i#>'); $edit->cana->db_name = 'cana'; $edit->cana->css_class = 'inputnum'; $edit->cana->rel_id = 'itscon'; $edit->cana->maxlength = 10; $edit->cana->size = 6; $edit->cana->rule = 'required|positive'; $edit->cana->autocomplete = false; $edit->cana->onkeyup = 'importe(<#i#>)'; $edit->precio = new inputField('Precio <#o#>', 'precio_<#i#>'); $edit->precio->db_name = 'precio'; $edit->precio->css_class = 'inputnum'; $edit->precio->rel_id = 'itscon'; $edit->precio->size = 10; if ($opttipo == 'C') { $edit->precio->rule = 'required|positive|callback_chpreca[<#i#>]'; } else { $edit->precio->rule = 'required|positive'; } $edit->precio->readonly = true; $edit->importe = new inputField('Importe <#o#>', 'importe_<#i#>'); $edit->importe->db_name = 'importe'; $edit->importe->size = 10; $edit->importe->css_class = 'inputnum'; $edit->importe->rel_id = 'itscon'; for ($i = 1; $i <= 4; $i++) { $obj = 'precio' . $i; $edit->{$obj} = new hiddenField('Precio <#o#>', $obj . '_<#i#>'); $edit->{$obj}->db_name = 'sinv' . $obj; $edit->{$obj}->rel_id = 'itscon'; $edit->{$obj}->pointer = true; } $edit->itiva = new hiddenField('', 'itiva_<#i#>'); $edit->itiva->db_name = 'iva'; $edit->itiva->rel_id = 'itscon'; $edit->sinvpeso = new hiddenField('', 'sinvpeso_<#i#>'); $edit->sinvpeso->db_name = 'sinvpeso'; $edit->sinvpeso->rel_id = 'itscon'; $edit->sinvpeso->pointer = true; $edit->sinvtipo = new hiddenField('', 'sinvtipo_<#i#>'); $edit->sinvtipo->db_name = 'sinvtipo'; $edit->sinvtipo->rel_id = 'itscon'; $edit->sinvtipo->pointer = true; //fin de campos para detalle $edit->impuesto = new inputField('Impuesto', 'impuesto'); $edit->impuesto->size = 20; $edit->impuesto->css_class = 'inputnum'; $edit->impuesto->type = 'inputhidden'; $edit->stotal = new inputField('Sub.Total', 'stotal'); $edit->stotal->size = 20; $edit->stotal->css_class = 'inputnum'; $edit->stotal->type = 'inputhidden'; $edit->gtotal = new inputField('Total', 'gtotal'); $edit->gtotal->size = 20; $edit->gtotal->css_class = 'inputnum'; $edit->gtotal->type = 'inputhidden'; $edit->tipo = new autoUpdateField('tipo', $opttipo, $opttipo); //$edit->buttons('save', 'undo', 'back','add_rel'); $edit->build(); $inven = array(); if ($opttipo == 'C') { $titulo = 'Consignación a Cliente'; //$query=$this->db->query('SELECT TRIM(codigo) AS codigo ,TRIM(descrip) AS descrip,tipo,base1,base2,base3,base4,iva,peso,precio1,pond FROM sinv WHERE activo=\'S\''); $edit->tipo = new autoUpdateField('tipo', 'C', 'C'); } else { $titulo = 'Consignación a Proveedor'; //$query=$this->db->query('SELECT TRIM(codigo) AS codigo ,TRIM(descrip) AS descrip,tipo,ultimo AS base1,ultimo AS base2,ultimo AS base3,ultimo AS base4,iva,peso,precio1,pond FROM sinv WHERE activo=\'S\''); $edit->tipo = new autoUpdateField('tipo', 'R', 'R'); } if ($edit->on_success()) { $rt = array('status' => 'A', 'mensaje' => 'Registro guardado', 'pk' => $edit->_dataobject->pk); echo json_encode($rt); } else { $conten['opttipo'] = $opttipo; $conten['form'] =& $edit; $this->load->view('view_scon', $conten); } }
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($estado = '', $id = '') { $this->datasis->modulo_id(115, 1); $this->rapyd->load('dataobject', 'datadetails'); $this->rapyd->uri->keep_persistence(); $mBANC = array('tabla' => 'banc', 'columnas' => array('codbanc' => 'Cóodigo', 'fondo' => 'Clasificacion', 'banco' => 'Banco', 'saldo' => 'Saldo', 'numcuent' => 'Cuenta'), 'filtro' => array('codbanc' => 'Cóodigo', 'banco' => 'Banco', 'saldo' => 'Saldo', 'numcuent' => 'Cuenta'), 'p_uri' => array(4 => '<#i#>'), 'retornar' => array('codbanc' => 'codbancm_<#i#>'), 'where' => 'activo = "S"', 'script' => array('ultimoch(<#i#>)', 'cal_nombrech(<#i#>)', 'cal_totalch()'), 'titulo' => 'Buscar Bancos'); $bBANC = $this->datasis->p_modbus($mBANC, "<#i#>"); $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'Cóodigo', 'nombre' => 'Nombre', 'rif' => 'Rif', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'Código', 'nombre' => 'Nombre', 'rif' => 'Rif'), 'retornar' => array('proveed' => 'cod_prov', 'nombre' => 'nombrep'), 'titulo' => 'Buscar Beneficiario'); $bSPRV = $this->datasis->p_modbus($mSPRV, "proveed"); $modbus = array('tabla' => 'v_pagos_encab', 'columnas' => array('numero' => 'Número', 'fondo' => 'F. Financiamiento', 'fecha' => 'Fecha', 'cod_prov' => 'Codigo', 'nombre' => 'Beneficiario', 'total2' => 'Total'), 'filtro' => array('numero' => 'Número', 'nombre' => 'Beneficiario', 'total2' => 'Total'), 'retornar' => array('numero' => 'pago_<#i#>', 'imptimbre' => 'imptimbreo_<#i#>', 'impmunicipal' => 'impmunicipalo_<#i#>', 'crs' => 'crso_<#i#>', 'total' => 'totalo_<#i#>', 'total2' => 'total2o_<#i#>', 'reten' => 'reteno_<#i#>', 'reteiva' => 'reteivao_<#i#>', 'crs' => 'crso_<#i#>', 'otrasrete' => 'otrasreteo_<#i#>', 'cod_prov' => 'cod_prov', 'observa' => 'temp'), 'p_uri' => array(4 => '<#i#>', 5 => '<#cod_prov#>'), 'where' => '(status="C2" OR status="O2" OR status = "H2" OR status = "M2" OR status = "N2" OR status = "F2" OR status = "B2" OR status = "R2" OR status = "G2" OR status = "I2" OR status = "S2" OR status="K2") AND IF(<#cod_prov#>=".....",cod_prov LIKE "%",cod_prov = <#cod_prov#>)', 'script' => array('cal_observa()', 'cal_nprov()'), 'titulo' => 'Busqueda de Ordenes de Pago'); $btn = $this->datasis->p_modbus($modbus, '<#i#>/<#cod_prov#>'); $do = new DataObject("desem"); $do->rel_one_to_many('pades', 'pades', array('numero' => 'desem')); $do->rel_one_to_many('mbanc', 'mbanc', array('numero' => 'desem')); $do->rel_pointer('pades', 'odirect', 'pades.pago=odirect.numero', "odirect.total AS totalo,odirect.total2 AS total2o,odirect.reteiva AS reteivao,odirect.reten AS reteno,odirect.imptimbre AS imptimbreo, odirect.impmunicipal AS impmunicipalo,odirect.crs AS crso,odirect.otrasrete AS otrasreteo "); $do->pointer('sprv', 'sprv.proveed=desem.cod_prov', 'sprv.nombre AS nombrep'); //$do->load($id); $edit = new DataDetails($this->t**s, $do); $edit->back_url = site_url($this->url . "filteredgrid"); $edit->set_rel_title('pades', 'Rubro <#o#>'); $edit->pre_process('insert', '_valida'); $edit->pre_process('update', '_valida'); $edit->pre_process('delete', '_pre_del'); $edit->post_process('insert', '_post_insert'); $edit->post_process('update', '_post_update'); $edit->post_process('delete', '_post_delete'); $status = $edit->get_from_dataobjetct('status'); //**************************INICIO ENCABEZADO******************************************************************** $edit->numero = new inputField("Número", "numero"); $edit->numero->mode = "autohide"; $edit->numero->when = array('show'); $edit->fdesem = new dateonlyField("Fecha", "fdesem"); $edit->fdesem->rule = 'required|chfecha'; $edit->fdesem->insertValue = date('Ymd'); $edit->fdesem->size = 12; $edit->cod_prov = new inputField("Beneficiario", 'cod_prov'); $edit->cod_prov->rule = 'required'; $edit->cod_prov->db_name = "cod_prov"; $edit->cod_prov->size = 5; $edit->cod_prov->append($bSPRV); $edit->cod_prov->onchange = "cal_nprov();"; //print_r($edit->_dataobject); //echo "sddsds".$edit->_dataobject->_pointer_data['nombrep']; $edit->nombrep = new inputField("Nombre Beneficiario", 'nombrep'); $edit->nombrep->size = 50; $edit->nombrep->readonly = true; $edit->nombrep->pointer = true; $edit->total = new inputField("Totales", "total"); $edit->total->size = 13; $edit->total->readonly = true; $edit->total->css_class = 'inputnum'; $edit->total->rule = 'numeric'; $edit->totalch = new inputField("Total en Cheques Activos", "totalch"); $edit->totalch->size = 15; $edit->totalch->readonly = true; $edit->totalch->css_class = 'inputnum'; $edit->totalch->rule = 'numeric'; $edit->tcrs = new inputField("Total a I.C.R.S", "tcrs"); $edit->tcrs->size = 13; $edit->tcrs->readonly = true; $edit->tcrs->css_class = 'inputnum'; $edit->tcrs->rule = 'numeric'; $edit->totrasrete = new inputField("Total Otras Retenciones", "totrasrete"); $edit->totrasrete->size = 13; $edit->totrasrete->readonly = true; $edit->totrasrete->css_class = 'inputnum'; $edit->totrasrete->rule = 'numeric'; $edit->ttimbre = new inputField("Total Timbre", "ttimbre"); $edit->ttimbre->size = 13; $edit->ttimbre->readonly = true; $edit->ttimbre->css_class = 'inputnum'; $edit->ttimbre->rule = 'numeric'; $edit->tmunicipal = new inputField("Total Timbre", "tmunicipal"); $edit->tmunicipal->size = 13; $edit->tmunicipal->readonly = true; $edit->tmunicipal->css_class = 'inputnum'; $edit->tmunicipal->rule = 'numeric'; $edit->tislr = new inputField("Total a Pagar", "tislr"); $edit->tislr->size = 13; $edit->tislr->readonly = true; $edit->tislr->css_class = 'inputnum'; $edit->tislr->rule = 'numeric'; $edit->triva = new inputField("Total a Pagar", "triva"); $edit->triva->size = 13; $edit->triva->readonly = true; $edit->triva->css_class = 'inputnum'; $edit->triva->rule = 'numeric'; $edit->total2 = new inputField("Total a Pagar", "total2"); $edit->total2->size = 13; $edit->total2->readonly = true; $edit->total2->css_class = 'inputnum'; $edit->total2->rule = 'numeric'; $edit->temp = new inputField("temp", "temp"); $edit->temp->when = array('modify', 'create'); //************************** FIN ENCABEZADO******************************************************************** //**************************INICIO DETALLE DE ORDENES DEPAGO***************************************************** $edit->itpago = new inputField("(<#o#>) ", "pago_<#i#>"); $edit->itpago->rule = 'callback_repetido|required|callback_itorden'; $edit->itpago->size = 13; $edit->itpago->db_name = 'pago'; $edit->itpago->rel_id = 'pades'; //$edit->itpago->readonly =true; if ($status == 'D2' || $status == 'D3') { $edit->itpago->mode = "autohide"; } $edit->itpago->append('<img src="' . base_url() . 'assets/default/images/system-search.png" alt="Busqueda de Ordenes de Pago" title="Busqueda de Ordenes de Pago" border="0" onclick="modbusdepen(<#i#>)"/>'); $campos = array('total2o', 'otrasreteo', 'crso', 'imptimbreo', 'impmunicipalo', 'reteno', 'reteivao', 'totalo'); foreach ($campos as $campo => $objeto) { $objeto2 = 'it' . $objeto; $edit->{$objeto2} = new inputField("(<#o#>) Total", $objeto . "_<#i#>"); $edit->{$objeto2}->db_name = $objeto; $edit->{$objeto2}->rel_id = 'pades'; $edit->{$objeto2}->size = 13; $edit->{$objeto2}->readonly = true; $edit->{$objeto2}->pointer = true; $edit->{$objeto2}->css_class = 'inputnum'; if ($status == 'D2' || $status == 'D3') { $edit->{$objeto2}->mode = "autohide"; } } //************************** FIN DETALLE DE ORDENES DEPAGO***************************************************** //**************************INICIO DETALLE DE DE MOVIMIENTOS BANCARIOS******************************************* $edit->itstatusm = new dropdownField("(<#o#>) Banco", 'statusm_<#i#>'); if ($edit->_status == 'show') { $edit->itstatusm->option("NC", "Nota de Crédito"); } $edit->itstatusm->option("E1", "Pendiente"); $edit->itstatusm->option("E2", "Activo"); $edit->itstatusm->option("AN", "Anulado"); $edit->itstatusm->option("A2", "Anulado."); $edit->itstatusm->db_name = 'status'; $edit->itstatusm->size = 3; $edit->itstatusm->rel_id = 'mbanc'; $edit->itstatusm->style = "width:100px;"; $edit->itstatusm->onchange = "cal_totalch();"; $edit->itstatusm->when = array('show'); //$edit->itstatusm->pointer = true; $edit->itcodbancm = new inputField("(<#o#>) Banco", 'codbancm_<#i#>'); $edit->itcodbancm->db_name = 'codbanc'; $edit->itcodbancm->size = 3; $edit->itcodbancm->readonly = true; $edit->itcodbancm->rel_id = 'mbanc'; $edit->itcodbancm->rule = "required|callback_banco"; $edit->itcodbancm->append($bBANC); //$edit->itcodbancm->pointer = true; $edit->itdestino = new dropdownField("(<#o#>) Destino", "destino_<#i#>"); $edit->itdestino->db_name = 'destino'; $edit->itdestino->option("C", "Caja"); $edit->itdestino->option("I", "Interno"); $edit->itdestino->style = "width:50px"; $edit->itdestino->rel_id = 'mbanc'; $edit->ittipo_docm = new dropdownField("(<#o#>) Tipo Documento", "tipo_docm_<#i#>"); $edit->ittipo_docm->db_name = 'tipo_doc'; $edit->ittipo_docm->option("CH", "Cheque"); if ($edit->_status == 'show') { $edit->ittipo_docm->option("NC", "Nota de Credito"); } $edit->ittipo_docm->option("ND", "Nota de Debito"); $edit->ittipo_docm->option("DP", "Deposito"); $edit->ittipo_docm->option("CH", "Cheque"); $edit->ittipo_docm->style = "width:180px"; $edit->ittipo_docm->rel_id = 'mbanc'; $edit->ittipo_docm->style = "width:130px;"; //$edit->ittipo_docm->pointer = true; $edit->itchequem = new inputField("(<#o#>) Cheque", 'chequem_<#i#>'); $edit->itchequem->db_name = 'cheque'; $edit->itchequem->size = 10; $edit->itchequem->rule = "required"; //callback_chexiste_cheque| $edit->itchequem->rel_id = 'mbanc'; //$edit->itchequem->pointer = true; $edit->itfecham = new dateonlyField("(<#o#>) Fecha Cheque", "fecham_<#i#>"); $edit->itfecham->db_name = 'fecha'; $edit->itfecham->size = 10; $edit->itfecham->rule = 'required'; $edit->itfecham->rel_id = 'mbanc'; $edit->itfecham->insertValue = date('Ymd'); //$edit->itfecham->pointer = true; $edit->itmontom = new inputField("(<#o#>) Total", 'montom_<#i#>'); $edit->itmontom->db_name = 'monto'; //$edit->itmontom->mode = 'autohide'; //$edit->itmontom->when = array('show'); $edit->itmontom->size = 15; $edit->itmontom->rule = 'callback_positivo'; $edit->itmontom->rel_id = 'mbanc'; $edit->itmontom->css_class = 'inputnum'; $edit->itmontom->onchange = "cal_totalch();"; //$edit->itmontom->pointer = true; $edit->itbenefim = new inputField("(<#o#>) A Nombre de", 'benefim_<#i#>'); $edit->itbenefim->db_name = 'benefi'; $edit->itbenefim->size = 15; $edit->itbenefim->maxlenght = 40; $edit->itbenefim->rel_id = 'mbanc'; $edit->itobservam = new textAreaField("(<#o#>) Observaciones", 'observam_<#i#>'); $edit->itobservam->db_name = 'observa'; $edit->itobservam->cols = 30; $edit->itobservam->rows = 1; $edit->itobservam->rel_id = 'mbanc'; //$edit->itobservam->pointer = true; //$edit->itidm = new inputField("(<#o#>) Cheque", 'idm_<#i#>'); //$edit->itidm->db_name ='id'; //$edit->itidm-> size = 1; //$edit->itidm->rel_id ='mbanc'; //$edit->itchequem->pointer = true; //$edit->itcontainer = new containerField("alert",$uri); //$edit->itcontainer->when = array("show"); //$edit->itcontainer->rel_id ='mbanc'; //************************** FIN DETALLE DE DE MOVIMIENTOS BANCARIOS******************************************* $sta = $edit->get_from_dataobjetct('sta'); if ($status == 'D1') { if ($this->datasis->puede(372)) { $edit->buttons("delete"); } $action = "javascript:window.location='" . site_url($this->url . 'actualizar/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_status", 'Emitir', $action, "TR", "show", "button"); $action = "javascript:btn_anulaf('" . $edit->rapyd->uri->get_edited_id() . "')"; $edit->button_status("btn_anular", 'Anular', $action, "TR", "show", "button"); if ($this->datasis->puede(371)) { $edit->buttons("modify", "save"); } } elseif ($status == 'D2' && $sta != 'E22' & $sta != 'E23') { $action = "javascript:btn_anulaf('" . $edit->rapyd->uri->get_edited_id() . "')"; $edit->button_status("btn_anular", 'Anular', $action, "TR", "show", "button_add_rel"); } elseif ($status == 'DA') { if ($this->datasis->puede(372)) { $edit->buttons("delete"); } } else { $edit->buttons("save"); } $edit->button_status("btn_add_mbanc", 'Agregar Cheque/Nota de Debito', "javascript:add_mbanc()", "MB", 'modify', "button_add_rel"); $edit->button_status("btn_add_mbanc2", 'Agregar Cheque/Nota de Debito', "javascript:add_mbanc()", "MB", 'create', "button_add_rel"); $edit->button_status("btn_add_pades", 'Agregar O. de Pago', "javascript:add_pades()", "PA", "create", "button_add_rel"); $edit->button_status("btn_add_pades2", 'Agregar O. de Pago', "javascript:add_pades()", "PA", "modify", "button_add_rel"); $edit->button_status("btn_op_desde_hasta", 'Agregar Multiples Ordenes de Pago', "javascript:op_desde_hasta()", "TL", "create", "TL"); $edit->button_status("btn_op_desde_hasta2", 'Agregar Multiples Ordenes de Pago', "javascript:op_desde_hasta()", "TL", "modify", "TL"); $edit->buttons("undo", "back"); if ($this->datasis->puede(370)) { $edit->buttons("add"); } $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_desem', $conten, true); //$data['content'] = $edit->output; $data['title'] = "{$this->t**s}"; $data["head"] = $this->rapyd->get_head() . script('jquery.js') . script('jquery-ui.js') . script("plugins/jquery.numeric.pack.js") . style('vino/jquery-ui.css'); $this->load->view('view_ventanas', $data); }
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 dataeditordp($numero, $esta) { if (!isset($_POST['codigo_0'])) { //SELECT c.codigo //,COALESCE(b.cantidad*IF(tipoordp='E',-1,1),0) AS tracana //,c.cantidad //FROM stra AS a //JOIN itstra AS b ON a.numero=b.numero //RIGHT JOIN ordpitem AS c ON a.ordp=c.numero AND b.codigo=c.codigo //WHERE c.numero='00000019' } $id_ordp = $this->datasis->dameval('SELECT id FROM ordp WHERE numero=' . $this->db->escape($numero)); $this->back_dataedit = 'inventario/ordp/dataedit/show/' . $id_ordp; $this->rapyd->load('dataobject', 'datadetails'); $modbus = array('tabla' => 'sinv', 'columnas' => array('codigo' => 'Código', 'descrip' => 'Descripción', 'precio1' => 'Precio 1', 'precio2' => 'Precio 2', 'precio3' => 'Precio 3', 'existen' => 'Existencia', 'peso' => 'Peso'), 'filtro' => array('codigo' => 'Código', 'descrip' => 'Descripción'), 'retornar' => array('codigo' => 'codigo_<#i#>', 'descrip' => 'descrip_<#i#>'), 'where' => 'activo = "S" AND tipo="Articulo"', 'script' => array('post_modbus("<#i#>")'), 'p_uri' => array(4 => '<#i#>'), 'titulo' => 'Busqueda de producto en inventario'); $btn = $this->datasis->p_modbus($modbus, '<#i#>'); $script = "\n\t\tfunction post_add_itstra(id){\n\t\t\t\$('#cantidad_'+id).numeric('.');\n\t\t\treturn true;\n\t\t}"; $do = new DataObject('stra'); $do->rel_one_to_many('itstra', 'itstra', 'numero'); //$do->rel_pointer('itstra','sinv','itstra.codigo=sinv.codigo','sinv.descrip as sinvdescrip'); $edit = new DataDetails('Transferencia', $do); $edit->back_url = $this->back_dataedit; $edit->set_rel_title('itstra', 'Producto <#o#>'); $edit->script($script, 'create'); $edit->script($script, 'modify'); $edit->pre_process('insert', '_pre_ordp_insert'); $edit->pre_process('update', '_pre_update'); $edit->pre_process('delete', '_pre_delete'); $edit->post_process('insert', '_post_insert'); $edit->numero = new inputField('Número', 'numero'); $edit->numero->mode = 'autohide'; $edit->numero->size = 10; $edit->numero->apply_rules = false; //necesario cuando el campo es clave y no se pide al usuario $edit->numero->when = array('show', 'modify'); $edit->ordp = new inputField('Orden de producción', 'ordp'); $edit->ordp->mode = 'autohide'; $edit->ordp->size = 10; $edit->ordp->rule = 'required|callback_chordp'; $edit->ordp->insertValue = $numero; $edit->ordp->when = array('show', 'modify'); $edit->fecha = new dateonlyField('Fecha', 'fecha'); $edit->fecha->rule = 'required|chfecha'; $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->size = 12; $edit->esta = new dropdownField('Estación', 'esta'); $edit->esta->option('', 'Seleccionar'); $edit->esta->options('SELECT estacion,CONCAT(estacion,\'-\',nombre) AS lab FROM esta ORDER BY estacion'); $edit->esta->rule = 'required'; $edit->esta->insertValue = $esta; $edit->esta->style = 'width:150px;'; $edit->tipoordp = new dropdownField('Tipo de movimiento', 'tipoordp'); $edit->tipoordp->option('', 'Seleccionar'); $edit->tipoordp->option('E', 'Entrega'); $edit->tipoordp->option('R', 'Retiro'); $edit->tipoordp->rule = 'required|enum[E,R]'; $edit->tipoordp->style = 'width:150px;'; $edit->observ1 = new inputField('Observación', 'observ1'); $edit->observ1->rule = 'max_length[60]|trim'; $edit->observ1->size = 32; $edit->observ1->maxlength = 30; //comienza el detalle $edit->codigo = new inputField('Código <#o#>', 'codigo_<#i#>'); $edit->codigo->db_name = 'codigo'; $edit->codigo->append($btn); $edit->codigo->rule = 'trim|required|sinvexiste'; $edit->codigo->rel_id = 'itstra'; $edit->codigo->maxlength = 15; $edit->codigo->size = 15; $edit->descrip = new inputField('Descripción', 'descrip_<#i#>'); $edit->descrip->db_name = 'descrip'; $edit->descrip->type = 'inputhidden'; $edit->descrip->rel_id = 'itstra'; $edit->descrip->maxlength = 45; $edit->descrip->size = 40; $edit->cantidad = new inputField('Cantidad', 'cantidad_<#i#>'); $edit->cantidad->db_name = 'cantidad'; $edit->cantidad->css_class = 'inputnum'; $edit->cantidad->rel_id = 'itstra'; $edit->cantidad->rule = 'numeric|mayorcero|required'; $edit->cantidad->maxlength = 10; $edit->cantidad->autocomplete = false; $edit->cantidad->size = 10; //Fin del detalle $edit->estampa = new autoUpdateField('estampa', date('Ymd'), date('Ymd')); $edit->hora = new autoUpdateField('hora', date('H:i:s'), date('H:i:s')); $edit->usuario = new autoUpdateField('usuario', $this->session->userdata('usuario'), $this->session->userdata('usuario')); $accion = "javascript:buscaprod()"; $edit->button_status('btn_terminar', 'Traer insumos', $accion, 'TR', 'create'); $edit->buttons('save', 'undo', 'back', 'add_rel'); if ($this->genesal) { $edit->build(); $conten['form'] =& $edit; $data['content'] = $this->load->view('view_stra_ordp', $conten, true); $data['style'] = style('redmond/jquery-ui.css'); $data['script'] = script('jquery.js'); $data['script'] .= script('jquery-ui.js'); $data['script'] .= script("jquery-impromptu.js"); $data['script'] .= script('plugins/jquery.numeric.pack.js'); $data['script'] .= script('plugins/jquery.ui.autocomplete.autoSelectOne.js'); $data['script'] .= script('plugins/jquery.floatnumber.js'); $data['script'] .= phpscript('nformat.js'); $data['content'] = $this->load->view('view_stra_ordp', $conten, true); $data['head'] = $this->rapyd->get_head(); $data['title'] = heading('Transferencias de inventario para producción'); $this->load->view('view_ventanas', $data); } else { $edit->on_save_redirect = false; $edit->build(); if ($edit->on_success()) { $rt = 'Transferencia Guardada'; } elseif ($edit->on_error()) { $rt = html_entity_decode(preg_replace('/<[^>]*>/', '', $edit->error_string)); } return $rt; } }
function dataedit($opttipo) { $opt_key = array_search($opttipo, array('scli', 'sprv')); if ($opt_key === false) { show_404(''); } $this->rapyd->load('dataobject', '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'), 'p_uri' => array(4 => '<#i#>'), 'where' => '`activo` = "S" AND `tipo` = "Articulo"', 'script' => array('post_modbus_sinv(<#i#>)'), 'titulo' => 'Buscar Artículo'); if ($opttipo == 'scli') { $mCLIPRO = array('tabla' => 'scli', 'columnas' => array('cliente' => 'Código Cliente', 'nombre' => 'Nombre', 'cirepre' => 'Rif/Cedula', 'dire11' => 'Dirección', 'tipo' => 'Tipo'), 'filtro' => array('cliente' => 'Código Cliente', 'nombre' => 'Nombre'), 'retornar' => array('cliente' => 'clipro', 'nombre' => 'nombre', 'dire11' => 'dir_clipro', 'tipo' => 'cliprotipo'), 'titulo' => 'Buscar Cliente', 'script' => array('post_modbus_scli()')); $modbus['retornar'] = array('codigo' => 'codigo_<#i#>', 'descrip' => 'desca_<#i#>', 'base1' => 'precio1_<#i#>', 'base2' => 'precio2_<#i#>', 'base3' => 'precio3_<#i#>', 'base4' => 'precio4_<#i#>', 'iva' => 'itiva_<#i#>', 'peso' => 'sinvpeso_<#i#>', 'tipo' => 'sinvtipo_<#i#>'); } else { $mCLIPRO = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'Código Proveedor', 'nombre' => 'Nombre', 'direc1' => 'Dirección', 'rif' => 'RIF'), 'filtro' => array('proveed' => 'Código Proveedor', 'nombre' => 'Nombre'), 'retornar' => array('proveed' => 'clipro', 'nombre' => 'nombre', 'direc1' => 'dir_clipro'), 'titulo' => 'Buscar Proveedor'); $modbus['retornar'] = array('codigo' => 'codigo_<#i#>', 'descrip' => 'desca_<#i#>', 'ultimo' => 'precio1_<#i#>', 'ultimo' => 'precio2_<#i#>', 'ultimo' => 'precio3_<#i#>', 'ultimo' => 'precio4_<#i#>', 'iva' => 'itiva_<#i#>', 'peso' => 'sinvpeso_<#i#>', 'tipo' => 'sinvtipo_<#i#>'); } $btnc = $this->datasis->modbus($mCLIPRO); $btn = $this->datasis->p_modbus($modbus, '<#i#>'); $do = new DataObject('psinv'); $do->rel_one_to_many('itpsinv', 'itpsinv', 'numero'); if ($opttipo == 'scli') { $do->pointer('scli', 'scli.cliente=psinv.clipro', 'scli.tipo AS cliprotipo', 'left'); $do->rel_pointer('itpsinv', 'sinv', 'itpsinv.codigo=sinv.codigo', 'sinv.descrip AS sinvdescrip, sinv.base1 AS sinvprecio1, sinv.base2 AS sinvprecio2, sinv.base3 AS sinvprecio3, sinv.base4 AS sinvprecio4, sinv.iva AS sinviva, sinv.peso AS sinvpeso,sinv.tipo AS sinvtipo'); } else { //$do->pointer('sprv' ,'sprv.proveed=psinv.clipro','"1" AS `cliprotipo`','left'); $do->rel_pointer('itpsinv', 'sinv', 'itpsinv.codigo=sinv.codigo', 'sinv.descrip AS sinvdescrip, sinv.ultimo AS sinvprecio1, sinv.ultimo AS sinvprecio2, sinv.ultimo AS sinvprecio3, sinv.ultimo AS sinvprecio4, sinv.iva AS sinviva, sinv.peso AS sinvpeso,sinv.tipo AS sinvtipo'); } $edit = new DataDetails('Inventario a consignación', $do); $edit->back_url = site_url('inventario/psinv/filteredgrid'); $edit->set_rel_title('itpsinv', 'Producto <#o#>'); $edit->back_url = $this->back_dataedit; $edit->pre_process('insert', '_pre_insert'); $edit->pre_process('update', '_pre_update'); $edit->pre_process('delete', '_pre_delete'); $edit->post_process('insert', '_post_insert'); //$edit->post_process('update','_post_update'); //$edit->post_process('delete','_post_delete'); $edit->fecha = new DateonlyField('Fecha', 'fecha', 'd/m/Y'); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->rule = 'required'; $edit->fecha->mode = 'autohide'; $edit->fecha->size = 10; /*$edit->tipo = new dropdownField('Tipo', 'tipo'); $edit->tipo->option('R','Recibido'); $edit->tipo->option('C','Cedido'); //$edit->tipo->option('X','Anulado'); $edit->tipo->style='width:160px';*/ $edit->vende = new dropdownField('Vendedor', 'vende'); $edit->vende->options('SELECT vendedor, CONCAT(vendedor,\' \',nombre) nombre FROM vend ORDER BY vendedor'); $edit->vende->style = 'width:200px;'; $edit->vende->size = 5; $edit->numero = new inputField('Número', 'numero'); $edit->numero->size = 10; $edit->numero->mode = 'autohide'; $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->peso = new inputField('Peso', 'peso'); $edit->peso->css_class = 'inputnum'; $edit->peso->readonly = true; $edit->peso->size = 10; $edit->clipro = new inputField($opttipo == 'scli' ? 'Cliente' : 'Proveedor', 'clipro'); $edit->clipro->size = 6; $edit->clipro->maxlength = 5; $edit->clipro->rule = 'required'; $edit->clipro->append($btnc); $edit->nombre = new inputField('Nombre', 'nombre'); $edit->nombre->size = 25; $edit->nombre->maxlength = 40; $edit->nombre->autocomplete = false; $edit->factura = new inputField('Factura', 'factura'); $edit->factura->size = 10; $edit->factura->when = array('show'); $edit->almacen = new dropdownField('Almacén', 'almacen'); $edit->almacen->options('SELECT ubica, CONCAT(ubica,\' \',ubides) nombre FROM caub ORDER BY ubica'); $edit->almacen->rule = 'required'; $edit->almacen->style = 'width:200px;'; $edit->almacen->size = 5; $edit->orden = new inputField("Orden", "orden"); $edit->orden->size = 10; $edit->observa = new inputField("Observación", "observa"); $edit->observa->size = 37; $edit->dir_clipro = new inputField("Dirección", "dir_clipro"); $edit->dir_clipro->size = 37; //$edit->dir_cl1 = new inputField(" ","dir_cl1"); //$edit->dir_cl1->size = 55; //Para saber que precio se le va a dar al cliente $edit->cliprotipo = new hiddenField('', 'cliprotipo'); $edit->cliprotipo->db_name = 'cliprotipo'; $edit->cliprotipo->pointer = true; $edit->cliprotipo->insertValue = 1; //Campos para el detalle $edit->codigo = new inputField('Código <#o#>', 'codigo_<#i#>'); $edit->codigo->size = 12; $edit->codigo->db_name = 'codigo'; //$edit->codigo->readonly = true; $edit->codigo->onkeyup = 'OnEnter(event,<#i#>)'; $edit->codigo->autocomplete = false; $edit->codigo->rel_id = 'itpsinv'; $edit->codigo->rule = 'required'; $edit->codigo->append($btn); $edit->desca = new inputField('Descripción <#o#>', 'desca_<#i#>'); $edit->desca->size = 34; $edit->desca->db_name = 'desca'; $edit->desca->maxlength = 50; $edit->desca->readonly = true; $edit->desca->rel_id = 'itpsinv'; $edit->cana = new inputField('Cantidad <#o#>', 'cana_<#i#>'); $edit->cana->db_name = 'cana'; $edit->cana->css_class = 'inputnum'; $edit->cana->rel_id = 'itpsinv'; $edit->cana->maxlength = 10; $edit->cana->size = 6; $edit->cana->rule = 'required|positive'; $edit->cana->autocomplete = false; $edit->cana->onkeyup = 'importe(<#i#>)'; $edit->precio = new inputField('Precio <#o#>', 'precio_<#i#>'); $edit->precio->db_name = 'precio'; $edit->precio->css_class = 'inputnum'; $edit->precio->rel_id = 'itpsinv'; $edit->precio->size = 10; if ($opttipo == 'scli') { $edit->precio->rule = 'required|positive|callback_chpreca[<#i#>]'; } else { $edit->precio->rule = 'required|positive'; } $edit->precio->readonly = true; $edit->importe = new inputField('Importe <#o#>', 'importe_<#i#>'); $edit->importe->db_name = 'importe'; $edit->importe->size = 10; $edit->importe->css_class = 'inputnum'; $edit->importe->rel_id = 'itpsinv'; for ($i = 1; $i <= 4; $i++) { $obj = 'precio' . $i; $edit->{$obj} = new hiddenField('Precio <#o#>', $obj . '_<#i#>'); $edit->{$obj}->db_name = 'sinv' . $obj; $edit->{$obj}->rel_id = 'itpsinv'; $edit->{$obj}->pointer = true; } $edit->itiva = new hiddenField('', 'itiva_<#i#>'); $edit->itiva->db_name = 'iva'; $edit->itiva->rel_id = 'itpsinv'; $edit->sinvpeso = new hiddenField('', 'sinvpeso_<#i#>'); $edit->sinvpeso->db_name = 'sinvpeso'; $edit->sinvpeso->rel_id = 'itpsinv'; $edit->sinvpeso->pointer = true; $edit->sinvtipo = new hiddenField('', 'sinvtipo_<#i#>'); $edit->sinvtipo->db_name = 'sinvtipo'; $edit->sinvtipo->rel_id = 'itpsinv'; $edit->sinvtipo->pointer = true; //fin de campos para detalle $edit->impuesto = new inputField('Impuesto', 'impuesto'); $edit->impuesto->size = 20; $edit->impuesto->css_class = 'inputnum'; $edit->stotal = new inputField('Sub.Total', 'stotal'); $edit->stotal->size = 20; $edit->stotal->css_class = 'inputnum'; $edit->gtotal = new inputField('Total', 'gtotal'); $edit->gtotal->size = 20; $edit->gtotal->css_class = 'inputnum'; $edit->usuario = new autoUpdateField('usuario', $this->session->userdata('usuario'), $this->session->userdata('usuario')); $edit->agente = new autoUpdateField('agente', $opttipo, $opttipo); $edit->buttons('save', 'undo', 'delete', 'back', 'add_rel'); $edit->build(); $inven = array(); if ($opttipo == 'scli') { $titulo = 'Dar a cliente inventario a consignación'; $query = $this->db->query('SELECT TRIM(codigo) AS codigo ,TRIM(descrip) AS descrip,tipo,base1,base2,base3,base4,iva,peso,precio1,pond FROM sinv WHERE activo=\'S\''); $edit->tipo = new autoUpdateField('tipo', 'C', 'C'); } else { $titulo = 'Recibir inventario a consignación de proveedor'; $query = $this->db->query('SELECT TRIM(codigo) AS codigo ,TRIM(descrip) AS descrip,tipo,ultimo AS base1,ultimo AS base2,ultimo AS base3,ultimo AS base4,iva,peso,precio1,pond FROM sinv WHERE activo=\'S\''); $edit->tipo = new autoUpdateField('tipo', 'R', 'R'); } 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); } } $jinven = json_encode($inven); $conten['inven'] = $jinven; $conten['form'] =& $edit; $data['content'] = $this->load->view('view_psinv', $conten, true); $data['title'] = heading($titulo); $data['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->rapyd->get_head() . phpscript('nformat.js') . script('plugins/jquery.numeric.pack.js') . script('plugins/jquery.floatnumber.js') . phpscript('nformat.js'); $this->load->view('view_ventanas', $data); }
function dataedit() { $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'), 'retornar' => array('proveed' => 'cod_prov', 'nombre' => 'nombre', 'reteiva' => 'reteiva_prov'), 'titulo' => 'Buscar Beneficiario'); $bSPRV2 = $this->datasis->p_modbus($mSPRV, "sprv"); $mOBRA = array('tabla' => 'obra', 'columnas' => array('numero' => 'Numero', 'contrato' => 'Contrato', 'codigoadm' => 'Est. Admin', 'fondo' => 'Fondo', 'codigopres' => 'Partida', 'ordinal' => 'Ordinal'), 'filtro' => array('numero' => 'Numero', 'contrato' => 'Contrato', 'codigoadm' => 'Est. Admin', 'fondo' => 'Fondo', 'codigopres' => 'Partida', 'ordinal' => 'Ordinal'), 'retornar' => array('numero' => 'obr', 'cod_prov' => 'cod_prov', 'reteiva_prov' => 'reteiva_prov', 'porcent' => 'porcent', 'monto' => 'monto'), 'script' => array('cal_amortiza()'), 'titulo' => 'Buscar Beneficiario'); $bOBRA = $this->datasis->p_modbus($mOBRA, "obra"); $rr = $this->ivaplica2(); $pimpm = $this->datasis->traevalor('IMPMUNICIPAL'); $pimpt = $this->datasis->traevalor('IMPTIMBRE'); $pcrs = $this->datasis->traevalor('CRS'); $site_url = site_url('presupuesto/pobra/islr'); $script = ' function cal_amortiza(){ monto = $("#monto" ).val(); iva = $("#iva" ).val(); porcent = $("#porcent" ).val(); total2=parseFloat($("#total2" ).val()); //alert(porcent); if($("#camortiza").attr("checked")){ a = total2 *parseFloat(porcent)/100; $("#amortiza" ).val(a); }else{ $("#amortiza").val("0"); } } function cal_rprov(codigo){ $.ajax({ type: "POST", url: "' . site_url("presupuesto/sprv/rprov") . '", data:"cod_prov="+codigo, success: function(data){ $("#reteiva_prov").val(data); } }); } $(".inputnum").numeric("."); $(function() { function cal(){ if($("#civag").attr("checked")){ $("#ivag").val(Math.round( ($("#subtotal").val() * ' . $rr['tasa'] . '/100)*100)/100 ); }else $("#ivag").val("0"); if($("#civar").attr("checked")) $("#ivar").val(Math.round( ($("#subtotal").val() * ' . $rr['redutasa'] . '/100)*100)/100 ); else $("#ivar").val("0"); if($("#civaa").attr("checked")) $("#ivaa").val(Math.round( ($("#subtotal").val() * ' . $rr['sobretasa'] . '/100)*100)/100 ); else $("#ivaa").val("0"); if($("#cimpt").attr("checked")) $("#imptimbre").val(Math.round( ($("#subtotal").val() * ' . $pimpt . ' / 100)*100)/100 ); else $("#imptimbre").val("0"); if($("#cimpm").attr("checked")){ $("#impmunicipal").val(Math.round( ($("#subtotal").val() * ' . $pimpm . ' / 100)*100)/100 ); }else{ $("#impmunicipal").val("0"); } if($("#ccrs").attr("checked")) $("#crs").val(Math.round( ($("#monto").val() * ' . $pcrs . ' / 100)*100)/100 ); else $("#crs").val("0"); $.post("' . $site_url . '",{ creten:$("#creten").val(),subtotal:$("#subtotal").val() },function(data){ $("#reten").val(data); }) otrasrete = parseFloat($("#otrasrete").val()); subtotal = parseFloat($("#subtotal").val()); ivag = 1 * $("#ivag" ).val(); ivar = 1 * $("#ivar" ).val(); ivaa = 1 * $("#ivaa" ).val(); iva = parseFloat(ivaa) + parseFloat(ivag) + parseFloat(ivar); reteiva = iva * parseFloat($("#reteiva_prov" ).val()) / 100; total2 = subtotal + iva ; total = total2 - parseFloat($("#reteiva" ).val())-parseFloat($("#reten" ).val())-parseFloat($("#impmunicipal" ).val())-parseFloat($("#imptimbre" ).val())-parseFloat($("#crs" ).val()); $("#reteiva" ).val(Math.round(reteiva*100)/100); $("#total2" ).val(Math.round(total2*100)/100); $("#total" ).val(Math.round(total*100)/100); $("#iva" ).val(Math.round(iva*100)/100); monto = $("#monto" ).val(); porcent = $("#porcent" ).val(); total2=$("#total2" ).val(); if($("#camortiza").attr("checked")){ a = (parseFloat(total2)) *parseFloat(porcent)/100; $("#amortiza" ).val(a); }else{ $("#amortiza").val("0"); } } $("#subtotal").change(function(){ cal(); }); $("#exento").change(function(){ cal(); }); $("#civag").change(function(){ cal(); }); $("#civar").change(function(){ cal(); }); $("#civaa").change(function(){ cal(); }); $("#cimpt").change(function(){ cal(); }); $("#cimpm").change(function(){ cal(); }); $("#ccrs").change(function(){ cal(); }); $("#creten").change(function(){ cal(); }); $("#camortiza").change(function(){ cal(); }); $("#otrasrete").change(function(){ cal(); }); }); $(document).ready(function() { $("#tr_porcent").hide(); $("#tr_monto").hide(); }); '; $do = new DataObject("odirect"); $do->pointer('sprv', 'sprv.proveed=odirect.cod_prov', 'sprv.nombre as nombre', 'LEFT'); $edit = new DataDetails($this->t**s, $do); $edit->back_url = site_url($this->url . "/index"); $edit->set_rel_title('itodirect', 'Rubro <#o#>'); $edit->script($script, "create"); $edit->script($script, "modify"); $edit->pre_process('update', '_valida'); $edit->pre_process('insert', '_valida'); //$edit->post_process('insert' ,'_post'); //$edit->post_process('update' ,'_post'); $edit->numero = new inputField("Número", "numero"); $edit->numero->mode = "autohide"; $edit->numero->when = array('show'); $edit->obr = new inputField("Obra", "obr"); $edit->obr->size = 5; $edit->obr->append($bOBRA); $edit->obr->readonly = true; //$edit->obr->when=array('show'); $edit->cod_prov = new inputField("Beneficiario", 'cod_prov'); $edit->cod_prov->size = 4; $edit->cod_prov->rule = "required"; $edit->cod_prov->append($bSPRV2); $edit->porcent = new inputField("Porcentaje", "porcent"); $edit->porcent->size = 5; $edit->porcent->when = array('modify'); $edit->monto = new inputField("monto", "monto"); $edit->monto->db_name = " "; $edit->monto->size = 5; $edit->monto->when = array('modify'); $edit->monto->value = 0; $edit->fecha = new dateonlyField("Fecha", "fecha"); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->size = 12; $edit->observa = new textAreaField("Observaciones", 'observa'); $edit->observa->cols = 60; $edit->observa->rows = 3; $edit->factura = new inputField("Factura", "factura"); $edit->factura->size = 15; //$edit->factura->rule="required"; $edit->factura->group = "Datos Factura"; $edit->controlfac = new inputField("Control Fiscal", "controlfac"); $edit->controlfac->size = 15; //$edit->controlfac->rule="required"; $edit->controlfac->group = "Datos Factura"; $edit->fechafac = new dateonlyField("Fecha de Factura", "fechafac"); $edit->fechafac->insertValue = date('Y-m-d'); $edit->fechafac->size = 12; $edit->fechafac->rule = "required"; $edit->fechafac->group = "Datos Factura"; $edit->subtotal = new inputField("Sub Total", 'subtotal'); $edit->subtotal->css_class = 'inputnum'; $edit->subtotal->size = 8; $edit->subtotal->group = "Datos Factura"; $edit->subtotal->rule = "required"; $edit->subtotal->value = 0; $edit->exento = new inputField("Exento", 'exento'); $edit->exento->css_class = 'inputnum'; $edit->exento->size = 8; $edit->exento->group = "Datos Factura"; $edit->exento->value = 0; $edit->iva = new inputField("IVA", 'iva'); $edit->iva->css_class = 'inputnum'; $edit->iva->size = 8; $edit->iva->group = "Datos Factura"; $edit->iva->readonly = true; $edit->iva->value = 0; $edit->ivag2 = new freeField("Free Field", "free", "General"); $edit->ivag2->in = "iva"; $edit->ivag = new inputField("IVA General", 'ivag'); $edit->ivag->css_class = 'inputnum'; $edit->ivag->size = 8; $edit->ivag->in = "iva"; $edit->ivag->readonly = true; $edit->ivag->value = 0; $edit->civag = new checkboxField("I.Municipal", "civag", "."); $edit->civag->db_name = " "; $edit->civag->value = $edit->get_from_dataobjetct('ivag') != 0 ? "." : ""; $edit->civag->in = "iva"; $edit->ivar2 = new freeField("Free Field", "free", "Reducido"); $edit->ivar2->in = "iva"; $edit->ivar = new inputField("IVA Reducido", 'ivar'); $edit->ivar->css_class = 'inputnum'; $edit->ivar->size = 8; $edit->ivar->in = "iva"; $edit->ivar->readonly = true; $edit->ivar->value = 0; $edit->civar = new checkboxField("I.Municipal", "civar", "."); $edit->civar->db_name = " "; $edit->civar->value = $edit->get_from_dataobjetct('ivar') != 0 ? "." : ""; $edit->civar->in = "iva"; $edit->ivaa2 = new freeField("Free Field", "free", "Adicional"); $edit->ivaa2->in = "iva"; $edit->ivaa = new inputField("IVA Adicional", 'ivaa'); $edit->ivaa->css_class = 'inputnum'; $edit->ivaa->size = 8; $edit->ivaa->in = "iva"; $edit->ivaa->readonly = true; $edit->ivaa->value = 0; $edit->civaa = new checkboxField("I.Municipal", "civaa", "."); $edit->civaa->db_name = " "; $edit->civaa->value = $edit->get_from_dataobjetct('ivaa') != 0 ? "." : ""; $edit->civaa->in = "iva"; $edit->total2 = new inputField("Total", 'total2'); $edit->total2->css_class = 'inputnum'; $edit->total2->size = 8; $edit->total2->group = "Datos Factura"; $edit->total2->readonly = true; $edit->total2->value = 0; $edit->reteiva = new inputField("Retencion IVA", 'reteiva'); $edit->reteiva->css_class = 'inputnum'; $edit->reteiva->size = 8; $edit->reteiva->group = "Descuentos"; $edit->reteiva->readonly = true; $edit->reteiva->value = 0; $edit->reteiva_prov2 = new freeField("Free Field", "free", "% Retencion"); $edit->reteiva_prov2->in = "reteiva"; $edit->reteiva_prov = new inputField("Porcentaje de IVA", "reteiva_prov"); $edit->reteiva_prov->size = 5; $edit->reteiva_prov->in = "reteiva"; $edit->reteiva_prov->readonly = true; $edit->reteiva_prov->value = 100; $edit->reten = new inputField("Retención ISLR", 'reten'); $edit->reten->css_class = 'inputnum'; $edit->reten->size = 8; $edit->reten->group = "Descuentos"; $edit->reten->readonly = true; $edit->reten->value = 0; $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:500px;"; $edit->creten->in = "reten"; $edit->imptimbre = new inputField("Impuesto 1X1000", 'imptimbre'); $edit->imptimbre->size = 8; $edit->imptimbre->css_class = 'inputnum'; $edit->imptimbre->group = "Descuentos"; $edit->imptimbre->value = 0; $edit->cimpt = new checkboxField("I.Municipal", "cimpt", "."); $edit->cimpt->db_name = " "; $edit->cimpt->value = "."; $edit->cimpt->in = "imptimbre"; $edit->cimpt->value = $edit->get_from_dataobjetct('imptimbre') != 0 ? "." : ""; $edit->impmunicipal = new inputField("Impuesto Municipal", 'impmunicipal'); $edit->impmunicipal->size = 8; $edit->impmunicipal->css_class = 'inputnum'; $edit->impmunicipal->group = "Descuentos"; $edit->impmunicipal->readonly = true; $edit->impmunicipal->value = 0; $edit->cimpm = new checkboxField("I.Municipal", "cimpm", "."); $edit->cimpm->db_name = " "; $edit->cimpm->value = "."; $edit->cimpm->in = "impmunicipal"; $edit->cimpm->value = $edit->get_from_dataobjetct('impmunicipal') != 0 ? "." : ""; $edit->crs = new inputField("Compromiso de Responsabilidad Social", 'crs'); $edit->crs->size = 8; $edit->crs->css_class = 'inputnum'; $edit->crs->group = "Descuentos"; //$edit->crs->readonly = true; $edit->crs->value = 0; $edit->ccrs = new checkboxField("I.Municipal", "ccrs", "."); $edit->ccrs->db_name = " "; $edit->ccrs->value = ""; $edit->ccrs->in = "crs"; $edit->ccrs->value = $edit->get_from_dataobjetct('crs') != 0 ? "." : ""; $edit->amortiza = new inputField("Amortizacion", "amortiza"); $edit->amortiza->size = 8; $edit->amortiza->group = "Descuentos"; // $edit->amortiza->readonly = true; $edit->amortiza->value = 0; $edit->otrasrete = new inputField("Otras Deducciones", 'otrasrete'); $edit->otrasrete->css_class = 'inputnum'; $edit->otrasrete->size = 8; $edit->otrasrete->insertValue = 0; $edit->otrasrete->group = "Descuentos"; $edit->otrasrete->value = 0; //$edit->otrasrete->onchange ='cal_total();'; $edit->camortiza = new checkboxField("", "camortiza", "."); $edit->camortiza->db_name = " "; $edit->camortiza->value = ""; $edit->camortiza->in = "amortiza"; $edit->camortiza->value = $edit->get_from_dataobjetct('crs') != 0 ? "." : ""; $edit->total = new inputField("Monto a Pagar", 'total'); $edit->total->size = 8; $edit->total->css_class = 'inputnum'; $edit->total->readonly = true; $edit->total->value = 0; $status = $edit->get_from_dataobjetct('status'); if ($status == 'O1') { $action = "javascript:window.location='" . site_url('presupuesto/common/po_anular/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_anular", 'Anular', $action, "TR", "show"); $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"); if ($this->datasis->puede(386)) { $edit->buttons("delete"); } } elseif ($status == 'O2') { $action = "javascript:window.location='" . site_url('presupuesto/common/po_anular/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_anular", 'Anular', $action, "TR", "show"); //$action = "javascript:window.location='" .site_url($this->url.'reversar/'.$edit->rapyd->uri->get_edited_id()). "'"; //$edit->button_status("btn_rever",'Reversar',$action,"TR","show"); //if($this->datasis->puede('1015')) } else { $edit->buttons("save"); } $edit->buttons("undo", "back"); $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']; $conten['imptimbre'] = $this->datasis->traevalor('IMPTIMBRE'); $conten['impmunicipal'] = $this->datasis->traevalor('IMPMUNICIPAL'); $smenu['link'] = barra_menu('172'); $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"); $this->load->view('view_ventanas', $data); }
function dataedit($status = '', $numero = '') { //$this->datasis->modulo_id(116,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'), 'retornar' => array('proveed' => 'cod_prov', 'nombre' => 'nombrep', 'reteiva' => 'reteiva_prov'), 'script' => array('cal_total()'), 'titulo' => 'Buscar Beneficiario'); $bSPRV2 = $this->datasis->modbus($mSPRV, "sprv"); $do = new DataObject("odirect"); $do->pointer('sprv', 'sprv.proveed = odirect.cod_prov', 'sprv.nombre as nombrep, sprv.rif rifp', 'LEFT'); $do->rel_one_to_many('itodirect', 'itodirect', array('numero' => 'numero')); $do->rel_pointer('itodirect', 'v_presaldo', 'itodirect.codigoadm=v_presaldo.codigoadm AND itodirect.fondo=v_presaldo.fondo AND itodirect.partida=v_presaldo.codigo ', "v_presaldo.denominacion as pdenominacion"); if ($status == "create" && !empty($numero)) { $do->load($numero); $do->set('status', 'C1'); $do->unset_pk(); } $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->pre_process('delete', '_pre_delete'); $edit->post_process('insert', '_post'); $edit->post_process('update', '_post'); $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->rule = 'unique'; if ($this->datasis->traevalor('USANODIRECT') == 'S') { $edit->numero->when = array('show'); } else { $edit->numero->when = array('show', 'create', 'modify'); } $edit->tipo = new hiddenField("Orden de ", "tipo"); $edit->tipo->value = "Contrato"; $edit->fecha = new dateonlyField("Fecha", "fecha"); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->size = 12; $lsnc = '<a href="javascript:consulsprv();" title="Proveedor" onclick="">Consulta/Agrega BENEFICIARIO</a>'; $edit->cod_prov = new inputField("Beneficiario", 'cod_prov'); $edit->cod_prov->db_name = "cod_prov"; $edit->cod_prov->size = 4; $edit->cod_prov->append($bSPRV2); $edit->cod_prov->append($lsnc); $edit->cod_prov->rule = "required"; $edit->nombrep = new inputField("Nombre", 'nombrep'); $edit->nombrep->size = 30; //$edit->nombrep->readonly = true; $edit->nombrep->pointer = true; $edit->rifp = new inputField("RIF", "rifp"); $edit->rifp->size = 10; $edit->rifp->pointer = true; $edit->rifp->db_name = 'rifp'; //if($status=='P') //$edit->rif->readonly = true; $edit->reteiva_prov = new inputField("% R.IVA", "reteiva_prov"); $edit->reteiva_prov->size = 2; $edit->reteiva_prov->readonly = true; $edit->reteiva_prov->when = array('modify', 'create'); $edit->reteiva_prov->onchange = 'cal_total();'; $edit->observa = new textAreaField("Concepto", 'observa'); $edit->observa->cols = 70; $edit->observa->rows = 3; $edit->tipoc = new dropdownField("Tipo de Pago", "tipoc"); $edit->tipoc->option("OT", "Otro"); $edit->tipoc->option("FA", "Fondo en anticipo"); $edit->factura = new inputField("Factura", "factura"); $edit->factura->size = 15; //$edit->factura->rule ="callback_chexiste_factura"; //$edit->factura->rule="required"; $edit->controlfac = new inputField("Control Fiscal", "controlfac"); $edit->controlfac->size = 15; //$edit->controlfac->rule="required"; $edit->fechafac = new dateonlyField("Fecha de Factura", "fechafac"); $edit->fechafac->insertValue = date('Y-m-d'); $edit->fechafac->size = 12; //$edit->fechafac->rule="required"; $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->imptimbre->onchange = 'cal_total();'; $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->total = new inputField("Monto a Pagar", 'total'); $edit->total->size = 8; $edit->total->css_class = 'inputnum'; $edit->impmunicipal = new inputField("Impuesto Municipal", 'impmunicipal'); $edit->impmunicipal->size = 8; $edit->impmunicipal->css_class = 'inputnum'; $edit->impmunicipal->onchange = 'cal_total();'; $edit->subtotal = new inputField("Total Base Imponible", 'subtotal'); $edit->subtotal->css_class = 'inputnum'; $edit->subtotal->size = 8; //$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->ivaa->onchange = 'cal_total();'; $edit->ivag = new inputField("IVA General", 'ivag'); $edit->ivag->css_class = 'inputnum'; $edit->ivag->size = 8; $edit->ivag->onchange = 'cal_total();'; $edit->ivar = new inputField("IVA Reducido", 'ivar'); $edit->ivar->css_class = 'inputnum'; $edit->ivar->size = 8; $edit->ivar->onchange = 'cal_total();'; $edit->exento = new inputField("Exento", 'exento'); $edit->exento->css_class = 'inputnum'; $edit->exento->size = 8; $edit->exento->onchange = 'cal_total();'; $edit->reteiva = new inputField("Retencion IVA", 'reteiva'); $edit->reteiva->css_class = 'inputnum'; $edit->reteiva->size = 8; $edit->reteiva->onchange = 'cal_total();'; $edit->creten = new dropdownField("Codigo ISLR", "creten"); $edit->creten->options("SELECT codigo,CONCAT_WS(' ',codigo,activida) FROM rete ORDER BY codigo"); $edit->creten->style = "width:300px;"; $edit->creten->onchange = 'cal_total();'; $edit->reten = new inputField("Retención ISLR", 'reten'); $edit->reten->css_class = 'inputnum'; $edit->reten->size = 8; $edit->reten->onchange = 'cal_total();'; $edit->otrasrete = new inputField("Otras Deducciones", 'otrasrete'); $edit->otrasrete->css_class = 'inputnum'; $edit->otrasrete->size = 8; $edit->otrasrete->insertValue = 0; $edit->otrasrete->onchange = 'cal_total();'; $edit->total2 = new inputField("Total", 'total2'); $edit->total2->css_class = 'inputnum'; $edit->total2->size = 8; $edit->multiple = new dropDownField("Factura Multiple", 'multiple'); $edit->multiple->option('N', 'NO'); $edit->itocompra = new inputField("(<#o#>) Descripción", "ocompra_<#i#>"); $edit->itocompra->db_name = 'ocompra'; $edit->itocompra->size = 15; $edit->itocompra->rel_id = 'itodirect'; //$edit->itocompra->readonly =true; $edit->itocompra->type = 'inputhidden'; $edit->itcodigoadm = new inputField("Estructura\tAdministrativa", "itcodigoadm_<#i#>"); $edit->itcodigoadm->type = 'inputhidden'; $edit->itcodigoadm->db_name = 'codigoadm'; $edit->itcodigoadm->rel_id = 'itodirect'; $edit->itcodigoadm->rule = 'required'; $edit->itcodigoadm->autocomplete = false; $edit->itpartida = new inputField("(<#o#>) Partida", "partida_<#i#>"); //$edit->itpartida->rule='|required'; $edit->itpartida->type = 'inputhidden'; $edit->itpartida->db_name = 'partida'; $edit->itpartida->rel_id = 'itodirect'; $edit->itpartida->autocomplete = false; //$edit->itpartida->readonly =true; $edit->itdenominacion = new inputField("(<#o#>) Descripción", "denominacion_<#i#>"); $edit->itdenominacion->db_name = 'pdenominacion'; $edit->itdenominacion->type = 'inputhidden'; $edit->itdenominacion->rel_id = 'itodirect'; $edit->itdenominacion->pointer = true; $edit->itdenominacion->readonly = true; $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->status = new dropdownField("Estado", "status"); $edit->status->option("C", "Por Elaborar"); $edit->status->option("C2", "Causado"); $edit->status->option("C1", "Por Causar"); $edit->status->option("C3", "Pagado"); $edit->status->option("CA", "Anulada"); $edit->status->style = "width:150px"; $edit->status->mode = 'autohide'; $status = $edit->get_from_dataobjetct('status'); if ($status == 'C1') { $action = "javascript:window.location='" . site_url($this->url . 'actualizar/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_status", 'Causar', $action, "TR", "show"); $action = "javascript:btn_anulaf('" . $edit->rapyd->uri->get_edited_id() . "')"; if ($this->datasis->puede(156)) { $edit->button_status("btn_anular", 'Anular', $action, "TR", "show"); } $edit->buttons("modify", "save", "delete"); } elseif ($status == 'C2') { $action = "javascript:window.location='" . site_url('presupuesto/opago/modconc/odirect/modify/' . $edit->rapyd->uri->get_edited_id()) . "'"; $edit->button_status("btn_moconc", 'Modificar Concepto', $action, "TR", "show"); //$action = "javascript:window.location='" .site_url($this->url.'reversar/'.$edit->rapyd->uri->get_edited_id()). "'"; //$edit->button_status("btn_rever",'Reversar',$action,"TR","show"); $action = "javascript:btn_anulaf('" . $edit->rapyd->uri->get_edited_id() . "')"; if ($this->datasis->puede(156)) { $edit->button_status("btn_anular", 'Anular', $action, "TR", "show"); } } elseif ($status == 'C3') { $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"); } } elseif ($status == "C") { $edit->buttons("modify", "save", "delete"); } elseif ($status == "CA") { $edit->buttons("delete"); } 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']; $conten['imptimbre'] = $this->datasis->traevalor('IMPTIMBRE'); $conten['impmunicipal'] = $this->datasis->traevalor('IMPMUNICIPAL'); $smenu['link'] = barra_menu('129'); $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true); $conten["form"] =& $edit; $data['content'] = $this->load->view('view_opagoc', $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(); $this->load->view('view_ventanas', $data); }
function dataedit() { $this->rapyd->load('dataobject', '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' => 'descrip'), 'retornar' => array('codigo' => 'codigo_<#i#>', 'descrip' => 'desca_<#i#>', 'base1' => 'precio1_<#i#>', 'base2' => 'precio2_<#i#>', 'base3' => 'precio3_<#i#>', 'base4' => 'precio4_<#i#>', 'iva' => 'itiva_<#i#>', 'peso' => 'sinvpeso_<#i#>', 'tipo' => 'sinvtipo_<#i#>'), 'p_uri' => array(4 => '<#i#>'), 'where' => '`activo` = "S" AND `tipo` = "Articulo"', 'script' => array('post_modbus_sinv(<#i#>)'), 'titulo' => 'Buscar Articulo'); $btn = $this->datasis->p_modbus($modbus, '<#i#>'); $mSCLId = array('tabla' => 'scli', 'columnas' => array('cliente' => 'Código Cliente', 'nombre' => 'Nombre', 'cirepre' => 'Rif/Cedula', 'dire11' => 'Dirección', 'tipo' => 'Tipo'), 'filtro' => array('cliente' => 'Código Cliente', 'nombre' => 'Nombre'), 'retornar' => array('cliente' => 'cod_cli', 'nombre' => 'nombre', 'dire11' => 'dir_cli', 'tipo' => 'sclitipo'), 'titulo' => 'Buscar Cliente', 'script' => array('post_modbus_scli()')); $btnc = $this->datasis->modbus($mSCLId); $do = new DataObject('snte'); $do->rel_one_to_many('itsnte', 'itsnte', 'numero'); $do->pointer('scli', 'scli.cliente=snte.cod_cli', 'scli.tipo AS sclitipo', 'left'); $do->rel_pointer('itsnte', 'sinv', 'itsnte.codigo=sinv.codigo', 'sinv.descrip AS sinvdescrip, sinv.base1 AS sinvprecio1, sinv.base2 AS sinvprecio2, sinv.base3 AS sinvprecio3, sinv.base4 AS sinvprecio4, sinv.iva AS sinviva, sinv.peso AS sinvpeso,sinv.tipo AS sinvtipo'); $edit = new DataDetails('Nota de entrega', $do); $edit->on_save_redirect = false; $edit->set_rel_title('itsnte', 'Producto <#o#>'); $edit->pre_process('insert', '_pre_insert'); $edit->pre_process('update', '_pre_update'); $edit->pre_process('delete', '_pre_delete'); $edit->post_process('insert', '_post_insert'); $edit->post_process('update', '_post_update'); $edit->post_process('delete', '_post_delete'); $edit->fecha = new DateonlyField('Fecha', 'fecha', 'd/m/Y'); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->rule = 'required'; $edit->fecha->mode = 'autohide'; $edit->fecha->calendar = false; $edit->fecha->size = 10; $edit->vende = new dropdownField('Vendedor', 'vende'); $edit->vende->options('SELECT vendedor, CONCAT(vendedor,\' \',nombre) nombre FROM vend ORDER BY vendedor'); $edit->vende->style = 'width:200px;'; $edit->vende->size = 5; $edit->numero = new inputField('Número', 'numero'); $edit->numero->size = 10; $edit->numero->mode = 'autohide'; $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->peso = new inputField('Peso', 'peso'); $edit->peso->css_class = 'inputnum'; $edit->peso->readonly = true; $edit->peso->type = 'inputhidden'; $edit->peso->size = 10; $edit->cliente = new inputField('Cliente', 'cod_cli'); $edit->cliente->size = 6; //$edit->cliente->maxlength=5; $edit->cliente->rule = 'required'; $edit->cliente->append($btnc); $edit->nombre = new inputField('Nombre', 'nombre'); $edit->nombre->size = 25; $edit->nombre->type = 'inputhidden'; $edit->nombre->maxlength = 40; $edit->nombre->autocomplete = false; $edit->factura = new inputField('Factura', 'factura'); $edit->factura->size = 10; $edit->factura->when = array('show'); $edit->almacen = new dropdownField('Almacén', 'almacen'); $edit->almacen->options('SELECT ubica, CONCAT(ubica,\' \',ubides) nombre FROM caub ORDER BY ubica'); $edit->almacen->rule = 'required'; $edit->almacen->style = 'width:200px;'; $edit->almacen->size = 5; $alma = $this->secu->getalmacen(); if (empty($alma)) { $alma = $this->datasis->traevalor('ALMACEN'); } $edit->almacen->insertValue = $alma; $edit->orden = new inputField('Orden', 'orden'); $edit->orden->size = 10; $edit->observa = new inputField('Observación', 'observa'); $edit->observa->size = 37; $edit->dir_cli = new inputField('Dirección', 'dir_cli'); $edit->dir_cli->type = 'inputhidden'; $edit->dir_cli->size = 37; //$edit->dir_cl1 = new inputField(' ','dir_cl1'); //$edit->dir_cl1->size = 55; //Para saber que precio se le va a dar al cliente $edit->sclitipo = new hiddenField('', 'sclitipo'); $edit->sclitipo->db_name = 'sclitipo'; $edit->sclitipo->pointer = true; $edit->sclitipo->insertValue = 1; //Campos para el detalle $edit->codigo = new inputField('Código <#o#>', 'codigo_<#i#>'); $edit->codigo->size = 8; $edit->codigo->db_name = 'codigo'; $edit->codigo->rel_id = 'itsnte'; $edit->codigo->rule = 'required'; $edit->codigo->append($btn); $edit->codigo->style = 'width:80%'; $edit->desca = new inputField('Descripción <#o#>', 'desca_<#i#>'); $edit->desca->size = 36; $edit->desca->db_name = 'desca'; $edit->desca->maxlength = 40; $edit->desca->readonly = true; $edit->desca->rel_id = 'itsnte'; $edit->desca->style = 'width:98%'; $edit->cana = new inputField('Cantidad <#o#>', 'cana_<#i#>'); $edit->cana->db_name = 'cana'; $edit->cana->css_class = 'inputnum'; $edit->cana->rel_id = 'itsnte'; $edit->cana->maxlength = 10; $edit->cana->size = 6; $edit->cana->rule = 'required|positive|callback_chcananeg[<#i#>]'; $edit->cana->autocomplete = false; $edit->cana->onkeyup = 'importe(<#i#>)'; $edit->cana->style = 'width:98%'; $edit->precio = new inputField('Precio <#o#>', 'precio_<#i#>'); $edit->precio->db_name = 'precio'; $edit->precio->css_class = 'inputnum'; $edit->precio->rel_id = 'itsnte'; $edit->precio->size = 10; $edit->precio->rule = 'required|positive|callback_chpreca[<#i#>]'; $edit->precio->readonly = true; $edit->precio->style = 'width:98%'; $edit->importe = new inputField('Importe <#o#>', 'importe_<#i#>'); $edit->importe->db_name = 'importe'; $edit->importe->size = 10; $edit->importe->css_class = 'inputnum'; $edit->importe->rel_id = 'itsnte'; $edit->importe->style = 'width:98%'; $edit->importe->type = 'inputhidden'; for ($i = 1; $i <= 4; $i++) { $obj = 'precio' . $i; $edit->{$obj} = new hiddenField('Precio <#o#>', $obj . '_<#i#>'); $edit->{$obj}->db_name = 'sinv' . $obj; $edit->{$obj}->rel_id = 'itsnte'; $edit->{$obj}->pointer = true; } $edit->itiva = new hiddenField('', 'itiva_<#i#>'); $edit->itiva->db_name = 'iva'; $edit->itiva->rel_id = 'itsnte'; $edit->sinvpeso = new hiddenField('', 'sinvpeso_<#i#>'); $edit->sinvpeso->db_name = 'sinvpeso'; $edit->sinvpeso->rel_id = 'itsnte'; $edit->sinvpeso->pointer = true; $edit->sinvtipo = new hiddenField('', 'sinvtipo_<#i#>'); $edit->sinvtipo->db_name = 'sinvtipo'; $edit->sinvtipo->rel_id = 'itsnte'; $edit->sinvtipo->pointer = true; //fin de campos para detalle $edit->impuesto = new hiddenField('Impuesto', 'impuesto'); $edit->impuesto->size = 20; $edit->impuesto->css_class = 'inputnum'; $edit->stotal = new hiddenField('Sub.Total', 'stotal'); $edit->stotal->size = 20; $edit->stotal->css_class = 'inputnum'; $edit->gtotal = new hiddenField('Total', 'gtotal'); $edit->gtotal->size = 20; $edit->gtotal->css_class = 'inputnum'; $edit->usuario = new autoUpdateField('usuario', $this->session->userdata('usuario'), $this->session->userdata('usuario')); //$edit->buttons('add_rel'); $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; $this->load->view('view_snte', $conten); } }
function dataedit() { $this->rapyd->load('dataobject', 'datadetails'); $do = new DataObject('sfac'); $do->rel_one_to_many('sitems', 'sitems', array('id' => 'id_sfac')); //$do->rel_one_to_many('sfpa' , 'sfpa' , array('numero','transac')); $do->pointer('scli', 'scli.cliente=sfac.cod_cli', 'scli.tipo AS sclitipo', 'left'); $do->pointer('sprv', 'sprv.proveed=sfac.sprv', 'sprv.nombre AS sprvnombre, sprv.rif AS sprvrif, sprv.direc1 AS sprvdirec', 'left'); $do->rel_pointer('sitems', 'sinv', 'sitems.codigoa=sinv.codigo', 'sinv.descrip AS sinvdescrip, sinv.base1 AS sinvprecio1, sinv.base2 AS sinvprecio2, sinv.base3 AS sinvprecio3, sinv.base4 AS sinvprecio4, sinv.iva AS sinviva, sinv.peso AS sinvpeso,sinv.tipo AS sinvtipo'); $edit = new DataDetails('Facturas', $do); //$edit->back_url = site_url('ventas/sfacter/filteredgrid'); $edit->set_rel_title('sitems', 'Producto <#o#>'); $edit->pre_process('insert', '_pre_insert'); $edit->pre_process('update', '_pre_update'); $edit->post_process('insert', '_post_insert'); $edit->post_process('update', '_post_update'); $edit->post_process('delete', '_post_delete'); $edit->sclitipo = new hiddenField('', 'sclitipo'); $edit->sclitipo->db_name = 'sclitipo'; $edit->sclitipo->pointer = true; $edit->sclitipo->insertValue = 1; $edit->sprv = new inputField('Código', 'sprv'); $edit->sprv->size = 6; $edit->sprv->maxlength = 5; $edit->sprv->rule = 'existesprv'; //$edit->sprv->append($boton); $edit->sprvnombre = new hiddenField('Nombre', 'sprvnombre'); $edit->sprvnombre->db_name = 'sprvnombre'; $edit->sprvnombre->pointer = true; $edit->sprvnombre->maxlength = 40; $edit->sprvnombre->size = 25; $edit->sprvnombre->readonly = true; $edit->sprvrif = new hiddenField('RIF', 'sprvrif'); $edit->sprvrif->db_name = 'sprvrif'; $edit->sprvrif->pointer = true; $edit->sprvrif->autocomplete = false; $edit->sprvrif->size = 15; $edit->sprvrif->readonly = true; $edit->sprvdirec = new hiddenField('Dirección', 'sprvdirec'); $edit->sprvdirec->db_name = 'sprvdirec'; $edit->sprvdirec->pointer = true; $edit->sprvdirec->size = 40; $edit->sprvdirec->readonly = true; $edit->fecha = new DateonlyField('Fecha', 'fecha', 'd/m/Y'); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->rule = 'required'; $edit->fecha->mode = 'autohide'; $edit->fecha->size = 10; $edit->vence = new DateonlyField('Vencimiento', 'vence', 'd/m/Y'); $edit->vence->insertValue = date('Y-m-d'); $edit->vence->rule = 'required'; $edit->vence->mode = 'autohide'; $edit->vence->size = 10; $edit->tipo_doc = new dropdownField('Documento', 'tipo_doc'); $edit->tipo_doc->option('F', 'Factura'); //$edit->tipo_doc->option('D','Devolución'); $edit->tipo_doc->style = 'width:200px;'; $edit->tipo_doc->size = 5; $edit->tipo_doc->rule = 'required'; $edit->vd = new dropdownField('Vendedor', 'vd'); $edit->vd->options('SELECT vendedor, CONCAT(vendedor,\' \',nombre) nombre FROM vend ORDER BY vendedor'); $edit->vd->style = 'width:200px;'; $edit->vd->insertValue = $this->secu->getvendedor(); $edit->vd->size = 5; $edit->numero = new inputField('Número', 'numero'); $edit->numero->size = 10; $edit->numero->mode = 'autohide'; $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->peso = new inputField('Peso', 'peso'); $edit->peso->css_class = 'inputnum'; $edit->peso->readonly = true; $edit->peso->size = 10; $edit->cliente = new inputField('Cliente', 'cod_cli'); $edit->cliente->size = 6; $edit->cliente->maxlength = 5; $edit->cliente->autocomplete = false; $edit->cliente->rule = 'required|existescli'; //$edit->cliente->append($boton); $edit->nombre = new hiddenField('Nombre', 'nombre'); $edit->nombre->size = 25; $edit->nombre->maxlength = 40; $edit->nombre->readonly = true; $edit->nombre->autocomplete = false; $edit->nombre->rule = 'required'; $edit->rifci = new hiddenField('RIF/CI', 'rifci'); $edit->rifci->autocomplete = false; $edit->rifci->readonly = true; $edit->rifci->size = 15; $edit->direc = new hiddenField('Dirección', 'direc'); $edit->direc->readonly = true; $edit->direc->size = 40; //*********************************** // Campos para el detalle 1 sitems //*********************************** $edit->codigoa = new inputField('Código <#o#>', 'codigoa_<#i#>'); $edit->codigoa->size = 12; $edit->codigoa->db_name = 'codigoa'; $edit->codigoa->rel_id = 'sitems'; $edit->codigoa->rule = 'required'; $edit->desca = new inputField('Descripción <#o#>', 'desca_<#i#>'); $edit->desca->size = 36; $edit->desca->db_name = 'desca'; $edit->desca->maxlength = 50; $edit->desca->readonly = true; $edit->desca->rel_id = 'sitems'; $edit->cana = new inputField('Cantidad <#o#>', 'cana_<#i#>'); $edit->cana->db_name = 'cana'; $edit->cana->css_class = 'inputnum'; $edit->cana->rel_id = 'sitems'; $edit->cana->maxlength = 10; $edit->cana->size = 6; $edit->cana->rule = 'required|positive'; $edit->cana->autocomplete = false; $edit->cana->onkeyup = 'importe(<#i#>)'; $edit->preca = new inputField('Precio <#o#>', 'preca_<#i#>'); $edit->preca->db_name = 'preca'; $edit->preca->css_class = 'inputnum'; $edit->preca->rel_id = 'sitems'; $edit->preca->size = 10; $edit->preca->rule = 'required|positive'; $edit->preca->readonly = true; $edit->detalle = new hiddenField('', 'detalle_<#i#>'); $edit->detalle->db_name = 'detalle'; $edit->detalle->rel_id = 'sitems'; $edit->tota = new inputField('Importe <#o#>', 'tota_<#i#>'); $edit->tota->db_name = 'tota'; $edit->tota->size = 10; $edit->tota->css_class = 'inputnum'; $edit->tota->rel_id = 'sitems'; for ($i = 1; $i < 4; $i++) { $obj = 'precio' . $i; $edit->{$obj} = new hiddenField('Precio <#o#>', $obj . '_<#i#>'); $edit->{$obj}->db_name = 'sinv' . $obj; $edit->{$obj}->rel_id = 'sitems'; $edit->{$obj}->pointer = true; } $edit->precio4 = new hiddenField('', 'precio4_<#i#>'); $edit->precio4->db_name = 'precio4'; $edit->precio4->rel_id = 'sitems'; $edit->itiva = new hiddenField('', 'itiva_<#i#>'); $edit->itiva->db_name = 'iva'; $edit->itiva->rel_id = 'sitems'; $edit->sinvpeso = new hiddenField('', 'sinvpeso_<#i#>'); $edit->sinvpeso->db_name = 'sinvpeso'; $edit->sinvpeso->rel_id = 'sitems'; $edit->sinvpeso->pointer = true; $edit->sinvtipo = new hiddenField('', 'sinvtipo_<#i#>'); $edit->sinvtipo->db_name = 'sinvtipo'; $edit->sinvtipo->rel_id = 'sitems'; $edit->sinvtipo->pointer = true; $edit->ivat = new hiddenField('I.V.A', 'iva'); $edit->ivat->css_class = 'inputnum'; $edit->ivat->readonly = true; $edit->ivat->size = 10; $edit->totals = new hiddenField('Sub-Total', 'totals'); $edit->totals->css_class = 'inputnum'; $edit->totals->readonly = true; $edit->totals->size = 10; $edit->totalg = new hiddenField('Total', 'totalg'); $edit->totalg->css_class = 'inputnum'; $edit->totalg->readonly = true; $edit->totalg->size = 10; $edit->observa = new inputField('Observacion', 'observa'); $edit->nfiscal = new inputField('No.Fiscal', 'nfiscal'); $edit->observ1 = new inputField('Observacion', 'observ1'); $edit->zona = new inputField('Zona', 'zona'); $edit->ciudad = new inputField('Ciudad', 'ciudad'); $edit->exento = new inputField('Exento', 'exento'); $edit->maqfiscal = new inputField('Mq.Fiscal', 'maqfiscal'); $edit->cajero = new inputField('Cajero', 'cajero'); $edit->referen = new inputField('Referencia', 'referen'); $edit->reiva = new inputField('Retencion de IVA', 'reiva'); $edit->creiva = new inputField('Comprobante', 'creiva'); $edit->freiva = new inputField('Fecha', 'freiva'); $edit->ereiva = new inputField('Emision', 'ereiva'); $edit->usuario = new autoUpdateField('usuario', $this->session->userdata('usuario'), $this->session->userdata('usuario')); $edit->estampa = new autoUpdateField('estampa', date('Ymd'), date('Ymd')); $edit->hora = new autoUpdateField('hora', date('H:i:s'), date('H:i:s')); $edit->buttons('add_rel'); $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; $this->load->view('view_sfacter', $conten); } /* //$data['script'] .= $script; //$data['script'] .= $scriptreiva; $conten['form'] =& $edit; $data['style'] = style('redmond/jquery-ui.css'); $data['style'] .= style('gt_grid.css'); $data['style'] .= style("impromptu.css"); $data['script'] = script('jquery.js'); $data['script'] .= script('jquery-ui.js'); $data["script"] .= script("jquery-impromptu.js"); $data["script"] .= script("plugins/jquery.blockUI.js"); $data['script'] .= script('plugins/jquery.numeric.pack.js'); $data['script'] .= phpscript('nformat.js'); $data['script'] .= script('plugins/jquery.floatnumber.js'); $data['script'] .= script("gt_msg_en.js"); $data['script'] .= script("gt_grid_all.js"); $data['content'] = $this->load->view('view_sfacter', $conten,true); $data['head'] = $this->rapyd->get_head(); $data['title'] = heading($this->titp); $this->load->view('view_ventanas', $data); */ }
function dataedit($back = '') { $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'), 'retornar' => array('proveed' => 'cod_prov', 'nombre' => 'nombrep'), 'titulo' => 'Buscar Beneficiario'); $bSPRV = $this->datasis->p_modbus($mSPRV, "sprv"); $mOCOMPRA = array('tabla' => 'ocompra', 'columnas' => array('numero' => 'Número', 'tipo' => 'Tipo', 'uejecutora' => 'uejecutora', 'cod_prov' => 'Beneficiario'), 'filtro' => array('numero' => 'Número', 'tipo' => 'Tipo', 'uejecutora' => 'uejecutora', 'cod_prov' => 'Beneficiario'), 'retornar' => array('numero' => 'compra', 'cod_prov' => 'cod_prov', 'total2' => 'montocontrato', 'CONCAT("Pago de Anticipo ",observa)' => 'observa', 'CONCAT("50")' => 'porcent', 'subtotal' => 'montob'), 'p_uri' => array(4 => '<#cod_prov#>'), 'where' => '( status = "C" ) AND IF(<#cod_prov#> = ".....", cod_prov LIKE "%" ,cod_prov = <#cod_prov#>)', 'script' => array('cal_total()'), 'titulo' => 'Buscar Ordenes de Compra'); $pOCOMPRA = $this->datasis->p_modbus($mOCOMPRA, '<#cod_prov#>'); $rr = $this->ivaplica2(); $pimpm = $this->datasis->traevalor('IMPMUNICIPAL'); $pimpt = $this->datasis->traevalor('IMPTIMBRE'); $pcrs = $this->datasis->traevalor('CRS'); $site_url = site_url('presupuesto/pobra/islr'); $uri = $this->datasis->get_uri(); $idt = $this->datasis->dameval("SELECT id FROM modbus WHERE idm='ocompra' AND uri='{$uri}'"); $modblink2 = site_url('/buscar/index/' . $idt); $script = ' $(".inputnum").numeric("."); $(function() { function cal(){ subtotal = parseFloat($("#subtotal").val()); ivag = 1 * $("#ivag" ).val(); ivar = 1 * $("#ivar" ).val(); ivaa = 1 * $("#ivaa" ).val(); iva = parseFloat(ivaa) + parseFloat(ivag) + parseFloat(ivar); reteiva_prov = parseFloat($("#reteiva_prov").val()); if( (isNaN(reteiva_prov)) || (reteiva_prov==0) || (reteiva_prov == "") || (reteiva_prov == 100) ) reteiva_prov = 100; else reteiva_prov = 75; reteiva = iva * parseFloat( reteiva_prov/ 100); reten = parseFloat($("#reten").val()); total2 = subtotal + iva ; total = total2 - reteiva - reten ; $("#reteiva_prov" ).val(reteiva_prov); $("#reteiva" ).val(reteiva); $("#total2" ).val(total2); $("#total" ).val(total); $("#iva" ).val(iva); } $("#civag").change(function(){ if($("#civag").attr("checked")==true) $("#ivag").val($("#subtotal").val() * ' . $rr['tasa'] . '/100); else $("#ivag").val("0"); cal(); }); $("#civar").change(function(){ if($("#civar").attr("checked")==true) $("#ivar").val($("#subtotal").val() * ' . $rr['redutasa'] . '/100); else $("#ivar").val("0"); cal(); }); $("#civaa").change(function(){ if($("#civaa").attr("checked")==true) $("#ivaa").val($("#subtotal").val() * ' . $rr['sobretasa'] . '/100); else $("#ivaa").val("0"); cal(); }); $("#creten").change(function(){ $.post("' . $site_url . '",{ creten:$("#creten").val(),subtotal:$("#subtotal").val() },function(data){ $("#reten").val(data); }) cal(); }); $("#subtotal").change(function(){ cal(); }); }); $(document).ready(function() { $("#porcent").keypress(function(){ cal_total(); }); }); function cal_total(){ montob=$("#montob").val(); porcent=$("#porcent").val(); if(porcent>=100){ porcent=50; $("#porcent").val(50); } total=montob*porcent/100; $("#total").val(Math.round(total*100)/100); } function modbusdepen(){ var cod_prov =$("#cod_prov").val(); if(cod_prov=="")cod_prov="....."; var link="' . $modblink2 . '"+"/"+cod_prov; vent=window.open(link,"ventbuscarocompra","width=800,height=600,scrollbars=Yes,status=Yes,resizable=Yes,screenx=5,screeny=5"); vent.focus(); document.body.setAttribute("onUnload","vent=window.open(\\"about:blank\\",\\"ventbuscarocompra\\");vent.close();"); } function btn_anulaf(i){ if(!confirm("Esta Seguro que desea Anular la Orden de Compra Causada ?")) return false; else window.location="' . site_url('presupuesto/common/pm_anular') . '/"+i } '; $do = new DataObject("odirect"); $do->pointer('sprv', 'sprv.proveed=odirect.cod_prov', 'sprv.nombre as nombrep', 'LEFT'); $edit = new DataDetails($this->t**s, $do); if ($back == 'opagof') { $edit->back_url = site_url("presupuesto/opagof/filteredgrid"); } else { $edit->back_url = site_url($this->url . "filteredgrid/index"); } $edit->set_rel_title('itodirect', 'Rubro <#o#>'); $edit->script($script, "create"); $edit->script($script, "modify"); $edit->script($script, "show"); $edit->pre_process('update', '_valida'); $edit->pre_process('insert', '_valida'); //$edit->post_process('insert' ,'_post'); //$edit->post_process('update' ,'_post'); $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->rule = 'unique'; if ($this->datasis->traevalor('USANODIRECT') == 'S') { $edit->numero->when = array('show'); } else { $edit->numero->when = array('show', 'create', 'modify'); } $edit->fecha = new dateonlyField("Fecha", "fecha"); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->size = 12; //$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->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:400px"; $edit->cod_prov = new inputField("Beneficiario", 'cod_prov'); $edit->cod_prov->size = 4; $edit->cod_prov->rule = "required"; $edit->cod_prov->readonly = true; $edit->cod_prov->append($bSPRV); $edit->nombrep = new inputField("Nombre", 'nombrep'); $edit->nombrep->size = 50; $edit->nombrep->readonly = true; $edit->nombrep->pointer = TRUE; $edit->nombrep->in = "cod_prov"; $edit->observa = new textAreaField("Observaciones", 'observa'); $edit->observa->cols = 60; $edit->observa->rows = 3; $edit->total = new inputField("Monto a Pagar", 'total'); $edit->total->size = 8; $edit->total->css_class = 'inputnum'; $edit->total->value = 0; $ganticipo = "Datos para Anticipos de Contratos"; $edit->compra = new inputField("Compromiso", 'compra'); $edit->compra->size = 10; //$edit->compra->rule = "required"; $edit->compra->readonly = true; $edit->compra->append('<img src="/tortuga/assets/default/images/system-search.png" alt="Busqueda de Ordenes de Compromisos" title="Busqueda de Ordenes de Compromisos" border="0" onclick="modbusdepen()"/>'); $edit->compra->group = $ganticipo; $edit->porcent = new inputField("Porcentaje", 'porcent'); $edit->porcent->size = 10; $edit->porcent->css_class = 'inputnum'; $edit->porcent->value = 0; $edit->porcent->group = $ganticipo; $edit->montocontrato = new inputField("Monto Contrato", 'montocontrato'); $edit->montocontrato->size = 10; $edit->montocontrato->css_class = 'inputnum'; $edit->montocontrato->value = 0; $edit->montocontrato->readonly = true; $edit->montocontrato->group = $ganticipo; $edit->montob = new hiddenField("", 'montob'); $edit->montob->size = 10; $edit->montob->css_class = 'inputnum'; $edit->montob->value = 0; $edit->montob->readonly = true; $edit->montob->group = $ganticipo; $status = $edit->get_from_dataobjetct('status'); if ($status == 'M1') { $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 == 'M2') { $action = "javascript:btn_anulaf('" . $edit->rapyd->uri->get_edited_id() . "')"; $edit->button_status("btn_anular", 'Anular', $action, "TR", "show"); } elseif ($status == 'M') { $edit->buttons("modify", "save"); } elseif ($status == 'MA') { $edit->buttons("delete"); } else { $edit->buttons("save"); } $edit->buttons("undo", "back", "add"); $edit->build(); $smenu['link'] = barra_menu('104'); $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); }