public function actionGetChartProspectByCustomer($param)
 {
     // \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     $arrParam = explode('-', $param);
     $data = [];
     $model = WeekStatusLine::find()->select(['CONCAT(EXTRACT(year FROM "quotation"),\'-\',res_partner.name,\'-\',\'' . $arrParam[0] . '\') AS id', 'EXTRACT(year FROM "quotation") AS year', 'res_partner.name AS name', 'COUNT(res_partner.name) as cout'])->leftJoin(ResPartner::tableName(), 'week_status_line.name = res_partner.id')->groupBy('year, res_partner.name')->where('EXTRACT(year FROM "quotation") = :year')->andWhere('state like :state')->addParams([':year' => $arrParam[1], ':state' => $arrParam[0]])->asArray();
     return \yii\helpers\Json::encode($model->all());
 }
Exemple #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getWeekStatusLines()
 {
     return $this->hasMany(WeekStatusLine::className(), ['status_id' => 'id']);
 }
Exemple #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getLine()
 {
     return $this->hasOne(WeekStatusLine::className(), ['id' => 'line_id']);
 }