Beispiel #1
0
 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&oacute;n de Tablas";
     $data["head"] = $this->rapyd->get_head() . script('jquery.js');
     $this->load->view('view_ventanas', $data);
 }
Beispiel #2
0
 function dataedit($status = '', $numero = '')
 {
     //$this->datasis->modulo_id(116,1);
     $this->rapyd->load('dataobject', 'datadetails');
     $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'C&oacute;odigo', 'nombre' => 'Nombre', 'rif' => 'Rif', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'C&oacute;digo', 'nombre' => 'Nombre', 'rif' => 'Rif'), 'retornar' => array('proveed' => 'cod_prov', 'nombre' => 'nombrep', 'reteiva' => 'reteiva_prov'), 'script' => array('cal_total()'), 'titulo' => 'Buscar Beneficiario');
     $bSPRV = $this->datasis->p_modbus($mSPRV, "<#i#>");
     $bSPRV2 = $this->datasis->modbus($mSPRV, "sprv");
     $modbus = array('tabla' => 'v_presaldoante', 'columnas' => array('codigoadm' => 'Est. Admin', 'codigo' => 'Partida', 'denominacion' => 'Denominaci&oacute;n', 'saldo' => 'Saldo'), 'filtro' => array('codigoadm' => 'Est. Admin', 'codigo' => 'Partida', 'denominacion' => 'Denominaci&oacute;n'), 'retornar' => array('codigoadm' => 'itcodigoadm_<#i#>', 'codigo' => 'partida_<#i#>'), 'where' => 'fondo = <#fondo#> AND codigo LIKE "4.%"', 'p_uri' => array(4 => '<#i#>', 5 => '<#fondo#>'), 'titulo' => 'Busqueda de partidas');
     //$btn=$this->datasis->p_modbus($modbus,'<#i#>');
     $btn = $this->datasis->p_modbus($modbus, '<#i#>/<#fondo#>');
     $btn = '<img src="/tortuga/assets/default/images/system-search.png"  alt="Busqueda de partidas" title="Busqueda de partidas" border="0" onclick="modbusdepen(<#i#>)"/>';
     $mNOMINA = array('tabla' => 'nomina', 'columnas' => array('nomi' => 'N&uacute;mero', 'denomi' => 'Descripcion', 'total' => 'Total'), 'filtro' => array('nomi' => 'N&uacute;mero', 'denomi' => 'Descripcion', 'total' => 'Total'), 'retornar' => array('nomi' => 'nomina', 'denomi' => 'denomin', 'total' => 'retenomina'), 'titulo' => 'Buscar Nominas');
     $bNOMINA = $this->datasis->p_modbus($mNOMINA, "nomina");
     $do = new DataObject("odirect");
     $do->pointer('sprv', 'sprv.proveed = odirect.cod_prov', 'sprv.nombre as nombrep, sprv.rif rif', 'LEFT');
     $do->rel_one_to_many('itodirect', 'itodirect', array('numero' => 'numero'));
     if ($status == "create" && !empty($numero)) {
         $do->load($numero);
         $do->set('status', 'N1');
         $do->unset_pk();
         /*$do->set('numero', '');
         		$do->pk    =array('numero'=>'');
         		//$do->loaded=0;
         		for($i=0;$i < $do->count_rel('itodirect');$i++){
         			$do->set_rel('itodirect','id'    ,'',$i);
         			$do->set_rel('itodirect','numero','',$i);
         		}
         		*/
     }
     $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');
     $edit->post_process('update', '_post');
     $edit->post_process('insert', '_post_insert');
     $edit->post_process('update', '_post_update');
     $edit->post_process('delete', '_post_delete');
     $ivaplica = $this->ivaplica2();
     $edit->numero = new inputField("N&uacute;mero", "numero");
     $edit->numero->mode = "autohide";
     if ($this->datasis->traevalor('USANODIRECT') == 'S') {
         $edit->numero->when = array('show');
     } else {
         $edit->numero->when = array('show', 'create');
     }
     $edit->tipo = new dropdownField("Orden de ", "tipo");
     $edit->tipo->option("Compra", "Compra");
     $edit->tipo->option("Servicio", "Servicio");
     $edit->tipo->option("T", "Transferencia");
     $edit->tipo->option("N", "Nomina");
     $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";
     $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->rif = new inputField("RIF", "rif");
     $edit->rif->size = 10;
     $edit->rif->pointer = true;
     if ($status == 'P') {
         $edit->rif->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');
     $edit->observa = new textAreaField("Observaciones", 'observa');
     $edit->observa->cols = 70;
     $edit->observa->rows = 3;
     $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->value = 0;
     $unsolofondo = $this->datasis->traevalor('UNSOLOFONDO', 'S', 'Indica si se utiliza una sola fuente de financiamiento');
     if ($unsolofondo == 'S') {
         $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->total->value = 0;
     $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->impmunicipal->value = 0;
     $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->iva->value = 0;
     $edit->ivaa = new inputField("IVA Adicional", 'ivaa');
     $edit->ivaa->css_class = 'inputnum';
     $edit->ivaa->size = 8;
     $edit->ivaa->value = 0;
     $edit->ivag = new inputField("IVA General", 'ivag');
     $edit->ivag->css_class = 'inputnum';
     $edit->ivag->size = 8;
     $edit->ivag->value = 0;
     $edit->ivar = new inputField("IVA Reducido", 'ivar');
     $edit->ivar->css_class = 'inputnum';
     $edit->ivar->size = 8;
     $edit->ivar->value = 0;
     $edit->exento = new inputField("Exento", 'exento');
     $edit->exento->css_class = 'inputnum';
     $edit->exento->size = 8;
     $edit->exento->value = 0;
     $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->mivaa->value = 0;
     $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->mivag->value = 0;
     $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->mivar->value = 0;
     $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->mexento->value = 0;
     $edit->reteiva = new inputField("Retencion IVA", 'reteiva');
     $edit->reteiva->css_class = 'inputnum';
     $edit->reteiva->size = 8;
     $edit->reteiva->value = 0;
     $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&oacute;n ISLR", 'reten');
     $edit->reten->css_class = 'inputnum';
     $edit->reten->size = 8;
     $edit->reten->value = 0;
     $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->otrasrete->value = 0;
     $edit->amortiza = new inputField("Amortizacion", "amortiza");
     $edit->amortiza->size = 8;
     $edit->amortiza->value = 0;
     $edit->amortiza->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->multiple->option("S", "SI");
     $edit->multiple->style = "width:50px;";
     $edit->itesiva = new dropdownField("P.IVA", "itesiva_<#i#>");
     $edit->itesiva->rule = 'required';
     $edit->itesiva->db_name = 'esiva';
     $edit->itesiva->rel_id = 'itodirect';
     $edit->itesiva->option("N", "No");
     $edit->itesiva->option("S", "Si");
     $edit->itesiva->option("A", "Auto");
     $edit->itesiva->style = "width:45px;";
     if ($unsolofondo != 'S') {
         $edit->itfondo = new dropdownField("Fondo", "itfondo_<#i#>");
         $edit->itfondo->size = 10;
         $edit->itfondo->rule = 'required';
         $edit->itfondo->db_name = 'fondo';
         $edit->itfondo->rel_id = 'itodirect';
         $edit->itfondo->options("SELECT tipo,tipo a  FROM presupuesto WHERE tipo<>'' GROUP BY tipo ORDER BY tipo desc");
         $edit->itfondo->style = "width:100px;";
     }
     $edit->itcodigoadm = new inputField("Estructura\tAdministrativa", "itcodigoadm_<#i#>");
     $edit->itcodigoadm->size = 10;
     $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->size = 15;
     $edit->itpartida->append($btn);
     $edit->itpartida->db_name = 'partida';
     $edit->itpartida->rel_id = 'itodirect';
     $edit->itpartida->autocomplete = false;
     //$edit->itpartida->readonly =true;
     //$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&oacute;n", "descripcion_<#i#>");
     $edit->itdescripcion->db_name = 'descripcion';
     $edit->itdescripcion->maxlength = 80;
     $edit->itdescripcion->size = 15;
     //$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:60px";
     $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->itusaislr = new dropdownField("(<#o#>) Islr", "usaislr_<#i#>");
     $edit->itusaislr->db_name = 'usaislr';
     $edit->itusaislr->rel_id = 'itodirect';
     $edit->itusaislr->insertValue = "N";
     $edit->itusaislr->onchange = 'cal_total();';
     $edit->itusaislr->option("N", "No");
     $edit->itusaislr->option("S", "Si");
     $edit->itusaislr->style = "width:45px";
     //$edit->itusaislr = new checkboxField("(<#o#>) Islr", "usaislr_<#i#>","Y","N");
     //$edit->itusaislr->db_name     = 'usaislr';
     //$edit->itusaislr->rel_id      = 'itodirect';
     //$edit->itusaislr->insertValue = "N";
     //$edit->itusaislr->when        = array("modify","create");
     //$edit->itusaislr->onchange ='cal_total();';
     $edit->itislr = new inputField("(<#o#>) Islr", "islr_<#i#>");
     $edit->itislr->css_class = 'inputnum';
     $edit->itislr->db_name = 'islr';
     $edit->itislr->rel_id = 'itodirect';
     $edit->itislr->rule = 'numeric';
     $edit->itislr->readonly = true;
     $edit->itislr->size = 5;
     $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", "Exento");
     $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;
     $edit->itimporte->onchange = 'cal_importep(<#i#>);';
     $edit->status = new dropdownField("Estado", "status");
     $edit->status->option("", "");
     $edit->status->option("N2", "Actualizado");
     $edit->status->option("N1", "Sin Actualizar");
     $edit->status->option("N3", "Pagado");
     $edit->status->when = array('show');
     $edit->status->style = "width:150px";
     $status = $edit->get_from_dataobjetct('status');
     if ($status == 'N1') {
         $action = "javascript:window.location='" . site_url($this->url . 'actualizar/' . $edit->rapyd->uri->get_edited_id()) . "'";
         $edit->button_status("btn_status", 'Actualizar', $action, "TR", "show");
         $action = "javascript:btn_anulaf('" . $edit->rapyd->uri->get_edited_id() . "')";
         $edit->button_status("btn_anular", 'Anular', $action, "TR", "show");
         $edit->buttons("modify", "save");
     } elseif ($status == 'N2') {
         $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() . "')";
         $edit->button_status("btn_anular", 'Anular', $action, "TR", "show");
     } elseif ($status == 'N3') {
         $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 == "N") {
         $edit->buttons("modify", "save");
     } else {
         $edit->buttons("save");
     }
     $edit->buttons("undo", "back", "add_rel", "add");
     $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('121');
     $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true);
     $conten["form"] =& $edit;
     $data['content'] = $this->load->view('view_opagoante', $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);
 }
Beispiel #3
0
 function dataedit()
 {
     //$this->datasis->modulo_id(101,1);
     $this->rapyd->load('dataobject', 'datadetails');
     $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'C&oacute;odigo', 'nombre' => 'Nombre', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'C&oacute;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&oacute;digo', 'denominacion' => 'Denominaci&oacute;n'), 'filtro' => array('codigo' => 'C&oacute;digo', 'denominacion' => 'Denominaci&oacute;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&acute;mero', 'codbanc' => 'Banco', 'monto' => 'Monto', 'saldo' => 'Demostrado'), 'filtro' => array('numero' => 'Nu&acute;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&uacute;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&oacute;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);
 }
Beispiel #4
0
    function dataedit()
    {
        $this->rapyd->load('dataobject', 'datadetails');
        $modbus = array('tabla' => 'sinv', 'columnas' => array('codigo' => 'C&oacute;digo', 'descrip' => 'Descripci&oacute;n', 'precio1' => 'Precio 1', 'precio2' => 'Precio 2', 'precio3' => 'Precio 3', 'existen' => 'Existencia'), 'filtro' => array('codigo' => 'C&oacute;digo', 'descrip' => 'Descripci&oacute;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&uacute;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&eacute;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&oacute;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&oacute;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&aacute;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&oacute;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);
        }
    }
Beispiel #5
0
 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&oacute;odigo', 'rif' => 'RIF', 'nombre' => 'Nombre', 'grupo' => 'Grupo', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'C&oacute;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&uacute;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&oacute;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&oacute;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);
 }
Beispiel #6
0
 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&oacute;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&uacute;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&ntilde;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);
 }
