Plots - PHP Financial System

Asked

Viewed 80 times

2

I am making a financial system, but due to insecurity and ignorance of the subject, I have the following doubt...

Let’s assume that: We have a value of R $ 1299,99 or similar.

What would be the ideal way to divide the plots to register in a BD?

12 installments of R $ 1299,99? (Daria R $ 108,3325)

I would like to store only 2 digits after the comma.

FOLLOWING THE LOGIC OF THE DATABASE:

CREATE TABLE TRANSACAO (
codigo INT AUTO_INCREMENT,
PRIMARY KEY (codigo)
);

CREATE TABLE TRANSACAO_PARCELA (
codigo INT AUTO_INCREMENT,
valor DOUBLE(11,2) NOT NULL,
cod_transacao INT,
FOREIGN KEY(cod_transacao),
PRIMARY KEY (codigo)
);

I would like suggestions or examples of how I can do this procedure.

1 answer

2


Good afternoon, André. It is the following, in our administrative/financial system works as follows:

What would be the ideal way to divide the plots to register in a BD? By dividing a value as mentioned. We used to round down and in the last installment we added the amount that was left to reach the total. Another situation is we always use the term always with the value of 30 days. Which makes the due date shorter in a few months because some months have 31 or 28 days.

In your example above, we use the following situation: 11 installments in the amount of R $ 108,33 and the 12th installment in the amount of R $ 108,36.

I hope I’ve helped

  • Very good, and thank you very much!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.