예제 #1
0
 public function loadProducts()
 {
     $databaseHelper = new DatabaseHelper();
     $receiptProductsDb = $databaseHelper->query("SELECT `id` FROM `receipt_product` WHERE receiptId = " . $this->id);
     if (count($receiptProductsDb) > 0) {
         foreach ($receiptProductsDb as $receiptProductDb) {
             $ReceiptProduct = new ReceiptProduct($receiptProductDb['id']);
             $this->receiptProducts[] = array('id' => $ReceiptProduct->getId(), 'productId' => $ReceiptProduct->getProductId(), 'label' => $ReceiptProduct->getLabel(), 'priceInVat' => $ReceiptProduct->getPriceInVat(), 'priceExVat' => $ReceiptProduct->getPriceExVat(), 'amount' => $ReceiptProduct->getAmount(), 'totalPriceInVat' => $ReceiptProduct->getTotalPriceInVat(), 'totalPriceExVat' => $ReceiptProduct->getTotalPriceExVat());
         }
     }
 }
예제 #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getReceiptProducts()
 {
     return $this->hasMany(ReceiptProduct::className(), ['product_id' => 'id']);
 }