0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
ADMIN
/
[
Home
]
File: summary_division_ctrl.php
<?php require_once "../lib/config.php"; require_once BASE_DIR."/lib/db/connection.php"; $error_flag=0; $completeday= @$_POST['checkcompletedays']; $Brief= @$_POST['checkbrief']; if(isset($_POST['show'])) { if($completeday!=fullday) { $fromdate_dd= @$_POST['cmbsumfdd']; $fromdate_mm=@$_POST['cmbsumfmm']; $fromdate_yy=@$_POST['txtsumfyy']; $from_date=$fromdate_yy."-".$fromdate_mm."-".$fromdate_dd; $todate_mm= @$_POST['cmbsumtomm']; $todate_dd=@$_POST['cmbsumtodd']; $todate_yy=@$_POST['txtsumtoyy']; $to_date=$todate_yy."-".$todate_mm."-".$todate_dd; if (!is_numeric(@$_POST['txtsumfyy'])) { $error['fdate_numeric']="Please enter valid year"; $error_flag=1; } if (!is_numeric(@$_POST['txtsumtoyy'])) { $error['todate_numeric']="Please enter valid year"; $error_flag=1; } } /* if ($fromdate_yy!="") { $error['fdate_yy']="Please enter year"; $error_flag=1; } if ($todate_yy!="") { $error['todate_yy']="Please enter year"; $error_flag=1; } */if($error_flag==1) { $url="http://".$server_ip."/CPFMS/ADMIN/summary_division.php?pcode=".$p_code_value; echo "<script>window.location='$url'</script>"; } if($error_flag==0) { $division_name=@$_SESSION['division_d']; $sql1="select user_id from user where user_name='$division_name'"; $sql=mysql_query($sql1); while($row=mysql_fetch_array($sql)) { $u_id=$row['user_id']; } if($completeday==fullday) { if($Brief==brief) { $sql="select project_id,group_name,debit,credit from ledger where user_id='$u_id' "; } else { $sql="select project_id,group_name,account_name,debit,credit from ledger where user_id='$u_id' "; } summaryreport::printsummaryDetails($sql,"",""); } else { if($Brief==brief) { $sql="select project_id,group_name,debit,credit from ledger where user_id='$u_id' and project_id='$p_id' and date between '$from_date' and '$to_date'" ; } else { $sql="select project_id,group_name,account_name,debit,credit from ledger where user_id='$u_id' and project_id='$p_id' and date between '$from_date' and '$to_date'" ; } summaryreport::printsummaryDetails($sql,$from_date,$to_date); } } } class summaryreport { //7 public function printsummaryDetails($sql1,$from_date,$to_date) {//10 $sql=mysql_query($sql1); if(mysql_affected_rows()>0) {//14 ?> <div align="center"><b><?php $division_name=@$_SESSION['division_d'];echo "Summary report of the division :$division_name"?> <?php echo"From:$from_date"?> <?php echo "To:$to_date";?></b></div> <table width="543" height="68" border="1" align="center"> <tr> <th width="94" height="23">Project id</th> <th width="207">By Account</th> <th width="107">To Account</th> <th width="48">Debit</th> <th width="53">Credit</th> </tr> <tr> <?php $i=0;$debit=0;$credit=0; while($row=mysql_fetch_array($sql)) {//32 ?> <th ><?php echo $row['project_id']; ?></th> <th ><?php echo $row['group_name']; ?></th> <th><?php echo $row['account_name']; ?></th> <th><?php $debit_db=$row['debit']; echo $debit_db; $debit=$debit+$debit_db; ?></th> <th><?php $credit_db=$row['credit']; echo $credit_db; $credit=$credit+$credit_db; ?></th> <!-- <th><a href="../USER/edit_payment.php?id=</?php echo $row['payment_id']; ?>"><img src="../images/edit.png" alt="edit" width="25" height="25" /></a></th> <th> <a href="../USER/delete_payment.php?id=</?php echo $row['payment_id']; ?>"><img src="../images/delete.jpg" alt="Delete" width="25" height="25" /></a></th>--> </tr> <?php }//32 ?> </table> <table width="539" align="center"> <tr> <td width="126"> <div align=""><strong>Grand total</strong></div></td> <td width="286"> </td> <td width="57"><div align="center"><?php echo $debit;?></div></td> <td width="50"><div align="center"><?php echo $credit;?></div></td> </tr> </table> <br /> <tr> Balance :<?php echo $credit-$debit;?> <?php }//14 else {//14 ?><font color="#CC0000"><b><?php echo "No Details to display"; ?></b></font><?php }//14 }//10 }//7 if(isset($_POST['show'])) { ?> </p> <p><a href="#" class="projectboldtxt style2" onclick="window.print()">Print</a> <a href="division_report.php">Back</a></p> </blockquote> <?php } ?>