Avatar of Johny Bravo
Johny Bravo
 asked on

Sql tables creation

Hello Experts,
I am creating below table , need your help with this

1.IncomeMaster
IncomeId
IncomeName

2.SocietyIncome
SocietyId
IncomeId

3.SocietyIncomeDetails
SocietyIncomeId
IncomeId
SocietyId
Details
MemberId(Not sure if this should be here)
CreationDate

Scenario is that, there are multiple societies. Society 'A' may have some different income sources, society 'B' has some different income.
So I created SocietyIncome table. We need to give admin option to set Income sources for his society.

Now in some Income source, that Income is received by Member or as overall income.
e.g, Maintenance Fee is a memberwise income, need to track which member has paid maintenance
while Renting Society ground for Events is a income by society.

So how should be table formed?
Microsoft SQL Server 2005Microsoft SQL Server 2008Microsoft SQL Server

Avatar of undefined
Last Comment
Johny Bravo

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Kevin Cross

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Jerry Miller

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Scott Pletcher

"Master" is not put in table names -- a table name w/o a suffix is considered a "master" if/when that's appropriate.

It helps to use an underscore (_) between the master tables in a relationship table.

Sorry, I don't have much time now, but here's a start:


Income ( IncomeId, Name, ... )

Society ( SocietyId, Name, Type?, ... )

Member ( MemberId, Name, ... )

-- identifies income sources and expected/scheduled payments, NOT payment details
Society_IncomeSource ( SourceId, SocietyId, IncomeId, CreateDate, PayDate, TotalAmount, ... )

-- identifies actual payment details ONLY, NOT income source nor schedule of payments
Society_IncomeDetails ( SourceId, ReceivedDate, MemberId (may be NULL if N/A), Amount, ... )
Johny Bravo

ASKER
Hi ,
Thanks for the comments. But still I am confused.
Please take a look at my current tables
1.Member
MemberId
MemberName
FlatNo
IsSuperAdmin

2.Society
SocietyId
SocietyName
Address

3.SocietyMembers
SocietyId
MemberId
IsSocietyId

4.IncomeMaster
IncomeId
IncomeName

5.SocietyIncome
SocietyId
IncomeId

6.SocietyIncomeDetails
SocietyIncomeId
IncomeId
SocietyId
Details
MemberId
CreationDate


What I need is, SocietyAdmin for a particular society can set the Income Types for his society.
In SocietyIncomeDetails, the income may be gained by Member and sometimes it is gained as a society  income.In case the income is generated by renting ground, such income will have NULL in SocietyIncomeDetails for that row,
I am going to use Dynamic Data Entities, so just worried if this works fine with this.
Jerry Miller

Where are you determining if the user is a SocietyAdmin? Your query will need to join tables based on SocietyID where SocietyAdmin's SocietyID = to the SocietyIncome.SocietyID
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Lowfatspread

could you take a step back and explain what this is all about ....

1. what do you mean by a society?  (e.g. what is the significance of flat number on the member table?)

2. are you basically assuming this is all about "rental" income , from rooms or equipment?

3. will membership dues  be an income source?

4. can non members be an income source (i think yes because of the null you described)

5. How do you want to deal with recurring income streams (ie hiring rooms for a year...)

6. how will you allow for multiple bookings/payments to be made by a member for several items   (e.g. a room , plus projector, lecturn,  tables/chairs.... and cleaning?)

7. how will the system handle prepayment, re-imburments, discounts for multiple bookings, late-payments,....

8. i get the feeling that there should be some form of associated booking system, and resource / equipment inventory within the system maybe you think thats covered by the incomeid table?  but if so wont you need to have facilities for depreciation and age of the underlying resource.

9. breakages / unavailablity of resource through other causes (e.g. key misplaced)

please help us to understand your actual requirements....
Johny Bravo

ASKER
Hi Lowfatspread,
"Society" is refered to Residential Apartment.
In Residential apartment the income sources are different.
Some income sources like maintenance fees are on monthly/ yearly basis.
So I need to track such income which are made from members.

Other income like if society has a theatre or play ground which is given on rent, then this income is society's income as it is society's property.

So some recurring incomes from member of the society and some income for renting society resources are gathered.

Sometime the income may be received by society if someone sells his falt , then he need to pay some amount to society.

I need to track these income and from which resource this income is generated.
Need to track income amount, date, pending fees( in case of recurring income like monthly fees)

If this information lacks anything please let me know.
Thanks for your time.