You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
2.2 KiB
27 lines
2.2 KiB
if exists (select * from sysobjects where id = OBJECT_ID(N'tAcpJsRcpBody') and OBJECTPROPERTY(id, N'IsView') = 1)
|
|
drop view tAcpJsRcpBody
|
|
go
|
|
create view tAcpJsRcpBody as
|
|
select b.BillNo,b.orgcode as YwOrgCode,(select orgname from t_shop where orgcode = b.orgcode) as YwOrgName,
|
|
YwBillNo,billtype as YwType,
|
|
case billtype when '0' then '駱澗데' when '1' then '藁새데' when '2' then '쏵송딧憐데' when '3' then '殮箇데' when '4' then '殮箇藁새' when '5' then '殮箇쏵송딧憐데' when '6' then '토箇데' when '7' then '토箇藁새데' when '8' then '토箇쏵송딧憐데' end as YwTypeName,
|
|
(CASE ISNULL(Rzdate,'') WHEN '' THEN NULL ELSE CONVERT(datetime,Rzdate + ' ' + RzTime,120) END) as JzDate,
|
|
case when billtype = '0' or billtype = '3' then (select cost from t_accept_head where billno = b.YwBillNo)
|
|
when billtype = '1' or billtype = '4' then (select cost from t_return_head where billno = b.YwBillNo)
|
|
when billtype = '2' or billtype = '5' or billtype = '8' then (select cjcost from t_adjbuyprice_head where billno = b.YwBillNo)
|
|
when billtype = '6' or billtype = '7' then (select zpamount from t_dist_head where billno = b.YwBillNo)
|
|
end as HJTotal,
|
|
case when billtype = '0' or billtype = '3' then (select netcost from t_accept_head where billno = b.YwBillNo)
|
|
when billtype = '1' or billtype = '4' then (select netcost from t_return_head where billno = b.YwBillNo)
|
|
when billtype = '2' or billtype = '5' or billtype = '8' then (select netcjcost from t_adjbuyprice_head where billno = b.YwBillNo)
|
|
when billtype = '6' or billtype = '7' then (select zpnetamount from t_dist_head where billno = b.YwBillNo)
|
|
end as WJTotal,
|
|
case when billtype = '0' or billtype = '3' then (select cost-netcost from t_accept_head where billno = b.YwBillNo)
|
|
when billtype = '1' or billtype = '4' then (select cost-netcost from t_return_head where billno = b.YwBillNo)
|
|
when billtype = '2' or billtype = '5' or billtype = '8' then (select netcost-netcjcost from t_adjbuyprice_head where billno = b.YwBillNo)
|
|
when billtype = '6' or billtype = '7' then (select zpamount-zpnetamount from t_dist_head where billno = b.YwBillNo)
|
|
end as JTaxTotal
|
|
from t_paysoa_body b, t_paysoa_head h where h.billno = b.billno
|
|
go
|
|
|