Skip to content

Commit

Permalink
Update intermediate accoutancy ratio.
Browse files Browse the repository at this point in the history
  • Loading branch information
ionosphere committed Mar 17, 2017
1 parent 6a55b6a commit 220ca7d
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ module Backend
module Cells
class AccountancyBalanceCellsController < Backend::Cells::BaseController
def show
f = FinancialYear.current
f = current_user.current_financial_year
if f
f.compute_balances!
@financial_year = f
@started_on = f.started_on
@stopped_on = f.stopped_on
Expand Down
60 changes: 16 additions & 44 deletions app/views/backend/cells/accountancy_balance_cells/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,58 +1,30 @@
- if @financial_year && Account.french_accounting_system?
:ruby
# get accoutancy ratio in financial_year.sum_entry_items_with_mandatory_line(:ratio, :products)
# operating_margin_on_turnover = ( operating_margin / turnover_value) * 100
product_value = @financial_year.sum_entry_items('7 C !75 C !76 C !77 C !78 C !79 C')
charge_value = @financial_year.sum_entry_items('60 D 61 D 62 D 63 D 64 D !6355 D')
turnover_value = @financial_year.sum_entry_items('7 C !707 C !7086 C !7087 C !7088 C !7097 C !75 C !76 C !77 C !78 C !79 C')
operating_margin = ( product_value - charge_value ) if product_value && charge_value
operating_profit = operating_margin - @financial_year.sum_entry_items('781 791 751 752 753 754 755 758') - @financial_year.sum_entry_items('681 651 653 654 655 658')
operating_margin_on_turnover = ( operating_margin / - turnover_value) * 100 if operating_margin && turnover_value && turnover_value != 0.0

# debts_on_assets = (debts / assets) * 100
financial_debt = @financial_year.sum_entry_items('1641 1642 1643 4553 4554 519, 512 514 517 C, 5186 161 163 165 166 1675 168 17 426, 451 456 458 C')
other_debt = @financial_year.sum_entry_items('401 4031 4081 4088 402 4032 4082, 445 C, 421 422 424 427 4282 4284 4286 431 437 4382 4386 442, 443 444 C, 446 447 4482 4486 457, 4551 4552 C, 269 279 404 405 4084 4196 4197 4198 4419, 452 453 454 461 C, 464, 467 C, 4686, 478 C, 509')
advanced_product = @financial_year.sum_entry_items('487')
debts = financial_debt + other_debt + advanced_product if financial_debt && other_debt && advanced_product
asset = @financial_year.sum_entry_items('109 2 !28 !29')
stock = @financial_year.sum_entry_items('3 !39')
client = @financial_year.sum_entry_items('4091 41, 445 4551 4552 D, 4096 4097 4098 425 4287 4387 441 !4419, 443 444 D, 4487, 451 452 453 454 456 458 461 462 D, 465, 467 D, 4687, 487 D')
portfolio_value = @financial_year.sum_entry_items('502 503 504 505 506 507 508')
bank = @financial_year.sum_entry_items('511, 512 514 D, 515 516, 517 D, 5187 53 54')
advance_charge = @financial_year.sum_entry_items('486 481 476')
assets = asset + stock + client + portfolio_value + bank + advance_charge if asset && stock && client && portfolio_value && bank && advance_charge
debts_on_assets = 0.0
debts_on_assets = (- debts / assets) * 100 if debts && assets && assets != 0.0
# liquid_assets_on_turnover = (liquid_assets / turnover_value) * 100
liquid_assets_on_turnover = (-bank / turnover_value) * 100 if bank && turnover_value && turnover_value != 0.0



production_sales = @financial_year.sum_entry_items_with_mandatory_line(:ratio, :production_sales)
production_purchases = @financial_year.sum_entry_items_with_mandatory_line(:ratio, :production_purchases)
added_value = @financial_year.sum_entry_items_with_mandatory_line(:ratio, :added_value)
operating_margin = @financial_year.sum_entry_items_with_mandatory_line(:ratio, :operating_margin)

