How to fix this logic? - sql-server

i have a query with 3 variable tables: #result, #order and #stock.
the logic is the stock qty must be allocated by lotsize (here i set=1) to all order based on priority (FIFO). the stock qty must be allocated till zero and the allocateqty must <= orderqty. the problem is one of orders, its allocateqty is over orderqty (priority=7) while other are correct.
DECLARE #RESULT TABLE (priority int,partcode nvarchar(50),orderqty int, runningstock int, allocateqty int)
DECLARE #ORDER TABLE(priority int,partcode nvarchar(50),orderqty int)
DECLARE #STOCK TABLE(partcode nvarchar(50),stockqty int)
INSERT INTO #ORDER (priority,partcode,orderqty)
VALUES (1,'A',10),
(2,'A',50),
(3,'A',10),
(4,'A',40),
(5,'A',3),
(6,'A',5),
(7,'A',11),
(8,'A',10),
(9,'A',10),
(10,'A',10);
INSERT INTO #STOCK(partcode,stockqty)
VALUES('A',120)
IF (SELECT SUM(orderqty)FROM #ORDER)<(SELECT stockqty FROM #STOCK)
BEGIN
INSERT INTO #RESULT(priority,partcode,orderqty,allocateqty)
SELECT priority, partcode,orderqty,orderqty
FROM #ORDER
END
ELSE
BEGIN
DECLARE #allocatedqty int = 0
DECLARE #Lotsize int=1
DECLARE #allocateqty int = #Lotsize
DECLARE #runningstock int = (SELECT stockqty FROM #stock)
WHILE #runningstock>=0
BEGIN
DECLARE #priority int
SELECT TOP 1 #priority = priority FROM #order ORDER BY priority ASC
WHILE #priority <= (SELECT MAX(priority) FROM #order)
BEGIN
DECLARE #orderqty int
SELECT #orderqty = orderqty - #allocatedqty FROM #order WHERE priority = #priority
SELECT #allocateqty = CASE WHEN #runningstock > 0 AND #orderqty > 0 THEN #Lotsize ELSE 0 END
INSERT INTO #RESULT(priority,partcode,orderqty,runningstock,allocateqty)
SELECT #priority,
partcode,
CASE WHEN #orderqty >= 0 THEN #orderqty ELSE 0 END AS orderqty,
#runningstock,
#allocateqty
FROM #order
WHERE priority = #priority
SET #priority += 1
SET #runningstock = #runningstock - #allocateqty
END
SET #allocatedqty += #allocateqty
IF (#runningstock <= 0) BREAK
END
END
select * from #RESULT where priority=7;
SELECT priority,
sum(allocateqty) as allocated
from #RESULT
group by priority
the result:

my reputation not reach 50 so cant add comment.
you said your other order is correct then priority = 7 is also correct. you can compare priority 2 and 4 with 7. its the same thing. i think all of your loop for orderqty only reach 10 times where priority 7 got 11 so it will left 1.
Either everything is correct or everything is wrong =x
EDIT:
Hi, I found the answer.
Change
SET #allocatedqty += #allocateqty
to
SET #allocatedqty += 1
because when using SET #allocatedqty += #allocateqty, the last order #allocateqty is 0 then it will always make #allocatedqty = 0 then it will not increase.
Hope this really help you.
EDIT based on #Jesuraja given answer it should be:
SET #allocatedqty += #Lotsize

As I'm not quite sure what you try to achieve with records which will set your stock to 0 or beyond I just can provide this. But it is much better than to run all your orders in a loop. Maybe you'll want to replace your loop.
DECLARE #RESULT TABLE (priority int,partcode nvarchar(50),orderqty int, runningstock int, allocateqty int)
DECLARE #ORDER TABLE(priority int,partcode nvarchar(50),orderqty int)
DECLARE #STOCK TABLE(partcode nvarchar(50),stockqty int)
INSERT INTO #ORDER (priority,partcode,orderqty)
--VALUES (1,'A',10),(2,'A',50),(3,'A',10),(4,'A',40),(5,'A',3),(6,'A',5),(7,'A',11),(8,'A',10),(9,'A',10),(10,'A',10); --your orders
VALUES (1,'A',1),(2,'A',2),(3,'A',3),(4,'A',4),(5,'A',5),(6,'A',6),(7,'A',7),(8,'A',8),(9,'A',9),(10,'A',10);
INSERT INTO #STOCK(partcode,stockqty)
--VALUES('A',50) -- your stock
VALUES('A',50)
IF (SELECT SUM(orderqty) FROM #ORDER)<(SELECT stockqty FROM #STOCK)
BEGIN
INSERT INTO #RESULT(priority,partcode,orderqty,allocateqty)
SELECT priority, partcode,orderqty,orderqty
FROM #ORDER
END
ELSE
BEGIN
;WITH dat AS(
SELECT s.partcode, s.stockqty, o.priority, o.orderqty,
ROW_NUMBER() OVER(PARTITION BY s.partcode ORDER BY o.priority DESC) as runningOrder
FROM #Stock as s
INNER JOIN #ORDER as o
ON s.partcode = o.partcode
)
INSERT INTO #RESULT(priority,partcode,orderqty,runningstock,allocateqty)
SELECT d1.priority, d1.partcode, d1.orderqty,
d1.stockqty - SUM(d2.orderqty) OVER(PARTITION BY d1.runningOrder) as runningstock,
CASE WHEN d1.stockqty - SUM(d2.orderqty) OVER(PARTITION BY d1.runningOrder) > 0 AND d1.orderqty > 0 THEN 1 ELSE 0 END
FROM dat as d1
INNER JOIN dat as d2
ON d1.partcode = d2.partcode
AND d1.runningOrder >= d2.runningOrder
END
select * from #RESULT where priority=7;
SELECT priority,
sum(allocateqty) as allocated
from #RESULT
group by priority

Related

how to call function inside a trigger?

what is the problem with the #temp variable?
create function dbo.getNumOfReviews2 (#email varchar(40))
returns int
as begin
declare #numOfReviews int
select #numOfReviews = count(*)
from dbo.Reviews
where email = #email
group by Email
return #numOfReviews
end
CREATE TRIGGER setDiscount
ON dbo.[Contains]
FOR INSERT
AS
DECLARE #OrderID int
DECLARE #ProductID int
DECLARE #Size VarChar(15)
DECLARE #temp int
IF CURSOR_STATUS('global','C_CURSOR')>=-1
BEGIN
DEALLOCATE C_CURSOR
END
DECLARE C_CURSOR CURSOR
FOR SELECT ProductID,OrderID,Size
FROM INSERTED
BEGIN
OPEN C_CURSOR
FETCH NEXT FROM C_CURSOR INTO #ProductID,#OrderID,#Size
WHILE (##FETCH_STATUS=0)
BEGIN
#temp = dbo.getNumOfReviews2(select BillingEmail from dbo.Orders where OrderID=#OrderID)
IF (SELECT COUNT(*)
FROM dbo.[Contains]
WHERE OrderID = #OrderID) > 5 or (SELECT sum(Quantity) FROM dbo.[Contains] WHERE OrderID=#OrderID) > 10 or
( #temp )> 5
UPDATE [Contains]
SET [Savings%] = [Savings%] + 0.05
WHERE OrderID = #OrderID and ProductID = #ProductID and Size = #Size
FETCH NEXT FROM C_CURSOR INTO #ProductID,#OrderID,#Size
END
END
Use select to call scalar function
correct way to do this would be
select #temp = dbo.getNumOfReviews2(BillingEmail)
from dbo.Orders
where OrderID=#OrderID
Note: It is not advisable to write big logic inside a trigger. Triggers should be simple and fast otherwise your DML operations will be slow. Moreover you have used a CURSOR which should be avoided at any cost. Rewrite the code using SET based approach.
Here is a SET based approach code
;WITH cte
AS (SELECT c1.orderid
FROM dbo.[contains] c1
INNER JOIN inserted i1
ON i1.orderid = c1.orderid
GROUP BY orderid
HAVING Count(*) > 5
OR Sum(quantity) > 5
OR #temp > 5)
UPDATE C
SET [savings%] = [savings%] + 0.05
FROM [contains] C
INNER JOIN inserted I
ON I.orderid = C.orderid
AND I.productid = C.productid
AND I.size = C.size
AND EXISTS (SELECT 1
FROM cte c1
WHERE c1.orderid = c.orderid)
CREATE OR REPLACE COVID19VMS_VACCINESHOT_T1
BEFORE INSERT OR UPDATE ON VACCINENEXTSHOTDATE
FOR EACH ROW
BEGIN
IF :NEW.VACCINESHOTDATE := 1
:NEW.VACCINEXTSHOTDATE := to_date(VACCINESHOTDATE +28)
END IF;
IF :NEW.VACCINESHOTDATE :=2
:NEW.VACCINENEXTSHOTDATE IS NULL
END IF
END

Updating Next_ID column

I have the following table:
VehicleID Reg_ID Next_RegID EntryDate
330034 9111 NULL 2010-12-06 00:00:00
330034 9113 NULL 2010-12-09 00:00:00
On the first row I need to update the Next_RegId column with the Reg_ID of the second row where VehicleId or (VIN/ChassisNumber) is the same. The Next_RegID column on the last entry should remain Null.
I've created a while loop procedure which works perfectly, but with millions of records in the table it takes ages to complete. Therefore, I was wondering if any of you dealt with this kind of a problem and have a solution for it.
Here's the procedure I wrote, and thanks in advance for all your help:
Declare #i as integer;
Declare #x as integer;
Declare #y as integer
Set #i= (Select Max(RID) from TempRegistration)
Set #x= 0
Set #y= 1
Declare #curChassis as nvarchar(100)
Declare #nextChassis as nvarchar(100)
While (#x <= #i)
Begin
set #curChassis = (Select ChassisNumber from TempRegistration where RID = #x)
set #nextChassis = (Select ChassisNumber from TempRegistration where RID = #y)
If (#curChassis = #nextChassis)
Begin
Update Registration set NextRegistrationId = (Select RegistrationId from TempRegistration where RID = #y)
Where RegistrationId = (Select RegistrationId from TempRegistration where RID = #x)
End
Set #x = #x + 1
Set #y = #y + 1
Print(#x)
End
TempRegistration is a temporary table I've created to assign a row_id which guides the while loop to assign the Reg_ID to the Next_RegId on the previous row.
This can be done with one UPDATE query. You haven't mentioned your RDBMS so...
For MSSQL:
Update Registration as t1
set NextRegistrationId = (Select TOP 1 RegistrationId
from Registration
where RID = t1.RID
and EntryDate>t1.EntryDate
order by EntryDate DESC)
For MySQL
Update Registration as t1
set NextRegistrationId = (Select RegistrationId
from Registration
where RID = t1.RID
and EntryDate>t1.EntryDate
order by EntryDate DESC
LIMIT 1)
If RID's are increasing with EntryDate then
Update Registration as t1
set NextRegistrationId = (Select MIN(RegistrationId)
from Registration
where RID = t1.RID
and EntryDate>t1.EntryDate
)
Tested and it seems to be working but this version uses a CTE (SQL Server)
with RegDetails as
(
select VehicleID, Reg_ID, ROW_NUMBER() OVER(PARTITION BY VehicleID ORDER BY EntryDate) AS ROWNUMBER
FROM dbo.Vehicle)
UPDATE a SET a.Next_RegID = b.Reg_ID
FROM RegDetails b
INNER JOIN dbo.Vehicle a ON (a.VehicleID = b.VehicleID)
WHERE b.ROWNUMBER = 2 and a.Next_RegID IS NULL and a.Reg_ID != b.Reg_ID

How to make this sql query

I have 2 SQL Server tables with the following structure
Turns-time
cod_turn (PrimaryKey)
time (datetime)
Taken turns
cod_taken_turn (Primary Key)
cod_turn
...
and several other fields which are irrelevant to the problem. I cant alter the table structures because the app was made by someone else.
given a numeric variable parameter, which we will assume to be "3" for this example, and a given time, I need to create a query which looking from that time on, it looks the first 3 consecutive records by time which are not marked as "taken". For example:
For example, for these turns, starting by the time of "8:00" chosen by the user
8:00 (not taken)
9:00 (not taken)
10:00 (taken)
11:00 (not taken)
12:00 (not taken)
13:00 (not taken)
14:00 (taken)
The query it would have to list
11:00
12:00
13:00
I cant figure out how to make the query in pure sql, if possible.
with a cursor
declare #GivenTime datetime,
#GivenSequence int;
select #GivenTime = cast('08:00' as datetime),
#GivenSequence = 3;
declare #sequence int,
#code_turn int,
#time datetime,
#taked int,
#firstTimeInSequence datetime;
set #sequence = 0;
declare turnCursor cursor FAST_FORWARD for
select turn.cod_turn, turn.[time], taken.cod_taken_turn
from [Turns-time] as turn
left join [Taken turns] as taken on turn.cod_turn = taken.cod_turn
where turn.[time] >= #GivenTime
order by turn.[time] asc;
open turnCursor;
fetch next from turnCursor into #code_turn, #time, #taked;
while ##fetch_status = 0 AND #sequence < #GivenSequence
begin
if #taked IS NULL
select #firstTimeInSequence = coalesce(#firstTimeInSequence, #time)
,#sequence = #sequence + 1;
else
select #sequence = 0,
#firstTimeInSequence = null;
fetch next from turnCursor into #code_turn, #time, #taked;
end
close turnCursor;
deallocate turnCursor;
if #sequence = #GivenSequence
select top (#GivenSequence) * from [Turns-time] where [time] >= #firstTimeInSequence
order by [time] asc
WITH Base AS (
SELECT *,
CASE WHEN EXISTS(
SELECT *
FROM Taken_turns taken
WHERE taken.cod_turn = turns.cod_turn) THEN 1 ELSE 0 END AS taken
FROM [Turns-time] turns)
, RecursiveCTE As (
SELECT TOP 1 cod_turn, [time], taken AS run, 0 AS grp
FROM Base
WHERE [time] >= #start_time
ORDER BY [time]
UNION ALL
SELECT R.cod_turn, R.[time], R.run, R.grp
FROM (
SELECT T.*,
CASE WHEN T.taken = 0 THEN 0 ELSE run+1 END AS run,
CASE WHEN T.taken = 0 THEN grp + 1 ELSE grp END AS grp,
rn = ROW_NUMBER() OVER (ORDER BY T.[time])
FROM Base T
JOIN RecursiveCTE R
ON R.[time] < T.[time]
) R
WHERE R.rn = 1 AND run < #run_length
), T AS(
SELECT *,
MAX(grp) OVER () AS FinalGroup,
COUNT(*) OVER (PARTITION BY grp) AS group_size
FROM RecursiveCTE
)
SELECT cod_turn,time
FROM T
WHERE grp=FinalGroup AND group_size=#run_length
I think there is not a simple way to achieve this.
But probably there are many complex ways :). This is an approach that should work in Transact-SQL:
CREATE TABLE #CONSECUTIVE_TURNS (id int identity, time datetime, consecutive int)
INSERT INTO #CONSECUTIVE_TURNS (time, consecutive, 0)
SELECT cod_turn
, time
, 0
FROM Turns-time
ORDER BY time
DECLARE #i int
#n int
SET #i = 0
SET #n = 3 -- Number of consecutive not taken records
while (#i < #n) begin
UPDATE #CONSECUTIVE_TURNS
SET consecutive = consecutive + 1
WHERE not exists (SELECT 1
FROM Taken-turns
WHERE id = cod_turn + #i
)
SET #i = #i + 1
end
DECLARE #firstElement int
SELECT #firstElement = min(id)
FROM #CONSECUTIVE_TURNS
WHERE consecutive >= #n
SELECT *
FROM #CONSECUTIVE_TURNS
WHERE id between #firstElement
and #firstElement + #n - 1
This is untested but I think it will work.
Pure SQL
SELECT TOP 3 time FROM [turns-time] WHERE time >= (
-- get first result of the 3 consecutive results
SELECT TOP 1 time AS first_result
FROM [turns-time] tt
-- start from given time, which is 8:00 in this case
WHERE time >= '08:00'
-- turn is not taken
AND cod_turn NOT IN (SELECT cod_turn FROM taken_turns)
-- 3 consecutive turns from current turn are not taken
AND (
SELECT COUNT(*) FROM
(
SELECT TOP 3 cod_turn AS selected_turn FROM [turns-time] tt2 WHERE tt2.time >= tt.time
GROUP BY cod_turn ORDER BY tt2.time
) AS temp
WHERE selected_turn NOT IN (SELECT cod_turn FROM taken_turns)) = 3
) ORDER BY time
Note: I tested it on Postgresql (with some code modification), but not MS SQL Server. I'm not sure about performance compared to T-SQL.
Another set-based solution (tested):
DECLARE #Results TABLE
(
cod_turn INT NOT NULL
,[status] TINYINT NOT NULL
,RowNumber INT PRIMARY KEY
);
INSERT #Results (cod_turn, [status], RowNumber)
SELECT a.cod_turn
,CASE WHEN b.cod_turn IS NULL THEN 1 ELSE 0 END [status] --1=(not taken), 0=(taken)
,ROW_NUMBER() OVER(ORDER BY a.[time]) AS RowNumber
FROM [Turns-time] a
LEFT JOIN [Taken_turns] b ON a.cod_turn = b.cod_turn
WHERE a.[time] >= #Start;
--SELECT * FROM #Results r ORDER BY r.RowNumber;
SELECT *
FROM
(
SELECT TOP(1) ca.LastRowNumber
FROM #Results a
CROSS APPLY
(
SELECT SUM(c.status) CountNotTaken, MAX(c.RowNumber) LastRowNumber
FROM
(
SELECT TOP(#Len)
b.RowNumber, b.[status]
FROM #Results b
WHERE b.RowNumber <= a.RowNumber
ORDER BY b.RowNumber DESC
) c
) ca
WHERE ca.CountNotTaken = #Len
ORDER BY a.RowNumber ASC
) x INNER JOIN #Results y ON x.LastRowNumber - #Len + 1 <= y.RowNumber AND y.RowNumber <= x.LastRowNumber;

SQL text wrapping

Hello and good afternoon. I am facing an issue with the system i support. I am able to build "Macros" which can pull sql views to a document. The issue is that the columns for these views do not wrap on the document. If a certain row contains too much text, it will push the other columns out of line. To resolve this i am trying to build a function to use with my view that will sort of brute force the wrap by looping through each row and creating an additional row to hold text for certain columns where the text limit was reached. I have something that works, but it's terribly slow at times. Does anyone have any ideas on how i can optimize this?
(
)
RETURNS #medlist2 TABLE (uniq_id UNIQUEIDENTIFIER, enterprise_id CHAR(5), practice_id CHAR (4), person_id UNIQUEIDENTIFIER,
enc_id UNIQUEIDENTIFIER, medication_name VARCHAR (70), sig_desc VARCHAR (512), start_date VARCHAR(10), row_num INT)
AS
BEGIN
DECLARE #medlist TABLE (uniq_id UNIQUEIDENTIFIER, enterprise_id CHAR (5), practice_id CHAR (4), person_id UNIQUEIDENTIFIER,
enc_id UNIQUEIDENTIFIER, medication_name VARCHAR (70), sig_desc VARCHAR (512), start_date DATETIME, processed INT)
DECLARE #medicationName VARCHAR (70)
DECLARE #sigDesc VARCHAR (512)
DECLARE #startDate VARCHAR (10)
DECLARE #uniqID UNIQUEIDENTIFIER
DECLARE #enterpriseID CHAR (5)
DECLARE #practiceID CHAR (4)
DECLARE #personID UNIQUEIDENTIFIER
DECLARE #encID UNIQUEIDENTIFIER
DECLARE #RowNum INT
DECLARE #RowCount INT
INSERT INTO #medlist (uniq_id, enterprise_id, practice_id, person_id,
enc_id, medication_name, sig_desc, start_date, processed)
SELECT uniq_id, enterprise_id, practice_id, person_id,
enc_id, medication_name, sig_desc, start_date, 0
FROM med_table
WHERE person_id IN (select distinct person_id from active_users where create_timestamp > GETDATE()-.2)
AND date_stopped = ''
ORDER BY medication_name
SET #RowCount = (SELECT COUNT(*) FROM #medlist WHERE processed = 0)
SET #RowNum = 0
WHILE #RowCount > 0
BEGIN
SET #RowNum = #RowNum + 1
SELECT TOP(1) #uniqid = uniq_id, #enterpriseID = enterprise_id, #practiceID = practice_id,
#personID = person_id, #encID = enc_id, #medicationName = '- ' +medication_name, #sigDesc = sig_desc,
#startDate = CONVERT(VARCHAR(10), start_date, 101)
FROM #medlist
WHERE processed = 0
INSERT INTO #medlist2(uniq_id, enterprise_id, practice_id, person_id,
enc_id, start_date, row_num, medication_name, sig_desc)
SELECT #uniqID, #enterpriseID, #practiceID, #personID, #encID, #startDate, #RowNum,
(CASE WHEN DATALENGTH(#medicationName) > 28 THEN LEFT(#medicationNAME, 28) + '-' ELSE #medicationName END),
(CASE WHEN DATALENGTH(#sigDesc) > 41 THEN LEFT(#sigDesc, 41) + '-' ELSE #sigDesc END)
WHILE DATALENGTH(#sigDesc) > 42 OR DATALENGTH(#medicationName) > 29
BEGIN
SET #medicationName = substring(#medicationName, 29,DATALENGTH(#medicationName))
SET #sigDesc = substring(#sigDesc, 42,DATALENGTH(#sigDesc))
SET #RowNum = #RowNum + 1
INSERT INTO #medlist2 (uniq_id, enterprise_id, practice_id, person_id,
enc_id, medication_name, sig_desc, row_num)
SELECT #uniqID, #enterpriseID, #practiceID, #personID, #encID, LEFT(#medicationNAME, 28), LEFT(#sigDesc, 41), #RowNum
IF DATALENGTH(#sigDesc) < 42 OR DATALENGTH(#medicationName) > 29
BREAK
ELSE
CONTINUE
END
UPDATE #medlist
SET processed = 1
WHERE uniq_id = #uniqID
SET #RowCount = (SELECT COUNT(*) FROM #medlist WHERE processed = 0)
IF #RowCount = 0
BREAK
ELSE
CONTINUE
END
RETURN
END
Don't do this in the database. Do it in your application layer!
Something as trivial as wrapping text is extremely expensive when SQL server is doing it on a row-by-row bases, but should be very quick to do in whatever application is displaying your results.

Why do my results not stay consistent?

I have the following stored procedure that I working on. I have noticed that every 5th or 6th time I refresh my results there are new values in there. Which considering that the data is in a static environment and no one is making any changes to the data at this time I really can't understand. Can someone please enlighten me as to why I would see different results even though I am running this procedure with the exact same parameters. I even tried it in query analyzer and still see the same strange results.
I am running in Sql 2008.
Here is the proc:
ALTER PROCEDURE [dbo].[SelectSearchBy_Category]
#userId INT,
#page INT,
#results INT,
#category NVARCHAR(50),
#searchTerm NVARCHAR(200) = NULL
AS
BEGIN
SET NOCOUNT ON
SET ROWCOUNT #results
DECLARE #categoryId INT
IF (#category IS NOT NULL) BEGIN
SET #categoryId = ( SELECT categoryId FROM Category WHERE categoryDescription = #category )
END
DECLARE #rowEnd INT
DECLARE #rowStart INT
SET #rowEnd = (#page * #results)
SET #rowStart = #rowEnd - #results
;WITH OrderedItems AS
(
SELECT
i.itemId,
title,
i.[description],
i.url,
i.categoryId,
i.ratingId,
i.requirements,
ISNULL(i.rating, 0) AS tating,
ISNULL(i.raters, 0) AS raters,
i.urlFriendlyPath,
ROW_NUMBER() OVER
(
ORDER BY i.dateAdded, (ISNULL(i.rating, 0) * ISNULL(i.raters, 0))
) AS RowNumber
FROM
[dbo].[Item] i
LEFT JOIN
UserItemIgnore uii ON uii.itemId = i.itemId AND uii.userId = #userId
INNER JOIN
ItemLanguage il ON il.itemId = i.itemId
WHERE
(#searchTerm IS NULL OR a.title LIKE '%' + #searchTerm + '%') AND
i.categoryId = #categoryId AND
il.languageId = 1 AND
uii.itemId IS NULL
)
SELECT *
FROM OrderedItems
WHERE RowNumber BETWEEN #rowStart AND #rowEnd
END
You will probably have consistent results if you put an order by clause in your OrderedItems temporary table definition.
Try using
ROW_NUMBER() OVER (ORDER BY i.dateAdded,
(ISNULL(i.rating, 0) * ISNULL(i.raters, 0)),
i.itemId)
i.itemId will act as a tie breaker to ensure that the results of ROW_NUMBER are deterministic in the event you have rows with equal ranks for i.dateAdded, (ISNULL(i.rating, 0) * ISNULL(i.raters, 0))

Resources