Ejemplo n.º 1
0
 /**
  * @param int $accountId
  * @param \DateTime $date
  * @return array
  */
 public function findOneByAccountAndPeriod($accountId, \DateTime $date)
 {
     $period = Util::getPreviousQuarter($date);
     $query = $this->fpdo->from($this->table)->leftJoin('bill ON bill.id = bill_item.bill_id')->select('bill.year')->where('bill_item.system_account_id', $accountId)->where('bill.year', $period['year'])->where('bill.quarter', $period['quarter']);
     $result = $query->limit(1)->fetchAll();
     return $this->bindCollection($result)->first();
 }