<?php
if (!defined("root")) {
	define("root", $_SERVER['DOCUMENT_ROOT']);
}
require(root."/___simple_config.php");
session_start();
$pageSubOf = "reports";
$pageName = "report_deposits";
$pageTitle = "Report Deposits";
$thisUrl = "reports/deposits";
$pageUrl = "/".adminFolder."/$thisUrl";
$coutSpecs = array('nl'=>"n");
require(root."/".adminFolder."/_common.php");
require(root."/".adminFolder."/_lib/db.php");
require(root."/".adminFolder."/_lib/main.php");
require(root."/".adminFolder."/_lib/auth.php");
$a = cekpost(cleanQuery($_GET["a"]), "");
$stgl = cekpost(cleanQuery($_REQUEST["fil_stgl"]), date('d-m-Y', time()));
$etgl = cekpost(cleanQuery($_REQUEST["fil_etgl"]), date('d-m-Y', time()));
$q_stgl = strtotime($stgl);
$q_etgl = strtotime($etgl)+86400;
$fil_stgl = strtotime($stgl);
$fil_etgl = strtotime($etgl);
require(root."/".adminFolder."/_tpl/tag_html_a.php");
cout('
<style type="text/css">
	
</style>
');
require(root."/".adminFolder."/_tpl/openbody.php");
require(root."/".adminFolder."/_tpl/header.php");
cout('<div class="page-header">');
	cout('<h1>'.$pageTitle.'</h1>');
cout('</div>');
# MAIN
###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ######
if ($a=="" || $a=="main") {
	cout('<div class="section_submenus">');
		cout('<ul class="nav nav-tabs" role="tablist">');
			if (authorizedModule("report_deposits_main", $ses_kduser)) {
				cout('<li role="presentation" class="active"><a href="'.$pageUrl.'/" title="Main List"><span class="glyphicon glyphicon-list"></span> Main</a></li>');
			}
		cout('</ul>');
	cout('</div>');
	
	cout('<nav class="navbar navbar-default">
		<div class="container-fluid">
			<!-- Brand and toggle get grouped for better mobile display -->
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
					<span class="sr-only">Toggle navigation</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="#">Filter</a>
			</div>');
			cout('<!-- Collect the nav links, forms, and other content for toggling -->');
			cout('<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">');
				cout('<form class="navbar-form navbar-left" role="search" method="post" target="filter_iframe" action="/'.adminFolder.'/_ajax/ajax_teachers.php?a=section_main">');
					if (authorizedModule("report_deposits_filter", $ses_kduser)) {
						if (authorizedModule("report_deposits_element_date", $ses_kduser)) {
							cout('<div class="form-group">');
								cout('<div class="controls"><label for="fil_stgl">From</label>');
									cout('<div class="input-group">');
										cout('<input id="fil_stgl" type="text" size="10" class="fil_stgl form-control" placeholder="Start Date" value="'.date('d-m-Y', $fil_stgl).'" />');
										cout('<label for="fil_stgl" class="input-group-addon btn">');
											cout('<span class="glyphicon glyphicon-calendar"></span>');
										cout('</label>');
									cout('</div>');
								cout('</div>');
							cout('</div>');
							cout('<div class="form-group">');
								cout('<div class="controls"><label for="fil_etgl">To</label>');
									cout('<div class="input-group">');
										cout('<input id="fil_etgl" type="text" size="10" class="fil_etgl form-control" placeholder="End Date" value="'.date('d-m-Y', $fil_etgl).'" />');
										cout('<label for="fil_etgl" class="input-group-addon btn">');
											cout('<span class="glyphicon glyphicon-calendar"></span>');
										cout('</label>');
									cout('</div>');
								cout('</div>');
							cout('</div>');
						}
						if (authorizedModule("report_deposits_element_games", $ses_kduser)) {
							cout('<div class="form-group">
								<label for="fil_kdgame">Games</label>
								<select name="fil_kdgame" id="fil_kdgame" class="form-control">
									<option value="">- Filter Game -</option>');
									$rsb=array();$qb="SELECT * FROM games WHERE isactive=1";
									callRS($rsb, $qb);
									for ($i=0;$i<count($rsb);$i++) {
										cout('<option value="'.$rsb[$i]["kdgame"].'">'.$rsb[$i]["nama"].'</option>');
									}
								cout('
								</select>
							</div>');
						}
						if (authorizedModule("report_deposits_element_username", $ses_kduser)) {
							cout('<div class="form-group">');
								cout('<label for="fil_username">UserName</label>');
								cout('<input type="text" name="fil_username" id="fil_username" class="form-control" placeholder="% UserName %">');
							cout('</div>');
						}
						if (authorizedModule("report_deposits_element_banks", $ses_kduser)) {
							cout('<div class="form-group">');
								cout('<label for="fil_kdbank">Bank</label>');
								$rsc=array();$qc = "SELECT * FROM banks";
								callRS($rsc, $qc);
								cout('<select name="fil_kdbank" id="fil_kdbank" class="form-control">');
									cout('<option value="">All</option>');
									for ($j=0;$j<count($rsc);$j++) {
										cout('<option value="'.$rsc[$j]["kdbank"].'" '.$sel.'>'.$rsc[$j]["inisial"].'</option>');
									}
								cout('</select>');
							cout('</div>');
						}
						if (authorizedModule("report_deposits_element_bank_account_number", $ses_kduser)) {
							cout('<div class="form-group">');
								cout('<label for="fil_norek">No. Rek.</label>');
								cout('<input type="text" name="fil_norek" id="fil_norek" class="form-control" placeholder="% Nomor Rekening %">');
							cout('</div>');
						}
						if (authorizedModule("report_deposits_element_bank_account_holder", $ses_kduser)) {
							cout('<div class="form-group">');
								cout('<label for="fil_namarek">Nama Rek.</label>');
								cout('<input type="text" name="fil_namarek" id="fil_namarek" class="form-control" placeholder="% Nama Pemilik Rek. %">');
							cout('</div>');
						}
						cout('<div class="form-group">
							<label for="fil_sort">Sort by?</label>
							<select name="fil_sort" id="fil_sort" class="form-control">
								<option value="0" selected="selected">Date</option>
								<option value="1">Highest DP</option>
								<option value="2">Lowest DP</option>
							</select>
						</div>');
					}
					cout('<button type="button" class="btn btn-primary" onclick="filterReload(\''.$pageName.'\', 1);return false;">Search</button>');
				cout('</form>');
				cout('<script>
					$(".fil_stgl, .fil_etgl").datepicker({
						inline: true,
						autosize: true,
						yearRange: "'.(date('Y', time())-5).':'.(date('Y', time())+1).'",
						changeMonth: true,
						changeYear: true,
						dateFormat: "dd-mm-yy"
					});
					$("#fil_username, #fil_norek, #fil_namarek, #fil_telp, #fil_email").keypress(function (e) {
						if(e.which == 13) {
							filterReload(\''.$pageName.'\', 1);
							return false;
						}
					});
				</script>');
			cout('</div><!-- /.navbar-collapse -->');
		cout('</div><!-- /.container-fluid -->');
	cout('</nav>');
	cout('<div class="ajax_resp"></div>');
	cout('<script>filterReload(\''.$pageName.'\', 1);</script>');
}
###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ######
/*
cout('<div class="container">');
	
	cout('<div id="contentPanel">');
		cout('<div class="bigTitle">'.$pageTitle.'</div>');
		# MAIN
		###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ######
		if ($a=="" || $a=="main") {
			cout('<div class="contentMenu">');
				cout(adminSubMenu(''.$pageUrl.'/', "main", "Main"));
			cout('</div>');
			cout('<div class="contentContainer">');
				cout('<div class="helper">');
					cout('<div class="inline" style="width:95%;border:1px #999 dashed;padding:10px;">');
						cout('<div class="inline" style="width:100%;"><strong>Filter</strong></div>');
						cout('<div class="inline" style="width:100%;">');
							cout('
							<div class="fleft">
								<div>Start Date:</div>
								<div><input type="text" id="fil_stgl" name="fil_stgl" value="'.date('d-m-Y', $fil_stgl).'" /></div>
							</div>
							<div class="fleft">
								<div>End Date:</div>
								<div><input type="text" id="fil_etgl" name="fil_etgl" value="'.date('d-m-Y', $fil_etgl).'" /></div>
							</div>');
						cout('</div>');
						cout('<div class="inline" style="width:100%;">');
							cout('<div class="fleft">
								<div><label for="fil_username">Username</label></div>
								<div><input type="text" name="fil_username" id="fil_username" /></div>
							</div>');
							cout('<div class="fleft">
								<div><label for="fil_kdbank">Bank</label></div>
								<div><select name="fil_kdbank" id="fil_kdbank">
									<option value=""></option>');
									$rsb=array();$qb="SELECT * FROM banks WHERE isactive=1";
									callRS($rsb, $qb);
									for ($i=0;$i<count($rsb);$i++) {
										cout('<option value="'.$rsb[$i]["kdbank"].'">'.$rsb[$i]["inisial"].'</option>');
									}
								cout('
								</select></div>
							</div>');
							cout('<div class="fleft">
								<div><label for="fil_norek">Nomor Rekening</label></div>
								<div><input type="text" name="fil_norek" id="fil_norek" /></div>
							</div>');
							cout('<div class="fleft">
								<div><label for="fil_namarek">Nama Pemilik Rekening</label></div>
								<div><input type="text" name="fil_namarek" id="fil_namarek" /></div>
							</div>');
						cout('</div>');
						cout('<div class="inline" style="width:100%;">');
							cout('<div class="fleft">
								<div><input class="formButton" type="button" value="Submit" onclick="loadall();" /></div>
							</div>');
						cout('</div>');
						cout('<div id="quick-err" class="err" style="width:100%;"></div>');
					cout('</div>');
					
					cout('<div id="main-list" class="main-list"></div>');
					cout('<div id="main-ajax-content" class="main-ajax-content"></div>');
					cout('<div class="tempMagicPop" style="width:1px;height:1px;overflow:hidden;"><div class="isi" style="display:inline-block;"></div></div>');
					cout('<script>
						loadall();
						function loadall() {
							var fil_stgl = $("#fil_stgl").val();
							var fil_etgl = $("#fil_etgl").val();
							var fil_kdbank = $("#fil_kdbank").val();
							var fil_username = $("#fil_username").val();
							var fil_norek = $("#fil_norek").val();
							var fil_namarek = $("#fil_namarek").val();
							var adata = "a=loadall";
							adata += "&fil_stgl="+ fil_stgl +"";
							adata += "&fil_etgl="+ fil_etgl +"";
							adata += "&fil_username="+ fil_username +"";
							adata += "&fil_norek="+ fil_norek +"";
							adata += "&fil_namarek="+ fil_namarek +"";
							adata += "&fil_kdbank="+ fil_kdbank +"";
							$(".main-ajax-content").html("<img src=\"/'.adminFolder.'/img/ajax-loader.gif\" alt />");
							$.ajax({
								type: "GET",
								url: "/'.adminFolder.'/_ajax/ajax_report_deposits.php",
								data: adata,
								success: function(resp){
									$(".main-ajax-content").html(resp);
								}
							});
						}
						$(document).ready(function(){
							$("#fil_stgl, #fil_etgl").datepicker({
								inline: true,
								autosize: true,
								yearRange: "'.(date('Y', time())-5).':'.(date('Y', time())+1).'",
								changeMonth: true,
								changeYear: true,
								dateFormat: "dd-mm-yy"
							});
						});
					</script>');
					
				cout('</div>');
			cout('</div>');
		}
		###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ###### ######
		
	cout('</div>');
cout('</div>');
*/
require(root."/".adminFolder."/_tpl/footer.php");
require(root."/".adminFolder."/_tpl/tag_html_b.php");
?>