diff --git a/application/controllers/emppaydate.php b/application/controllers/emppaydate.php index a60df687..637f1699 100755 --- a/application/controllers/emppaydate.php +++ b/application/controllers/emppaydate.php @@ -84,23 +84,44 @@ class emppaydate extends BaseController $this->load->library('form_validation'); - - $this->form_validation->set_rules('EmpID','EmpID','required'); - $this->form_validation->set_rules('HRA_Rate','HRA_Rate','trim|required'); + $EmpID = $this->input->post('EmpID'); + $this->form_validation->set_rules('EmpID','EmpID','trim|required'); + $this->form_validation->set_rules('HRA_Rate','HRA_Rate','trim|required'); + $this->form_validation->set_rules('HRA_Amount','HRA_Amount','trim|required'); + $this->form_validation->set_rules('Basic_Pay','Basic_Pay','trim|required'); + $this->form_validation->set_rules('Total_salary','Total_salary','trim|required'); $this->form_validation->set_rules('OT_Rate','OT_Rate','trim|required'); $this->form_validation->set_rules('Allowances','Allowances','trim|required'); $this->form_validation->set_rules('PF_Rate','PF_Rate','trim|required'); $this->form_validation->set_rules('ESI_Rate','ESI_Rate','trim|required'); - $this->form_validation->set_rules('Food_Allowances','Food_Allowances','requried'); - + $this->form_validation->set_rules('Food_Allowances','Food_Allowances','trim|required'); + //$Loan_Amount=$this->input->post('Loan_Amount'); + // echo "before if"; + // if($Loan_Amount != 0.00 || $Loan_Amount != "") + // { + // echo "indisde "; + // $Load_Issued_date=$this->input->post('loan_issued_date'); + // $Due_Amount=$this->input->post('monthly_due'); + // $Due_Started=$this->input->post('due_started'); + // echo $Load_Issued_date ."-".$Due_Amount."-".$Due_Started; + // if($Load_Issued_date == "" || $Due_Started =="" || $Due_Amount == "" || $Due_Amount == 0) + // //echo "FAIL";die(); + + // $this->form_validation->set_rules('Loan_Amount','Loan_Amount','trim|required'); + // $this->form_validation->set_rules('loan_issued_date','loan_issued_date','trim|required'); + // $this->form_validation->set_rules('monthly_due','monthly_due','trim|required'); + // $this->form_validation->set_rules('Food_Allodue_startedwances','due_started','trim|required'); + + // } + //die(); - if($this->form_validation->run() == FALSE) + if($this->form_validation->run() == FALSE || $EmpID == -1) { $this->addemppaydate(); } else { - $Pay_Data_ID=$this->input->post('Pay_Data_ID'); + //$Pay_Data_ID=$this->input->post('Pay_Data_ID'); $EmpID = $this->input->post('EmpID'); $Total_Salary=$this->input->post('Total_salary'); $Basic_Pay=$this->input->post('Basic_Pay'); @@ -114,10 +135,16 @@ class emppaydate extends BaseController $Loan_Amount=$this->input->post('Loan_Amount'); $Load_Issued_date=$this->input->post('loan_issued_date'); + if(!empty($Load_Issued_date)){ $Load_Issued_date=$this->getDateformat2($Load_Issued_date); + }else{$Load_Issued_date=null;} $Due_Amount=$this->input->post('monthly_due'); $Due_Started=$this->input->post('due_started'); + if(!empty($Due_Started)){ $Due_Started=$this->getDateformat2($Due_Started); + }else{$Due_Started=null;} + + $No_Of_Dues=$this->input->post('no_of_due'); $Paid_due=$this->input->post('paid_due'); $Remaining_Due=$this->input->post('remaining_due'); @@ -129,9 +156,9 @@ class emppaydate extends BaseController $chked = $this->input->post('is_Active'); $IsActive = '1'; - $emppay = array('EmpID'=>$EmpID,'TotalSalary'=>$Total_Salary,'Basic_Pay'=>$Basic_Pay,'HRA_Rate'=>$HRA_Rate,'HRA_Amount'=>$HRA_Amount, 'OT_Rate'=>$OT_Rate, 'Allowances'=>$Allowances, 'PF_Rate'=>$PF_Rate, 'ESI_Rate'=>$ESI_Rate ,'Food_Allowances'=>$Food_Allowances,'Loan_Amount'=>$Loan_Amount,'Loan_Issued_Date'=>$Load_Issued_date,'Monthly_Due'=>$Due_Amount,'Due_Start_Date'=>$Due_Started,'No_of_Dues'=>$No_Of_Dues,'Paid_Due'=>$Paid_due,'Remaining_Due'=>$Remaining_Due,'Paid_Amount'=>$Paid_Amount,'is_Active'=>$IsActive,'Created_By'=>$CreateBy); + $emppay = array('EmpID'=>$EmpID,'TotalSalary'=>$Total_Salary,'Basic_Pay'=>$Basic_Pay,'HRA_Rate'=>$HRA_Rate,'HRA_Amount'=>$HRA_Amount, 'OT_Rate'=>$OT_Rate, 'Allowances'=>$Allowances, 'PF_Rate'=>$PF_Rate, 'ESI_Rate'=>$ESI_Rate ,'Food_Allowances'=>$Food_Allowances,'Loan_Amount'=>$Loan_Amount,'Loan_Issued_Date'=>$Load_Issued_date,'Monthly_Due'=>$Due_Amount,'Due_Start_Date'=>$Due_Started,'No_of_Dues'=>$No_Of_Dues,'Paid_Due'=>$Paid_due,'Remaining_Due'=>$Remaining_Due,'Paid_Amount'=>$Paid_Amount,'Created_By'=>$CreateBy); - // print_r($emppay);die(); + //print_r($emppay);die(); $result = $this->emppaydate_model->addNewemppay($emppay); if($result > 0) @@ -154,7 +181,7 @@ class emppaydate extends BaseController /** * This function is used for editing purpose and it has oldest values only. */ - function editOldemppay($paydataid= NULL) + function editOldemppay($paydataid="") { $data['emppay'] = $this->emppaydate_model->getUserInfo($paydataid); @@ -180,16 +207,16 @@ class emppaydate extends BaseController $Pay_Data_ID= $this->input->post('Pay_Data_ID'); - $this->form_validation->set_rules('Pay_Data_ID','Pay_Data_ID','trim|required'); + //$this->form_validation->set_rules('Pay_Data_ID','Pay_Data_ID','trim|required'); $this->form_validation->set_rules('EmpID','EmpID','trim|required'); - $this->form_validation->set_rules('total_salary','total_salary','trim|required'); + $this->form_validation->set_rules('Total_Salary','Total_Salary','trim|required'); $this->form_validation->set_rules('Basic_Pay','Basic_Pay','trim|required'); $this->form_validation->set_rules('HRA_Rate','HRA_Rate','trim|required'); $this->form_validation->set_rules('OT_Rate','OT_Rate','trim|required'); $this->form_validation->set_rules('Allowances','Allowances','trim|required'); $this->form_validation->set_rules('PF_Rate','PF_Rate','trim|required'); $this->form_validation->set_rules('ESI_Rate','ESI_Rate','trim|required'); - $this->form_validation->set_rules('Food_Allowances','Food_Allowances','trim|requried'); + $this->form_validation->set_rules('Food_Allowances','Food_Allowances','trim|required'); @@ -198,7 +225,7 @@ class emppaydate extends BaseController if($this->form_validation->run() == FALSE) { - $this->editOldemppay(); + $this->editOldemppay($Pay_Data_ID); } @@ -207,7 +234,7 @@ class emppaydate extends BaseController $Pay_Data_ID=$this->input->post('Pay_Data_ID'); $EmpID = $this->input->post('EmpID'); - $TotalSalary=$this->input->post('total_salary'); + $TotalSalary=$this->input->post('Total_Salary'); $Basic_Pay=$this->input->post('Basic_Pay'); $HRA_Rate=$this->input->post('HRA_Rate'); $HRA_Amount=$this->input->post('HRA_Amount'); @@ -217,10 +244,14 @@ class emppaydate extends BaseController $ESI_Rate=$this->input->post('ESI_Rate'); $Loan_Amount=$this->input->post('Loan_Amount'); $Load_Issued_date=$this->input->post('loan_issued_date'); - $Load_Issued_date=$this->getDateformat2($Load_Issued_date); + if(!empty($Load_Issued_date)){$Load_Issued_date=$this->getDateformat2($Load_Issued_date);} + else{$Load_Issued_date=null;} + $Due_Amount=$this->input->post('monthly_due'); - $Due_Started=$this->input->post('due_started'); - $Due_Started=$this->getDateformat2($Due_Started); + $Due_Started=$this->input->post('due_started'); + if(!empty($Due_Started)){$Due_Started=$this->getDateformat2($Due_Started);} + else{$Due_Started=null;} + //echo $Load_Issued_date. "-" . $Due_Started;die(); $No_Of_Dues=$this->input->post('no_of_due'); $Paid_due=$this->input->post('paid_due'); @@ -230,24 +261,24 @@ class emppaydate extends BaseController $Last_Mod_By=$this->session->userdata('userId'); $Last_Mod_Time=date('d-m-Y h:i:sa'); $Food_Allowances=$this->input->post('Food_Allowances'); - $chked = $this->input->post('is_Active'); + // $chked = $this->input->post('is_Active'); - if( $chked != '') - { - $IsActive = '1'; - } - else - { - $IsActive = '0'; - } + // if( $chked != '') + // { + // $IsActive = '1'; + // } + // else + // { + // $IsActive = '0'; + // } - $emppaydatas = array(); + //$emppaydatas = array(); - $emppaydatas = array('Pay_Data_ID'=>$Pay_Data_ID,'EmpID'=>$EmpID,'TotalSalary'=>$TotalSalary,'Basic_Pay'=>$Basic_Pay,'HRA_Rate'=>$HRA_Rate,'HRA_Amount'=>$HRA_Amount, 'OT_Rate'=>$OT_Rate, 'Allowances'=>$Allowances, 'PF_Rate'=>$PF_Rate, 'ESI_Rate'=>$ESI_Rate ,'Food_Allowances'=>$Food_Allowances,'Loan_Amount'=>$Loan_Amount,'Loan_Issued_Date'=>$Load_Issued_date,'Monthly_Due'=>$Due_Amount,'Due_Start_Date'=>$Due_Started,'No_of_Dues'=>$No_Of_Dues,'Paid_Due'=>$Paid_due,'Remaining_Due'=>$Remaining_Due,'Paid_Amount'=>$Paid_Amount,'is_Active'=>$IsActive,'Last_Mod_By'=>$Last_Mod_By,'Last_Mod_Time'=>$Last_Mod_Time); + $emppaydatas = array('Pay_Data_ID'=>$Pay_Data_ID,'EmpID'=>$EmpID,'TotalSalary'=>$TotalSalary,'Basic_Pay'=>$Basic_Pay,'HRA_Rate'=>$HRA_Rate,'HRA_Amount'=>$HRA_Amount, 'OT_Rate'=>$OT_Rate, 'Allowances'=>$Allowances, 'PF_Rate'=>$PF_Rate, 'ESI_Rate'=>$ESI_Rate ,'Food_Allowances'=>$Food_Allowances,'Loan_Amount'=>$Loan_Amount,'Loan_Issued_Date'=>$Load_Issued_date,'Monthly_Due'=>$Due_Amount,'Due_Start_Date'=>$Due_Started,'No_of_Dues'=>$No_Of_Dues,'Paid_Due'=>$Paid_due,'Remaining_Due'=>$Remaining_Due,'Paid_Amount'=>$Paid_Amount,'Last_Mod_By'=>$Last_Mod_By,'Last_Mod_Time'=>$Last_Mod_Time); // print_r($emppaydatas);die(); $result = $this->emppaydate_model->editemppay($emppaydatas); diff --git a/application/controllers/payslip.php b/application/controllers/payslip.php index fe5fbcfa..3f288ec7 100755 --- a/application/controllers/payslip.php +++ b/application/controllers/payslip.php @@ -154,6 +154,8 @@ function getEmployee() { $result = $this->payroll_model->getEmpAll($Payon); + //print_r($result); + //echo "-----------------------------------------"; if($result > 0 ) { @@ -163,7 +165,11 @@ function getEmployee() $EmpID = $result[$i]['EmpId']; $Data['PayDetails'] = $this->payroll_model->GetPayslipdata($Payon,$EmpID); - $Data['Count'] = $i; + //print_r($Data['PayDetails']);//die(); + $totalsalary =$Data['PayDetails'][0]->LessAdvance; + $totalsalaryinwords = $this->convertNumber(round($totalsalary)); + $Data['amtinwords']=$totalsalaryinwords; + //$Data['Count'] = $i; $this->load->View("payslipgenerateprint", $Data ); @@ -175,6 +181,9 @@ function getEmployee() { $EmpID = $this->input->post('Employee'); $Data['PayDetails'] = $this->payroll_model->GetPayslipdata($Payon,$EmpID); + $totalsalary =$Data['PayDetails'][0]->LessAdvance; + $totalsalaryinwords = $this->convertNumber(round($totalsalary)); + $Data['amtinwords']=$totalsalaryinwords; $this->load->View("payslipgenerateprint", $Data ); @@ -222,12 +231,15 @@ function getEmployee() function uploadExcel(){ + $FNAME = $this->input->post('FileName'); + echo "HI" . $FNAME; + echo realpath($FNAME);die(); $PayrollFileName = ''; //Check whether user upload picture if(!empty($_FILES['userfile']['name'])) { - //echo 'inside if'; + echo 'inside if'; $pathinfo = pathinfo($_FILES['userfile']['name']); $config['upload_path'] = 'uploads/files/'; $config['allowed_types'] = 'xls|xlsx|csv'; @@ -363,7 +375,9 @@ function getEmployee() */ function uploadExcel2(){ - + // $FNAME = $this->input->post('FileName'); + // echo "HI" . $FNAME . "-"; + // echo realpath($FNAME);die(); $PayrollFileName = ''; //Check whether user upload picture @@ -462,7 +476,7 @@ function getEmployee() } $FileDataExists = $this->payroll_model->checkFileDetailsExists2($PayOn,$EmpId); - //echo $FileExists; + // echo $FileDataExists; //die(); @@ -509,17 +523,15 @@ function getEmployee() } - // $data['Success'] = ""; + $data['Success'] = ""; - // $this->global['pageTitle'] = 'Siddharth : Payroll Data Upload'; + $this->global['pageTitle'] = 'Siddharth : Payroll Data Upload'; - // $this->loadViews("payslipupload2", $this->global, $data , NULL); + $this->loadViews("payslipupload2", $this->global, $data , NULL); - } - else{ - - $fail++; + } + // $data['Fail'] = ""; @@ -527,8 +539,10 @@ function getEmployee() // $this->loadViews("payslipupload2", $this->global, $data , NULL); - } - } + } + else{ + + $fail++;} @@ -538,28 +552,29 @@ function getEmployee() //echo $fail; //$data['success'] = ""; + //echo "DONE"; echo ""; echo ""; $this->global['pageTitle'] = 'Siddharth : Payroll Data Upload'; $this->loadViews("payslipupload2", $this->global , NULL); - //redirect('monthlyListings'); + //redirect('payslip/viewUpload2'); } else { - $data['Fail'] = ""; + //$data['Fail'] = ""; //echo ""; $this->global['pageTitle'] = 'Siddharth : Payroll Data Upload2'; - //$this->loadViews("payslipupload2", $this->global, $data , NULL); + $this->loadViews("payslipupload2", $this->global, $data , NULL); } } else { - $data['Fail'] = ""; + //$data['Fail'] = ""; //echo ""; $PayrollFileName = ''; @@ -583,6 +598,76 @@ function getEmployee() $this->loadViews("404", $this->global, NULL, NULL); } + + function convertNumber($amt){ + $ShowPaise='0'; + $totalAmt=explode(".",$amt); + + $number = $totalAmt[0]; + $no = $number; + + if(!empty($totalAmt[1]) && $totalAmt[1]!=0){ + $point = $totalAmt[1]; + $ShowPaise='1'; + } + else{ + $point=0; + $ShowPaise='0'; + } + + + $hundred = null; + $digits_1 = strlen($no); + + $i = 0; + $str = array(); + $words = array('0' => '', '1' => 'One', '2' => 'Two', + '3' => 'Three', '4' => 'Four', '5' => 'Five', '6' => 'Six', + '7' => 'Seven', '8' => 'Eight', '9' => 'Nine', + '10' => 'Ten', '11' => 'Eleven', '12' => 'Twelve', + '13' => 'Thirteen', '14' => 'Fourteen', + '15' => 'Fifteen', '16' => 'Sixteen', '17' => 'Seventeen', + '18' => 'Eighteen', '19' =>'Nineteen', '20' => 'Twenty', + '30' => 'Thirty', '40' => 'Forty', '50' => 'Fifty', + '60' => 'Sixty', '70' => 'Seventy', + '80' => 'Eighty', '90' => 'Ninety'); + $digits = array('', 'Hundred', 'Thousand', 'Lakh', 'Crore'); + while ($i < $digits_1) { + $divider = ($i == 2) ? 10 : 100; + $number = floor($no % $divider); + $no = floor($no / $divider); + $i += ($divider == 10) ? 1 : 2; + if ($number) { + $plural = (($counter = count($str)) && $number > 9) ? 's' : null; + $hundred = ($counter == 1 && $str[0]) ? ' and ' : null; + $str [] = ($number < 21) ? $words[$number] . + " " . $digits[$counter] . $plural . " " . $hundred + : + $words[floor($number / 10) * 10] + . " " . $words[$number % 10] . " " + . $digits[$counter] . $plural . " " . $hundred; + } else $str[] = null; + } + $str = array_reverse($str); + $result = implode('', $str); + + $points = ($point) ? + " " . $words[$point / 10] . " " . + $words[$point = $point % 10] : ''; + +if($ShowPaise=='0'){ + +$amountInWords = "Rupees " . $result." Only"; +} +else{ + +$amountInWords = "Rupees " . $result ." Paise ". $points." Only"; +} + + + return $amountInWords; + } + } ?> \ No newline at end of file diff --git a/application/views/addemppaydate.php b/application/views/addemppaydate.php index 04b1a21c..e82facb4 100755 --- a/application/views/addemppaydate.php +++ b/application/views/addemppaydate.php @@ -85,7 +85,8 @@ $("#due_started").datepicker({ } } //$data=array('name'=>'EmpID','value'=>$Employee,'id'=>'EmpID','class' => 'form-control'); - echo form_dropdown('EmpID', $Employee,set_value('EmpID'),'class="form-control",id="xxx"'); + $js = array('id'=> 'emp'); + echo form_dropdown('EmpID', $Employee,set_value('EmpID'),'class="form-control"',$js); //echo form_dropdown($data); ?> @@ -157,11 +158,11 @@ $("#due_started").datepicker({
| Pay Data ID | +Employee ID | Employee Name | -Total Salary | -Basic Pay | -HRA Rate | -HRA Amount | -OT Rate | -Allowances | -PF Rate | -ESI Rate | -Food Allowances | -Is Active | +Total Salary in ₹ | +Basic Pay in ₹ | +HRA Rate in % | +HRA Amount in ₹ | +OT Rate in ₹ | +Allowances in ₹ | +PF Ratein % | +ESI Rate in % | +Food Allowances in ₹ | -Edit | + +Action | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Pay_Data_ID ?> | +EmpID ?> | FirstName ." ". $record->LastName?> | -TotalSalary,0,'',''); ?> | +TotalSalary; ?> | Basic_Pay ?> | HRA_Rate ?> | -HRA_Amount,0,'',''); ?> | +HRA_Amount; ?> | OT_Rate ?> | Allowances ?> | PF_Rate ?> | ESI_Rate ?> | Food_Allowances ?> | -is_Active ? 'Yes' : 'No'?> | + diff --git a/application/views/monthlyListing.php b/application/views/monthlyListing.php index a60cb82f..a1524ba9 100755 --- a/application/views/monthlyListing.php +++ b/application/views/monthlyListing.php @@ -51,12 +51,12 @@ speed:500Employee Id | Employee Name | LOP Days | -OT Hours Worked | -Loan Recovered | +OT Hours Worked in Hrs | +Loan Recovered in ₹ | -Incentives | -Other Deductions | -Edit | +Incentives in Rs | +Other Deductions in ₹ | +Action | FirstName ." ". $record->LastName ?> | LOP_Days ?> | OT_Hrs_Worked ?> | -Loan_Recovered ?> | +Loan_Recovered)){echo number_format($record->Loan_Recovered,2,'.','');}else {echo $record->Loan_Recovered;} ?> | Incentives ?> | Other_Deductions ?> | diff --git a/application/views/payslipgenerate.php b/application/views/payslipgenerate.php index 327479ef..08ec5504 100755 --- a/application/views/payslipgenerate.php +++ b/application/views/payslipgenerate.php @@ -84,17 +84,23 @@ $(function() { url:"payslip/callsp", success:function(result){ - + + $('form#PayslipGenerator').submit(); $('#content').loader('hide'); //alert("Procedure Called Sucessfully!"); } }); - //AJAX ENDED + // CALCULATE PAY AJAX ENDED }); + + + + alert(count + " Employees Salary Added Successfully!"); + } // else for select all not selected else{ @@ -106,7 +112,7 @@ $(function() { url:"payslip/callsp", success:function(result) { - + $('form#PayslipGenerator').submit(); $('#content').loader('hide'); alert("Employees Salary Added Successfully!"); @@ -196,10 +202,10 @@ $(function() { + |
- Survey No: 168/1C3,Pennalur Pet Road,Goonipalyam village, Uthukottai Taluk,Tiruvallur Dist, Chennai,Tamilnadu,Pin code : 602026. PaySlip for the month of Survey No: 168/1C3,Pennalur Pet Road,Goonipalyam village, Uthukottai Taluk,Tiruvallur Dist, Chennai,Tamilnadu,Pin code : 602026. PaySlip for the Month of |
| Total Amount In Words | -+ | ||||||||||||||||||||||||||
| This is a computer generated document. This document does not require signature. | |||||||||||||||||||||||||||