Skip to content

Commit

Permalink
[fix]本年利润计算问题
Browse files Browse the repository at this point in the history
  • Loading branch information
GoodERPJeff committed Jun 19, 2016
1 parent 2296631 commit c2feb75
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -7,3 +7,5 @@
.DS_Store
*~
*.orig
.vscode
.vscode/*
15 changes: 9 additions & 6 deletions finance/trial_balance.py
Expand Up @@ -120,22 +120,25 @@ def create_trial_balance(self):
this_debit = this_credit = 0
cumulative_occurrence_credit = cumulative_occurrence_debit = 0
subject_name_id = trial_balance.subject_name_id.id
if subject_name_id in trial_balance_dict:

if subject_name_id in trial_balance_dict: #本月有发生额
this_debit = trial_balance_dict[subject_name_id].get('current_occurrence_debit', 0) or 0
this_credit = trial_balance_dict[subject_name_id].get('current_occurrence_credit', 0) or 0

if trial_balance.subject_name_id.balance_directions == 'in':
ending_balance_debit = initial_balance_debit + this_debit - this_credit
else:
ending_balance_credit = initial_balance_credit + this_credit - this_debit
if self.period_id.year == last_period.year:
cumulative_occurrence_credit = this_credit + trial_balance.cumulative_occurrence_credit
cumulative_occurrence_debit = this_debit + trial_balance.cumulative_occurrence_debit
else:
ending_balance_credit = initial_balance_credit
ending_balance_debit = initial_balance_debit
cumulative_occurrence_credit = trial_balance.cumulative_occurrence_credit or 0
cumulative_occurrence_debit = trial_balance.cumulative_occurrence_debit or 0

if self.period_id.year == last_period.year:
cumulative_occurrence_credit = this_credit + trial_balance.cumulative_occurrence_credit
cumulative_occurrence_debit = this_debit + trial_balance.cumulative_occurrence_debit
else:
cumulative_occurrence_credit = this_credit
cumulative_occurrence_debit = this_debit
subject_code = trial_balance.subject_code
trial_balance_dict[subject_name_id] = {
'initial_balance_credit': initial_balance_credit,
Expand Down

0 comments on commit c2feb75

Please sign in to comment.