<body>
<?php 
//Detalles
$numPresupuesto = $_GET['id'];
$elPresupuesto = Presupuesto::model()->findByPk($numPresupuesto);
$detallePresupuesto = PresupuestoDetalle::model()->findAll("presupuesto_id = {$numPresupuesto}");
//$elnumero = $laFactura->factura->numero;
?>
			<style type="text/css">
				#cuerpo{
				   font-size: 70%;
				}
				#total{
					/*color:red;*/
					background: #A9A9A9;
				}
			</style>

<div id="cuerpo" style="background-image: url(images/m_horizontal_presupuesto.jpg); background-repeat: no-repeat; height:100%; padding:0px 0px 0px 20px;">

<!-- <div style="height:175px"></div> -->
<!-- <div style="padding:170px 0px 0px 0px;"> -->

<div style="padding:90px 0px 0px 0px;">
<h5>Presupuesto de Prestación de Servicios</h5>
<p><b>Nombre: </b><?php 
echo $elPresupuesto->paciente->nombreCompleto;
?>
</p>
<p><b>N° de Identificación: </b><?php 
echo $elPresupuesto->paciente->n_identificacion;
Exemplo n.º 2
0
			
		<?php 
    }
}
?>
		</table>
	</div>	
</div>


<div clas = "row">
	<div class="span6">
		<!-- Presupuestos-->

		<?php 
$elPresupuesto = Presupuesto::model()->findAll("paciente_id = {$model->id}");
if (count($elPresupuesto) > 0) {
    ?>
				
				<div class="row">
					<div class="span1"></div>
					<div class="span10">
						<h3 class="text-center">Presupuestos generados</h3>
						<table class="table table-striped">
							<tr>
								<th>Fecha</th>
								<th>Estado</th>
								<th>Total</th>
								<th></th>
							</tr>
						<?php 
 public function actionActualizarLaboratorio()
 {
     $model = Contratos::model()->findByPk($_GET['id']);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     // if(isset($_POST['Presupuesto']))
     // {
     //$model->attributes=$_POST['Presupuesto'];
     $model->fecha = date("Y-m-d");
     $model->observaciones = $_POST['observaciones'];
     $model->usuario_id = $_POST['vendedor'];
     if ($model->save()) {
         $detalleP = ContratoDetalle::model()->findAll("contrato_id = {$model->id}");
         foreach ($detalleP as $detalle_P) {
             $detalle_P->delete();
         }
         $eltotal = 0;
         for ($i = 0; $i <= $_POST['variable']; $i++) {
             //$x = $i+1;
             //
             if (isset($_POST['linea_' . $i])) {
                 $detalleP = new ContratoDetalle();
                 $detalleP->presupuesto_id = $model->id;
                 $detalleP->linea_servicio_id = $_POST['linea_' . $i];
                 $detalleP->cantidad = $_POST['cantidad_' . $i];
                 $detalleP->vu = $_POST['vu_' . $i];
                 $detalleP->desc = $_POST['desc_' . $i];
                 $detalleP->vu_desc = $_POST['vu_desc_' . $i];
                 $detalleP->vt_sin_desc = $_POST['vt_sin_desc_' . $i];
                 $detalleP->vt_con_desc = $_POST['vt_con_desc_' . $i];
                 $detalleP->total = $_POST['total_' . $i];
                 $eltotal = $eltotal + $_POST['total_' . $i];
                 $detalleP->save();
             }
         }
         $paraTotal = Presupuesto::model()->findByPk($model->id);
         $paraTotal->total = $eltotal;
         $paraTotal->save();
     }
     $this->redirect(array('view', 'id' => $model->id));
     //}
     // $this->render('create',array(
     // 	'model'=>$model,
     // ));
 }
Exemplo n.º 4
0
 public function actionDelete($id)
 {
     if (Yii::app()->getRequest()->getIsPostRequest()) {
         $orden = $this->loadModel($id, 'OrdenTrabajo');
         $totalorden = $orden->sumita;
         $factura = $this->loadModel($orden->id_rf, 'RegistroFactura');
         if ($orden->delete()) {
             $iva = Ivas::model()->findBySql('SELECT valor_iva FROM ivas ORDER BY fecha DESC');
             $suma_bruto = $factura->sumarNeto() * ($iva['valor_iva'] / 100 + 1);
             $factura->setAttributes(array('total_neto' => $factura->sumarNeto(), 'total_bruto' => round($suma_bruto)));
             $factura->save();
             $presid = Presupuesto::model()->find('ano = :an ORDER BY modificado DESC', array(':an' => date("Y", strtotime($orden->fecha))));
             $presupuesto = $this->loadModel($presid->id, 'Presupuesto');
             $presupuesto->setAttributes(array('ppto_disponible' => $presupuesto->ppto_disponible + $totalorden));
             $presupuesto->save();
         }
         if (!Yii::app()->getRequest()->getIsAjaxRequest()) {
             $this->redirect(array('admin'));
         }
     } else {
         throw new CHttpException(400, Yii::t('app', 'Your request is invalid.'));
     }
 }
Exemplo n.º 5
0
}
//Anular Contrato
if ($model->estado == "Activo" and $model->saldo == $model->total and $losRealizados == 0) {
    ?>
				 	<a href="#anular" class="btn btn-small btn-info" data-toggle="modal"><i class="icon-download icon-white"></i> Anular Contrato</a>
			 	<?php 
}
?>
		<?php 
