35 lines
777 B
PHP
Executable File
35 lines
777 B
PHP
Executable File
<?php
|
||
/**
|
||
* Klasa reprezentuj<75>ca wpis na fakturze
|
||
* @author Krzysztof Raciniewski
|
||
*
|
||
*/
|
||
class InvoiceItems {
|
||
|
||
/**
|
||
* Pobera wszystkie pozycje faktury o unikalnym ID
|
||
* @param $id - unikalny ID faktury
|
||
*/
|
||
public static function getByInvoiceId( $id ) {
|
||
$db = $GLOBALS ['db'];
|
||
$query = "SELECT * FROM ecminvoiceoutitems WHERE ecminvoiceout_id='$id'";
|
||
$result = $db->query ( $query );
|
||
|
||
return InvoiceItems::getAllFromResult( $result );
|
||
}
|
||
|
||
/**
|
||
* Zwraca w formie tablicy wszystkie wiersze odpowiedzi na zapytanie
|
||
* @param unknown $result
|
||
* @return multitype:
|
||
*/
|
||
public static function getAllFromResult( $result ) {
|
||
$itemsArray = array();
|
||
while($row = $result->fetch_assoc()){
|
||
array_push($itemsArray, $row);
|
||
}
|
||
return $itemsArray;
|
||
}
|
||
|
||
}
|
||
?>
|