function dataedit($sta, $id) { $this->rapyd->load('dataedit', 'datagrid'); $edit = new DataEdit('Ficha del cliente', 'scli'); $edit->back_url = site_url($this->url . 'filteredgrid'); $edit->cliente = new inputField('Cliente', 'cliente'); $edit->cliente->rule = 'trim|required|existesprv'; $edit->cliente->maxlength = 5; $edit->cliente->size = 7; $edit->cliente->mode = 'autohide'; $edit->nombre = new inputField('Nombre', 'nombre'); $edit->nombre->rule = 'trim'; $edit->nombre->maxlength = 40; $edit->nombre->size = 40; $edit->nombre->mode = 'autohide'; $edit->nombre->in = 'cliente'; $edit->rifci = new inputField('RIF/CI', 'rifci'); $edit->rifci->rule = 'trim'; $edit->rifci->maxlength = 40; $edit->rifci->size = 40; $edit->rifci->mode = 'autohide'; $edit->telefono = new inputField('Teléfono', 'telefono'); $edit->telefono->rule = 'trim'; $edit->telefono->maxlength = 40; $edit->telefono->size = 40; $edit->telefono->mode = 'autohide'; $edit->buttons('undo', 'back'); $edit->build(); $data['content'] = $edit->output; $crm = $edit->_dataobject->get('crm'); if (empty($crm)) { $dbdata['usuario'] = $this->secu->usuario(); $dbdata['status'] = 'A'; $dbdata['fecha'] = date('Ymd'); $dbdata['titulo'] = 'Callcenter'; $dbdata['cliente'] = $edit->_dataobject->get('cliente'); $dbdata['descripcion'] = ''; $mSQL = $this->db->insert_string('crm_contenedor', $dbdata); $this->db->simple_query($mSQL); $crm = $this->db->insert_id(); $mSQL = "UPDATE scli SET crm = {$crm} WHERE id={$id}"; $this->db->simple_query($mSQL); } $this->crm_back = site_url("crm/callcenter/dataedit/{$sta}/{$id}"); $adici = array($edit->_dataobject->pk['id']); $this->prefijo = 'crm_'; $data['content'] .= Contenedor::_showAdjuntos($crm, 'crm/callcenter/adjuntos', $adici); $data['content'] .= Contenedor::_showEventos($crm, 'crm/callcenter/eventos', $adici); $data['content'] .= Contenedor::_showComentarios($crm, 'crm/callcenter/comentarios', $adici); $data['style'] = style('redmond/jquery-ui.css'); $data['script'] = script('jquery.js'); $data['script'] .= script('jquery-ui.js'); $data['script'] .= script('plugins/jquery.floatnumber.js'); $data['script'] .= script('plugins/jquery.numeric.pack.js'); $data['script'] .= script('plugins/jquery.ui.autocomplete.autoSelectOne.js'); $data['script'] .= phpscript('nformat.js'); $data['head'] = $this->rapyd->get_head(); $data['title'] = heading('Callcenter'); $this->load->view('view_ventanas', $data); }
<?php require_once 'php/Contenedor.php'; $contenedor = new Contenedor(); $contenedor->iniciar();
function dataedit() { $this->rapyd->load('dataobject', 'datadetails'); $monedalocal = 'Bs'; $modbus = array('tabla' => 'sinv', 'columnas' => array('codigo' => 'Código', 'descrip' => 'Descripción'), 'filtro' => array('codigo' => 'Código', 'descrip' => 'Descripción'), 'retornar' => array('codigo' => 'codigo_<#i#>', 'descrip' => 'descrip_<#i#>'), 'p_uri' => array(4 => '<#i#>'), 'titulo' => 'Buscar Producto en inventario', 'script' => array('post_sinv_modbus("<#i#>")')); $btn = $this->datasis->p_modbus($modbus, '<#i#>'); $sprv = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'Código Proveedor', 'nombre' => 'Nombre', 'rif' => 'RIF'), 'filtro' => array('proveed' => 'Código Proveedor', 'nombre' => 'Nombre'), 'retornar' => array('proveed' => 'proveed', 'nombre' => 'nombre'), 'titulo' => 'Buscar Proveedor', 'where' => 'tipo IN (3,4)', 'script' => array('post_sprv_modbus()')); $boton = $this->datasis->modbus($sprv); $aran = array('tabla' => 'aran', 'columnas' => array('codigo' => 'Código', 'descrip' => 'Descripción', 'tarifa' => 'Tarifas'), 'filtro' => array('codigo' => 'Código', 'descrip' => 'Descripción'), 'retornar' => array('codigo' => 'codaran_<#i#>', 'tarifa' => 'arancel_<#i#>'), 'p_uri' => array(4 => '<#i#>'), 'titulo' => 'Buscar Aranceles', 'script' => array('aranpresis(<#i#>)')); $aran = $this->datasis->p_modbus($aran, '<#i#>'); $asprv = array('tabla' => 'sprv', 'columnas' => array('proveed' => 'Código Proveedor', 'nombre' => 'Nombre', 'rif' => 'RIF'), 'filtro' => array('proveed' => 'Código Proveedor', 'nombre' => 'Nombre'), 'retornar' => array('proveed' => 'agente', 'nombre' => 'nomage'), 'titulo' => 'Buscar Proveedor', 'script' => array('post_sprv_modbus()')); $aboton = $this->datasis->modbus($asprv, 'agsprv'); $script = "\n\t\tfunction post_add_itstra(id){\n\t\t\t\$('#cantidad_'+id).numeric(" . ");\n\t\t\treturn true;\n\t\t}\n\t\tfunction formato(row) {\n\t\t\treturn row[0] + " - " + row[1];\n\t\t}"; $do = new DataObject('ordi'); $do->rel_one_to_many('itordi', 'itordi', 'numero'); $edit = new DataDetails('ordi', $do); $_status = $do->get('status'); $_control = $do->get('control'); if ($_status == 'C') { $dbcontrol = $this->db->escape($_control); $scstcana = $this->datasis->dameval('SELECT COUNT(*) FROM scst WHERE tipo_doc<>\'XX\' AND control=' . $dbcontrol); if (empty($scstcana)) { $_id = $do->get('id'); $this->db->simple_query('UPDATE ordi SET status="A", control=NULL WHERE id=' . $_id); $do->set('control', ''); $do->set('status', 'A'); } } $edit->back_url = site_url('import/ordi/filteredgrid'); $edit->set_rel_title('itstra', 'Producto <#o#>'); $edit->script($script, 'create'); $edit->script($script, 'modify'); $edit->pre_process('insert', '_pre_insert'); $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->numero = new inputField('Número', 'numero'); $edit->numero->mode = 'autohide'; $edit->numero->size = 10; //$edit->numero->apply_rules=false; //necesario cuando el campo es clave y no se pide al usuario $edit->numero->when = array('show', 'modify'); $edit->dua = new inputField('Declaración única de aduana', 'dua'); $edit->dua->size = 10; $edit->fecha = new dateonlyField('Fecha de Factura', 'fecha'); $edit->fecha->insertValue = date('Y-m-d'); $edit->fecha->maxlength = 8; $edit->fecha->size = 10; /*$edit->status = new dropdownField('Estatus', 'status'); $edit->status->option('A','Abierto'); $edit->status->option('C','Cerrado'); $edit->status->option('E','Eliminado'); $edit->status->rule = 'required'; $edit->status->style = 'width:120px';*/ $edit->proveed = new inputField('Proveedor', 'proveed'); $edit->proveed->rule = 'trim|required|existesprv'; $edit->proveed->maxlength = 5; $edit->proveed->size = 7; $edit->proveed->append($boton); $edit->nombre = new inputField('Nombre', 'nombre'); $edit->nombre->rule = 'trim'; $edit->nombre->maxlength = 40; $edit->nombre->size = 40; $edit->nombre->type = 'inputhidden'; $edit->agente = new inputField('Agente aduanal', 'agente'); $edit->agente->rule = 'trim|existesprv|required'; $edit->agente->maxlength = 5; $edit->agente->size = 7; $edit->agente->append($aboton); $edit->nomage = new inputField('Nombre de agente', 'nomage'); $edit->nomage->rule = 'trim'; $edit->nomage->maxlength = 40; $edit->nomage->size = 40; $edit->nomage->type = 'inputhidden'; $arr = array('montofob' => 'Total factura extranjera $'); foreach ($arr as $obj => $etiq) { $edit->{$obj} = new inputField($etiq, $obj); $edit->{$obj}->rule = 'trim'; $edit->{$obj}->maxlength = 20; $edit->{$obj}->size = 10; $edit->{$obj}->css_class = 'inputnum'; $edit->{$obj}->autocomplete = false; $edit->{$obj}->showformat = 'decimal'; $edit->{$obj}->type = 'inputhidden'; } $arr = array('gastosi' => 'Gastos Internacionales $', 'montocif' => 'Monto FOB+gastos Internacionales $', 'gastosn' => 'Gastos Nacionales ' . $monedalocal, 'montotot' => 'Monto CIF + Gastos Nacionales ' . $monedalocal, 'montoiva' => 'Monto del iva ' . $monedalocal); foreach ($arr as $obj => $etiq) { $edit->{$obj} = new inputField($etiq, $obj); $edit->{$obj}->rule = 'trim'; $edit->{$obj}->maxlength = 20; $edit->{$obj}->size = 10; $edit->{$obj}->css_class = 'inputnum'; $edit->{$obj}->autocomplete = false; $edit->{$obj}->showformat = 'decimal'; $edit->{$obj}->when = array('show'); } $edit->arribo = new dateonlyField('Fecha de Llegada', 'arribo'); $edit->arribo->rule = 'chfecha'; $edit->arribo->maxlength = 8; $edit->arribo->size = 10; $edit->factura = new inputField('Nro. Factura', 'factura'); $edit->factura->rule = 'trim'; $edit->factura->maxlength = 20; $edit->factura->size = 10; $edit->factura->autocomplete = false; $edit->cambioofi = new inputField('Cambio Oficial', 'cambioofi'); $edit->cambioofi->css_class = 'inputnum'; $edit->cambioofi->rule = 'trim|required'; $edit->cambioofi->maxlength = 17; $edit->cambioofi->size = 10; $edit->cambioofi->autocomplete = false; $edit->cambioofi->insertValue = 6.3; $edit->cambioofi->showformat = 'decimal'; $edit->cambioreal = new inputField('Cambio Real', 'cambioreal'); $edit->cambioreal->css_class = 'inputnum'; $edit->cambioreal->rule = 'trim|required'; $edit->cambioreal->maxlength = 17; $edit->cambioreal->size = 10; $edit->cambioreal->autocomplete = false; $edit->cambioreal->showformat = 'decimal'; $edit->peso = new inputField('Peso Total', 'peso'); $edit->peso->css_class = 'inputnum'; $edit->peso->rule = 'trim'; $edit->peso->maxlength = 12; $edit->peso->size = 10; $edit->peso->showformat = 'decimal'; $edit->peso->when = array('show'); $edit->condicion = new textareaField('Condiciones', 'condicion'); $edit->condicion->rule = 'trim'; $edit->condicion->cols = 37; $edit->condicion->rows = 3; $edit->estimadif = new inputField('Diferencia en estimación', 'estimadif'); $edit->estimadif->css_class = 'inputnum'; $edit->estimadif->maxlength = 12; $edit->estimadif->size = 10; $edit->estimadif->showformat = 'decimal'; $edit->estimadif->when = array('show'); //********************* //comienza el detalle //********************* $edit->codigo = new inputField('Código <#o#>', 'codigo_<#i#>'); $edit->codigo->db_name = 'codigo'; $edit->codigo->rule = 'trim|required|existesinv'; $edit->codigo->rel_id = 'itordi'; $edit->codigo->maxlength = 15; $edit->codigo->size = 10; $edit->codigo->append($btn); $edit->codigo->autocomplete = false; $edit->descrip = new inputField('Descripción <#o#>', 'descrip_<#i#>'); $edit->descrip->db_name = 'descrip'; $edit->descrip->rel_id = 'itordi'; $edit->descrip->maxlength = 35; $edit->descrip->size = 30; $edit->descrip->autocomplete = false; $edit->descrip->type = 'inputhidden'; $edit->cantidad = new inputField('Cantidad <#o#>', 'cantidad_<#i#>'); $edit->cantidad->db_name = 'cantidad'; $edit->cantidad->css_class = 'inputnum'; $edit->cantidad->rel_id = 'itordi'; $edit->cantidad->rule = 'numeric|mayorcero|required'; $edit->cantidad->maxlength = 10; $edit->cantidad->size = 7; $edit->cantidad->autocomplete = false; $edit->cantidad->showformat = 'decimal'; $arr = array('costofob' => 'costofob', 'importefob' => 'importefob'); foreach ($arr as $obj => $db) { $edit->{$obj} = new inputField(ucfirst("{$obj} <#o#>"), "{$obj}_<#i#>"); $edit->{$obj}->db_name = $db; $edit->{$obj}->css_class = 'inputnum'; $edit->{$obj}->rel_id = 'itordi'; $edit->{$obj}->rule = 'trim|mayorcero|required'; $edit->{$obj}->maxlength = 20; $edit->{$obj}->size = 10; $edit->{$obj}->autocomplete = false; $edit->{$obj}->showformat = 'decimal'; if ($obj == 'importefob') { $edit->{$obj}->type = 'inputhidden'; } } $edit->codaran = new inputField('Codaran <#o#>', 'codaran_<#i#>'); $edit->codaran->db_name = 'codaran'; $edit->codaran->rel_id = 'itordi'; $edit->codaran->rule = 'trim|required'; $edit->codaran->maxlength = 15; $edit->codaran->size = 10; //$edit->codaran->readonly = true; $edit->codaran->append($aran); $edit->arancel = new inputField('arancel <#o#>', 'arancel_<#i#>'); $edit->arancel->db_name = 'arancel'; $edit->arancel->css_class = 'inputnum'; $edit->arancel->rel_id = 'itordi'; $edit->arancel->rule = 'trim'; $edit->arancel->maxlength = 7; $edit->arancel->size = 5; $edit->arancel->readonly = true; $edit->arancel->autocomplete = false; $edit->arancel->showformat = 'decimal'; $edit->arancel->type = 'inputhidden'; //Termina el detalle $edit->ordeni = new autoUpdateField('status', 'A', 'A'); $stat = $edit->_dataobject->get('status'); if ($stat != 'C') { $accion = "javascript:window.location='" . site_url('import/ordi/cargarordi/' . $edit->_dataobject->pk['numero']) . "'"; $edit->button_status('btn_cargar', 'Cargar', $accion, 'BR', 'show'); $action = "javascript:window.location='" . site_url('import/ordi/calcula/' . $edit->_dataobject->pk['numero']) . "'"; $edit->button_status('btn_recalculo', 'Calcular valores', $action, 'BR', 'show'); $action = "javascript:window.location='" . site_url('import/ordi/arancif/' . $edit->_dataobject->pk['numero']) . "'"; $edit->button_status('btn_arancif', 'Reajustar los aranceles', $action, 'BR', 'show'); $edit->buttons('modify', 'save', 'delete', 'add_rel'); } else { $id = $edit->get_from_dataobjetct('numero'); $this->db->where('ordeni', $id); $this->db->from('ordiestima'); if ($this->db->count_all_results() > 0) { $accion = "javascript:window.location='" . site_url('import/ordi/gserestima' . $edit->pk_URI()) . "'"; $edit->button_status('btn_ginpo', 'Agregar gasto real', $accion, 'BR', 'show'); } } $accion = "javascript:window.location='" . site_url('import/limport/liqui/' . $edit->_dataobject->pk['numero']) . "'"; $edit->button_status('btn_liqui', 'Descargar Caldeco', $accion, 'BR', 'show'); $accion = "javascript:window.location='" . site_url('formatos/ver/ORDI' . $edit->pk_URI()) . "'"; $edit->button_status('btn_imprime', 'Imprimir', $accion, 'BR', 'show'); $edit->buttons('undo', 'back'); $edit->build(); $auto_aran = site_url('import/ordi/autocomplete/codaran'); //$this->rapyd->jquery[]='$(".inputnum").numeric(".");'; if ($edit->_status == 'show') { $conten['peroles'][] = $this->_showgeri($edit->_dataobject->pk['numero'], $stat); $conten['peroles'][] = $this->_showgeser($edit->_dataobject->pk['numero'], $stat); $conten['peroles'][] = $this->_showordiva($edit->_dataobject->pk['numero'], $stat); //$conten['peroles'][] = $this->_showordiestima($edit->_dataobject->pk['numero'],$stat); $crm = $edit->_dataobject->get('crm'); if (!empty($crm)) { $adici = array($edit->_dataobject->pk['numero']); $this->prefijo = 'crm_'; $conten['peroles'][] = Contenedor::_showAdjuntos($crm, 'import/ordi/adjuntos', $adici); $conten['peroles'][] = Contenedor::_showEventos($crm, 'import/ordi/eventos', $adici); $conten['peroles'][] = Contenedor::_showComentarios($crm, 'import/ordi/comentarios', $adici); } } $conten['form'] =& $edit; $data['content'] = $this->load->view('view_ordi', $conten, true); $data['style'] = style('redmond/jquery-ui.css'); $data['script'] = script('jquery.js'); $data['script'] .= script('jquery-ui.js'); $data['script'] .= script('plugins/jquery.floatnumber.js'); $data['script'] .= script('plugins/jquery.numeric.pack.js'); $data['script'] .= script('plugins/jquery.ui.autocomplete.autoSelectOne.js'); $data['script'] .= phpscript('nformat.js'); $data['head'] = $this->rapyd->get_head(); $data['title'] = heading('Importaciones'); $this->load->view('view_ventanas', $data); }