Ejemplo n.º 1
0
 private function proceso($idevento, $id)
 {
     $mensaje = "";
     $compra = Ocompra::model()->findByPk($id);
     switch ($idevento) {
         case 65:
             ///APROB
             if (Ocompra::puedeautorizar()) {
                 $filas = $compra->detallefirme;
                 foreach ($filas as $row) {
                     // $filafirme=Docompra::model()->findByPk($row->id);//solo si
                     //Solo si no esta anulado
                     $row->setScenario('cambiaestado');
                     if (in_array($row->estadodetalle, Estado::estadosnocalculablesdetalle($compra->coddocu))) {
                         $row->estadodetalle = ESTADO_DOCOMPRA_APROBADO;
                     }
                     if (!$row->save()) {
                         $mensaje .= " Ocurrió un error  en el item " . $row->item . " al guardar los datos del estado detalle  <br>";
                     }
                 }
             } else {
                 $mensaje .= " No tiene permisos para efectuar esta acción <br>";
             }
             break;
         case 67:
             ///deshacer APROBACIOPN
             ///AQUI YA NNOS ETRABAJA CON EL BUFFER SE TRABAJADA CON LA TABAL ORIIGNAL
             $filas = $compra->detallefirme;
             foreach ($filas as $row) {
                 //$filafirme=Docompra::model()->findByPk($row->id);
                 if ($row->cantidadentregada > 0) {
                     $mensaje .= "  El item " . $row->item . "  Ya tiene ingreso de almacen <br>";
                 } else {
                     //si no tiene atenciones entonces normal no mas Revertimos
                     $row->setScenario('cambiaestado');
                     if (in_array($row->estadodetalle, Estado::estadosnocalculablesdetalle($compra->coddocu))) {
                         $row->estadodetalle = ESTADO_DOCOMPRA_CREADO;
                     }
                     $mensaje .= $row->save() ? "" : " No se pudo revertir  el item " . $row->item . "<br>";
                     /*print_r($row->geterrors());
                       print_r($row->geterrors());yii::app()->end();*/
                 }
                 //refrescar el buffer
                 $this->ClearBuffer($id);
                 //Limpia temporal
                 $this->IniciaBuffer($id);
                 //Levanta temporales
             }
             break;
         case 66:
             ///aNULAR
             //aqui hayq ue tabajar directametne cn la tabla firme DOCOMPRA
             $filas = $compra->detallefirme;
             //aqui hayq ue tabajar directametne cn la tabla firme DOCOMPRA
             foreach ($filas as $row) {
                 if ($row->cantidadentregada > 0) {
                     $mensaje .= "  El item " . $row->item . "  Ya tiene ingresos de almacen <br>";
                 } else {
                     //si no tiene atenciones entonces normal no mas Revertimos
                     $row->setScenario('cambiaestado');
                     $row->estadodetalle = ESTADO_DOCOMPRA_ANULADO;
                     $mensaje .= $row->save() ? "" : " No se pudo anular el item " . $row->item . "<br>";
                 }
             }
             //refrescar el buffer
             $this->ClearBuffer($id);
             //Limpia temporal
             $this->IniciaBuffer($id);
             //Levanta temporales
             break;
     }
     return $mensaje;
 }
Ejemplo n.º 2
0
 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);
 }