| Current Path : /home2/wtmwscom/www/member/ |
| Current File : /home2/wtmwscom/www/member/report_monthly.php |
<?php
$title= "Monthly Income Report";
include 'header.php';
include_once('lib/ps_pagination.php');
$uid = $_SESSION['userid'];
$total = 0;
?>
<h1>Monthly B. V. Report</h1>
<?php echo getMessage();?>
<section>
<table style="width: 100%;">
<thead>
<tr>
<th>S. No.</th>
<th>Matching Income</th>
<th>ORG-1 Amount</th>
<th>ORG-2 Amount</th>
<th>Date</th>
</tr>
</thead>
<?php
$amount_left = 0;
$amount_right = 0;
$childs_left = get_child_levels(get_child_ids_2($uid, 'L'));
$childs_right = get_child_levels(get_child_ids_2($uid, 'R'));
$amount_left = get_pv_amount($childs_left);
$amount_right = get_pv_amount($childs_right);
?>
<tbody>
<tr >
<td>1</td>
<td><?php echo min($amount_left, $amount_right)?></td>
<td><?php echo $amount_left;?></td>
<td><?php echo $amount_right;?></td>
<td><?php echo date("d M, Y h:i A");?></td>
</tr>
</tbody>
</table>
</section>
<h1>Monthly Achieved Report</h1>
<?php echo getMessage();?>
<section>
<table style="width: 100%;">
<thead>
<tr>
<th>S. No.</th>
<th>Amount</th>
<th>TDS (10%)</th>
<th>Service Charge (10%)</th>
<th>Net Amount</th>
<th>Date</th>
</tr>
</thead>
<?php
$query = "SELECT uid, amount, datetime FROM monthly_income WHERE `uid`='".$uid."' ORDER BY `datetime` DESC";
$pager = new PS_Pagination($link, $query, 50, 5 );
$pager->setDebug(true);
$result = $pager->paginate();
if($result){
?>
<tbody>
<?php
$total=0;
if(!isset($_GET['page'])){ $i=1; }else{ $i=(($_GET['page']-1)*50)+1; }
while ($row = mysqli_fetch_object($result)){
$total = $total+$row->amount;
$tds = $row->amount * 0.10;
$service = $row->amount * 0.10;
$net = $row->amount - ($tds + $service);
?>
<tr <?php if($i%2){echo "class='light'";}else{echo "class='dark'";}?>>
<td><?php echo $i;?></td>
<td><?php echo $row->amount;?></td>
<td><?php echo $tds;?></td>
<td><?php echo $service;?></td>
<td><?php echo $net;?></td>
<td><?php echo date("d M, Y h:i A", strtotime($row->datetime));?></td>
</tr>
<?php $i++;}?>
</tbody>
<thead>
<tr>
<th colspan="2" style="text-align: right;">Total Amount:</th>
<th colspan="4" style="text-align: left;"><?php echo $total?></th>
</tr>
</thead>
<?php }?>
</table>
<?php echo $pager->renderFullNav();?>
</section>
<?php include 'footer.php';
function get_pv_amount($id_array){
$amount = 0;
if(!empty ($id_array)) {
$uid_in = implode(" , ", $id_array);
//$result = mysqli_query($connection, "select pv_amount from product_sale where uid in ( $uid_in ) and monthly_status = 0");
$result = mysqli_query($connection, "select pv_amount from product_sale where uid in ( $uid_in ) and date BETWEEN '". date('Y-m')."-01'"." AND '".date('Y-m-d')."'");
$rec_id_array = array();
while($row = mysqli_fetch_object($result)){
$amount = $amount + $row->pv_amount;
// $rec_id_array[] = $row->rec_id;
}
}
return $amount;
}
?>