Skip to content

Commit

Permalink
eerste release uren systeem
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerChaos committed Sep 29, 2016
1 parent 5495fc5 commit 664c617
Show file tree
Hide file tree
Showing 8 changed files with 372 additions and 57 deletions.
6 changes: 3 additions & 3 deletions ajax/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
$start = $_POST['start'];
$end = $_POST['end'];
$groep = $_POST['groep'];
$color = "#D08040"; //rc(0,125);
$color1 = "#8028E0"; //rc(125,250);
$fcolor = "#008000";
$color = "#D05860"; // Niet volledig //rc(0,125);
$color1 = "#008000"; // Volledig//rc(125,250);
$fcolor = "#A0B0E0";
$out = array();
try{
$stmt = $db->prepare("SELECT * FROM groep WHERE id=:groep");
Expand Down
106 changes: 106 additions & 0 deletions ajax/overzicht.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?php
echo "<h1>".$_SESSION[ERROR]."</h1>";
$_SESSION[ERROR] ="";
if ($_POST['details'])
{
// parameters from URL
$details = $_POST['details'];
require(getenv("DOCUMENT_ROOT")."/functions/database.php");
try{
$stmt = $db->prepare("SELECT * FROM details WHERE awid=:details");
$stmt->execute(array(':details' => $details,));
$result = $stmt->fetchall(PDO::FETCH_ASSOC);
$stmt3 = $db->prepare("SELECT * FROM aanwezig Where id = :naam");
$stmt3->execute(array(':naam' => $details,));
$result3 = $stmt3->fetch(PDO::FETCH_ASSOC);
$stmt2 = $db->prepare("SELECT * FROM gebruikers Where id = :naam");
$stmt2->execute(array(':naam' => $result3['uid'],));
$result2 = $stmt2->fetch(PDO::FETCH_ASSOC);
$fac = $result3['gefactureerd'];
$print = ($fac != "y")?"<a href=\"../details/$details\" class=\"btn btn-success btn-block btn-lg\"><i class='material-icons'>border_color</i></a>":"Al Gefactureerd";
$count = "0";
$factuur = "0";
$total = "0";
}//end try
catch(Exception $e) {
echo '<h2><font color=red>';
var_dump($e->getMessage());
die ('</h2></font> ');
}
$table = "
<div class=\"alert alert-info\">
<div class=\"row\">
<div class=\"col-sm-4\">OVerzicht van ".$result3['van']." tot ".$result3['tot']." op ".$result3['datum']."</div>
<div class=\"col-sm-4 text-center\">$print</div>
<div class=\"col-sm-4 text-right\">".$result3['uren']." uren</div>
</div>
</div>
<div id='print'>
<table border=1 id='hoofd' name='hoofd' class=\"table table-striped table-bordered table-hover\">
<thead>
<tr>
<td>van</td>
<td>Tot</td>
<td>Klant</td>
<td>Project</td>
<td>uren</td>
<td>info</td>
<td>Factuur</td>
";
$table .= "</tr>
</thead>
<tbody>";
foreach($result as $info) {
try{
$total++;
$count += $info['uren'];
$factuur += ($info['factuur'] == "y")?$info['uren']:"0";

$stmt3 = $db->prepare("SELECT * FROM
klanten WHERE id = :klant ORDER BY id ASC
");
$stmt3->execute(array(
':klant' => $info['kid'],
));
$klant = $stmt3->fetch(PDO::FETCH_ASSOC);
$stmt4 = $db->prepare("SELECT * FROM
projecten WHERE id = :project ORDER BY id ASC
");
$stmt4->execute(array(
':project' => $info['pid'],
));
$project = $stmt4->fetch(PDO::FETCH_ASSOC);
}//end try
catch(Exception $e) {
echo '<h2><font color=red>';
var_dump($e->getMessage());
die ('</h2></font> ');
}

$table .= "<tr>";
$table .= "<td class=warning >$info[van]</td>";
$table .= "<td class=warning >$info[tot]</td>";
$table .= "<td class=success>$klant[naam]</td>";
$table .= "<td class=success>$project[naam]</td>";
$table .= "<td class=danger>$info[uren]</td>";
$table .= "<td class=info>$info[info]</td>";
$table .= "<td class=danger >$info[factuur]</td>";
$table .= "</tr>";
}
$table .= "<tr><td colspan=\"3\"></td>
<td>Totaal Aantal Uren:</td>
<td class='alert alert-info'>$count</td>
<td>Te Facturen uren:</td>
<td class='alert alert-danger' colspan=\"2\">$factuur</td>
<tr>";
$table .= "</tbody></table></div>";
echo $table;
if ($fac == 'y'){
echo "<div class='alert alert-block alert-danger text-center'>Factuur is al aangemaakt , geen bewerking meer mogelijk</div>";
}
}//end try
else
{
echo"aanwezigheid ID Bestaan niet";
}
?>
207 changes: 207 additions & 0 deletions pages/admin/overzicht.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
<?php
if (a()){
echo "<h1>".$_SESSION[ERROR]."</h1>";
$_SESSION[ERROR] ="";
require(getenv("DOCUMENT_ROOT")."/functions/database.php");
//details
try{
$stmt = $db->prepare("SELECT * FROM details ORDER BY datum DESC");
$stmt->execute();
$result = $stmt->fetchall(PDO::FETCH_ASSOC);
foreach($result as $info)
{
try{
$stmt2 = $db->prepare("SELECT * FROM
klanten WHERE id = :klant ORDER BY id ASC
");
$stmt2->execute(array(
':klant' => $info['kid'],
));
$klant = $stmt2->fetch(PDO::FETCH_ASSOC);
$stmt4 = $db->prepare("SELECT * FROM
projecten WHERE id = :project ORDER BY id ASC
");
$stmt4->execute(array(
':project' => $info['pid'],
));
$project = $stmt4->fetch(PDO::FETCH_ASSOC);
}//end try
catch(Exception $e) {
echo '<h2><font color=red>';
var_dump($e->getMessage());
die ('</h2></font> ');
}

$fac = ($info[factuur] == 'y')?"<td class=success >$info[factuur]</td>":"<td class=danger >$info[factuur]</td>";
$table .= "<tr data-toggle='modal' data-target='#modal' id='$info[awid]' onclick='detail(this.id);'>";
$table .= "<td class=warning >$info[datum]</td>";
$table .= "<td class=warning >$info[van]</td>";
$table .= "<td class=warning >$info[tot]</td>";
$table .= "<td class=success>$klant[naam]</td>";
$table .= "<td class=success>$project[naam]</td>";
$table .= "<td class=danger>$info[uren]</td>";
$table .= "<td class=info>$info[info]</td>";
$table .= $fac;
$table .= "</tr>";
}
$details = $table;
}
catch(Exception $e) {
echo '<h2><font color=red>';
var_dump($e->getMessage());
die ('</h2></font> ');
}
//einde details

//aanwezig
try{
$stmt6 = $db->prepare("SELECT * FROM aanwezig ORDER BY datum DESC");
$stmt6->execute();
$result5 = $stmt6->fetchall(PDO::FETCH_ASSOC);
foreach($result5 as $info2)
{
try{
$stmt5 = $db->prepare("SELECT * FROM
gebruikers WHERE id = :klant ORDER BY id ASC
");
$stmt5->execute(array(
':klant' => $info2['uid'],
));
$user = $stmt5->fetch(PDO::FETCH_ASSOC);
}//end try
catch(Exception $e) {
echo '<h2><font color=red>';
var_dump($e->getMessage());
die ('</h2></font> ');
}
$fac2 = ($info2[gefactureerd] == 'y')?"<td class=success >$info2[gefactureerd]</td>":"<td class=danger >$info2[gefactureerd]</td>";
$table2 .= "<tr data-toggle='modal' data-target='#modal' id='$info2[id]' onclick='detail(this.id);'>";
$table2 .= "<td class=success>$user[naam]</td>";
$table2 .= "<td class=warning >$info2[datum]</td>";
$table2 .= "<td class=warning >$info2[van]</td>";
$table2 .= "<td class=warning >$info2[tot]</td>";
$table2 .= "<td class=danger>$info2[uren]</td>";
$table2 .= $fac2;
$table2 .= "</tr>";
}
$aanwezig = $table2;
}
catch(Exception $e) {
echo '<h2><font color=red>';
var_dump($e->getMessage());
die ('</h2></font> ');
}
?>
<script>
function detail(val, dat) {
$.ajax({
type: "POST",
url: "../ajax/overzicht.php",
data:'details='+val,
success: function(data){
//alert(data);
//alert ("del: " +dat+ " en waarde: " +val);
$("#modal").modal('show');
$("#modalcode").html(data);

}
});
}
$(document).ready(function() {
$('table.table').DataTable( {
scrollY: '15vh',
scrollCollapse: true,
paging: false,
ordering: true,
initComplete: function (settings, json) {
// Get initial order
var orderInit = this.api().order();

this.api().columns().every( function (index) {
var column = this;
var select = $('<select><option value=""></option></select>')
.appendTo( $(column.footer()).empty() )
.on( 'change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);

column
.search( val ? '^'+val+'$' : '', true, false )
.draw();
} );

// NOTE: Temporarily sort the column data before retrieving it
// with data() function.
column.order('desc').draw(false).data().unique().each( function ( d, j ) {

if(column.search() === '^'+d+'$'){
select.append( '<option value="'+d+'" selected="selected">'+d+'</option>' )
} else {
select.append( '<option value="'+d+'">'+d+'</option>' )
}

} );
} );

// Restore initial order
this.api().order(orderInit).draw(false);
}
} );
} );
</script>
<div class='alert alert-block alert-success text-center'> Overzicht Aanwezigheden </div>
<table border=1 id='aanwezig' class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Gebruiker</th>
<th>datum</th>
<th>van</th>
<th>Tot</th>
<th>uren</th>
<th>Gefactureerd</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Gebruiker</th>
<th>datum</th>
<th>van</th>
<th>Tot</th>
<th>uren</th>
<th>Gefactureerd</th>
</tr>
</tfoot>
<tbody>
<?php echo $aanwezig; ?>
</tbody></table>
<div class='alert alert-block alert-danger text-center'> Overzicht Details </div>
<table border=1 id='details' class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>datum</th>
<th>van</th>
<th>Tot</th>
<th>Klant</th>
<th>Project</th>
<th>uren</th>
<th>info</th>
<th>Factuur</th>
</tr>
</thead>
<tfoot>
<tr>
<th>datum</th>
<th>van</th>
<th>Tot</th>
<th>Klant</th>
<th>Project</th>
<th>uren</th>
<th>info</th>
<th>Factuur</th>
</tr>
</tfoot>
<tbody>
<?php echo $details ?>
</tbody></table>
<?php } ?>
2 changes: 1 addition & 1 deletion pages/admin/versie.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$versie = "0.1.0";
$versie = "1.0.0";
if (a())
{
$ch = curl_init();
Expand Down
Loading

0 comments on commit 664c617

Please sign in to comment.