<?php
require "racs.php";
require "vtshowsBBB.php";
session_start();
if(!isset($_SESSION['titles']) || !isset($_SESSION['positions'])|| !isset($_SESSION['usernames'])){
header("location:index.php");
}
?>
<html>
<title>RpM-Paymode</title>
<head>
<style type="text/css">
.form-style-9{
	max-width: 450px;
	background: #FAFAFA;
	padding: 30px;
	margin: 50px auto;
	box-shadow: 1px 1px 25px rgba(0, 0, 0, 0.35);
	border-radius: 10px;
	border: 6px solid #305A72;
}
.form-style-9 ul{
	padding:0;
	margin:0;
	list-style:none;
}
.form-style-9 ul li{
	display: block;
	margin-bottom: 10px;
	min-height: 35px;
}
.form-style-9 ul li  .field-style{
	box-sizing: border-box; 
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box; 
	padding: 8px;
	outline: none;
	border: 1px solid #B0CFE0;
	-webkit-transition: all 0.30s ease-in-out;
	-moz-transition: all 0.30s ease-in-out;
	-ms-transition: all 0.30s ease-in-out;
	-o-transition: all 0.30s ease-in-out;

}.form-style-9 ul li  .field-style:focus{
	box-shadow: 0 0 5px #B0CFE0;
	border:1px solid #B0CFE0;

}
.form-style-9 ul li .field-split{
	width: 49%;
}
.form-style-9 ul li .field-full{
	width: 100%;
}
.form-style-9 ul li input.align-left{
	float:left;
}
.form-style-9 ul li input.align-right{
	float:right;
}
.form-style-9 ul li textarea{
	width: 100%;
	height: 100px;
}
.form-style-9 ul li input[type="button"], 
.form-style-9 ul li input[type="submit"] {
	-moz-box-shadow: inset 0px 1px 0px 0px #3985B1;
	-webkit-box-shadow: inset 0px 1px 0px 0px #3985B1;
	box-shadow: inset 0px 1px 0px 0px #3985B1;
	background-color: #216288;
	border: 1px solid #17445E;
	display: inline-block;
	cursor: pointer;
	color: #FFFFFF;
	padding: 8px 18px;
	text-decoration: none;
	font: 12px Arial, Helvetica, sans-serif;
}
.form-style-9 ul li input[type="button"]:hover, 
.form-style-9 ul li input[type="submit"]:hover {
	background: linear-gradient(to bottom, #2D77A2 5%, #337DA8 100%);
	background-color: #28739E;
}
</style>    
<link rel="stylesheet" type="text/css" media="all" href="jsDatePick_ltr.min.css" />
<link rel="stylesheet" type="text/css" media="all" href="jsDatePick_ltr.css" />
<script type="text/javascript" src="jsDatePick.min.1.3.js"></script>
<script src="datesps.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

<link rel="stylesheet" type="text/css" href="vtxstyles.css">
</head>
<body style='font-family:calibri;font-size:small;'>
<div style='width=30%;height:100%%;'>
<?php


$flt=racs(1);

if($flt=="access failed"){
printf("<div style='font-color:red;'>>Access failed\nContact Sales and Marketing division</div>");
}
else{
$conn=mysqli_connect("localhost","primarysales","S5L7lF01EQZvQrGK","primarysales_diana");

if(isset($_REQUEST['starts'])){
$starts=$_REQUEST['starts'];}
else{
$starts=date('Y-m-01');}

if(isset($_REQUEST['ends'])){
$ends=$_REQUEST['ends'];}
else{
$ends=date('Y-m-t');}

if(isset($_REQUEST['zones'])){
$zones=$_REQUEST['zones'];}
else{
$zones='all';}

if(isset($_REQUEST['regions'])){
$regions=$_REQUEST['regions'];}
else{
$regions='all';}


if(isset($_REQUEST['rsm'])){
$rsm=$_REQUEST['rsm'];}
else{
$rsm='all';}

if(isset($_REQUEST['exnm'])){
$exnm=$_REQUEST['exnm'];}
else{
$exnm='all';}

if(isset($_REQUEST['agents'])){
$agents=$_REQUEST['agents'];}
else{
$agents='all';}


if(isset($_REQUEST['dates'])){
$invdates=$_REQUEST['dates'];}
else{
$invdates='all';}


if(isset($_REQUEST['terri'])){
$terrys=$_REQUEST['terri'];}
else{
$terrys='all';}

if(isset($_REQUEST['subrgn'])){
$subregions=$_REQUEST['subrgn'];}
else{
$subregions='all';}

if(isset($_REQUEST['agtypes'])){
$agenttypes=$_REQUEST['agtypes'];}
else{
$agenttypes='all';}

if(isset($_REQUEST['invnum'])){
$invnum=$_REQUEST['invnum'];}
else{
$invnum='all';}

if(isset($_REQUEST['dlvdate'])){
$ddates=$_REQUEST['dlvdate'];}
else{
$ddates='all';}

if(isset($_REQUEST['chqdt'])){
$chqdt=$_REQUEST['chqdt'];}
else{
$chqdt='all';}

if(isset($_REQUEST['chqnum'])){
$chqnum=$_REQUEST['chqnum'];}
else{
$chqnum='all';  
}

if(isset($_REQUEST['payrcdt'])){
$paydate=$_REQUEST['payrcdt'];}
else{
$paydate='all';  
}

if(isset($_REQUEST['chqamount'])){
$chqamount=$_REQUEST['chqamount'];}
else{
$chqamount='all';  
}

if(isset($_REQUEST['chqbank'])){
$chqbank=$_REQUEST['chqbank'];}
else{
$chqbank='all';  
}

if(isset($_REQUEST['depsitdt'])){
$depsitdt=$_REQUEST['depsitdt'];}
else{
$depsitdt='all';  
}

if(isset($_REQUEST['zoneorder'])){
$zoneorder=$_REQUEST['zoneorder'];}
else{
$zoneorder='all';  
}

#$flt=racs(1);
if(strtolower($zones)!='all'){
$flt=$flt." and zones='".$zones."' ";}
if(strtolower($regions)!='all'){
$flt=$flt." and regions='".$regions."' ";}
if(strtolower($subregions)!='all'){
$flt=$flt." and sub_regions='".$subregions."' ";}
if(strtolower($agents)!='all'){
$flt=$flt." and agent_names='".$agents."' ";}
if(strtolower($agenttypes)!='all'){
$flt=$flt." and agent_types='".$agenttypes."' ";}
if(strtolower($terrys)!='all'){
$flt=$flt." and territory_names='".$terrys."' ";}
if(strtolower($items)!='all'){
$flt=$flt." and item_names='".$items."' ";}
if(strtolower($ranges)!='all'){
$flt=$flt." and item_ranges='".$ranges."' ";}
if(strtolower($subranges)!='all'){
$flt=$flt." and sub_ranges='".$subranges."' ";}
if(strtolower($voucher)!='all'){
$flt=$flt." and invoice_number='".$voucher."' ";}
}

stps(1);
printf("<div class='sds'>");
sacnew(1);
printf("</div>");

?>

<form class="form-style-9" name="form_name" method="post" action="rpmupdatechqbnk.php">
<ul>
<li>
<input type="text" name="dbname" id="dbn" class="field-style field-split align-left" disabled="true" value="<?php if(isset($agents)) echo $agents ?>" />
<input type="hidden" name="agentname" value="<?php if(isset($agents)) echo $agents ?>" />
<input type="hidden" name="paydates" value="<?php if(isset($paydate)) echo $paydate ?>" />
<input type="hidden" name="zones" value="<?php if(isset($zones)) echo $zones ?>" />
<input type="hidden" name="dlvdates" value="<?php if(isset($ddates)) echo $ddates ?>" />
<input type="hidden" name="agtype" value="<?php if(isset($agenttypes)) echo $agenttypes ?>" />
<input type="hidden" name="subrgn" value="<?php if(isset($subregions)) echo $subregions ?>" />
<input type="hidden" name="terriname" value="<?php if(isset($terrys)) echo $terrys ?>" />
<input type="hidden" name="invdate" value="<?php if(isset($invdates)) echo $invdates ?>" />
<input type="hidden" name="exname" value="<?php if(isset($exnm)) echo $exnm ?>" />
<input type="hidden" name="rsmname" value="<?php if(isset($rsm)) echo $rsm ?>" />
<input type="hidden" name="region" value="<?php if(isset($regions)) echo $regions ?>" />
<input type="hidden" name="chqamount" value="<?php if(isset($chqamount)) echo $chqamount ?>" />
<input type="hidden" name="chqbank" value="<?php if(isset($chqbank)) echo $chqbank ?>" />
<input type="hidden" name="depsitdt" value="<?php if(isset($depsitdt)) echo $depsitdt ?>" />
<input type="hidden" name="zoneorder" value="<?php if(isset($zoneorder)) echo $zoneorder ?>" />
<input type="hidden" name="invnumberr" value="<?php if(isset($invnum)) echo $invnum ?>" />

<input type="text" name="invnumber" id="innum" class="field-style field-split align-right" disabled="true" value="<?php if(isset($invnum)) echo $invnum ?>" />
</li>
<li>
<input type="text" name="chqdate" class="field-style field-split align-right" disabled="true" placeholder="Cheque Date" value="Cheq Date-<?php echo $chqdt?>"/>
</li>
<li>
<input type="text" name="dbchqnumm" class="field-style field-split align-right" disabled="true" value="<?php echo $chqnum?>"/>
<input type="hidden" name="chqnum" value="<?php if(isset($chqnum)) echo $chqnum ?>" />
<br><br>
<li>
<input type="text" name="cometarea" class="field-style field-split align-left" placeholder="Comment Area" value="" id="comarea" disabled="true"/>&nbsp&nbsp
<select name="chqsts" id="cashb" class="field-style field-split align-right">
<option></option>    
<option>Realized</option>    
<option>Cheque-Rtn</option>
</select>   
<br><br>
<input type="text" name="rtnchqcharges" class="field-style field-split align-right" value="" placeholder="Rtn Cheq Charges"/>
<li>
<input type="submit" name="save" id="btnac" onclick="submit_by_name()"/>    
</li>
</ul>
</form>
</div>
</div>

<script>

// Submit form with name function.
function submit_by_name() {
var name = document.getElementById("cashb").value;
if (validation()) // Calling validation function
{
var x = document.getElementsByName('form_name');
x[0].submit(); //form submission
alert(" Name : " + name + " n Form Name : " + document.getElementById("form_id").getAttribute("name") + "nn Form Submitted Successfully......");
}
}

// Name and Email validation Function.
function validation() {
var name = document.getElementById("cashb").value;
if (name === '') {
alert("Please fill Cheque Status fields...!!!!!!");
return false;
}
}

</script>

</body>
</html>