Files
crm.twinpol.com/modules/EcmReports/class/class.PurchaseInvoiceItems.php

41 lines
1.1 KiB
PHP
Raw Normal View History

2025-05-12 15:44:39 +00:00
<?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;
}
}
?>