como estas GatorV este mi codigo:
este es el controlador donde llamo al metodo del modelo y lo guargo en la vista para poder ver sus datos.
Código PHP:
public function registrodetalleingresoproductoAction() {
$this->_helper->layout->setLayout('layoutp');
$this->view->headTitle('Index-Principal', 'PREPEND');
$this->view->title = "Registro Detalle de Ingreso ";
$cod_ingre = $this->_getParam('cod_ingreso');
$cod_almacen = $this->_getParam('cod_almacen');
$form = new Admin_Form_DetalleIngresoProducto();
//$form->registrar->setLabel('Adicionar');
$tabla_producto = new Admin_Model_DbTable_Producto();
$productos = $tabla_producto->getProductoPorAlmacen($cod_almacen);
$form->COD_PRODUCTO->setMultiOptions($productos);
$form->COD_INGRESO->setValue($cod_ingre);
//instancio el modelo
$tabla_detalle_ingreso=new Admin_Model_DbTable_DetalleIngresoProducto();
//llamo al metodo que devuelve el array de array y lo guardo en una variable
$detalles_ingreso=$tabla_detalle_ingreso->getDetalleIngreso($cod_ingre);
$this->view->form = $form;
//guardo en la vista esa varible con un nombre para recuperar en el phtml
$this->view->tabla_detalles=$detalles_ingreso;
$this->view->titulo_tabla='Detalle de Ingreso de Producto';
if ($this->getRequest()->isPost()) {
$formData = $this->getRequest()->getPost();
if ($form->isValid($formData)) {
$datos_gral = $form->getValues();
$cod_detalle_ingreso=$form->getValue('COD_DETA_INGRE');
$cod_ingreso=$form->getValue('COD_INGRESO');
$cod_producto = $form->getValue('COD_PRODUCTO');
$tipo_unidad = $form->getValue('TIPO_UNIDAD');
$cantidad_prod = $form->getValue('CANTIDAD');
$cantidad_uni_prod = $form->getValue('CANTIDAD_UNIDADES');
$observacion_ingreso=$form->getValue('OBSERVACION_INGRE');
$datos_detalle_ingreso = array('COD_PRODUCTO' => $cod_producto, 'COD_INGRESO' => $cod_ingreso,'CANTIDAD' => $cantidad_prod, 'CANTIDAD_UNIDADES' => $cantidad_uni_prod, 'OBSERVACION_INGRE' => $observacion_ingreso);
$model_detalle_ingreso = new Admin_Model_DbTable_DetalleIngresoProducto();
$model_detalle_ingreso->insertarDetalleIngresoProducto($datos_detalle_ingreso);
$this->_helper->Redirector->gotoSimple('registrodetalleingresoproducto', 'Ingresoproducto', 'admin', array('cod_ingreso' => $cod_ingre, 'cod_almacen' => $cod_almacen));
} else {
$form->populate($formData);
}
}
este es el metodo en la clase model:
Código PHP:
public function getDetalleIngreso($cod_ingreso) {
//echo 'ested es el codigo' . $cod_ingreso . '<br>';
$consulta = $this->_db->select()
->from(array('DI' => 'DETALLEINGRESO', 'P' => 'PRODUCTO', 'I' => 'INGRESO','TI'=>'TIPOINGRESO','TU'=>'TIPO_UNIDAD'),
array('P.COD_PRODUCTO','P.NOMBRE_PROD', 'DI.*', 'I.TIPO_INGRE','I.FECHA_INGRE'))
->join(array('I' => 'INGRESO'), 'DI.COD_INGRESO=I.COD_INGRESO', array())
->join(array('P' => 'PRODUCTO'), 'DI.COD_PRODUCTO=P.COD_PRODUCTO', array())
->join(array('TU' => 'TIPO_UNIDAD'), 'P.TIPO_UNIDAD=TU.TIPO_UNIDAD', array())
->join(array('TI'=>'TIPOINGRESO'),'TI.TIPO_INGRE=I.TIPO_INGRE',array())
->where('DI.COD_INGRESO = ?', 2);
$resultado = $this->getAdapter()->fetchAll($consulta);
return $resultado;
}
verifiacando la consulta con manager de Mysql, devuelve los valores que necesito o busco con la consulta.
y este es como recupero en el lado de la vista y lo muestro en una tabla:
Código PHP:
<div align="center">
<table border="1">
<thead>
<tr ><?php echo $this->escape($this->titulo_tabla) ?></tr>
<tr>
<td>Tipo Ingreso</td>
<td>Codigo Producto</td>
<td>Producto</td>
<td>Cantidad</td>
<td>Cantidad Unidad</td>
<td>Observacion</td>
<td>Fecha</td>
</tr>
</thead>
<tbody>
<?php
foreach ($this->tabla_detalles as $detalle) :
// print_r($detalle);
//
?>
<!-- por cada fila, muestro sus datos -->
<tr>
<td><?php echo $this->escape($detalle->COD_INGRESO); ?></td>
<td><?php echo $this->escape($detalle->NOMBRE_PROD); ?></td>
<td><?php echo $this->escape($detalle->TIPO_INGRE); ?></td>
<td><?php echo $this->escape($detalle->CANTIDAD); ?></td>
<td><?php echo $this->escape($detalle->CANTIDAD_UNIDADES); ?></td>
<td><?php echo $this->escape($detalle->OBSERVACION_INGRE); ?></td>
<td><?php echo $this->escape($detalle->FECHA_INGRE); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
no me muestra nada, al hacer un print_r($detalles_ingreso) me muestra los valores pero en el lado de la vista no muestra nada, nose q esta mal
gracias de ente mano