update lectinning a inner join lect b on b.lectno=a.lectno and b.userno=#userno# inner join cminning cmi on cmi.cmino=a.cmino inner join ctpage ctp on ctp.ctno=cmi.ctno and ctp.isdel=0 and ctp.pseq=#pseq# and ctp.cpno=#cpno# and ctp.pseq=a.pseq set a.etime=now(),a.eip=now(),a.ispce=#ispc# ,a.pseq=ctp.pseq ,a.psec=case when a.pseq=ctp.pseq then a.psec else 0 end ,a.udt=now(),a.uno=#uno#,a.uip=#uip# where a.lectno=#lectno# and a.cmino=#cmino#; insert into lectinning (lectno,cmino,totstudy,stime,etime,istatus,finishtime,sip,eip,ispcs,ispce,pseq,psec,) select #lectno#,a.cmino,0,now(),now(),case when a.atime=0 then 2 else 0 end,case when a.atime=0 then now() else null end,#uip#,#uip#,#ispc#,#ispc#,ctp.pseq,0, from cminning a inner join ctpage ctp on ctp.ctno=a.ctno and ctp.isdel=0 and ctp.pseq=#pseq# and ctp.cpno=#cpno# and ctp.pseq=1 left outer join lectinning b on b.lectno=#lectno# and b.cmino=#cmino# where a.cmino=#cmino# and b.lectno is null; update lect a inner join ( select a.lectno,truncate(count(c.lectno) / count(b.cmino) * 100, 0) attrate from lect a inner join cminning b on b.cmno=a.cmno and ifnull(b.isscd,0)=0 left outer join lectinning c on c.lectno=a.lectno and c.cmino=b.cmino and c.istatus=2 where a.lectno=#lectno# and a.userno=#userno# group by a.lectno ) b on b.lectno=a.lectno set a.attrate=b.attrate ,a.stime=case when a.stime is null then now() else a.stime end ,a.etime=now() ,a.sip=case when a.sip is null then #uip# else a.sip end ,a.eip=#uip# ,a.ispcs=case when a.ispcs is null then #ispc# else a.ispcs end ,a.ispce=#ispc# ,udt=now(),uno=#uno#,uip=#uip# where a.lectno=#lectno# and a.userno=#userno#; SELECT * FROM (SELECT LAST_INSERT_ID(0) col1) a WHERE col1 > 0; insert into lectinningpage(lectno,cmino,cpno,totstudy,stime,etime,sip,eip,ispc,webkitinfo,) select b.lectno,a.cmino,p.cpno,0,now(),now(),#uip#,#uip#,#ispc#,#webkitinfo#, from cminning a inner join lectinning li on li.lectno=#lectno# and li.cmino=a.cmino inner join ct ct on ct.ctno=a.ctno inner join ctpage p on p.ctno=ct.ctno and p.isdel=0 and p.pseq=#pseq# and p.cpno=#cpno# and p.pseq=li.pseq inner join lect b on b.lectno=#lectno# and b.userno=#userno# and b.cmno=a.cmno and b.status=1 and b.ischanged=0 where a.cmino=#cmino# and b.sdate < now() and b.edate > now() SELECT last_insert_id() update lectinningpage a inner join lect b on b.lectno=a.lectno and b.userno=#userno# set a.totstudy=TIMESTAMPDIFF(SECOND, a.stime, now()),a.etime=now(),a.eip=#uip#,a.udt=now(),a.uno=#uno#,a.uip=#uip# where a.logno=#logno#; update lectinning a inner join lect b on b.lectno=a.lectno and b.userno=#userno# inner join cminning c on c.cmino=a.cmino inner join ( select lectno,sum(totstudy) totstudy from lectinningpage where lectno=#lectno# and cmino=#cmino# group by lectno ) d on d.lectno=a.lectno set a.udt=now(),a.uno=#uno#,a.uip=#uip# ,a.totstudy=d.totstudy ,a.etime=now() ,a.istatus=case when a.istatus <> 2 and c.atime * 60 <= d.totstudy then 2 else a.istatus end ,a.finishtime=case when a.finishtime is null and c.atime * 60 <= d.totstudy then now() else a.finishtime end ,a.eip=#uip#,a.ispce=#ispc# ,a.psec=#psec# where a.lectno=#lectno# and a.cmino=#cmino#; update lect a inner join ( select a.lectno,truncate(count(c.lectno) / count(b.cmino) * 100, 0) attrate from lect a inner join cminning b on b.cmno=a.cmno and ifnull(b.isscd,0)=0 left outer join lectinning c on c.lectno=a.lectno and c.cmino=b.cmino and c.istatus=2 where a.lectno=#lectno# and a.userno=#userno# group by a.lectno ) b on b.lectno=a.lectno set a.attrate=b.attrate ,a.etime=now() ,a.eip=#uip# ,a.ispce=#ispc# ,udt=now(),uno=#uno#,uip=#uip# where a.lectno=#lectno# and a.userno=#userno#; update lectinning set isokmid=1 where lectno=#lectno# and cmino=#cmino# insert into lectrs(lectno,rsno,rscno,rscqno,qno,atext,) select a.lectno,b.rsno,b.rscno,c.rscqno,c.qno,c.atext, from lect a inner join cmrs b on b.rsno=#rsno# left outer join lectrs a0 on a0.lectno=a.lectno and a0.rsno=b.rsno inner join ( select a.rscqno,a.qno,#Ds[].atext# atext from rscq a where a.rscqno=#Ds[].rscqno# ) c on c.rscqno is not null where a.lectno=#lectno# and a.userno=#userno# and a0.lectno is null update lectexq a inner join lectex d on d.lectno=a.lectno and d.exno=a.exno and d.eend is null inner join lect d2 on d2.lectno=d.lectno and d2.userno=#userno# inner join cmex c on c.exno=a.exno inner join ( select #exno# exno, #UED[].eqno# eqno, #UED[].atext# atext, #UED[].qinos# qinos, #UED[].iscorrect# iscorrect ) b on b.exno=a.exno and b.eqno=a.eqno set a.atext=b.atext, a.qinos=b.qinos,a.udt=now(),a.uno=#uno#,a.uip=#uip# ,a.cpoint=case when b.iscorrect = 1 then a.dpoint else 0 end ,a.iscorrect=b.iscorrect where a.lectno=#lectno# and a.exno=#exno#; update lectex a inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno# inner join ( select a.exno, sum(ifnull(a.cpoint, 0)) tpoint from lectexq a where a.lectno=#lectno# and a.exno=#exno# group by a.exno ) b on b.exno=a.exno inner join cmex c on c.exno=a.exno set a.udt=now(),a.uno=#userno#,a.uip=#uip# ,a.eend=now() , a.tpoint=b.tpoint ,a.cblock=#cblock# where a.lectno=#lectno# and a.exno=#exno# and a.eend is null update lectexq a inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno# inner join lectex d on d.lectno=a.lectno and d.exno=a.exno and d.eend is null inner join cmex c on c.exno=a.exno inner join ( select #exno# exno, #UED[].eqno# eqno, #UED[].atext# atext, #UED[].qinos# qinos, #UED[].iscorrect# iscorrect ) b on b.exno=a.exno and b.eqno=a.eqno set a.atext=b.atext, a.qinos=b.qinos,a.udt=now(),a.uno=#uno# ,a.cpoint=case when b.iscorrect = 1 then a.dpoint else 0 end ,a.iscorrect=b.iscorrect where a.lectno=#lectno# and a.exno=#exno#; update lectex a inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno# inner join ( select a.exno, sum(ifnull(a.cpoint, 0)) tpoint from lectexq a where a.exno=#exno# and a.lectno=#lectno# group by a.exno ) b on b.exno=a.exno inner join cmex c on c.exno=a.exno set a.udt=now(),a.uno=#userno# , a.tpoint=b.tpoint where a.lectno=#lectno# and a.exno=#exno# and a.eend is null update lectsd a inner join lect b on b.lectno=a.lectno and b.userno=#userno# and b.sdate < now() and b.edate > now() inner join cm c on c.cmno=b.cmno set a.udt=now(),a.uno=#uno#,a.uip=#uip# ,a.fgno=#fgno#,a.atext=#atext# ,a.submittime=now(),submitip=#uip# where a.lectno=#lectno# and a.sdno=#sdno# and a.checktime is null; insert into lectsd (lectno,sdno,atext,fgno,iscopy,submittime,submitip,) select a.lectno,a.sdno,#atext#,#fgno#,0,now(),#uip#, from (select #lectno# lectno,#userno# userno,#sdno# sdno) a inner join lect b on b.lectno=a.lectno and b.userno=a.userno inner join cm c on c.cmno=b.cmno and b.sdate < now() and b.edate > now() left outer join lectsd d on d.lectno=a.lectno and d.sdno=a.sdno where d.lectno is null; update lectsd a inner join lect b on b.lectno=a.lectno and b.userno=#userno# and b.sdate < now() and b.edate > now() inner join cm c on c.cmno=b.cmno set a.udt=now(),a.uno=#uno#,a.uip=#uip# ,a.submittime=now(),submitip=#uip# where a.lectno=#lectno# and a.sdno=#sdno# and a.checktime is null; update lectsdboard a inner join lectsd a2 on a2.lectno=a.lectno and a2.sdno=a.sdno and a2.checktime is null inner join lect b on b.lectno=a.lectno and b.userno=#userno# and b.sdate < now() and b.edate > now() inner join cm c on c.cmno=b.cmno set a.udt=now(),a.uno=#uno#,a.uip=#uip# ,a.subject=#subject#,contents=#contents#,a.fgno=#fgno# where a.bno=#bno# and a.lectno=#lectno# and a.sdno=#sdno#; update lectsd a inner join lect b on b.lectno=a.lectno and b.userno=#userno# and b.sdate < now() and b.edate > now() inner join cm c on c.cmno=b.cmno set a.udt=now(),a.uno=#uno#,a.uip=#uip# ,a.submittime=now(),submitip=#uip# where a.lectno=#lectno# and a.sdno=#sdno# and a.checktime is null; insert into lectsd (lectno,sdno,iscopy,submittime,submitip,) select a.lectno,a.sdno,0,now(),#uip#, from (select #lectno# lectno,#userno# userno,#sdno# sdno) a inner join lect b on b.lectno=a.lectno and b.userno=a.userno and b.sdate < now() and b.edate > now() inner join cm c on c.cmno=b.cmno left outer join lectsd d on d.lectno=a.lectno and d.sdno=a.sdno where d.lectno is null; SELECT * FROM (SELECT LAST_INSERT_ID(0) col1) a WHERE col1 > 0; insert into lectsdboard (lectno,sdno,subject,contents,fgno,rcount,cip,isdel,) select a.lectno,a.sdno,#subject#,#contents#,#fgno#,0,#uip#,0, from (select #lectno# lectno,#userno# userno,#sdno# sdno) a inner join lect b on b.lectno=a.lectno and b.userno=a.userno and b.sdate < now() and b.edate > now() inner join cm c on c.cmno=b.cmno SELECT last_insert_id() update lectsd a inner join lectsdboard b on b.bno=#bno# and b.cno=#userno# and b.isdel=0 and b.lectno=a.lectno and b.sdno=a.sdno inner join lect a2 on a2.lectno=b.lectno and a2.userno=b.cno and a2.sdate < now() and a2.edate > now() inner join cm c on c.cmno=a2.cmno set a.submittime=null,a.submitip=null and a.checktime is null; update lectsdboard a inner join lectsd b on b.lectno=a.lectno and b.sdno=a.sdno and b.checktime is null inner join lect a2 on a2.lectno=b.lectno and a2.userno=a.cno and a2.sdate < now() and a2.edate > now() inner join cm c on c.cmno=a2.cmno set a.uno=#uno#,a.udt=now(),a.uip=#uip# ,a.isdel=1 where a.bno=#bno# and a.cno=#userno# and a.isdel=0; SELECT * FROM (SELECT LAST_INSERT_ID(0) col1) a WHERE col1 > 0; insert into lectsdboardcmt (bno,ctext,isdel,) values (#bno#,#ctext#,0,); SELECT LAST_INSERT_ID() update lectsdboardcmt set ,ctext=#ctext# where bcno=#bcno# and cno=#cno# update lectsdboardcmt set ,isdel=1 where bcno=#bcno# and cno=#cno# update payitem set ,rbank = #rbank# ,rbankaccnum = HEX(AES_ENCRYPT(#rbankaccnum#, )) ,tbankuser = #tbankuser# where payno = #payno# SELECT * FROM (SELECT LAST_INSERT_ID(0) col1) a WHERE col1 > 0; insert into pay (ptype,ispg,isgroup,isexam,userno,username,pstatus,rstatus,rstatustime,cshrcancelnum,canceltime,cancelmsg,cancelcnt ,refunding,paylimit,payoktime,pgkey,orgamt,discamt,deliamt,isrefunddvr,payamt,refundamt,isdvr,) select #ptype#,0,0,1,u.userno,u.username,1,0,null,null,null,null,null ,0,null,#payoktime#,null ,a.outfee ,case when #ptype# = 6 then a.outfee else case when ua.isjoin=1 then a.outfee-a.infee else 0 end end ,0,0 ,case when #ptype# = 6 then 0 else case when ua.isjoin=1 then a.infee else a.outfee end end ,0,0, from exam a inner join users u on u.userno=#userno# left outer join assign ua on ua.asno=u.asno where a.exno=#exno# SELECT last_insert_id() SELECT * FROM (SELECT LAST_INSERT_ID(0) col1) a WHERE col1 > 0; insert into payitem (payno,ptype,pcno,itemno,userno,pstatus,rstatus,pgkey,cancelcode,cancelmsg,canceltype,pcnt ,orgamt,discamt,payamt ,payamtcash,payamtcard ,refundamt,refundtime,refundtimereal,refundinfo,isrebate,fgno,cartno,) select p.payno,3,null,#itemno#,#userno#,1,0,null,null,null,null,1 ,a.outfee ,case when p.ptype=6 then a.outfee else case when ua.isjoin=1 then a.outfee-a.infee else 0 end end ,case when p.ptype=6 then 0 else case when ua.isjoin=1 then a.infee else a.outfee end end ,0,0 ,0,null,null,null,0,null,null, from exam a inner join users u on u.userno=#userno# inner join pay p on p.payno=#payno# left outer join assign ua on ua.asno=u.asno where a.exno=#itemno# SELECT last_insert_id() update examuser set ,payno=#payno#,pino=#pino#,pstatus=1 where exno=#itemno# and userno=#userno# and status=1 and payno is null and pino is null and pstatus=4 update examuser set ,pstatus=9 where exno=#exno# and userno=#userno# and status=1 and payno is null and pino is null and pstatus=4 update payrfd set ,bankname=#bankname#,bankowner=#bankowner#,bankno=HEX(AES_ENCRYPT(#bankno#, )) ,isowner=#isowner#,ruser=#ruser#,rphone=HEX(AES_ENCRYPT(#rphone#, )) ,rreason=#rreason#,rtext=#rtext#,rstatus=#rstatus#,rback=#rback# ,statustime=case when rstatus <> #rstatus# then now() else statustime end where rfdno=#rfdno# update pay set ,rstatus=1,rstatustime=now(),cancelcnt=case when #cancelcnt# = 0 then cancelcnt else #cancelcnt# end ,isrefunddvr=case when isrefunddvr = 0 and #isrefunddvr# = 1 then 1 else isrefunddvr end ,refundamt = refundamt + #newrefundamt# ,iscanceled = #iscanceled# where payno=#payno#; update payitem a inner join ( select #PIs[].pino# pino,#PIs[].refundamt# refundamt,#PIs[].refundstatus# refundstatus,#PIs[].refundtime# refundtime,#PIs[].refundinfo# refundinfo ) b on b.pino=a.pino set a.rstatus=1,a.pgkey=#cancelcode#,a.refundamt=b.refundamt,a.refundtime=b.refundtime,a.refundtimereal=now(),a.refundinfo=b.refundinfo,a.refundstatus=b.refundstatus where a.payno=#payno# and a.rstatus=0; update examuser set udt=now(),uno=#uno#,uip=#uip# ,pstatus=8 where payno=#payno# and pino in ($pinosexamuser$); update lect set udt=now(),uno=#uno#,uip=#uip# ,status=8 where payno=#payno# and pino in ($pinoslect$) and ischanged=0; update payitem a inner join ( select #PIs[].rstatus# rstatus,#PIs[].pino# pino,#PIs[].refundamt# refundamt,#PIs[].refundstatus# refundstatus,#PIs[].refundtime# refundtime,#PIs[].refundinfo# refundinfo ) b on b.pino=a.pino and b.rstatus > 0 set a.refundstatus=b.refundstatus where a.payno=#payno# and a.pino in ($pinosexamuser2$) and a.rstatus>0; update examuser a inner join ( select #PIs[].rstatus# rstatus,#PIs[].pino# pino,#PIs[].refundamt# refundamt,#PIs[].refundstatus# refundstatus,#PIs[].refundtime# refundtime,#PIs[].refundinfo# refundinfo ) b on b.pino=a.pino and b.rstatus > 0 set a.udt=now(),a.uno=#uno#,a.uip=#uip# ,a.pstatus=case when b.refundstatus=1 then 8 else 1 end where a.payno=#payno# and a.pino in ($pinosexamuser2$); update payitem a inner join ( select #PIs[].rstatus# rstatus,#PIs[].pino# pino,#PIs[].refundamt# refundamt,#PIs[].refundstatus# refundstatus,#PIs[].refundtime# refundtime,#PIs[].refundinfo# refundinfo ) b on b.pino=a.pino and b.rstatus > 0 set a.refundstatus=b.refundstatus where a.payno=#payno# and a.pino in ($pinoslect2$) and a.rstatus>0; update lect a inner join ( select #PIs[].rstatus# rstatus,#PIs[].pino# pino,#PIs[].refundamt# refundamt,#PIs[].refundstatus# refundstatus,#PIs[].refundtime# refundtime,#PIs[].refundinfo# refundinfo ) b on b.pino=a.pino and b.rstatus > 0 set a.udt=now(),a.uno=#uno#,a.uip=#uip# ,a.status=case when b.refundstatus=1 then 8 else 1 end where a.payno=#payno# and a.pino in ($pinoslect2$); insert into payrfdlog (payno,pino,refundamt,refunddate,dmemo,pistatus,) select #payno#,a.pino,a.refundamt,a.refundtime,a.refundinfo,a.refundstatus, from ( select #PIs[].pino# pino,#PIs[].refundamt# refundamt,#PIs[].refundstatus# refundstatus,#PIs[].refundtime# refundtime,#PIs[].refundinfo# refundinfo ) a; insert into payrfdlog (payno,pino,refundamt,refunddate,dmemo,pistatus,) values(#payno#,null,#deliamt#,now(),"택배비환불",0,); update paytax a set a.ischeck = #ischeck# ,a.udt = now() ,a.uno = #uno# ,a.uip = #uip# ,a.checktime = case when #ischeck# = 1 then now() else null end a.taxno in ($taxnos$) a.taxno = #taxno# update paytax a set a.iscancel = 1 ,a.udt = now() ,a.uno = #uno# ,a.uip = #uip# a.taxno in ($taxnos$) a.taxno = #taxno# update paytax set ,asname=#asname# ,ceoname=#ceoname# ,brno=#brno# ,grno=#grno# ,btype=#btype# ,bkind=#bkind# ,manname=#manname# ,telno=HEX(AES_ENCRYPT(#telno#, )) ,email=HEX(AES_ENCRYPT(#email#, )) ,taxdate=#taxdate# ,taxinfo=#taxinfo# ,isreceipt=#isreceipt# ,iscancel=#iscancel# ,asaddr=#asaddr# ,mgtkey=#mgtkey# ,taxdatereq=#taxdatereq# ,statecode=#statecode# ,realtaxdate=case when #statecode#=300 and realtaxdate is null then now() else realtaxdate end where taxno=#taxno# update docprintpast set ,kind=#kind# ,cg=#cg# ,cshape=#cshape# ,username=#username# ,userpno=HEX(AES_ENCRYPT(#userpno#, )) ,typeman=#typeman# ,edukind=#edukind# ,typeedu=#typeedu# ,typegrade=#typegrade# ,typejob=#typejob# ,cgname=#cgname# ,completeno=#completeno# ,companyname=#companyname# ,companyaddr=#companyaddr# ,brno=#brno# ,eino=#eino# ,btype=#btype# ,bkind=#bkind# ,ceoname=#ceoname# ,ssdate=#ssdate# ,sedate=#sedate# ,sctime=#sctime# ,assign=#assign# ,slevel=#slevel# ,uduty=#uduty# ,phone=HEX(AES_ENCRYPT(#phone#, )) ,mname=#mname# ,mphone=HEX(AES_ENCRYPT(#mphone#, )) ,sprice=#sprice# ,rprice=#rprice# ,rbank=#rbank# ,rbankno=HEX(AES_ENCRYPT(#rbankno#, )) ,rbankuser=#rbankuser# ,taxemail=HEX(AES_ENCRYPT(#taxemail#, )) ,syear=#syear# where no=#no# insert into docprintpast (kind, cg, cshape, username, userpno, typeman, edukind, typeedu, typegrade, typejob, cgname, completeno, companyname, companyaddr, brno, eino, btype, bkind, ceoname, ssdate, sedate, sctime, assign, slevel, uduty, phone, mname, mphone, sprice, rprice, rbank, rbankno, rbankuser, taxemail, syear, ) select #Ds[].kind#, #Ds[].cg#, #Ds[].cshape#, #Ds[].username# , HEX(AES_ENCRYPT(#Ds[].userpno#, )) , #Ds[].typeman#, #Ds[].edukind#, #Ds[].typeedu#, #Ds[].typegrade#, #Ds[].typejob#, #Ds[].cgname#, #Ds[].completeno#, #Ds[].companyname#, #Ds[].companyaddr#, #Ds[].brno#, #Ds[].eino#, #Ds[].btype#, #Ds[].bkind#, #Ds[].ceoname#, #Ds[].ssdate#, #Ds[].sedate#, #Ds[].sctime#, #Ds[].assign#, #Ds[].slevel#, #Ds[].uduty# , HEX(AES_ENCRYPT(#Ds[].phone#, )) , #Ds[].mname# , HEX(AES_ENCRYPT(#Ds[].mphone#, )) , #Ds[].sprice#, #Ds[].rprice#, #Ds[].rbank# , HEX(AES_ENCRYPT(#Ds[].rbankno#, )) , #Ds[].rbankuser# , HEX(AES_ENCRYPT(#Ds[].taxemail#, )) , #Ds[].syear# , now(), #Ds[].uno#, now(), #Ds[].uno#, #Ds[].uip# ; update users set ,username=#username# ,userpno=HEX(AES_ENCRYPT(#userpno#, )) ,slevel=#slevel# ,uduty=#uduty# ,mobile=HEX(AES_ENCRYPT(#mobile#, )) ,birthday=HEX(AES_ENCRYPT(#birthday#, )) where userno=#userno#; update lect set ,iscomplete=#iscomplete#,completetime=null ,cmisno=#cmisno# ,sdate=#sdate# ,edate=#edate# where lectno=#lectno# and userno=#userno#; update payitem set ,rbank=#rbank# ,rbankaccnum=HEX(AES_ENCRYPT(#rbankaccnum#, )) ,tbankuser=#rbankuser# ,rbankamt=#rbankamt# where pino=#pino# and userno=#userno#; update pplog set ,typeman=#typeman# ,typejob=#typejob# ,typeedu=#typeedu# ,typegrade=#typegrade# ,typejobitem=#typejobitem# ,rbankname=#rbank# ,rbankacc=HEX(AES_ENCRYPT(#rbankaccnum#, )) ,rbankowner=#rbankuser# ,association=#association# ,asname=#asname# ,post=#post# ,address1=#address1# ,address2=#address2# ,brno=#brno# ,eino=#eino# ,btype=#btype# ,bkind=#bkind# ,ceoname=#ceoname# ,mname=#mname# ,mphone=HEX(AES_ENCRYPT(#mphone#, )) ,taxemail=HEX(AES_ENCRYPT(#taxemail#, )) where pplno=#pplno# and userno=#userno#; update lectinningpage a set a.etime=now(),a.eip=#uip#,a.udt=now(),a.uno=#uno#,a.uip=#uip# where a.logno=#logno#;