diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php index 66975bd1..161efadd 100755 --- a/application/models/dahsboard_model.php +++ b/application/models/dahsboard_model.php @@ -507,31 +507,68 @@ function totalimportpo () function importbudgt () { - $sql="SELECT ROUND(sum(BudgetAmount),2) as totalimportbudget FROM T_CostCenter_Budget where BudgetType ='IMPORT' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())"; + if (date('m') >= 4) + { + $yearl = date('Y').'-'.(date('Y')+1); + } else { + $yearl = (date('Y')-1).'-'.date('Y'); + } + $ab=$yearl; + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + $sql="SELECT ROUND(sum(BudgetAmount),2) as totalimportbudget FROM T_CostCenter_Budget where BudgetType ='IMPORT' and date(CreatedDate) >= '".$fa."-04-01' and date(CreatedDate) <= '".$aa."-03-31'"; $query = $this->db->query($sql); return $query->result(); } function capitalbud () { - $sql="SELECT sum(BudgetAmount) as totalcapitalbudget FROM T_CostCenter_Budget where BudgetType ='CAPITAL' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW()) "; + if (date('m') >= 4) + { + $yearl = date('Y').'-'.(date('Y')+1); + } else { + $yearl = (date('Y')-1).'-'.date('Y'); + } + $ab=$yearl; + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + $sql="SELECT sum(BudgetAmount) as totalcapitalbudget FROM T_CostCenter_Budget where BudgetType ='CAPITAL' and date(CreatedDate) >= '".$fa."-04-01' and date(CreatedDate) <= '".$aa."-03-31' "; $query = $this->db->query($sql); return $query->result(); } function servicebudgt () { - $sql="SELECT ROUND(sum(BudgetAmount),2) as totalservicebudget FROM T_CostCenter_Budget where BudgetType ='SERVICE' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())"; + if (date('m') >= 4) + { + $yearl = date('Y').'-'.(date('Y')+1); + } else { + $yearl = (date('Y')-1).'-'.date('Y'); + } + $ab=$yearl; + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + $sql="SELECT ROUND(sum(BudgetAmount),2) as totalservicebudget FROM T_CostCenter_Budget where BudgetType ='SERVICE' and date(CreatedDate) >= '".$fa."-04-01' and date(CreatedDate) <= '".$aa."-03-31'"; $query = $this->db->query($sql); return $query->result(); } function revenuebudgt () { - $sql="SELECT ROUND(sum(BudgetAmount),2) as totalrevenuebudget FROM T_CostCenter_Budget where BudgetType ='REVENUE' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())"; + if (date('m') >= 4) + { + $yearl = date('Y').'-'.(date('Y')+1); + } else { + $yearl = (date('Y')-1).'-'.date('Y'); + } + $ab=$yearl; + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + $sql="SELECT ROUND(sum(BudgetAmount),2) as totalrevenuebudget FROM T_CostCenter_Budget where BudgetType ='REVENUE' and date(CreatedDate) >= '".$fa."-04-01' and date(CreatedDate) <= '".$aa."-03-31'"; $query = $this->db->query($sql); return $query->result(); } + function typebal () { if (date('m') >= 4) diff --git a/application/models/monthlypay_model.php b/application/models/monthlypay_model.php index 86859213..a1da02e5 100755 --- a/application/models/monthlypay_model.php +++ b/application/models/monthlypay_model.php @@ -18,6 +18,7 @@ class monthlypay_model extends CI_Model $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->join('T_Loan_Master','T_Monthly_Pay_Inputs.EmpID=T_Loan_Master.EmpID','left'); + $this->db->order_by('T_Employee_Details.EmpID','asc'); $this->db->where('Month_Year',$current); $query = $this->db->get(); @@ -53,7 +54,8 @@ class monthlypay_model extends CI_Model left join T_Attendance on T_Emp_Pay_Data.EmpID = T_Attendance.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_Employee_Details.DateofJoining <= CURRENT_DATE - and month(T_Attendance.Month_Year) = month(?)"; + and month(T_Attendance.Month_Year) = month(?) + order by T_Employee_Details.EmpID"; $query = $this->db->query($sql,array($current)); return $query->result(); @@ -121,6 +123,7 @@ class monthlypay_model extends CI_Model $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->order_by('T_Attendance.EmpID', 'asc'); $this->db->where('Month_Year',$current); $this->db->where('T_Employee_Details.IsActive',1); diff --git a/application/models/payroll_model.php b/application/models/payroll_model.php index 342665ca..ae0946ba 100755 --- a/application/models/payroll_model.php +++ b/application/models/payroll_model.php @@ -197,12 +197,15 @@ class Payroll_model extends CI_Model function getReportforBank($bank,$payon) { + $this->db->distinct(); $this->db->select('Pay.*,Emp.FirstName as FName ,Emp.LastName as Lname,Emp.PANNo as Pan,Emp.BankBranchName as BankName,Emp.IFSCCode as IFSC,Bank.Address as BAddress'); $this->db->from('T_Payroll Pay'); $this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID'); $this->db->join('T_Bank_Details Bank', 'Emp.BankBranchName = Bank.Bank_name'); + $this->db->order_by("Pay.EmpID", "asc"); $this->db->where('Emp.BankBranchName',$bank); $this->db->where('Pay.PayOn',$payon); + $this->db->where('Pay.TotalSalary > 0'); $query = $this->db->get(); return $query->result(); } @@ -210,12 +213,16 @@ class Payroll_model extends CI_Model 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'); - $this->db->from('T_Payroll Pay'); - $this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID'); - $this->db->where('Pay.PayOn',$payon); - $query = $this->db->get(); - return $query->result(); + $this->db->distinct(); + $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'); + $this->db->from('T_Payroll Pay'); + $this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID'); + $this->db->where('Pay.PayOn',$payon); + $this->db->where('Pay.EmployeeESI > 0 '); + $this->db->where('Pay.CompanyESI > 0'); + $this->db->order_by("Pay.EmpID", "asc"); + $query = $this->db->get(); + return $query->result(); } @@ -417,7 +424,7 @@ class Payroll_model extends CI_Model function getCompanyInformation() { - $subQuery = "select CompanyName,replace(Address,',','
') as Address,GSTNO,PAN,ContactNumber,EmailAddress,AlternateContactNumber,companyWebsite,StateCode + $subQuery = "select CompanyName,Address,GSTNO,PAN,ContactNumber,EmailAddress,AlternateContactNumber,companyWebsite,StateCode from T_Company_Details "; $query = $this->db->query($subQuery); //print_r($query->result());die(); diff --git a/application/views/monthlypayinputs.php b/application/views/monthlypayinputs.php index fc771fad..5dd3efcc 100755 --- a/application/views/monthlypayinputs.php +++ b/application/views/monthlypayinputs.php @@ -1,21 +1,10 @@ - + - - - -