Beispiel #7
0
 function dataedit()
 {
     //$this->datasis->modulo_id(119,1);
     $this->rapyd->load('dataobject', 'datadetails');
     $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'C&oacute;odigo', 'nombre' => 'Nombre', 'rif' => 'Rif', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'C&oacute;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&oacute;digo', 'ordinal' => 'Ord', 'denominacion' => 'Denominaci&oacute;n', 'saldo' => 'Saldo'), 'filtro' => array('codigo' => 'C&oacute;digo', 'denominacion' => 'Denominaci&oacute;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&oacute;odigo', 'codbanc' => 'Banco', 'monto' => 'Monto'), 'filtro' => array('id' => 'C&oacute;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&uacute;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&oacute;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&oacute;n", "descripcion_<#i#>");
     $edit->itdescripcion->db_name = 'descripcion';
     $edit->itdescripcion->maxlength = 80;
     $edit->itdescripcion->size = 15;
     $edit->itdescripcion->rel_id = 'itodirect';
     $edit->itunidad = new dropdownField("(<#o#>) Unidad", "unidad_<#i#>");
     $edit->itunidad->db_name = 'unidad';
     $edit->itunidad->rel_id = 'itodirect';
     $edit->itunidad->options("SELECT unidades AS id,unidades FROM unidad ORDER BY unidades");
     $edit->itunidad->style = "width:80px";
     $edit->itcantidad = new inputField("(<#o#>) Cantidad", "cantidad_<#i#>");
     $edit->itcantidad->css_class = 'inputnum';
     $edit->itcantidad->db_name = 'cantidad';
     $edit->itcantidad->rel_id = 'itodirect';
     $edit->itcantidad->rule = 'numeric';
     $edit->itcantidad->onchange = 'cal_importe(<#i#>);';
     $edit->itcantidad->size = 5;
     $edit->itprecio = new inputField("(<#o#>) Precio", "precio_<#i#>");
     $edit->itprecio->css_class = 'inputnum';
     $edit->itprecio->db_name = 'precio';
     $edit->itprecio->rel_id = 'itodirect';
     $edit->itprecio->rule = 'callback_positivo';
     $edit->itprecio->onchange = 'cal_importe(<#i#>);';
     $edit->itprecio->size = 8;
     $edit->itiva = new dropdownField("(<#o#>) IVA", "iva_<#i#>");
     $edit->itiva->db_name = 'iva';
     $edit->itiva->rel_id = 'itodirect';
     $edit->itiva->onchange = 'cal_importe(<#i#>);';
     $edit->itiva->options($this->_ivaplica());
     $edit->itiva->option("0", "Excento");
     $edit->itiva->style = "width:80px";
     $edit->itimporte = new inputField("(<#o#>) Importe", "importe_<#i#>");
     $edit->itimporte->css_class = 'inputnum';
     $edit->itimporte->db_name = 'importe';
     $edit->itimporte->rel_id = 'itodirect';
     $edit->itimporte->rule = 'numeric';
     $edit->itimporte->readonly = true;
     $edit->itimporte->size = 8;
     //relacion itfac
     $status = $edit->get_from_dataobjetct('status');
     $edit->tivag = new inputField("", "tivag");
     $edit->tivag->mode = "autohide";
     $edit->tivag->size = 5;
     $edit->tivar = new inputField("", "tivar");
     $edit->tivar->mode = "autohide";
     $edit->tivar->size = 5;
     $edit->tivaa = new inputField("", "tivaa");
     $edit->tivaa->mode = "autohide";
     $edit->tivaa->size = 5;
     $edit->tsubtotal = new inputField("", "tsubtotal");
     $edit->tsubtotal->readonly = true;
     $edit->tsubtotal->size = 8;
     $edit->tsubtotal->when = array('modify');
     $edit->texento = new inputField("", "texento");
     $edit->texento->readonly = true;
     $edit->texento->size = 8;
     $edit->texento->when = array('modify');
     $edit->trivag = new inputField("", "trivag");
     $edit->trivag->readonly = true;
     $edit->trivag->size = 8;
     $edit->trivag->when = array('modify');
     $edit->trivar = new inputField("", "trivar");
     $edit->trivar->readonly = true;
     $edit->trivar->size = 8;
     $edit->trivar->when = array('modify');
     $edit->trivaa = new inputField("", "trivaa");
     $edit->trivaa->readonly = true;
     $edit->trivaa->size = 8;
     $edit->trivaa->when = array('modify');
     $edit->treteiva = new inputField("", "treteiva");
     $edit->treteiva->readonly = true;
     $edit->treteiva->size = 8;
     $edit->treteiva->when = array('modify');
     $edit->ttotal = new inputField("", "ttotal");
     $edit->ttotal->readonly = true;
     $edit->ttotal->size = 8;
     $edit->ttotal->when = array('modify');
     $edit->ttotal2 = new inputField("", "ttotal2");
     $edit->ttotal2->readonly = true;
     $edit->ttotal2->size = 8;
     $edit->ttotal2->when = array('modify');
     $edit->itfactura = new inputField("(<#o#>) Factura", "factura_<#i#>");
     $edit->itfactura->size = 10;
     $edit->itfactura->db_name = 'factura';
     $edit->itfactura->rel_id = 'itfac';
     $edit->itfactura->rule = 'required';
     $edit->itcontrolfac = new inputField("(<#o#>) Control Fiscal", "controlfac_<#i#>");
     $edit->itcontrolfac->db_name = 'controlfac';
     $edit->itcontrolfac->size = 10;
     $edit->itcontrolfac->rel_id = 'itfac';
     $edit->itcontrolfac->rule = 'required';
     $edit->itfechafac = new dateonlyField("(<#o#>) Fecha Factura", "fechafac_<#i#>");
     $edit->itfechafac->db_name = 'fechafac';
     $edit->itfechafac->insertValue = date('Y-m-d');
     $edit->itfechafac->size = 10;
     $edit->itfechafac->rule = 'required';
     $edit->itfechafac->rel_id = 'itfac';
     $edit->itsubtotal = new inputField("(<#o#>) Total", "subtotal_<#i#>");
     $edit->itsubtotal->size = 8;
     $edit->itsubtotal->db_name = 'subtotal';
     $edit->itsubtotal->rel_id = 'itfac';
     $edit->itsubtotal->onchange = 'cal_subtotal(<#i#>);';
     $edit->itsubtotal->css_class = "inputnum";
     if ($status == "B3") {
         $edit->itsubtotal->mode = "autohide";
     }
     $edit->itexento = new inputField("(<#o#>) Exento", "exento_<#i#>");
     $edit->itexento->size = 8;
     $edit->itexento->db_name = 'exento';
     $edit->itexento->rel_id = 'itfac';
     $edit->itexento->css_class = "inputnum";
     if ($status == "B3") {
         $edit->itexento->mode = "autohide";
     }
     $edit->itivag = new inputField("(<#o#>) % IVA General", "ivag_<#i#>");
     $edit->itivag->size = 8;
     $edit->itivag->db_name = 'ivag';
     $edit->itivag->rel_id = 'itfac';
     $edit->itivag->onchange = 'cal_itivag(<#i#>);';
     $edit->itivag->css_class = "inputnum";
     if ($status == "B3") {
         $edit->itivag->mode = "autohide";
     }
     $edit->itivar = new inputField("(<#o#>) % IVA Reducido", "ivar_<#i#>");
     $edit->itivar->size = 8;
     $edit->itivar->db_name = 'ivar';
     $edit->itivar->rel_id = 'itfac';
     $edit->itivar->onchange = 'cal_itivar(<#i#>);';
     $edit->itivar->css_class = "inputnum";
     if ($status == "B3") {
         $edit->itivar->mode = "autohide";
     }
     $edit->itivaa = new inputField("(<#o#>) % IVA Adicional", "ivaa_<#i#>");
     $edit->itivaa->size = 8;
     $edit->itivaa->db_name = 'ivaa';
     $edit->itivaa->rel_id = 'itfac';
     $edit->itivaa->onchange = 'cal_itivaa(<#i#>);';
     $edit->itivaa->css_class = "inputnum";
     if ($status == "B3") {
         $edit->itivaa->mode = "autohide";
     }
     $edit->itreteiva = new inputField("(<#o#>) % IVA Adicional", "reteiva_<#i#>");
     $edit->itreteiva->size = 8;
     $edit->itreteiva->db_name = 'reteiva';
     $edit->itreteiva->rel_id = 'itfac';
     $edit->itreteiva->readonly = true;
     if ($status == "B3") {
         $edit->itreteiva->mode = "autohide";
     }
     $edit->ittotal = new inputField("(<#o#>) % IVA Adicional", "total_<#i#>");
     $edit->ittotal->size = 8;
     $edit->ittotal->db_name = 'total';
     $edit->ittotal->rel_id = 'itfac';
     $edit->ittotal->readonly = true;
     if ($status == "B3") {
         $edit->ittotal->mode = "autohide";
     }
     $edit->ittotal2 = new inputField("(<#o#>) % IVA Adicional", "total2_<#i#>");
     $edit->ittotal2->size = 8;
     $edit->ittotal2->db_name = 'total2';
     $edit->ittotal2->rel_id = 'itfac';
     $edit->ittotal2->readonly = true;
     if ($status == "B3") {
         $edit->ittotal2->mode = "autohide";
     }
     //fin relacion itfac
     if ($status == 'B1') {
         $action = "javascript:window.location='" . site_url($this->url . 'actualizar/' . $edit->rapyd->uri->get_edited_id()) . "'";
         $edit->button_status("btn_status", 'Actualizar', $action, "TR", "show");
         $edit->buttons("modify", "save");
     } elseif ($status == 'B2') {
         $action = "javascript:window.location='" . site_url('presupuesto/common/pd_anular/' . $edit->rapyd->uri->get_edited_id()) . "'";
         if ($this->datasis->puede('1015')) {
             $edit->button_status("btn_anular", 'Anular', $action, "TR", "show");
         }
     } elseif ($status == 'B3') {
         $multiple = $edit->get_from_dataobjetct('multiple');
         if ($multiple == "N") {
             $action = "javascript:window.location='" . site_url($this->url . 'camfac/dataedit/modify/' . $edit->rapyd->uri->get_edited_id()) . "'";
             $edit->button_status("btn_camfac", 'Modificar Factura', $action, "TR", "show");
         }
     } else {
         $edit->buttons("save");
     }
     $edit->buttons("undo", "back", "add_rel");
     $edit->build();
     $query = $this->db->query('SELECT codigo,base1,tari1,pama1 FROM rete');
     $rt = array();
     foreach ($query->result_array() as $row) {
         $pivot = array('base1' => $row['base1'], 'tari1' => $row['tari1'], 'pama1' => $row['pama1']);
         $rt['_' . $row['codigo']] = $pivot;
     }
     $rete = json_encode($rt);
     $conten['rete'] = $rete;
     $ivaplica = $this->ivaplica2();
     $conten['status'] = $status;
     $conten['ivar'] = $ivaplica['redutasa'];
     $conten['ivag'] = $ivaplica['tasa'];
     $conten['ivaa'] = $ivaplica['sobretasa'];
     $conten['imptimbre'] = $this->datasis->traevalor('IMPTIMBRE');
     $conten['impmunicipal'] = $this->datasis->traevalor('IMPMUNICIPAL');
     $smenu['link'] = barra_menu('119');
     $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true);
     $conten["form"] =& $edit;
     $data['content'] = $this->load->view('view_odirectmulti', $conten, true);
     $data['title'] = " {$this->t**s} ";
     $data["head"] = $this->rapyd->get_head() . script('jquery.js') . script("plugins/jquery.numeric.pack.js") . script("plugins/jquery.json.min.js");
     $this->load->view('view_ventanas', $data);
 }
    function dataedit($back = '')
    {
        $this->rapyd->load('dataobject', 'datadetails');
        $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'C&oacute;odigo', 'nombre' => 'Nombre', 'rif' => 'Rif', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'C&oacute;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&uacute;mero', 'tipo' => 'Tipo', 'uejecutora' => 'uejecutora', 'cod_prov' => 'Beneficiario'), 'filtro' => array('numero' => 'N&uacute;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&uacute;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);
    }
