0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
USER
/
[
Home
]
File: paymentreport_ctrl.php
<?php require_once "../lib/config.php"; require_once BASE_DIR."/lib/db/connection.php"; $error_flag=0; $completeday= @$_POST['checkcompletedays']; if(isset($_POST['show'])) { if($completeday!=fullday) { $fromdate_dd= @$_POST['cmbpayfdd']; $fromdate_mm=@$_POST['cmbpayfmm']; $fromdate_yy=@$_POST['txtpayfyy']; $from_date=$fromdate_yy."-".$fromdate_mm."-".$fromdate_dd; $todate_mm= @$_POST['cmbpaytomm']; $todate_dd=@$_POST['cmbpaytodd']; $todate_yy=@$_POST['txtpaytoyy']; $to_date=$todate_yy."-".$todate_mm."-".$todate_dd; if (!is_numeric(@$_POST['txtpayfyy'])) { $error['fdate_numeric']="Please enter valid year"; $error_flag=1; } if (!is_numeric(@$_POST['txtpaytoyy'])) { $error['todate_numeric']="Please enter valid year"; $error_flag=1; } } if($error_flag==1) { echo "<script>window.location='http://localhost/CPFMS/USER/paymentreport.php</script>"; /*$url="http://".$server_ip."/CPFMS/USER/paymentreport.php?pcode=".$p_code_value; echo "<script>window.location='$url'</script>"; */ } if($error_flag==0) { $p_id=@$_SESSION['project_id']; $u_id=@$_SESSION['user_id']; if($completeday==fullday) { $sql="select * from payment where user_id='$u_id' and project_id='$p_id' and p_date ORDER BY p_date "; Paymentreport::printpaymentDetails($sql,"",""); } else { $sql="select * from payment where user_id='$u_id' and project_id='$p_id' and p_date between '$from_date' and '$to_date'" ; Paymentreport::printpaymentDetails($sql,$from_date,$to_date); } } } class Paymentreport { //7 public function printpaymentDetails($sql1,$from_date,$to_date) {//10 $sql=mysql_query($sql1); if(mysql_affected_rows()>0) {//14 ?> <div align="center"><b><?php $p_code=@$_SESSION['project_code_s'];echo "Payment details of project:$p_code"?> <?php echo"From:$from_date"?> <?php echo "To:$to_date";?></b></div> <table width="611" height="72" border="1" align="center"> <tr> <th width="29"> S No </th> <th width="49">Date </th> <th width="62">Payment id</th> <th width="60">Voucher number</th> <th width="114">Account name</th> <th width="68">Amount</th> <th width="73">Discount</th> <th width="104">Description </th> </tr> <tr><?php $i=0; while($row=mysql_fetch_array($sql)) {//32 ?> <th height="22"><?php @$_SESSION['sl_no']=@$_SESSION['sl_no']+1; echo @$_SESSION['sl_no']; ?></th> <th><?php $datedb=$row['p_date']; echo $datedb; ?></th> <th><?php echo $row['payment_id']; ?></th> <th><?php if ($row['voucher']=="") {?> <?php } else { echo $row['voucher']; } ?></th> <th><?php echo $row['account_Name']; ?></th> <th><?php $amount_db=$row['amount']; echo $amount_db; $i=$i+1; $amount_array[$i]=$amount_db; $amount=0; for($j=1;$j<=$i;$j++) { $amount=$amount+$amount_array[$j]; } ?></th> <th><?php $discount_db=$row['discount']; echo $discount_db; $i=$i+1; $discount_array[$i]=$discount_db; $discount=0; for($j=1;$j<=$i;$j++) { $discount=$discount+$discount_array[$j]; } ?></th> <th><?php echo $row['description']; ?></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="611" align="center"> <tr> <td><strong>Grand Total:</strong></td> <td><?php echo $amount;?></td> <td><?php echo $discount;?></td> <td> </td> </tr> </table> <strong>Balance :<?php echo $amount-$discount;?></strong> <?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="leavemanagement.php">Back</a></p> </blockquote> <?php } ?>