@
chuckzhou 下面的函数和一个单条更新语句
ALTER PROCEDURE [dbo].[GetIcCardBalance]
@
sID varchar(12),
@
balance decimal(10,2) out
AS
BEGIN
set @
balance = 0
set @
balance = (select isnull(balance,0) from ic_register (NOLOCK) where patient_id = @
sID) -
isnull((select sum(isnull(charge_price * charge_amount*caoyao_fu,0))
from mz_detail_charge WITH (nolock) where patient_id = @
sID and charge_status = '2'),0)
--set @
balance = dbo.GetICRealBalance(@sID)
if @@error = 0 return 0
else
return -1
END