<td > 區域: <?php echo CHtml::dropDownList('qry_area', '', CHtml::listData(TbsArea::model()->findAll(array('order' => 'id ASC', 'condition' => 'opt1=1')), 'id', 'areaname'), array('prompt' => '選擇分區', 'options' => array($qry_area => array('selected' => 'selected')), 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('tbsCom/dynamicstores', array('update' => 'qry_area')), 'update' => '#TbaLog_storecode'))); ?> <br> 門市: <?php echo $form->dropDownList($model, 'storecode', CHtml::listData(TbsStore::model()->findAll(array('order' => 'id ASC', 'condition' => 'opt1=1')), 'storecode', 'storename'), array('prompt' => '選擇門市', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('tbsCom/dynamicemps', array('model' => 'TbaLog', 'column' => 'storecode', 'empty' => FALSE)), 'update' => '#TbaLog_empno'))); ?> </td> <td> 員工 *: <?php echo $form->dropDownList($model, 'empno', CHtml::listData(TbsEmpMonth::model()->findAll(array('order' => 'id ASC', 'condition' => 'opt3<>2')), 'empno', 'empname'), array('empty' => '選擇員工')); ?> <?php echo $form->error($model, 'empno'); ?> <br> <?php echo $form->labelEx($model, 'logday'); ?> <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'logday', 'options' => array('showAnim' => 'slideDown', 'changeMonth' => true, 'changeYear' => true, 'dateFormat' => 'yymmdd'), 'htmlOptions' => array('style' => 'width:100px;'))); ?>
public function actionRpt11() { //用以計算開始/結束時間之變數 $time_start = microtime(true); //決定是門市設計師按鈕功能,false則是每日業績按鈕功能 $isExist = true; //查詢的年月 $qry_date = date('Ym'); //區域 $qry_area = ""; //門市 $qry_store = ""; //顯示銷售情報 $check_sale_Intelligence = 0; if (isset($_GET['storecode']) && isset($_GET['pdate'])) { Yii::app()->session['storecode'] = $_GET['storecode']; Yii::app()->session['pdate'] = $_GET['pdate']; $this->redirect(array('rpt11')); //跳轉回rpt11頁面 } else { if (isset($_POST['qry_date'])) { $qry_date = $_POST['qry_date']; } if (isset($_POST['qry_area'])) { $qry_area = $_POST['qry_area']; } if (isset($_POST['qry_store'])) { $qry_store = $_POST['qry_store']; } if (isset($_POST['check_sale_Intelligence'])) { $check_sale_Intelligence = $_POST['check_sale_Intelligence']; } if (Yii::app()->session['storecode'] != '' && Yii::app()->session['pdate'] != '') { $qry_store = Yii::app()->session['storecode']; $qry_date = Yii::app()->session['pdate']; //沒使用到清空 unset(Yii::app()->session['storecode']); unset(Yii::app()->session['pdate']); } } //切割出年份 $tmp_year = substr($qry_date, 0, 4); //切割出月份 $tmp_mon = substr($qry_date, 4, 2); //月底 $dateS = date("Ymd", mktime(24, 0, 0, $tmp_mon, 0, $tmp_year)); //月初 $dateE = date("Ymd", mktime(0, 0, 0, $tmp_mon + 1, 0, $tmp_year)); // 取得欄位 $col = $this->getRpt11Col($check_sale_Intelligence); // 取得表頭 $title = $this->getRpt11Title(); // 取得欄位2 $acol = $this->getRpt11_daily_Col(); // 取得表頭2 $atitle = $this->getRpt11_daily_Title(); // 取得欄位3 $acol2 = $this->getRpt11_daily2_Col(); // 取得表頭3 $atitle2 = $this->getRpt11_daily2_Title(); // 輸出在畫面上的陣列 $colAry = array(); $colAry2 = array(); $colAry3 = array(); //其他項目包含少收 $other = array(); // 門市. 門市ID $storeAry = array(); $storeAreaId = array(); $TbsStores = TbsStore::model()->findAllByAttributes(array('opt1' => 1)); foreach ($TbsStores as $store) { $storeAry[$store->storecode] = $store->storename; $storeAreaId[$store->storecode] = $store->area_id; } unset($TbsStores); // 區域 $areaAry = array(); $TbsAreas = TbsArea::model()->findAllByAttributes(array('opt1' => 1)); foreach ($TbsAreas as $area) { $areaAry[$area->id] = $area->areaname; } unset($TbsAreas); // 職位 $positionAry = array(); $TbsPositions = TbsPosition::model()->findAllByAttributes(array('opt1' => 1)); foreach ($TbsPositions as $pos) { $positionAry[$pos->id] = $pos->pcname; } unset($TbsPositions); // 薪資, 責任額 $salaryAry = array(); $dutyAry = array(); $TbsBaseSalary = TbsBasesalary::model()->findAllByAttributes(array('opt1' => 1)); foreach ($TbsBaseSalary as $salary) { $salaryAry[$salary->id] = $salary->salary; $dutyAry[$salary->id] = $salary->duty; } unset($TbsBaseSalary); //員工SQL $qryStrno = ''; $check_area = TRUE; $check_store = TRUE; $check_all = TRUE; $check_query = TRUE; //如果有選門市,就只選出那一家門市 if ($qry_store != '') { $tbsStroes = TbsStore::model()->findAllByAttributes(array('storecode' => $qry_store)); if (count($tbsStroes) < 1) { $check_store = FALSE; } //如果只選區域,就選出區域內的所有門市 } elseif ($qry_area != '') { $tbsStroes = TbsStore::model()->findAllByAttributes(array('area_id' => $qry_area)); if (count($tbsStroes) < 1) { $check_area = FALSE; } //如果都沒有選,就全部選出來 } else { $tbsStroes = TbsStore::model()->findAll(); if (count($tbsStroes) < 1) { $check_all = FALSE; } } // 儲存篩選出的門市的店編 $sqlStroe = array(); foreach ($tbsStroes as $store) { //找出篩選出的門市的區域代碼 $area = TbsArea::model()->findByPK($store->area_id); if ($area != NULL) { //push店編 array_push($sqlStroe, $store->storecode); } } // 查詢用的SQL $qryStr = ''; //如果有選門市或區域就需要sql=AND storecode in('007001',007002') if ($qry_store != '' or $qry_area != '') { //sql=sql.in('007001')因為只有一筆的時候沒有' , ' 所以直接把店編放進去 if (count($sqlStroe) > 0) { // $qryStr = " AND storecode in ('$sqlStroe[0]'"; $qryStr = "WHERE a.storecode in ('{$sqlStroe['0']}'"; //如果門市>1,就需要' , ' if (count($sqlStroe) > 1) { for ($i = 1; $i < count($sqlStroe); $i++) { $qryStr = $qryStr . ",'{$sqlStroe[$i]}'"; } } $qryStr = $qryStr . ")"; } } $empSql = "SELECT a.empno, a.daymonth, a.storecode\n FROM (\n tbs_emp_month a\n INNER JOIN (\n SELECT id, empno, MAX( daymonth ) AS daymonth, storecode\n FROM tbs_emp_month\n WHERE depart = '3'\n AND daymonth <= '{$qry_date}'\n GROUP BY empno\n )b ON a.empno = b.empno\n AND a.daymonth = b.daymonth\n ) {$qryStr} "; $result = Yii::app()->db->createCommand($empSql)->queryAll(); //sql=sql.in('007001')因為只有一筆的時候沒有' , ' 所以直接把店編放進去 if (count($result) > 0) { $qryStrno = " AND empno in ('" . $result[0]['empno'] . "'"; //如果名單>1,就需要' , ' if (count($result) > 1) { for ($i = 1; $i < count($result); $i++) { $qryStrno = $qryStrno . ",'" . $result[$i]['empno'] . "'"; } } $qryStrno = $qryStrno . ")"; } else { if ($check_store && $check_area) { $check_query = FALSE; } if ($check_store) { Yii::app()->user->setFlash('error', '查無門市所屬人員,請重新查詢!'); } if ($check_area) { Yii::app()->user->setFlash('error', '查無區域所屬門市及人員!'); } } unset($result); $empAry = array(); $sql = ''; if (isset($_POST['qry_designer']) && $check_query or $qry_store != '' && $qry_date != '' && !isset($_POST['qry_daily']) && $check_query) { //OR $qry_store!='' && $qry_date!='' && $check_query 為了GET //查到15號的業績 $midday = date("Ymd", mktime(0, 0, 0, $tmp_mon, 15, $tmp_year)); $sql = "SELECT empno, serviceno, sum(num) as num FROM tbp_perform_emp_log " . "WHERE pdate BETWEEN '{$dateS}' AND '{$dateE}' {$qryStrno} " . "GROUP BY empno, serviceno ORDER BY empno "; $sql2 = "SELECT empno, serviceno, sum(num) as num FROM tbp_perform_emp_log " . "WHERE pdate BETWEEN '{$dateS}' AND '{$midday}' {$qryStrno} " . "GROUP BY empno, serviceno ORDER BY empno "; $result1 = Yii::app()->db->createCommand($sql)->queryAll(); $empAry = $this->setEmpAry($result1); $result2 = Yii::app()->db->createCommand($sql2)->queryAll(); $empAry = $this->setMidEmpAry($empAry, $result2); // 查出洗髮+10元的剪髮顆數跟洗頭數 $sql3 = "SELECT a.empno, sum(b.num) as cut, sum(a.num) as wash\n FROM \n (\n SELECT pdate, storecode, empno, num \n FROM `tbp_perform_emp_log` \n WHERE pdate BETWEEN '{$dateS}' AND '{$dateE}' {$qryStrno} AND serviceno = 'D01' \n ) a\n ,\n (\n SELECT pdate, storecode, empno, num \n FROM `tbp_perform_emp_log` \n WHERE pdate BETWEEN '{$dateS}' AND '{$dateE}' {$qryStrno} AND serviceno = 'A01'\n ) b \n WHERE a.pdate = b.pdate AND a.storecode = b.storecode AND a.empno = b.empno\n GROUP BY a.empno"; $result3 = Yii::app()->db->createCommand($sql3)->queryAll(); $empAry = $this->setWashEmpAry($empAry, $result3, 'col10', 'col12'); // 查出洗髮不加10元的剪髮顆數跟洗頭數 $sql4 = "SELECT a.empno, sum(b.num) as cut, sum(a.num) as wash\n FROM \n (\n SELECT pdate, storecode, empno, sum(num) as num\n FROM `tbp_perform_emp_log` \n WHERE pdate BETWEEN '{$dateS}' AND '{$dateE}' {$qryStrno} AND serviceno IN ('S02','S06')\n GROUP BY pdate, storecode, empno\n ) a\n ,\n (\n SELECT pdate, storecode, empno, sum(num) as num\n FROM `tbp_perform_emp_log` \n WHERE pdate BETWEEN '{$dateS}' AND '{$dateE}' {$qryStrno} AND serviceno IN ('A01','S01','S05')\n GROUP BY pdate, storecode, empno\n ) b \n WHERE a.pdate = b.pdate AND a.storecode = b.storecode AND a.empno = b.empno\n GROUP BY a.empno"; $result4 = Yii::app()->db->createCommand($sql4)->queryAll(); $empAry = $this->setWashEmpAry($empAry, $result4, 'col11', 'col13'); foreach ($empAry as $empno => $empData) { // 查詢員工薪資福利 $empMonth = new TbsEmpMonth(); $empMonth = TbsEmpMonth::model()->findByDayMonth($empno, $qry_date); $user = User::model()->findByPk($empno); if ($empMonth != NULL) { $row = array(); //員編 $row['empno'] = $empno; // 年月 $row['ym'] = $qry_date; // 營業區 $row['area'] = $areaAry[$empMonth->area]; // 門市 $row['store'] = $storeAry[$empMonth->storecode]; // 職稱 $row['position'] = $positionAry[$empMonth->position1]; // 姓名 $row['name'] = $user->emp ? $user->emp->empname : ''; // 到職日 $row['arrivedate'] = Yii::app()->dateFormatter->format("yyyy-MM-dd", $empMonth->arrivedate, "yyyy-MM-dd"); // 狀態 $row['status'] = TbsEmp::model()->getHireType($empMonth->hiretype); // 底薪 $row['salary'] = $salaryAry[$empMonth->salary]; //已休 $row['vacation'] = ' '; // 責任業績, 區店長需動態算, opt2欄位設成管理門市數 // if($empMonth->position1 == 9){ // $areaduty = TbsAreaduty::model()->findByAttributes(array('storenum'=>$empMonth->opt2)); // if(isset($areaduty)) // $row['duty'] = $areaduty->duty; // }else $row['duty'] = $dutyAry[$empMonth->salary]; // 設定各欄位業績及洗助算法 $row = $this->setRpt11RowData($row, $empData); // 達成率 $rate = $row['duty'] == 0 ? 0 : round($row['perform'] / $row['duty'], 4); $row['rate'] = $rate * 100 . "%"; // CVarDumper::dump($empData,10,true); // // 是否達成 $row['achi'] = $rate >= 1 ? '達成' : '未達成'; if ($row['perform'] + $row['assist'] > 0) { // ================== 以下是期中 ========================== // CVarDumper::dump($midasum,10,TRUE); // 設定各欄位業績及洗助算法 $row = $this->setRpt11MidRowData($row, $empData); } // 期中業績(不含洗住) $row['col8'] = $row['midperform']; // 期中責任業績 $row['midduty'] = $row['duty']; // 達成率 if ($row['midduty'] > 0) { $rate = $row['midduty'] == 0 ? 0 : round($row['midperform'] / $row['midduty'], 4); $row['midrate'] = $rate * 100 . "%"; } else { $row['midrate'] = "0%"; } // 是否達成 $row['midachi'] = $rate >= 0.5 ? '達成' : '未達成'; if ($row['midperform'] + $row['midassist'] > 0) { //期末業績成長率 if ($row['midperform'] > 0) { $ratecol14 = round(($row['perform'] - $row['midperform'] - $row['midperform']) / $row['midperform'], 4); // print_r($ratecol14); $row['col7'] = $ratecol14 * 100 . "%"; } else { $row['col7'] = "0%"; } } array_push($colAry, $row); } else { Yii::app()->user->setFlash('error', "查無員工 {$empno} " . (isset($user->emp) ? $user->emp->empname : '') . " ,{$qry_date} 月的薪資福利資料"); break; } } unset($empAry); //統計結果 //$total=$this->getTotal($colAry); } elseif (isset($_POST['qry_daily'])) { $isExist = false; /*--以下為每日業績--*/ //儲存所選門市當月總業績金額 $all_amount = array(); //儲存所選門市當月每天業績金額 $amount = array(); //每一行的陣列 $Arylog = array(); if (isset($_POST['qry_store']) && $qry_store != '') { //門市總業績 $perform_sql = ''; $perform_sql = "SELECT mid(pdate,1,6) AS pdate , storecode ,storename , sum(total) AS total FROM tbp_perform \n WHERE mid(pdate,1,6)={$qry_date} and storecode='{$qry_store}' "; $perform_result = Yii::app()->db->createCommand($perform_sql)->queryAll(); //先將該門市整個月的業績存在all_amount array()裡 if ($perform_result > 0) { foreach ($perform_result as $value) { $all_amount[$value['pdate']] = $value['total']; } unset($perform_result); } //該門市有業績的人員資料 $personsql = ''; $personsql = "SELECT mid(a.pdate,1,6) AS pdate , c.areaname ,d.storecode ,d.storename \n , b.position1 , a.empno , a.empname , b.arrivedate ,b.hiretype\n\n FROM tbp_perform_emp AS a ,tbs_emp_month AS b ,tbs_area AS c , tbs_store AS d\n\n where mid(a.pdate,1,6)='{$qry_date}' and a.storecode='{$qry_store}' and\n a.empno=b.empno and b.area=c.id and b.storecode=d.storecode\n\n and d.storecode=(SELECT storecode FROM tbs_emp_month\n where empno=a.empno and daymonth <='{$qry_date}'\n order by daymonth DESC LIMIT 1) "; //group by a.empno $person_result = Yii::app()->db->createCommand($personsql)->queryAll(); //撈出在該門市有業績的員編 $temp_arr = array(); if (count($person_result) > 0) { for ($i = 0; $i < count($person_result); $i++) { array_push($temp_arr, $person_result[$i]['empno']); } } //if(count($person_result)>0){ $_str = "'" . implode("','", $temp_arr) . "'"; //每個員編加入單引號為了sql in查詢使用 //得到員工剪、染、洗等.. $personsql2 = ''; $personsql2 = "SELECT empno,empname ,serviceno, sum(num) as num FROM tbp_perform_emp_log \n WHERE mid(pdate,1,6)='{$qry_date}' and storecode='{$qry_store}' \n and empno in({$_str}) and num!=0\n GROUP BY empno, serviceno ORDER BY empno , serviceno"; $person_result2 = Yii::app()->db->createCommand($personsql2)->queryAll(); $person_result2 = $this->setEmpAry($person_result2); //有業績的人員資料及員工剪、染、洗等..,放在一起 for ($i = 0; $i < count($person_result); $i++) { $empno = $person_result[$i]['empno']; if (isset($person_result2[$empno])) { $emp = $person_result2[$empno]; $emp['pdate'] = $person_result[$i]['pdate']; $emp['areaname'] = $person_result[$i]['areaname']; $emp['storecode'] = $person_result[$i]['storecode']; $emp['storename'] = $person_result[$i]['storename']; $emp['position1'] = $person_result[$i]['position1']; $emp['empno'] = $person_result[$i]['empno']; $emp['empname'] = $person_result[$i]['empname']; $emp['arrivedate'] = $person_result[$i]['arrivedate']; $emp['hiretype'] = $person_result[$i]['hiretype']; $person_result2[$empno] = $emp; } else { continue; } } foreach ($person_result2 as $empno => $empData) { $row = array(); // 年月 $row['ym'] = $empData['pdate']; // 營業區 $row['areaname'] = $empData['areaname']; // 門市編號(為了計算本店與別店的占比) $row['storecode'] = $empData['storecode']; // 門市 $row['storename'] = $empData['storename']; // 職稱 $row['position'] = $positionAry[$empData['position1']]; // 姓名 $row['empname'] = $empData['empname']; // 到職日期 $row['arrivedate'] = $empData['arrivedate']; // 狀態 $row['hiretype'] = TbsEmp::model()->getHireType($empData['hiretype']); // 設定各欄位業績及洗助算法 $row = $this->setRpt11Row_daily_Data2($row, $empData); // 業績百分比 $total = (double) $all_amount[$empData['pdate']]; $rate = round($row['perform'] / $total, 4); $row['rate'] = $rate * 100 . "%"; array_push($colAry3, $row); } //存業績陣列 $rank = array(); //存業績排名陣列 $rank2 = array(); for ($i = 0; $i < count($colAry3); $i++) { array_push($rank, $colAry3[$i]['perform']); } //create a copy and rsort $rank_copy = $rank; rsort($rank_copy); //reverses key and values $rank_copy = array_flip($rank_copy); //create result by using keys from sorted values + 1 foreach ($rank as $val) { $rank2[] = $rank_copy[$val] + 1; } //插入排名到$colAry3 foreach ($rank2 as $key => $value) { if (isset($colAry3[$key])) { $temp = $colAry3[$key]; $temp['perform_rank'] = $value; $colAry3[$key] = $temp; } else { continue; } } // CVarDumper::dump($colAry3,10,true); //門市服務項目SQL $sql = ''; $sql = "(SELECT pdate , storecode , storename ,serviceno, sum(num) as amount FROM tbp_perform_emp_log\n WHERE mid(pdate,1,6)='{$qry_date}' and storecode='{$qry_store}' AND num !=0\n GROUP BY pdate , serviceno \n ORDER BY pdate DESC )"; $sql2 = ''; $sql2 = "(SELECT pdate , storecode , storename ,serviceno, sum(num) as amount FROM tbp_perform_log\n WHERE mid(pdate,1,6)='{$qry_date}' and storecode='{$qry_store}' AND num !=0\n GROUP BY pdate , serviceno \n ORDER BY pdate DESC )"; $sql = $sql . "UNION" . $sql2; //合併 $sql = $sql . "order by pdate DESC, storecode, serviceno"; //一定要照pdate排序,因為loop要照日期去跑 $result = Yii::app()->db->createCommand($sql)->queryAll(); //門市業績 $sql3 = ''; $sql3 = "SELECT pdate , storecode ,storename , total FROM tbp_perform \n WHERE mid(pdate,1,6)='{$qry_date}' and storecode='{$qry_store}'\n GROUP BY pdate \n ORDER BY storecode ASC , pdate DESC"; $result2 = Yii::app()->db->createCommand($sql3)->queryAll(); //先將該門市整個月的業績存在amount array()裡 if ($result2 > 0) { foreach ($result2 as $value) { $amount[$value['pdate']] = $value['total']; } unset($result2); } //將門市所有服務項目放在同個日期及門市 if (count($result > 0)) { if (isset($result[0]['pdate']) or isset($result[0]['storecode'])) { $day = $result[0]['pdate']; $storecode = $result[0]['storecode']; // 每一行的陣列 $row = array(); for ($i = 0; $i < count($result); $i++) { if ($day == $result[$i]['pdate'] && $storecode == $result[$i]['storecode']) { $row['pdate'] = $result[$i]['pdate']; $row['storecode'] = $result[$i]['storecode']; $row['storename'] = $result[$i]['storename']; $row[$result[$i]['serviceno']] = $result[$i]['amount']; $row['total'] = $amount[$result[$i]['pdate']]; } else { array_push($Arylog, $row); $row = array(); $day = $result[$i]['pdate']; $storecode = $result[$i]['storecode']; /*------*/ $row['pdate'] = $result[$i]['pdate']; $row['storecode'] = $result[$i]['storecode']; $row['storename'] = $result[$i]['storename']; $row[$result[$i]['serviceno']] = $result[$i]['amount']; $row['total'] = $amount[$result[$i]['pdate']]; } } //for ($i = 0; $i < count($result); $i++) { array_push($Arylog, $row); } //if(isset($result[0]['pdate']) OR isset($result[0]['storecode']) ){ } //if(count($result>0)) { foreach ($Arylog as $key => $storeData) { $row = array(); //日期 $row['ymd'] = $storeData['pdate']; // 設定各欄位業績及洗助算法 $row = $this->setRpt11Row_daily_Data($row, $storeData); //每日業績金額 $row['perform_amount'] = (double) $storeData['total']; array_push($colAry2, $row); } //計算其他項目 $other_sql = ''; $other_sql = "(SELECT mid(pdate,1,6) as pdate , storecode , storename ,serviceno, sum(num) as amount FROM tbp_perform_log\n WHERE mid(pdate,1,6)='{$qry_date}' and storecode='{$qry_store}' AND num !=0\n GROUP BY serviceno \n ORDER BY pdate DESC )"; $other_result = Yii::app()->db->createCommand($other_sql)->queryAll(); if (count($other_result > 0)) { if (isset($other_result[0]['storecode'])) { $storecode = $other_result[0]['storecode']; // 每一行的陣列 $row = array(); for ($i = 0; $i < count($other_result); $i++) { if ($storecode == $other_result[$i]['storecode']) { $row['storecode'] = $other_result[$i]['storecode']; $row['storename'] = $other_result[$i]['storename']; $row[$other_result[$i]['serviceno']] = $other_result[$i]['amount']; } else { array_push($other, $row); $row = array(); $storecode = $other_result[$i]['storecode']; /*------*/ $row['storecode'] = $other_result[$i]['storecode']; $row['storename'] = $other_result[$i]['storename']; $row[$other_result[$i]['serviceno']] = $other_result[$i]['amount']; } } //for ($i = 0; $i < count($other_result); $i++) { array_push($other, $row); } //if(isset($result[0]['storecode']) ){ } //if(count($other_result>0)) { if (isset($other[0])) { $other = $this->getRpt11MoneySellandReduce($other[0]); //其他項目百分比 $other_amout = (double) $all_amount[$qry_date]; if ($other['sum'] != 0) { $rate = round($other['sum'] / $other_amout, 4); $other['rate'] = $rate * 100 . "%"; } if ($other['sum2'] != 0) { $rate = round($other['sum2'] / $other_amout, 4); $other['rate2'] = $rate * 100 . "%"; } } } } //elseif(isset($_POST['qry_daily'])) // CVarDumper::dump($colAry,10,true); $time_end = microtime(true); $computetime = round($time_end - $time_start, 3); if (isset($_POST['qry_designer']) or $qry_store != '' && $qry_date != '' && !isset($_POST['qry_daily'])) { if (count($colAry) < 1) { Yii::app()->user->setFlash('error', Yii::app()->user->getFlash('error') . "查無,{$qry_date} 月的業績資料"); } else { Yii::app()->user->setFlash('success', Yii::app()->user->getFlash('success') . "查詢成功. 共計 " . count($colAry) . " 筆資料"); } } elseif (isset($_POST['qry_daily'])) { if ($qry_store != '') { if (count($colAry2) < 1 and count($colAry3) < 1) { Yii::app()->user->setFlash('error', Yii::app()->user->getFlash('error') . "查無,{$qry_date} 月的業績資料"); } else { Yii::app()->user->setFlash('success', Yii::app()->user->getFlash('success') . "查詢成功."); } } else { Yii::app()->user->setFlash('error', Yii::app()->user->getFlash('error') . "請選擇門市!"); } } $this->render('rpt11', array('isExist' => $isExist, 'qry_date' => $qry_date, 'qry_area' => $qry_area, 'qry_store' => $qry_store, 'tbsStroes' => $tbsStroes, 'check_sale_Intelligence' => $check_sale_Intelligence, 'col' => $col, 'title' => $title, 'colAry' => $colAry, 'acol' => $acol, 'atitle' => $atitle, 'colAry2' => $colAry2, 'acol2' => $acol2, 'atitle2' => $atitle2, 'colAry3' => $colAry3, 'other' => $other, 'computetime' => $computetime)); }