各种费用计算

 

-- 根据收费类型收费

--按单收费
select s.Pk_LugFeeSubject_Id,s.LugFeeSubject_Name,s.LugFeeSubject_Price from lug.LugFeeSubject s
where s.Fk_LugSubjectFeeStyle_Id=1 and s.Fk_CarryStation_Id=@pCarryStaId
union all
--按件收费 (设置收费上限)
select s.Pk_LugFeeSubject_Id,s.LugFeeSubject_Name,
(case  when s.LugFeeSubject_MaxPrice>0 and s.LugFeeSubject_Price*@pLugAmount>s.LugFeeSubject_MaxPrice then s.LugFeeSubject_MaxPrice
       else s.LugFeeSubject_Price*@pLugAmount end) as LugFeeSubject_Price
from lug.LugFeeSubject s
where s.Fk_LugSubjectFeeStyle_Id=2 and s.Fk_CarryStation_Id=@pCarryStaId
union all
--按重量 搬运费(根据区间取值)
select s.Pk_LugFeeSubject_Id,s.LugFeeSubject_Name,
(select f.LugLoadFee_Price from lug.LugLoadFee f where @pFactWeight>f.LugLoadFee_StartWeight and @pFactWeight<=f.LugLoadFee_EndWeight)
as LugFeeSubject_Price
from lug.LugFeeSubject s
where s.Fk_LugSubjectFeeStyle_Id=3 and s.Pk_LugFeeSubject_Id=3 and s.Fk_CarryStation_Id=@pCarryStaId

你可能感兴趣的:(各种费用计算)