public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'charges' => array(self::HAS_MANY, 'Charge', 'ShopLot_LotNo'),
'payments' => array(self::HAS_MANY, 'Payment', 'ShopLot_LotNo'),
'owner' => array(self::BELONGS_TO, 'Owner', 'Owner_OwnerID'),
'shopFloor' => array(self::BELONGS_TO, 'Shopfloor', 'LotFloor'),
'DueDebit' => array(self::STAT, 'Charge', 'ShopLot_LotNo','select'=> 'SUM(Amount)', 'condition'=>'ChargeDueDate>"now()"'),
'Debit' => array(self::STAT, 'Charge', 'ShopLot_LotNo','select'=> 'SUM(Amount)'),
'Credit' => array(self::STAT, 'Payment', 'ShopLot_LotNo','select'=> 'SUM(Amount)'),
);
}
I want to add an attribute ‘Balance’ base on ‘Credit-Debit’, How I can do this?