Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6061507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:56:44+00:00 2026-05-23T08:56:44+00:00

We have a web-app for tracking periodic payments for a loan, currently we are

  • 0

We have a web-app for tracking periodic payments for a loan, currently we are managing it in a mysql database like this:

loan_payments table with the following columns
[ id, customerId, installmentNo, installmentAmount, penalty, previousOutstanding, totalReceivable, amountReceived ]

receipts table with the following columns
[ id, loan_payments.id (FK), paymentAmount, otherPaymentDetails]

The code flow is as follows:

  1. During creation of new Loan, nrInstallments rows are entered in the loan_payments table for that customer. Assuming there are fixed 10 installments for all customers, 10 rows will be created
  2. For the first row ( installmentNo = 1 ), the penalty and previousOutstanding will be set to 0.
  3. Whenever a new payment is received, the amountReceived is incremented by that amount in the current installment ( installmentNo = 1) and an entry is done in the payments table. *At any give time there is only ONE current installment*
  4. When its time for next installment ( installmentNo = 2) , the previous installment’s [ totalReceivable - amountReceived ] is inserted into the next installment’s ( installmentNo = 2) previousOutstanding. All previous payments/installments are frozen. And intimation is sent to customers indicating, installmentAmount, penalty and previousOutstanding to be paid.
  5. Now all payments will be received against this current installment (installmentNo = 2) and its amountReceived will be incremented whenever a new payment is received.
  6. All penalty calculation will be done against the current installment.

Currently we do not provide update/delete of any payments that does not belong to the current installment.

Everything was working fine, until the client asked for a feature to update/delete previous payments. Following are the problems we will face, if we allow update/delete of previous payments

  • Suppose current installment no is 5, If user updates payment with installment no 2, all the calculation of previousOutstanding and penalty will be wrong. This doesnt make sense since, intimations were already sent to customers.

  • There are lot of reports currently using the previousOutstanding and the penalty columns.

Our queries:

  1. Is it good design to store previousOutstanding and penalty in the database? Or should it be calculated in the code?
  2. How do we redesign the logic/database to allow the following.
    1. Take payment against ANY installmentNo
    2. Allow update/delete of any previous Payment
    3. Flexible penalty calculation. ( Take % from user if required )
    4. Ability to waive off penalty for particular customer for particular installmentNo.
    5. If possible, report showing how much penalty was waived-off for a given customer against which installmentNo. ( If this requirement makes the design complex, we can drop it)
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:56:45+00:00Added an answer on May 23, 2026 at 8:56 am

    An accounting database should be easy to audit, which means it is much better to make it append-only and not edit any old rows. If some columns contain precalculated aggregates, denormalise by dropping them, and put them in a view so your reports still work. The mailings you sent using snapshots of aggregate values should be stored in another append-only table, and since you define these to be snapshots they won’t become inaccurate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web-app with a Java back-end that uses Tomcat jdbc-pool for database
I have another web app, that uses the liferay user database. But before a
So we have this web app where we support UTF8 data. Hooray UTF8. And
I have a web app that runs fine in Visual web developer. But when
I have a web app built with Dojo 1.7.2, using RequireJS to load individual
I have a web app. I am using JSF2 framework. My problem started when
I have a web app, where I keep a subdomain for every client eg:
I have a web app that reads data from a SQL DB that contains
I have a web app that has a big and complex form (fields, checks,
I have a web app game and while in the game I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.