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