0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
ADMIN
/
[
Home
]
File: ledger_ctrl.php
<?php require_once "../lib/config.php"; require_once BASE_DIR."/lib/db/connection.php"; //$u_id= @$_SESSION['user_id']; $p_id=@$_SESSION['project_id_a']; $sql="select distinct account_name from ledger where project_id='$p_id' "; $sql=mysql_query($sql); $i=0; while($row=mysql_fetch_array($sql)) { $acc_name=$row['account_name']; $i=$i+1; $acc_name_array[$i]=$acc_name; } $error_flag=0; $accname_restore=@$_POST['cmbaccname']; $error_flag=0; $completeday= @$_POST['checkcompleteday']; if(isset($_POST['show'])) { //22 $a_name=$acc_name_array[$accname_restore]; if($completeday!="fullday") { $fromdate_dd= @$_POST['cmbLfromdd']; $fromdate_mm=@$_POST['cmbLformmm']; $fromdate_yy=@$_POST['txtLfromyy']; $from_date=$fromdate_yy."-".$fromdate_mm."-".$fromdate_dd; $todate_mm= @$_POST['cmbLtomm']; $todate_dd=@$_POST['cmbLtodd']; $todate_yy=@$_POST['txtLtoyy']; $to_date=$todate_yy."-".$todate_mm."-".$todate_dd; if (!is_numeric(@$_POST['txtLfromyy'])) { $error['fdate_numeric']="Please enter valid year"; $error_flag=1; } if (!is_numeric(@$_POST['txtLtoyy'])) { $error['todate_numeric']="Please enter valid year"; $error_flag=1; } } if($error_flag==1) { /*$url=$server_ip."/USER/ledger.php?message=$message"; echo "<script>window.location='$url'</script>"; */ include "ledger.php"; exit(); /*$url="http://".$server_ip."/CPFMS/USER/ledger.php?pcode=".$p_code_value; echo "<script>window.location='$url'</script>"; */ } if($error_flag==0) { $p_id=@$_SESSION['project_id_a']; if($completeday=="fullday") { $sql="select * from ledger where project_id='$p_id' and (account_name='$a_name' or group_name='$a_name') and date ORDER BY date "; ledgerreport::printledgerDetails($sql,"","",$a_name); } else { $sql="select * from ledger where project_id='$p_id' and (account_name='$a_name' or group_name='$a_name') and date between '$from_date' and '$to_date'" ; ledgerreport::printledgerDetails($sql,$from_date,$to_date,$a_name); } } } class ledgerreport { //7 public function printledgerDetails($sql1,$from_date,$to_date,$a_name) {//10 $sql=mysql_query($sql1); if(mysql_affected_rows()>0) {//14 ?> <div align="center"><strong><?php $p_code=@$_SESSION['project_code_s'];echo "Ledger of project:$p_code"?> <?php echo"From:$from_date"?> <?php echo "To:$to_date";?></strong></div><br /><div align="center"><?php //echo "By Account:$byaccount"; echo "To Account: $a_name"; ?></div> <table width="1047" height="76" border="1" align="center" id="ledgertable"> <tr> <th width="24" height="42"> S No </th> <th width="83">Date </th> <th width="75">Ledger id</th> <th width="150">By Account</th> <th width="150">To Account</th> <th width="100">Debit</th> <th width="100">Credit</th> <th width="152">Description </th> <th width="75">Reference</th> <th width="74">Reference id</th> </tr> <tr><?php $i=0;$debit=0;$credit=0; while($row=mysql_fetch_array($sql)) {//32 ?> <td><div align="center"> <?php @$_SESSION['sl_no']=@$_SESSION['sl_no']+1; echo @$_SESSION['sl_no']; ?> </div></td> <td><div align="center"> <?php $datedb=$row['date']; echo $datedb; ?> </div></td> <td><div align="center"> <?php echo $row['ledg_id']; ?> </div></td> <td><div align="center"> <?php echo $row['group_name']; ?> </div></td> <td><div align="center"> <?php echo $row['account_name']; ?> </div></td> <td><div align="center"> <?php $debit_db=$row['debit']; echo $debit_db; $debit=$debit+$debit_db; ?> </div></td> <td><div align="center"> <?php $credit_db=$row['credit']; echo $credit_db; $credit=$credit+$credit_db; ?> </div></td> <td><div align="center"> <?php echo $row['description']; ?> </div></td> <td><div align="center"> <?php echo $row['ledger_type']; ?> </div></td> <td><div align="center"> <?php echo $row['type_id']; ?> </div></td> <!-- <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="485" align="center"> <tr> <td width="264"><div align="left"><strong>Grand total</strong></div></td> <td width="104"><div align="center"><strong><?php echo $debit;?></strong></div> </td> <td width="101"><div align="center"><strong><?php echo $credit;?></strong></div></td> </tr> </table> <blockquote> <p> Balance : <b><?php echo $credit-$debit;?></b> <?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="project_report.php">Back</a></p> </blockquote> <?php } ?>