<?
session_start();
include_once('opendb.php');
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
$br=$_SESSION['branch'];

if(strlen($user)<=0)
{
  print "<script> alert('Invalid User'); document.location='inde.php' </script>";
  return;
}

?>


<html>
<body >

<title>Rebate Certificate</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript" src="scripts/jquery-latest.js"></script>
<link type="text/css" href="includes/style1.css" rel="stylesheet" />

<script type="text/javascript">
$(function() {
if ($.browser.msie && $.browser.version.substr(0,1)<7)
{
	$('li').has('ul').mouseover(function(){
	$(this).children('ul').show();
	}).mouseout(function(){
	$(this).children('ul').hide();
	})
        }
});        
</script>
<script>
function valid()
{
}
</script>
<style>
.txt td
{
font-family: calibri;

}
</style>
<link rel="stylesheet" type="text/css" media="all" href="jsDatePick_ltr.min.css" />
<script type="text/javascript" src="jsDatePick.min.1.3.js"></script>
<script type="text/javascript">
window.onload = function(){
new JsDatePick({
	useMode:2,
	target:"inputField",
	dateFormat:"%Y-%m-%d"
});
new JsDatePick({
	useMode:2,
	target:"inputField1",
	dateFormat:"%Y-%m-%d"
});
            
};
</script>

<SCRIPT LANGUAGE="JavaScript" SRC="util/PopupWindow.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="util/AnchorPosition.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="util/CalendarPopup.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="util/date.js"></SCRIPT>
<script>

var cal1 = new CalendarPopup();
cal1.showYearNavigation();

var cal2 = new CalendarPopup();
cal2.showYearNavigation();

</script>
<style>
.tble1
{

border:0px solid silver;
margin-top:20px;
width:100%;

}	
.tble1 td, th
{
border-collapse:collapse;
border:0px solid silver;

}
.tble1 tr
{
height:30px;
}
.tble1
{
font-family: calibri;
}

