39 lines
826 B
PHP
Executable File
39 lines
826 B
PHP
Executable File
<?php
|
|
/**
|
|
* Klasa reprezentująca wpis na paragonie
|
|
* @author Krzysztof Raciniewski
|
|
*
|
|
*/
|
|
class ReceiptItems {
|
|
|
|
/**
|
|
* Pobera wszystkie pozycje paragonu o unikalnym ID
|
|
*
|
|
* @param $id -
|
|
* unikalny ID paragonu
|
|
*/
|
|
public static function getByReceiptId($id) {
|
|
$db = $GLOBALS ['db'];
|
|
$query = "SELECT * FROM ecmreceiptitems WHERE ecmreceipt_id='$id'";
|
|
$result = $db->query ( $query );
|
|
|
|
return ReceiptItems::getAllFromResult ( $result );
|
|
|
|
}
|
|
|
|
/**
|
|
* Zwraca w formie tablicy wszystkie wiersze odpowiedzi na zapytanie
|
|
*
|
|
* @param
|
|
* $result
|
|
* @return Zwraca wiersze w postacie tablicy
|
|
*/
|
|
public static function getAllFromResult($result) {
|
|
$itemsArray = array ();
|
|
while ( $row = $result->fetch_assoc () ) {
|
|
array_push ( $itemsArray, $row );
|
|
}
|
|
return $itemsArray;
|
|
}
|
|
}
|
|
?>
|