Beispiel #9
0
 function dataedit()
 {
     $this->rapyd->load('datadetails', 'dataobject');
     $this->load->helper('form');
     $mBANC = array('tabla' => 'banc', 'columnas' => array('codbanc' => 'C&oacute;odigo', 'banco' => 'Banco', 'numcuent' => 'Cuenta', 'saldo' => 'Saldo'), 'filtro' => array('codbanc' => 'C&oacute;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&oacute;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&eacute;bito");
         $edit->ittipo_doc->option("DF", "Diferencia");
     } else {
         $edit->ittipo_doc->option("DP", "Deposito");
         $edit->ittipo_doc->option("DB", "Tarjeta D&eacute;bito");
         $edit->ittipo_doc->option("DF", "Diferencia");
         $edit->ittipo_doc->option("EF", "Efectivo");
     }
     $edit->itcheque = new inputField("(<#o#>) Transacci&oacute;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);
 }
Beispiel #10
0
 function dataedit()
 {
     //$this->datasis->modulo_id(101,1);
     $this->rapyd->load('dataobject', 'datadetails');
     $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'C&oacute;odigo', 'nombre' => 'Nombre', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'C&oacute;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&uacute;mero', 'fecha' => 'fecha', 'tipo' => 'tipo'), 'filtro' => array('numero' => 'N&uacute;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&oacute;odigo', 'banco' => 'Banco', 'saldo' => 'Saldo'), 'filtro' => array('codbanc' => 'C&oacute;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&uacute;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);
 }
Beispiel #11
0
 function dataedit()
 {
     $this->rapyd->load('dataobject', 'datadetails');
     $tipo_rete = $this->datasis->traevalor('CONTRIBUYENTE');
     $rif = $this->datasis->traevalor('RIF');
     $fields = $this->db->field_data('gser');
     $url_pk = $this->uri->segment_array();
     $coun = 0;
     $pk = array();
     foreach ($fields as $field) {
         if ($field->primary_key == 1) {
             $coun++;
             $pk[] = $field->name;
         }
     }
     $values = array_slice($url_pk, -$coun);
     $claves = array_combine(array_reverse($pk), $values);
     //print_r($claves);
     $query = "UPDATE gitser AS a\n\t\t\tJOIN gser AS b on a.numero=b.numero and a.fecha = b.fecha and a.proveed = b.proveed\n\t\t\tSET a.idgser=b.id\n\t\t\tWHERE a.id=" . $claves['id'] . " ";
     $this->db->simple_query($query);
     /*$modbus=array(
     			'tabla'   => 'mgas',
     			'columnas'=> array(
     			'codigo'  => 'C&oacute;digo',
     			'descrip' => 'descrip'),
     			'filtro'  => array('codigo' =>'C&oacute;digo','descrip'=>'descrip'),
     			'retornar'=> array('codigo'=>'codigo_<#i#>','descrip'=>'descrip_<#i#>'),
     			'p_uri'   => array(4=>'<#i#>'),
     			'titulo'  => 'Buscar Articulo',
     			'script'  => array('lleva(<#i#>)'));
     		$btn=$this->datasis->p_modbus($modbus,'<#i#>');*/
     $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'C&oacute;odigo', 'nombre' => 'Nombre', 'rif' => 'Rif'), 'filtro' => array('proveed' => 'C&oacute;digo', 'nombre' => 'Nombre'), 'retornar' => array('proveed' => 'proveed', 'nombre' => 'nombre', 'tipo' => 'sprvtipo', 'reteiva' => 'sprvreteiva'), 'script' => array('totalizar()'), 'titulo' => 'Buscar Proveedor');
     $bSPRV = $this->datasis->modbus($mSPRV);
     $do = new DataObject('gser');
     $do->pointer('sprv', 'sprv.proveed=gser.proveed', 'sprv.tipo AS sprvtipo, sprv.reteiva AS sprvreteiva', 'left');
     $do->rel_one_to_many('gitser', 'gitser', array('id' => 'idgser'));
     $do->rel_one_to_many('gereten', 'gereten', array('id' => 'idd'));
     //$do->rel_pointer('rete','rete','gereten.codigorete=rete.codigo','rete.pama1 AS retepama1');
     $edit = new DataDetails("Gastos", $do);
     if ($edit->_status == 'show') {
         $edit->back_url = site_url("finanzas/gsercol/filteredgrid");
     } else {
         $edit->back_url = site_url("finanzas/gsercol/agregar");
     }
     $edit->set_rel_title('gitser', 'Gasto <#o#>');
     //$edit->script($script,'create');
     //$edit->script($script,'modify');
     $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->tipo_doc = new dropdownField("Tipo Documento", "tipo_doc");
     $edit->tipo_doc->style = "width:100px";
     $edit->tipo_doc->option('FC', "Factura");
     $edit->tipo_doc->option('ND', "Nota Debito");
     $edit->tipo_doc->option('AD', "Amortizaci&oacute;n");
     $edit->tipo_doc->option('GA', "Gasto");
     //$edit->tipo_doc->option('GA',"Gasto de N&oacute;mina");
     $edit->ffactura = new DateonlyField("Fecha Documento", "ffactura", "d/m/Y");
     $edit->ffactura->insertValue = date("Y-m-d");
     $edit->ffactura->size = 10;
     $edit->ffactura->rule = 'required';
     //$edit->ffactura->insertValue = date("Y-m-d");
     $edit->fecha = new DateonlyField('Fecha Registro', 'fecha');
     $edit->fecha->insertValue = date("Y-m-d");
     $edit->fecha->size = 10;
     $edit->fecha->rule = 'required';
     $edit->vence = new DateonlyField("Fecha Vencimiento", "vence", "d/m/Y");
     $edit->vence->insertValue = date("Y-m-d");
     $edit->vence->size = 10;
     //$edit->vence->insertValue = date("Y-m-d");
     $edit->compra = new inputField('Doc.Asociado', 'compra');
     $edit->compra->rule = 'max_length[8]';
     $edit->compra->size = 10;
     $edit->compra->maxlength = 8;
     $edit->numero = new inputField("N&uacute;mero", "numero");
     $edit->numero->size = 10;
     $edit->numero->maxlength = 8;
     $edit->numero->autocomplete = false;
     $edit->numero->rule = 'required';
     $edit->proveed = new inputField("Proveedor", "proveed");
     $edit->proveed->size = 6;
     $edit->proveed->maxlength = 5;
     $edit->proveed->append($bSPRV);
     $edit->proveed->rule = "required";
     $edit->nfiscal = new inputField("Control Fiscal", "nfiscal");
     $edit->nfiscal->size = 10;
     $edit->nfiscal->autocomplete = false;
     $edit->nfiscal->maxlength = 20;
     $edit->nombre = new inputField("Nombre", "nombre");
     $edit->nombre->size = 30;
     $edit->nombre->maxlength = 40;
     $edit->nombre->rule = "required";
     $edit->sprvtipo = new hiddenField('', 'sprvtipo');
     $edit->sprvtipo->db_name = 'sclitipo';
     $edit->sprvtipo->pointer = true;
     $edit->sprvreteiva = new hiddenField('', 'sprvreteiva');
     $edit->sprvreteiva->db_name = 'sprvreteiva';
     $edit->sprvreteiva->insertValue = $tipo_rete == 'ESPECIAL' && strtoupper($rif[0]) != 'V' ? '50' : '0';
     $edit->sprvreteiva->pointer = true;
     $edit->totpre = new inputField("Sub.Total", "totpre");
     $edit->totpre->size = 10;
     $edit->totpre->css_class = 'inputnum';
     $edit->totpre->readonly = true;
     $edit->totpre->showformat = 'decimal';
     $edit->totbruto = new inputField("Total", "totbruto");
     $edit->totbruto->size = 10;
     $edit->totbruto->css_class = 'inputnum';
     $edit->totbruto->onkeyup = "valida(0)";
     $edit->totbruto->showformat = 'decimal';
     $edit->totiva = new inputField("Total IVA", "totiva");
     $edit->totiva->css_class = 'inputnum';
     $edit->totiva->size = 10;
     $edit->totiva->showformat = 'decimal';
     $edit->reteica = new inputField('Ret. ICA', 'reteica');
     $edit->reteica->css_class = 'inputnum';
     $edit->reteica->when = array('show');
     $edit->reteica->size = 10;
     $edit->reteica->showformat = 'decimal';
     $edit->retesimple = new inputField('Ret', 'retesimple');
     $edit->retesimple->css_class = 'inputnum';
     $edit->retesimple->when = array('show');
     $edit->retesimple->size = 10;
     $edit->retesimple->showformat = 'decimal';
     $edit->codb1 = new dropdownField('Caja/Banco', 'codb1');
     $edit->codb1->option('', '');
     $edit->codb1->options("SELECT TRIM(codbanc) AS ind, CONCAT_WS('-',codbanc,banco) AS label FROM banc ORDER BY codbanc");
     $edit->codb1->rule = 'max_length[5]|callback_chcodb|condi_required';
     $edit->codb1->style = 'width:120px';
     $edit->codb1->onchange = "esbancaja(this.value)";
     $edit->tipo1 = new dropdownField("Cheque/ND", "tipo1");
     $edit->tipo1->option('', 'Ninguno');
     $edit->tipo1->option('C', 'Cheque');
     $edit->tipo1->option('D', 'D&eacute;bito');
     $edit->tipo1->rule = 'condi_required|callback_chtipoe';
     $edit->tipo1->style = "width:100px";
     $edit->cheque1 = new inputField('N&uacute;mero', "cheque1");
     $edit->cheque1->rule = 'condi_required|callback_chobliganumerog';
     $edit->cheque1->size = 12;
     $edit->cheque1->maxlength = 20;
     $edit->benefi = new inputField("Beneficiario", "benefi");
     $edit->benefi->size = 39;
     $edit->benefi->maxlength = 40;
     $edit->monto1 = new inputField("Contado", "monto1");
     $edit->monto1->size = 10;
     $edit->monto1->css_class = 'inputnum';
     $edit->monto1->onkeyup = "contado()";
     $edit->monto1->rule = 'condi_required|callback_chmontocontado|positive';
     $edit->monto1->autocomplete = false;
     $edit->monto1->showformat = 'decimal';
     $edit->credito = new inputField("Cr&eacute;dito", "credito");
     $edit->credito->size = 10;
     $edit->credito->showformat = 'decimal';
     $edit->credito->css_class = 'inputnum';
     $edit->credito->onkeyup = "ccredito()";
     $edit->credito->autocomplete = false;
     /*$edit->creten = new inputField("C&oacute;digo de la retencion","creten");
     		$edit->creten->size = 10;
     		$edit->creten->maxlength=10;
     		$edit->creten->append($bRETE);*/
     /*$edit->breten = new inputField("Base de la retenci&oacute;n","breten");
     		$edit->breten->size = 10;
     		$edit->breten->maxlength=10;
     		$edit->breten->css_class='inputnum';
     		$edit->breten->onkeyup="valida(0)";*/
     $edit->reten = new inputField("Monto de la retenci&oacute;n", "reten");
     $edit->reten->size = 10;
     $edit->reten->maxlength = 10;
     $edit->reten->css_class = 'inputnum';
     $edit->reten->when = array('show');
     $edit->reten->showformat = 'decimal';
     //$edit->reten->onkeyup="valida(0)";
     $edit->reteiva = new inputField("Ret.de IVA", "reteiva");
     $edit->reteiva->size = 10;
     $edit->reteiva->maxlength = 10;
     $edit->reteiva->rule = 'callback_chreteiva';
     $edit->reteiva->css_class = 'inputnum';
     $edit->reteiva->showformat = 'decimal';
     //$edit->reteiva->onkeyup="reteiva()";
     $edit->reteica = new inputField("Ret. ICA", "reteica");
     $edit->reteica->size = 10;
     $edit->reteica->maxlength = 10;
     //$edit->reteica->rule = 'callback_chreteiva';
     $edit->reteica->css_class = 'inputnum';
     $edit->reteica->when = array('show');
     $edit->totneto = new inputField("Neto", "totneto");
     $edit->totneto->size = 10;
     $edit->totneto->maxlength = 10;
     $edit->totneto->css_class = 'inputnum';
     $edit->totneto->readonly = true;
     $edit->totneto->showformat = 'decimal';
     $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'));
     //***************************
     //Campos para el detalle 1
     //***************************
     $edit->codigo = new inputField("C&oacute;digo <#o#>", "codigo_<#i#>");
     $edit->codigo->size = 5;
     $edit->codigo->db_name = 'codigo';
     //$edit->codigo->append($btn);
     $edit->codigo->rule = "required";
     //$edit->codigo->readonly=true;
     $edit->codigo->rel_id = 'gitser';
     $edit->descrip = new inputField("Descripci&oacute;n <#o#>", "descrip_<#i#>");
     $edit->descrip->size = 25;
     $edit->descrip->db_name = 'descrip';
     $edit->descrip->maxlength = 50;
     $edit->descrip->rel_id = 'gitser';
     $edit->precio = new inputField("Precio <#o#>", "precio_<#i#>");
     $edit->precio->db_name = 'precio';
     $edit->precio->css_class = 'inputnum';
     $edit->precio->size = 10;
     $edit->precio->rule = 'required|positive';
     $edit->precio->rel_id = 'gitser';
     $edit->precio->autocomplete = false;
     $edit->precio->onkeyup = "importe(<#i#>)";
     $edit->precio->showformat = 'decimal';
     $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 = 'gitser';
     $edit->tasaiva->onchange = "importe(<#i#>)";
     $edit->iva = new inputField("importe <#o#>", "iva_<#i#>");
     $edit->iva->db_name = 'iva';
     $edit->iva->css_class = 'inputnum';
     $edit->iva->rel_id = 'gitser';
     $edit->iva->size = 8;
     $edit->iva->rule = 'positive|callback_chretiva';
     $edit->iva->onkeyup = "valida(<#i#>)";
     $edit->iva->showformat = 'decimal';
     $edit->importe = new inputField("importe <#o#>", "importe_<#i#>");
     $edit->importe->db_name = 'importe';
     $edit->importe->css_class = 'inputnum';
     $edit->importe->rel_id = 'gitser';
     $edit->importe->size = 10;
     $edit->importe->onkeyup = "valida(<#i#>)";
     $edit->importe->showformat = 'decimal';
     $edit->departa = new dropdownField("Departamento <#o#>", "departa_<#i#>");
     $edit->departa->option('', 'Seleccionar');
     $edit->departa->options("SELECT codigo, CONCAT_WS('-',codigo,departam) AS label FROM dept ORDER BY codigo");
     $edit->departa->db_name = 'departa';
     $edit->departa->rule = 'required';
     $edit->departa->style = 'width:100px';
     $edit->departa->rel_id = 'gitser';
     $edit->departa->onchange = "gdeparta(this.value)";
     $edit->sucursal = new dropdownField("Sucursal <#o#>", "sucursal_<#i#>");
     //$edit->sucursal->option('','Seleccionar');
     $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 = 'gitser';
     $edit->sucursal->onchange = "gsucursal(this.value)";
     //*****************************
     //Fin de campos para detalle
     //*****************************
     //*****************************
     //Campos para el detalle reten
     //****************************
     //$edit->itorigen = new autoUpdateField('origen','SCST','SCST');
     //$edit->itorigen->rel_id ='gereten';
     $edit->codigorete = new dropdownField('', 'codigorete_<#i#>');
     $edit->codigorete->option('', 'Seleccionar');
     $edit->codigorete->options('SELECT TRIM(codigo) AS codigo,TRIM(CONCAT_WS("-",codigo,activida)) AS activida FROM rete ORDER BY codigo');
     $edit->codigorete->db_name = 'codigorete';
     $edit->codigorete->rule = 'max_length[4]';
     $edit->codigorete->style = 'width: 350px';
     $edit->codigorete->rel_id = 'gereten';
     $edit->codigorete->onchange = 'post_codigoreteselec(<#i#>,this.value)';
     $edit->base = new inputField('base', 'base_<#i#>');
     $edit->base->db_name = 'base';
     $edit->base->rule = 'max_length[10]|numeric|positive';
     $edit->base->css_class = 'inputnum';
     $edit->base->size = 12;
     $edit->base->rel_id = 'gereten';
     $edit->base->maxlength = 10;
     $edit->base->onkeyup = 'importerete(<#i#>)';
     $edit->base->showformat = 'decimal';
     $edit->porcen = new inputField('porcen', 'porcen_<#i#>');
     $edit->porcen->db_name = 'porcen';
     $edit->porcen->rule = 'max_length[5]|numeric|positive';
     $edit->porcen->css_class = 'inputnum';
     $edit->porcen->size = 7;
     $edit->porcen->rel_id = 'gereten';
     $edit->porcen->readonly = true;
     $edit->porcen->maxlength = 5;
     $edit->porcen->showformat = 'decimal';
     $edit->monto = new inputField('monto', 'monto_<#i#>');
     $edit->monto->db_name = 'monto';
     $edit->monto->rule = 'max_length[10]|numeric|positive';
     $edit->monto->css_class = 'inputnum';
     $edit->monto->rel_id = 'gereten';
     $edit->monto->size = 12;
     $edit->monto->readonly = true;
     $edit->monto->maxlength = 8;
     $edit->monto->showformat = 'decimal';
     //*****************************
     //Fin de campos para detalle
     //*****************************
     $edit->buttons('save', 'undo', 'delete', 'back', 'add_rel');
     $edit->build();
     //echo $edit->_dataobject->db->last_query();
     $smenu['link'] = barra_menu('518');
     $conten['form'] =& $edit;
     $data['content'] = $this->load->view('view_gsercol', $conten, true);
     $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true);
     $data['title'] = heading('Registro de Gastos o Nota de D&eacute;bito');
     $data['head'] = script('jquery.js') . script('jquery-ui.js') . script('plugins/jquery.numeric.pack.js') . script('plugins/jquery.meiomask.js') . style('redmond/jquery-ui-1.8.1.custom.css') . $this->rapyd->get_head() . phpscript('nformat.js') . script('plugins/jquery.floatnumber.js');
     $this->load->view('view_ventanas', $data);
 }