= infos do
- if product_value
- if production_sales
.big-info
%span.title= :product_value.tl(financial_year: @financial_year.name)
%span.value= product_value.l(currency: Preference[:currency])
- if charge_value
%span.value= production_sales.l(currency: Preference[:currency])
- if production_purchases
.big-info
%span.title= :charge_value.tl(financial_year: @financial_year.name)
%span.value= charge_value.l(currency: Preference[:currency])
%span.value= production_purchases.l(currency: Preference[:currency])
- if added_value
.big-info{class: (added_value > 0 ? :positive : added_value < 0 ? :negative : :caution)}
%span.title= :added_value.tl(financial_year: @financial_year.name)
%span.value= added_value.l(currency: Preference[:currency])
- if operating_margin
.big-info{class: (operating_margin > 0 ? :positive : operating_margin < 0 ? :negative : :caution)}
%span.title= :operating_margin.tl(financial_year: @financial_year.name)
%span.value= operating_margin.l(currency: Preference[:currency])
- if operating_margin_on_turnover
.big-info{class: (operating_margin_on_turnover > 30 ? :positive : operating_margin_on_turnover < 10 ? :negative : :caution)}
%span.title= :operating_margin_on_turnover.tl(financial_year: @financial_year.name)
%span.value= operating_margin_on_turnover.round(2)
- if operating_profit
.big-info
%span.title= :operating_profit.tl(financial_year: @financial_year.name)
%span.value= operating_profit.l(currency: Preference[:currency])
- if bank
.big-info{class: (debts_on_assets > 0 ? :positive : debts_on_assets < 0 ? :negative : :caution)}
%span.title= :debts_on_assets.tl(financial_year: @financial_year.name)
%span.value= debts_on_assets.round(2)
- if liquid_assets_on_turnover
.big-info{class: (liquid_assets_on_turnover > 0 ? :positive : liquid_assets_on_turnover < 0 ? :negative : :caution)}
%span.title= :liquid_assets_on_turnover.tl(financial_year: @financial_year.name)
%span.value= liquid_assets_on_turnover.round(2)
- else
= no_data
18 changes: 18 additions & 0 deletions config/accoutancy_mandatory_documents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ fr_pcga:
exceptional_expenses: '67 687 D'
employee_involvement: '691 D'
profit_taxe: '695 697 699 D'
ratio:
merchandise_sales: '707 C, - 7097 D'
merchandise_purchases: '607 D, - 6097 C, 6037 D'
commercial_margin: '707 C, - 7097 D, - 607 D, 6097 C, - 6037 D'
production_sales: '70 C, !707 !7097, 71 72 73 C'
production_purchases: '601 602 D, - 603 C, 604 605 606 607 608 609 61 62 D'
added_value: '707 C, - 7097 D, - 607 D, 6097 C, - 6037 D, 70 C, !707 !7097, 71 72 73 C, - 601 602 D, 603 C, - 604 605 606 607 608 609 61 62 D'
taxes_and_wages: '63 64 D'
operating_margin: '707 C, - 7097 D, - 607 D, 6097 C, - 6037 D, 70 C, !707 !7097, 71 72 73 C, - 601 602 D, 603 C, - 604 605 606 607 608 609 61 62 D, 74 C, - 63 64 D'
balance_sheet:
unsubcribed_capital: '109'
incorporeal_assets: '20 237'
Expand Down Expand Up @@ -101,6 +110,15 @@ fr_pcg82:
exceptional_expenses: '67 687 D'
employee_involvement: '691 D'
profit_taxe: '695 697 699 D'
ratio:
merchandise_sales: '707 C, - 7097 D'
merchandise_purchases: '607 D, - 6097 C, 6037 D'
commercial_margin: '707 C, - 7097 D, - 607 D, 6097 C, - 6037 D'
production_sales: '70 C, !707 !7097, 71 72 73 C'
production_purchases: '601 602 D, - 603 C, 604 605 606 607 608 609 61 62 D'
added_value: '707 C, - 7097 D, - 607 D, 6097 C, - 6037 D, 70 C, !707 !7097, 71 72 73 C, - 601 602 D, 603 C, - 604 605 606 607 608 609 61 62 D'
taxes_and_wages: '63 64 D'
operating_margin: '707 C, - 7097 D, - 607 D, 6097 C, - 6037 D, 70 C, !707 !7097, 71 72 73 C, - 601 602 D, 603 C, - 604 605 606 607 608 609 61 62 D, 74 C, - 63 64 D'
balance_sheet:
unsubcribed_capital: '109'
incorporeal_assets: '20'
Expand Down
Loading

0 comments on commit 220ca7d

Please sign in to comment.