%-# 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. -%>
<%= t('description') %>
<%= t('expense') %>
<%= t('income') %>
<%income_total = 0%>
<%expenses_total = 0%>
<%direct_income=0%>
<%direct_expenses=0%>
<%donations_total=0%>
<%donations_income=0%>
<%donations_expenses=0%>
<%fees_total=0 %>
<%amount = 0%>
<%flag=0%>
<%# @monthly_payslips.each do |m| %>
<%# expenses_total += m.amount.to_i %>
<%# end %>
<% @employees.each do |e| %>
<% expenses_total += e.employee_salary(@start_date,@last_date) %>
<% end %>
<%= link_to t('salary_account') , :action => 'salary_department_year' , :date => @academic_year%>
<%=expenses_total%>
<% @transactions_not_fees.each do |t| %>
<% if t.category.is_income? %>
<%income_total +=t.amount%>
<%direct_income+=t.amount%>
<%else%>
<%expenses_total +=t.amount%>
<%direct_expenses+=t.amount%>
<%end%>
<%end%>
<%= link_to t('direct_expense') , :action => 'direct_expenses_year',:date => @academic_year%>
<%=direct_expenses%>
<%= link_to t('direct_income') , :action => 'direct_income_year',:date => @academic_year%>
<%=direct_income%>
<% @donations.each do |d| %>
<% if d.category.is_income? %>
<%income_total +=d.amount%>
<% donations_income+=d.amount %>
<%else%>
<%expenses_total +=d.amount%>
<% donations_expenses+=d.amount %>
<%end%>
<% @trigger.each do |trigger| %>
<%unless trigger.finance_category.id.nil? %>
<% if d.category_id == trigger.finance_category.id %>
<%expenses_total += (d.amount * (trigger.percentage / 100))%>
<%donations_expenses += (d.amount * (trigger.percentage / 100))%>
<% end %>
<% end %>
<% end %>
<% end %>
<%donations_total=donations_income-donations_expenses %>
<%= link_to t('donations') , :action => 'donations_report_year',:date => @academic_year%>
<%=donations_total%>
<% @transactions_fees.each do |t| %>
<%income_total +=t.amount%>
<%fees_total += t.amount%>
<%end%>
<%= link_to t('fees_text') , :action => 'fees_report_year' , :date => @academic_year%>
<%=fees_total%>
<%= t('total') %>
<%=expenses_total%>
<%=income_total%>
<%= t('grand_total') %>
<%=income_total-expenses_total%>