0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
USER
/
[
Home
]
File: salaryreport_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']; $sql="select * from employe where user_id='$u_id' and project_id='$p_id' and status=1"; $sql=mysql_query($sql); $i=0; while($row=mysql_fetch_array($sql)) { $emp_group=$row['emp_name']; $i=$i+1; $emp_name_array[$i]=$emp_group; } $emp_count=$i; $error_flag=0; $completeday= @$_POST['checkcompletedays']; if(isset($_POST['show'])) { $empname=@$_POST['cmbempname']; $emp_name=$emp_name_array[$empname]; if($completeday!=fullday) { $fromdate_dd= @$_POST['cmbsalfdd']; $fromdate_mm=@$_POST['cmbsalfmm']; $fromdate_yy=@$_POST['txtsalfyy']; $from_date=$fromdate_yy."-".$fromdate_mm."-".$fromdate_dd; $todate_mm= @$_POST['cmbsaltomm']; $todate_dd=@$_POST['cmbsaltodd']; $todate_yy=@$_POST['txtsaltoyy']; $to_date=$todate_yy."-".$todate_mm."-".$todate_dd; if (!is_numeric(@$_POST['txtsalfyy'])) { $error['fdate_numeric']="Please enter valid year"; $error_flag=1; } if (!is_numeric(@$_POST['txtsaltoyy'])) { $error['todate_numeric']="Please enter valid year"; $error_flag=1; } } if($error_flag==1) { $url=$server_ip."/USER/salaryreport.php"; echo "<script>window.location='$url'</script>"; } if($error_flag==0) {//153 Salaryreport::printsalaryDetailsheader($from_date,$to_date); $p_id=@$_SESSION['project_id']; $u_id=@$_SESSION['user_id']; $sql1="select distinct(emp_id) from salaryvoucher where user_id='$u_id' and project_id='$p_id'"; $sql2=mysql_query($sql1); while($row_base=mysql_fetch_array($sql2)) { // 69 $emp_id_db=$row_base['emp_id']; if($emp_name=="") { $sql_emp="select * from employe where `emp_id`='$emp_id_db' and user_id='$u_id' and project_id='$p_id' and status=1"; } else { $sql_emp="select * from employe where `emp_id`='$emp_id_db' and user_id='$u_id' and project_id='$p_id' and emp_name='$emp_name'"; } $sql_emp=mysql_query($sql_emp); while($row_inner=mysql_fetch_array($sql_emp)) { //166 $emp_id_var=$row_inner['emp_id']; if($completeday==fullday) { $sql="select * from salaryvoucher where user_id='$u_id' and project_id='$p_id' and emp_id='$emp_id_var' and date ORDER BY date "; Salaryreport::printsalaryDetails($sql,"",""); } else { $sql="select * from salaryvoucher where user_id='$u_id' and project_id='$p_id' and emp_id='$emp_id_var' and date between '$from_date' and '$to_date'" ; Salaryreport::printsalaryDetails($sql,$from_date,$to_date); } }//166 } //69 }//153 } class Salaryreport { //7 public function printsalaryDetailsheader($from_date,$to_date) {//101 ?> <div align="center"><b><?php $p_code=@$_SESSION['project_code_s'];echo "Salary details of project:$p_code"?> <?php echo"From:$from_date"?> <?php echo "To:$to_date";?></b></div><br /> <table width="808" height="73" border="1" align="center"> <tr> <th width="39"> S No </th> <th width="88">Date </th> <th width="75">Salary id</th> <th width="195">Name</th> <th width="75">Voucher No.</th> <th width="115">Salary</th> <th width="175">Description </th> </tr></table><?php }//101 public function printsalaryDetails($sql1,$from_date,$to_date) {//10 $sql=mysql_query($sql1); if(mysql_affected_rows()>0) {//14 ?> <table width="809" height="73" border="1" align="center"> <?php $salary=0; while($row=mysql_fetch_array($sql)) {//32 ?> <tr> <td width="39" height="23"><div align="center"> <?php @$_SESSION['sl_no']=@$_SESSION['sl_no']+1; echo @$_SESSION['sl_no']; ?> </div></td> <td width="89"><div align="center"> <?php echo $row['date']; ?> </div></td> <td width="75"><div align="center"> <?php echo $row['salary_id']; ?> </div></td> <td width="195"><div align="center"> <?php $p_id=@$_SESSION['project_id']; $u_id=@$_SESSION['user_id']; $emp_db=$row['emp_id']; $sql_emp="select `emp_name` from employe where `emp_id`='$emp_db' and user_id='$u_id' and project_id='$p_id'"; $sql4=mysql_query($sql_emp); while($row_emp=mysql_fetch_array($sql4)) { echo $row_emp['emp_name']; } ?> </div></td> <td width="75"><div align="center"> <?php echo $row['svoucherno']; ?> </div></td> <th width="115"><div align="center"> <?php $salary_db=$row['salary_paid']; echo $salary_db; $salary=$salary+$salary_db; ?> </div></th> <td width="175"><div align="center"> <?php echo $row['description']; ?> </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><tr> <br />Grand Total: <b><?php echo $salary;?></b><br /></table> <?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="task.php">Back</a></p> </blockquote> <?php } ?>