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

41 lines
1.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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;
}
}
?>