Initial commit
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[insert_attribute]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[insert_attribute];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[insert_attribute]
|
||||
@name AS NVARCHAR(128),
|
||||
@inserted_attribute_id AS INT = NULL OUTPUT
|
||||
AS
|
||||
BEGIN TRANSACTION;
|
||||
INSERT INTO [Tables].[attributes]([name])
|
||||
VALUES (@name);
|
||||
SET @inserted_attribute_id = SCOPE_IDENTITY();
|
||||
COMMIT TRANSACTION;
|
||||
GO
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[insert_price_history_record]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[insert_price_history_record];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[insert_price_history_record]
|
||||
@product_id AS INT,
|
||||
@datetime AS DATETIME,
|
||||
@price AS MONEY,
|
||||
@inserted_price_history_record_id INT = NULL OUTPUT
|
||||
AS
|
||||
BEGIN TRANSACTION;
|
||||
INSERT INTO [Tables].[price_history_records]([product_id], [datetime], [price])
|
||||
VALUES (@product_id, @datetime, @price);
|
||||
SET @inserted_price_history_record_id = SCOPE_IDENTITY();
|
||||
COMMIT TRANSACTION;
|
||||
GO
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[insert_product_inflow_record]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[insert_product_inflow_record];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[insert_product_inflow_record]
|
||||
@barcode_product_value_id AS INT,
|
||||
@barcode_product_attribute_id AS INT,
|
||||
@supplier_id AS INT,
|
||||
@count AS INT,
|
||||
@full_price AS INT,
|
||||
@datetime AS DATETIME,
|
||||
@inserted_product_inflow_record_id INT = NULL OUTPUT
|
||||
AS
|
||||
BEGIN TRANSACTION;
|
||||
INSERT INTO [Tables].[product_inflow_records]([barcode_product_value_id], [supplier_id], [count], [full_price], [datetime])
|
||||
VALUES (@barcode_product_value_id, @supplier_id, @count, @full_price, @datetime);
|
||||
SET @inserted_product_inflow_record_id = SCOPE_IDENTITY();
|
||||
COMMIT TRANSACTION;
|
||||
GO
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[insert_product_outflow_record]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[insert_product_outflow_record];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[insert_product_outflow_record]
|
||||
@barcode_product_outflow_record_id AS INT,
|
||||
@count AS INT,
|
||||
@datetime AS DATETIME,
|
||||
@inserted_product_outflow_records INT = NULL OUTPUT
|
||||
AS
|
||||
BEGIN TRANSACTION;
|
||||
INSERT INTO [Tables].[product_outflow_records]([barcode_product_value_id], [count], [datetime])
|
||||
VALUES (@barcode_product_outflow_record_id, @count, @datetime);
|
||||
SET @inserted_product_outflow_records = SCOPE_IDENTITY();
|
||||
COMMIT TRANSACTION;
|
||||
GO
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[insert_product_value]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[insert_product_value];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[insert_product_value]
|
||||
@product_id AS INT,
|
||||
@attribute_id AS INT,
|
||||
@value AS NVARCHAR(128),
|
||||
@inserted_product_value_id INT = NULL OUTPUT
|
||||
AS
|
||||
BEGIN TRANSACTION;
|
||||
INSERT INTO [Tables].[product_values]([product_id], [attribute_id], [value])
|
||||
VALUES (@product_id, @attribute_id, @value);
|
||||
SET @inserted_product_value_id = SCOPE_IDENTITY();
|
||||
COMMIT TRANSACTION;
|
||||
GO
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[insert_product_write_off_record]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[insert_product_write_off_record];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[insert_product_write_off_record]
|
||||
@barcode_product_value_id AS INT,
|
||||
@reason_id AS INT,
|
||||
@count AS INT,
|
||||
@datetime AS DATETIME,
|
||||
@inserted_product_write_off_record_id AS INT = NULL OUTPUT
|
||||
AS
|
||||
BEGIN TRANSACTION;
|
||||
INSERT INTO [Tables].[product_write_off_records]([barcode_product_value_id], [reason_id], [count], [datetime])
|
||||
VALUES (@barcode_product_value_id, @reason_id, @count, @datetime);
|
||||
SET @inserted_product_write_off_record_id = SCOPE_IDENTITY();
|
||||
COMMIT TRANSACTION;
|
||||
GO
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[insert_supplier]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[insert_supplier];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[insert_supplier]
|
||||
@name AS NVARCHAR(128),
|
||||
@address AS NVARCHAR(128),
|
||||
@telephone_number AS NVARCHAR(128),
|
||||
@inserted_supplier_id AS INT = NULL OUTPUT
|
||||
AS
|
||||
BEGIN TRANSACTION;
|
||||
INSERT INTO [Tables].[suppliers]([name], [address], [telephone_number])
|
||||
VALUES (@name, @address, @telephone_number);
|
||||
SET @inserted_supplier_id = SCOPE_IDENTITY();
|
||||
COMMIT TRANSACTION;
|
||||
GO
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[insert_write_off_reason]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[insert_write_off_reason];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[insert_write_off_reason]
|
||||
@name AS NVARCHAR(128),
|
||||
@inserted_write_off_reason_id AS INT = NULL OUTPUT
|
||||
AS
|
||||
BEGIN TRANSACTION;
|
||||
INSERT INTO [Tables].[write_off_reasons]([name])
|
||||
VALUES (@name);
|
||||
SET @inserted_write_off_reason_id = SCOPE_IDENTITY();
|
||||
COMMIT TRANSACTION;
|
||||
GO
|
||||
Reference in New Issue
Block a user