0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
ADMIN
/
[
Home
]
File: salaryvoucher_datewise_report_ctrl.php
<?php require_once "../lib/config.php"; require_once BASE_DIR."/lib/db/connection.php"; //include("../model/financial_mdl.php"); //include("../model/financial_report_mdl.php"); $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']; } $sql="select * from employe where user_id='$u_id' "; $sql=mysql_query($sql); $i=0; $emp_name_array=[]; while($row=mysql_fetch_array($sql)) { $emp_group=$row['emp_name']; $i=$i+1; $emp_name_array[$i]=$emp_group; } $empname=@$_POST['cmbempname']; $emp_name=$emp_name_array[$empname]; $year_start=@$_POST['txtstartyy']; $month_var_start=@$_POST['cmbstartmm']; $day_var_start=@$_POST['cmbstartdd']; $SD=$year_start."-".$month_var_start."-".$day_var_start; $year_end=@$_POST['txtendyy']; $month_var_end=@$_POST['cmbendmm']; $day_var_end=@$_POST['cmbenddd']; $ED=$year_end."-".$month_var_end."-".$day_var_end; $num_workday=@$_POST['txtworkday']; if(isset($_POST['showbtn'])) { if (!is_numeric(@$_POST['txtstartyy'])) { $error['start_year_numeric']="Please enter valid year"; $error_flag=1; } if($year_start=="") { $error['start_year']="Please Enter year"; $error_flag=1; } if (!is_numeric(@$_POST['txtendyy'])) { $error['end_year_numeric']="Please enter valid year"; $error_flag=1; } if($year_end=="") { $error['end_year']="Please Enter year"; $error_flag=1; } if (!is_numeric(@$_POST['txtworkday'])) { $error['wd_numeric']="Please enter only number"; $error_flag=1; } if ($num_workday >31 or $num_workday <1) { $error['wd_invalid']="Please enter valid working days"; $error_flag=1; } if($num_workday=="") { $error['num_workday']="Please Enter Number of workingday"; $error_flag=1; } if($error_flag==1) { include("salaryvoucher_datewise_report.php"); exit(); } if($error_flag==0) {//68 if($emp_name=="") // All { $sql_emp="select * from employe where user_id='$u_id'"; } else { $sql_emp="select * from employe where user_id='$u_id' and`emp_name`='$emp_name'"; } @$_SESSION['total_salary']=0; LeaveSalaryVoucherReport::printleaveSalaryVoucherheader($SD,$ED); $sql3=mysql_query($sql_emp); while($row_emp=mysql_fetch_array($sql3)) { //98 $emp_id_var=$row_emp['emp_id']; $emp_name_var=$row_emp['emp_name']; LeaveSalaryVoucherReport::printLeaveSalaryVoucherReport($emp_id_var,$empname,$SD,$ED,$num_workday); } } } class LeaveSalaryVoucherReport { //57 public function printleaveSalaryVoucherheader($start,$end) {//59 ?> <div align="center"> <p><b>Salary Voucher of <b><?php $u_name=@$_SESSION['division_d'];$u_name=strtoupper($u_name);echo $u_name; ?></b> for the period from <?php echo $start;?> and : <?php echo $end;?></p> </div> <table width="799" height="48" border="1" align="center"> <tr> <th width="40" height="42"> S No </th> <th width="172">Employee Name</th> <th width="140">Project Code</th> <th width="110">Gross Salary </th> <th width="50">CL</th> <th width="50">LWOS</th> <th width="90"><p>LWOS Amt</p></th> <th width="95">Salary*</th> </tr> </table> <?php }//59 public function printLeaveSalaryVoucherReport($emp_id_var,$empname,$start,$end,$num_workday) {//77 ?> <table width="799" height="48" border="1" align="center"> <tr> <td width="40" height="39"><div align="center"> <?php @$_SESSION['sl_no']=@$_SESSION['sl_no']+1; echo @$_SESSION['sl_no']; ?> </div></td> <td width="172" ><div align="center"> <?php $sql_emp="select * from employe where emp_id='$emp_id_var'"; $sql3=mysql_query($sql_emp); while($row_emp_fn=mysql_fetch_array($sql3)) { $project_id=$row_emp_fn['project_id']; $gross_salary=$row_emp_fn['salary']; echo $row_emp_fn['emp_name']; } ?> </div></td> <td width="140"><div align="center"> <?php $sql_code="select project_code from addproject where project_id='$project_id'"; $sql_code=mysql_query($sql_code); while($row_code=mysql_fetch_array($sql_code)) { echo $row_code['project_code']; } ?> </div></td> <td width="110"><div align="center"> <?php echo $gross_salary; ?> </div></td> <td width="50"><div align="center"> <?php $sql_count="select * from leave_entry where leave_type='CL' and emp_id='$emp_id_var' and start_date between '$start' and '$end' and end_date between '$start' and '$end'"; $sql_count=mysql_query($sql_count); $count_cl=0; while($row_count=mysql_fetch_array($sql_count)) { /*$date=$row_count['start_date']; list($date_yy, $date_mm, $date_dd) = split('[/.-]', $date); if(($year==$date_yy) && ($month_var==date_mm)) {*/ $count_db=$row_count['leave_count']; $count_cl=$count_cl+$count_db; //} } echo $count_cl; ?> </div></td> <td width="50"><div align="center"> <?php $sql_count1="select * from leave_entry where leave_type='LWOS' and emp_id='$emp_id_var' and start_date between '$start' and '$end' and end_date between '$start' and '$end'"; $sql_count1=mysql_query($sql_count1); $count_lwos=0; while($row_count1=mysql_fetch_array($sql_count1)) { /*$date=$row_count1['start_date']; list($date_yy, $date_mm, $date_dd) = split('[/.-]', $date); //$date_mm=$date_mm+0; if(($year==$date_yy) && ($month_var==$date_mm)) {*/ $count_db1=$row_count1['leave_count']; $count_lwos=$count_lwos+$count_db1; //} } echo $count_lwos; ?> </div></td> <td width="90"><div align="center"> <?php $Lwos_amt=($gross_salary/$num_workday)*$count_lwos; echo round($Lwos_amt,0); ?> </div></td> <th width="95" ><div align="center"> <?php $salary=$gross_salary-$Lwos_amt; $salary=round($salary,0); echo $salary; @$_SESSION['total_salary']=@$_SESSION['total_salary']+$salary; ?> </div></tr> </table> <?php }//77 }//57 if(isset($_POST['showbtn'])) { ?> <br /> <table width="864"> <tr> <td width="752"> <div align="right">Total Salary :</div></td> <td width="100"> <div align="center"><b><?php echo @$_SESSION['total_salary'];?></b></div></td> </tr> </table> </p> <br /> Total Working Days : <?php echo $_POST['txtworkday'];?><br /><br /> * Not including HRA, Water Bill etc. <p><a href="#" class="projectboldtxt style2" onclick="window.print()">Print</a> <a href="division_report.php">Back</a></p> </blockquote> <?php } ?>