-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdapanesAFM_s.php
57 lines (53 loc) · 2.3 KB
/
dapanesAFM_s.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
require_once 'opendata.php';
if ($_POST) {
$afm = (int) $_POST['afm'];
}
else {
print "<h2 style=\"color:red;\">ΠΡΕΠΕΙ ΝΑ ΟΡΙΣΕΤΕ ΕΝΑΝ ΑΦΜ</h2>";
exit;
}
// ΕΚΤΥΠΩΣΗ ΠΛΗΡΟΦΟΡΙΩΝ ΦΟΡΕΑ (UID, ΕΠΩΝΥΜΙΑ, ΜΟΝΑΔΕΣ, ΥΠΟΓΡΑΦΟΝΤΕΣ)
$client = new OpendataClient();
$client->setAuth('apiuser_1', 'ApiUser@1');
$pages = 0;
$sum = 0.0;
$response = $client->getResource('/search?org=99206915&type=Β.2.1&size=250&from_date=2014-01-01&page=' .$pages);
$unitData = $response->data;
$actual_size = 1;// $unitData['info']['actualSize'];
$counter = 1;
while ($actual_size != 0) {
//echo $actual_size;
foreach ($unitData['decisions'] as $unit) {
$kaeData = $unit['extraFieldValues']['sponsor'];
//print_r($kaeData);
foreach ($kaeData as $kae) {
if (strcmp($kae['sponsorAFMName']['afm'], $afm) == 0) {
print $counter . ") ". $unit['subject'] . ": " . $unit['ada'] . " TYPE : " . $unit['decisionTypeId'] . ": ΗΜΕΡΟΜΗΝΙΑ : ". gmdate("Y-m-d", $unit['submissionTimestamp']/1000). " <a href=\"". $unit['documentUrl'] . "\">Link</a> <br> \n";
print "   ΠΡΟΜΗΘΕΥΤΗΣ : '". $kae['sponsorAFMName']['afm'] . "' - " . $kae['sponsorAFMName']['name'] . "<br> \n";
print "     ΚΑΕ : " . $kae['cpv'] . " ΠΟΣΟ : " . $kae['expenseAmount']['amount'] . "<br> \n";
$sum += $kae['expenseAmount']['amount'];
$counter++;
}
}
}
/*
print " Υπογράφοντες:<br>\n";
foreach ($orgData['signers'] as $signer) {
print " ". $signer['uid'] . ": " . $signer['lastName'] . " " . $signer['firstName'] . "<br>\n";
}
*/
$pages++;
$response = $client->getResource('/search?org=99206915&type=Β.2.1&size=250&from_date=2014-01-01&page=' .$pages);
$unitData = $response->data;
//echo "---" . $unitData['info']['actualSize'];
$actual_size = $unitData['info']['actualSize'];
if ($actual_size == NULL)
$actualSize = 1;
else if ($actual_size == 0)
break;
}
print "<h2> ΣΥΝΟΛΙΚΟ ΠΟΣΟ : " . $sum . "€ </h2>";
// else {
// echo "Error " . $response->code;
//}