Initial commit
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[insert_product]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[insert_product];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[insert_product]
|
||||
@name AS NVARCHAR(128),
|
||||
@product_type_id AS INT,
|
||||
@barcode AS BIGINT,
|
||||
@inserted_product_id AS INT = NULL OUTPUT
|
||||
AS
|
||||
BEGIN TRANSACTION;
|
||||
INSERT INTO [Tables].[products]([barcode], [name], [product_type_id])
|
||||
VALUES(@barcode, @name, @product_type_id);
|
||||
SET @inserted_product_id = SCOPE_IDENTITY();
|
||||
COMMIT TRANSACTION;
|
||||
GO
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[insert_product_attribute]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[insert_product_attribute];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[insert_product_attribute]
|
||||
@product_id AS INT,
|
||||
@attribute_id AS INT
|
||||
AS
|
||||
BEGIN TRANSACTION;
|
||||
INSERT INTO [Tables].[product_attributes]([product_id], [attribute_id])
|
||||
VALUES (@product_id, @attribute_id);
|
||||
COMMIT TRANSACTION;
|
||||
GO
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[insert_product_type]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[insert_product_type];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[insert_product_type]
|
||||
@parent_id AS INT = NULL,
|
||||
@name AS NVARCHAR(128),
|
||||
@inserted_product_type_id AS INT = NULL OUTPUT
|
||||
AS
|
||||
BEGIN TRY
|
||||
INSERT INTO [Tables].[product_types]([parent_id], [name])
|
||||
VALUES(@parent_id, @name);
|
||||
SET @inserted_product_type_id = SCOPE_IDENTITY();
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
DECLARE @message NVARCHAR(128);
|
||||
SET @message =
|
||||
'Cannot create [a] subgroup. Cause: the group '
|
||||
+ '(name: "'+ (SELECT [name] FROM [Tables].[product_types] WHERE [id] = @parent_id) +'"; [id]:'+ LTRIM(STR(@parent_id)) +')'
|
||||
+ ' is referenced by [a] product object.';
|
||||
PRINT 'Actual error number: ' + CAST(ERROR_NUMBER() AS NVARCHAR(10));
|
||||
PRINT 'Actual line number: ' + CAST(ERROR_LINE() AS NVARCHAR(10));
|
||||
THROW 51000, @message, 1;
|
||||
END CATCH
|
||||
GO
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
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)
|
||||
AS
|
||||
BEGIN TRANSACTION;
|
||||
INSERT INTO [Tables].[product_values]([product_id], [attribute_id], [value])
|
||||
VALUES (@product_id, @attribute_id, @value);
|
||||
COMMIT TRANSACTION;
|
||||
GO
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[insert_product]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[insert_product];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[insert_product]
|
||||
@name AS NVARCHAR(128),
|
||||
@product_type_id AS INT,
|
||||
@barcode_attribute_id AS INT,
|
||||
@inserted_product_id AS INT = NULL OUTPUT
|
||||
AS
|
||||
BEGIN TRANSACTION;
|
||||
INSERT INTO [Tables].[products]([barcode], [name], [product_type_id])
|
||||
VALUES(@name, @product_type_id);
|
||||
SET @inserted_product_id = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO [Tables].[product_attributes]([product_id], [attribute_id])
|
||||
VALUES (@inserted_product_id, @barcode_attribute_id);
|
||||
COMMIT TRANSACTION;
|
||||
GO
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[delete_product_type]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[delete_product_type];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[delete_product_type]
|
||||
@product_type_id AS INT
|
||||
AS
|
||||
DECLARE @newParentId INT;
|
||||
SET @newParentId = (
|
||||
SELECT [parent_id]
|
||||
FROM [Tables].[product_types]
|
||||
WHERE [id] = @product_type_id
|
||||
)
|
||||
BEGIN TRANSACTION;
|
||||
UPDATE [Tables].[product_types]
|
||||
SET [parent_id] = @newParentId
|
||||
WHERE [parent_id] = @product_type_id
|
||||
|
||||
DELETE FROM [Tables].[product_types]
|
||||
WHERE [id] = @product_type_id;
|
||||
COMMIT TRANSACTION;
|
||||
GO
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[delete_product]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[delete_product];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[delete_product]
|
||||
@product_id AS INT
|
||||
AS
|
||||
BEGIN TRANSACTION;
|
||||
DELETE FROM [Tables].[product_values]
|
||||
WHERE [product_id] = @product_id;
|
||||
DELETE FROM [Tables].[product_attributes]
|
||||
WHERE [product_id] = @product_id;
|
||||
DELETE FROM [Tables].[products]
|
||||
WHERE [id] = @product_id;
|
||||
COMMIT TRANSACTION;
|
||||
GO
|
||||
+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
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[delete_product_inflow_record]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[delete_product_inflow_record];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[delete_product_inflow_record]
|
||||
@product_inflow_record_id AS INT
|
||||
AS
|
||||
DELETE FROM [Tables].[product_inflow_records]
|
||||
WHERE [id] = @product_inflow_record_id;
|
||||
GO
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[delete_product_type]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[delete_product_type];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[delete_product_type]
|
||||
@product_type_id AS INT
|
||||
AS
|
||||
DELETE FROM [Tables].[product_types]
|
||||
WHERE [id] = @product_type_id;
|
||||
GO
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[delete_product_write_off_record]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[delete_product_write_off_record];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[delete_product_write_off_record]
|
||||
@product_write_off_record_id AS INT
|
||||
AS
|
||||
DELETE FROM [Tables].[product_write_off_records]
|
||||
WHERE [id] = @product_write_off_record_id;
|
||||
GO
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[delete_attribute]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[delete_attribute];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[delete_attribute]
|
||||
@attribute_id AS INT
|
||||
AS
|
||||
DELETE FROM [Tables].[attributes]
|
||||
WHERE [id] = @attribute_id;
|
||||
GO
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[delete_price_history_record]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[delete_price_history_record];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[delete_price_history_record]
|
||||
@price_history_record_id AS INT
|
||||
AS
|
||||
DELETE FROM [Tables].[price_history_records]
|
||||
WHERE [id] = @price_history_record_id;
|
||||
GO
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[delete_product_attribute]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[delete_product_attribute];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[delete_product_attribute]
|
||||
@product_id AS INT,
|
||||
@product_attribute_id AS INT
|
||||
AS
|
||||
DELETE FROM [Tables].[product_attributes]
|
||||
WHERE [product_id] = @product_attribute_id
|
||||
AND [attribute_id] = @product_attribute_id
|
||||
GO
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[delete_product_outflow_record]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[delete_product_outflow_record];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[delete_product_outflow_record]
|
||||
@product_outflow_record_id AS INT
|
||||
AS
|
||||
DELETE FROM [Tables].[product_outflow_records]
|
||||
WHERE [id] = @product_outflow_record_id;
|
||||
GO
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[delete_product_value]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[delete_product_value];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[delete_product_value]
|
||||
@product_value_id AS INT
|
||||
AS
|
||||
DELETE FROM [Tables].[product_values]
|
||||
WHERE [id] = @product_value_id;
|
||||
GO
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[delete_supplier]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[delete_supplier];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[delete_supplier]
|
||||
@supplier_id AS INT
|
||||
AS
|
||||
DELETE FROM [Tables].[suppliers]
|
||||
WHERE [id] = @supplier_id;
|
||||
GO
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[update_attribute]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[update_attribute];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[update_attribute]
|
||||
@attribute_id AS INT,
|
||||
@name AS NVARCHAR(128)
|
||||
AS
|
||||
UPDATE [Tables].[attributes]
|
||||
SET [name] = @name
|
||||
WHERE [id] = @attribute_id;
|
||||
GO
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[update_price_history_record]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[update_price_history_record];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[update_price_history_record]
|
||||
@price_history_record_id AS INT,
|
||||
@product_id AS INT,
|
||||
@datetime AS DATETIME,
|
||||
@price AS MONEY
|
||||
AS
|
||||
UPDATE [Tables].[price_history_records]
|
||||
SET
|
||||
[product_id] = @product_id,
|
||||
[datetime] = @datetime,
|
||||
[price] = @price
|
||||
WHERE [id] = @price_history_record_id;
|
||||
GO
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[update_product]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[update_product];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[update_product]
|
||||
@product_id AS INT,
|
||||
@name AS NVARCHAR(128),
|
||||
@product_type_id AS INT,
|
||||
@barcode_attribute_id AS INT
|
||||
AS
|
||||
UPDATE [Tables].[products]
|
||||
SET
|
||||
[name] = @name,
|
||||
[product_type_id] = @product_type_id
|
||||
WHERE [id] = @product_id;
|
||||
GO
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[update_product_inflow_record]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[update_product_inflow_record];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[update_product_inflow_record]
|
||||
@product_inflow_record_id AS INT,
|
||||
@barcode_product_value_id AS INT,
|
||||
@supplier_id AS INT,
|
||||
@count AS INT,
|
||||
@full_price AS INT,
|
||||
@datetime AS DATETIME
|
||||
AS
|
||||
UPDATE [Tables].[product_inflow_records]
|
||||
SET
|
||||
[barcode_product_value_id] = @barcode_product_value_id,
|
||||
[supplier_id] = @supplier_id,
|
||||
[count] = @count,
|
||||
[full_price] = @full_price,
|
||||
[datetime] = @datetime
|
||||
WHERE [id] = @product_inflow_record_id;
|
||||
GO
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[update_product_outflow_record]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[update_product_outflow_record];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[update_product_outflow_record]
|
||||
@product_outflow_record_id AS INT,
|
||||
@barcode_product_value_record_id AS INT,
|
||||
@count AS INT,
|
||||
@datetime AS INT,
|
||||
@inserted_product_outflow_records AS INT = NULL OUTPUT
|
||||
AS
|
||||
UPDATE [Tables].[product_outflow_records]
|
||||
SET
|
||||
[barcode_product_value_id] = @barcode_product_value_record_id,
|
||||
[count] = @count,
|
||||
[datetime] = @datetime
|
||||
WHERE [id] = @product_outflow_record_id;
|
||||
GO
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[update_product_type]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[update_product_type];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[update_product_type]
|
||||
@product_type_id AS INT,
|
||||
@parent_id AS INT = NULL,
|
||||
@name AS NVARCHAR(128)
|
||||
AS
|
||||
UPDATE [Tables].[product_types]
|
||||
SET
|
||||
[parent_id] = @parent_id,
|
||||
[name] = @name
|
||||
WHERE [id] = @product_type_id;
|
||||
GO
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[update_product_value]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[update_product_value];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[update_product_value]
|
||||
@product_value_id AS INT,
|
||||
@product_id AS INT,
|
||||
@attribute_id AS INT,
|
||||
@value AS NVARCHAR(128)
|
||||
AS
|
||||
UPDATE [Tables].[product_values]
|
||||
SET
|
||||
[product_id] = @product_id,
|
||||
[attribute_id] = @attribute_id,
|
||||
[value] = @value
|
||||
WHERE [id] = @product_value_id;
|
||||
GO
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[update_product_write_off_record]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[update_product_write_off_record];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[update_product_write_off_record]
|
||||
@product_write_off_record_id AS INT,
|
||||
@barcode_product_value_id AS INT,
|
||||
@reason_id AS INT,
|
||||
@count AS INT,
|
||||
@datetime AS DATETIME
|
||||
AS
|
||||
UPDATE [Tables].[product_write_off_records]
|
||||
SET
|
||||
[barcode_product_value_id] = @barcode_product_value_id,
|
||||
[reason_id] = @reason_id,
|
||||
[count] = @count,
|
||||
[datetime] = @datetime
|
||||
WHERE [id] = @product_write_off_record_id;
|
||||
GO
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[update_supplier]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[update_supplier];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[update_supplier]
|
||||
@supplier_id AS INT,
|
||||
@name AS NVARCHAR(128),
|
||||
@address AS NVARCHAR(128),
|
||||
@telephone_number AS NVARCHAR(128)
|
||||
AS
|
||||
UPDATE [Tables].[suppliers]
|
||||
SET
|
||||
[name] = @name,
|
||||
[address] = @address,
|
||||
[telephone_number] = @telephone_number
|
||||
WHERE [id] = @supplier_id;
|
||||
GO
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
USE [Database]
|
||||
|
||||
IF OBJECT_ID('[Procedures].[update_write_off_reason]', 'P') IS NOT NULL
|
||||
DROP PROCEDURE [Procedures].[update_write_off_reason];
|
||||
GO
|
||||
CREATE PROCEDURE [Procedures].[update_write_off_reason]
|
||||
@write_off_reason_id AS INT,
|
||||
@name AS NVARCHAR(128)
|
||||
AS
|
||||
UPDATE [Tables].[write_off_reasons]
|
||||
SET [name] = @name
|
||||
WHERE [id] = @write_off_reason_id;
|
||||
GO
|
||||
Reference in New Issue
Block a user