Beispiel #12
0
 function dataedit()
 {
     //$this->datasis->modulo_id(115,1);
     $this->rapyd->load('dataobject', 'datadetails');
     $modbus = array('tabla' => 'ppla', 'columnas' => array('codigo' => 'Codigo', 'denominacion' => 'Denominaci&oacute;n'), 'filtro' => array('codigo' => 'Codigo', 'denominacion' => 'Denominaci&oacute;n'), 'retornar' => array('codigo' => 'itcodigopres_<#i#>'), 'p_uri' => array(4 => '<#i#>'), 'where' => 'movimiento = "S" AND MID(codigo,1,1)="4"', 'script' => array('cal_nppla(<#i#>)'), 'titulo' => 'Busqueda de partidas', 'title' => 'Haz click aqui para abrir una ventana nueva con el modulo de busqueda avanzada para seleccionar una partida');
     $btn = $this->datasis->p_modbus($modbus, '<#i#>');
     $do = new DataObject("anoprox");
     $do->rel_one_to_many('itanoprox', 'itanoprox', array('numero' => 'numero'));
     $do->rel_pointer('itanoprox', 'ppla', 'ppla.codigo=itanoprox.codigopres', "ppla.denominacion as denomia");
     $do->order_by('itanoprox.codigopres');
     $msj = "ERROR: DEBE SOLUCIONAR LOS SIGUIENTES PROBLEMAS:</br>";
     if (!empty($do->error_message_ar['pre_ins'])) {
         $do->error_message_ar['pre_ins'] = $msj . $do->error_message_ar['pre_ins'];
     }
     if (!empty($do->error_message_ar['pre_upd'])) {
         $do->error_message_ar['pre_upd'] = $msj . $do->error_message_ar['pre_upd'];
     }
     $edit = new DataDetails($this->t**s, $do);
     $edit->back_url = site_url($this->url . "filteredgrid", "assas");
     $edit->set_rel_title('itanoprox', '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&uacute;mero", "numero");
     //$edit->numero->rule = "callback_chexiste";
     $edit->numero->mode = "autohide";
     $edit->numero->when = array('show', 'modify');
     $edit->responsable = new inputField("Responsable", "responsable");
     $edit->responsable->maxlenth = 249;
     $edit->responsable->tip = "Completar este campo con el Nombre y Apellido del responsable o Director de la Direcci&oacute;n.</br></br> Ejemplo:Juan Perez";
     $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', 'modify');
     //$edit->concepto = new textareaField("Concepto", 'concepto');
     //$edit->concepto->rows    = 1;
     //$edit->concepto->cols    = 80;
     //$edit->concepto->tip     = "Introduzca alg&uacute;n concepto de ser necesario. Este es muy &uacute;til cuando se hacen varias proyecciones de una misma dependencia.</br>Ejemplo:Esta lista es de prioridad uno &oacute; Esta pertenece al departamento X";
     $edit->uejecuta = new dropdownField("Direcci&oacute;n", "uejecuta");
     $edit->uejecuta->option("", "Seccionar");
     $edit->uejecuta->options("SELECT codigo,CONCAT(codigo,' ',nombre)a FROM uejecutora ORDER BY nombre");
     $edit->uejecuta->onchange = "get_uadmin();";
     $edit->uejecuta->rule = "required";
     $edit->uejecuta->tip = "Seleccione el nombre de la Direcci&oacute;n a la cual pertenece, haciendo click en la flecha del lado derecho del campo</br> Ejemplo: Direcci&oacute;n de Administraci&oacute;n";
     $edit->uejecuta->style = "width:500px";
     //$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->uadministra->tip      = "Seleccione el nombre de la unidad Administrativa de ser necesario haciendo click en la flecha del lado derecho del campo.</br>Ejemplo: Departamento de Compras";
     //************************** FIN   ENCABEZADO********************************************************************
     //**************************INICIO DETALLE DE ASIGNACIONES  *****************************************************
     $edit->itcodigoadm = new inputField("(<#o#>) Actividad", "itcodigoadm_<#i#>");
     $edit->itcodigoadm->rule = 'required';
     $edit->itcodigoadm->size = 2;
     $edit->itcodigoadm->db_name = 'codigoadm';
     $edit->itcodigoadm->rel_id = 'itanoprox';
     $edit->itcodigoadm->insertValue = "51";
     $edit->itcodigoadm->tip = "Trasncriba el numero de la actividad a la cual pertenece este item.</br></br>Ejemplo:52";
     $edit->itcodigopres = new inputField("(<#o#>) Partida", "itcodigopres_<#i#>");
     $edit->itcodigopres->rule = 'required|callback_itorden';
     $edit->itcodigopres->size = 12;
     $edit->itcodigopres->db_name = 'codigopres';
     $edit->itcodigopres->rel_id = 'itanoprox';
     $edit->itcodigopres->insertValue = "4.";
     $edit->itcodigopres->append($btn);
     $edit->itcodigopres->tip = "Trasncriba, Seleccione o Busque por medio de la Lupa, La partida a la cual corresponde el bien.</br></br>Ejemplo:4.03.03.03";
     $edit->itdenomia = new textareaField("(<#o#>)", "itdenomia_<#i#>");
     $edit->itdenomia->db_name = 'denomia';
     $edit->itdenomia->rel_id = 'itanoprox';
     $edit->itdenomia->pointer = true;
     $edit->itdenomia->cols = 15;
     $edit->itdenomia->rows = 2;
     $edit->itdenomia->readonly = true;
     $edit->itdenomia->tip = "Este campos es solo referencial, no debe de trancribir en el, el sistema lo har&aacute; automaticamente";
     $edit->itunidad = new dropdownField("(<#o#>) Unidad", "unidad_<#i#>");
     $edit->itunidad->db_name = 'unidad';
     $edit->itunidad->rule = 'required';
     $edit->itunidad->rel_id = 'itanoprox';
     $edit->itunidad->options("SELECT unidades AS id,unidades FROM unidad ORDER BY unidades");
     $edit->itunidad->style = "width:80px";
     $edit->itunidad->tip = "Seleccione la unidad de medida del bien.</br>Ejemplo: Unidad";
     $edit->itdescrip = new inputField("(<#o#>) Bien", "itdescrip_<#i#>");
     $edit->itdescrip->rule = 'required';
     $edit->itdescrip->size = 20;
     $edit->itdescrip->db_name = 'descrip';
     $edit->itdescrip->rel_id = 'itanoprox';
     $edit->itdescrip->tip = "Transcriba un nombre corto o referencial del bien</br></br>Ejemplo: Monitor";
     $edit->itdescripd = new textareaField("(<#o#>) Descripci&oacute;n Detallada", "itdescripd_<#i#>");
     $edit->itdescripd->rule = 'required';
     $edit->itdescripd->db_name = 'descripd';
     $edit->itdescripd->rel_id = 'itanoprox';
     $edit->itdescripd->cols = 25;
     $edit->itdescripd->rows = 2;
     $edit->itdescripd->tip = 'Transcriba la descripci&oacute;n detallada del bien.</br></br>Ejemplo: Monitor LCD 22 pulgadas con entrada de video para usar como TV';
     $edit->itcant = new inputField("(<#o#>) C&aacute;ntidad", "itcant_<#i#>");
     $edit->itcant->css_class = 'inputnum';
     $edit->itcant->rule = 'required|callback_positivo';
     $edit->itcant->size = 7;
     $edit->itcant->db_name = 'cant';
     $edit->itcant->rel_id = 'itanoprox';
     $edit->itcant->tip = "Transcriba la cantidad de elementos ha adquirir.</br>Ejemplo: 2";
     //$edit->itmontoa->mode      ="autohide";
     //************************** FIN   DETALLE DE ORDENES DEPAGO*****************************************************
     $status = $edit->get_from_dataobjetct('status');
     if ($status == 'H1') {
         $action = "javascript:window.location='" . site_url($this->url . 'termina/' . $edit->rapyd->uri->get_edited_id()) . "'";
         $edit->button_status("btn_add_anoprox", 'AGREGAR BIEN', "javascript:add_itanoprox()", "MB", 'modify', "button_add_rel");
         $edit->button_status("btn_add_anoprox", 'AGREGAR BIEN', "javascript:add_itanoprox()", "MB", 'create', "button_add_rel");
         $edit->button_status("btn_termina", 'Marcar Documento Como Terminado', $action, "TR", "show");
         $edit->buttons("modify", "save");
     } elseif ($status == 'H2') {
         $action = "javascript:btn_anular('" . $edit->rapyd->uri->get_edited_id() . "')";
         $edit->button_status("btn_anula", 'Anular', $action, "TR", "show");
     } else {
         $edit->button_status("btn_add_anoprox", 'AGREGAR BIEN', "javascript:add_itanoprox()", "MB", 'modify', "button_add_rel");
         $edit->button_status("btn_add_anoprox", 'AGREGAR BIEN', "javascript:add_itanoprox()", "MB", 'create', "button_add_rel");
     }
     $edit->buttons("save", "undo", "back");
     $edit->build();
     $smenu['link'] = barra_menu('10C');
     $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true);
     $conten["form"] =& $edit;
     $data['content'] = $this->load->view('view_anoprox', $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.meiomask.js') . script("plugins/jquery.numeric.pack.js") . script("plugins/jquery.json.min.js") . script('plugins/jquery.tooltip.js') . script('plugins/jquery.autocomplete.js') . style('jquery.autocomplete.css') . style('jquery.tooltip.css') . style('tooltip.css') . style('vino/jquery-ui.css');
     //
     $this->load->view('view_ventanas', $data);
 }
Beispiel #13
0
 function dataedit()
 {
     //$this->datasis->modulo_id(115,1);
     $this->rapyd->load('dataobject', 'datadetails');
     $modbus = array('tabla' => 'v_presaldo', 'columnas' => array('codigoadm' => 'Est. Admin', 'fondo' => 'Fondo', 'codigo' => 'Partida', 'ordinal' => 'Ordinal', 'denominacion' => 'Denominaci&oacute;n', 'saldo' => 'Saldo'), 'filtro' => array('codigoadm' => 'Est. Admin', 'fondo' => 'Fondo', 'codigo' => 'Partida', 'ordinal' => 'Ordinal', 'denominacion' => 'Partida'), 'retornar' => array('codigoadm' => 'codigoadm_<#i#>', 'fondo' => 'fondo_<#i#>', 'codigo' => 'codigopres_<#i#>', 'denominacion' => 'denomi_<#i#>'), 'p_uri' => array(4 => '<#i#>'), 'where' => 'movimiento = "S" AND saldo >0', 'titulo' => 'Busqueda de partidas');
     $btn = $this->datasis->p_modbus($modbus, '<#i#>');
     $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'C&oacute;odigo', 'nombre' => 'Nombre', 'rif' => 'Rif', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'C&oacute;digo', 'nombre' => 'Nombre', 'rif' => 'Rif'), 'p_uri' => array(4 => '<#i#>'), 'retornar' => array('proveed' => 'cod_prov_<#i#>', 'nombre' => 'nombre_<#i#>'), 'titulo' => 'Buscar Beneficiario');
     $bSPRV = $this->datasis->p_modbus($mSPRV, "<#i#>");
     $do = new DataObject("nomi");
     $do->rel_one_to_many('asignomi', 'asignomi', array('numero' => 'numero'));
     $do->rel_one_to_many('retenomi', 'retenomi', array('numero' => 'numero'));
     $do->rel_one_to_many('otrosnomi', 'otrosnomi', array('numero' => 'numero'));
     //$do->rel_pointer('asignomi','presupuesto' ,'presupuesto.codigoadm=presupuesto.codigoadm AND asignomi.fondo=presupuesto.tipo AND presupuesto.codigopres=presupuesto.codigopres ',"presupuesto.denominacion as denomi2");
     //$do->rel_pointer('asignomi','ppla' ,'asignomi.codigopres=ppla.codigo','ppla.denominacion as denomi2');
     //$do->rel_pointer('retenomi','sprv' ,'sprv.proveed=retenomi.cod_prov','sprv.nombre as nombrep');
     //$do->rel_pointer('','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");
     //$do->pointer('sprv' ,'sprv.proveed=desem.cod_prov','sprv.nombre as nombrep');
     //$do->rel_pointer('mbanc','mbanc' ,'mbanc.desem=desem.numero',"mbanc.tipo_doc as tipo_docp,mbanc.cheque as chequep,mbanc.fecha as fechap,mbanc.monto as montop,mbanc.observa as observap,mbanc.codbanc as codbancp,mbanc.status AS statusp");
     //$do->load(1);
     //print_r($do->_rel_pointer_data);
     //print_r($do->get_all());
     $edit = new DataDetails($this->t**s, $do);
     $edit->back_url = site_url($this->url . "filteredgrid");
     $edit->set_rel_title('pades', '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&uacute;mero", "numero");
     $edit->numero->rule = "callback_chexiste";
     $edit->numero->mode = "autohide";
     if ($this->datasis->traevalor('USANODIRECT') == 'S') {
         $edit->numero->when = array('show');
     } else {
         $edit->numero->when = array('show', 'create');
     }
     $edit->fecha = new dateonlyField("Fecha", "fecha");
     $edit->fecha->insertValue = date('Ymd');
     $edit->fecha->size = 12;
     if ($status == 'O') {
         $edit->fecha->mode = "autohide";
     }
     //}else
     //$edit->fecha->rule        = 'required|chfecha';
     $edit->descrip = new textareaField("Descripci&oacute;n", 'descrip');
     $edit->descrip->rows = 3;
     $edit->descrip->cols = 60;
     if ($status == 'O') {
         $edit->descrip->mode = "autohide";
     }
     $edit->asig = new inputField("Total Asignaciones", "asig");
     $edit->asig->size = 15;
     $edit->asig->readonly = true;
     $edit->asig->css_class = 'inputnum';
     if ($status == 'O') {
         $edit->asig->mode = "autohide";
     }
     $edit->rete = new inputField("Total Deducciones", "rete");
     $edit->rete->size = 15;
     $edit->rete->readonly = true;
     $edit->rete->css_class = 'inputnum';
     $edit->otros = new inputField("Total Otros", "otros");
     $edit->otros->size = 15;
     $edit->otros->readonly = true;
     $edit->otros->css_class = 'inputnum';
     //if($this->datasis->traevalor("USACERTICOMPRO")=='S'){
     $edit->compromiso = new inputField("Nro Compromiso", "compromiso");
     $edit->compromiso->size = 15;
     if ($status == 'O') {
         $edit->compromiso->mode = "autohide";
     }
     //}
     //************************** FIN   ENCABEZADO********************************************************************
     //**************************INICIO DETALLE DE ASIGNACIONES  *****************************************************
     $edit->itfondo = new dropdownField("F. Financiamiento", "fondo_<#i#>");
     $edit->itfondo->rule = 'required';
     $edit->itfondo->db_name = 'fondo';
     $edit->itfondo->rel_id = 'asignomi';
     $edit->itfondo->options("SELECT tipo,tipo a  FROM presupuesto WHERE tipo<>'' GROUP BY tipo ORDER BY tipo desc");
     $edit->itfondo->style = "width:100px;";
     if ($status == 'O') {
         $edit->itfondo = new inputField("F. Financiamiento", "fondo_<#i#>");
         $edit->itfondo->readonly = true;
         $edit->itfondo->rule = 'required';
         $edit->itfondo->db_name = 'fondo';
         $edit->itfondo->size = 10;
         $edit->itfondo->rel_id = 'asignomi';
     }
     $edit->itcodigoadm = new inputField("Estructura\tAdministrativa", "codigoadm_<#i#>");
     $edit->itcodigoadm->db_name = 'codigoadm';
     $edit->itcodigoadm->rel_id = 'asignomi';
     $edit->itcodigoadm->rule = 'required';
     $edit->itcodigoadm->size = 15;
     $edit->itcodigoadm->autocomplete = false;
     if ($status == 'O') {
         $edit->itcodigoadm->readonly = true;
     }
     //$edit->itcodigoadm->mode    ="autohide";
     $edit->itcodigopres = new inputField("(<#o#>) ", "codigopres_<#i#>");
     $edit->itcodigopres->rule = 'required';
     $edit->itcodigopres->size = 15;
     $edit->itcodigopres->db_name = 'codigopres';
     $edit->itcodigopres->rel_id = 'asignomi';
     $edit->itcodigopres->autocomplete = false;
     //$edit->itcodigopres->readonly =true;
     if ($status == 'O') {
         $edit->itcodigopres->readonly = true;
     } else {
         $edit->itcodigopres->append($btn);
     }
     //$edit->itcodigopres->mode    ="autohide";
     //if($status == 'D2' || $status == 'D3')$edit->itpago->mode     = "autohide";
     //$edit->itordinal= new inputField("(<#o#>) Ordinal","ordinal_<#i#>");
     ////$edit->itordinal->rule   ='required';
     //$edit->itordinal->db_name='ordinal';
     //$edit->itordinal->rel_id ='asignomi';
     //$edit->itordinal->size     =5;
     //if($status=='O' )
     //$edit->itordinal->readonly =true;
     ////$edit->itordinal->mode     ="autohide";
     $edit->itdenomi = new inputField("(<#o#>) Denominacion", "denomi_<#i#>");
     //$edit->itdenomi->rule   ='required';
     $edit->itdenomi->db_name = 'denominacion';
     $edit->itdenomi->rel_id = 'asignomi';
     //$edit->itdenomi->pointer  =true;
     $edit->itdenomi->size = 40;
     ///if($status=='O' )
     $edit->itdenomi->readonly = true;
     //$edit->itdenomi->mode     ="autohide";
     $edit->itmontoa = new inputField("(<#o#>) Monto", 'montoa_<#i#>');
     $edit->itmontoa->db_name = 'monto';
     //$edit->itmonto->mode      = 'autohide';
     //$edit->itmonto->when     = array('show');
     $edit->itmontoa->size = 15;
     $edit->itmontoa->rule = 'callback_positivo';
     $edit->itmontoa->rel_id = 'asignomi';
     $edit->itmontoa->css_class = 'inputnum';
     $edit->itmontoa->onchange = "cal_asig();";
     //$edit->itmontom->pointer = true;
     if ($status == 'O') {
         $edit->itmontoa->readonly = true;
     }
     //$edit->itmontoa->mode      ="autohide";
     //************************** FIN   DETALLE DE ORDENES DEPAGO*****************************************************
     //**************************INICIO DETALLE DE DE MOVIMIENTOS BANCARIOS*******************************************
     $edit->itcod_prov = new inputField("(<#o#>) Proveedor", "cod_prov_<#i#>");
     $edit->itcod_prov->rule = 'callback_cod_prov';
     //required|
     $edit->itcod_prov->size = 5;
     $edit->itcod_prov->append($bSPRV);
     $edit->itcod_prov->db_name = 'cod_prov';
     $edit->itcod_prov->rel_id = 'retenomi';
     $edit->itnombre = new inputField("(<#o#>)Nombre", 'nombre_<#i#>');
     $edit->itnombre->db_name = 'nombre';
     $edit->itnombre->size = 50;
     //$edit->itnombre->readonly = true;
     //$edit->itnombre->pointer  = true;
     $edit->itnombre->rel_id = 'retenomi';
     $edit->itmontor = new inputField("(<#o#>) Monto", 'montor_<#i#>');
     $edit->itmontor->db_name = 'monto';
     //$edit->itmonto->mode      = 'autohide';
     //$edit->itmonto->when     = array('show');
     $edit->itmontor->size = 15;
     $edit->itmontor->rule = 'callback_positivo';
     $edit->itmontor->rel_id = 'retenomi';
     $edit->itmontor->css_class = 'inputnum';
     $edit->itmontor->onchange = "cal_rete();";
     //$edit->itmontom->pointer = true;
     //**************************INICIO DETALLE APORTES *******************************************
     $edit->itcod_provo = new inputField("(<#o#>) Proveedor", "cod_provo_<#i#>");
     $edit->itcod_provo->rule = 'callback_cod_prov';
     //required|
     $edit->itcod_provo->size = 5;
     $edit->itcod_provo->append($bSPRV);
     $edit->itcod_provo->db_name = 'cod_prov';
     $edit->itcod_provo->rel_id = 'otrosnomi';
     $edit->itnombreo = new inputField("(<#o#>)Nombre", 'nombreo_<#i#>');
     $edit->itnombreo->db_name = 'nombre';
     $edit->itnombreo->size = 50;
     $edit->itnombreo->rel_id = 'otrosnomi';
     $edit->itmontoro = new inputField("(<#o#>) Monto", 'montoro_<#i#>');
     $edit->itmontoro->db_name = 'monto';
     $edit->itmontoro->size = 15;
     //$edit->itmontoro->rule      ='callback_positivo';
     $edit->itmontoro->rel_id = 'otrosnomi';
     $edit->itmontoro->css_class = 'inputnum';
     $edit->itmontor->onchange = "cal_otros();";
     //$edit->itmontom->pointer = true;
     //************************** FIN   DETALLE DE DE MOVIMIENTOS BANCARIOS*******************************************
     if ($status == 'P') {
         $edit->button_status("btn_add_asignomi", 'Agregar Asignacion', "javascript:add_asignomi()", "AS", 'modify');
         $edit->button_status("btn_add_asignomi2", 'Agregar Asignacion', "javascript:add_asignomi()", "AS", 'create');
         $action = "javascript:window.location='" . site_url($this->url . 'actualizar/' . $edit->rapyd->uri->get_edited_id()) . "'";
         if ($this->datasis->puede(195)) {
             $edit->button_status("btn_status", 'Comprometer', $action, "TR", "show");
         }
         if ($this->datasis->puede(188)) {
             $edit->buttons("modify", "save", "delete");
         }
     } elseif ($status == 'C') {
         $action = "javascript:window.location='" . site_url($this->url . 'reversar/' . $edit->rapyd->uri->get_edited_id()) . "'";
         if ($this->datasis->puede(195)) {
             $edit->button_status("btn_anular", 'Reversar Compromiso', $action, "TR", "show");
         }
     } elseif ($status == 'O') {
         if ($this->datasis->puede(188)) {
             $edit->buttons("modify", "save");
         }
     } elseif ($status == 'p') {
         if ($this->datasis->puede(188)) {
             $edit->buttons("modify", "save");
         }
     } else {
         $edit->buttons("save");
     }
     $edit->button_status("btn_add_asignomi", 'Agregar Asignacion', "javascript:add_asignomi()", "AS", 'modify');
     $edit->button_status("btn_add_asignomi2", 'Agregar Asignacion', "javascript:add_asignomi()", "AS", 'create');
     $edit->button_status("btn_add_retenomi", 'Agregar Deducciones', "javascript:add_retenomi()", "RE", "create");
     $edit->button_status("btn_add_retenomi2", 'Agregar Deducciones', "javascript:add_retenomi()", "RE", "modify");
     $edit->button_status("btn_add_otrosnomi", 'Agregar Otro Concepto', "javascript:add_otrosnomi()", "OT", "create");
     $edit->button_status("btn_add_otrosnomi2", 'Agregar Otro Concepto', "javascript:add_otrosnomi()", "OT", "modify");
     $edit->buttons("undo", "back");
     $edit->build();
     $data['status'] = $status;
     $smenu['link'] = barra_menu('40F');
     $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true);
     $conten["form"] =& $edit;
     $data['content'] = $this->load->view('view_nomi', $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);
 }
