Add php files
This commit is contained in:
41
modules/EcmReports/class/class.PurchaseInvoiceItems.php
Normal file
41
modules/EcmReports/class/class.PurchaseInvoiceItems.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user