function dataeditdialog() { $this->rapyd->load('dataedit'); $edit = new DataEdit('', 'scli'); $edit->on_save_redirect = false; $edit->cid = 'sclidialog'; $edit->pre_process('delete', '_pre_del'); $edit->pre_process('insert', '_pre_ins'); $edit->pre_process('update', '_pre_udp'); $edit->post_process('insert', '_post_insert'); $edit->post_process('update', '_post_update'); $edit->post_process('delete', '_post_delete'); $edit->rifci = new inputField('RIF/CI', 'sclidialogrifci'); $edit->rifci->db_name = 'rifci'; $edit->rifci->rule = 'trim|strtoupper|required|callback_chci'; $edit->rifci->maxlength = 13; $edit->rifci->size = 13; $edit->nombre = new inputField('Nombre', 'sclidialognombre'); $edit->nombre->db_name = 'nombre'; $edit->nombre->rule = 'trim|strtoupper|required'; $edit->nombre->size = 55; $edit->nombre->maxlength = 45; $edit->nombre->style = 'width:95%;'; $edit->grupo = new dropdownField('Grupo', 'sclidialoggrupo'); $edit->grupo->db_name = 'grupo'; $edit->grupo->option('', 'Seleccione un grupo'); $edit->grupo->options('SELECT TRIM(grupo) AS grupo, CONCAT(grupo," ",gr_desc) gr_desc FROM grcl ORDER BY gr_desc'); $edit->grupo->rule = 'required'; $edit->grupo->size = 6; $edit->grupo->maxlength = 4; $edit->grupo->style = 'width:220px'; $edit->grupo->insertValue = $this->datasis->dameval('SELECT grupo FROM grcl WHERE gr_desc like "CONSUMIDOR FINAL%"'); $edit->dire11 = new inputField('Dirección', 'sclidialogdire11'); $edit->dire11->db_name = 'dire11'; $edit->dire11->rule = 'trim'; $edit->dire11->size = 90; $edit->dire11->maxlength = 40; $edit->dire11->style = 'width:95%;'; $edit->telefono = new inputField('Teléfonos', 'sclidialogtelefono'); $edit->telefono->db_name = 'telefono'; $edit->telefono->rule = 'trim'; $edit->telefono->size = 22; $edit->telefono->maxlength = 30; $edit->ciudad1 = new dropdownField('Ciudad', 'sclidialogciudad1'); $edit->ciudad1->db_name = 'ciudad1'; $edit->ciudad1->rule = 'trim'; $edit->ciudad1->option('', 'Seleccionar'); $edit->ciudad1->options('SELECT TRIM(ciudad) AS codigo, ciudad FROM ciud ORDER BY ciudad'); $edit->ciudad1->style = 'width:200px'; $edit->ciudad1->insertValue = $this->datasis->traevalor('CIUDAD'); $edit->tiva = new dropdownField('Tipo Fiscal', 'sclidialogtiva'); $edit->tiva->db_name = 'tiva'; $edit->tiva->option('N', 'No Contribuyente'); $edit->tiva->option('C', 'Contribuyente'); $edit->tiva->option('E', 'Especial'); $edit->tiva->option('R', 'Regimen Exento'); $edit->tiva->option('O', 'Otro'); $edit->tiva->style = 'width:110px'; $edit->tiva->insertValue = 'N'; $edit->tiva->rule = 'required|enum[N,C,E,R,O]'; $edit->zona = new dropdownField('Zona', 'sclidialogzona'); $edit->zona->db_name = 'zona'; $edit->zona->rule = 'trim|required'; $edit->zona->option('', 'Seleccionar'); $edit->zona->options('SELECT TRIM(codigo) AS codigo, CONCAT(codigo," ", nombre) nombre FROM zona ORDER BY nombre'); $edit->zona->style = 'width:166px'; $edit->zona->insertValue = $this->datasis->traevalor('ZONAXDEFECTO'); $edit->email = new inputField('E-mail', 'sclidialogemail'); $edit->email->db_name = 'email'; $edit->email->rule = 'trim|valid_email'; $edit->email->size = 40; $edit->email->maxlength = 100; $edit->tipo = new autoUpdateField('tipo', '1', '1'); $edit->credito = new autoUpdateField('credito', 'N', 'N'); $edit->limite = new autoUpdateField('limite', '0', '0'); $script = ' $(function() { $("#sclidialogrifci").focusout(function(){ rif=$(this).val().toUpperCase(); $(this).val(rif); $("#sclidialogrifci").val(rif); if(!chrif(rif)){ alert("Al parecer el RIF colocado no es correcto, por favor verifique con el SENIAT."); return true; }else{ $.ajax({ type: "POST", url: "' . site_url('ajax/traerif') . '", dataType: "json", data: {rifci: rif}, success: function(data){ if(data.error==0){ if($("#sclidialognombre").val()==""){ $("#sclidialognombre").val(data.nombre); } } } }); //Chequea si esta repetido $.ajax({ type: "POST", url: "' . site_url('ajax/rifrep/C') . '", dataType: "json", data: {rifci: rif, codigo: ' . json_encode($edit->get_from_dataobjetct('cliente')) . '}, success: function(data){ if(data.rt){ $.prompt(data.msj,{ buttons: { Continuar: true }, focus: 1, submit:function(e,v,m,f){ $("#nombre").focus(); } }); $("#sclidialogrifci").unbind("focusout"); } } }); //Fin del chequeo repetido } }); }); function chrif(rif){ rif.toUpperCase(); var patt=/[EJPGV][0-9]{9} * /g; if(patt.test(rif)){ var factor= new Array(4,3,2,7,6,5,4,3,2); var v=0; if(rif[0]=="V"){ v=1; }else if(rif[0]=="E"){ v=2; }else if(rif[0]=="J"){ v=3; }else if(rif[0]=="P"){ v=4; }else if(rif[0]=="G"){ v=5; } acum=v*factor[0]; for(i=1;i<9;i++){ acum=acum+parseInt(rif[i])*factor[i]; } acum=11-acum%11; if(acum>=10 || acum<=0){ acum=0; } return (acum==parseInt(rif[9])); }else{ return true; } }'; $edit->script($script); $edit->build(); if ($edit->on_show()) { echo $edit->output; } if ($edit->on_success()) { $data = array('id' => $edit->_dataobject->get('id'), 'cliente' => $edit->_dataobject->get('cliente'), 'nombre' => $edit->_dataobject->get('nombre'), 'rifci' => $edit->_dataobject->get('rifci'), 'tipo' => $edit->_dataobject->get('tipo'), 'direc' => $edit->_dataobject->get('dire11'), 'descuento' => 0); $rt = array('status' => 'A', 'mensaje' => 'Registro guardado', 'data' => $data, 'pk' => $edit->_dataobject->pk); echo json_encode($rt); } if ($edit->on_error()) { $rt = array('status' => 'B', 'mensaje' => $edit->error_string, 'pk' => $edit->_dataobject->pk); echo json_encode($rt); } }
function ncppro() { $this->rapyd->load('dataedit'); $edit = new DataEdit('Nota de credito a proveedor', 'sprm'); $edit->on_save_redirect = false; $edit->pre_process('insert', '_pre_ncppro_insert'); $edit->pre_process('update', '_pre_ncppro_update'); $edit->pre_process('delete', '_pre_ncppro_delete'); $edit->post_process('insert', '_post_ncppro_insert'); $edit->cod_prv = new inputField('Proveedor', 'cod_prv'); $edit->cod_prv->rule = 'existesprv'; $edit->cod_prv->size = 8; $edit->nombre = new inputField('Nombre', 'nombre'); $edit->nombre->type = 'inputhidden'; $edit->nombre->in = 'cod_prv'; $edit->sprvreteiva = new hiddenField('', 'sprvreteiva'); $edit->codigo = new dropdownField('Motivo', 'codigo'); $edit->codigo->option('', 'Seleccionar'); $edit->codigo->options('SELECT TRIM(codigo) AS cod, nombre FROM botr WHERE tipo=\'P\' ORDER BY nombre'); $edit->codigo->style = 'width:200px;'; $edit->codigo->rule = 'required'; $edit->fecha = new dateonlyField('Fecha', 'fecha'); $edit->fecha->size = 12; $edit->fecha->maxlength = 8; $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->calendar = false; $edit->fecha->rule = 'chfecha|required'; $edit->observa1 = new textareaField('Concepto:', 'observa1'); $edit->observa1->cols = 70; $edit->observa1->rows = 2; $edit->observa1->style = 'width:100%;'; $edit->observa2 = new textareaField('', 'observa2'); $edit->observa2->cols = 70; $edit->observa2->rows = 2; $edit->observa2->style = 'width:100%;'; $edit->observa2->when = array('show'); $edit->nfiscal = new inputField('Control Físcal', 'nfiscal'); $edit->nfiscal->rule = 'required'; $edit->nfiscal->size = 15; $edit->nfiscal->maxlength = 17; $edit->serie = new inputField('Número', 'serie'); $edit->serie->rule = 'required'; $edit->serie->size = 15; $edit->serie->maxlength = 17; $edit->afecta = new inputField('#Fac.Afectada', 'afecta'); $edit->afecta->rule = 'required'; $edit->afecta->size = 15; $edit->afecta->maxlength = 12; $edit->fecapl = new dateonlyField('Fecha de emisión', 'fecapl'); $edit->fecapl->size = 12; $edit->fecapl->maxlength = 8; $edit->fecapl->insertValue = date('Y-m-d'); $edit->fecapl->calendar = false; $edit->fecapl->rule = 'chfecha|required'; $edit->depto = new dropdownField('Departamento', 'depto'); $edit->depto->option('', 'Seleccionar'); $edit->depto->options('SELECT depto,CONCAT_WS(\'-\',depto,TRIM(descrip)) AS descrip FROM dpto WHERE tipo=\'G\' ORDER BY descrip'); $edit->depto->style = 'width:200px;'; $edit->depto->rule = 'required'; $ivas = $this->datasis->ivaplica(); $edit->ptasa = new inputField('', 'ptasa'); $edit->ptasa->rule = 'numeric'; $edit->ptasa->type = 'inputhidden'; $edit->ptasa->insertValue = $ivas['tasa']; $edit->ptasa->showformat = 'decimal'; $edit->preducida = new inputField('', 'preducida'); $edit->preducida->rule = 'numeric'; $edit->preducida->type = 'inputhidden'; $edit->preducida->insertValue = $ivas['redutasa']; $edit->preducida->showformat = 'decimal'; $edit->padicional = new inputField('', 'padicional'); $edit->padicional->rule = 'numeric'; $edit->padicional->type = 'inputhidden'; $edit->padicional->insertValue = $ivas['sobretasa']; $edit->padicional->showformat = 'decimal'; //bases de los impuestos $edit->montasa = new inputField('Montasa', 'montasa'); $edit->montasa->rule = 'max_length[17]|numeric|positive'; $edit->montasa->css_class = 'inputnum'; $edit->montasa->size = 19; $edit->montasa->maxlength = 17; $edit->montasa->rule = 'condi_required'; $edit->monredu = new inputField('Monredu', 'monredu'); $edit->monredu->rule = 'max_length[17]|numeric|positive'; $edit->monredu->css_class = 'inputnum'; $edit->monredu->size = 19; $edit->monredu->maxlength = 17; $edit->monredu->rule = 'condi_required'; $edit->monadic = new inputField('Monadic', 'monadic'); $edit->monadic->rule = 'max_length[17]|numeric|positive'; $edit->monadic->css_class = 'inputnum'; $edit->monadic->size = 19; $edit->monadic->maxlength = 17; $edit->monadic->rule = 'condi_required'; //fin de las bases de los impuestos $edit->tasa = new inputField('general', 'tasa'); $edit->tasa->rule = 'max_length[17]|numeric'; $edit->tasa->css_class = 'inputnum'; $edit->tasa->size = 12; $edit->tasa->maxlength = 17; $edit->tasa->rule = 'condi_required|callback_chmontasa[G]'; $edit->reducida = new inputField('reducida', 'reducida'); $edit->reducida->rule = 'max_length[17]|numeric|positive'; $edit->reducida->css_class = 'inputnum'; $edit->reducida->size = 12; $edit->reducida->maxlength = 17; $edit->reducida->rule = 'condi_required|callback_chmontasa[R]'; $edit->sobretasa = new inputField('adicional', 'sobretasa'); $edit->sobretasa->rule = 'max_length[17]|numeric|positive'; $edit->sobretasa->css_class = 'inputnum'; $edit->sobretasa->size = 12; $edit->sobretasa->maxlength = 17; $edit->sobretasa->rule = 'condi_required|callback_chmontasa[A]|positive'; $edit->exento = new inputField('Exento', 'exento'); $edit->exento->rule = 'max_length[17]|numeric'; $edit->exento->css_class = 'inputnum'; $edit->exento->size = 19; $edit->exento->maxlength = 17; $edit->exento->rule = 'condi_required|positive'; $edit->reteiva = new inputField('Ret. IVA', 'reteiva'); $edit->reteiva->rule = 'max_length[17]|numeric'; $edit->reteiva->css_class = 'inputnum'; $edit->reteiva->size = 19; $edit->reteiva->maxlength = 17; $edit->reteiva->insertValue = '0'; $edit->reteiva->rule = 'condi_required|callback_chobligatipo[NC]|positive'; $edit->monto = new inputField('Total', 'monto'); $edit->monto->rule = 'required|max_length[17]|numeric'; $edit->monto->css_class = 'inputnum'; $edit->monto->size = 19; $edit->monto->maxlength = 17; $edit->monto->type = 'inputhidden'; //Campos comodines $edit->sprvreteiva = new hiddenField('', 'sprvreteiva'); $edit->aplrete = new hiddenField('', 'aplrete'); //Fin de los campos comodines $edit->tipo_doc = new autoUpdateField('tipo_doc', 'NC', 'NC'); $edit->usuario = new autoUpdateField('usuario', $this->secu->usuario(), $this->secu->usuario()); $edit->estampa = new autoUpdateField('estampa', date('Ymd'), date('Ymd')); $edit->hora = new autoUpdateField('hora', date('H:i:s'), date('H:i:s')); $arr_ptasa = array(); $edit->apltasa = new dropdownField('', 'apltasa'); $mSQL = 'SELECT fecha,tasa,redutasa,sobretasa FROM civa ORDER BY fecha DESC LIMIT 3'; $query = $this->db->query($mSQL); foreach ($query->result() as $row) { $arr_ptasa[] = array(floatval($row->tasa), floatval($row->redutasa), floatval($row->sobretasa)); $edit->apltasa->option($row->fecha, dbdate_to_human($row->fecha)); } $edit->apltasa->onchange = 'chapltasa()'; $edit->apltasa->style = 'width:100px;'; $edit->apltasa->rule = 'required'; $edit->build(); if ($edit->on_success()) { $rt = array('status' => 'A', 'mensaje' => 'Registro guardado', 'pk' => $edit->_dataobject->pk); echo json_encode($rt); } if ($edit->on_error()) { $rt = array('status' => 'B', 'mensaje' => preg_replace('/<[^>]*>/', '', $edit->error_string), 'pk' => null); echo json_encode($rt); $act = false; return true; } if ($edit->on_show()) { $conten['json_ptasa'] = json_encode($arr_ptasa); $conten['form'] =& $edit; $conten['title'] = heading('Nota de crédito a factura pagada a proveedor'); $this->load->view('view_ncppro', $conten); } }
function dataedit() { $this->rapyd->load('dataedit'); $edit = new DataEdit($this->t**s, 'bconci'); $edit->on_save_redirect = false; $edit->post_process('insert', '_post_insert'); $edit->post_process('update', '_post_update'); $edit->post_process('delete', '_post_delete'); $edit->pre_process('insert', '_pre_insert'); $edit->pre_process('update', '_pre_update'); $edit->pre_process('delete', '_pre_delete'); $edit->fecha = new dateonlyField('Fecha', 'fecha', 'm/Y'); $edit->fecha->mode = 'autohide'; $edit->fecha->rule = 'chfecha[m/Y]'; $edit->fecha->size = 10; $edit->fecha->maxlength = 8; $edit->fecha->insertValue = date('Y-m-d', mktime(0, 0, 0, date('n'), 0)); $edit->fecha->calendar = false; $edit->codbanc = new dropdownField('Banco', 'codbanc'); $edit->codbanc->style = 'width:480px'; $edit->codbanc->mode = 'autohide'; $edit->codbanc->rule = 'required'; $edit->codbanc->option('', 'Seleccionar'); $edit->codbanc->options("SELECT TRIM(codbanc) AS codbanc,CONCAT_WS(' ',codbanc,banco,numcuent) AS desca FROM banc WHERE tbanco<>'CAJ'"); $edit->saldoi = new inputField('Saldo Inicial', 'saldoi'); $edit->saldoi->rule = 'numeric|required'; $edit->saldoi->insertValue = '0.0'; $edit->saldoi->css_class = 'inputnum'; $edit->saldoi->onkeyup = 'totalizar()'; $edit->saldoi->size = 15; $edit->saldoi->maxlength = 18; $edit->saldof = new inputField('Saldo Final', 'saldof'); $edit->saldof->insertValue = '0.0'; $edit->saldof->rule = 'numeric|required'; $edit->saldof->css_class = 'inputnum'; $edit->saldof->onkeyup = 'totalizar()'; $edit->saldof->size = 15; $edit->saldof->maxlength = 18; $edit->deposito = new inputField('Depósitos', 'deposito'); $edit->deposito->rule = 'numeric'; $edit->deposito->type = 'inputhidden'; $edit->deposito->insertValue = '0.0'; $edit->deposito->css_class = 'inputnum'; $edit->deposito->size = 20; $edit->deposito->maxlength = 18; $edit->credito = new inputField('Notas de Crédito', 'credito'); $edit->credito->rule = 'numeric'; $edit->credito->type = 'inputhidden'; $edit->credito->insertValue = '0.0'; $edit->credito->css_class = 'inputnum'; $edit->credito->size = 20; $edit->credito->maxlength = 18; $edit->cheque = new inputField('Cheques', 'cheque'); $edit->cheque->rule = 'numeric'; $edit->cheque->type = 'inputhidden'; $edit->cheque->insertValue = '0.0'; $edit->cheque->css_class = 'inputnum'; $edit->cheque->size = 20; $edit->cheque->maxlength = 18; $edit->debito = new inputField('Notas de Débito', 'debito'); $edit->debito->rule = 'numeric'; $edit->debito->type = 'inputhidden'; $edit->debito->insertValue = '0.0'; $edit->debito->css_class = 'inputnum'; $edit->debito->size = 20; $edit->debito->maxlength = 18; $edit->cdeposito = new inputField('Depósitos', 'cdeposito'); $edit->cdeposito->rule = 'numeric'; $edit->cdeposito->insertValue = '0.0'; $edit->cdeposito->css_class = 'inputnum'; $edit->cdeposito->onkeyup = 'totalizar()'; $edit->cdeposito->size = 12; $edit->cdeposito->maxlength = 18; $edit->ccredito = new inputField('Notas de Crédito', 'ccredito'); $edit->ccredito->rule = 'numeric'; $edit->ccredito->insertValue = '0.0'; $edit->ccredito->css_class = 'inputnum'; $edit->ccredito->onkeyup = 'totalizar()'; $edit->ccredito->size = 12; $edit->ccredito->maxlength = 18; $edit->ccheque = new inputField('Cheques', 'ccheque'); $edit->ccheque->rule = 'numeric'; $edit->ccheque->insertValue = '0.0'; $edit->ccheque->css_class = 'inputnum'; $edit->ccheque->onkeyup = 'totalizar()'; $edit->ccheque->size = 12; $edit->ccheque->maxlength = 18; $edit->cdebito = new inputField('Notas de Débito', 'cdebito'); $edit->cdebito->rule = 'numeric'; $edit->cdebito->insertValue = '0.0'; $edit->cdebito->css_class = 'inputnum'; $edit->cdebito->onkeyup = 'totalizar()'; $edit->cdebito->size = 12; $edit->cdebito->maxlength = 18; //$edit->status = new inputField('Estatus','status'); //$edit->status->rule=''; //$edit->status->size =3; //$edit->status->maxlength =1; $edit->usuario = new autoUpdateField('usuario', $this->secu->usuario(), $this->secu->usuario()); $edit->estampa = new autoUpdateField('estampa', date('Ymd'), date('Ymd')); $edit->hora = new autoUpdateField('hora', date('H:i:s'), date('H:i:s')); $edit->build(); if ($edit->on_success()) { $rt = array('status' => 'A', 'mensaje' => 'Registro guardado', 'pk' => $edit->_dataobject->pk); echo json_encode($rt); return true; } if ($edit->on_error()) { $rt = array('status' => 'B', 'mensaje' => preg_replace('/<[^>]*>/', '', $edit->error_string), 'pk' => null); echo json_encode($rt); $act = false; return true; } if ($edit->on_show()) { $conten['form'] =& $edit; $this->load->view('view_bconci', $conten); } }
function reporte() { header('Content-Type: text/html; charset=' . $this->config->item('charset')); $this->rapyd->load('dataedit'); $this->rapyd->uri->keep_persistence(); $atts = array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0'); $edit = new DataEdit('', 'reportes'); $id = $edit->_dataobject->pk['nombre']; $uri2 = anchor_popup('reportes/ver/' . $id, 'Probar reporte', $atts); $uri3 = anchor_popup('supervisor/mantenimiento/centinelas', 'Centinela', $atts); $edit->title(' '); $script = ' $("#df1").submit(function(){ $("#proteo").val(editor.getValue()); $.post("' . site_url('supervisor/repomenu/gajax_proteo/update/' . $id) . '", {nombre: "' . $id . '", proteo: $("#proteo").val()}, function(data){ //alert("Reporte guardado" + data); } ); return false; }); function guarda() { $("#proteo").val(editor.getValue()); $.post("' . site_url('supervisor/repomenu/gajax_proteo/update/' . $id) . '", {nombre: "' . $id . '", proteo: $("#proteo").val()}, function(data){ //alert("Reporte guardado" + data); } ); return false; }; function fcargar(){ $.post("' . site_url('supervisor/repomenu/cargar/') . '", { nombre:"' . $id . '"}, function(data){ if (data){ $("#proteo").val(editor.setValue(data)); } else { alert("Archivo vacio");} }); return false; }; function fguardar(){ $("#proteo").val(editor.getValue()); $.post("' . site_url('supervisor/repomenu/guardar/') . '", {nombre: "' . $id . '", proteo: $("#proteo").val()}, function(data){ alert(data); }); return false; };'; $edit->script($script, 'modify'); $edit->back_save = true; $edit->back_cancel = true; $edit->back_cancel_save = true; $edit->back_url = site_url('supervisor/repomenu/filteredgrid'); $edit->proteo = new textareaField('', 'proteo'); $edit->proteo->rows = 30; $edit->proteo->cols = 130; $edit->proteo->css_class = 'text-indent:100px;width:90%;11'; //$edit->buttons('modify', 'save', 'undo', 'delete', 'back'); //$accion=$this->datasis->jwinopen(site_url('reportes/ver/'.$id."'")); //$edit->button_status('btn_probar','Probar Reporte',$accion,'TL','modify'); //$accion=$this->datasis->jwinopen(site_url('supervisor/mantenimiento/centinelas')); //$edit->button_status('btn_centinela','Centinelas',$accion,'TL','modify'); //$edit->button_status('btn_guardar' ,'Guardar a Archivo' ,'fguardar()','TL','modify'); //$edit->button_status('btn_cargar' ,'Cargar desde Archivo','fcargar()' ,'TL','modify'); $edit->build(); $rt = array('status' => '', 'msj' => '', 'pk' => ''); if ($edit->on_success()) { $rt['status'] = 'A'; $rt['msj'] = 'Guardado'; echo json_encode($rt); } if ($edit->on_error()) { $rt['status'] = 'B'; $rt['msj'] = $edit->error_string; echo json_encode($rt); } //$this->rapyd->jquery[]='$("#proteo").tabby();'; //$this->rapyd->jquery[]='$("#proteo").linedtextarea();'; if ($edit->on_show()) { $data['back_url'] = $edit->back_url; $data['content'] = $edit->output; $data['title'] = $id; $data['head'] = $this->rapyd->get_head(); $this->load->view('editorep', $data); } }