GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Brandon Leitheiser
-- Create date: 07.11.2010
-- Description: This stored Procedure should be called when the system wants to find out the price of ups
-- hundred weight.
-- =============================================
CREATE PROCEDURE [dbo].[sp_CalcUPSHundredWeightGround]
-- Add the parameters for the stored procedure here
@Zip nvarchar(10),
@TotalWeight int,
@ServiceLevel nvarchar(10),
@PlantID nvarchar(50),
@Tier bit,
@Zone nvarchar(15) = null,
@UnitPrice money = null,
@TotalPrice money output
--@Results money OUTPUT
AS
BEGIN
select @Zone = @ServiceLevel from upshundredweightzipzone
where zipstart <= @Zip and zipEnd >= @Zip and PlantID = @PlantID and Tier = @Tier
IF @@RowCount > 0
Begin
Select @UnitPrice = Price from upshundredweightzoneprice
where Zone = @Zone and "weight" >= @TotalWeight and PlantID = @PlantID and Tier = @Tier
Select @TotalPrice = (@TotalWeight / 100) * @UnitPrice
Return @TotalPrice
End
Else
Begin
Select @TotalPrice = 0.00
return @TotalPrice
End
END
GO
|