You are on page 1of 1

select

b.FK_iwItemsREN [Item Code],


dbo.udf_getitemdescription(b.FK_iwItemsREN) [Item Description],
sum(b.renqty) [Quantity],
B.renprice [Price],
sum(B.renprice*B.renqty) [Amount]
from pspatinv A
inner join
psPatitem B on b.FK_TRXNO = a.PK_TRXNO
where dbo.udf_GetFullName(a.fk_emdpatients)= name'
and a.rendate between '01/03/2020' and '01/06/2020'
group by FK_iwItemsREN, B.renprice
ORDER BY b.FK_iwItemsREN

select
dbo.udf_GetFullName(FK_emdPatients) as [Patient Name]
,dbo.udf_GetFullName(FK_ASUHold) as [User Hold]
,holddatetime as [Hold Date/Time]
,dbo.udf_GetFullName(FK_ASURelease) as [User Unhold]
,releasedatetime as [Unhold Date/Time]
,case when ishold = 1 then 'YES'
else 'NO' end as [Is Hold?]
,dbo.udf_GetDepartmentName(FK_mscWarehouse) as [Department]
from psAcctHoldDept
where FK_psPatRegisters = '158180'

You might also like