|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-08-11 : 07:07:58
|
| Todd writes "Hello,I am new here and new to Database development for the web. I have a need to create a web page which will contain buttons which will have the ability to run queries (which i've already written) and the results appear in a window (new web page).The following is an example of one query I would like to launch from a button in a web page:/* FIND TRADE / CASH ERRORS IN THE VISMA DATABASEAUTHOR TPicquelleUSAGE: Click on run, there is nothing to set by the user.History 23Jan2003 TPicquelle Added (NOLOCK) 27Sep2002 TPicquelle Correct cast of x-ref 19Sep2002 TPicquelle Initial design*/use f0001--FIND the parent of the TRADE revenue types (assume that type 13 is always trade)declare @tradeParent intselect @tradePArent = inf from r2 (NOLOCK) where rno = 13select ct.vodt as "Transaction",valdt as 'Posted', convert (varchar(10),sta.Nm) as Station, convert (varchar(15),ae.Nm) as AccountExec, convert (varchar(22),adv.Nm) + '/' + convert (varchar(22),adv.Nm) as "Advertiser/Agency", --adv.empno as Advertiser#, --convert (varchar(22),adv.Nm) as Advertiser, --agc.empNo as Agency#, --convert(varchar(22),agc.nm) as "Agency/Advertiser", ct.votp as VoucherType, str(ct.r2,4,0) as Rev, str(ct.am,10,2) as Amount, str(ct.ram,10,2) as Outstanding, ct.invono as "Invoice#", ct.ordno as "Order#", ct.agref as "X-ref", str(ct.qty,10,2) as "Agc Com", str(ct.Intrt,20,2) as "AE com", ct.txt as text from CustTr ct (NOLOCK) left outer join R3 sta (NOLOCK) on sta.RNo = ct.R3 left outer join R1 ae (NOLOCK) on ae.RNo = ct.R1 left outer join R1 rt (NOLOCK) on rt.RNo = ct.R2 left outer join actor adv (NOLOCK) on adv.EmpNo = ct.EmpNo left outer join actor agc (NOLOCK) on agc.EmpNo = ct.CustNo where --( --check all credit voucher types (2,3,4,5,40) -- ct.VoTp in ( select vt.VoTpNo from votp vt where vt.crac = 0 and afftrn = 0) --OR ct.VoTp = 1 -- need invoices too! --) AND -- ignore adjustments and trade specific voucher types ct.votp not in (33,34,23,24,25,26,27,28) AND --look for trade revenue types (13,14,15,16,17,18,48) ct.r2 in (select rno from r2 where inf = @tradeParent) AND -- if remaining is not the same as amount - it was matched! CT.am <> CT.RAM -- ignore misc revenue types --and (ct.r2 < 1000)order by valdt desc, adv.Nm asc, ct.CustNo asc, ct.Txt2 asc--select * from EmpV--select * from actor--select * from votp vt where vt.crac = 0 and afftrn = 0--select rno, inf, nm from r2 order by rno/*--Birmingham Revenue types used - need to catch user child trade types!!!select distinct rt.rno, rt.nm, rt.inf, rt.inf2 from custtr ctleft outer join R2 rt on rt.RNo = ct.R2 order by rt.rnorno nm inf inf2 ----------- ---------------------------------------- ---------------------------------------- ---------------------------------------- 7 Local Agency 1 78 Local Direct 1 810 Natl Political 2 1011 Natl Rev 2 1112 Network Revenue 3 1213 Trade Rev 4 1319 Loc Ag Pol 1 1933 Local Non Trad 1 |
|