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