
PK 
<?php
session_start();
require_once '../common/common.php';
require_once '../common/secure.php';
include("connection.php");
include ("../head_account.php");
?>
<script type="text/javascript">
$(document).ready(function(){
$("#submit").click(function(){
if($("#cat").val()!='select')
{
if($("#sub_cat").val()=='select')
{
alert("Please select subcategory");
$("#cat").focus();
return false;
}
}
if($("#searchby").val()=='category')
{
//alert($("#cat").val());
if($("#cat").val()=='select')
{
alert("Please select category.");
$("#cat").focus();
return false;
}
}
});
$("#searchby").change(function(){
if($(this).val()=="category")
{
$(".tr").fadeIn();
$(".tr2").fadeOut();
}
else if($(this).val()=="branch")
{
$(".tr").fadeOut();
$(".tr2").fadeIn();
}
else if($(this).val()!="branch")
{
$(".tr2").fadeOut();
}
if($("#searchin").val()!="select")
{
ajx_cat_fill();
}
if($(this).val()=="yearly")
{
$(".tr2").fadeOut();
$(".tr").fadeOut();
}
if($(this).val()=="select")
{
$(".tr2").fadeOut();
$(".tr").fadeOut();
}
});
$("#cat").change(function(){
if($("#searchin").val()!="select")
{
$.ajax({
url: "ajax_get_cat.php?id=" + $(this).val() + "&time=" + new Date().getTime() + "&type=" + $("#searchin").val() ,
type: "GET",
error: function (xhr, desc, exceptionobj) {
alert(xhr.responseText);
},
success: function(data){
if (data.error) {
alert(data.error);
return;
}
//alert(data);
var x = data.split(',');
var op = '<option value="select">Select</option>'+'<option value="all">All</option>';
for (var i = 0; i < x.length-1; i++)
{
var y=x[i].split(':');
op = op + '<option value=' + y[0] + '>' + y[1] + '</option>';
}
$("#sub_cat").html(op);
}
});
}else
{
alert("Please select \"search in\" option");
$("#searchin").focus();
}
});
$("#searchin").change(function(){
if($("#searchin").val()!="select")
{
//alert($("#searchin").val());
ajx_cat_fill();
}
else
{
$('#searchby').val('select');
$(".tr").fadeOut();
}
});
});
function ajx_cat_fill()
{
$.ajax({
url: "ajax_get_cat_report.php?time=" + new Date().getTime() + "&type=" + $("#searchin").val() ,
type: "GET",
error: function (xhr, desc, exceptionobj) {
alert(xhr.responseText);
},
success: function(data){
if (data.error) {
alert(data.error);
return;
}
//alert(data);
var x = data.split(',');
var op = '<option value="select">Select</option>';
for (var i = 0; i < x.length-1; i++)
{
var y=x[i].split(':');
op = op + '<option value=' + y[0] + '>' + y[1] + '</option>';
}
if($("#searchin").val()!="select")
{
$("#cat").html(op);
}
}
});
}
</script>
<div align="center">
<form action="report.php" id="frm1" method="post">
<fieldset style="width:80%;"><legend>Accounts Reports</legend>
<table cellspacing="3" align="center" width="100%" border="0" cellpadding="2">
<tr>
<td style='text-align:left;' >
Search In :<select id='searchin' name='searchin' style="width:120px;">
<option value='select'>Select</option>
<?php
if($_GET['typeacc']=='income')
{
$incomeselect="selected='selected'";
}
else if($_GET['typeacc']=='expenditure')
{
$expenditurselect="selected='selected'";
}
echo "<option value='income' ".$incomeselect.">Income</option>";
echo "<option value='expenditur' ".$expenditurselect.">Expenditure</option>";
?>
</select>
</td>
<td style='text-align:left;'>
Search By : <select id='searchby' name='searchby' style="width:120px;">
<option value='select' selected='selected'>Select</option>
<option value='branch'>Branch</option>
<option value='category'>Category</option>
<option value='yearly'>Yearly</option>
</select>
</td>
</tr>
<tr>
<td colspan='2'> </td>
</tr>
<tr class="tr2" style="display:none;">
<td colspan='2' align='left' style='text-align:left;'>
Branch : <select id='branch' name='branch' style="width:120px;">
<?php
if($_SESSION['city']=='ludhiana')
{
$amsr='selected="selected"';
}
?>
<option value='amritsar'>Amritsar</option>
<option value='ludhiana' <?php echo $amsr; ?>>Ludhiana</option>
</select>
</td>
</tr>
<tr class="tr" style="display:none;">
<td style='text-align:left;'>
Category : <select id='cat' name='cat' style="width:120px;">
<option value='select' selected='selected'>Select</option>
</select>
</td>
<td>Sub Category : <select id='sub_cat' name='sub_cat' style="width:120px;">
<option value='select' selected='selected'>Select</option>
</select>
</td>
</tr>
<tr>
<td colspan='2'> </td>
</tr>
<tr>
<td colspan='2' align="center" style='text-align:left;'>
<center><input type="submit" name="submit" id="submit" value="Go" style="width:95px;"/></center>
</td>
</tr>
</table>
</fieldset>
</form>
</div>
<?php include ("../foot.php"); ?>


PK 99