$wartosc){
if($pos !== false){
if($j%4==0){
$p2->AddPage();
}
$j++;
$tytul = "";
$opis = "";
$query = "SELECT
d.document_date as docdate,
d.document_name as docname,
DATE_FORMAT(DATE(d.date_entered), '%d-%m-%Y') as docdateentered,
d.category_id as doccategory,
d.description as docdes,
ifnull(d.value,0) as docwartosc,
u.first_name as username,
u.last_name as userlastname
FROM
documents d
left join users u on u.id = d.created_by
left join accounts a on d.parent_id = a.id
WHERE
d.id = '".$wartosc. "' AND d.deleted = 0";
/**
* ************* GET DATA FROM DB********************
*/
echo $query;
die();
$rows = $db->query ( $query );
while ( $r = $db->fetchByAssoc ( $rows ) ) {
if($r['docname']!=NULL)
$tytul = $tytul. "Nazwa dokumentu: ".$r['docname']."
";
if($r['docdateentered']!=NULL)
$tytul = $tytul."Data wprowadzenia: ".$r['docdateentered']."
";
if($r['docdate']!=NULL)
$tytul = $tytul."Data dokumentu: ".$r['docdate']."
";
if($r ['doccategory']!=NULL)
$tytul = $tytul."Kategoria: ".$app_list_strings['document_category_dom'][$r ['doccategory']]."
";
if($r['docwartosc']!=NULL)
$tytul = $tytul."Wartość: ".number_format($r['docwartosc'], 2, ",", ".")."
";
if($r['username']!=NULL && $r['userlastname']!=NULL)
$tytul = $tytul."Wprowadził: ".$r['username']." ".$r['userlastname']."
";
if($r['docdes']!=NULL)
$tytul = $tytul."Opis dokumentu: ".$r['docdes']."
";
// Wczytywanie raportów
$queryraport = "
SELECT
CONCAT(u.first_name, ' ', u.last_name) AS name,
d.accepted AS accepted,
d.accepted_description AS accepteddes
FROM
documents_user d
left join users u on u.id = d.user_id
WHERE
d.document_id = '".$wartosc."'";
$tmp = $db->query ( $queryraport );
if($tmp->num_rows == 0){
$opisy = "";
}else{
$opisy = "
| Użytkownik | Status | Opis | ||
|---|---|---|---|---|
| ".$tmp2['name']." | "; if($tmp2['accepted']==0){ $opisy = $opisy ."Oczekuje | "; }elseif($tmp2['accepted']==1){ $opisy = $opisy ."Zaakceptowano | "; }elseif($tmp2['accepted']==2){ $opisy = $opisy ."Odrzucono | "; } $opisy = $opisy ."".str_replace("XVZC"," ",$tmp2['accepteddes'])." | ";
$opisy = $opisy ."