/** * @Author: ANH DUNG Sep 15, 2014 * @Todo: calc report daily * @Param: $model model * @Param: $aRes var return * @Param: $date_from 2014-05-25 * @Param: $date_to model 2014-09-25 * BA-Tung Hoang: cai sales report cua financial anh lay nhung cai amount cua invoice ma da paid roi tru cho cai amount cua voucher DA PAID */ public static function ReportDailyTrans($model, &$aRes, $date_from, $date_to) { $criteria = new CDbCriteria(); $criteria->addBetweenCondition("t.received_on", $date_from, $date_to); $criteria->compare('t.status', STATUS_GEN_RECEIPT); $criteria->addCondition('t.received_on IS NOT NULL'); $criteria->select = "sum(profit_to_property_info) as profit_to_property_info,sum(profit_to_property_info_by_company) as profit_to_property_info_by_company," . " t.received_on, count(DISTINCT t.transactions_id) as count_record"; $criteria->group = "t.received_on"; $criteria->order = "t.received_on"; $models = ProTransactionsSaveCommission::model()->findAll($criteria); foreach ($models as $item) { $aRes['TOTAL_AMOUNT_INVOICE'][$item->received_on] = $item->profit_to_property_info + $item->profit_to_property_info_by_company; $aRes['COUNT_TRANS'][$item->received_on] = $item->count_record; } $aRes['LOOP_VAR'] = MyFormat::getArrayDay($date_from, $date_to); }