Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function defaultScope() {
- $criteria = new CDbCriteria;
- $criteria->alias = $this->alias;
- $criteria->together = true;
- $criteria->with = array(
- 'quotationDetails'=>array('alias'=>'qd'),
- 'opportunity'=>array('alias'=>'opp'),
- 'sales'=>array('alias'=>'sls'),
- );
- $criteria->select = array("*",
- "ROUND(SUM(qd.selling_price * qd.quantity),2) as totalAmount",
- "ROUND(SUM(qd.selling_price * qd.quantity)*(1-($this->alias.discount/100)),2) as totalDiscountedAmount",
- "ROUND(SUM(sls.amount)) as totalSalesCredited",
- );
- $criteria->group = "$this->alias.id";
- return $criteria;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement