Updated the SQL script to hold Invoice Numbers as text as this may cause issues using int in c#. Finished the debug Access to SQL code form. Pushing this purely to have the code for reference at another time.

This commit is contained in:
2017-03-22 22:36:51 -05:00
parent f554d37fb1
commit 36fe75d761
2 changed files with 329 additions and 228 deletions
@@ -1,4 +1,4 @@
--File Version: 1.2.0.0 for SQL Server
--File Version: 1.2.1.0 for SQL Server
--Purpose: Creates an empty database template in SQL for the Advertising Profit Control software; master template.
--Notes: This version does not implement any table relationships, its just flat data tables.
-- Currency will be represented with DECIMAL(19,2) as the standard. From stackoverflow:
@@ -9,6 +9,7 @@
--Versions:
-- 1.0.0.0: Initial script version.
-- 1.2.0.0: Changed column names that produced duplicate names when C# code is generated by Entity Framework (i.e. Aditem becomes AdItem1).
-- 1.2.1.0: Changed Invoice Number data type to VARCHAR(256) to reduce the risk of to large of number being used for int32 in C#.
--Create the database called "AdvertisingProfitControl".
CREATE DATABASE AdvertisingProfitControl
@@ -111,7 +112,7 @@ CREATE TABLE Invoices
(
Id INTEGER IDENTITY PRIMARY KEY, --The IDENTITY key word in SQL tells the engine to create a unique number when a record is added.
InvoiceDate DATE NOT NULL,
InvoiceNumber INTEGER NOT NULL,
InvoiceNumber VARCHAR(256) NOT NULL,
InvoiceNetAmountAtCost DECIMAL(19,2),
InvoiceNetAmount DECIMAL(19,2),
InvoiceNote VARCHAR(256),
@@ -165,9 +166,8 @@ CREATE TABLE CostAnalysis
(
Id INTEGER IDENTITY PRIMARY KEY, --The IDENTITY key word in SQL tells the engine to create a unique number when a record is added.
SalesPerManHour DECIMAL(19,2),
--Allows percentages between %1000.00 (10,000 percent) and %0.1235. DECIMAL(x,y) x is the total number of digits
--you want to represent and y is the number of digits to display after the decimal point.
SalaryPercentage DECIMAL(6,6), --The percentage of the manager's salary that was made on this week's sale items.
--DECIMAL(x,y) x is the total number of digits you want to represent and y is the number of digits to display after the decimal point.
SalaryPercentage DECIMAL(19, 2), --The percentage of the manager's salary that was made on this week's sale items.
SalaryDollar DECIMAL(19,2), --
Supplies DECIMAL(19,2), --Total of costs from invoices (?).
FkDateId INTEGER NOT NULL FOREIGN KEY REFERENCES WeekEndingDates(Id)