예제 #1
0
 public function actionVentasCallCenter()
 {
     $this->perfil();
     $model = new Ventas();
     $flex = new ReportesFlex();
     //if (isset($_GET['grid_mode'],$_GET['evento'],$_GET['funcion']) and $_GET['grid_mode']=='export'){
     if (isset($_POST['grid_mode']) and $_POST['grid_mode'] == 'export') {
         $funcion = isset($_POST['funcion_id']) ? $_POST['funcion_id'] : $_POST['funcion'];
         $this->widget('application.extensions.EExcelView', array('dataProvider' => $flex->getCallCenter($_POST['evento_id'], $funcion), 'grid_mode' => 'export', 'columns' => array(array('header' => 'Fecha', 'value' => '$data["VentasFecHor"]'), array('header' => 'Funcion', 'value' => '$data["funcionesTexto"]'), array('header' => 'Zona', 'value' => '$data["ZonasAli"]'), array('header' => 'Fila', 'value' => '$data["FilasAli"]'), array('header' => 'Asiento', 'value' => '$data["LugaresLug"]'), array('header' => 'Referencia', 'value' => '$data["VentasNumRef"]'), array('header' => 'Impresiones', 'value' => '$data["vecesImpreso"]'))));
         Yii::app()->end();
     }
     if (!empty($_POST)) {
         $eventoId = $_POST['evento_id'];
         $funcionesId = empty($_POST['funcion_id']) ? "TODAS" : $_POST['funcion_id'];
         $this->render('ventasCallCenter', array('model' => $flex, 'eventoId' => $eventoId, 'funcionesId' => $funcionesId));
     } else {
         $this->render('ventasCallCenter', array('model' => $flex));
     }
 }
예제 #2
0
파일: ReportesVentas.php 프로젝트: cicb/tpc
 public function getUltimasVentas($eventoId, $funcionesId = "TODAS")
 {
     $modelo = new ReportesFlex();
     $desde = date("Y-m-d", strtotime("-2 day"));
     $hasta = date("Y-m-d");
     $funcion = "";
     if ($funcionesId > 0) {
         $funcion = sprintf(" AND FuncionesId = '%s' ", $funcionesId);
     }
     $reporte = $modelo->getReporte($eventoId, $funcion, $desde, $hasta, $cargo = false, $tipoBoleto = 'NORMAL,BOLETO DURO', $where = '', $group_by = 'DAYOFYEAR(VentasFecHor)', $campos = ", \tCASE DATE(VentasFecHor) \n\t\t\t\t\tWHEN DATE_SUB(curdate(), INTERVAL 2 DAY) THEN 'antier'\n\t\t\t\t\tWHEN DATE_SUB(curdate(), INTERVAL 1 DAY) THEN 'ayer'\n\t\t\t\t\tWHEN CURDATE() THEN 'hoy'\n\t\t\t\t\tEND  AS dia ");
     $matrix = array('hoy' => array('titulo' => 'Venta hoy', 'boletos' => 0, 'importe' => 0), 'ayer' => array('titulo' => 'Venta ayer', 'boletos' => 0, 'importe' => 0), 'antier' => array('titulo' => 'Venta antier', 'boletos' => 0, 'importe' => 0));
     foreach ($reporte->getData() as $fila) {
         $matrix[$fila['dia']]['boletos'] = number_format($fila['cantidad']);
         $matrix[$fila['dia']]['importe'] = number_format($fila['total']);
     }
     return $matrix;
 }