ayuda con formato PDF |
[eluser]Unknown[/eluser]
Hola, soy nuevo en esto de codeigniter y php, no he programado mucho la verdad por lo tanto me considero bastante novato, mi problema es el siguiente: estoy programando un sistema donde el cual al momento de que un empleado renuncia se genera un PDF con cierta información, el problema es que uno de esos campos que se llama fecha de baja del empleado no logro que aparezca la fecha indicada en ese campo, la información si se guarda en la base de datos pero no puedo ligarla al PDF, el campo queda vacío, pongo el código que aparece en el controlador con el cual se supone que se hace la consulta en la BD y el codigo que esta en la vista para ver si pueden ayudarme a descubrir el error: no pongo todo para no confundir, solo lo que es importante ESTO ES LO QUE APARECE EN EL CONTROLADOR: function formato_baja($id=0) { if ($id == 0) { redirect('personal', 'refresh'); exit(0); } $this->data['fecha_baja'] = $this->cdc_model->seleccionar('comisionista_baja', array('id_comisionista_baja' => $id_comisionista_baja)); lo que empieza con $this->data es lo que manda pedir la fecha de baja a la funcion seleccionar que esta en el modelo ESTO ES LO QUE APARECE EN LA VISTA <td colspan="1">Fecha de baja:</td> <td colspan="3"><div class="info"><?php echo $fecha_baja['fecha_baja'];?></div></td> </tr> SE SUPONE QUE ESTE PEDAZO DE CODIGO DEBERIA MANDAR LLAMAR LA FECHA DE BAJA DEL EMPLEADO PERO NO LO HACE ADJUNTO TAMBIEN LA FUNCION DEL MODELO CON EL CUAL SE SUPONE QUE SE HACE LA CONSULTA A LA BD function seleccionar($tabla=NULL, $columna=NULL, $valor=NULL){ if($tabla != NULL && $columna != NULL) return $this->db->from($tabla)->where($columna, $valor)->get()->row(); else return false; } CABE RESALTAR QUE LA TABLA SE LLAMA COMISIONISTA_BAJA Y ADEMAS VIENEN DOS ID´S uno que se llama id_comisionista y otro que se llama id_comisionista_baja , la llave primaria es el 2do ID, esto lo pongo como información extra por si acaso. Muchas gracias por cualquier sugerencia, se agradece mucho. saludos.
[eluser]Tim Brownlaw[/eluser]
Hola y bienvenido al mundo de PHP y CodeIgniter ![]() Puede usar https://translate.google.com si usted no entiende Inglés This might help... ( I have not tested this, so there might be a few mistakes) I have kept this simple without adding any error checking but I have added in some comments where you would need to take some action depending upon the outcome. Your Model is Code: function seleccionar($tabla=NULL, $columna=NULL, $valor=NULL){ Your Controller should be... Code: function formato_baja($id=0) { So $this->data['echa_baja'] will be an object of an array. If you pass $this->data['fecha_baja'] to your view you will need to access the elements using something like $fecha_baja->id etc. As an example ( as I do not know the other field names you want to display from the database row) The Simple, One entry from the database, view. Code: <td colspan="1">Fecha de baja:</td> There are various ways to create a table of all the values... but see if this part works first! You haven't shown how you are displaying the actual view... One thing you would need to do is to check the return from the model in the controller to determine the output... as I have indicated above. |
Welcome Guest, Not a member yet? Register Sign In |