/**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = FacturasProductos::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #2
0
									echo '<td>'.$proyectomonto->partida['p1'].'.'.$proyectomonto->partida['p2'].'.'.$proyectomonto->partida['p3'].'.'.$proyectomonto->partida['p4'].'</td>';
									echo '<td>'.number_format($proyectomonto->monto_presupuestado,2,',','.').'</td>';
									$partida_dinero_nacional = 0;
									foreach ($proyectomonto->presupuestoProductos as $key => $value) {
											$partida_dinero_nacional += $value['monto_presupuesto'];
									}
									$partida_dinero_importado = 0;
									foreach ($proyectomonto->presupuestoImportacion as $key => $value) {
											$partida_dinero_importado += $value['monto_presupuesto']*$value['cantidad']*$value->divisa->tasa['tasa'];
											//echo $value['monto_presupuesto'];
									}
									$total_cargado = $partida_dinero_nacional + $partida_dinero_importado;
									$porcentaje = $total_cargado*100/$proyectomonto->monto_presupuestado;
									

									$facturasRendicion = FacturasProductos::model()->findAllByAttributes(array('presupuesto_partida_id'=>$proyectomonto->presupuesto_partida_id));
									

									$totalRendicion = 0;
									if(isset($facturasRendicion))
										foreach ($facturasRendicion as $key => $value) {
											# code...
											//$totalRendicion += $value['costo_unitario']*$value['cantidad_adquirida']*(($value->iva->porcentaje/100)+1);
											$totalRendicion += $value['costo_unitario']*$value['cantidad_adquirida'];
										}
									echo '<td>'.$totalRendicion.'</td>';


									echo '<td>'.number_format($proyectomonto->monto_presupuestado-$totalRendicion,2,',','.').'</td>';
									//echo '<td></td>';
									//echo '<td> '.number_format($porcentaje,2,',','.').'% </td>';