-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathVraagprijsVerkoopprijs.php
137 lines (120 loc) · 4.6 KB
/
VraagprijsVerkoopprijs.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
include_once(__DIR__.'/include/config.php');
include_once(__DIR__ .'/include/HTML_TopBottom.php');
include_once($cfgGeneralIncludeDirectory.'class.MobileDetect.php');
$db = connect_db();
$minUserLevel = 1;
$cfgProgDir = 'auth/';
include($cfgProgDir. "secure.php");
echo $HTMLHeader;
if(isset($_REQUEST['selectie'])) {
$groep = substr($_REQUEST['selectie'], 0, 1);
$id = substr($_REQUEST['selectie'], 1);
if($groep == 'Z') {
$opdrachtData = getOpdrachtData($id);
$Name = $opdrachtData['naam'];
$dataset = getHuizen($id);
} else {
$LijstData = getLijstData($id);
$Name = $LijstData['naam'];
$dataset = getLijstHuizen($id);
}
$knownHuizen = array();
$max_percentage = 33;
echo "<form method='post' action='". $_SERVER['PHP_SELF']."'>\n";
echo "<table width='100%' border=0>\n";
echo "<tr>\n";
echo " <td align='center' colspan='4'><h1>Verkoopprijs versus Vraagprijs '$Name'</h1></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan='4'> </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width='25%'> </td>\n";
echo " <td width='34%' align='left'>$max_percentage %</td>\n";
echo " <td width='34%' align='right'>$max_percentage %</td>\n";
echo " <td width='7%'> </td>\n";
echo "</tr>\n";
# Doorloop alle huizen
foreach($dataset as $huisID) {
$data = getFundaData($huisID);
$adres = convertToReadable($data['adres']);
$prijzen = getPriceHistory($huisID);
$WOZ = getWOZHistory($huisID);
$vraagprijs = end($prijzen);
//if(date('n', $data['eind']) < 7) {
$verkoopJaar = date('Y', $data['eind']);
//} else {
// $verkoopJaar = (date('Y', $data['eind'])+1);
//}
if(isset($WOZ[$verkoopJaar])) {
$verkoopprijs = $WOZ[$verkoopJaar];
$afname = ((($vraagprijs-$verkoopprijs)/$vraagprijs)*100);
$breedte = round(100*$afname/$max_percentage);
} else {
$breedte = 0;
}
if($data['offline'] == '1') {
if($data['verkocht'] != '1') {
$TextClass = 'offline';
} else {
$TextClass = 'offlineVerkocht';
}
} elseif($data['verkocht'] == '1') {
$TextClass = 'onlineVerkocht';
} else {
$TextClass = 'online';
}
echo "<tr>\n";
echo " <td width='25%'>";
echo "<a href='admin/HouseDetails.php?selectie=". $_REQUEST['selectie'] ."&id=$huisID' target='_blank'><img src='images/details.gif' title='Toon opties voor $adres'></a>";
echo "<a id='$huisID'> <a href='http://funda.nl/". $huisID ."' target='_blank' class='$TextClass' title='Bezoek $adres op funda.nl'>$adres</a></td>\n";
if($breedte > 0) {
echo " <td>\n";
echo " <table width='100%' border=0><tr>\n";
echo " <td width='". (100-$breedte) ."%'> </td>\n";
echo " <td width='". $breedte ."%' bgcolor='#FF6D6D' title='Te koop voor ". formatPrice($vraagprijs) .", verkocht voor ". formatPrice($verkoopprijs) ."; ". round($afname, 1) ."% onder de vraagprijs'> </td>\n";
echo " </tr></table>\n";
echo " </td>\n";
echo " <td> </td>\n";
} elseif($breedte < 0) {
echo " <td> </td>\n";
echo " <td>\n";
echo " <table width='100%' border=0><tr>\n";
echo " <td width='". abs($breedte) ."%' bgcolor='#FF6D6D' title='Te koop voor ". formatPrice($vraagprijs) .", verkocht voor ". formatPrice($verkoopprijs) ."; ". round(abs($afname), 1) ."% boven de vraagprijs'> </td>\n";
echo " <td width='". (100-abs($breedte)) ."%'> </td>\n";
echo " </tr></table>\n";
echo " </td>\n";
} else {
echo " <td> </td>\n";
echo " <td> </td>\n";
}
echo " <td width='7%'> </td>\n";
echo "</tr>\n";
}
echo "</table>\n";
echo "</form>\n";
} else {
$HTML[] = "<form method='post' action='". $_SERVER['PHP_SELF'] ."'>";
$HTML[] = "<input type='hidden' name='addHouses' value='". (isset($_REQUEST['addHouses']) ? '1' : '0') ."'>";
$HTML[] = "<input type='hidden' name='chosenList' value='". (isset($_REQUEST['chosenList']) ? $_REQUEST['chosenList'] : '') ."'>";
$HTML[] = "<table>";
$HTML[] = "<tr>";
$HTML[] = " <td>Selectie</td>";
$HTML[] = " <td> </td>";
$HTML[] = " <td>". makeSelectionSelection(isset($_REQUEST['addHouses']), false) ."</td>";
$HTML[] = "</tr>";
$HTML[] = "<tr>";
$HTML[] = " <td colspan='3' align='center'><input type='submit' name='submit' value='Weergeven'></td>";
$HTML[] = "</tr>";
$HTML[] = "</table>";
$HTML[] = "</form>";
echo "<tr>\n";
echo "<td width='25%' valign='top' align='center'> </td>\n";
echo "<td width='50%' valign='top' align='center'>\n";
echo showBlock(implode("\n", $HTML), $mobile);
echo "</td>\n";
echo "<td width='25%' valign='top' align='center'> </td>\n";
echo "</tr>\n";
}
echo $HTMLFooter;