ATTENDANCE LOAN REPORT MODULES
This commit is contained in:
parent
95fa66f58c
commit
b4c0330d8a
@ -75,6 +75,9 @@ $route['monthlyListings/(:num)'] = "monthlypay/monthlyListing/$1";
|
||||
$route['emppayListings'] = 'emppaydate/emppayListing';
|
||||
$route['emppayListings/(:num)'] = 'emppaydate/emppayListing/$1';
|
||||
|
||||
$route['attendance'] = 'monthlypay/attendanceLoad';
|
||||
$route['publicholidays'] = 'monthlypay/loadPublicholidays';
|
||||
$route['loanreports'] = 'payslip/loadLoanReport';
|
||||
|
||||
|
||||
|
||||
|
||||
@ -109,12 +109,12 @@ 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);
|
||||
$Load_Issued_date=$Load_Issued_date=date('Y-m-d',strtotime($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);
|
||||
$Due_Started=$Due_Started=date('Y-m-d',strtotime($Due_Started));
|
||||
}else{$Due_Started=null;}
|
||||
|
||||
|
||||
@ -129,22 +129,35 @@ 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,'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);
|
||||
$emppay = array('EmpID'=>$EmpID,'TotalSalary'=>$Total_Salary,'Basic_Pay'=>$Basic_Pay,'HRA_Rate'=>$HRA_Rate,'HRA_Amount'=>$HRA_Amount,'Allowances'=>$Allowances, 'PF_Rate'=>$PF_Rate, 'ESI_Rate'=>$ESI_Rate ,'Food_Allowances'=>$Food_Allowances,'Created_By'=>$CreateBy);
|
||||
$loandetails = array('EmpID'=>$EmpID,'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'=>1,'Created_By'=>$CreateBy);
|
||||
|
||||
|
||||
$result = $this->emppaydate_model->addNewemppay($emppay);
|
||||
|
||||
if($Loan_Amount != 0)
|
||||
{
|
||||
$result2 = $this->emppaydate_model->addLoanInfo($loandetails,'add');
|
||||
if($result2 > 0)
|
||||
{
|
||||
echo "<script>alert('Loan Information Saved successfully!');</script>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<script>alert('Something Went Wrong..! Loan Information Not Saved. Try later..!');</script>";
|
||||
}
|
||||
}
|
||||
if($result > 0)
|
||||
{
|
||||
|
||||
|
||||
redirect('emppaydate/emppayListing','refresh');
|
||||
echo "<script>alert('Employee Pay List Created successfully!');</script>";
|
||||
redirect('emppaydate/emppayListing','refresh');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
redirect('emppaydate/emppayListing','refresh');
|
||||
echo "<script>alert('Employee Pay List Not Created!');</script>";
|
||||
redirect('emppaydate/emppayListing','refresh');
|
||||
|
||||
}
|
||||
|
||||
//}
|
||||
@ -214,16 +227,19 @@ class emppaydate extends BaseController
|
||||
$Allowances=$this->input->post('Allowances');
|
||||
$PF_Rate=$this->input->post('PF_Rate');
|
||||
$ESI_Rate=$this->input->post('ESI_Rate');
|
||||
$loan_ID =$this->input->post('loanid');
|
||||
$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);}
|
||||
if(!empty($Load_Issued_date)){$Load_Issued_date=date('Y-m-d',strtotime($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);}
|
||||
if(!empty($Due_Started)){$Due_Started=date('Y-m-d',strtotime($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');
|
||||
@ -237,10 +253,38 @@ class emppaydate extends BaseController
|
||||
|
||||
|
||||
|
||||
$emppaydatas = array('Pay_Data_ID'=>$Pay_Data_ID,'EmpID'=>$EmpID,'TotalSalary'=>$TotalSalary,'Basic_Pay'=>$Basic_Pay,'HRA_Rate'=>$HRA_Rate,'HRA_Amount'=>$HRA_Amount,'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);
|
||||
$emppay = array('Pay_Data_ID'=>$Pay_Data_ID,'EmpID'=>$EmpID,'TotalSalary'=>$TotalSalary,'Basic_Pay'=>$Basic_Pay,'HRA_Rate'=>$HRA_Rate,'HRA_Amount'=>$HRA_Amount,'Allowances'=>$Allowances, 'PF_Rate'=>$PF_Rate, 'ESI_Rate'=>$ESI_Rate ,'Food_Allowances'=>$Food_Allowances,'Last_Mod_By'=>$Last_Mod_By);
|
||||
$loandetails = array('Loan_ID'=>$loan_ID,'EmpID'=>$EmpID,'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'=>1,'Last_Mod_By'=>$Last_Mod_By);
|
||||
|
||||
|
||||
$result = $this->emppaydate_model->editemppay($emppaydatas);
|
||||
if($Loan_Amount != 0 and $loan_ID !='')
|
||||
{
|
||||
$result2 = $this->emppaydate_model->addLoanInfo($loandetails,'update');
|
||||
if($result2 > 0)
|
||||
{
|
||||
echo "<script>alert('Loan Information Saved successfully!');</script>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<script>alert('Something Went Wrong..! Loan Information Not Saved. Try later..!');</script>";
|
||||
}
|
||||
}
|
||||
else if($Loan_Amount != 0 and $loan_ID == '')
|
||||
{
|
||||
$loandetails = array('EmpID'=>$EmpID,'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'=>1,'Created_By'=>$Last_Mod_By);
|
||||
$result2 = $this->emppaydate_model->addLoanInfo($loandetails,'add');
|
||||
if($result2 > 0)
|
||||
{
|
||||
echo "<script>alert('Loan Information Saved successfully!');</script>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<script>alert('Something Went Wrong..! Loan Information Not Saved. Try later..!');</script>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$result = $this->emppaydate_model->editemppay($emppay);
|
||||
|
||||
|
||||
if($result == true)
|
||||
@ -260,6 +304,7 @@ class emppaydate extends BaseController
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function deleteEmpPay()
|
||||
@ -287,14 +332,7 @@ class emppaydate extends BaseController
|
||||
|
||||
$this->loadViews("404", $this->global, NULL, NULL);
|
||||
}
|
||||
function getDateformat2($Val)
|
||||
{
|
||||
$date = new DateTime($Val,new DateTimeZone('Asia/Kolkata'));
|
||||
|
||||
$retDate = $date->format('d-m-Y');
|
||||
|
||||
return $retDate;
|
||||
}
|
||||
|
||||
|
||||
function getDateformat($Val)
|
||||
{
|
||||
|
||||
@ -34,10 +34,161 @@ class monthlypay extends BaseController
|
||||
$this->loadviews('monthlyListing',$this->global);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to load the monthly list
|
||||
*/
|
||||
function loadPublicholidays()
|
||||
{
|
||||
|
||||
|
||||
$data['days'] = $this-> monthlypay_model->getPublicHoldays();
|
||||
$this->global['pageTitle'] = 'Siddharth : Public Holidays';
|
||||
|
||||
$this->loadviews('publicholidays',$this->global,$data,NULL);
|
||||
|
||||
}
|
||||
function deletePublicHoliday()
|
||||
{
|
||||
$d = $this->input->post('param1');
|
||||
$res = $this->monthlypay_model->deleteHoliday($d);
|
||||
if($res == 1){
|
||||
echo "Deleted Successfully..!";
|
||||
}else{echo "Something Wrong, Try Later...!";}
|
||||
}
|
||||
|
||||
function savePublicHolidays()
|
||||
{
|
||||
$jsondata = $this->input->post('param1');
|
||||
$phpdata = json_decode($jsondata);
|
||||
$total =0;
|
||||
|
||||
foreach($phpdata as $d)
|
||||
{
|
||||
|
||||
|
||||
$hname = $d->Holiday_Name;
|
||||
$hdate = $d->Date;
|
||||
|
||||
$tostore = array('H_Name'=>$hname,'H_Date'=>$hdate);
|
||||
$isExist = $this->monthlypay_model->checkHoliday($hdate);
|
||||
|
||||
if($isExist[0]['count'] == 0)
|
||||
{
|
||||
$count = $this->monthlypay_model->saveHolidays($tostore,'i');
|
||||
$total = $total + $count;
|
||||
}
|
||||
else
|
||||
{
|
||||
$count = $this->monthlypay_model->saveHolidays($tostore,'u');
|
||||
$total = $total + $count;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo $total . "-Holiday(s) Saved Successfully..!";
|
||||
}
|
||||
|
||||
|
||||
function attendanceLoad()
|
||||
{
|
||||
$montharray = array(01=>"Jan",02=>"Feb",03=>"Mar",04=>"Apr",05=>"May",06=>"Jun",07=>"Jul",08=>"Aug",09=>"Sep",10=>"Oct",11=>"Nov",12=>"Dec");
|
||||
|
||||
if($this->input->post('month'))
|
||||
{
|
||||
//echo "post";
|
||||
$current = $this->input->post('month');
|
||||
$month = substr($current,0,3);
|
||||
$year = substr($current,4);
|
||||
$month=array_search($month,$montharray);
|
||||
$current = $year."-".$month.'-01';
|
||||
//echo $current;
|
||||
}
|
||||
if(empty($current))
|
||||
{
|
||||
// echo "fresh";
|
||||
$current = date("Y-m");
|
||||
$year = date("Y");
|
||||
$month = date("m");
|
||||
$current = $current."-01";
|
||||
}
|
||||
|
||||
$monthdays =cal_days_in_month(CAL_GREGORIAN,$month,$year);
|
||||
$begin = new DateTime($year.'-'.$month.'-01');
|
||||
$end = new DateTime($year.'-'.$month.'-'.$monthdays);
|
||||
$sundayarray =array();
|
||||
while ($begin <= $end)
|
||||
{
|
||||
if($begin->format("D") == "Sun")
|
||||
{
|
||||
array_push($sundayarray,$begin->format("d"));
|
||||
}
|
||||
$begin->modify('+1 day');
|
||||
}
|
||||
$noofsundays = count($sundayarray);
|
||||
|
||||
$publicholidaysarray = $this-> monthlypay_model->getPublicHoldays($current);
|
||||
$string ="attendance";
|
||||
$data['noofsundays']=$noofsundays;
|
||||
$data['noofpublicholidays']=count($publicholidaysarray);
|
||||
$data['publicholidaysarray']=$publicholidaysarray;
|
||||
$data['sundayarray']=$sundayarray;
|
||||
$data['monthdays']=$monthdays;
|
||||
$data['datefordropdown'] = $current;
|
||||
$data['attendance'] = $this-> monthlypay_model->monthlyAttendance($current);
|
||||
$data['emppay'] = $this-> monthlypay_model->getEmpPayDetails($current,$string);
|
||||
$this->global['pageTitle'] = 'Siddharth : Monthly Attendance';
|
||||
$this->loadViews("attendance", $this->global, $data, NULL);
|
||||
}
|
||||
|
||||
function saveAttendance()
|
||||
{
|
||||
|
||||
$total = 0;
|
||||
$jsondata = $this->input->post('param1');
|
||||
$phpdata = json_decode($jsondata,true);
|
||||
$date = $this->input->post('param2');
|
||||
$NoofDays = $this->input->post('param3');
|
||||
$Month_Year = date('Y-m-d',strtotime($date));
|
||||
$CreateBy = $this->session->userdata ( 'userId' );
|
||||
// echo 'from COn' . $date;
|
||||
// print_r($phpdata);die();[Paid Leave
|
||||
// echo count($phpdata);
|
||||
//echo $NoofDays.'sdjksjh';
|
||||
$EmpID ='temp';
|
||||
foreach($phpdata as $data)
|
||||
{
|
||||
|
||||
|
||||
$EmpID = $data['Employee ID'];
|
||||
$W1H = $data['1W'];$W1OT = $data['1OT']; $W2H = $data['2W'];$W2OT = $data['2OT'];$W3H = $data['3W'];$W3OT = $data['3OT'];$W4H = $data['4W'];$W4OT = $data['4OT'];
|
||||
$W5H = $data['5W'];$W5OT = $data['5OT']; $W6H = $data['6W'];$W6OT = $data['6OT']; $W7H = $data['7W'];$W7OT = $data['7OT']; $W8H = $data['8W'];$W8OT = $data['8OT'];
|
||||
$W9H = $data['9W'];$W9OT = $data['9OT']; $W10H = $data['10W'];$W10OT = $data['10OT']; $W11H = $data['11W'];$W11OT = $data['11OT']; $W12H = $data['12W'];$W12OT = $data['12OT'];
|
||||
$W13H = $data['13W'];$W13OT = $data['13OT']; $W14H = $data['14W'];$W14OT = $data['14OT']; $W15H = $data['15W'];$W15OT = $data['15OT']; $W16H = $data['16W'];$W16OT = $data['16OT'];
|
||||
$W17H = $data['17W'];$W17OT = $data['17OT']; $W18H = $data['18W'];$W18OT = $data['18OT']; $W19H = $data['19W'];$W19OT = $data['19OT']; $W20H = $data['20W'];$W20OT = $data['20OT'];
|
||||
$W21H = $data['21W'];$W21OT = $data['21OT']; $W22H = $data['22W'];$W22OT = $data['22OT']; $W23H = $data['23W'];$W23OT = $data['23OT']; $W24H = $data['24W'];$W24OT = $data['24OT'];
|
||||
$W25H = $data['25W'];$W25OT = $data['25OT']; $W26H = $data['26W'];$W26OT = $data['26OT']; $W27H = $data['27W'];$W27OT = $data['27OT']; $W28H = $data['28W'];$W28OT = $data['28OT'];
|
||||
if(!empty($data['29W'])){$W29H = $data['29W'];}else{$W29H=null;} if(!empty($data['29OT'])){$W29OT = $data['29OT'];}else{$W29OT=null;} if(!empty($data['30W'])){$W30H = $data['30W'];}else{$W30H=null;}
|
||||
if(!empty($data['30OT'])){$W30OT = $data['30OT'];}else{$W30OT=null;} if(!empty($data['31W'])){$W31H = $data['31W'];}else{$W31H=null;}if(!empty($data['31OT'])){$W31OT = $data['31OT'];}else{$W31OT=null;}
|
||||
$totalworkinghrs = $data['Total Hrs'];$totalothrs = $data['OT Hrs'];$paidleave = $data['Paid Leave'];$daysworked = $data['Days Worked'];$absent = $data['Absent'];
|
||||
|
||||
$monthattendance = array('Month_Year'=>$Month_Year,'NoofDays'=>$NoofDays,'EmpID'=>$EmpID,'WH1'=>$W1H,'OT1'=>$W1OT,'WH2'=>$W2H,'OT2'=>$W2OT,'WH3'=>$W3H,'OT3'=>$W3OT,
|
||||
'WH4'=>$W4H,'OT4'=>$W4OT,'WH5'=>$W5H,'OT5'=>$W5OT,'WH6'=>$W6H,'OT6'=>$W6OT,'WH7'=>$W7H,'OT7'=>$W7OT,'WH8'=>$W8H,'OT8'=>$W8OT,'WH9'=>$W9H,'OT9'=>$W9OT,'WH10'=>$W10H,'OT10'=>$W10OT,
|
||||
'WH11'=>$W11H,'OT11'=>$W11OT,'WH12'=>$W12H,'OT12'=>$W12OT,'WH13'=>$W13H,'OT13'=>$W13OT,'WH14'=>$W14H,'OT14'=>$W14OT,'WH15'=>$W15H,'OT15'=>$W15OT,'WH16'=>$W16H,'OT16'=>$W16OT,
|
||||
'WH17'=>$W17H,'OT17'=>$W17OT,'WH18'=>$W18H,'OT18'=>$W18OT,'WH19'=>$W19H,'OT19'=>$W19OT,'WH20'=>$W20H,'OT20'=>$W20OT,'WH21'=>$W21H,'OT21'=>$W21OT,'WH22'=>$W22H,'OT22'=>$W22OT,
|
||||
'WH23'=>$W23H,'OT23'=>$W23OT,'WH24'=>$W24H,'OT24'=>$W24OT,'WH25'=>$W25H,'OT25'=>$W25OT,'WH26'=>$W26H,'OT26'=>$W26OT,'WH27'=>$W27H,'OT27'=>$W27OT,'WH28'=>$W28H,'OT28'=>$W28OT,
|
||||
'WH29'=>$W29H,'OT29'=>$W29OT,'WH30'=>$W30H,'OT30'=>$W30OT,'WH31'=>$W31H,'OT31'=>$W31OT,'Total_WHrs'=>$totalworkinghrs,'Total_OTHrs'=>$totalothrs,'Paid_Leave'=>$paidleave,
|
||||
'Days_Worked'=>$daysworked,'Absent'=>$absent,'Created_by'=>$CreateBy);
|
||||
|
||||
|
||||
$res = $this->monthlypay_model->saveAttendance($monthattendance,$Month_Year,$EmpID);
|
||||
echo $res;
|
||||
$total = $total + $res;
|
||||
// die();
|
||||
}
|
||||
echo $total . "-Employee(s) Attendance saved Successfully..!";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
function monthlyListing()
|
||||
{
|
||||
|
||||
|
||||
@ -228,18 +228,7 @@ function phpAlert($msg) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if($this->input->post('ESI_Report'))
|
||||
if($this->input->post('ESI_Report'))
|
||||
{
|
||||
$data['PFESI'] = $this->payroll_model->getReportforPFESI($payon);
|
||||
//print_r($data['PFESI']);die();
|
||||
@ -388,8 +377,100 @@ function phpAlert($msg) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function loadLoanReport()
|
||||
{
|
||||
|
||||
$currentyear = '';
|
||||
$nxtyear = '';
|
||||
|
||||
$eid = $this->uri->segment(3);
|
||||
$fyr = $this->uri->segment(4);
|
||||
if(!empty($eid) and !empty($fyr) and !is_numeric($eid) and !($fyr =='Overall'))
|
||||
{
|
||||
//echo "EMPLOYEE WITH FINYEAR";
|
||||
$currentyear = substr($fyr,0,4);
|
||||
$nxtyear = substr($fyr,5,4);
|
||||
$data['fyear'] = $currentyear.'-'.$nxtyear;
|
||||
$data['loanrecords'] = $this->payroll_model->getLoanReportforEmp($eid,$currentyear,$nxtyear,'emp');
|
||||
$data['selsource'] = $eid;
|
||||
|
||||
}
|
||||
else if(!empty($eid) and !empty($fyr) and $fyr=='Overall')
|
||||
{
|
||||
// echo "EMPLOYEE WITH OVERALL";
|
||||
$data['fyear'] = "Overall";
|
||||
$currentyear ='';
|
||||
$nxtyear = '';
|
||||
$data['loanrecords'] = $this->payroll_model->getLoanReportforEmp($eid,$currentyear,$nxtyear,'emp');
|
||||
$data['selsource'] = $eid;
|
||||
}
|
||||
else if(is_numeric($eid))
|
||||
{
|
||||
//echo "LOAN HISTORY";
|
||||
$currentyear ='';
|
||||
$nxtyear = '';
|
||||
$data['selsource'] = $eid;
|
||||
$data['fyear'] = $currentyear.'-'.$nxtyear;
|
||||
$data['childdata'] = $this->payroll_model->getLoanReportforEmp($eid,$currentyear="",$nxtyear="",'history');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if(empty($this->input->post('finyear')))
|
||||
{
|
||||
echo "DEFAULT LOAD";
|
||||
$year = date("Y");
|
||||
$month = date("m");
|
||||
$currentyear = '';
|
||||
$nxtyear = '';
|
||||
$source = $this->input->post('source');
|
||||
$data['selsource'] = 'Company';
|
||||
|
||||
// if($month >= 4)
|
||||
// {
|
||||
// $currentyear = $year;
|
||||
// $nxtyear = ($year+1);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $currentyear =($year-1);
|
||||
// $nxtyear = $year;
|
||||
// }
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!empty($this->input->post('finyear')))
|
||||
{
|
||||
|
||||
echo "FIN YEAR WITH SOURCE";
|
||||
$source = $this->input->post('source');
|
||||
$data['selsource'] =$source;
|
||||
$finyear = $this->input->post('finyear');
|
||||
$currentyear = substr($finyear,0,4);
|
||||
$nxtyear = substr($finyear,5,4);
|
||||
$data['fyear'] = $currentyear.'-'.$nxtyear;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo $currentyear.'-'.$nxtyear;
|
||||
// echo "Company";
|
||||
$data['loanrecords'] = $this->payroll_model->getLoanReport($source,$currentyear,$nxtyear);
|
||||
// print_r($data['loanrecords']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
$data['loanemployees'] = $this->payroll_model->getEmpDetailsforLoan();
|
||||
$this->global['pageTitle'] = 'Siddharth : Loan Reports';
|
||||
$this->loadViews("loanreports", $this->global,$data, NULL);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This function used to load the first screen of the user
|
||||
@ -407,8 +488,9 @@ function phpAlert($msg) {
|
||||
{
|
||||
$current = date("m-Y");
|
||||
$data['month'] = $this-> monthlypay_model->monthlyListing($current);
|
||||
$data['fresh'] = $this-> monthlypay_model->getEmpPayDetails($current);
|
||||
|
||||
// $data['fresh'] = $this-> monthlypay_model->getEmpPayDetails($current);
|
||||
|
||||
$data['fresh'] = $this-> monthlypay_model->getEmpPayDetailsforMonthInputs($current);
|
||||
$this->global['pageTitle'] = 'Siddharth : Payroll Monthly Inputs';
|
||||
$this->loadViews("monthlypayinputs", $this->global,$data,NULL);
|
||||
|
||||
@ -419,8 +501,9 @@ function phpAlert($msg) {
|
||||
{
|
||||
|
||||
$current = $this->input->post('param1');
|
||||
// echo $current;die();
|
||||
$month = $this-> monthlypay_model->monthlyListing($current);
|
||||
$fresh = $this-> monthlypay_model->getEmpPayDetails($current);
|
||||
$fresh = $this-> monthlypay_model->getEmpPayDetailsforMonthInputs($current);
|
||||
$data = json_encode(array_merge($month,$fresh));
|
||||
echo $data;
|
||||
}
|
||||
@ -467,6 +550,7 @@ function phpAlert($msg) {
|
||||
|
||||
$EmpID = $j['Employee Id'];
|
||||
$Name = $j['Employee Name'];
|
||||
$DaysWorked = $j['Days Worked'];
|
||||
$LOP_Days = $j['LOP Days'];
|
||||
$Paid_leave = $j['Paid Leave'];
|
||||
$OT_Hrs_Worked = $j['OT Hours Worked in Hrs'];
|
||||
@ -474,7 +558,14 @@ function phpAlert($msg) {
|
||||
$Incentives = $j['Incentives in ₹'];
|
||||
$Other_Deductions = $j['Other Deductions in ₹'];
|
||||
$Created_By = $this->session->userdata ( 'userId' );
|
||||
if(!is_numeric($LOP_Days) || ($LOP_Days > 31) || (strlen((string)$LOP_Days)) > 5 )
|
||||
|
||||
if(!is_numeric($DaysWorked) || ($DaysWorked > 31) || (strlen((string)$DaysWorked)) > 5 )
|
||||
{
|
||||
//echo $EmpID . "-LOP_Days Invalid Data!";
|
||||
$ErrorFlag++;
|
||||
}
|
||||
|
||||
if(!is_numeric($LOP_Days) || ($LOP_Days > 31) || (strlen((string)$LOP_Days)) > 5 )
|
||||
{
|
||||
//echo $EmpID . "-LOP_Days Invalid Data!";
|
||||
$ErrorFlag++;
|
||||
@ -555,6 +646,7 @@ function phpAlert($msg) {
|
||||
{
|
||||
$EmpID = $j['Employee Id'];
|
||||
$Name = $j['Employee Name'];
|
||||
$DaysWorked = $j['Days Worked'];
|
||||
$LOP_Days = $j['LOP Days'];
|
||||
$Paid_leave = $j['Paid Leave'];
|
||||
$OT_Hrs_Worked = $j['OT Hours Worked in Hrs'];
|
||||
@ -567,7 +659,7 @@ function phpAlert($msg) {
|
||||
$Other_Deductions = $j['Other Deductions in ₹'];
|
||||
$Created_By = $this->session->userdata ( 'userId' );
|
||||
|
||||
$monthlypaydata = array('Month_Year'=>$month,'EmpID'=>$EmpID,'LOP_Days'=>$LOP_Days,'Paid_leave'=>$Paid_leave,'OT_Hrs_Worked'=>$OT_Hrs_Worked,'Loan_Recovered'=>$Loan_Recovered,'Incentives'=>$Incentives,'Other_Deductions'=>$Other_Deductions,'Created_By'=>$Created_By);
|
||||
$monthlypaydata = array('Month_Year'=>$month,'EmpID'=>$EmpID,'Days_worked'=>$DaysWorked,'LOP_Days'=>$LOP_Days,'Paid_leave'=>$Paid_leave,'OT_Hrs_Worked'=>$OT_Hrs_Worked,'Loan_Recovered'=>$Loan_Recovered,'Incentives'=>$Incentives,'Other_Deductions'=>$Other_Deductions,'Created_By'=>$Created_By);
|
||||
$result = $this->monthlypay_model->saveMonthlyData_model($monthlypaydata);
|
||||
$total = $total + $result;
|
||||
}
|
||||
@ -781,7 +873,9 @@ function getEmployee()
|
||||
|
||||
$remarks = 'Manual Edit By' . $userid ." On " . date('Y-m-d');
|
||||
$paydetails = array('Key'=>$paykey,'EmpID'=>$EmpID,'PayOn'=>$PayOn,'Other_allowances'=>$otherallowence,'OtherDeductions'=>$otherdeductions,'Incentive'=>$incentive,'LessAdvance'=>$netpay,'TotalSalary'=>$netpay,'SalaryAsPerPF'=>$SalaryAsPerPF,'Totaldeduction'=>$Totaldeduction,'remarks'=>$remarks);
|
||||
$monthdetails = array('Month_Year'=>$PayOn,'Other_Deductions'=>$otherdeductions,'Incentives'=>$incentive);
|
||||
$result = $this->payroll_model->updateEmpPayslip($paydetails);
|
||||
$res = $this->monthlypay_model->editmonth($monthdetails,$EmpID);
|
||||
echo $result;
|
||||
}
|
||||
|
||||
@ -931,11 +1025,12 @@ function getEmployee()
|
||||
|
||||
|
||||
$EmpId = $sheet->getCell('A'.$x)->getValue();
|
||||
$EmpId=strtoupper($EmpId);
|
||||
$LOPDays = $sheet->getCell('C'.$x)->getValue();
|
||||
$Paid_leave =$sheet->getCell('D'.$x)->getValue();
|
||||
$OTHoursWorked =$sheet->getCell('E'.$x)->getValue();
|
||||
$loanRecovered=$sheet->getCell('F'.$x)->getValue();
|
||||
$EmpId=strtoupper($EmpId);
|
||||
$Days_worked = $sheet->getCell('C'.$x)->getValue();
|
||||
$LOPDays = $sheet->getCell('D'.$x)->getValue();
|
||||
$Paid_leave =$sheet->getCell('E'.$x)->getValue();
|
||||
$OTHoursWorked =$sheet->getCell('F'.$x)->getValue();
|
||||
$loanRecovered=$sheet->getCell('G'.$x)->getValue();
|
||||
if(is_string($loanRecovered))
|
||||
{
|
||||
$loanRecovered = strtoupper($loanRecovered);
|
||||
@ -951,7 +1046,7 @@ function getEmployee()
|
||||
if($flag!=0 && $flag2!=0){
|
||||
|
||||
|
||||
$FileData = array('Month_Year'=>$PayOn,'EmpID'=>$EmpId,'LOP_Days'=>$LOPDays,'Paid_leave'=>$Paid_leave,'OT_Hrs_Worked'=>$OTHoursWorked,'Loan_Recovered'=>$loanRecovered,'Incentives'=>$Incentive,'Other_Deductions'=>$Other_Deductions,'Created_By'=>$createdby,'Created_Time'=>date("Y-m-d h:i:sa"));
|
||||
$FileData = array('Month_Year'=>$PayOn,'EmpID'=>$EmpId,'Days_worked'=>$Days_worked,'LOP_Days'=>$LOPDays,'Paid_leave'=>$Paid_leave,'OT_Hrs_Worked'=>$OTHoursWorked,'Loan_Recovered'=>$loanRecovered,'Incentives'=>$Incentive,'Other_Deductions'=>$Other_Deductions,'Created_By'=>$createdby,'Created_Time'=>date("Y-m-d h:i:sa"));
|
||||
$result = $this->payroll_model->UploadFileData2($FileData);
|
||||
$success++;
|
||||
}
|
||||
|
||||
@ -47,17 +47,31 @@ class emppaydate_model extends CI_Model
|
||||
|
||||
return $emppay;
|
||||
}
|
||||
|
||||
function addLoanInfo($dataarray,$string)
|
||||
{
|
||||
if($string == 'add'){
|
||||
$this->db->insert('T_Loan_Master', $dataarray);
|
||||
$loanid = $this->db->affected_rows();
|
||||
return $loanid;
|
||||
}
|
||||
else if($string == 'update')
|
||||
{
|
||||
$loanid = $dataarray['Loan_ID'];
|
||||
$this->db->where('Loan_ID',$loanid);
|
||||
$this->db->update('T_Loan_Master', $dataarray);
|
||||
$loanid = $this->db->affected_rows();
|
||||
return $loanid;
|
||||
}
|
||||
}
|
||||
function getUserInfo($paydataid)
|
||||
{
|
||||
$this->db->select('T_Emp_Pay_Data.*,T_Employee_Details.FirstName,T_Employee_Details.LastName');
|
||||
$this->db->from('T_Emp_Pay_Data');
|
||||
$this->db->join('T_Employee_Details','T_Emp_Pay_Data.EmpID=T_Employee_Details.EmpID');
|
||||
//$this->db->where('isDeleted', 0);
|
||||
//$this->db->where('roleId !=', 1);
|
||||
$this->db->where('T_Emp_Pay_Data.Pay_Data_ID', $paydataid);
|
||||
$query = $this->db->get();
|
||||
//print_r($query->result());
|
||||
//die();
|
||||
$sql = 'select T_Emp_Pay_Data.Pay_Data_ID,T_Emp_Pay_Data.EmpID as PAYEMPID,T_Emp_Pay_Data.Basic_Pay,T_Emp_Pay_Data.HRA_Rate,T_Emp_Pay_Data.Allowances,T_Emp_Pay_Data.Food_Allowances,T_Emp_Pay_Data.PF_Rate,T_Emp_Pay_Data.ESI_Rate,T_Emp_Pay_Data.HRA_Amount,T_Emp_Pay_Data.TotalSalary,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Loan_Master.*from T_Emp_Pay_Data
|
||||
join T_Employee_Details on T_Emp_Pay_Data.EmpID=T_Employee_Details.EmpID
|
||||
left join T_Loan_Master on T_Emp_Pay_Data.EmpID=T_Loan_Master.EmpID and T_Loan_Master.is_Active = 1
|
||||
where T_Emp_Pay_Data.Pay_Data_ID = ?;';
|
||||
$query = $this->db->query($sql,array($paydataid));
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
|
||||
@ -12,26 +12,29 @@ class monthlypay_model extends CI_Model
|
||||
*/
|
||||
function monthlyListing($current="")
|
||||
{
|
||||
|
||||
$this->db->select('T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName');
|
||||
//echo $current;
|
||||
$this->db->select('T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Payroll.Key');
|
||||
$this->db->from('T_Monthly_Pay_Inputs');
|
||||
$this->db->join('T_Employee_Details','T_Monthly_Pay_Inputs.EmpID=T_Employee_Details.EmpID');
|
||||
$this->db->join('T_Payroll','T_Monthly_Pay_Inputs.EmpID=T_Payroll.EmpID','left');
|
||||
$this->db->where('Month_Year',$current);
|
||||
|
||||
$query = $this->db->get();
|
||||
|
||||
$query = $this->db->get();
|
||||
// print_r($query->result());
|
||||
$result = $query->result();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getEmpPayDetails($current="")
|
||||
function getEmpPayDetails($current="",$s="")
|
||||
{
|
||||
//echo $s;die();
|
||||
if($s == ''){
|
||||
|
||||
$current = '01-'.$current;
|
||||
//echo $current;
|
||||
$current = date_create($current);
|
||||
$current = date_format($current,"Y-m-d");
|
||||
//echo $current;
|
||||
}
|
||||
$this->db->select('T_Emp_Pay_Data.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.DateofJoining');
|
||||
$this->db->from('T_Emp_Pay_Data');
|
||||
$this->db->join('T_Employee_Details ','T_Emp_Pay_Data.EmpID=T_Employee_Details.EmpID');
|
||||
@ -42,6 +45,93 @@ class monthlypay_model extends CI_Model
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getEmpPayDetailsforMonthInputs($current="")
|
||||
{
|
||||
|
||||
$current = '01-'.$current;
|
||||
//echo $current;
|
||||
$current = date_create($current);
|
||||
$current = date_format($current,'Y-m-d');
|
||||
$sql = "select T_Emp_Pay_Data.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.DateofJoining,T_Attendance.Days_Worked as Days_worked,T_Attendance.Absent as LOP_Days,T_Attendance.Paid_Leave as Paid_leave,T_Attendance.Total_OTHrs as OT_Hrs_Worked,T_Attendance.NoofDays from T_Emp_Pay_Data
|
||||
left join T_Employee_Details on T_Employee_Details.EmpID = T_Emp_Pay_Data.EmpID
|
||||
left join T_Attendance on T_Emp_Pay_Data.EmpID = T_Attendance.EmpID
|
||||
where T_Employee_Details.DateofJoining <= CURRENT_DATE
|
||||
and month(T_Attendance.Month_Year) = month(?)";
|
||||
|
||||
$query = $this->db->query($sql,array($current));
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function getPublicHoldays($current="")
|
||||
{
|
||||
if(!empty($current))
|
||||
{
|
||||
$sql = "select * from T_Public_Holidays where month(H_Date) = month(?) and year(H_Date) = year(?)";
|
||||
$query = $this->db->query($sql,array($current,$current));
|
||||
return $query->result();
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "select * from T_Public_Holidays where year(H_Date)=year(CURRENT_DATE) order by H_Date";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function checkHoliday($Date)
|
||||
{
|
||||
$Date = date('Y-m-d',strtotime($Date));
|
||||
//echo $Date;die();[
|
||||
|
||||
$sql="select count(*) as count from T_Public_Holidays where H_Date = ?";
|
||||
$query = $this->db->query($sql,array($Date));
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
function saveHolidays($data,$string)
|
||||
{
|
||||
//print_r($data);
|
||||
if($string == 'i')
|
||||
{
|
||||
$this->db->insert('T_Public_Holidays',$data);
|
||||
$i= $this->db->affected_rows();
|
||||
return $i;
|
||||
}
|
||||
else if($string == 'u')
|
||||
{
|
||||
$this->db->where('H_date',$data['H_Date']);
|
||||
$this->db->update('T_Public_Holidays',$data);
|
||||
$i = $this->db->affected_rows();
|
||||
return $i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function deleteHoliday($d)
|
||||
{
|
||||
//echo "from Model" . $d;
|
||||
$this->db->where('H_date',$d);
|
||||
$this->db->delete('T_Public_Holidays');
|
||||
return $this->db->affected_rows();
|
||||
}
|
||||
function monthlyAttendance($current="")
|
||||
{
|
||||
|
||||
$this->db->select('T_Attendance.*,T_Employee_Details.FirstName,T_Employee_Details.LastName');
|
||||
$this->db->from('T_Attendance');
|
||||
$this->db->join('T_Employee_Details','T_Attendance.EmpID=T_Employee_Details.EmpID');
|
||||
$this->db->where('Month_Year',$current);
|
||||
|
||||
$query = $this->db->get();
|
||||
|
||||
$result = $query->result();
|
||||
|
||||
return $result;
|
||||
}
|
||||
function saveMonthlyData_model($data)
|
||||
{
|
||||
|
||||
@ -80,6 +170,44 @@ class monthlypay_model extends CI_Model
|
||||
|
||||
}
|
||||
|
||||
function saveAttendance($monthattendance,$Month_Year,$EmpID)
|
||||
{
|
||||
$this->db->select('count(*) as c');
|
||||
$this->db->from('T_Attendance');
|
||||
$this->db->where('Month_Year',$Month_Year);
|
||||
$this->db->where('EmpID',$EmpID);
|
||||
$isExist = $this->db->get();
|
||||
$isExist = $isExist->result_array();
|
||||
$ans = $isExist[0]['c'];
|
||||
|
||||
if($ans == 0)
|
||||
{
|
||||
|
||||
//array_pop();
|
||||
$this->db->insert('T_Attendance',$monthattendance);
|
||||
return $this->db->affected_rows();
|
||||
//echo "INS";
|
||||
// if($this->db->affected_rows() > 0)
|
||||
// {
|
||||
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->where('Month_Year',$Month_Year);
|
||||
$this->db->where('EmpID',$EmpID);
|
||||
$this->db->update('T_Attendance',$monthattendance);
|
||||
//echo "UPDATE";
|
||||
return $this->db->affected_rows();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function addNewmonthlisting($m_list)
|
||||
{
|
||||
|
||||
@ -207,6 +207,7 @@ class Payroll_model extends CI_Model
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
|
||||
function getReportforPFESI($payon)
|
||||
{
|
||||
$this->db->select('Pay.EmployeeESI,Pay.PF,Pay.CompanyESI,Pay.CompanyPF,Pay.NoofDaysWorked,Pay.OTperHours,Emp.FirstName as FName ,Emp.LastName as Lname,Emp.PFNO,Emp.ESI');
|
||||
@ -218,6 +219,96 @@ class Payroll_model extends CI_Model
|
||||
|
||||
}
|
||||
|
||||
function getLoanReport($source='',$year1="",$year2="")
|
||||
{
|
||||
// echo "<br>---------------------------";
|
||||
// echo "<br>From Model-";
|
||||
// echo $source.'-'.$year1.'-'.$year2;
|
||||
|
||||
$this->db->distinct();
|
||||
$this->db->select('Pay.EmpID,Emp.FirstName as FName ,Emp.LastName as Lname,sum(Loan_Amount) as Loan_Amount,sum(Paid_Amount) as Paid_Amount');
|
||||
$this->db->from('T_Emp_Pay_Data Pay');
|
||||
$this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID');
|
||||
$this->db->join('T_Loan_Master loan', 'Pay.EmpID = loan.EmpID');
|
||||
|
||||
if($source != 'company'){
|
||||
$this->db->where('Pay.EmpID',$source);
|
||||
}
|
||||
|
||||
if($year1 != "" and $year2 != ""){
|
||||
$this->db->where('month(loan.Loan_Issued_Date)>=',4);
|
||||
$this->db->where('year(loan.Loan_Issued_Date)=',$year1);
|
||||
$this->db->or_where('month(loan.Loan_Issued_Date)<=',3);
|
||||
$this->db->where('year(loan.Loan_Issued_Date)=',$year2);
|
||||
}
|
||||
$this->db->group_by('Pay.EmpID');
|
||||
$this->db->order_by('Pay.EmpID','asc');
|
||||
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
//print_r($query->result());die();
|
||||
|
||||
}
|
||||
|
||||
function getEmpDetailsforLoan()
|
||||
{
|
||||
|
||||
$this->db->select('Pay.EmpID,Pay.FirstName as FName ,Pay.LastName as Lname');
|
||||
$this->db->from('T_Employee_Details Pay');
|
||||
$this->db->join('T_Loan_Master loan', 'Pay.EmpID = loan.EmpID');
|
||||
$this->db->order_by('Pay.EmpID','asc');
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
|
||||
function getLoanReportforEmp($eid='',$year1="",$year2="",$string="")
|
||||
{
|
||||
|
||||
|
||||
//$this->db->distinct();
|
||||
if($string == 'emp'){
|
||||
$this->db->select('Pay.EmpID,Emp.FirstName as FName ,Emp.LastName as Lname,loan.*');
|
||||
$this->db->from('T_Emp_Pay_Data Pay');
|
||||
$this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID');
|
||||
$this->db->join('T_Loan_Master loan', 'Pay.EmpID = loan.EmpID','left');
|
||||
// if($source != 'company'){
|
||||
$this->db->where('Pay.EmpID',$eid);
|
||||
//}
|
||||
if($year1 != "" and $year2 != ""){
|
||||
$this->db->where('month(loan.Loan_Issued_Date)>=',4);
|
||||
$this->db->where('year(loan.Loan_Issued_Date)=',$year1);
|
||||
$this->db->or_where('month(loan.Loan_Issued_Date)<=',3);
|
||||
$this->db->where('year(loan.Loan_Issued_Date)=',$year2);
|
||||
//$this->db->group_by('Pay.EmpID');
|
||||
}
|
||||
$this->db->order_by('loan.Loan_Issued_Date','asc');
|
||||
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
elseif($string == 'history')
|
||||
{
|
||||
|
||||
$this->db->select('T_Loan_Master.EmpID,Emp.FirstName,Emp.LastName,T_Loan_Master.Loan_Amount,T_Loan_Master.Loan_Issued_Date,T_Loan_History.*');
|
||||
$this->db->from('T_Loan_History');
|
||||
$this->db->join('T_Loan_Master','T_Loan_Master.Loan_ID=T_Loan_History.Loan_ID');
|
||||
$this->db->join('T_Employee_Details Emp', 'T_Loan_Master.EmpID = Emp.EmpID');
|
||||
$this->db->where('T_Loan_History.Loan_ID',$eid);
|
||||
$q = $this->db->get();
|
||||
// $this->db->order_by('Entry_Date','asc');
|
||||
// $this->db->where('Loan_ID',$eid);
|
||||
// $q = $this->db->get('T_Loan_History');
|
||||
//print_r($q->result());
|
||||
return $q->result();
|
||||
// print_r($q->result());
|
||||
// die();
|
||||
|
||||
|
||||
}
|
||||
//print_r($query->result());die();
|
||||
|
||||
}
|
||||
/* *//**
|
||||
* This function is used to get the PayOn details from T_Payroll_FileOTperHours
|
||||
* @return array $result : This is result of the query
|
||||
|
||||
721
application/views/attendance.php
Normal file
721
application/views/attendance.php
Normal file
@ -0,0 +1,721 @@
|
||||
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
|
||||
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
|
||||
<script src="<?php echo base_url()?>assets/js/jquery.CongelarFilaColumna.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
|
||||
|
||||
<?php
|
||||
// print_r($attendance);
|
||||
// echo "<br>";
|
||||
// echo count($attendance);
|
||||
// echo "<br>";
|
||||
// print_r($emppay);
|
||||
// echo "<br>";
|
||||
// echo count($emppay);
|
||||
//print_r($datefordropdown);
|
||||
//print_r($noofpublicholidays);print_r($publicholidaysarray);
|
||||
$datefordropdown = date_create($datefordropdown);
|
||||
$datefordropdown = date_format($datefordropdown,'M-Y');
|
||||
//echo $datefordropdown;
|
||||
$attendance = array_merge($attendance,$emppay);
|
||||
// echo count($attendance) ."<br>";
|
||||
// print_r($attendance);
|
||||
// echo "<br>------------------------------<br>";
|
||||
|
||||
?>
|
||||
<style type="text/css">
|
||||
.num {
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.fht-table,
|
||||
.fht-table thead,
|
||||
.fht-table tfoot,
|
||||
.fht-table tbody,
|
||||
.fht-table tr,
|
||||
.fht-table th,
|
||||
.fht-table td {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.fht-table td {
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.fht-table td:hover {
|
||||
background-color: #3c8dbc;
|
||||
color:#ffffff;
|
||||
}
|
||||
|
||||
.fht-table{
|
||||
border: 0 none;
|
||||
height: auto;
|
||||
width: auto;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
/*table-layout: fixed; Algoritmo de distribucion fijo */
|
||||
/*white-space:nowrap; Impide los saltos de línea automáticos */
|
||||
}
|
||||
|
||||
.fht-table th,.fht-table td {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fht-table-wrapper,
|
||||
.fht-table-wrapper .fht-thead,
|
||||
.fht-table-wrapper .fht-tfoot,
|
||||
.fht-table-wrapper .fht-fixed-column .fht-tbody,
|
||||
.fht-table-wrapper .fht-fixed-body .fht-tbody,
|
||||
.fht-table-wrapper .fht-tbody {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.fht-table-wrapper .fht-fixed-body .fht-tbody,
|
||||
.fht-table-wrapper .fht-tbody {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.fht-table-wrapper .fht-table .fht-cell {
|
||||
overflow: hidden;
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
.fht-table-wrapper .fht-fixed-column,
|
||||
.fht-table-wrapper .fht-fixed-body {
|
||||
top: 0;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.fht-table-wrapper .fht-fixed-column {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.fht-fixed-body .fht-thead table {
|
||||
margin-right: 20px;
|
||||
border: 0 none;
|
||||
}
|
||||
|
||||
/*For Examples*/
|
||||
|
||||
.ContenedorTabla {
|
||||
height: 500px;
|
||||
margin: 0 auto;
|
||||
overflow: auto;
|
||||
width: auto;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.header, .main {
|
||||
display: inline-block;
|
||||
height: auto;
|
||||
width: 100%;
|
||||
}
|
||||
.titulosHeader {
|
||||
border-bottom: 1px solid #e8bb25;
|
||||
height: auto;
|
||||
margin-bottom: 10px;
|
||||
padding-bottom: 8px;
|
||||
padding-top: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.celda_encabezado_general {
|
||||
background-color: #3c8dbc;
|
||||
border: 1px solid #ccc;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
padding: 2px 4px;
|
||||
text-align: center;
|
||||
}
|
||||
._Separador{
|
||||
background-color: #fff;
|
||||
height: 12px;
|
||||
border-left: 1px solid #ccc;
|
||||
border-right: 1px solid #ccc;
|
||||
width: 7px;
|
||||
}
|
||||
._Separador div{
|
||||
width: 4px;
|
||||
}
|
||||
.celda_normal {
|
||||
/*background-color: #fff;*/
|
||||
border: 1px solid #ccc;
|
||||
padding: 2px 4px;
|
||||
}
|
||||
|
||||
/*style excel*/
|
||||
.excel_cell{
|
||||
border: 1px solid #CCC;
|
||||
color: #222;
|
||||
text-align: center;
|
||||
font-size: 13px
|
||||
font-weight: normal;
|
||||
padding: 4px;
|
||||
white-space: pre-line;
|
||||
empty-cells: show;
|
||||
}
|
||||
._cell_header{
|
||||
background-color: #EEE;
|
||||
}
|
||||
._cell_Default{
|
||||
background-color: #FFF;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.excel_cell div{
|
||||
width: 30px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.modal
|
||||
{
|
||||
padding-right:30% ! important;
|
||||
}
|
||||
|
||||
</style>
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
<center>Employee Monthly Attendance View/Edit</center>
|
||||
</h1>
|
||||
</section>
|
||||
<section class="content">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<?php
|
||||
|
||||
$attributes = array('id' => 'atten');
|
||||
echo form_open('attendance', $attributes);
|
||||
$today = date('M-Y');
|
||||
$data = array('type' => 'text','name' => 'month','id' => 'month','value' => $datefordropdown,'class' => 'form-control select2');
|
||||
echo form_input($data);?>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<input type="submit" value="Change Month" class="btn btn-primary" onclick="changeMonth();" title='click here for load attendance for specified month'>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div><!-- /.box-header -->
|
||||
|
||||
|
||||
<div class="box-body">
|
||||
<?php
|
||||
|
||||
// $year =date('Y');
|
||||
// $month =date('m');
|
||||
// $day = date('d');
|
||||
|
||||
// $monthdays =cal_days_in_month(CAL_GREGORIAN,$month,$year);
|
||||
|
||||
|
||||
// $begin = new DateTime($year.'-'.$month.'-01');
|
||||
// $end = new DateTime($year.'-'.$month.'-'.$monthdays);
|
||||
|
||||
// $ind =array();
|
||||
|
||||
// while ($begin <= $end) // Loop will work begin to the end date
|
||||
// {
|
||||
// if($begin->format("D") == "Sun") //Check that the day is Sunday here
|
||||
// {
|
||||
|
||||
// array_push($ind,$begin->format("d"));
|
||||
// }
|
||||
|
||||
// $begin->modify('+1 day');
|
||||
// }
|
||||
// $noofsundays = count($ind);
|
||||
|
||||
$testarray=array();
|
||||
$finalarray = array();
|
||||
if(!empty($attendance))
|
||||
{
|
||||
|
||||
foreach($attendance as $record)
|
||||
{
|
||||
|
||||
//$index++;
|
||||
|
||||
if(in_array($record->EmpID,$testarray))
|
||||
{
|
||||
//$index--;
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
|
||||
array_push($testarray,$record->EmpID);
|
||||
array_push($finalarray,$record);
|
||||
}
|
||||
}
|
||||
}
|
||||
//print_r($testarray);echo count($testarray);
|
||||
//echo "<br>...........................<br>";
|
||||
//print_r($finalarray);echo count($finalarray);
|
||||
// $index = 0;
|
||||
// foreach($finalarray as $gg )
|
||||
// {
|
||||
// echo "<br>...........................<br>";
|
||||
// $index = $index +1;
|
||||
// echo "S.NO" . $index . "<br>";
|
||||
// echo "EmpID" . $gg->EmpID ."<br>";
|
||||
// //echo $key ."-".$value;
|
||||
|
||||
// for ($col =1; $col <= $monthdays;$col++){
|
||||
// $flag =0;
|
||||
// foreach($ind as $in)
|
||||
// {
|
||||
// if($in == $col)
|
||||
// {
|
||||
// $flag = 1;
|
||||
// }
|
||||
// }
|
||||
// $WH='WH'.$col;
|
||||
// $OT = 'OT'.$col;
|
||||
|
||||
|
||||
// if(!empty($gg->$WH)){echo "WORK" . $gg->$WH."--";}else{echo "WORK" . "0--";}
|
||||
|
||||
// if(!empty($gg->$OT)){echo "OT" . $gg->$OT. "--";}else{echo "OT" . "0--";}
|
||||
// }
|
||||
// // /// echo "$WH";
|
||||
// //print_r($gg);
|
||||
|
||||
// //break;
|
||||
|
||||
// }
|
||||
//die();
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<main class="main">
|
||||
<div class="ContenedorTabla">
|
||||
|
||||
<table id="attendance" class="fht-table">
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
|
||||
<th class="celda_encabezado_general" rowspan="2">S.NO</th>
|
||||
<th class="celda_encabezado_general" rowspan="2">Employee ID</th>
|
||||
<th class="celda_encabezado_general" rowspan="2">Employee Name</th>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
for ($col =1; $col <= $monthdays;$col++){
|
||||
|
||||
$flag =0;
|
||||
$flag2 = 0;
|
||||
foreach($sundayarray as $in) //For Find out Sundays($ind) from $monthdays array
|
||||
{
|
||||
if($in == $col)
|
||||
{
|
||||
$flag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($publicholidaysarray as $h) //For Find out public holidays from $monthdays array
|
||||
{
|
||||
|
||||
$temp = $h->H_Date;
|
||||
$temp = substr($temp,8);
|
||||
$title = '';
|
||||
if($temp == $col)
|
||||
{
|
||||
$flag2 = 1;
|
||||
//$title ="Public Holiday-" . str_replace(" ","_",$h->H_Name);
|
||||
$title = str_replace(" ","_",$h->H_Name);
|
||||
//echo $title;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<th <?php if($flag == 1){ ?> title = "Sunday" <?php }else if($flag2 == 1){ ?> title = <?php echo $title; }?> class="celda_encabezado_general"<?php if($flag == 1 or $flag2 == 1){echo "style='background: #f39c12 ;'";}?> ><?php if($flag == 1 or $flag2 == 1){echo "<font style='color:#ff0000;'>".$col . "W<font>";}else{echo $col."W";}?></th>
|
||||
<th <?php if($flag == 1){ ?> title = "Sunday" <?php } else if($flag2 == 1){ ?> title = <?php echo $title; }?> class="celda_encabezado_general" <?php if($flag == 1 or $flag2 == 1){echo "style='background: #f39c12 ;'";}?>><?php if($flag == 1 or $flag2 == 1){echo "<font style='color:#ff0000;'>".$col . "OT<font>";}else{echo $col."OT";}?></th>
|
||||
<?php
|
||||
$flag =0;
|
||||
$flag2 =0;
|
||||
}?>
|
||||
<th class="celda_encabezado_general" >Total Hrs</th>
|
||||
<th class="celda_encabezado_general" >OT Hrs</th>
|
||||
<th class="celda_encabezado_general" >Paid Leave</th>
|
||||
<th class="celda_encabezado_general" >Days Worked</th>
|
||||
<th class="celda_encabezado_general" >Absent</th>
|
||||
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $index = 0;
|
||||
$row=0;
|
||||
foreach($finalarray as $a){ $row++;$index++;?>
|
||||
|
||||
<tr id="<?php echo $row;?>">
|
||||
<td class="celda_normal" ><?php echo $index;?></td>
|
||||
<td class="celda_normal"><?php echo $a->EmpID;?></td>
|
||||
<td class="celda_normal"><?php echo $a->FirstName.'-'.$a->LastName;?></td>
|
||||
|
||||
<?php for ($col =1; $col <= $monthdays;$col++){
|
||||
$flag =0;
|
||||
foreach($sundayarray as $in)
|
||||
{
|
||||
if($in == $col)
|
||||
{
|
||||
$flag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($publicholidaysarray as $h) //For Find out public holidays from $monthdays array
|
||||
{
|
||||
|
||||
$temp = $h->H_Date;
|
||||
$temp = substr($temp,8);
|
||||
$title = '';
|
||||
$flag2 = 0;
|
||||
if($temp == $col)
|
||||
{
|
||||
$flag2 = 1;
|
||||
//$title ="Public_Holiday-" . str_replace(" ","_",$h->H_Name);
|
||||
$title = str_replace(" ","_",$h->H_Name);
|
||||
//echo $title;
|
||||
}
|
||||
}
|
||||
$WH='WH'.$col;
|
||||
$OT = 'OT'.$col;
|
||||
|
||||
?>
|
||||
<td <?php if($flag == 1){ ?> title = "Sunday" <?php }else if($flag2 == 1 ){ ?> title = <?php echo $title; } ?> class="celda_normal" onkeyup="myFunction(this.parentNode.id,this.id,this.textContent);" id ="<?php if($flag == 1 or $flag2 == 1) {echo $row.$col.'WS';}else{echo $row.$col.'W';}?>" <?php if($flag == 1 or $flag2 == 1){echo "style='background: #f9cd86 ;'";}?> contenteditable = "true"><?php if(!empty($a->$WH)){echo $a->$WH;}else{echo "0";}?></td>
|
||||
<td <?php if($flag == 1){ ?> title = "Sunday" <?php }else if($flag2 == 1 ){ ?> title = <?php echo $title; } ?> class="celda_normal" onkeyup="myFunction(this.parentNode.id,this.id,this.textContent);" id ="<?php if($flag == 1 or $flag2 == 1) {echo $row.$col.'OTS';}else{echo $row.$col.'OT';}?>" <?php if($flag == 1 or $flag2 == 1){echo "style='background: #f9cd86 ;'";}?> contenteditable = "true"><?php if(!empty($a->$OT)){echo $a->$OT;}else{echo "0";}?></td>
|
||||
|
||||
<?php $flag =0;
|
||||
$flag2 =0;
|
||||
}?>
|
||||
<td class="celda_normal" id="<?php echo $row.'TH';?>"><?php if(!empty($a->Total_WHrs)){echo $a->Total_WHrs;}else{echo "0.00";}?></td>
|
||||
<td class="celda_normal" id="<?php echo $row.'OTH';?>"><?php if(!empty($a->Total_OTHrs)){echo $a->Total_OTHrs;}else{echo "0.00";}?></td>
|
||||
<td class="celda_normal" id="<?php echo $row.'PL';?>"><?php if(!empty($a->Paid_Leave)){echo $a->Paid_Leave;}else{echo "0.00";}?></td>
|
||||
<td class="celda_normal" id="<?php echo $row.'DW';?>"><?php if(!empty($a->Days_Worked)){echo $a->Days_Worked;}else{echo "0.00";}?></td>
|
||||
<td class="celda_normal"id="<?php echo $row.'AB';?>"><?php if(!empty($a->Absent)){echo $a->Absent;}else{echo "0.00";}?></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><!-- /.box-body -->
|
||||
<div class="box-footer ">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<input type="button" class="btn btn-primary" id="c" value="save" onClick="getAllData();">
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- /.box footer -->
|
||||
</div><!-- /.box -->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/common.js" charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
$("#month").datepicker({
|
||||
minViewMode: 1,
|
||||
format: 'M-yyyy'
|
||||
});
|
||||
|
||||
|
||||
function getAllData()
|
||||
{
|
||||
|
||||
var Totalnoofdays = <?php echo $monthdays?>;
|
||||
var alldata = $("#attendance").tableToJSON();
|
||||
// alert(JSON.stringify(alldata));
|
||||
alldata=JSON.stringify(alldata);
|
||||
// alert(alldata);
|
||||
|
||||
|
||||
var month = $('#month').val();
|
||||
var currentmonth = month.substr(0,3);
|
||||
var currentyear = month.substr(4,4);
|
||||
// alert(currentyear);
|
||||
var montharray = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
|
||||
var currentmonth = jQuery.inArray(currentmonth,montharray);//!== -1
|
||||
currentmonth++;
|
||||
|
||||
//alert(currentmonth);
|
||||
var currentdate = '01-'+currentmonth+'-'+currentyear;
|
||||
//alert(currentdate);
|
||||
// var today = new Date();
|
||||
// alert(today);
|
||||
// var day =today.getDate();
|
||||
// alert(day);
|
||||
// var month =today.getMonth();
|
||||
// month++;
|
||||
// alert(month);
|
||||
// var year = today.getFullYear();
|
||||
// alert(year);
|
||||
var totaldata = 0;
|
||||
$('#content').loader('hide');
|
||||
$.ajax({
|
||||
data:{param1:alldata,param2:currentdate,param3:Totalnoofdays},
|
||||
//dataType:"json",
|
||||
type:"POST",
|
||||
url:"<?php echo base_url() ?>monthlypay/saveAttendance",
|
||||
|
||||
success:function(data) {
|
||||
if(data)
|
||||
{
|
||||
$('#content').loader('hide');
|
||||
alert(data);
|
||||
//totaldata = totaldata + parseFloat(data);
|
||||
//console.log(data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
//alert(totaldata+"-Employees attendance saved sucessfully..!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
$("#attendance").CongelarFilaColumna({lboHoverTr:true});
|
||||
$('html').bind('keypress', function(e)
|
||||
{
|
||||
//alert(e.which || e.keyCode);
|
||||
if(((e.which || e.keyCode) == 8) || ((e.which || e.keyCode) == 9) || ((e.which || e.keyCode) == 46) || ((e.which || e.keyCode) == 37) || ((e.which || e.keyCode) == 39))
|
||||
{
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
if(e.keyCode == 13)
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
if(((e.which || e.keyCode) < 48) || ((e.which || e.keyCode) > 57))
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
function myFunction(p,i,v)
|
||||
{
|
||||
//alert(p+"-"+i+"-"+v);
|
||||
var i =i;
|
||||
var id = i.substr(-1);
|
||||
//alert(id);
|
||||
var len = i.length;
|
||||
var nxtid =0;
|
||||
var nxtvalue = 0;
|
||||
var curvalue = 0;
|
||||
var curid =0;
|
||||
// if(v == 0)
|
||||
// {
|
||||
// // document.getElementById(i).innerHTML = parseFloat(0);
|
||||
// document.getElementById(i).style.backgroundColor="red";
|
||||
// }else{
|
||||
// document.getElementById(i).style.backgroundColor="#fff";
|
||||
// }
|
||||
|
||||
|
||||
if(v > 24)
|
||||
{
|
||||
alert('Working Hrs Do Not Exceed 24 HRs');
|
||||
|
||||
$(i).focus();
|
||||
document.getElementById(i).innerHTML = parseFloat(0);
|
||||
return false;
|
||||
}
|
||||
if(id == 'W' && v > 8){ // checking working hrs vallue is more than 8, if it is set as OT Hrs more than 8
|
||||
|
||||
if(len == 3)
|
||||
{
|
||||
nxtid = i.substr(1,1)
|
||||
}
|
||||
else if(len == 4)
|
||||
{
|
||||
nxtid = i.substr(1,2)
|
||||
}
|
||||
|
||||
nxtvalue = v-8;
|
||||
curvalue = 8;
|
||||
|
||||
nxtid = p+nxtid+'OT';
|
||||
curid = i;
|
||||
|
||||
|
||||
document.getElementById(i).innerHTML = parseFloat(curvalue)
|
||||
document.getElementById(nxtid).innerHTML = parseFloat(nxtvalue)
|
||||
|
||||
}
|
||||
else if(id == 'T' && v > 16){
|
||||
|
||||
alert("OT Should not exceed 16 Hrs");
|
||||
$(i).focus();
|
||||
document.getElementById(i).innerHTML = parseFloat(0);
|
||||
}
|
||||
|
||||
|
||||
var totalworkingHrs=0;
|
||||
var totalOTHrs = 0;
|
||||
var paidleave = 0;
|
||||
var totalDaysWorked=0;
|
||||
var absent = 0;
|
||||
var sundays = <?php echo $noofsundays?>;
|
||||
var totaldays = <?php echo $monthdays?>;
|
||||
totaldays = (totaldays * 2)+3;
|
||||
//console.log(totaldays);
|
||||
|
||||
|
||||
var totalhrsid=p+'TH';
|
||||
var totalothrsid=p+'OTH';
|
||||
var paidleaveid=p+'PL';
|
||||
var daysworkedid=p+'DW';
|
||||
var absentid=p+'AB';
|
||||
|
||||
//document.getElementById(i).textContent = v;
|
||||
//alert('Total Hrs-'+document.getElementById(i).textContent);
|
||||
|
||||
var Row = $('#attendance').find('tr').eq(p).find('td');
|
||||
// console.log(Row);
|
||||
$.each(Row,function(index,value){
|
||||
cal:
|
||||
{
|
||||
if(index >= totaldays )
|
||||
{
|
||||
break cal;
|
||||
}
|
||||
if((index != 0) && (index !=1) && (index != 2))// && (index > totaldays))
|
||||
{
|
||||
|
||||
//alert(value.id+"-"+value.textContent);
|
||||
|
||||
var str = value.id;
|
||||
var temp = str.length;
|
||||
var res = '';
|
||||
switch(temp)
|
||||
{
|
||||
case 3:
|
||||
var current = value.textContent == '' ? 0:parseFloat(value.textContent);
|
||||
totalworkingHrs += current;
|
||||
if(current == 0){paidleave++;}
|
||||
break;
|
||||
|
||||
case 4: res = str.substr(-2);
|
||||
if(res == 'OT' )
|
||||
{
|
||||
var current = value.textContent == '' ? 0:parseFloat(value.textContent);
|
||||
totalOTHrs = totalOTHrs+current;
|
||||
}
|
||||
else if(res == 'WS')
|
||||
{
|
||||
var current = value.textContent == '' ? 0:parseFloat(value.textContent);
|
||||
totalOTHrs = totalOTHrs+current;
|
||||
}else
|
||||
{
|
||||
var current = value.textContent == '' ? 0:parseFloat(value.textContent);
|
||||
totalworkingHrs += current;
|
||||
if(current == 0){paidleave++;}
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: res = str.substr(-3);
|
||||
if(res == 'OTS' )
|
||||
{
|
||||
var current = value.textContent == '' ? 0:parseFloat(value.textContent);
|
||||
totalOTHrs = totalOTHrs+current
|
||||
}
|
||||
else
|
||||
{
|
||||
res = str.substr(-2);
|
||||
if(res == 'WS')
|
||||
{
|
||||
var current = value.textContent == '' ? 0:parseFloat(value.textContent);
|
||||
totalOTHrs = totalOTHrs+current
|
||||
}
|
||||
else if(res == 'OT')
|
||||
{
|
||||
var current = value.textContent == '' ? 0:parseFloat(value.textContent);
|
||||
totalOTHrs = totalOTHrs+current;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: res = str.substr(-3);
|
||||
if(res == 'OTS' )
|
||||
{
|
||||
var current = value.textContent == '' ? 0:parseFloat(value.textContent);
|
||||
totalOTHrs = totalOTHrs+current;
|
||||
}
|
||||
break;
|
||||
|
||||
default://alert('Nothing');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if(paidleave == 1 )
|
||||
{
|
||||
absent = 0;
|
||||
}else if(paidleave == 0)
|
||||
{
|
||||
absent = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
absent = paidleave-2;
|
||||
paidleave = 2;
|
||||
}
|
||||
document.getElementById(totalhrsid).innerHTML = parseFloat(totalworkingHrs).toFixed(2);// == ''?0:parseFloat(totalworkingHrs));
|
||||
document.getElementById(totalothrsid).innerHTML = parseFloat(totalOTHrs).toFixed(2);// == ''?0:parseFloat(totalOTHrs));
|
||||
document.getElementById(paidleaveid).innerHTML = parseFloat(paidleave).toFixed(2);
|
||||
document.getElementById(daysworkedid).innerHTML = parseFloat((totalworkingHrs/8)+4).toFixed(2);
|
||||
document.getElementById(absentid).innerHTML = parseFloat(absent).toFixed(2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@ -17,32 +17,32 @@ $("#due_started").datepicker({
|
||||
|
||||
|
||||
|
||||
window.onload = function(){
|
||||
loanReset();
|
||||
function loanReset(){
|
||||
//alert("hi");
|
||||
var loan=$("#Loan_Amount").val();//document.getElementById('Loan_Amount').value;
|
||||
var paid=$("#Paid_Amount").val();//document.getElementById('Paid_Amount').value;
|
||||
if(loan !=0){
|
||||
if (loan == paid)
|
||||
{
|
||||
//alert("loan reset");
|
||||
$("#Loan_Amount").val(0.00);
|
||||
$("#Paid_Amount").val(0.00);
|
||||
$("#monthly_due").val(0.00);
|
||||
$("#no_of_due").val(0);
|
||||
$("#remaining_due").val(0);
|
||||
$("#paid_due").val(0);
|
||||
$("#loan_issued_date").val("");
|
||||
$("#due_started").val("");
|
||||
// window.onload = function(){
|
||||
// loanReset();
|
||||
// function loanReset(){
|
||||
// //alert("hi");
|
||||
// var loan=$("#Loan_Amount").val();//document.getElementById('Loan_Amount').value;
|
||||
// var paid=$("#Paid_Amount").val();//document.getElementById('Paid_Amount').value;
|
||||
// if(loan !=0){
|
||||
// if (loan == paid)
|
||||
// {
|
||||
// //alert("loan reset");
|
||||
// $("#Loan_Amount").val(0.00);
|
||||
// $("#Paid_Amount").val(0.00);
|
||||
// $("#monthly_due").val(0.00);
|
||||
// $("#no_of_due").val(0);
|
||||
// $("#remaining_due").val(0);
|
||||
// $("#paid_due").val(0);
|
||||
// $("#loan_issued_date").val("");
|
||||
// $("#due_started").val("");
|
||||
|
||||
}else
|
||||
{
|
||||
//alert("loan pending");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
// }else
|
||||
// {
|
||||
// //alert("loan pending");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
</script>
|
||||
|
||||
<?php
|
||||
@ -73,18 +73,19 @@ if (loan == paid)
|
||||
$Remaining_Due='';
|
||||
$Paid_Due='';
|
||||
$Paid_Amount=0;
|
||||
$loanid='';
|
||||
|
||||
|
||||
if(!empty($emppay))
|
||||
{
|
||||
|
||||
// print_r($emppay);
|
||||
foreach ($emppay as $ep)
|
||||
{
|
||||
|
||||
|
||||
|
||||
$Pay_Data_ID=$ep->Pay_Data_ID;
|
||||
$EmpID=$ep->EmpID;
|
||||
$EmpID=$ep->PAYEMPID;
|
||||
$Empname=$ep->FirstName ." ". $ep->LastName ;
|
||||
$TotalSalary=$ep->TotalSalary;
|
||||
$Basic_Pay=$ep->Basic_Pay;
|
||||
@ -97,24 +98,31 @@ if(!empty($emppay))
|
||||
$is_Active=$ep->is_Active;
|
||||
$Food_Allowances=$ep->Food_Allowances;
|
||||
$Loan_Amount=$ep->Loan_Amount;
|
||||
if(empty($Loan_Amount)){$Loan_Amount = 0.00;}
|
||||
if( !empty($ep->Loan_Issued_Date) ){
|
||||
$Loan_issued_date=new DateTime( $ep->Loan_Issued_Date, new DateTimeZone('Asia/Kolkata'));
|
||||
$Loan_issued_date=$Loan_issued_date->format('d-m-Y');}
|
||||
else{$Loan_issued_date=null;}
|
||||
|
||||
$Monthly_due=$ep->Monthly_Due;
|
||||
if(empty($Monthly_due)){$Monthly_due = 0.00;}
|
||||
if(!empty($ep->Due_Start_Date)){
|
||||
$Due_start_date=new DateTime( $ep->Due_Start_Date, new DateTimeZone('Asia/Kolkata'));
|
||||
$Due_start_date=$Due_start_date->format('d-m-Y');}
|
||||
else{$Due_start_date=null;}
|
||||
$No_of_dues=$ep->No_of_Dues;
|
||||
if(empty($No_of_dues)){$No_of_dues = 0.00;}
|
||||
$Paid_Due=$ep->Paid_Due;
|
||||
if(empty($Paid_Due)){$Paid_Due = 0.00;}
|
||||
$Remaining_Due=$ep->Remaining_Due;
|
||||
if(empty($Remaining_Due)){$Remaining_Due = 0.00;}
|
||||
$Paid_Amount=$ep->Paid_Amount;
|
||||
if(empty($Paid_Amount)){$Paid_Amount = 0.00;}
|
||||
$Created_By=$ep->Created_By;
|
||||
$Created_Time=$ep->Created_Time;
|
||||
$Last_Mod_By=$ep->Last_Mod_By;
|
||||
$Last_Mod_Time=$ep->Last_Mod_Time;
|
||||
$loanid = $ep->Loan_ID;
|
||||
|
||||
|
||||
}
|
||||
@ -175,8 +183,8 @@ if(!empty($emppay))
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
<span for ="Food_Allowances">Employee Name</span>
|
||||
<input type="text" class="form-control" id="Food_Allowances" name="Food_Allowances" value="<?php echo $Empname; ?>" readonly>
|
||||
<span for ="Employee">Employee Name</span>
|
||||
<input type="text" class="form-control" id="Empname" name="Empname" value="<?php echo $Empname; ?>" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -276,8 +284,8 @@ if(!empty($emppay))
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
|
||||
|
||||
|
||||
<input type="hidden" name="loanid" value="<?php echo $loanid;?>">
|
||||
<span for="Pay_Data_ID">Loan Amount</span>
|
||||
<input type="text" class="form-control num" id="Loan_Amount" name="Loan_Amount" value="<?php echo $Loan_Amount; ?>" pattern="([0-9]{1,7}([.][0-9]{1,2})?)" title="Minimum 4 digit,Maximum 6 Digit" onchange="duecalculation();">
|
||||
</div>
|
||||
@ -533,6 +541,9 @@ function dateCalulation()
|
||||
function finalCheck()
|
||||
{
|
||||
//alert("final check");
|
||||
|
||||
|
||||
|
||||
var loanamount=document.getElementById('Loan_Amount').value;
|
||||
if(loanamount != "" && loanamount != 0.00)
|
||||
{
|
||||
@ -541,8 +552,16 @@ function finalCheck()
|
||||
var dsdate=document.getElementById('due_started').value;
|
||||
if(idate == "" || due == "" || due == 0.00 || dsdate == ""){
|
||||
alert("Enter All Loan Information Correctly...!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if($('#Total_Salary').val() == '' || $('#HRA_Rate').val() == '' || $('#Allowances').val() == '' ||$('#PF_Rate').val() == '' ||$('#ESI_Rate').val() == '' || $('#Food_Allowances').val() == '')
|
||||
{
|
||||
|
||||
alert("Please Enter All Information Correctly..!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$("#deleteemp").click(function(){
|
||||
|
||||
@ -492,7 +492,7 @@ if(!empty($PayInfo))
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
|
||||
<input type="text" class="form-control num" id="otherallowence" name="otherallowence" value="<?php echo $Other_allowances;?>" onchange="calculateSalary();" >
|
||||
<input type="text" class="form-control num" id="otherallowence" name="otherallowence" value="<?php echo $Other_allowances;?>" onchange="calculateSalary();" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -456,14 +456,20 @@ $(function() {
|
||||
<span id="menu" data-toggle="dropdown" ><i class="fa fa-thumb-tack"></i> PaySlip <span class="caret"></span></span>
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="menu3">
|
||||
<li class="treeview">
|
||||
<a href="<?php echo base_url(); ?>attendance">
|
||||
<i class="fa fa-refresh fa-spin "></i>
|
||||
<span>Monthly Attendance</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="treeview">
|
||||
<a href="<?php echo base_url(); ?>monthlypay">
|
||||
<i class="fa fa-upload"></i>
|
||||
<i class="fa fa-keyboard-o"></i>
|
||||
<span>Monthly Pay Information</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="treeview">
|
||||
<a href="<?php echo base_url(); ?>ExcelUpload2">
|
||||
<i class="fa fa-keyboard-o"></i>
|
||||
<i class="fa fa-upload"></i>
|
||||
<span>Monthly Pay Upload</span>
|
||||
</a>
|
||||
</li>
|
||||
@ -489,6 +495,17 @@ $(function() {
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="treeview">
|
||||
<a href="<?php echo base_url(); ?>publicholidays" >
|
||||
<i class="fa fa-calendar"></i> <span>Public Holidays</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="treeview">
|
||||
<a href="<?php echo base_url(); ?>loanreports" >
|
||||
<i class="fa fa-list-alt"></i> <span>Loan Reports</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<?php
|
||||
|
||||
386
application/views/loanreports.php
Normal file
386
application/views/loanreports.php
Normal file
@ -0,0 +1,386 @@
|
||||
|
||||
<script src="<?php echo base_url()?>assets/tabletoexport/jquery.tableexport.v2.js"></script>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
$dateflag=0;
|
||||
$statusflag =0;
|
||||
$source = array('company'=>'Company');
|
||||
$historytableflag = 0;
|
||||
if(!empty($childdata) )
|
||||
{
|
||||
if(count($childdata) > 0 ){
|
||||
$historytableflag = 1; }
|
||||
//echo "child";
|
||||
}
|
||||
if(!empty($loanrecords))
|
||||
{
|
||||
|
||||
foreach($loanrecords as $r)
|
||||
{
|
||||
|
||||
if(!empty($r->Loan_Issued_Date))
|
||||
{
|
||||
$dateflag=1;
|
||||
$statusflag=1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if(!empty($loanemployees))
|
||||
{
|
||||
foreach($loanemployees as $l)
|
||||
{
|
||||
$source[$l->EmpID] = $l->EmpID.'-'.$l->FName.'-'.$l->Lname;
|
||||
}
|
||||
|
||||
}
|
||||
$monthsoptions = array("01" => "Jan", "02" => "Feb","03" => "Mar","04" => "Apr","05" => "May","06" => "June","07"=> "July","08"=> "Aug","09" => "Sep","10"=> "Oct","11" => "Nov","12"=>"Dec");
|
||||
|
||||
?>
|
||||
<style>
|
||||
.ui-datepicker-trigger{
|
||||
border:none;
|
||||
background:none;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
|
||||
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
|
||||
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
|
||||
<script>
|
||||
$(function()
|
||||
{
|
||||
|
||||
$("#finyear").datepicker(
|
||||
{
|
||||
|
||||
minViewMode: 1,
|
||||
|
||||
|
||||
//format: 'M-yyyy',
|
||||
|
||||
});
|
||||
|
||||
$("#finyear").change(function(){
|
||||
$("#finyearttext").val('');
|
||||
var date = $('#finyear').datepicker('getDate');
|
||||
$("#finyear").val("Year");
|
||||
var month = date.getMonth();
|
||||
var year = date.getFullYear();
|
||||
month++;
|
||||
if (month >= 4)
|
||||
{
|
||||
$("#finyear").val("Year");
|
||||
$("#finyearttext").val(year + '-' + (year+1));
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#finyear").val("Year");
|
||||
$("#finyearttext").val((year-1) + '-' + year);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//alert($('#source').find(":selected").text());
|
||||
$("#finyear").val("Year");
|
||||
var sw = <?php echo $historytableflag;?>;
|
||||
if(sw == 1)
|
||||
{
|
||||
$('#parenttable').hide();
|
||||
$('#historyarea').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#parenttable').show();
|
||||
$('#historyarea').hide();
|
||||
}
|
||||
|
||||
// $("#finyear").datepicker({}).onmouseleave({
|
||||
// alert("sdds");
|
||||
// });
|
||||
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.num {
|
||||
text-align:right;
|
||||
}
|
||||
</style>
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
<center>Company/Employee Loan Reports</center>
|
||||
</h1>
|
||||
</section>
|
||||
<section class="content">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<!--<center><h3 class="box-title">-->
|
||||
<div class="box-tools">
|
||||
|
||||
<form action="<?php echo base_url() ?>payslip/loadLoanReport" method="POST" id="searchList">
|
||||
|
||||
|
||||
</div><!--</h3></center>-->
|
||||
|
||||
</div><!-- /.box-header -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<?php echo form_dropdown('source',set_value('monthyear',$source),'id="source"' ,'class="form-control select2"');?>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<?php echo form_input('finyear',set_value('finyearttext'),'id="finyearttext"' ,'class="form-control"');?>
|
||||
<input type="button" id="finyear" value="Year">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
|
||||
<input type="button" value="View Report" class="btn btn-primary" id="report">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div id="parenttable">
|
||||
<div> <center><strong><h2> <?php if(empty($fyear)){$fyear = "Overall";} echo $fyear; ?></h2><strong><center></div>
|
||||
<table id="monthlylistings" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
|
||||
<thead style="background-color:#ddf">
|
||||
<tr>
|
||||
|
||||
<th>S.No</th>
|
||||
<th>Employee Name</th>
|
||||
<th>Loan Given</th>
|
||||
<?php if($dateflag == 1) {?>
|
||||
<th>Loan Issue Date</th>
|
||||
<?php }?>
|
||||
<th>Loan Recovered</th>
|
||||
<?php if($statusflag == 1) {?>
|
||||
<th>Loan Status</th>
|
||||
<?php }?>
|
||||
<th>Loan Balance</th>
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$index = 0;
|
||||
$totalloangiven = 0;
|
||||
$totalrecovered = 0;
|
||||
$totalbalance = 0;
|
||||
$base=base_url();
|
||||
if(!empty($loanrecords))
|
||||
{
|
||||
foreach($loanrecords as $rec)
|
||||
{
|
||||
$index++;
|
||||
|
||||
?>
|
||||
<tr> <td><?php echo $index;?></td>
|
||||
<?php if($dateflag != 1) {?>
|
||||
<td><?php echo '<a href="'.$base.'payslip/loadLoanReport/'.$rec->EmpID.'/'.$fyear.'">'.$rec->EmpID.'-'.$rec->FName.'-'.$rec->Lname.'</a>';?></td>
|
||||
<?php }else{?>
|
||||
<td><?php echo '<a href="'.$base.'payslip/loadLoanReport/'.$rec->Loan_ID.'">'.$rec->EmpID.'-'.$rec->FName.'-'.$rec->Lname.'</a>';?></td>
|
||||
<?php }?>
|
||||
<td style="text-align:right;"><?php if(!empty($rec->Loan_Amount)){$totalloangiven+=$rec->Loan_Amount; echo $rec->Loan_Amount;}else{echo "0.00";}?></td>
|
||||
<?php if($dateflag == 1) {?>
|
||||
<td style="text-align:right;"><?php if(!empty($rec->Loan_Issued_Date)){echo $rec->Loan_Issued_Date;}else{echo "-";}?></td>
|
||||
<?php }?>
|
||||
<td style="text-align:right;"><?php if(!empty($rec->Paid_Amount)){$totalrecovered+=$rec->Paid_Amount ;echo $rec->Paid_Amount;}else{echo "0.00";} ?></td>
|
||||
<?php if($statusflag == 1) {?>
|
||||
<td style="text-align:center;" ><?php $final = ''; if($rec->is_Active == 1){$final = "<font color='blue'>Pending</font>"; }else{$final = "<font color='green'>Completed</font>";} if($rec->Remaining_Due < 0 and $rec->is_Active == 1){$final.=",<font color='red'>Over Due</font>";} echo $final;?></td>
|
||||
<?php }?>
|
||||
<td style="text-align:right;"><?php if(!empty(($rec->Loan_Amount) and ($rec->Paid_Amount))){ $totalbalance+= ($rec->Loan_Amount - $rec->Paid_Amount);echo number_format(($rec->Loan_Amount - $rec->Paid_Amount),2,'.','');}else {echo "0.00";}?></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td style="text-align:right;"><strong>Total</strong></td>
|
||||
<td style="text-align:left;"><strong><?php echo number_format($totalloangiven,2,'.','');?></strong></td>
|
||||
|
||||
<?php if($dateflag == 1) {?>
|
||||
<td></td>
|
||||
<?php }?>
|
||||
|
||||
<td style="text-align:left;"><strong><?php echo number_format($totalrecovered,2,'.','');?></strong></td>
|
||||
|
||||
<?php if($statusflag == 1) {?>
|
||||
<td></td>
|
||||
<?php }?>
|
||||
|
||||
<td style="text-align:left;"><strong><?php echo number_format( $totalbalance,2,'.','');?></strong></td>
|
||||
<tr>
|
||||
</table>
|
||||
</div>
|
||||
<p> </p>
|
||||
|
||||
<?php if($historytableflag == 1){?>
|
||||
<div id="historyarea">
|
||||
<div>
|
||||
<?php
|
||||
$Name = '';
|
||||
$Loan = 0;
|
||||
$Issue_date = 0;
|
||||
|
||||
if(!empty($childdata))
|
||||
{
|
||||
foreach($childdata as $c)
|
||||
{
|
||||
$Loan_ID = $c->Loan_ID;
|
||||
$Name = $c->EmpID.'-'.$c->FirstName.'-'.$c->LastName;
|
||||
$Loan = $c->Loan_Amount;
|
||||
$Issue_date = $c->Loan_Issued_Date;
|
||||
$dis = 'Loan ID:-'.$Loan_ID.'-Name:-'.$Name.'- Amount:-'. $Loan;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<span><center><h3> <?php echo $Name.' Loan Amount:'.$Loan.' Loan Issued Date:'.$Issue_date;?></h3></center></span>
|
||||
</div>
|
||||
<table id="historytable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
|
||||
<thead style="background-color:#ddf">
|
||||
|
||||
<tr><th>Date </th> <th>Due_Month </th> <th>Due Amount </th> <th>Balance Amount</th> </tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
if(!empty($childdata))
|
||||
{
|
||||
foreach($childdata as $child)
|
||||
{
|
||||
|
||||
$monthno = substr($child->Due_Date,0,2);
|
||||
$yr = substr($child->Due_Date,3,4);
|
||||
$final = $monthsoptions[$monthno].'-'.$yr;
|
||||
|
||||
?>
|
||||
<tr> <td style="text-align:left;"><?php echo date_format(date_create($child->Entry_Date),'Y-m-d');?></td> <td style="text-align:right;"><?php echo $final;?></td> <td style="text-align:right;"><?php echo $child->Due_Amount ;?></td> <td style="text-align:right;"><?php echo $child->Balance_Amount;?></td> </tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="row">
|
||||
|
||||
</div>
|
||||
</div><!-- /.box-body -->
|
||||
<!-- <div class="box-footer clearfix">
|
||||
|
||||
</div> -->
|
||||
</div><!-- /.box -->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/common.js" charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
|
||||
$('#monthlylistings').DataTable({
|
||||
"paging": true,
|
||||
"lengthChange": true,
|
||||
"searching": true,
|
||||
"ordering": true,
|
||||
"aaSorting": [[ 0, "asc" ]],
|
||||
"info": true,
|
||||
"autoWidth": true
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
$(function () {
|
||||
|
||||
$('#historytable').DataTable({
|
||||
"paging": true,
|
||||
"lengthChange": true,
|
||||
"searching": true,
|
||||
"ordering": false,
|
||||
"aaSorting": [[ 0, "asc" ]],
|
||||
"info": true,
|
||||
"autoWidth": true
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
$('#report').click(function(){
|
||||
|
||||
// var finyear = $('#finyearttext').val();
|
||||
// var source = $('#source').val();
|
||||
// $("#form").submit( function(eventObj) {
|
||||
// $('#searchList').attr('method', 'post')
|
||||
// .attr('action', "payslip/loadLoanReport")
|
||||
// .attr('value', "something")
|
||||
// .appendTo('#form');
|
||||
// return true;
|
||||
// });
|
||||
|
||||
$("#searchList").submit();
|
||||
});
|
||||
|
||||
|
||||
var name2="<?php if(!empty($dis)){echo $dis;}?>";
|
||||
$("#historytable").tableExport({
|
||||
bootstrap: true,
|
||||
separator: ",",
|
||||
headings: true,
|
||||
buttonContent: "Export",
|
||||
addClass: "",
|
||||
defaultClass: "btn",
|
||||
defaultTheme: "btn-default",
|
||||
type: "csv",
|
||||
fileName: name2,
|
||||
position: "bottom",
|
||||
stripQuotes: true
|
||||
});
|
||||
|
||||
var name = "<?php echo 'Loan Report - ' . $selsource . ' for ' . $fyear;?>";
|
||||
$("#monthlylistings").tableExport({
|
||||
bootstrap: true,
|
||||
separator: ",",
|
||||
headings: true,
|
||||
buttonContent: "Export",
|
||||
addClass: "",
|
||||
defaultClass: "btn",
|
||||
defaultTheme: "btn-default",
|
||||
type: "csv",
|
||||
fileName: name,
|
||||
position: "bottom",
|
||||
stripQuotes: true
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
// print_r($month);
|
||||
// echo "-------------";
|
||||
// print_r($fresh);
|
||||
$sample = array_merge($month,$fresh);
|
||||
|
||||
?>
|
||||
@ -71,7 +73,7 @@ $('html').bind('keypress', function(e)
|
||||
$aftersix = array();
|
||||
for ($i = 0; $i <3;$i++){
|
||||
|
||||
$month++;;
|
||||
$month++;
|
||||
if($month > 12)
|
||||
{
|
||||
$month = 1;
|
||||
@ -134,6 +136,7 @@ $('html').bind('keypress', function(e)
|
||||
<th>S.No</th>
|
||||
<th>Employee Id</th>
|
||||
<th>Employee Name</th>
|
||||
<th>Days Worked</th>
|
||||
<th>LOP Days</th>
|
||||
<th>Paid Leave</th>
|
||||
<th>OT Hours Worked in Hrs</th>
|
||||
@ -178,15 +181,16 @@ $('html').bind('keypress', function(e)
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td style="text-align:right;"><?php echo $index ?></td>
|
||||
<td style="text-align:right;" style="background-color:blue;"><?php echo $index; ?></td>
|
||||
<td style="text-align:right;"><?php echo $record->EmpID ?></td>
|
||||
<td><?php echo $record->FirstName ." ". $record->LastName ?></td>
|
||||
<td contenteditable='true' style="text-align:right;"><?php if(!empty($record->LOP_Days)){echo $record->LOP_Days;}else{echo "0.00";}?></td>
|
||||
<td contenteditable='true' style="text-align:right;"><?php if(!empty($record->Paid_leave)){echo $record->Paid_leave;}else { echo number_format(0.00,2,'.','');} ?></td>
|
||||
<td contenteditable='true' style="text-align:right;"><?php if(!empty($record->OT_Hrs_Worked)){echo $record->OT_Hrs_Worked;}else { echo number_format(0.00,2,'.','');} ?></td>
|
||||
<td contenteditable='true' style="text-align:right;"><?php if(!empty($record->Loan_Recovered)){if(is_numeric($record->Loan_Recovered)){echo number_format($record->Loan_Recovered,2,'.','');}else {echo $record->Loan_Recovered;}}else{echo number_format(0.00,2,'.','');} ?></td>
|
||||
<td contenteditable='true' style="text-align:right;"><?php if(!empty($record->Incentives)){echo $record->Incentives;}else{ echo number_format(0.00,2,'.','');;} ?></td>
|
||||
<td contenteditable='true' style="text-align:right;"><?php if(!empty($record->Other_Deductions)){echo $record->Other_Deductions; }else{ echo number_format(0.00,2,'.','');;} ?></td>
|
||||
<td <?php if(empty($record->Key)){echo "contenteditable='true';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Days_worked)){echo $record->Days_worked;}else{echo "0.00";}?></td>
|
||||
<td <?php if(empty($record->Key)){echo "contenteditable='true';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->LOP_Days)){echo $record->LOP_Days;}else{echo "0.00";}?></td>
|
||||
<td <?php if(empty($record->Key)){echo "contenteditable='true';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Paid_leave)){echo number_format($record->Paid_leave,2,'.','');}else { echo number_format(0.00,2,'.','');} ?></td>
|
||||
<td <?php if(empty($record->Key)){echo "contenteditable='true';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->OT_Hrs_Worked)){echo $record->OT_Hrs_Worked;}else { echo number_format(0.00,2,'.','');} ?></td>
|
||||
<td <?php if(empty($record->Key)){echo "contenteditable='true';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Loan_Recovered)){if(is_numeric($record->Loan_Recovered)){echo number_format($record->Loan_Recovered,2,'.','');}else {echo $record->Loan_Recovered;}}else{echo number_format(0.00,2,'.','');} ?></td>
|
||||
<td <?php if(empty($record->Key)){echo "contenteditable='true';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Incentives)){echo $record->Incentives;}else{ echo number_format(0.00,2,'.','');;} ?></td>
|
||||
<td <?php if(empty($record->Key)){echo "contenteditable='true';"; } ?> <?php if(!empty($record->Key)){?> title="Payslip Calculated" style="text-align:right;color:blue;"<?php } else{?>style="text-align:right;"<?php }?> ><?php if(!empty($record->Other_Deductions)){echo $record->Other_Deductions; }else{ echo number_format(0.00,2,'.','');;} ?></td>
|
||||
|
||||
</tr>
|
||||
|
||||
@ -241,7 +245,7 @@ $('html').bind('keypress', function(e)
|
||||
{
|
||||
|
||||
var alldata = $("#monthlylistings").tableToJSON();
|
||||
// alert(JSON.stringify(alldata));
|
||||
//alert(JSON.stringify(alldata));
|
||||
alldata=JSON.stringify(alldata)
|
||||
var month = $('#monthyear').val();
|
||||
$('#content').loader('hide');
|
||||
@ -325,7 +329,7 @@ $('html').bind('keypress', function(e)
|
||||
if(data)
|
||||
{
|
||||
$('#content').loader('hide');
|
||||
//alert(data);
|
||||
alert(data);
|
||||
var trHTML="";
|
||||
var obj =JSON.parse(data);
|
||||
var temparray = [];
|
||||
@ -347,6 +351,8 @@ $('html').bind('keypress', function(e)
|
||||
++i
|
||||
i=i-j;
|
||||
|
||||
var Days_Worked = val.Days_worked;
|
||||
if(Days_Worked == null){ Days_Worked="0.00";}
|
||||
var LOP_Days = val.LOP_Days;
|
||||
if(LOP_Days == null){ LOP_Days="0.00";}
|
||||
var Paid_leave = val.Paid_leave;
|
||||
@ -365,6 +371,7 @@ $('html').bind('keypress', function(e)
|
||||
'<td style="text-align:right;">' + (i) + '</td>' +
|
||||
'<td style="text-align:right;">' + val.EmpID + '</td>' +
|
||||
'<td>' + val.FirstName+" "+ val.LastName + '</td>' +
|
||||
'<td contenteditable="true" style="text-align:right;">' + Days_Worked + '</td>' +
|
||||
'<td contenteditable="true" style="text-align:right;">' + LOP_Days + '</td>' +
|
||||
'<td contenteditable="true" style="text-align:right;">' + Paid_leave + '</td>' +
|
||||
'<td contenteditable="true" style="text-align:right;">' + OT_Hrs_Worked + '</td>' +
|
||||
|
||||
242
application/views/publicholidays.php
Normal file
242
application/views/publicholidays.php
Normal file
@ -0,0 +1,242 @@
|
||||
<?php
|
||||
// print_r($month);
|
||||
// echo "-------------";
|
||||
// print_r($days);
|
||||
//$sample = array_merge($month,$fresh);
|
||||
|
||||
?>
|
||||
|
||||
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
|
||||
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
$("#hdate").datepicker({
|
||||
dateFormat: 'yy-mm-dd',changeMonth: true, changeYear: true,yearRange: '-100:+0'
|
||||
});
|
||||
});
|
||||
$('html').bind('keypress', function(e)
|
||||
{
|
||||
//alert('Key Pressed');
|
||||
if(e.keyCode == 13)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
.num {
|
||||
text-align:right;
|
||||
}
|
||||
</style>
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
<center>Public Holiday Information - <?php echo date('Y');?></center>
|
||||
</h1>
|
||||
</section>
|
||||
<section class="content">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<!--<center><h3 class="box-title">-->
|
||||
<div class="box-tools">
|
||||
|
||||
|
||||
</div><!--</h3></center>-->
|
||||
|
||||
</div><!-- /.box-header -->
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-3">
|
||||
<span>Holiday Name : </span>
|
||||
<input type="text" name="hname" id="hname">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<span>Date : </span>
|
||||
<input type="text" name="hdate" id="hdate">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<input type="button" id="Add" value = "Add" class="btn btn-primary" >
|
||||
</div>
|
||||
</div>
|
||||
<p> </p>
|
||||
<div class="box-body">
|
||||
<table id="phdays" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
|
||||
<thead style="background-color:#ddf">
|
||||
<tr>
|
||||
|
||||
<!-- <th>S.No</th> -->
|
||||
<th>Holiday_Name</th>
|
||||
<th>Date</th>
|
||||
<th style="width:10%";>Action</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="db">
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
$index=0;
|
||||
$testarray=array();
|
||||
|
||||
|
||||
|
||||
if(!empty($days))
|
||||
{
|
||||
foreach($days as $day)
|
||||
|
||||
{
|
||||
$index++;
|
||||
|
||||
?>
|
||||
|
||||
<tr id="<?php echo $index;?>">
|
||||
<!-- <td style="text-align:right;"><?php echo $index ?></td> -->
|
||||
|
||||
<td contenteditable='true' style="text-align:right;"><?php if(!empty($day->H_Name)){echo $day->H_Name;}else{echo "NO DATA";}?></td>
|
||||
<td contenteditable='true' style="text-align:right;"><?php if(!empty($day->H_Date)){echo $day->H_Date;}else{echo "NO DATA";}?></td>
|
||||
<td style="text-align:right;"><a href='#' onclick = "DeleteRow(<?php echo $index ; ?>)" id="Del" ><span class="glyphicon glyphicon-trash"></span></a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
<p> </p>
|
||||
<div class="row">
|
||||
<div class="col-md-4" id="savebutton">
|
||||
<input type="button" id="submit" value = "Save" class="btn btn-primary">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div><!-- /.box-body -->
|
||||
<!-- <div class="box-footer clearfix">
|
||||
|
||||
</div> -->
|
||||
</div><!-- /.box -->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/common.js" charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
|
||||
$('#phday0s').DataTable({
|
||||
"paging": true,
|
||||
"lengthChange": true,
|
||||
"searching": true,
|
||||
"ordering": false,
|
||||
// "aaSorting": [[ 0, "asc" ]],
|
||||
"info": true,
|
||||
"autoWidth": true
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/html" id="addList">
|
||||
<tr id="<%=index%>">
|
||||
<td style="text-align:right;" ><%=Holiday_Name%></td>
|
||||
<td style="text-align:right;" contenteditable="true"><%=Date%></td>
|
||||
<td style="text-align:right;">
|
||||
<a href='#' onclick = "DeleteRow(<?php echo $index ; ?>)" id="Del" ><span class="glyphicon glyphicon-trash"></span></a>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function DeleteRow(rowid)
|
||||
{
|
||||
var d='';
|
||||
//alert(rowid);
|
||||
var tr = document.getElementById(rowid);
|
||||
var Row = $('#phdays').find('tr').eq(rowid).find('td');
|
||||
$.each(Row,function(index,value){
|
||||
if(index == 1 ){
|
||||
d = value.textContent
|
||||
}
|
||||
});
|
||||
// alert(d);
|
||||
$('#content').loader('show');
|
||||
$.ajax({
|
||||
data:{param1:d},
|
||||
type:"POST",
|
||||
url:"<?php echo base_url() ?>monthlypay/deletePublicHoliday",
|
||||
|
||||
success:function(data){
|
||||
$('#content').loader('hide');
|
||||
alert(data);
|
||||
}
|
||||
|
||||
});
|
||||
tr.parentNode.removeChild(tr);
|
||||
}
|
||||
$('#Add').click(function(){
|
||||
|
||||
var index = $('#phdays tr').length;
|
||||
|
||||
var temp = index;
|
||||
var H_name = $('#hname').val();
|
||||
var H_date = $('#hdate').val();
|
||||
|
||||
|
||||
|
||||
if(H_name != '' && H_date != '')
|
||||
{
|
||||
var template = jQuery("#addList").html();
|
||||
index = parseInt(index);
|
||||
$('#db').append(_.template(template,{index:temp,Holiday_Name:H_name,Date:H_date}));
|
||||
var tablevalue = $('#phdays').tableToJSON(); // Convert the table into a javascript object
|
||||
var value = JSON.stringify(tablevalue);
|
||||
$('#hname').val('');
|
||||
$('#hdate').val('');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#submit').click(function(){
|
||||
|
||||
var jsondata = $('#phdays').tableToJSON();
|
||||
var jsondata = JSON.stringify(jsondata);
|
||||
$('#content').loader('show');
|
||||
$.ajax({
|
||||
data:{param1:jsondata},
|
||||
type:"POST",
|
||||
url:"<?php echo base_url() ?>monthlypay/savePublicHolidays",
|
||||
|
||||
success:function(data){
|
||||
$('#content').loader('hide');
|
||||
alert(data);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
633
assets/js/jquery.CongelarFilaColumna.js
Normal file
633
assets/js/jquery.CongelarFilaColumna.js
Normal file
@ -0,0 +1,633 @@
|
||||
/*
|
||||
* CongelarFilaColumna is a jQuery plugin that allows freezing of rows and columns.
|
||||
* Scrolling can be enabled. Both rows and columns can be frozen. Rows to be frozen
|
||||
* should be placed in 'thead' (whole frozen header). You can freeze rows and columns combined with colspan or rowspan.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2017
|
||||
* Author: Agustin Rios Reyes.
|
||||
* Email: nitsugario@gmail.com
|
||||
* Github: https://github.com/nitsugario/jQuery-Freeze-Table-Column-and-Rows
|
||||
* Versión: 2.2
|
||||
*
|
||||
* Licensed under MIT
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
*/
|
||||
|
||||
(function($)
|
||||
{
|
||||
$.fn.CongelarFilaColumna = function (method)
|
||||
{
|
||||
|
||||
var defaults =
|
||||
{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
Columnas: 3, //Number of columns fixed
|
||||
soloThead : false, //only the fixed header
|
||||
coloreacelda: false,
|
||||
colorcelda: '#F4FA58',
|
||||
lboHoverTr: false,
|
||||
tfoot: false
|
||||
};
|
||||
var settings = {};
|
||||
var methods =
|
||||
{
|
||||
init: function (options)
|
||||
{
|
||||
settings = $.extend({}, defaults, options);
|
||||
|
||||
return this.each(function ()
|
||||
{
|
||||
var $tabla = $(this);
|
||||
|
||||
if (helpers._EsUnaTabla($tabla))
|
||||
{
|
||||
methods.setup.apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
$.error('La Tabla No es válida. :( ');
|
||||
};
|
||||
});
|
||||
},
|
||||
setup: function ()
|
||||
{
|
||||
if ( settings.soloThead )
|
||||
{
|
||||
var $wrapper,
|
||||
$lobTable = $(this),
|
||||
lobTable = this,
|
||||
lstClassTable = $lobTable.attr("class");
|
||||
|
||||
helpers._ObtenerAsignarAnchoAltoThead( $lobTable );
|
||||
|
||||
var lobThead = $lobTable.find("thead").clone(),
|
||||
lnuWidthTable = $lobTable.width(),
|
||||
lobTableThead = $("<table>").attr("class",lstClassTable).append(lobThead);
|
||||
|
||||
|
||||
settings.scrollbarOffset = helpers._OptenerWidthBarraScroll();
|
||||
$lobTable.css({'width':lnuWidthTable});
|
||||
|
||||
if (!$lobTable.closest('.fht-table-wrapper').length)
|
||||
{
|
||||
$lobTable.addClass('fht-table');
|
||||
$lobTable.wrap('<div class="fht-table-wrapper"></div>');
|
||||
}
|
||||
|
||||
$wrapper = $lobTable.closest('.fht-table-wrapper');
|
||||
|
||||
if ( $wrapper.find('.fht-fixed-body').length == 0)
|
||||
$lobTable.wrap('<div class="fht-fixed-body"></div>');
|
||||
|
||||
$fixedBody = $wrapper.find('.fht-fixed-body');
|
||||
|
||||
$wrapper.css({
|
||||
width: settings.width,
|
||||
height: settings.height
|
||||
});
|
||||
|
||||
/*Agregamos la tabla completa a fht-tbody-conten*/
|
||||
$lobTable.wrap('<div class="fht-tbody"><div class="fht-tbody-conten"></div></div>');
|
||||
$lobTable.closest('.fht-tbody-conten').css({'width':lnuWidthTable});
|
||||
$lobDivBody = $wrapper.find('div.fht-tbody');
|
||||
|
||||
/*Agregamos el encabesado clonado al div fht-thead*/
|
||||
$lobDivTHead = $('<div class="fht-thead"></div>').prependTo($fixedBody).css({'width':lnuWidthTable});
|
||||
lobTableThead.css({'width':lnuWidthTable});
|
||||
$lobDivTHead.append(lobTableThead).css({'width':lnuWidthTable});
|
||||
|
||||
$lobTable.css({
|
||||
'margin-top': -$lobDivTHead.outerHeight(true)
|
||||
});
|
||||
|
||||
var lnuTbodyHeight = $wrapper.height() - $lobDivTHead.outerHeight(true);
|
||||
|
||||
$lobDivBody.css({
|
||||
'height': lnuTbodyHeight,
|
||||
'width':lnuWidthTable+settings.scrollbarOffset+2
|
||||
});
|
||||
|
||||
helpers._OnScroll( $lobDivBody );
|
||||
|
||||
return lobTable;
|
||||
}
|
||||
else
|
||||
{
|
||||
var $wrapper,
|
||||
$tabla = $(this),
|
||||
tabla = this,
|
||||
contenedor = $(this).parent(),
|
||||
classT = $tabla.attr("class");
|
||||
|
||||
helpers._ObtenerAsignarAnchoAlto($tabla);
|
||||
|
||||
var thead = $tabla.find("thead").clone(),
|
||||
anchotabla = $tabla.width(),
|
||||
tablaTH = $("<table>").attr("class",classT).append(thead),
|
||||
$tablaTHCol = $("<table>").attr("class",classT).append($("<thead>")),
|
||||
$tablaTBCol = $("<table>").attr("class",classT).append($("<tbody>"));
|
||||
|
||||
settings.scrollbarOffset = helpers._OptenerWidthBarraScroll();
|
||||
$tabla.css({'width':anchotabla});
|
||||
|
||||
tablaTH.addClass('fht-table');
|
||||
$tablaTHCol.addClass('fht-table');
|
||||
$tablaTBCol.addClass('fht-table');
|
||||
|
||||
helpers._ClonarHeaderColumnasACongelar($tabla,$tablaTHCol,'thead',settings.Columnas);
|
||||
helpers._ClonarHeaderColumnasACongelar($tabla,$tablaTBCol,'tbody',settings.Columnas);
|
||||
|
||||
if( settings.tfoot)
|
||||
{
|
||||
$tablaTBCol.append($("<tfoot>"));
|
||||
helpers._ClonarHeaderColumnasACongelar($tabla,$tablaTBCol,'tfoot',settings.Columnas);
|
||||
}
|
||||
|
||||
if (!$tabla.closest('.fht-table-wrapper').length)
|
||||
{
|
||||
$tabla.addClass('fht-table');
|
||||
$tabla.wrap('<div class="fht-table-wrapper"></div>');
|
||||
}
|
||||
|
||||
$wrapper = $tabla.closest('.fht-table-wrapper');
|
||||
|
||||
if ( $wrapper.find('.fht-fixed-column').length == 0)
|
||||
{
|
||||
$tabla.wrap('<div class="fht-fixed-body"></div>');
|
||||
$('<div class="fht-fixed-column"></div>').prependTo($wrapper);
|
||||
$fixedBody = $wrapper.find('.fht-fixed-body');
|
||||
}
|
||||
|
||||
$wrapper.css({
|
||||
width: settings.width,
|
||||
height: settings.height
|
||||
});
|
||||
|
||||
if (!$tabla.hasClass('fht-table-init'))
|
||||
{
|
||||
$tabla.wrap('<div class="fht-tbody"><div class="fht-tbody-conten"></div></div>');
|
||||
}
|
||||
|
||||
$tabla.closest('.fht-tbody-conten').css({'width':anchotabla});
|
||||
$divBody = $wrapper.find('div.fht-tbody');
|
||||
|
||||
if (!$tabla.hasClass('fht-table-init'))
|
||||
{
|
||||
|
||||
$divHead = $('<div class="fht-thead"></div>').prependTo($fixedBody).css({'width':anchotabla});
|
||||
|
||||
tablaTH.css({'width':anchotabla});
|
||||
|
||||
$divHead.append(tablaTH).css({'width':anchotabla});
|
||||
}
|
||||
else
|
||||
{
|
||||
$divHead = $wrapper.find('div.fht-thead');
|
||||
}
|
||||
|
||||
$tabla.css({
|
||||
'margin-top': -$tabla.find('thead').outerHeight(true)
|
||||
});
|
||||
|
||||
var tbodyHeight = $wrapper.height() - $divHead.outerHeight(true);
|
||||
|
||||
$divBody.css({
|
||||
'height': tbodyHeight
|
||||
});
|
||||
|
||||
$tabla.addClass('fht-table-init');
|
||||
|
||||
var $fixedColumn = $wrapper.find('.fht-fixed-column');
|
||||
|
||||
var $thead = $('<div class="fht-thead"></div>').append($tablaTHCol),
|
||||
$tbody = $('<div class="fht-tbody"></div>').append($tablaTBCol),
|
||||
$fixedBody = $wrapper.find('.fht-fixed-body'),
|
||||
fixedBodyWidth = $wrapper.width(),
|
||||
fixedBodyHeight = $fixedBody.find('.fht-tbody').outerHeight() - settings.scrollbarOffset;
|
||||
|
||||
$thead.appendTo($fixedColumn);
|
||||
|
||||
var AnchoCol = $thead.find('table').width()+1;
|
||||
|
||||
$thead.find('table').css({'width': AnchoCol,'height':$divHead.outerHeight(true)});
|
||||
$tbody.find('table').css({'width': AnchoCol});
|
||||
|
||||
$tbody.appendTo($fixedColumn).css({
|
||||
'height': fixedBodyHeight+2,
|
||||
'background-color': '#ffffff'
|
||||
});
|
||||
|
||||
$fixedColumn.css({
|
||||
'width': AnchoCol
|
||||
});
|
||||
|
||||
$fixedBody.css({
|
||||
'width': fixedBodyWidth
|
||||
});
|
||||
|
||||
helpers._OnScroll($divBody);
|
||||
|
||||
return tabla;
|
||||
};
|
||||
}
|
||||
};
|
||||
var helpers =
|
||||
{
|
||||
/*
|
||||
* return boolean
|
||||
* valida si el elemento tien un thead y un tbody.
|
||||
*/
|
||||
_EsUnaTabla: function($obj)
|
||||
{
|
||||
var $tabla = $obj,
|
||||
TieneTable = $tabla.is('table'),
|
||||
TieneThead = $tabla.find('thead').length > 0,
|
||||
TieneTbody = $tabla.find('tbody').length > 0;
|
||||
|
||||
if (TieneTable && TieneThead && TieneTbody)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
_ObtenerAsignarAnchoAltoThead: function($obj)
|
||||
{
|
||||
var $lobTable = $obj;
|
||||
|
||||
$lobTable.find("thead tr").each(function()
|
||||
{
|
||||
$(this).find("th").each(function()
|
||||
{
|
||||
if( settings.coloreacelda )
|
||||
$(this).css({'background-color': settings.colorcelda});
|
||||
|
||||
$(this).css({'width':$(this).width(),'height':$(this).height(),'overflow': 'hidden'});
|
||||
});
|
||||
});
|
||||
},
|
||||
_ObtenerAsignarAnchoAlto: function($obj)
|
||||
{
|
||||
var $tabla = $obj,
|
||||
lstTipoThTd = "",
|
||||
lnuCuentaColumnasFila = 1,
|
||||
lnuColumnasFijas = settings.Columnas,
|
||||
lboRowspan = false,
|
||||
lboColspan = false,
|
||||
lboMasColumnas = true,
|
||||
lboFaltaColumnaFila = false,
|
||||
lnuCuantosColspan = 0,
|
||||
lnuCuentaColspan = 0,
|
||||
lnuCuantosRowspan = 0,
|
||||
lnuCuentaRowspan = 0,
|
||||
lnuCuentaRowspanFaltan = 0;
|
||||
|
||||
$tabla.find("tr").each(function(lnuFila)
|
||||
{
|
||||
lstTipoThTd = ( $(this).parent().is('thead') ) ? 'th' : ( $(this).parent().is('tbody') ) ? 'td' : ( $(this).parent().is('tfoot') ) ? 'td' : 'undefined';
|
||||
|
||||
//-- Asignar un identificador a las filas, si no lo tienen.
|
||||
if( $(this).parent().is('tbody') || $(this).parent().is('tfoot') )
|
||||
{
|
||||
lstSigla = ( $(this).parent().is('thead') ) ? 'th' : ( $(this).parent().is('tbody') ) ? 'tb' : ( $(this).parent().is('tfoot') ) ? 'tf' : 'undefined';
|
||||
lstIdTr = lstSigla+lnuFila;
|
||||
|
||||
if( settings.lboHoverTr )
|
||||
if( !$(this).attr("id") )
|
||||
$(this).attr("id",lstIdTr);
|
||||
}
|
||||
|
||||
if ( !lboRowspan )
|
||||
{
|
||||
$(this).find( lstTipoThTd ).each(function(lnuCell)
|
||||
{
|
||||
if ( lnuCuentaColumnasFila <= lnuColumnasFijas )
|
||||
{
|
||||
if ( $(this).attr("rowspan") )
|
||||
{
|
||||
if ( $(this).attr( "colspan" ) )
|
||||
lnuCuentaRowspan = lnuCuentaRowspan-parseInt($(this).attr( "colspan" ))-1;
|
||||
else
|
||||
lnuCuentaRowspan++;
|
||||
|
||||
if( lnuCuantosRowspan < $(this).attr("rowspan") )
|
||||
{
|
||||
lnuCuantosRowspan = $(this).attr("rowspan")-1;
|
||||
lboFaltaColumnaFila = true;
|
||||
}
|
||||
else
|
||||
lboFaltaColumnaFila = true;
|
||||
|
||||
lnuCuentaRowspanFaltan = $(this).attr("rowspan")-1;
|
||||
lboRowspan = true;
|
||||
}
|
||||
|
||||
if ( $(this).attr( "colspan" ) )
|
||||
lnuCuentaColumnasFila += parseInt($(this).attr( "colspan" ));
|
||||
else
|
||||
lnuCuentaColumnasFila++;
|
||||
|
||||
if( settings.coloreacelda )
|
||||
$(this).css({'background-color': settings.colorcelda});
|
||||
|
||||
$(this).css({'width':$(this).width(),'height':$(this).height(),'overflow': 'hidden'});
|
||||
}
|
||||
});
|
||||
|
||||
lnuCuentaColumnasFila = 1;
|
||||
|
||||
if( lboRowspan )
|
||||
lnuCuantosRowspan--;
|
||||
}
|
||||
else
|
||||
{
|
||||
var lnuFaltan = lnuColumnasFijas - lnuCuentaRowspan;
|
||||
lnuCuentaRowspanFaltan--;
|
||||
|
||||
if ( lnuCuantosRowspan-- <= 0 )
|
||||
{
|
||||
lboRowspan = false;
|
||||
lnuCuentaRowspan = 0;
|
||||
|
||||
if( lnuFaltan > 0 )
|
||||
{
|
||||
lnuCuentaColumnasFila3 = 1;
|
||||
lnuColumnasFijas3 = lnuFaltan;
|
||||
|
||||
$(this).find( lstTipoThTd ).each(function(lnuCell)
|
||||
{
|
||||
if ( lnuCuentaColumnasFila3 <= lnuColumnasFijas3 )
|
||||
{
|
||||
if ( $(this).attr( "colspan" ) )
|
||||
lnuCuentaColumnasFila3 += parseInt($(this).attr( "colspan" ));
|
||||
else
|
||||
lnuCuentaColumnasFila3++;
|
||||
|
||||
if( settings.coloreacelda )
|
||||
$(this).css({'background-color': settings.colorcelda});
|
||||
|
||||
$(this).css({'width':$(this).width(),'height':$(this).height(),'overflow': 'hidden'});
|
||||
}
|
||||
});
|
||||
|
||||
lnuCuentaColumnasFila3 = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lnuCuentaColumnasFila2 = 1;
|
||||
lnuColumnasFijas2 = lnuFaltan;
|
||||
|
||||
$(this).find( lstTipoThTd ).each(function(lnuCell)
|
||||
{
|
||||
if ( lnuCuentaColumnasFila2 <= lnuColumnasFijas2 )
|
||||
{
|
||||
if ( $(this).attr( "colspan" ) )
|
||||
lnuCuentaColumnasFila2 += parseInt($(this).attr( "colspan" ));
|
||||
else
|
||||
lnuCuentaColumnasFila2++;
|
||||
|
||||
if( settings.coloreacelda )
|
||||
$(this).css({'background-color': settings.colorcelda});
|
||||
|
||||
$(this).css({'width':$(this).width(),'height':$(this).height(),'overflow': 'hidden'});
|
||||
}
|
||||
});
|
||||
|
||||
lnuCuentaColumnasFila2 = 1;
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
},
|
||||
_ClonarHeaderColumnasACongelar: function($pobTabla,$ponDonde,pstTipoThTbTf,pnuCuantasCols)
|
||||
{
|
||||
var lnuCuentaColumnasFila = 1,
|
||||
lnuColumnasFijas = pnuCuantasCols,
|
||||
lboRowspan = false,
|
||||
lboColspan = false,
|
||||
lboMasColumnas = true,
|
||||
lboFaltaColumnaFila = false,
|
||||
lnuCuantosColspan = 0,
|
||||
lnuCuentaColspan = 0,
|
||||
lnuCuantosRowspan = 0,
|
||||
lnuCuentaRowspan = 0,
|
||||
lnuCuentaRowspanFaltan = 0,
|
||||
$lobTrThTd = $pobTabla.find(pstTipoThTbTf),
|
||||
lstTipoThTd = (pstTipoThTbTf == "thead") ? "th" : (pstTipoThTbTf == "tbody" || pstTipoThTbTf =='tfoot') ? "td" : "td",
|
||||
$lobClonarTrThTd;
|
||||
|
||||
$lobTrThTd.find("tr").each(function(lnuFila)
|
||||
{
|
||||
if( settings.lboHoverTr )// Asignar el evento hover a las filas para marcarlas.
|
||||
if( pstTipoThTbTf =='tbody' || pstTipoThTbTf =='tfoot' )
|
||||
{
|
||||
$(this).hover(
|
||||
function()
|
||||
{
|
||||
lstIdTr = "#"+$(this).attr("id");
|
||||
$(this).css( "background", "rgba(182,227,250,0.6)" );
|
||||
$(lstIdTr).css( "background", "rgba(182,227,250,0.6)" );
|
||||
},
|
||||
function() {
|
||||
lstIdTr = "#"+$(this).attr("id");
|
||||
$(this).css( "background", "" );
|
||||
$(lstIdTr).css( "background", "" );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if ( !lboRowspan )
|
||||
{
|
||||
var tr = $(this).clone(true).html("");
|
||||
|
||||
$(this).find( lstTipoThTd ).each(function(lnuCell)
|
||||
{
|
||||
if ( lnuCuentaColumnasFila <= lnuColumnasFijas )
|
||||
{
|
||||
if ( $(this).attr("rowspan") )
|
||||
{
|
||||
if ( $(this).attr( "colspan" ) )
|
||||
lnuCuentaRowspan = lnuCuentaRowspan-parseInt($(this).attr( "colspan" ))-1;
|
||||
else
|
||||
lnuCuentaRowspan++;
|
||||
|
||||
if( lnuCuantosRowspan < $(this).attr("rowspan") )
|
||||
{
|
||||
lnuCuantosRowspan = $(this).attr("rowspan")-1;
|
||||
lboFaltaColumnaFila = true;
|
||||
}
|
||||
else
|
||||
lboFaltaColumnaFila = true;
|
||||
|
||||
lnuCuentaRowspanFaltan = $(this).attr("rowspan")-1;
|
||||
lboRowspan = true;
|
||||
}
|
||||
|
||||
if ( $(this).attr( "colspan" ) )
|
||||
lnuCuentaColumnasFila += parseInt($(this).attr( "colspan" ));
|
||||
else
|
||||
lnuCuentaColumnasFila++;
|
||||
|
||||
if (lnuCell == 0)
|
||||
{
|
||||
$lobClonarTrThTd = tr.appendTo($ponDonde.find(pstTipoThTbTf));
|
||||
$lobClonarTrThTd.append($(this).clone());
|
||||
}
|
||||
else
|
||||
$lobClonarTrThTd.append($(this).clone());
|
||||
}
|
||||
});
|
||||
|
||||
lnuCuentaColumnasFila = 1;
|
||||
|
||||
if( lboRowspan )
|
||||
lnuCuantosRowspan--;
|
||||
}
|
||||
else
|
||||
{
|
||||
var lnuFaltan = lnuColumnasFijas - lnuCuentaRowspan;
|
||||
lnuCuentaRowspanFaltan--;
|
||||
|
||||
if ( lnuCuantosRowspan-- <= 0 )
|
||||
{
|
||||
lboRowspan = false;
|
||||
lnuCuentaRowspan = 0;
|
||||
|
||||
if( lnuFaltan > 0 )
|
||||
{
|
||||
lnuCuentaColumnasFila3 = 1;
|
||||
lnuColumnasFijas3 = lnuFaltan;
|
||||
var tr = $(this).clone(true).html("");
|
||||
|
||||
$(this).find( lstTipoThTd ).each(function(lnuCell)
|
||||
{
|
||||
if ( lnuCuentaColumnasFila3 <= lnuColumnasFijas3 )
|
||||
{
|
||||
if ( $(this).attr( "colspan" ) )
|
||||
lnuCuentaColumnasFila3 += parseInt($(this).attr( "colspan" ));
|
||||
else
|
||||
lnuCuentaColumnasFila3++;
|
||||
|
||||
if (lnuCell == 0)
|
||||
{
|
||||
$lobClonarTrThTd = tr.appendTo($ponDonde.find(pstTipoThTbTf));
|
||||
$lobClonarTrThTd.append($(this).clone());
|
||||
}
|
||||
else
|
||||
$lobClonarTrThTd.append($(this).clone());
|
||||
}
|
||||
});
|
||||
|
||||
lnuCuentaColumnasFila3 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
var tr = $(this).clone(true).html("");
|
||||
tr.appendTo($ponDonde.find(pstTipoThTbTf));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( lnuFaltan > 0 )
|
||||
{
|
||||
lnuCuentaColumnasFila2 = 1;
|
||||
lnuColumnasFijas2 = lnuFaltan;
|
||||
var tr = $(this).clone(true).html("");
|
||||
|
||||
$(this).find( lstTipoThTd ).each(function(lnuCell)
|
||||
{
|
||||
if ( lnuCuentaColumnasFila2 <= lnuColumnasFijas2 )
|
||||
{
|
||||
if ( $(this).attr( "colspan" ) )
|
||||
lnuCuentaColumnasFila2 += parseInt($(this).attr( "colspan" ));
|
||||
else
|
||||
lnuCuentaColumnasFila2++;
|
||||
|
||||
if (lnuCell == 0)
|
||||
{
|
||||
$lobClonarTrThTd = tr.appendTo($ponDonde.find(pstTipoThTbTf));
|
||||
$lobClonarTrThTd.append($(this).clone());
|
||||
}
|
||||
else
|
||||
$lobClonarTrThTd.append($(this).clone());
|
||||
}
|
||||
});
|
||||
|
||||
lnuCuentaColumnasFila2 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
var tr = $(this).clone(true).html("");
|
||||
tr.appendTo($ponDonde.find(pstTipoThTbTf));
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
},
|
||||
_OnScroll: function($obj)
|
||||
{
|
||||
var $tabla = $obj,
|
||||
$wrapper = $tabla.closest('.fht-table-wrapper'),
|
||||
$thead = $tabla.siblings('.fht-thead');
|
||||
|
||||
$tabla.on('scroll', function()
|
||||
{
|
||||
if( !settings.soloThead )
|
||||
{
|
||||
var $fixedColumns = $wrapper.find('.fht-fixed-column');
|
||||
|
||||
$fixedColumns.find('.fht-tbody table').css({
|
||||
'margin-top': -$tabla.scrollTop()
|
||||
});
|
||||
}
|
||||
|
||||
$thead.find('table').css({
|
||||
'margin-left': -this.scrollLeft
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
_OptenerWidthBarraScroll: function()
|
||||
{
|
||||
var scrollbarWidth = 0;
|
||||
|
||||
if (!scrollbarWidth)
|
||||
{
|
||||
if (/msie/.test(navigator.userAgent.toLowerCase()))
|
||||
{
|
||||
var $textarea1 = $('<textarea cols="10" rows="2"></textarea>').css({ position: 'absolute', top: -1000, left: -1000 }).appendTo('body'),
|
||||
$textarea2 = $('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>').css({ position: 'absolute', top: -1000, left: -1000 }).appendTo('body');
|
||||
|
||||
scrollbarWidth = $textarea1.width() - $textarea2.width() + 2;
|
||||
$textarea1.add($textarea2).remove();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var $div = $('<div />').css({ width: 100, height: 100, overflow: 'auto', position: 'absolute', top: -1000, left: -1000 })
|
||||
.prependTo('body').append('<div />').find('div')
|
||||
.css({ width: '100%', height: 200 });
|
||||
|
||||
scrollbarWidth = 100 - $div.width();
|
||||
$div.parent().remove();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return scrollbarWidth;
|
||||
}
|
||||
};
|
||||
|
||||
if (methods[method])
|
||||
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
else if (typeof method === 'object' || !method)
|
||||
return methods.init.apply(this, arguments);
|
||||
else
|
||||
$.error('El Método "' + method + '" No existe en el plugin CongelarFilaColumna! :( ');
|
||||
|
||||
}
|
||||
})(jQuery);
|
||||
85
assets/tabletoexport/jquery.tableexport.v2.js
Normal file
85
assets/tabletoexport/jquery.tableexport.v2.js
Normal file
@ -0,0 +1,85 @@
|
||||
(function ($) {
|
||||
|
||||
$.fn.tableExport = function (options) {
|
||||
|
||||
var settings = $.extend({}, $.fn.tableExport.defaults, options),
|
||||
rowD = $.fn.tableExport.rowDel, bootstrapClass, bootstrapTheme, bootstrapSpacing;
|
||||
|
||||
if (settings.bootstrap) {
|
||||
bootstrapClass = $.fn.tableExport.bootstrap[0] + " ";
|
||||
bootstrapTheme = $.fn.tableExport.bootstrap[1] + " ";
|
||||
|
||||
} else {
|
||||
bootstrapClass = bootstrapTheme = bootstrapSpacing = "";
|
||||
}
|
||||
|
||||
|
||||
return this.each(function () {
|
||||
var $el = $(this),
|
||||
$rows = settings.headings ? $el.find('tr') : $el.find('tr:has(td)'),
|
||||
fileName = settings.fileName === "id" ? $el.attr('id') : settings.fileName,
|
||||
exporters = {
|
||||
csv: function (rdel, name) {
|
||||
rdel = '"' + rdel + '"';
|
||||
var colD = '"' + $.fn.tableExport.csv.separator + '"',
|
||||
dataURL = 'data:text/csv;charset=utf-8,' +
|
||||
encodeURIComponent('"' + $rows.map(function (i, val) {
|
||||
var $cols = $(val).find('th, td');
|
||||
return $cols.map(function (i, val) {
|
||||
return $(val).text().replace(/"/g, '""')
|
||||
}).get().join(colD);
|
||||
}).get().join(rdel) + '"'),
|
||||
myFile = name + ".csv",
|
||||
myContent = $.fn.tableExport.csv.buttonContent,
|
||||
myClass = $.fn.tableExport.csv.defaultClass;
|
||||
createButton(dataURL, myFile, myContent, myClass);
|
||||
}
|
||||
};
|
||||
|
||||
settings.formats.forEach(
|
||||
function (key) {
|
||||
exporters[key](rowD, fileName);
|
||||
}
|
||||
);
|
||||
|
||||
function checkCaption(exportButton) {
|
||||
var $caption = $el.find('caption:not(.head)');
|
||||
$caption.length ? $caption.append(exportButton) : $el.prepend('<caption class="' + bootstrapSpacing + settings.position + '">' + exportButton + '</caption>');
|
||||
}
|
||||
|
||||
function createButton(dataURL, myFile, myContent, myClass) {
|
||||
var exportButton = "<a href='" + dataURL + "' download='" + myFile + "' role='button' class='" + bootstrapClass + bootstrapTheme + myClass + "'>" + myContent + "</a>";
|
||||
checkCaption(exportButton);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Define the plugin default properties.
|
||||
$.fn.tableExport.defaults = {
|
||||
headings: true, // [Boolean], display table headings (th elements) in the first row, [default: true]
|
||||
formats: ["csv"],
|
||||
fileName: "id", // [id, name, String], filename for the downloaded file, [default: "export"]
|
||||
bootstrap: true, // [String], additional button classes to add, [default: ""]
|
||||
position: "bottom" // [top, bottom], position of the caption element relative to table, [default: "bottom"]
|
||||
};
|
||||
|
||||
|
||||
|
||||
$.fn.tableExport.csv = {
|
||||
defaultClass: "csv",
|
||||
buttonContent: "Excel",
|
||||
separator: ","
|
||||
};
|
||||
|
||||
|
||||
|
||||
$.fn.tableExport.bootstrap = ["btn", "btn-default", "btn-toolbar"];
|
||||
|
||||
$.fn.tableExport.rowDel = "\r\n";
|
||||
|
||||
|
||||
}(jQuery));
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user