Beispiel #14
0
 function dataedit()
 {
     $this->rapyd->load('dataobject', 'datadetails');
     $tipo_rete = $this->datasis->traevalor('CONTRIBUYENTE');
     $rif = $this->datasis->traevalor('RIF');
     $fields = $this->db->field_data('gser');
     $url_pk = $this->uri->segment_array();
     $coun = 0;
     $pk = array();
     foreach ($fields as $field) {
         if ($field->primary_key == 1) {
             $coun++;
             $pk[] = $field->name;
         }
     }
     $values = array_slice($url_pk, -$coun);
     $claves = array_combine(array_reverse($pk), $values);
     $query = "UPDATE gitser AS a\n\t\t\tJOIN gser AS b on a.numero=b.numero and a.fecha = b.fecha and a.proveed = b.proveed\n\t\t\tSET a.idgser=b.id\n\t\t\tWHERE a.id=" . $claves['id'] . " ";
     $this->db->simple_query($query);
     $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'Coodigo', 'nombre' => 'Nombre', 'rif' => 'Rif'), 'filtro' => array('proveed' => 'Codigo', 'nombre' => 'Nombre'), 'retornar' => array('proveed' => 'proveed', 'nombre' => 'nombre', 'tipo' => 'sprvtipo', 'reteiva' => 'sprvreteiva'), 'script' => array('post_sprv_modbus()'), 'titulo' => 'Buscar Proveedor');
     $bSPRV = $this->datasis->modbus($mSPRV);
     $do = new DataObject('gser');
     $do->pointer('sprv', 'sprv.proveed=gser.proveed', 'sprv.tipo AS sprvtipo, sprv.reteiva AS sprvreteiva', 'left');
     $do->rel_one_to_many('gitser', 'gitser', array('id' => 'idgser'));
     $do->rel_one_to_many('gereten', 'gereten', array('id' => 'idd'));
     $do->where_rel_one_to_many('gereten', array('gereten.origen', 'GSER'));
     //$do->rel_pointer('rete','rete','gereten.codigorete=rete.codigo','rete.pama1 AS retepama1');
     $edit = new DataDetails('Gastos', $do);
     if ($edit->_status == 'show') {
         $edit->back_url = site_url('finanzas/gser/filteredgrid');
     } else {
         $edit->back_url = site_url('finanzas/gser/agregar');
     }
     $edit->set_rel_title('gitser', 'Gasto <#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->tipo_doc = new dropdownField('Documento', 'tipo_doc');
     $edit->tipo_doc->style = 'width:80px';
     $edit->tipo_doc->option('FC', 'Factura');
     $edit->tipo_doc->option('ND', 'N. Debito');
     if ($edit->_status == 'show') {
         $edit->tipo_doc->option('XX', 'Anulado');
         $edit->tipo_doc->option('AD', 'Amortizacion');
         $edit->tipo_doc->option('GA', 'Gasto de Nomina');
     }
     $edit->ffactura = new DateonlyField('Fecha', 'ffactura', 'd/m/Y');
     $edit->ffactura->insertValue = date('Y-m-d');
     $edit->ffactura->size = 12;
     $edit->ffactura->rule = 'required';
     $edit->ffactura->calendar = false;
     $edit->fecha = new DateonlyField('Registro', 'fecha');
     $edit->fecha->insertValue = date('Y-m-d');
     $edit->fecha->size = 12;
     $edit->fecha->rule = 'required';
     $edit->fecha->calendar = false;
     $edit->vence = new DateonlyField('Vence', 'vence', 'd/m/Y');
     $edit->vence->insertValue = date('Y-m-d');
     $edit->vence->size = 12;
     $edit->vence->calendar = false;
     $edit->compra = new inputField('Doc.Asociado', 'compra');
     $edit->compra->rule = 'max_length[8]';
     $edit->compra->size = 10;
     $edit->compra->maxlength = 8;
     $edit->afecta = new inputField('Doc.Afectado', 'afecta');
     $edit->afecta->rule = '';
     $edit->afecta->size = 10;
     $edit->numero = new inputField('Documento Nro.', 'serie');
     $edit->numero->size = 10;
     $edit->numero->maxlength = 12;
     $edit->numero->autocomplete = false;
     $edit->numero->rule = 'condi_required|callback_chnumero|callback_chdupli';
     $edit->proveed = new inputField('Proveedor', 'proveed');
     $edit->proveed->size = 6;
     $edit->proveed->append($bSPRV);
     $edit->proveed->rule = 'existesprv|required';
     $edit->tercero = new inputField('Facturado a nombre de Tercero', 'tercero');
     $edit->tercero->size = 6;
     //$edit->tercero->append($bSPRV);
     $edit->tercero->rule = '';
     $edit->reteter = new inputField('Ret IVA Bs', 'reteter');
     $edit->reteter->rule = 'numeric|positive';
     $edit->reteter->size = 10;
     $edit->reteter->maxlength = 10;
     $edit->reteter->css_class = 'inputnum';
     $edit->reteter->showformat = 'decimal';
     $edit->reteter->autocomplete = false;
     $edit->nfiscal = new inputField('Control Fiscal', 'nfiscal');
     $edit->nfiscal->size = 10;
     $edit->nfiscal->autocomplete = false;
     $edit->nfiscal->maxlength = 20;
     $edit->nombre = new inputField('Nombre', 'nombre');
     $edit->nombre->size = 30;
     $edit->nombre->maxlength = 40;
     $edit->nombre->type = 'inputhidden';
     $edit->nombre->rule = 'required';
     $edit->sprvtipo = new hiddenField('', 'sprvtipo');
     $edit->sprvtipo->db_name = 'sclitipo';
     $edit->sprvtipo->pointer = true;
     $edit->sprvreteiva = new hiddenField('', 'sprvreteiva');
     $edit->sprvreteiva->db_name = 'sprvreteiva';
     $edit->sprvreteiva->insertValue = $tipo_rete == 'ESPECIAL' && strtoupper($rif[0]) != 'V' ? '75' : '0';
     $edit->sprvreteiva->pointer = true;
     $edit->totpre = new inputField('Sub.Total', 'totpre');
     $edit->totpre->size = 10;
     $edit->totpre->css_class = 'inputnum';
     $edit->totpre->readonly = true;
     $edit->totpre->showformat = 'decimal';
     $edit->totpre->type = 'inputhidden';
     $edit->totbruto = new inputField('Total', 'totbruto');
     $edit->totbruto->size = 10;
     $edit->totbruto->css_class = 'inputnum';
     $edit->totbruto->showformat = 'decimal';
     $edit->totbruto->type = 'inputhidden';
     $edit->totiva = new inputField('Total IVA', 'totiva');
     $edit->totiva->css_class = 'inputnum';
     $edit->totiva->size = 10;
     $edit->totiva->showformat = 'decimal';
     $edit->totiva->type = 'inputhidden';
     $edit->reteica = new inputField('Ret. ICA', 'reteica');
     $edit->reteica->css_class = 'inputnum';
     $edit->reteica->when = array('show');
     $edit->reteica->size = 10;
     $edit->reteica->showformat = 'decimal';
     $edit->retesimple = new inputField('Ret', 'retesimple');
     $edit->retesimple->css_class = 'inputnum';
     $edit->retesimple->when = array('show');
     $edit->retesimple->size = 10;
     $edit->retesimple->showformat = 'decimal';
     $edit->codb1 = new dropdownField('Caja/Banco', 'codb1');
     $edit->codb1->option('', 'Ninguno');
     $edit->codb1->options("SELECT TRIM(codbanc) AS ind, CONCAT_WS('-',codbanc,banco) AS label FROM banc WHERE activo='S' AND codbanc<>'00' ORDER BY codbanc");
     $edit->codb1->rule = 'max_length[5]|callback_chcodb|condi_required';
     $edit->codb1->style = 'width:120px';
     $edit->codb1->onchange = "esbancaja(this.value)";
     $edit->fondo = new dropdownField('Fondo', 'fondo');
     $edit->fondo->option('', 'Ninguno');
     $edit->fondo->options("SELECT TRIM(codbanc) AS ind, CONCAT_WS('-',codbanc,banco) AS label FROM banc WHERE activo='S' AND codbanc<>'00' AND tbanco='FO' ORDER BY codbanc");
     $edit->fondo->style = 'width:160px';
     $edit->tipo1 = new dropdownField('Tipo', 'tipo1');
     $edit->tipo1->option('', 'Ninguno');
     $edit->tipo1->option('C', 'Cheque');
     $edit->tipo1->option('D', 'N.Debito');
     $edit->tipo1->rule = 'condi_required|callback_chtipoe';
     $edit->tipo1->style = 'width:70px';
     $edit->cheque1 = new inputField('N&uacute;mero', 'cheque1');
     $edit->cheque1->rule = 'condi_required|callback_chobliganumerog';
     $edit->cheque1->size = 12;
     $edit->cheque1->maxlength = 20;
     $edit->benefi = new inputField('Beneficiario', 'benefi');
     $edit->benefi->size = 39;
     $edit->benefi->maxlength = 40;
     $edit->monto1 = new inputField('Contado', 'monto1');
     $edit->monto1->rule = 'numeric|positive';
     $edit->monto1->size = 10;
     $edit->monto1->css_class = 'inputnum';
     $edit->monto1->onkeyup = 'contado()';
     $edit->monto1->rule = 'condi_required|callback_chmontocontado|positive';
     $edit->monto1->autocomplete = false;
     $edit->monto1->showformat = 'decimal';
     $edit->credito = new inputField('Monto a Cr&eacute;dito', 'credito');
     $edit->credito->rule = 'numeric|positive';
     $edit->credito->size = 10;
     $edit->credito->showformat = 'decimal';
     $edit->credito->css_class = 'inputnum';
     $edit->credito->onkeyup = 'ccredito()';
     $edit->credito->autocomplete = false;
     //$edit->credito->readonly=true;
     $edit->reten = new inputField('Ret. ISLR', 'reten');
     $edit->reten->rule = 'numeric|positive';
     $edit->reten->size = 10;
     $edit->reten->maxlength = 10;
     $edit->reten->css_class = 'inputnum';
     //$edit->reten->when=array('show');
     $edit->reten->showformat = 'decimal';
     $edit->reten->type = 'inputhidden';
     $edit->reteiva = new inputField('Ret de IVA', 'reteiva');
     $edit->reteiva->rule = 'numeric|positive';
     $edit->reteiva->size = 10;
     $edit->reteiva->maxlength = 10;
     $edit->reteiva->rule = 'callback_chreteiva';
     $edit->reteiva->onchange = 'totalizar()';
     $edit->reteiva->css_class = 'inputnum';
     $edit->reteiva->showformat = 'decimal';
     $edit->reteiva->autocomplete = false;
     //$edit->reteiva->onkeyup="reteiva()";
     $edit->cnd = new checkboxField('IVA Deducible', 'cnd', 'S', 'N');
     $edit->cnd->insertValue = 'S';
     $edit->reteica = new inputField('Ret. ICA', 'reteica');
     $edit->reteica->size = 10;
     $edit->reteica->maxlength = 10;
     //$edit->reteica->rule = 'callback_chreteiva';
     $edit->reteica->css_class = 'inputnum';
     $edit->reteica->when = array('show');
     $edit->totneto = new inputField('Monto Neto', 'totneto');
     $edit->totneto->rule = 'numeric|positive';
     $edit->totneto->size = 10;
     $edit->totneto->maxlength = 10;
     $edit->totneto->css_class = 'inputnum';
     $edit->totneto->readonly = true;
     $edit->totneto->showformat = 'decimal';
     //$edit->totneto->type='inputhidden';
     $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'));
     //**************************************************************
     //   Campos para el detalle 1
     //
     $edit->codigo = new inputField('Codigo <#o#>', 'codigo_<#i#>');
     $edit->codigo->size = 7;
     $edit->codigo->db_name = 'codigo';
     //$edit->codigo->append($btn);
     $edit->codigo->rule = 'required|existemgas';
     $edit->codigo->rel_id = 'gitser';
     $edit->descrip = new inputField('Descripcion <#o#>', 'descrip_<#i#>');
     $edit->descrip->size = 40;
     $edit->descrip->db_name = 'descrip';
     $edit->descrip->maxlength = 50;
     $edit->descrip->rel_id = 'gitser';
     $edit->precio = new inputField('Precio <#o#>', 'precio_<#i#>');
     $edit->precio->db_name = 'precio';
     $edit->precio->css_class = 'inputnum';
     $edit->precio->size = 10;
     $edit->precio->rule = 'required|positive';
     $edit->precio->rel_id = 'gitser';
     $edit->precio->autocomplete = false;
     $edit->precio->onkeyup = 'importe(<#i#>)';
     $edit->precio->showformat = 'decimal';
     $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 = 'gitser';
     $edit->tasaiva->onchange = 'importe(<#i#>)';
     $edit->iva = new inputField('importe <#o#>', 'iva_<#i#>');
     $edit->iva->db_name = 'iva';
     $edit->iva->css_class = 'inputnum';
     $edit->iva->rel_id = 'gitser';
     $edit->iva->size = 8;
     $edit->iva->rule = 'positive|callback_chretiva';
     $edit->iva->onkeyup = 'valida(<#i#>)';
     $edit->iva->showformat = 'decimal';
     $edit->iva->type = 'inputhidden';
     $edit->importe = new inputField('importe <#o#>', 'importe_<#i#>');
     $edit->importe->db_name = 'importe';
     $edit->importe->css_class = 'inputnum';
     $edit->importe->rel_id = 'gitser';
     $edit->importe->size = 10;
     $edit->importe->onkeyup = 'valida(<#i#>)';
     $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 IN ('G','A') ORDER BY depto");
     $edit->departa->db_name = 'departa';
     $edit->departa->rule = 'required';
     $edit->departa->style = 'width:70px';
     $edit->departa->rel_id = 'gitser';
     $edit->departa->onchange = "gdeparta(this.value)";
     $edit->sucursal = new dropdownField('Sucursal <#o#>', 'sucursal_<#i#>');
     $edit->sucursal->options("SELECT codigo,codigo AS sucursal FROM sucu ORDER BY codigo");
     $edit->sucursal->db_name = 'sucursal';
     $edit->sucursal->rule = 'required';
     $edit->sucursal->style = 'width:40px';
     $edit->sucursal->title = 'Sucursal';
     $edit->sucursal->rel_id = 'gitser';
     $edit->sucursal->onchange = "gsucursal(this.value)";
     $edit->cargo = new dropdownField('Cargo <#o#>', 'cargo_<#i#>');
     $edit->cargo->option('', 'Seleccionar');
     $edit->cargo->options("SELECT id, CONCAT(codigo,' ',nombre) nombre FROM usol WHERE activo='S' ORDER BY codigo");
     $edit->cargo->db_name = 'gcargo';
     $edit->cargo->style = 'width:50px';
     $edit->cargo->title = 'Cargo';
     $edit->cargo->rel_id = 'gitser';
     $edit->cargo->onchange = "gcargo(this.value)";
     //================= Fin de campos para detalle =================
     //**************************************************************
     //   Campos para el detalle reten
     //
     $edit->itorigen = new autoUpdateField('origen', 'GSER', 'GSER');
     $edit->itorigen->rel_id = 'gereten';
     $edit->codigorete = new dropdownField('', 'codigorete_<#i#>');
     $edit->codigorete->option('', 'Seleccionar');
     $edit->codigorete->options('SELECT TRIM(codigo) AS codigo,TRIM(CONCAT_WS("-",tipo,codigo,activida)) AS activida FROM rete ORDER BY tipo,codigo');
     $edit->codigorete->db_name = 'codigorete';
     $edit->codigorete->rule = 'max_length[4]';
     $edit->codigorete->style = 'width: 300px';
     $edit->codigorete->rel_id = 'gereten';
     $edit->codigorete->onchange = 'post_codigoreteselec(<#i#>,this.value)';
     $edit->base = new inputField('base', 'base_<#i#>');
     $edit->base->db_name = 'base';
     $edit->base->rule = 'max_length[10]|numeric|positive';
     $edit->base->css_class = 'inputnum';
     $edit->base->size = 12;
     $edit->base->autocomplete = false;
     $edit->base->rel_id = 'gereten';
     $edit->base->maxlength = 10;
     $edit->base->onkeyup = 'importerete(<#i#>)';
     $edit->base->showformat = 'decimal';
     $edit->porcen = new inputField('porcen', 'porcen_<#i#>');
     $edit->porcen->db_name = 'porcen';
     $edit->porcen->rule = 'max_length[5]|numeric|positive';
     $edit->porcen->css_class = 'inputnum';
     $edit->porcen->size = 7;
     $edit->porcen->rel_id = 'gereten';
     $edit->porcen->readonly = true;
     $edit->porcen->maxlength = 5;
     $edit->porcen->showformat = 'decimal';
     $edit->porcen->type = 'inputhidden';
     $edit->monto = new inputField('monto', 'monto_<#i#>');
     $edit->monto->db_name = 'monto';
     $edit->monto->rule = 'max_length[10]|numeric|positive';
     $edit->monto->css_class = 'inputnum';
     $edit->monto->rel_id = 'gereten';
     $edit->monto->size = 12;
     $edit->monto->readonly = true;
     $edit->monto->maxlength = 8;
     $edit->monto->showformat = 'decimal';
     $edit->monto->type = 'inputhidden';
     $edit->terceroi = new checkboxField('terceroi', 'terceroi_<#i#>', 'S', 'N');
     $edit->terceroi->insertValue = 'N';
     $edit->terceroi->rel_id = 'gereten';
     $edit->terceroi->db_name = 'tercero';
     //********************************
     // Fin de campos para detalle
     //
     $edit->buttons('add_rel');
     $edit->on_save_redirect = false;
     $edit->build();
     if ($edit->on_success()) {
         $rt = array('status' => 'A', 'mensaje' => 'Registro guardado', 'pk' => $edit->_dataobject->pk);
         echo json_encode($rt);
     } else {
         if ($this->genesal) {
             $conten['form'] =& $edit;
             $conten['solo'] = $this->solo;
             $data['content'] = $this->load->view('view_gser', $conten);
         } else {
             $rt = array('status' => 'B', 'mensaje' => html_entity_decode($edit->error_string), 'pk' => '');
             echo json_encode($rt);
         }
     }
 }
