Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I'm busy with a website and I don't know how to keep track payments that I receive montly. My hardest problem is how my database structure would be. Right now I'm not really looking for code I just need someone to light up my bulb. Your help would be appreciated.

[Edit - Removed text speak, fixed spelling and grammar]
Posted
Updated 6-Mar-12 4:45am
v2
Comments
wizardzz 6-Mar-12 10:32am    
Well, what part are you stuck on specifically? What have you thought of so far?
Kschuler 6-Mar-12 10:46am    
If your stuck on organizing the database structure, you need to tell us more about that so we can help. How are your tables setup now? What problems are you having with they way they are currently setup?
sparbery 6-Mar-12 11:23am    
well so far i was thinking of saving the name of the person ,date ,and year and the the paymet he made per month im nt quiet sure if its a good idea because in the end i will have to be able to know who paid or did not pay
Kschuler 6-Mar-12 11:26am    
I suggest you have a billing date column and a paid date column. That way if the paid date column is empty you know it hasn't actually been paid yet. Also, if you have a date column you do not need another column to store the year. You have that in the date if you are using a true Date datatype.

You simply need to store the date for each payment; most databases that I'm aware of allow you to calculate the different parts of a date. If your database supports calculated columns, you could have it compute the month part on insert/update and it would give you convenient access to the data.
 
Share this answer
 
Comments
sparbery 6-Mar-12 10:57am    
thats a good idea but for now im just stuck on the idea then ill get to the coding but let me try explain my project, its a investment company where by we capture the members info and from there we organise a monthly payments(installments) and keep track of who paid every month
Just to expand on Pete's correct answer,

Create a payments table, make sure you store the PaymentDate and PaymentValue fields + whatever else you require (who made the payment, payment source, short description etc)

Something like (SQL Server Syntax)

SQL
CREATE TABLE [Payments] (
    [Id] [int] IDENTITY (1, 1) NOT NULL ,
    [PaymentDate] [datetime] NULL ,
    [PaymentValue] [money] NULL ,
    [Description] [varchar] (50),
    [PaidBy] [varchar] (50)
    CONSTRAINT [PK_Payments] PRIMARY KEY  CLUSTERED
    (
        [Id]
    ) WITH  FILLFACTOR = 90  ON [PRIMARY]
) ON [PRIMARY]
GO


This will contain individual payments you receive. You can then write a query that summarises data by month
 
Share this answer
 
Add the GETDATE() as a default value for PaymentDate instead if NULL
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900