Files
crm.twinpol.com/modules/EcmReports/class/class.Account.php
2025-05-12 15:44:39 +00:00

73 lines
2.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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;
}
}
?>