Add php files
This commit is contained in:
73
modules/EcmReportsBackUp20151106/class/class.Account.php
Executable file
73
modules/EcmReportsBackUp20151106/class/class.Account.php
Executable file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Klasa pobiera informacje o właścicielu faktury
|
||||
* @author Krzysztof Raciniewski
|
||||
*
|
||||
*/
|
||||
class Account {
|
||||
|
||||
/**
|
||||
* Pobera wszystkie pozycje faktury o unikalnym ID
|
||||
*
|
||||
* @param $id -
|
||||
* unikalny ID faktury
|
||||
*/
|
||||
public static function getByAccountId($id) {
|
||||
$db = $GLOBALS ['db'];
|
||||
$query = "SELECT * FROM accounts WHERE id='$id'";
|
||||
$result = $db->query ( $query );
|
||||
return $result->fetch_assoc();
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda stworzy strukturę tablicy:
|
||||
* .
|
||||
* .
|
||||
* |
|
||||
* |
|
||||
* +----- Kontrahent1 --------------------------+ Dokument1 ------------------> Wpisy na fakturze
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* | +-------------------+ Dokument2 ------------------> Wpisy na fakturze
|
||||
* |
|
||||
* |
|
||||
* |
|
||||
* +----- Kontrahent2 --------------------------+ Kategoria ------------------> Wpisy na fakturze
|
||||
* . |
|
||||
* . |
|
||||
* . |
|
||||
* +-------------------+ Kategoria2 ------------------> Wpisy na fakturze
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* Na podstawie tablicy z dokumentami( taką tablicę zwraca metoda getBetweenDate w klasie Invoice i Receipt )
|
||||
* */
|
||||
public static function getAccountsFromInvoicesArray($invoices) {
|
||||
$accounts = array();
|
||||
|
||||
foreach( $invoices as $invoice ){
|
||||
$accounts[$invoice["parent_name"]]["invoices"][] = $invoice;
|
||||
}
|
||||
|
||||
return $accounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Zwraca w formie tablicy wszystkie wiersze odpowiedzi na zapytanie
|
||||
* @param $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