コード例 #1
0
 public function GetTotalAmountByStats(Gyuser_Model_Cheques $obj)
 {
     $table = $this->getDbTable();
     $select = $table->select();
     $select->setIntegrityCheck(false);
     $select->from(array('cqu' => 'cheques'), array('sum(amount) as total_amount'));
     if ($obj->getProvider_id()) {
         $select->where('cqu.provider_id = ?', $obj->getProvider_id());
     } elseif ($obj->getCredit_provider_id()) {
         $select->where('cqu.credit_provider_id = ?', $obj->getCredit_provider_id());
     }
     $select->where('cqu.status = ?', $obj->getStatus());
     $row = $table->fetchRow($select);
     return $row->total_amount;
 }