I am making an App that requires i save info for an Invoice that concers a building and many suites inside that building. There are several buildings and each building has a different amount of suites.
So the invoice saves this info.
Dumpster Costs, Insurance, Fire, Snow REmovale, Lawn Care, COmments, PropTaxes, Gas, Utilities etc...
The owner of the building gets these bills and then splits it up between the tenants..the tenants are charged a certain percentage of the bill depending on how much of the building they are renting.
I am having trouble figuring out the best way to store this information.
Currently i have the DB layed out like this.
BuildingID
SuiteID
InvoiceNumber
InvoiceDate
Comments
Lawn
Dumpster
Snow
Fire
Gas
Utilities
Insurance
PropTaxes
So if a building has 7 suites i would Insert 7 Lines, 1 for each suite. Like so
BuildingID ,SuiteID,InvoiceNum,InvoiceDate,COmments,Lawn..etc
BuildingID ,SuiteID,InvoiceNum,InvoiceDate,COmments,Lawn..etc
BuildingID ,SuiteID,InvoiceNum,InvoiceDate,COmments,Lawn..etc
BuildingID ,SuiteID,InvoiceNum,InvoiceDate,COmments,Lawn..etc
BuildingID ,SuiteID,InvoiceNum,InvoiceDate,COmments,Lawn..etc
BuildingID ,SuiteID,InvoiceNum,InvoiceDate,COmments,Lawn..etc
BuildingID ,SuiteID,InvoiceNum,InvoiceDate,COmments,Lawn..etc
So I end up duplicating some info. THe buildingID is the same for all suites, THe comments are the same, THe InvoiceNum is the same, The InvoiceDate is the same...But the SuiteNum, and amounts in the LawnCare,Dumpster, Snow etc... are different.
So i can't really think of a better way to lay this DB out.... but i know repeating Info is wrong so does anyone know of a better way to do this?
Also this makes it impossible to add an autoincriment Field, because 7 lines may refer to 1 invoice entry and i would want them to all have the same Index/key value, but if i used an autoincrement field they would have different values.
Thanks!
😃 😃