Beispiel #15
0
    function dataedit()
    {
        $this->rapyd->load('dataobject', 'datadetails');
        $modbusSinv = array('tabla' => 'sinv', 'columnas' => array('codigo' => 'C&oacute;digo', 'descrip' => 'Descripci&oacute;n'), 'filtro' => array('codigo' => 'C&oacute;digo', 'descrip' => 'Descripci&oacute;n'), 'retornar' => array('codigo' => 'codigo_<#i#>', 'descrip' => 'descrip_<#i#>'), 'p_uri' => array(4 => '<#i#>'), 'titulo' => 'Buscar Articulo', 'where' => '`activo` = "S" AND `tipo` = "Articulo"');
        //$boton=$this->datasis->p_modbus($modbusSinv,'<#i#>');
        $modbus = array('tabla' => 'sfac', 'columnas' => array('numero' => 'N&uacute;mero', 'fecha' => 'Fecha', 'cod_cli' => 'Cliente', 'rifci' => 'Rif', 'nombre' => 'Nombre', 'tipo_doc' => 'Tipo'), 'filtro' => array('numero' => 'N&uacute;mero', 'cod_cli' => 'Cliente', 'rifci' => 'Rif', 'nombre' => 'Nombre'), 'where' => 'tipo_doc = "F" and mid(numero,1,1) <> "_"', 'retornar' => array('numero' => 'factura', 'fecha' => 'fechafa', 'cod_cli' => 'cod_cli', 'nombre' => 'nombre'), 'titulo' => 'Buscar Factura');
        //$btn=$this->datasis->modbus($modbus);
        $do = new DataObject('snot');
        $do->rel_one_to_many('itsnot', 'itsnot', 'numero');
        $do->rel_pointer('itsnot', 'sinv', 'itsnot.codigo=sinv.codigo', 'sinv.descrip AS sinvdescrip', 'sinv.ultimo AS sinvultimo');
        $edit = new DataDetails('Nota de Entrega', $do);
        $edit->on_save_redirect = false;
        $edit->set_rel_title('itsnot', 'Producto <#o#>');
        $script = '
		$(function() {
			$("#fecha").datepicker({dateFormat:"dd/mm/yy"});
			$("#fechafa").datepicker({dateFormat:"dd/mm/yy"});
		});		';
        $edit->script($script, 'create');
        $edit->script($script, 'modify');
        $edit->pre_process('insert', '_pre_insert');
        $edit->pre_process('delete', '_pre_delete');
        $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|chfecha';
        $edit->fecha->mode = 'autohide';
        $edit->fecha->calendar = false;
        $edit->fecha->size = 10;
        $edit->numero = new inputField('N&uacute;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->tipo = new dropdownField('Tipo', 'tipo');
        $edit->tipo->option('E', 'Entrega');
        $edit->tipo->option('D', 'Devoluci&oacute;n');
        $edit->tipo->style = 'width:140px;';
        $edit->tipo->size = 5;
        $edit->tipo->rule = 'required|enum[D,E]';
        $edit->tipo->insertValue = 'E';
        $edit->fechafa = new DateonlyField('Fecha Factura', 'fechafa', 'd/m/Y');
        $edit->fechafa->rule = 'required|chfecha';
        $edit->fechafa->mode = 'autohide';
        $edit->fechafa->calendar = false;
        $edit->fechafa->size = 10;
        $edit->fechafa->type = 'inputhidden';
        $edit->factura = new inputField('Factura', 'factura');
        $edit->factura->size = 10;
        $edit->factura->mode = 'autohide';
        $edit->factura->maxlength = 8;
        $edit->factura->rule = 'required|existefac|callback_chsnte';
        //$edit->factura->append($btn);
        $edit->peso = new inputField('Peso', 'peso');
        $edit->peso->css_class = 'inputnum';
        $edit->peso->readonly = true;
        $edit->peso->size = 10;
        $edit->peso->type = 'inputhidden';
        $edit->cliente = new inputField('Cliente', 'cod_cli');
        $edit->cliente->size = 6;
        $edit->cliente->maxlength = 5;
        $edit->cliente->type = 'inputhidden';
        $edit->cliente->rule = 'required|callback_chsclifa';
        $edit->nombre = new inputField('Nombre', 'nombre');
        $edit->nombre->size = 25;
        $edit->nombre->maxlength = 40;
        $edit->nombre->autocomplete = false;
        $edit->nombre->rule = 'required';
        $edit->nombre->type = 'inputhidden';
        $edit->observa1 = new inputField('Observaciones', 'observ1');
        $edit->observa1->size = 40;
        $edit->observa1->maxlength = 80;
        //**************************
        //  Campos para el detalle
        //**************************
        $edit->codigo = new inputField('C&oacute;digo', 'codigo_<#i#>');
        $edit->codigo->size = 12;
        $edit->codigo->db_name = 'codigo';
        $edit->codigo->readonly = true;
        $edit->codigo->rel_id = 'itsnot';
        $edit->codigo->rule = 'required|existesinv|callback_chrepetidos';
        $edit->codigo->type = 'inputhidden';
        //$edit->codigo->append($boton);
        $edit->descrip = new inputField('Descripci&oacute;n', 'descrip_<#i#>');
        $edit->descrip->size = 36;
        $edit->descrip->db_name = 'descrip';
        $edit->descrip->maxlength = 50;
        $edit->descrip->readonly = true;
        $edit->descrip->rel_id = 'itsnot';
        $edit->descrip->type = 'inputhidden';
        $edit->cant = new inputField('Cantidad', 'cant_<#i#>');
        $edit->cant->db_name = 'cant';
        $edit->cant->css_class = 'inputnum';
        $edit->cant->rel_id = 'itsnot';
        $edit->cant->maxlength = 10;
        $edit->cant->size = 6;
        $edit->cant->rule = 'required|positive|numeric';
        $edit->cant->type = 'inputhidden';
        $edit->cant->showformat = 'decimal';
        $edit->cant->autocomplete = false;
        $edit->saldo = new inputField('Saldo', 'saldo_<#i#>');
        $edit->saldo->db_name = 'saldo';
        $edit->saldo->css_class = 'inputnum';
        $edit->saldo->rel_id = 'itsnot';
        $edit->saldo->maxlength = 10;
        $edit->saldo->size = 6;
        $edit->saldo->showformat = 'decimal';
        $edit->saldo->rule = 'required|positive|numeric';
        $edit->saldo->type = 'inputhidden';
        $edit->saldo->autocomplete = false;
        $edit->entrega = new inputField('Entrega', 'entrega_<#i#>');
        $edit->entrega->db_name = 'entrega';
        $edit->entrega->css_class = 'inputnum';
        $edit->entrega->rel_id = 'itsnot';
        $edit->entrega->maxlength = 10;
        $edit->entrega->size = 6;
        $edit->entrega->rule = 'positive|numeric|callback_chitems[<#i#>]';
        $edit->entrega->showformat = 'decimal';
        $edit->entrega->autocomplete = false;
        //$edit->itfactura = new inputField('Factura <#o#>', 'itfactura_<#i#>');
        //$edit->itfactura->size     = 12;
        //$edit->itfactura->db_name  = 'factura';
        //$edit->itfactura->readonly = true;
        //$edit->itfactura->rel_id   = 'itsnot';
        //**************************
        //fin de campos para detalle
        //**************************
        $edit->hora = new autoUpdateField('hora', date('Hi'), date('Hi'));
        $edit->estampa = new autoUpdateField('estampa', date('Ymd'), date('Ymd'));
        $edit->usuario = new autoUpdateField('usuario', $this->session->userdata('usuario'), $this->session->userdata('usuario'));
        //$edit->buttons('save', 'undo', 'delete', '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;
            $data['content'] = $this->load->view('view_snot', $conten);
        }
    }
