Files
crm.twinpol.com/modules/EcmReportsBackUp20151106/class/class.PurchaseInvoiceItems.php
2025-05-12 15:44:39 +00:00

43 lines
907 B
PHP
Executable File
Raw Blame History

<?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<69>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;
}
}
echo"<pre>";
print_r($data);
echo"</pre>";
?>