------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
Hi Sam,
I dug a little deeper into this and see what you’re saying. There is nothing unique about what’s saved in regards to each fee and the transactions in the table.
I see a couple of workarounds for this that may work …
One is you can set up those fees to save to separate unique GL accounts. I know you are not using the GL, but if you can just save it to different accounts, then you can join on those tables since fees and fin_trxn both have the GLCODE_ID saved.
Another is the fee_trxn_detail table does tell you the exact fee_amount for that transaction. It is hacking a bit but can you infer from those amounts saved which amount belongs to which fee, and then when you take the transaction detail from fin_trxn, you can just match the amount you expect to the right fee? Hope that makes sense..
you guys are smart cookies. John, I like your long-term table
redesign proposal. As for the short-term workarounds you suggest:
1) I thought about this too, and joining based on the amount should
work most of the time, unless they have a 2% fee on a $250 loan, which
I think would then break us. That might really happen, or sometimes
they have a $10 fixed fee or different percentages, and may add new
product configurations with different fees in the future, so as
tempting as this approach is it should probably be avoided.
2) Kay, using different GL codes for each fee sounds like a brilliant
workaround, I'm going to try that. Hopefully I don't have to tunnel
underground to avoid any trapdoors, we'll see ;)
thanks much!
I updated my mifosChartOfAccounts.custom.xml in the following way:
<code>
<GLIncomeAccount code="30000" name="INCOME">
<GLAccount code="71" name="Operating Income">
<GLAccount code="7131" name="Loan Interest" />
<GLAccount code="7132" name="Fees Received">
<GLAccount code="7132000" name="Insurance Fee 5" />
<GLAccount code="7132001" name="Insurance Fee 10" />
<GLAccount code="7132002" name="Minimum Fee 30" />
<GLAccount code="7132003" name="Maximum Fee 60" />
<GLAccount code="7132004" name="Maximum Fee 100" />
<GLAccount code="7132005" name="Overdue Principal Fee" />
<GLAccount code="7132006" name="Overdue Interest Fee" />
<GLAccount code="7132007" name="Loan Fee 2" />
<GLAccount code="7132008" name="Loan Fee 2.5" />
<GLAccount code="7132009" name="Loan Fee 3.5" />
</GLAccount>
<GLAccount code="7133" name="Penalties Received" />
</GLAccount>
<GLAccount code="788" name="Rounding" />
</GLIncomeAccount>
</code>
and made sure the value in my mifosBeanConfig.custom.xml under both
actionToDebitAccount and actionToCreditAccount matched the top-level
Fees-Received element:
<code>
<entry key="FEEPOSTING" value="7132"/>
</code>
Then I changed my selenium script that creates the desired fees, using
the following data:
<code>
fee_codes = {
"$5 Insurance Fee":"7132000",
"$10 Insurance Fee":"7132001",
"$30 Minimum Fee":"7132002",
"$60 Maximum Fee":"7132003",
"$100 Maximum Fee":"7132004",
"Overdue Principal":"7132005",
"Overdue Interest":"7132006",
"2% Loan Fee":"7132007",
"2.5% Loan Fee":"7132008",
"3.5% Loan Fee":"7132009",
}
</code>
Then I refreshed my database, started my mifos instance again, ran my
script to populate fees, and then disbursed some test loans.
Amazingly, the FINANCIAL_TRXN.GLCODE_ID column was now being populated
with the correct codes for credit actions. However, for debit actions
it was always populating the code corresponding to 7132009. This
seems like some sort of bug. The first loan I created had a 3.5% fee
and a $5 fee, but for the subsequent test loans I used other fees,
like 2% and $5, or 2.5% and $5. It was consistently using the right
codes for credits, but consistently using 7132009 for debits.
This seems like a bug that perhaps I am the first to stumble into. I
delved into the code and eventually made a change in
FeesAccountingEntry.java. Following the example for credits that
seemed to be working, I replaced
<code>
addAccountEntryDetails(feeTrxn.getFeeAmount(),
finActionFee, getGLcode(finActionFee
.getApplicableDebitCharts()),
FinancialConstants.DEBIT);
</code>
with this
<code>
addAccountEntryDetails(feeTrxn.getFeeAmount(),
finActionFee,
feeTrxn.getAccountFees().getFees().getGlCode(),
FinancialConstants.DEBIT);
</code>
Now it all seems to work, and I have a way to join financial_trxn rows
with their corresponding fees rows.
Phew.
Will you please accept this patch for Mifos?
thanks,
Jeff