From 213200e8cbc7fe3ef0934cfb44a2712dd8b4ee01 Mon Sep 17 00:00:00 2001 From: venbatechnologies Date: Mon, 5 Mar 2018 13:01:40 +0530 Subject: [PATCH] salarycostforton --- application/config/routes.php | 6 + application/controllers/monthlypay.php | 320 +++++++++++ application/models/monthlypay_model.php | 98 +++- application/views/reportslink.php | 2 + application/views/salarycostforproduction.php | 527 ++++++++++++++++++ 5 files changed, 952 insertions(+), 1 deletion(-) create mode 100644 application/views/salarycostforproduction.php diff --git a/application/config/routes.php b/application/config/routes.php index b673265a..c664c34b 100755 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -278,5 +278,11 @@ $route['normalinprocess'] = "inprocess/addNewInprocessInspection"; $route['nissaninprocess'] = "inprocess/addNewNissanInprocessInspection"; + + +//this route path productionsalary details +$route['productionsalary']="monthlypay/productionsalary"; + + /* End of file routes.php */ /* Location: ./application/config/routes.php */ diff --git a/application/controllers/monthlypay.php b/application/controllers/monthlypay.php index 8d9360e8..fa8737bc 100755 --- a/application/controllers/monthlypay.php +++ b/application/controllers/monthlypay.php @@ -497,6 +497,326 @@ class monthlypay extends BaseController } +//this function used to Production salary Details + + + + + + function productionsalary(){ + + + $this->global['pageTitle'] = 'Siddharth : ProductionSalary'; + + + + $data['productionsalary'] = $this->monthlypay_model->productionsalarycost(); + + + + $this->loadviews('salarycostforproduction',$this->global,$data,NULL); + } + + +function addnew() +{ + + $date=$this->input->post('datepick'); + $date = date('Y-m-d',strtotime($date)); + + $prod = $this->input->post('pton'); + // echo $prod; + $mper= $this->input->post('today_abs'); + // echo $mper; + + $ttl = $this->input->post('today_salary'); + // echo $ttl; + $salary= $this->input->post('calc'); + //echo $salary; + + $Createdby = $this->session->userdata('userId'); + + + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $acc_createddt = $dt->format('Y-m-d H:i:s'); + + $productions = array('date'=>$date, + 'production'=>$prod, + 'emppresent'=>$mper, + 'totalsalary '=>$ttl, + 'salaryton'=>$salary, + 'createdon'=>$acc_createddt, + 'createdby'=>$Createdby ); + //print_r($productions); + // die; + $result = $this->monthlypay_model->productionsalarycosts($productions); + if( $result >= 0){ + + + + echo ""; + + redirect('monthlypay/productionsalary','refresh'); + + } + + + + +} + +function edited(){ + + $sno=$this->input->post('sno'); + // echo $sno; + $date=$this->input->post('date'); + $date = date('Y-m-d',strtotime($date)); + // echo $date; + $prod = $this->input->post('prod'); + // echo $prod; + $mper= $this->input->post('pra'); + // echo $mper; + + $ttl = $this->input->post('sal'); + // echo $ttl; + $salary= $this->input->post('ast'); + // echo $salary; + + $updatedby = $this->session->userdata('userId'); + + + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $acc_createddt = $dt->format('Y-m-d H:i:s'); + + $productions = array('date'=>$date, + 'production'=>$prod, + 'emppresent'=>$mper, + 'totalsalary '=>$ttl, + 'salaryton'=>$salary, + 'updatedon'=>$acc_createddt, + 'updatedby'=>$updatedby ); + +//print_r($productions); +$result = $this->monthlypay_model->updateproduction($productions,$sno); + if( $result >= 0){ + + + +echo "Updated Successfully Saved"; + + redirect('monthlypay/productionsalary','refresh'); + + } + + + +} + + + +/*date click on day salary,absent name, total absent display*/ + +function dateFunctionChangeVales() +{ + + + + $date = $this->input->post("id"); + // echo $date; + $daydate = date('Y-m',strtotime($date)); + //echo $date; die; + $daydate = $daydate . '-01'; + //$dat = date('d'); + // echo $daydate; echo ""; + $WH = 'WH' . date('j',strtotime($date)); + // echo $WH; + + $yesterday = $this->monthlypay_model->attyesterday($WH,$daydate); + // print_r($yesterday);die; + + $values = 0; + $absEmp = array(); + //echo $value; die; + foreach ($yesterday as $weekda => $value) { + + if ($value[$WH] != 0) { + + $values++; + $absendId = $value['EmpID']; + $absendName = $value['FirstName']; + + + $absEmp [] = $absendId . "-" . $absendName; //absend empid and name list + + + + } + + + } + + //print_r($absentName);die; + $data['today'] = $values; + + $OT = 'OT' . date('j',strtotime($date)); + + $CUR_month = date('t'); + + $toDayEmployee = $this->monthlypay_model->dayAllPersentEmpSalary($WH, $OT, $daydate); + + + $EmpID = 0; + + $employeeSalary = 0; + + foreach ($toDayEmployee as $value) { + $values = 0; + $totalothour = 0; + + if ($value[$WH] != 0) { + + $totalothour = $value[$OT]; + //echo $totalothour;die; + $values = 1; + + //print_r($values); die; + $Empid = $value['EmpID']; + //print_r($value['EmpID']); + + $totalEmployeePersent = $this->monthlypay_model->persentEmployeeDetails($Empid); + + + $HRA_Amount = $totalEmployeePersent[0]->HRA_Amount; + $Basic_Pay = $totalEmployeePersent[0]->Basic_Pay; + $totalsalary = $totalEmployeePersent[0]->TotalSalary; + $dayFoodAmt = $totalEmployeePersent[0]->Food_Allowances; + //$allowances =$totalEmployeePersent[0]->Allowances; + //echo "hra amount";print_r(array($HRA_Amount,$Basic_Pay,$totalsalary)); + //$Allowances = $allowances * $values; + $Food_Allowances = $dayFoodAmt * $values; + + $daySalary = $Basic_Pay / $CUR_month; + /**per day salary working hour**/ + //echo $daySalary.'
'; + + $dayHra = $HRA_Amount / $CUR_month; + /** per day hra amount **/ + //echo $dayHra.'
'; + + $onehoursSalary = ($daySalary + $dayHra) / 8; + /**one hour salay ot calculation**/ + if ($totalothour != 0) /** if ot not equal zero **/ { + $totSalayOT = $totalothour * $onehoursSalary; + } else { + $totSalayOT = 0; + } + $currentDaySalary = $daySalary * $values; + /** current day salary working days calculation**/ + + + $currentDayHra = $dayHra * $values; + /** total working days hra calculations**/ + // echo $currentDayHra.'
'; + $currentDatePF = $currentDaySalary + $currentDayHra + $totSalayOT; + /** current date pf calculation**/ + if ($totalsalary <= 20000) { + + $esiAmount = $currentDatePF * 1.75 / 100; + /** esiamount not elgiable for 20000 **/ + } else { + $esiAmount = 0; + } + $pfAmount = $currentDaySalary * 12 / 100; + /** pf amount per day**/ + + //echo $totalothour;die; + $salaryInCurrentdays = $currentDaySalary + $totSalayOT + $currentDayHra + $Food_Allowances; + $salaryInCurrentday = $salaryInCurrentdays - ($esiAmount + $pfAmount); + $employeeSalary += round($salaryInCurrentday); + // echo $employeeSalary; + } + + } + + + //$salaryInCurrentday++; + + + $data['employeeSalary'] = $employeeSalary; + +//print_r($data); + // } + echo json_encode($data); +} + + + +// function forreport() +// { + + +// $da =$this->input->post('term'); +// //$ab = date('Y-m-d',strtotime($da)); +// //echo strtotime($da); +// $da = '01-'.$da; +// //echo $da; + + +// $ab = date('Y-m-d',strtotime($da)); + +// //strtotime(str_replace('/', '-', '27/05/1990') +// //echo $ab; die; + + + +// $result = $this->monthlypay_model->cost($ab); + +// echo json_encode($result); + +// } + + + +function salarycost() +{ + + + $this->global['pageTitle'] = 'Siddharth : ProductionSalary'; + // $da =$this->input->post('term'); + $da=$this->input->post('datepi'); + //$ab = date('Y-m-d',strtotime($da)); +//echo $da; + $da= '01-'.$da; + //echo $d; + + + $ab = date('Y-m-d',strtotime($da)); + + //strtotime(str_replace('/', '-', '27/05/1990') + //echo $ab; die; + + + + $data['productionsalary'] = $this->monthlypay_model->cost($ab); + + + +//print_r( $data['$productionsalary']); die; + + +//echo json_encode($result); + // $this->loadviews('salarycostforproduction',$this->$data,NULL); + + $this->loadviews('salarycostforproduction',$this->global,$data,NULL); + +} + + + + } diff --git a/application/models/monthlypay_model.php b/application/models/monthlypay_model.php index 998e407e..53a161dd 100755 --- a/application/models/monthlypay_model.php +++ b/application/models/monthlypay_model.php @@ -394,6 +394,102 @@ join T_DepartmentDetails as Dep on Dep.DEPCode=Emp.Departmentcode where Emp.IsA - +//this function Production Salary cost details + + + + + + + function productionsalarycosts($productions) + { + $this->db->insert('T_ProductionSalaryCost',$productions); + + $r = $this->db->affected_rows(); + return $r; + } + +function updateproduction($productions,$sno) +{ + + + $this->db->where('sno',$sno); + $this->db->update('T_ProductionSalaryCost',$productions); + $r = $this->db->affected_rows(); + return $r; + + + + } + + function productionsalarycost() + { + $this->db->select('*'); + $this->db->from('T_ProductionSalaryCost'); + $query =$this->db->get(); + return $query->result(); + } + + + + function attyesterday($WH,$daydate) + { + + + +$sql="select att.EmpID,".$WH.",a.FirstName from T_Attendance as att +join T_Employee_Details as a on a.EmpID= att.EmpID +where Month_Year = ? and att.EmpID in (select EmpID from T_Attendance)"; + $query = $this->db->query($sql,array($daydate)); + + return $query->result_array(); +} + + + function dayAllPersentEmpSalary($WH,$OT,$date) + { + + $sql="select EmpID,".$WH.",".$OT." from T_Attendance where Month_Year = ? and EmpID in (select EmpID from T_Attendance)"; + $query = $this->db->query($sql,array($date)); + + return $query->result_array(); +} + + + +function persentEmployeeDetails($EmpID){ + +$sql= "select * FROM T_Emp_Pay_Data where EmpID = ?;"; + $query = $this->db->query($sql,array($EmpID)); + + return $query->result(); + +} + + + +function cost($ab) +{ + + + + $sql = "select * from T_ProductionSalaryCost where month(date)=month('".$ab."')"; + + //echo $sql;die; + + $query = $this->db->query($sql); + + return $query->result(); +} + + + + + + + + + } ?> + diff --git a/application/views/reportslink.php b/application/views/reportslink.php index 881bffcd..97c07f97 100755 --- a/application/views/reportslink.php +++ b/application/views/reportslink.php @@ -54,6 +54,8 @@

  Finance Reports

