コード例 #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Desolpe();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Desolpe'])) {
         $model->attributes = $_POST['Desolpe'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #2
0
ファイル: SolpeController.php プロジェクト: hipogea/zega
 public function actionCargafavorito($id)
 {
     $id = (int) MiFactoria::cleanInput($id);
     $modelodetalle = new Desolpe();
     $modelodetalle->valorespordefecto();
     $modelocabeza = Solpe::model()->findbypk($id);
     if (is_null($modelocabeza)) {
         throw new CHttpException(500, 'No existe esta solicitud con este ID');
     }
     if ($this->eseditable($modelocabeza->estado)) {
         if (isset($_POST['Desolpe'])) {
             $modelodetalle->attributes = $_POST['Desolpe'];
             /*$criterio=New CDbcriteria;
             		$criterio->addcondition("hidsolpe=:vhidsolpe");
             		$criterio->params=Array(":vhidsolpe"=>$modelodetalle->idenfavorito);
             		*/
             $listafavoritos = Listamateriales::model()->findByPk($modelodetalle->idenfavorito)->hijos;
             // echo " esto es ".count($listafavoritos);
             //yii::app()->end();
             foreach ($listafavoritos as $fila) {
                 // if($fila['est'] <> '02' and $fila['est'] <> '99' ) //SIEMPRE QUE SEA UN ESTADO VALIDO
                 // {
                 $registro = new Desolpe();
                 $registro->setScenario('insert');
                 $registro->attributes = $modelodetalle->attributes;
                 $registro->codart = $fila->codigo;
                 $registro->um = $fila->um;
                 $registro->txtmaterial = $fila->maestro->descripcion;
                 $registro->cant = $fila->cant;
                 //$registro->tipsolpe='M';
                 $registro->hidsolpe = $modelocabeza->id;
                 $registro->codocu = '350';
                 if ($registro->save()) {
                     Yii::app()->user->setFlash('success', " Se Agrego la lista '" . $registro->codart . "' a la solicitud ");
                 } else {
                     // echo " NO grabo  \n";
                     // print_r($registro->attributes);
                 }
                 //  }
             }
             //Close the dialog, reset the iframe and update the grid
             echo CHtml::script("window.parent.\$('#cru-dialogdetalle').dialog('close');\n\t\t\t\t\t\t\t\t\twindow.parent.\$('#cru-detalle').attr('src','');\n\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('detalle-grid');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
             Yii::app()->user->setFlash('success', " Se Agrego la lista  a la solicitud ");
             $this->render('update', array('model' => $modelocabeza, 'idcabeza' => $modelocabeza->id));
             Yii::app()->end();
         }
         // if (!empty($_GET['asDialog']))
         $this->layout = '//layouts/iframe';
         $this->render('_form_cargafavorito', array('model' => $modelodetalle));
     } else {
         throw new CHttpException(500, 'No se puede agregar mas items a esta solpe');
     }
 }
コード例 #3
0
ファイル: MiFactoria.php プロジェクト: hipogea/zega
 public static function CreaSolpeAutomatica($codocu, $id)
 {
     $solpe = new Solpe();
     $solpe->textocabecera = "Documento automático";
     $solpe->hidref = $id;
     $solpe->codocuref = $codocu;
     $solpe->escompra = '0';
     if (!$solpe->save()) {
         print_r($solpe->getErrors());
         yii::app()->end();
     }
     $solpe->refresh();
     $identidad = $solpe->id;
     unset($solpe);
     $registrospeticiones = self::Devuelvepeticioneshijos($id);
     foreach ($registrospeticiones as $fila) {
         $registrodesolpe = new Desolpe();
         $registrodesolpe->setScenario('insert');
         $registrodesolpe->hidsolpe = $identidad;
         $registrodesolpe->cant = $fila->cant;
         $registrodesolpe->codart = $fila->codart;
         $registrodesolpe->um = $fila->um;
         $registrodesolpe->txtmaterial = $fila->descripcion;
         $registrodesolpe->imputacion = $fila->imputacion;
         $registrodesolpe->centro = $fila->codcen;
         $registrodesolpe->codal = $fila->codal;
         $registrodesolpe->item = $fila->item;
         $registrodesolpe->tipimputacion = 'V';
         ////debe de implemntarse la progrtamacion del plan de ventas
         ///temporalmente quieda con programacion plana
         $registrodesolpe->fechaent = date("Y-m-d");
         $registrodesolpe->tipsolpe = $fila->tipo;
         if (!$registrodesolpe->save()) {
             print_r($registrodesolpe->getErrors());
             yii::app()->end();
         }
         unset($registrodesolpe);
     }
     $nuevasolpe = Solpe::model()->findByPk($identidad);
     //$nuevasolpe->save();
     if (!$nuevasolpe->save()) {
         print_r($nuevasolpe->getErrors());
         yii::app()->end();
     }
 }
コード例 #4
0
 public function actualizasolpenueva($kardex, $desolpe, $inventario)
 {
     $cadena = "";
     $modeloreserva = Alreserva::model()->find("hidesolpe=:hidesolpex and codocu='450' ", array("hidesolpex" => $kardex->idref));
     $modeloreserva->setScenario('cambiaestado');
     if ($kardex->codmov == '10') {
         $modeloreserva->estadoreserva = '20';
         ///actualizar a reserva ATENDIDA
         $cantidadreservada = $modeloreserva->cant;
         if ($cantidadreservada == $modelodetalle->cant) {
             //si lo que pidio es lo que se reresvo es una atencion total
             $modelodetalle->est = '40';
             //atendido totalmente
         } else {
             //en cambio
             if (!$cantidadreservada > 0) {
                 //si es una cantidad reservada > 0 quiere decir que es parcial , si es cero el status no varia
                 $modelodetalle->est = '50';
             }
             //atendido parcialmente
         }
         //actualizamos el precio unitario real del detalle de la Solpe
         $desolpe->punitreal = $inventario->punit + $inventario->punitdif;
         $desolpe->atendido = date("Y-m-d H:i:s");
     }
     if ($kardex->codmov == '20') {
         $desolpe->est = '60';
         //Volver a colocar el estado 'reservado'
         //refrescar  el status de la reserva tambien pe...
         $desolpe->estadoreserva = '10';
         ///
         $desolpe->punitreal = 0;
         $desolpe->atendido = null;
     }
     if ($kardex->codmov == '70') {
         //Insertar un nuevo registro en  la solpe para dar fe de que se ha reingresado
         $desolpe->punitreal = $inventario->punit + $inventario->punitdif;
         $nuevasolpe = new Desolpe();
         $nuevasolpe->atttributes = $desolpe->getAttributes();
         $nuevasolpe->cant = -1 * abs($kardex->cant);
         $nuevasolpe->um = $kardex->um;
         if (!$nuevasolpe->save()) {
             $cadena .= " Hubo un error al registrar el reingreso de la Solpe  " . $desolpe->desolpe_solpe->numero . "-" . $desolpe->item . " ";
         }
         //$desolpe->est='06'; //Volver a colocar el estado 'reservado'
         //refrescar  el status de la reserva tambien pe...
         //$desolpe->estadoreserva='01'; ///
         //$desolpe->punitreal=0;
         //$desolpe->atendido=null;
     }
     if ($desolpe->save() and $modeloreserva->save()) {
         //Yii::app()->user->setFlash('succcess', " La solicitud  ".$modelodetalle->desolpe_solpe->numero."-".$modelodetalle->item. " se ha actualizado");
     } else {
         $cadena .= " Hubo un error al grabar los datos de la solicitud  " . $desolpe->desolpe_solpe->numero . "-" . $desolpe->item . " ";
         //$transaccion->rollback();
         //yii::app()->end();
     }
 }
コード例 #5
0
ファイル: EjemplosController.php プロジェクト: hipogea/zega
 public function actionRutas()
 {
     // echo Contactos::getListMailContacto ( 33 , '421' ) ;
     $cadena = yii::app()->correo->correo_simple('*****@*****.**', '*****@*****.**', 'SOLICITUD DE COTIZACION', " favor de cotizar los siguiente s mateiale   ");
     var_dump($cadena);
     yii::app()->end();
     $modelokardex = Alkardex::model()->findByPk(2408);
     // $transacc=Yii::app()->db->beginTransaction();
     $nuevo = new Alkardex();
     $nuevo->attributes = $modelokardex->attributes;
     $nuevo->numdocref = 'PICHOx';
     $nuevo->save();
     print_r($nuevo->attributes);
     yii::app()->end();
     $model = new Desolpe();
     $model->save();
     yii::app()->mensajes->clear();
     yii::app()->mensajes->setmessageitem('350', 456, "eSTE ES MI PRIMER MEJSAE ", 'notice');
     yii::app()->mensajes->setmessageitem('350', 455, "eSTE ES MI segundo MEJSAE ", 'notice');
     yii::app()->mensajes->setmessageitem('350', 455, yii::app()->mensajes->getErroresItem($model->geterrors()), 'error');
     yii::app()->mensajes->setmessageitem('350', 455, "eSTE ES MI tercer MEJSAE ", 'notice');
     //print_r(yii::app()->session['errores']);
     $matriz = yii::app()->mensajes->getMessages('350');
     print_r($matriz);
     yii::app()->end();
     var_dump(Ocompra::puedeautorizar());
     var_dump(Montoinventario::datosgrafo('mes', 6, null));
     $mo = new Alinventario();
     print_r($mo->getStockValAlmacen());
     $data = Ocompra::historicoprecios('18005720');
     print_r($data->getData());
     echo " Yii::getPathOfAlias('webroot') :  " . Yii::getPathOfAlias('webroot') . "<br>";
     //echo "yii::app()->params['webRoot']     :     ".yii::app()->params['webRoot']."<br> ";
     echo "yii::app()->baseUrl     :     " . yii::app()->baseUrl . "<br> ";
     echo "yii::app()->getBaseUrl(true)     :     " . yii::app()->getBaseUrl(true) . "<br> ";
     echo "yii::app()->getBaseUrl(false)     :     " . yii::app()->getBaseUrl(false) . "<br> ";
     echo "yii::app()->basePath      :     " . yii::app()->basePath . "<br> ";
     echo "yii::app()->baseUrl     :     " . yii::app()->baseUrl . "<br> ";
     echo "Yii::app()->getTheme()->baseUrl    :    " . Yii::app()->getTheme()->baseUrl . "<br> ";
     echo "Yii::app()->getTheme()->basePath    :    " . Yii::app()->getTheme()->basePath . "<br> ";
     echo "Yii::app()->getTheme()->systemViewPath    :    " . Yii::app()->getTheme()->systemViewPath . "<br> ";
     echo "Yii::app()->getTheme()->viewPath    :    " . Yii::app()->getTheme()->viewPath . "<br> ";
     echo "Yii::app()->getHomeUrl()            :    " . Yii::app()->getHomeUrl() . "  <br>";
     echo "Yii::app()->runtimePath             :  " . Yii::app()->runtimePath . "<br> ";
     echo "yii::app()->request->getServerName()     :     " . yii::app()->request->getServerName() . "<br> ";
     echo "yii::app()->request->hostInfo     :     " . yii::app()->request->hostInfo . "<br> ";
     echo "yii::app()->request->pathInfo     :     " . yii::app()->request->pathInfo . "<br> ";
     echo "yii::app()->request->serverName     :     " . yii::app()->request->serverName . "<br> ";
     echo "yii::app()->request->url     :     " . yii::app()->request->url . "<br> ";
     echo "yii::app()->request->userHostAddress     :     " . yii::app()->request->userHostAddress . "<br> ";
     echo "<br><br><br>";
     echo "<br><br><br>";
     echo "Archivos del directorio " . Yii::app()->getTheme()->basePath . "  <br>";
     $archivos = CFileHelper::findFiles(Yii::app()->getTheme()->basePath . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'reportes', array('fileTypes' => array('css'), 'exclude' => array(), 'level' => -1, 'absolutePaths' => false));
     print_r($archivos);
 }