コード例 #1
0
ファイル: Event.class.php プロジェクト: centaurustech/truc
    public function get_discounts()
    {
        global $g_pdo;
        $request = <<<EOF
SELECT `id` FROM `discount`
WHERE `id_event`= :id
EOF;
        debug($request);
        $pst = $g_pdo->prepare($request);
        $pst->execute(array(":id" => $this->id));
        $result = array();
        while (($record = $pst->fetch()) != NULL) {
            $result[] = Discount::get_from_id($record["id"]);
        }
        return $result;
    }
コード例 #2
0
ファイル: Invoice.php プロジェクト: amad4biz/invoices
 /**
  * Returns viewable data
  * @return object 
  */
 public function read()
 {
     parent::read();
     $out = $this->toClone();
     // get entries
     $Entry = new Entry();
     $out->entries = $Entry->get_from_id($this->id);
     // get discounts
     $Discount = new Discount();
     $out->discounts = $Discount->get_from_id($this->id);
     // get payments
     $Payment = new Payment();
     $out->payments = $Payment->get_from_id($this->id);
     // get total
     $out->total = $this->get_total($out);
     // return
     return $out;
 }