// <?php 
// /**
//  * @author: Katarzyna Zdunek 
//  */
// include ("class.BuyerItems.php");
// 	class Buyer{
	
// 		public static function getById($id) {
// 			$db = $GLOBALS ['db'];
// 			$query = "SELECT * FROM documents WHERE id='$id'";
// 			$result = $db->query ( $query );
// 			$buyerData = $result->fetch_assoc ();
// 			$buyerData ["items"] = InvoiceItems::getByBuyerId ( $id );
// 			$buyerData ["account"] = Account::getByBuyerId ( $id );
// 			return $buyerData;
// 		}
// 		/**
// 		 * Pobranie według daty
// 		 * 
// 		 * **/
// 		public static function getBetweenDate($date_from, $date_to, $category, $type, $contractorId) {
// 		$db = $GLOBALS ['db'];
		
// 		$query = "SELECT * FROM documents 
// 				  WHERE register_date 
// 				  >= '$date_from' AND 
// 				  register_date <= '$date_to'
// 			      AND type LIKE '$type' AND deleted=0 AND canceled=0 ";
		
// 		if (! empty ( $contractorId )) {
// 			$query .= " AND parent_id = '" . $contractorId . "'";
// 		}
		
// 		$query .= " ORDER BY date_entered asc";
		
// 		$result = $db->query ( $query );
		
// 		$buyersArray = array ();
// 		while ( $buyerData = $result->fetch_assoc () ) {
// 			// Formatowanie dat zgodnie z datÄ… systemowÄ…
// 			$date = new DateTime ( $buyerData ["register_date"] );
// 			$buyerData ["register_date"] = $date->format ( 'd.m.Y' );
// 			$date = new DateTime ( $buyerData ["sell_date"] );
// 			$buyerData ["sell_date"] = $date->format ( 'd.m.Y' );
// 			$buyerData ["items"] = BuyerItems::getByBuyerId ( $buyerData ["id"] );
// 			$buyerData ["account"] = Account::getByAccountId ( $buyerData ["parent_id"] );
		
		
// 	}
// }
// ?>