
PK 
<?php
require_once '../common/secure.php';
include("connection.php");
include ("../head_account.php");
$searchinType=$_GET['searchin'];
/*print_pre($_SESSION);*/
?>
<script type="text/javascript">
function show1(objxf)
{
var target=objxf;
//alert(target);
$(document).ready(function(){
$("#"+target+"").fadeOut("slow");
$("#table1_"+target+"").fadeIn("slow");
});
}
function show_sub1(frtd)
{
var target=frtd;
//alert(target);
$(document).ready(function(){
//alert($(target).html());
$("#"+target+"").fadeOut("slow");
$("#span_"+target+"").fadeOut("slow");
$("#div1_"+target+"").fadeIn("slow");
});
}
$(document).ready(function(){
$(".togg1").click(function()
{
var dispid="div1_s"+$(this).attr('id');
var dissubpid="s"+$(this).attr('id');
$("#"+dispid+"").toggle("slow");
$("#"+dissubpid+"").show("slow");
$("#span_"+dissubpid+"").fadeIn("fast");
//alert(dispid);
});
});
function show(objxf)
{
var target=objxf;
//alert(target);
$(document).ready(function(){
//alert($(target).html());
$("#"+target+"").fadeOut("slow");
$("#table_"+target+"").fadeIn("slow");
});
}
function show_sub(frtd)
{
var target=frtd;
//alert(target);
$(document).ready(function(){
//alert($(target).html());
$("#"+target+"").fadeOut("slow");
$("#div_"+target+"").fadeIn("slow");
});
}
$(document).ready(function(){
$(".togg").click(function()
{
var dispid="div_s"+$(this).attr('id');
var dissubpid="s"+$(this).attr('id');
$("#"+dispid+"").toggle("slow");
$("#"+dissubpid+"").show("slow");
//alert(dispid);
});
});
</script>
<font color="#006699"><b>
<?php
if($_GET['action']=="edit")
{
echo "Edit ".ucfirst($searchinType);
}
else
{
echo ucfirst($searchinType);
}
?> Details</b></font>
<center><a href="account_get_reports.php">Back</a></center>
<table cellspacing="3" align="center" width="90%" border="4" cellpadding="3">
<tr>
<?php
if($searchinType=="income")
{
?>
<th><strong>INCOME</strong> <a href='addregularincome.php' style='margin-left:25px;'>Regular Income</a></th>
<?php
}
?>
<?php
if($searchinType=="expenditure")
{
?>
<th><strong>EXPENDITURE</strong> <a href='addregularexpenditure.php' style='margin-left:25px;'>Regular Expenditure</a></th>
<?php
}
?>
</tr>
<tr>
<?php
//Show Income Report
if($searchinType=="income")
{
?>
<td valign='top' width='45%'>
<?php
$sql="select * from income";
$res=mysql_query($sql);
$grandTotal=0;
while($ro=mysql_fetch_array($res))
{
echo "<table style='display:none' id='table1_cat1_".($ro['id'])."' >
<tr>
<td valign='top' bgcolor='silver'>".$ro['name']."</td>
<td>";
$sql2="SELECT * FROM income_sub WHERE inc_id='".$ro['id']."'";
$result1=mysql_query($sql2);
$subtotal1=0;
while($ro1=mysql_fetch_array($result1))
{
echo "<a name='_".$ro1['id']."'></a>";
echo "<a href='#_".$ro1['id']."' onclick=\"show_sub1('sub1_".$ro1['id']."')\" id=\"sub1_".$ro1['id']."\">".$ro1['name']."</a> ";
echo "<span id=\"span_sub1_".$ro1['id']."\">Total : </span>";
$spanid1="span_sub1_".$ro1['id'];
echo "<div style=\"display:none;\" id=\"div1_sub1_".$ro1['id']."\">
<a id='ub1_".$ro1['id']."' href='#_".$ro1['id']."' class='togg1'>".$ro1['name']."</a>";
$sql3="SELECT * FROM income_criteria WHERE inc_sub_id='".$ro1['id']."' ORDER BY id";
$result2=mysql_query($sql3);
$totalamu1=0;
echo "<table>
<tr>
<th>S.No.</th>
<th>Date</th>
<th>Details</th>
<th>Amount</th>";
if($_GET['action']=="edit")
{
echo "<th colspan='2'>Action</th>";
}
echo "</tr>";
while($ro20=mysql_fetch_array($result2))
{
$arrPHP=explode("-",$ro20['idate']);
$phpDate=($arrPHP[2]."-".$arrPHP[1]."-".$arrPHP[0]);
echo "<tr>
<td>".$ro20['id']."</td>
<td>".$phpDate."</td>
<td>".$ro20['details']."</td>
<td>".$ro20['amount']."</td>";
if($_GET['action']=="edit")
{
echo "<td><a href='update_criteria.php?mod=inccriteria&action=edit&id=".$ro20['id']."'>Edit</a></td>";
echo "<td><a href='account_edit_action.php?mod=inccriteria&action=del&id=".$ro20['id']."'>Delete</a></td>";
}
echo "</tr>";
$totalamu1=(int)$ro20['amount'] + (int)$totalamu1;
}
echo " </table> ";
echo "<script type='text/javascript'>
$(document).ready(function(){
$('#".$spanid1."').html('".$totalamu1."');
});
</script>";
echo " <div style='border:1px solid;border-color:silver;font-size:12px;width:100%;height:15px' align='center'>
<div align='left' style=';padding-left:25px;float:left'>Total</div>
<div align='right' style=';padding-left:10px;'>".$totalamu1."</div>
</div>
</div><br/>";
$subtotal1=$subtotal1+$totalamu1;
}
echo "
</td>
</tr>
</table>";
if((int)$subtotal1>0)
{
echo "<a href='#' onclick=\"show1('cat1_".$ro['id']."')\" id=\"cat1_".$ro['id']."\">".$ro['name']."</a><div align='center' style='padding-left:0px;float:left;width:100%;background-color:silver'>
<div align='right' style='background-color:silver;float:right;padding-left:-50px'>".$subtotal1."</div>
<div align='left' style='width:250px;;float:left;background-color:silver'>Total</div>
</div> <br/><br/>";
}else
{
continue;
}
$grandTotal1=$grandTotal1+$subtotal1;
}
?>
</td>
<?php
}
if($searchinType=="expenditure")
{
?>
<td valign='top' width='100%'>
<?php
$sql="select * from expenditure";
$res=mysql_query($sql);
$grandTotal=0;
while($ro=mysql_fetch_array($res))
{
echo "<table style='display:none' id=\"table_cat_".strtolower($ro['id'])."\">
<tr>
<td valign='top' bgcolor='silver'>".$ro['name']."</td>
<td>";
$sql2="SELECT * FROM expenditure_sub WHERE exp_id='".$ro['id']."'";
$result1=mysql_query($sql2);
$subtotal=0;
while($ro1=mysql_fetch_array($result1))
{
echo "<a name='_".$ro1['id']."'></a>";
echo "<a href='#_".$ro1['id']."' onclick=\"show_sub('sub_".$ro1['id']."')\" id=\"sub_".$ro1['id']."\">".$ro1['name']."</a><br/>";
echo "<div style=\"display:none\" id=\"div_sub_".$ro1['id']."\">
<a id='ub_".$ro1['id']."' href='#_".$ro1['id']."' class='togg'>".$ro1['name']."</a>";
$sql3="SELECT * FROM expenditure_criteria WHERE exp_sub_id='".$ro1['id']."' ORDER BY id";
$result2=mysql_query($sql3);
$totalamu=0;
echo "<table cellspacing='0' cellpadding='0' border='1px solid'>
<tr>
<th>S.No.</th>
<th>Date</th>
<th>Details</th>
<th>Tax</th>
<th>Amount</th>
<th>Total Amount</th>";
if($_GET['action']=="edit")
{
echo "<th colspan='2'>Action</th>";
}
echo "</tr>";
while($ro2=mysql_fetch_array($result2))
{
$arrPHP=explode("-",$ro2['idate']);
$phpDate=($arrPHP[2]."-".$arrPHP[1]."-".$arrPHP[0]);
/*if(trim($ro2['tax'])=="")
{
$ro2['tax']=0;
}*/
if($ro2['grandtotal']=="0.00")
{
$ro2['grandtotal']=$ro2['amount'];
}
echo "<tr width='10px'>
<td>".$ro2['id']."</td>
<td>".$phpDate."</td>
<td>".$ro2['details']."</td>
<td>".$ro2['tax']."</td>
<td>".$ro2['amount']."</td>
<td>".$ro2['grandtotal']."</td>";
if($_GET['action']=="edit")
{
echo "<td><a href='update_criteria.php?mod=expcriteria&action=edit&id=".$ro2['id']."'>Edit</a></td>";
echo "<td><a href='account_edit_action.php?mod=expcriteria&action=del&id=".$ro2['id']."'>Delete</a></td>";
}
echo "</tr>";
//$totalamu=$ro2['amount'] + $totalamu ;
$totalamu=$ro2['grandtotal'] + $totalamu ;
}
echo " </table> ";
echo "<div style='border:1px solid;border-color:silver;font-size:12px;width:100%;height:15px' align='center'>
<div align='left' style='width:50%;padding-left:25px;float:left'>Total</div>
<div align='center' style='width:50%;padding-left:100px;'>".$totalamu."</div>
</div>
</div><br/>";
$subtotal=$subtotal+$totalamu;
}
echo "
</td>
</tr>
</table>";
if((int)$subtotal>0)
{
echo "<a href='#' onclick=\"show('cat_".$ro['id']."')\" id=\"cat_".strtolower($ro['id'])."\">".$ro['name']."</a><div align='center' style='padding-left:0px;width:100%;;float:left;background-color:silver'>
<div align='left' style='width:250px;;float:left;background-color:silver'>Total</div>
<div align='right' style='background-color:silver;float:right;padding-left:-50px'>".$subtotal."</div>
</div> <br/><br/>";
}else
{
continue;
}
$grandTotal=$grandTotal+$subtotal;
}
?>
</td>
<?php
}
?>
</tr>
<!-- certificate income -->
<?php
if($searchinType=="income")
{
echo "<tr>
<td>Regular Income :".$grandTotal1."</td>
</tr>
<tr>
<td>Certificate Income :";
$sql_inc_total="SELECT sum(grandtotal) FROM invoices WHERE invstatus='paid'";
$result_inc_total=mysql_query($sql_inc_total);
$row_inc_total=mysql_fetch_array($result_inc_total);
echo $inc_total=$row_inc_total['sum(grandtotal)'];
echo "</td>
</tr>";
}
if($searchinType=="expenditure")
{
echo "<tr>
<td>Regular Expenditure:".$grandTotal."</td>
</tr>";
/*<tr>
<td>Certificate Expenditure :";
$sql_exp_total="SELECT sum(grandtotal) FROM invoices WHERE invstatus='pending'";
$result_exp_total=mysql_query($sql_exp_total);
$row_exp_total=mysql_fetch_array($result_exp_total);
echo $exp_total=$row_exp_total['sum(grandtotal)'];
echo "</td>
</tr>";*/
}
?>
<!-- certificate income -->
<tr>
<?php
if($searchinType=="income")
{
?>
<td><?php $inc_grandtotal=$grandTotal1+$inc_total; echo "Grand Total : ".$inc_grandtotal; ?> </td>
<?php
}
if($searchinType=="expenditure")
{
?>
<td><?php $exp_grandtotal=$grandTotal+$exp_total; echo "Grand Total : ".$exp_grandtotal; ?> (incl. tax)</td>
<?php
}
?>
</tr>
</table>
<?php
include ("../foot.php");
?>


PK 99