Advertisement
fernandezekiel

Untitled

Aug 8th, 2013
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. $criteria->select = array("*",
  2.             "COALESCE((SELECT (ROUND(SUM(quotation_detail.selling_price * quotation_detail.quantity),2)) FROM quotation_detail WHERE quotation_detail.quotation_header_id=$this->alias.id GROUP BY quotation_detail.quotation_header_id),0) as totalAmount",
  3.             "COALESCE((SELECT ROUND(totalAmount*(1-(COALESCE($this->alias.discount/100,0))),2) FROM quotation_detail WHERE quotation_detail.quotation_header_id=$this->alias.id GROUP BY quotation_detail.quotation_header_id),0) as totalDiscountedAmount",
  4.             "COALESCE((SELECT ROUND(totalDiscountedAmount*(1+(COALESCE($this->alias.tax/100,0))),2) FROM quotation_detail WHERE quotation_detail.quotation_header_id=$this->alias.id GROUP BY quotation_detail.quotation_header_id),0.00) as totalTaxedAmount",
  5.             "COALESCE((SELECT (ROUND(SUM(amount),2)) FROM sale WHERE quoation_id=$this->alias.id GROUP BY quoation_id),0.00) AS totalSalesCredited"
  6.         );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement