
[dbo].[GetInternationalContainerTotalsForLetter]
CREATE procedure [dbo].[GetInternationalContainerTotalsForLetter]
@inOrderId int
as
set nocount on
select
sum( isnull( Pieces, 0 ) ) as ContainersTotal,
case
when sum( isnull( CubicFeet, 0 ) ) > 0
then cast(
cast( sum( isnull( NetWeight, 0 ) ) as numeric ) / cast( sum( CubicFeet ) as numeric )
as decimal(10, 2) )
else cast( 0 as decimal(10, 2) )
end as ContainersDensity,
sum( isnull( GrossWeight, 0 ) ) as ContainersGrossWeight,
sum( isnull( TareWeight, 0 ) ) as ContainersTareWeight,
sum( isnull( NetWeight, 0 ) ) as ContainersNetWeight,
sum( isnull( CubicFeet, 0 ) ) as ContainersCubicFeet
from InternationalContainer
where OrdersFID = @inOrderID
group by OrdersFID
GO
GRANT EXECUTE ON [dbo].[GetInternationalContainerTotalsForLetter] TO [MssExec]
GO