41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
|
|
<?php
|
|||
|
|
/**
|
|||
|
|
*
|
|||
|
|
* @author: Katarzyna Zdunek
|
|||
|
|
**/
|
|||
|
|
|
|||
|
|
class PurchaseInvoiceItems{
|
|||
|
|
/**
|
|||
|
|
* Pobiera wszystkie faktury wchodzД…ce do firmy
|
|||
|
|
* @param id- unikalny id faktury wchodzacej
|
|||
|
|
*
|
|||
|
|
**/
|
|||
|
|
public static function getByInvoiceId($id)
|
|||
|
|
{
|
|||
|
|
$db = $GLOBALS['db'];
|
|||
|
|
$query = "SELECT * FROM Documents WHERE parent_id'=$id'
|
|||
|
|
AND parent_type= 'Accounts'
|
|||
|
|
AND (category_id= 'invoice_costs'
|
|||
|
|
OR category_id= 'invoice_goods')";
|
|||
|
|
$result = $db->query($query);
|
|||
|
|
|
|||
|
|
return BuyerItems::getAllFromResult ($result);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Zwrocenie w tablicy wszystkich wynikпїЅw zapytania
|
|||
|
|
*
|
|||
|
|
* @param $result wiersze w postaci tablicy
|
|||
|
|
*/
|
|||
|
|
public static function getAllFromResult ($result){
|
|||
|
|
$itemsArray= Array();
|
|||
|
|
while ( $row = $result->fetch_assoc () ) {
|
|||
|
|
array_push ( $itemsArray, $row );
|
|||
|
|
}
|
|||
|
|
return $itemsArray;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
?>
|