th{
    // background-color: grey;  
    font-weight: bold;  
    color: white; 
    border:1px solid #D7D7D1;
    border-collapse:collapse;
background: rgb(181,189,200); /* Old browsers */
background: -moz-linear-gradient(top, rgba(181,189,200,1) 0%, rgba(130,140,149,1) 36%, rgba(40,52,59,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(181,189,200,1)), color-stop(36%,rgba(130,140,149,1)), color-stop(100%,rgba(40,52,59,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(181,189,200,1) 0%,rgba(130,140,149,1) 36%,rgba(40,52,59,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(181,189,200,1) 0%,rgba(130,140,149,1) 36%,rgba(40,52,59,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(181,189,200,1) 0%,rgba(130,140,149,1) 36%,rgba(40,52,59,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(181,189,200,1) 0%,rgba(130,140,149,1) 36%,rgba(40,52,59,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b5bdc8', endColorstr='#28343b',GradientType=0 ); /* IE6-9 */
}
.ro_settled td
{
background: #6bba70; /* Old browsers */
background: -moz-linear-gradient(top, #6bba70 0%, #6bba70 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6bba70), color-stop(100%,#6bba70)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #6bba70 0%,#6bba70 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #6bba70 0%,#6bba70 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #6bba70 0%,#6bba70 100%); /* IE10+ */
background: linear-gradient(to bottom, #6bba70 0%,#6bba70 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6bba70', endColorstr='#6bba70',GradientType=0 ); /* IE6-9 */
color:white;
}
.ro_settl td
{
background: #6bba70; /* Old browsers */
background: -moz-linear-gradient(top, #6bba70 0%, #6bba70 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6bba70), color-stop(100%,#6bba70)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #6bba70 0%,#6bba70 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #6bba70 0%,#6bba70 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #6bba70 0%,#6bba70 100%); /* IE10+ */
background: linear-gradient(to bottom, #6bba70 0%,#6bba70 100%); /* W3C */
filter: progid:DXImageTran.Microsoft.gradient( startColorstr='#6bba70', endColorstr='#6bba70',GradientType=0 ); /* IE6-9 */
color:red;
}
</style>
<form action='<?print $PHP_SELF?>' method='post' >

<center>
<?	
$fromdt=$_REQUEST['fromdt'];	
$todt=$_REQUEST['todt'];
$type=$_REQUEST['type'];
$redtype=$_REQUEST['redtype'];	
$qry=mysqli_query($db,"select gname,invdate,sum(total),sum(mba),sum(strbtnml),sum(strbtspl),sum(redct),sum(befrtx),sum(taxamt),sum(nettot),min(invno),max(invno) from prod_invoice where invdate between '$fromdt' and '$todt' and brcode='$brcode' and gname='$type' group by gname");
$row=mysqli_fetch_row($qry);
$qry1=mysqli_query($db,"select brname from branch where brcode = '$brcode'");
$row1=mysqli_fetch_row($qry1);
$qry3=mysqli_query($db,"select gname,invdate,sum(total),sum(mba),sum(strbtnml),sum(strbtspl),sum(redct),sum(befrtx),sum(taxamt),sum(nettot),min(invno),max(invno) from salesretn where invdate between '$fromdt' and '$todt' and brcode='$brcode' and gname='$type' group by gname");
$row3=mysqli_fetch_row($qry3);
$mtot_total3 = $row3[2];
if(($redtype=='mda')or ($redtype=='MDA'))
{
	$mtot_rebt3 = $row3[3];
}
if(($redtype=='strbtnml')or ($redtype=='State Rebate Normal'))
{
	$mtot_rebt3 = $row3[4];
}
if(($redtype=='strbtspl')or ($redtype=='State Rebate Special'))
{
	$mtot_rebt3 = $row3[5];
}


$brname = $row1[0];
$mtot_total = $row[2];
if(($redtype=='mda')or ($redtype=='MDA'))
{
	$mtot_rebt = $row[3];
}
if(($redtype=='strbtnml')or ($redtype=='State Rebate Normal'))
{
	$mtot_rebt = $row[4];
}
if(($redtype=='strbtspl')or ($redtype=='State Rebate Special'))
{
	$mtot_rebt = $row[5];
}
?>
<table class='tble1'>
<tr>
<td>Total Sales : &nbsp;&nbsp;<?print $mtot_total?> </td><td align=right>Rebate :&nbsp;&nbsp;<?print $mtot_rebt ?> </td>
</tr>
<tr>
<td>Sales Returned : &nbsp;&nbsp;<?print $mtot_total3?></td><td align=right>Rebates :&nbsp;&nbsp;<?print $mtot_rebt3 ?> </td>
</tr>
<tr>
<td>Net Sales :&nbsp;&nbsp;<?print $mtot_total-$mtot_total3?> </td><td align=right> Net Rebates :&nbsp;&nbsp;<?print $mtot_rebt-$mtot_rebt3?> </td>
</tr>
</table>
<br/>
<table style="font-family:calibri;">
<tr align=center>
<td>				CERTIFICATE </td>
</tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>

<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   
Certified that the duplicate copies of the cash memos mentioned in the centers statements 
enclosed with the claim are kept in record with use and will be made available to the staff of the
commission or the officers of the Goverment audit department for checking whenever demanded.
</td>
</tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>


<tr>
<td>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp   Certified that the sales for which the rebate has been claimed do not included the wholesales
of sales or goods returned or sales or goods on which rebate is not admissible or sales of government
departments.
</td>
</tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr>
<td>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Certified that all the centres for which claims have been made in this statement are approved 
branches of this institution.
</td>
</tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr>
<td>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Certified that claims are made strictly according to the books of account of this institution 
and that the amount of the claim has not been claimed and received previously and that in the event 
of any discrepency found during inspection or audit, this institution will be liable to repay such 
amount to the commission promptly and rebates subsidy claimed above have been paid at the rates and 
according to the scales and conditions prescribed in the sanctions of the each scheme.
</td>
</tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr>
<td>
Place : <?print $brname?>
</td>
</tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr>
<td>
Date  : <?print date('d-m-Y')?>
</td>
</tr>
<tr>
<td>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp (Rubber stamp of the institution)
</td>
</tr>

<tr align=right>
<td>

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp										Signature of Manager
</td>
</tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr>
<td>
*(Strike which is not applicable)

Net Rebate amount for payment Rs. ...................... Entered in the Ledger Folio No.
</td>
</tr>
<tr>
<td>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
					 	CHECKING CLERK
						</td>
</tr>
<tr>
<td>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp										Superintendent
</td>
</tr>
<tr>
<td>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp										Khadi & VI Commission
</td>
</tr>
<tr>
<td>

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp										Trivandum
</td>
</tr>
</table>
		