if ($model->presupuesto_id != Null) {
    $elPresupuesto = Presupuesto::model()->findByPk($model->presupuesto_id);
    ?>
					<a href="#presupuesto" class="btn btn-small btn-warning" data-toggle="modal"><i class="icon-asterisk icon-white"></i> Ver Presupuesto</a>
				<?php 
} else {
    $elPresupuesto = Presupuesto::model()->findByPk(0);
}
?>
		
	</div>

	<div class="span5">
	<?php 
if ($model->estado == "Activo") {
    ?>
		<?php 
    if ($valorRealizados == $model->total and $model->saldo == 0 and $tratamiento_programado == $tratamiento_realizado) {
        ?>
				<a href="index.php?r=contratos/completar&idContrato=<?php 
        echo $model->id;
        ?>
 /**
  * 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 $id the ID of the model to be loaded
  * @return Presupuesto the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Presupuesto::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function actionGuardarContratos()
 {
     if (!isset($_GET['idPaciente'])) {
         $model = new Contratos();
         //Buscar Presupuesto
         $elpresupuesto = Presupuesto::model()->findByPk($_GET['idpresupuesto']);
         $model->presupuesto_id = $elpresupuesto->id;
         $model->paciente_id = $elpresupuesto->paciente_id;
         $model->total = $elpresupuesto->total;
         $model->saldo = $elpresupuesto->total;
         $model->n_identificacion = $elpresupuesto->paciente->n_identificacion;
         $model->estado = "Sin Confirmar";
         $model->fecha_sola = date("Y-m-d");
         $model->fechahora = date("Y-m-d H:i:s");
         $model->vendedor_id = $elpresupuesto->vendedor_id;
         $model->usuario_id = $elpresupuesto->usuario_id;
         $model->observaciones = $elpresupuesto->observaciones;
         if ($model->save()) {
             $detallePresupuesto = PresupuestoDetalle::model()->findAll("presupuesto_id={$elpresupuesto->id}");
             foreach ($detallePresupuesto as $detalle_presupuesto) {
                 $detalleContrato = new ContratoDetalle();
                 $detalleContrato->contrato_id = $model->id;
                 $detalleContrato->linea_servicio_id = $detalle_presupuesto->linea_servicio_id;
                 $detalleContrato->cantidad = $detalle_presupuesto->cantidad;
                 $detalleContrato->vu = $detalle_presupuesto->vu;
                 $detalleContrato->desc = $detalle_presupuesto->desc;
                 $detalleContrato->vu_desc = $detalle_presupuesto->vu_desc;
                 $detalleContrato->vt_sin_desc = $detalle_presupuesto->vt_sin_desc;
                 $detalleContrato->vt_con_desc = $detalle_presupuesto->vt_con_desc;
                 $detalleContrato->estado = "Activo";
                 $detalleContrato->total = $detalle_presupuesto->total;
                 $detalleContrato->save();
             }
             $elpresupuesto->estado = "Contratado";
             $elpresupuesto->save();
             $ElTratamiento = ContratoDetalle::model()->find("contrato_id = {$model->id}");
             $paraTotal = Contratos::model()->findByPk($model->id);
             $paraTotal->tratamiento = $ElTratamiento->lineaServicio->nombre;
             $paraTotal->save();
         }
         $this->redirect(array('view', 'id' => $model->id));
         //
     } else {
         $model = new Contratos();
         // Uncomment the following line if AJAX validation is needed
         // $this->performAjaxValidation($model);
         // if(isset($_POST['Presupuesto']))
         // {
         //$model->attributes=$_POST['Presupuesto'];
         $datoPaciente = Paciente::model()->findByPk($_GET['idPaciente']);
         $model->paciente_id = $_GET['idPaciente'];
         $model->estado = "Activo";
         $model->n_identificacion = $datoPaciente->n_identificacion;
         $model->fechahora = date("Y-m-d H:i:s");
         $model->vendedor_id = $_POST['vendedor_id'];
         $model->observaciones = $_POST['observaciones'];
         $model->usuario_id = Yii::app()->user->usuarioId;
         if ($model->save()) {
             $eltotal = 0;
             for ($i = 0; $i <= $_POST['variable']; $i++) {
                 //$x = $i+1;
                 //
                 if (isset($_POST['linea_' . $i])) {
                     $detalleP = new ContratoDetalle();
                     $detalleP->contrato_id = $model->id;
                     $detalleP->linea_servicio_id = $_POST['linea_' . $i];
                     $detalleP->cantidad = $_POST['cantidad_' . $i];
                     $detalleP->vu = $_POST['vu_' . $i];
                     $detalleP->desc = $_POST['desc_' . $i];
                     $detalleP->vu_desc = $_POST['vu_desc_' . $i];
                     $detalleP->vt_sin_desc = $_POST['vt_sin_desc_' . $i];
                     $detalleP->vt_con_desc = $_POST['vt_con_desc_' . $i];
                     $detalleP->total = $_POST['total_' . $i];
                     $detalleP->estado = "Activo";
                     $eltotal = $eltotal + $_POST['total_' . $i];
                     $detalleP->save();
                 }
             }
             $ElTratamiento = ContratoDetalle::model()->find("contrato_id = {$model->id}");
             $paraTotal = Contratos::model()->findByPk($model->id);
             $paraTotal->tratamiento = $ElTratamiento->lineaServicio->nombre;
             $paraTotal->total = $eltotal;
             $paraTotal->saldo = $eltotal;
             $paraTotal->save();
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
 }