<%-# Fedena #Copyright 2010 Foradian Technologies Private Limited # #This product includes software developed at #Project Fedena - http://www.projectfedena.org/ # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, #software distributed under the License is distributed on an #"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY #KIND, either express or implied. See the License for the #specific language governing permissions and limitations #under the License. -%>
<%= image_tag("/images/HR/show_hr.png") %>

<%= t('employee_text') %>

<%= t('department_wise_payslip') %>

<%= link_to_function image_tag("/images/buttons/back.png",:border => 0), "history.back()" %>
<% unless flash[:notice].nil? %>

<%= flash[:notice] %>

<% end %> <% form_for :payslip do |f| %>
<% selected_dept = params[:payslip].blank? ? "" : params[:payslip][:department_id].blank? ? "" : params[:payslip][:department_id] %> <% selected_salary_date = params[:payslip].blank? ? "" : params[:payslip][:salary_date].blank? ? "" : params[:payslip][:salary_date] %>
<%= f.select :department_id, [["#{t('all_departments')}",'All']] + @departments.map { |c| [c.name, c.id] }, {:selected=>selected_dept.to_i,:prompt => "#{t('select_department')}"} %>
<%= f.select :salary_date, @salary_dates.map {|c| [c.salary_date.strftime("%B %Y"),c.salary_date.strftime("%Y-%m-%d")]}, {:selected=>selected_salary_date,:prompt => "#{ t('select_month')}"} %>
<%= submit_tag "► #{t('view')}",:class=>'submit_button' %>
<% end %>
<% if request.post? %> <% if @payslips[:monthly_payslips].present? or @payslips[:individual_payslip_category].present? %> <% grouped_monthly_payslips = @payslips[:monthly_payslips] unless @payslips[:monthly_payslips].blank?%> <% grouped_individual_payslip_categories = @payslips[:individual_payslip_category] unless @payslips[:individual_payslip_category].blank?%> <% total_salary = 0 %> <% total_approved_salary = 0 %> <% total_employees = 0 %> <% i=0 %> <% unless grouped_monthly_payslips.blank? %> <% grouped_monthly_payslips.each do |(empid,payslip)| %> <% if payslip and payslip.first and payslip.first.active_or_archived_employee %> <% grouped_individual_payslip_category = nil %> <% unless grouped_individual_payslip_categories.blank? %> <% grouped_individual_payslip_category = grouped_individual_payslip_categories[empid] unless grouped_individual_payslip_categories[empid].nil? %> <% end %> <% emp_payslip = Employee.calculate_salary(payslip,grouped_individual_payslip_category) %> <% end %> <% total_salary += emp_payslip[:net_amount].to_f unless emp_payslip.nil? %> <% total_approved_salary += emp_payslip[:net_amount].to_f if !emp_payslip.nil? and payslip.first.is_approved %> <% total_employees = i %> <% end %> <% end %>
<%= t('sl_no') %> <%= t('employee_text') %> <%= t('employee_no') %> <%= t('net_salary') %> <%= t('payslip_status') %>
<%= i+=1 %> <%= payslip.first.active_or_archived_employee.full_name %> <%= payslip.first.active_or_archived_employee.employee_number %> <%="%.2f" %emp_payslip[:net_amount] unless emp_payslip.nil? %> <%= payslip.first.status_as_text %> <%= link_to "#{t('view')}",{:action=>"view_employee_payslip",:id=>payslip.first.employee_id,:salary_date=>params[:payslip][:salary_date]} %>
<%= t('total_employees') %>: <%= total_employees %> <%= t('total_salary') %> : <%="%.2f" %total_salary %> <%= t('approved_salary') %>: <%="%.2f" %total_approved_salary %>
<% else %>

<%= t('no_payslip_found') %>

<% end %> <% end %>