Cost Center

+ + SalaryCostforTonProduction

  Cashbook

diff --git a/application/views/salarycostforproduction.php b/application/views/salarycostforproduction.php new file mode 100644 index 00000000..a09309ef --- /dev/null +++ b/application/views/salarycostforproduction.php @@ -0,0 +1,527 @@ + + + + + + + + + + + + +
+ +
+

+
Siddharth Industries - Production Salary Cost
+

+
+
+
+
+ + +
+
+
+
+ +
+ +
+ +
+ + +
+ + + +
+
+
+ +
+ + +
+
+ + +
+ + +
+ +
+ + > + +
+ +
+ + + > + +
+
+ + +
+
+ +
+ + +
+
+ +
+
+
+ + + + +
+ + + +

+ + + +
+ + + + + + +

+ + +
+
+
+
+ +
+   + input->post('month')){ + $month = $this->input->post('month'); + echo '('.$month.')'; + + } + ?> + + +
+
+ + + + + + + + + + + + + + + + + $ps){ + ?> + + + + + + + + + + + + + + + + + + + + + + +
SNoDateProduction/TonEmployeePresentTotalSalaryCostSalaryCostPerTonAction
sno ?>date !='0000-00-00'){ + $date = date("d-m-Y",strtotime($ps->date)); + }else{ + $date = ''; + } + echo $date; + ?> + production ?>emppresent ?>totalsalary , 0, '.', ''); + ?>salaryton);?>
+

 

+
+ + + + +
+
+
+
+ + + + + + + + + + + + \ No newline at end of file