Beispiel #16
0
    function dataedit()
    {
        $this->rapyd->load('dataobject', 'datadetails');
        $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'C&oacute;odigo', 'nombre' => 'Nombre', 'rif' => 'Rif', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'C&oacute;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&uacute;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&oacute;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);
    }
Beispiel #17
0
 function dataedit()
 {
     $this->rapyd->load('dataobject', 'datadetails');
     $modbus = array('tabla' => 'sinv', 'columnas' => array('codigo' => 'C&oacute;digo', 'descrip' => 'Descripci&oacute;n', 'precio1' => 'Precio 1', 'precio2' => 'Precio 2', 'precio3' => 'Precio 3', 'existen' => 'Existencia'), 'filtro' => array('codigo' => 'C&oacute;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&oacute;digo Cliente', 'nombre' => 'Nombre', 'cirepre' => 'Rif/Cedula', 'dire11' => 'Direcci&oacute;n', 'tipo' => 'Tipo'), 'filtro' => array('cliente' => 'C&oacute;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&uacute;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&eacute;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&oacute;n', 'observa');
     $edit->observa->size = 37;
     $edit->dir_cli = new inputField('Direcci&oacute;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&oacute;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&oacute;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);
     }
 }
Beispiel #18
0
 function dataedit()
 {
     //$this->datasis->modulo_id(101,1);
     $this->rapyd->load('dataobject', 'dataedit');
     $mOCOMPRA = array('tabla' => 'ocompra', 'columnas' => array('numero' => 'N&uacute;mero', 'tipo' => 'Tipo', 'uejecutora' => 'uejecutora', 'cod_prov' => 'Beneficiario'), 'filtro' => array('numero' => 'N&uacute;mero', 'tipo' => 'Tipo', 'uejecutora' => 'uejecutora', 'cod_prov' => 'Beneficiario'), 'retornar' => array('numero' => 'compra', 'tipo' => 'tipo', 'uejecutora' => 'uejecutora', 'cod_prov' => 'cod_prov', 'fechafac' => 'fechafac', 'factura' => 'factura', 'controlfac' => 'controlfac', 'total' => 'ototal', 'abonado' => 'oabonado'), 'where' => 'total > abonado', 'titulo' => 'Buscar Ordenes de Compra');
     $pOCOMPRA = $this->datasis->p_modbus($mOCOMPRA, "ocompra");
     $do = new DataObject("odirect");
     $do->rel_one_to_many('pacom', 'pacom', array('numero' => 'pago'));
     $edit = new DataDetails($this->t**s, $do);
     $edit->back_url = site_url($this->url . "filteredgrid");
     $edit->set_rel_title('pago', 'Rubro <#o#>');
     //$edit->pre_process('update'   ,'_valida');
     //$edit->pre_process( 'insert'  ,'_valida');
     //$edit->post_process('insert'  ,'_post');
     //$edit->post_process('update'  ,'_post');
     $edit->id = new inputField("N&uacute;mero", "id");
     $edit->id->mode = "autohide";
     $edit->id->when = array('show');
     $edit->id->group = "Pago";
     $edit->itcompra = new inputField("(<#o#>) Numero O. Compra", "compra_<#i#>");
     $edit->itcompra->append($bOCOMPRA);
     $edit->itcompra->rel_id = 'pacom';
     $edit->factura = new inputField("Factura", "factura");
     $edit->factura->mode = "autohide";
     $edit->factura->group = "Orden De Compra";
     $edit->controlfac = new inputField("Control Fiscal", "controlfac");
     $edit->controlfac->mode = "autohide";
     $edit->controlfac->group = "Orden De Compra";
     $edit->fechafac = new inputField("Fecha Causaci&oacute;n", "fechafac");
     $edit->fechafac->mode = "autohide";
     $edit->fechafac->group = "Orden De Compra";
     $edit->tipo = new inputField("Orden de", "tipo");
     $edit->tipo->mode = "autohide";
     $edit->tipo->group = "Orden De Compra";
     $edit->uejecutora = new inputField("Unidad Ejecutora", "uejecutora");
     $edit->uejecutora->mode = "autohide";
     $edit->uejecutora->group = "Orden De Compra";
     $edit->cod_prov = new inputField("Beneficiario", 'cod_prov');
     $edit->cod_prov->size = 6;
     $edit->cod_prov->group = "Orden De Compra";
     $edit->cod_prov->mode = "autohide";
     $edit->oabonado = new inputField("Abonado", 'oabonado');
     $edit->oabonado->db_name = ' ';
     $edit->oabonado->size = 8;
     $edit->oabonado->mode = "autohide";
     $edit->oabonado->group = "Orden De Compra";
     $edit->oabonado->when = array('create');
     $edit->ototal = new inputField("Total O. Compra", 'ototal');
     $edit->ototal->db_name = ' ';
     $edit->ototal->size = 8;
     $edit->ototal->mode = "autohide";
     $edit->ototal->group = "Orden De Compra";
     $edit->ototal->when = array('create');
     $edit->fecha = new dateonlyField("Fecha de Pago", "fecha");
     $edit->fecha->insertValue = date('Y-m-d');
     $edit->fecha->size = 12;
     $edit->fecha->rule = "required";
     $edit->fecha->group = "Pago";
     $edit->pago = new inputField("Pagar", 'pago');
     $edit->pago->size = 8;
     $edit->pago->mode = "autohide";
     $edit->pago->group = "Pago";
     $n = $edit->_dataobject->get('numero');
     $status = $edit->_dataobject->get("status");
     if ($status == 'T') {
         //$action = "javascript:window.location='" .site_url($this->url.'actualizar/'.$edit->rapyd->uri->get_edited_id()). "'";
         //$action = "javascript:window.location='" .site_url($this->url.'actualizar/'.$n)."'";
         //$edit->button_status("btn_status",'Ordenar Pago',$action,"TR","show");
         $edit->buttons("modify", "save");
     } elseif ($status == 'O') {
         $action = "javascript:window.location='" . site_url($this->url . 'reversar/' . $edit->rapyd->uri->get_edited_id()) . "'";
         //$action = "javascript:window.location='" .site_url($this->url.'reversar/'.$n). "'";
         $edit->button_status("btn_rever", 'Deshacer Ordenar Pago', $action, "TR", "show");
     } else {
         $edit->buttons("save");
     }
     $edit->buttons("undo", "back");
     $edit->build();
     $data['content'] = $edit->output;
     $data['title'] = " {$this->t**s} ";
     //$data['content'] = $edit->output;
     //$data['title']   = " $this->t**s ";
     $data["head"] = script("jquery.pack.js") . script("plugins/jquery.numeric.pack.js") . script("plugins/jquery.floatnumber.js") . $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
Beispiel #19
0
 function dataedit($status = '', $numero = '')
 {
     $this->datasis->modulo_id(102, 1);
     $this->rapyd->load('dataobject', 'datadetails');
     $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'C&oacute;odigo', 'nombre' => 'Nombre', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'C&oacute;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&oacute;odigo', 'tipo' => 'Tipo', 'uejecutora' => 'U. Ejecutora', 'cod_prov' => 'Beneficiario', 'beneficiario' => 'Beneficiario'), 'filtro' => array('numero' => 'C&oacute;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&oacute;digo', 'denominacion' => 'Denominaci&oacute;n'), 'filtro' => array('codigo' => 'C&oacute;digo', 'denominacion' => 'Denominaci&oacute;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&uacute;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&oacute;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&oacute;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);
 }
Beispiel #20
0
 function dataedit()
 {
     $this->rapyd->load('dataobject', 'datadetails');
     $modbus = array('tabla' => 'sinv', 'columnas' => array('codigo' => 'C&oacute;digo', 'descrip' => 'Descripci&oacute;n', 'precio1' => 'Precio 1', 'precio2' => 'Precio 2', 'precio3' => 'Precio 3', 'existen' => 'Existencia'), 'filtro' => array('codigo' => 'C&oacute;digo', 'descrip' => 'Descripci&oacute;n'), 'retornar' => array('codigo' => 'codigoa_<#i#>', 'descrip' => 'desca_<#i#>'), 'p_uri' => array(4 => '<#i#>'), 'titulo' => 'Buscar Art&iacute;culo', 'where' => '`activo` = "S"');
     $btn = $this->datasis->p_modbus($modbus, '<#i#>');
     $mSCLId = array('tabla' => 'scli', 'columnas' => array('cliente' => 'C&oacute;digo Cliente', 'nombre' => 'Nombre', 'cirepre' => 'Rif/Cedula', 'dire11' => 'Direcci&oacute;n', 'tipo' => 'Tipo'), 'filtro' => array('cliente' => 'C&oacute;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&oacute;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&uacute;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&oacute;n', 'direc');
     $edit->direc->size = 40;
     //**************************
     //  Campos para el detalle 1 sitems
     //**************************
     $edit->codigoa = new inputField('C&oacute;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&oacute;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);
 }
Beispiel #21
0
 function dataedit()
 {
     //$this->datasis->modulo_id(70,1);
     $this->rapyd->load('dataobject', 'datadetails');
     $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'C&oacute;odigo', 'rif' => 'RIF', 'nombre' => 'Nombre', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'C&oacute;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&uacute;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&oacute;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);
 }
Beispiel #22
0
 function dataedit()
 {
     $this->rapyd->load('dataobject', 'datadetails');
     $modbus = array('tabla' => 'sumi', 'columnas' => array('codigo' => 'C&oacute;digo', 'descrip' => 'Descripcion', 'unidad' => 'Unidad'), 'filtro' => array('codigo' => 'C&oacute;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&oacute;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&uacute;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&oacute;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&oacute;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&oacute;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);
 }
Beispiel #23
0
 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&oacute;digo', 'denominacion' => 'Denominaci&oacute;n'), 'filtro' => array('codigo' => 'C&oacute;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&uacute;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);
 }
Beispiel #24
0
 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&oacute;digo', 'descrip' => 'Descripci&oacute;n', 'precio1' => 'Precio 1', 'precio2' => 'Precio 2', 'precio3' => 'Precio 3', 'existen' => 'Existencia'), 'filtro' => array('codigo' => 'C&oacute;digo', 'descrip' => 'Descripci&oacute;n'), 'p_uri' => array(4 => '<#i#>'), 'where' => '`activo` = "S" AND `tipo` = "Articulo"', 'script' => array('post_modbus_sinv(<#i#>)'), 'titulo' => 'Buscar Art&iacute;culo');
     if ($opttipo == 'C') {
         $mCLIPRO = array('tabla' => 'scli', 'columnas' => array('cliente' => 'C&oacute;digo Cliente', 'nombre' => 'Nombre', 'cirepre' => 'Rif/Cedula', 'dire11' => 'Direcci&oacute;n', 'tipo' => 'Tipo'), 'filtro' => array('cliente' => 'C&oacute;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&oacute;digo Proveedor', 'nombre' => 'Nombre', 'direc1' => 'Direcci&oacute;n', 'rif' => 'RIF'), 'filtro' => array('proveed' => 'C&oacute;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&oacute;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&uacute;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&oacute;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&eacute;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&oacute;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&oacute;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&oacute;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&oacute;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&oacute;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);
     }
 }
Beispiel #25
0
 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&oacute;digo', 'descrip' => 'Descripci&oacute;n', 'precio1' => 'Precio 1', 'precio2' => 'Precio 2', 'precio3' => 'Precio 3', 'existen' => 'Existencia'), 'filtro' => array('codigo' => 'C&oacute;digo', 'descrip' => 'Descripci&oacute;n'), 'p_uri' => array(4 => '<#i#>'), 'where' => '`activo` = "S" AND `tipo` = "Articulo"', 'script' => array('post_modbus_sinv(<#i#>)'), 'titulo' => 'Buscar Art&iacute;culo');
     if ($opttipo == 'scli') {
         $mCLIPRO = array('tabla' => 'scli', 'columnas' => array('cliente' => 'C&oacute;digo Cliente', 'nombre' => 'Nombre', 'cirepre' => 'Rif/Cedula', 'dire11' => 'Direcci&oacute;n', 'tipo' => 'Tipo'), 'filtro' => array('cliente' => 'C&oacute;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&oacute;digo Proveedor', 'nombre' => 'Nombre', 'direc1' => 'Direcci&oacute;n', 'rif' => 'RIF'), 'filtro' => array('proveed' => 'C&oacute;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&oacute;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&uacute;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&eacute;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&oacute;n", "observa");
     $edit->observa->size = 37;
     $edit->dir_clipro = new inputField("Direcci&oacute;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&oacute;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&oacute;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&oacute;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&oacute;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);
 }
Beispiel #26
0
 function dataedit()
 {
     //$this->datasis->modulo_id(101,1);
     $this->rapyd->load('dataobject', 'datadetails');
     $modbus = array('tabla' => 'v_presaldo', 'columnas' => array('codigo' => 'C&oacute;digo', 'denominacion' => 'Denominaci&oacute;n', 'saldo' => 'Saldo'), 'filtro' => array('codigo' => 'C&oacute;digo', 'denominacion' => 'Denominaci&oacute;n'), 'retornar' => array('codigo' => 'partida_<#i#>', 'denominacion' => 'denomi_<#i#>'), 'p_uri' => array(4 => '<#i#>', 5 => '<#fondo#>', 6 => '<#estadmin#>'), 'where' => 'fondo=<#fondo#> AND codigoadm=<#estadmin#> AND LENGTH(codigo)=' . $this->flongpres, 'titulo' => 'Busqueda de partidas');
     $btn = $this->datasis->p_modbus($modbus, '<#i#>/<#fondo#>/<#estadmin#>');
     $do = new DataObject("pmov");
     $do->rel_one_to_many($this->id_rel, 'itpmov', array('numero' => 'numero'));
     $edit = new DataDetails($this->t**s, $do);
     $edit->back_url = site_url($this->url . "/filteredgrid");
     $edit->set_rel_title($this->id_rel, 'Rubro <#o#>');
     //$edit->pre_process('insert'  ,'_valida');
     //$edit->pre_process('update'  ,'_valida');
     //$edit->post_process('insert'  ,'_paiva');
     //$edit->post_process('update'  ,'_paiva');
     $edit->numero = new inputField("N&uacute;mero", "numero");
     $edit->numero->mode = "autohide";
     $edit->numero->when = array('show');
     $edit->fecha = new dateonlyField("Fecha", "fecha");
     $edit->fecha->insertValue = date('Y-m-d');
     $edit->fecha->size = 12;
     $edit->estadmin = new dropdownField("Estructura Administrativa", "estadmin");
     $edit->estadmin->option("", "Seleccione");
     $edit->estadmin->rule = 'required';
     $edit->estadmin->options("SELECT b.codigo, CONCAT_WS(' ',b.codigo,b.denominacion) AS val FROM presupuesto AS a JOIN estruadm AS b ON a.codigoadm=b.codigo  GROUP BY b.codigo");
     $edit->fondo = new dropdownField("Fondo", "fondo");
     $edit->fondo->rule = "required";
     $estadmin = $edit->getval('estadmin');
     if ($estadmin !== false) {
         $edit->fondo->options("SELECT tipo,tipo a  FROM presupuesto WHERE codigoadm='{$estadmin}' GROUP BY tipo");
     } else {
         $edit->fondo->option("", "Seleccione una estructura administrativa primero");
     }
     $edit->observa = new textAreaField("Observaciones", 'observa');
     $edit->observa->cols = 80;
     $edit->observa->rows = 3;
     $edit->monto = new inputField("Total", 'monto');
     $edit->monto->css_class = 'inputnum';
     $edit->monto->size = 10;
     $edit->itpartida = new inputField("(<#o#>) Partida", "partida_<#i#>");
     $edit->itpartida->rule = 'callback_repetido|required|callback_itpartida';
     $edit->itpartida->size = 15;
     $edit->itpartida->db_name = 'partida';
     $edit->itpartida->rel_id = $this->id_rel;
     //$edit->itpartida->readonly  = true;
     $edit->itpartida->append('<img src="/tortuga/assets/default/images/system-search.png"  alt="Busqueda de partidas" title="Busqueda de partidas" border="0" onclick="modbusdepen(<#i#>)"/>');
     $edit->itdenomi = new inputField("(<#o#>) Denominaci&oacute;n", "denomi_<#i#>");
     $edit->itdenomi->db_name = 'denomi';
     $edit->itdenomi->maxlength = 250;
     $edit->itdenomi->size = 40;
     //$edit->itdenomi->rule     = 'required';
     $edit->itdenomi->rel_id = $this->id_rel;
     $edit->itmonto = new inputField("(<#o#>) Monto", "monto_<#i#>");
     $edit->itmonto->css_class = 'inputnum';
     $edit->itmonto->db_name = 'monto';
     $edit->itmonto->rel_id = $this->id_rel;
     $edit->itmonto->rule = 'numeric';
     $edit->itmonto->size = 8;
     $edit->itmonto->onchange = 'cal_total(<#i#>);';
     $status = $edit->get_from_dataobjetct('status');
     if ($status == 'C') {
         $action = "javascript:window.location='" . site_url($this->url . 'actualizar/' . $edit->rapyd->uri->get_edited_id()) . "'";
         $edit->button_status("btn_status", 'Actualizar', $action, "TR", "show");
         $edit->buttons("modify", "save");
     } elseif ($status == 'T') {
         $action = "javascript:window.location='" . site_url($this->url . 'reversar/' . $edit->rapyd->uri->get_edited_id()) . "'";
         $edit->button_status("btn_rever", 'Reversar', $action, "TR", "show");
     } else {
         $edit->buttons("save");
     }
     $edit->buttons("undo", "back", "add_rel");
     $edit->build();
     $smenu['link'] = barra_menu('101');
     $data['smenu'] = $this->load->view('view_sub_menu', $smenu, true);
     $conten["form"] =& $edit;
     $data['content'] = $this->load->view('view_pmov2', $conten, true);
     //$data['content'] = $edit->output;
     $data['title'] = " {$this->t**s} ";
     $data["head"] = $this->rapyd->get_head() . script('jquery.js') . script("plugins/jquery.numeric.pack.js") . script("plugins/jquery.json.min.js");
     $this->load->view('view_ventanas', $data);
 }
 function dataedit($status = '', $numero = '')
 {
     //$this->datasis->modulo_id(116,1);
     $this->rapyd->load('dataobject', 'datadetails');
     $mSPRV = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'C&oacute;odigo', 'nombre' => 'Nombre', 'rif' => 'Rif', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'C&oacute;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&uacute;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&oacute;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&oacute;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&oacute;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);
 }
Beispiel #28
0
 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&oacute;odigo', 'fondo' => 'Clasificacion', 'banco' => 'Banco', 'saldo' => 'Saldo', 'numcuent' => 'Cuenta'), 'filtro' => array('codbanc' => 'C&oacute;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&oacute;odigo', 'nombre' => 'Nombre', 'rif' => 'Rif', 'contacto' => 'Contacto'), 'filtro' => array('proveed' => 'C&oacute;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&uacute;mero', 'fondo' => 'F. Financiamiento', 'fecha' => 'Fecha', 'cod_prov' => 'Codigo', 'nombre' => 'Beneficiario', 'total2' => 'Total'), 'filtro' => array('numero' => 'N&uacute;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&uacute;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&eacute;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);
 }
Beispiel #29
0
 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&oacute;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&oacute;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&oacute;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&uacute;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&oacute;n', 'direc');
     $edit->direc->readonly = true;
     $edit->direc->size = 40;
     //***********************************
     //  Campos para el detalle 1 sitems
     //***********************************
     $edit->codigoa = new inputField('C&oacute;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&oacute;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);
     */
 }
Beispiel #30
0
 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&oacute;digo', 'descrip' => 'Descripci&oacute;n', 'precio1' => 'Precio 1', 'precio2' => 'Precio 2', 'precio3' => 'Precio 3', 'existen' => 'Existencia', 'peso' => 'Peso'), 'filtro' => array('codigo' => 'C&oacute;digo', 'descrip' => 'Descripci&oacute;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&uacute;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&oacute;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&oacute;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&oacute;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&oacute;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&oacute;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&oacute;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;
     }
 }