I am building a database for generating quotes for a service shop and am struggling with how to handle our flat rates and special rates for customers. There is a fixed list of tasks that are considered a flat rate, stuff like Visual Inspection, Pressure Test, Steam, Sensor Inspection... and so on.
We give discounts to larger customers, which may or may not be a simple "All FlatRates *.25 = Discount" calculation, so I need to be able to override the default rate for each item if required.
These are my tables:
Relationships:
Questions:
1. Do the tables and relationships make sense for this application?
2. If the tables and relationships make sense...how could I structure a form so all entries from tblFlatRates would be listed and all the fields from tblCompanyFlatRates would be shown as well so you could input a special rate for each flat rate?
I am just having a heck of a time conceptualizing this setup for some reason!
We give discounts to larger customers, which may or may not be a simple "All FlatRates *.25 = Discount" calculation, so I need to be able to override the default rate for each item if required.
These are my tables:
- tblCompanies: This table will contain details about each company (e.g., CompanyID, CompanyName).
- tblFlatRates: This table holds the standard or default rates for each service (e.g., FlatRateID, Description, DefaultRate). The FlatRateID is the primary key.
- tblCompanyFlatRates: This table holds CompanyID from tblCompanies and FlatRateID from tblFlatRates. It will also have a field for the special rate.
- tbljncQuoteFlatRate: This table allows the user to add one or more flat rate tasks to the Quote. QuoteFlatRateID is the primary key with QuoteID and FlatRateID as FKs.
- tblQuotes: This is the main table where quotes are stored for each work order. QuoteID is the primary key
Relationships:
- tblCompanies to tblCompanyFlatRates (one-to-many relationship on CompanyID). One company can have many special rates.
- tblFlatRates to tblCompanyFlatRates (one-to-many relationship on FlatRateID). One service can have many special rates (one for each Flat Rate task).
- tblFlatRates to tbljncQuoteFlatRate (one-to-many relationship on FlatRateID). One Quote can have many flat rates (one for each Flat Rate task).
- tblQuotes to tbljncQuoteFlatRate (one-to-many relationship on QuoteID). One Quote can have many flat rates (one for each Flat Rate task).
Questions:
1. Do the tables and relationships make sense for this application?
2. If the tables and relationships make sense...how could I structure a form so all entries from tblFlatRates would be listed and all the fields from tblCompanyFlatRates would be shown as well so you could input a special rate for each flat rate?
I am just having a heck of a time conceptualizing this setup for some reason!