Premium margin is negative
Direct processing But July has been carried forward
and directly to the margin will appear red page (mainly because of the change Splsk balance amount)
Need to update the details and then sum up the details (to prevent the same document out of other varieties)
Update Spls_ck set chkje=0,ml=0,chbdj=0,jcje=85.47,hwjcer=85.47 where spid= ' SPH00005569 ' and rq>= ' 2015-08-01 '
Update PF_CKMX set chbje=0,ml=0,chbdj=0 where spid= ' SPH00005569 ' and rq>= ' 2015-08-01 '
Update B set b.chbje=a.chbje,b.ml=a.ml from
(select Djbh,sum (chbje) chbje,sum (ml) ml from pf_ckmx where spid= ' SPH00005569 ' and rq>= ' 2015-08-01 ' GROUP by DJBH) A,PF _ckhz b where a.djbh=b.djbh
Update b set b.chbje=a.chbje,b.ml=a.ml from pf_ckhz A,cwk b where a.djbh=b.djbh and A.DJBH in (select DJBH from PF_CKMX WH ere spid= ' SPH00005569 ')
Discover the Red Book page
Update Spls_rk set jcje=0,hwjcer=0,chbdj=0 where djbh= ' JHBYMA00000044 ' and spid= ' SPH00005569 '
Select Return and sell after
Return
First of all the original gift sales data and original returns and corresponding sales ticket data
Select A.DJBH,E.SPBH,E.SPMCH,E.SHPGG,E.DW,E.SHENGCCJ,B.DWMCH,A.PIHAO,A.SHL,A.HSJE,A.CHBDJ,A.RQ,D.ONTIME,D.BM, D.YWY,C.USERNAME,A.ML, ' pin ' as Beizhu from pf_ckmx a,mchk b,pf_djhz c,pf_ckhz d,spkfk e where a.spid=e.spid and D.DWBH=B.DWB H and D.XGDJBH=C.DJBH and A.DJBH=D.DJBH and A.spid in (the select SPID from SPKFK where left (spbh,2) = ' ZP ') and a.djbh like ' XS a% '--and a.chbdj<>0
UNION ALL
Select A.duiydjbh,e.spbh,e.spmch,e.shpgg,e.dw,e.shengccj,b.dwmch,a.pihao,a.shl,a.hsje,a.chbdj,a.rq,d.bm, ",", A.ML, ' fallback ' as Beizhu from PF_CKMX a,mchk b,pf_ckhz d,spkfk e where a.spid=e.spid and D.DWBH=B.DWBH and A.DUIYDJBH=D.DJBH and A.spid in (select spid from SPKFK where left (spbh,2) = ' ZP ') and a.djbh like ' xsc% '
Separate terminals and distribution centralized returns after the return of goods all the data to check the giveaway
Check that the giveaway cost amount is 0
Select b.spbh,a.* from SPKFJC A,SPKFK b where A.spid=b.spid and a.spid in (select spid from SPKFK where left (spbh,2) = ' ZP ') and a.kcje<>0
Select A.spid,sum (hwje) from hwsp A,SPKFK b where A.spid=b.spid and A.spid in (the select SPID from SPKFK where left (spbh,2) = ' ZP ') and a.hwje<>0 GROUP by A.spid
Found that there is a variety of cost amount of 0.01, directly updated to 0, for not 0 of the 3 varieties of inspection, found a return for no goods, a variety of non-differential, a variety has not returned.
Check whether the HSHJ and PCKHDJ in the SPHWPH table for the giveaway are 0
SELECT * from SPKFK where spid in
(select DISTINCT spid from sphwph where spid in (select spid from SPKFK where left (spbh,2) = ' ZP ') and (hshj<>0 or PCK hdj<>0))
It is found that non-premium locations are not 0 unified update to 0 and the gift limit can not be entered in the non-premium shelf
Update sphwph set hshj=0,pckhdj=0 where spid in (the select SPID from SPKFK where left (spbh,2) = ' ZP ') and (hshj<>0 or PCK hdj<>0) and HW not in (' HWI00000012 ', ' HWI00000013 ')
Update cost unit price and individual valuation after inspection is correct
Update SPKFJC set chbdj=0,kcje=0 where spid in (the select SPID from SPKFK where left (spbh,2) = ' ZP ') and spid<> ' SPH00005 588 '
Update hwsp set chbdj=0,hwje=0 where spid in (the select SPID from SPKFK where left (spbh,2) = ' ZP ') and spid<> ' SPH00005588 ‘
Update sphwph set gebjj=0 where spid in (the select SPID from SPKFK where left (spbh,2) = ' ZP ') and spid<> ' SPH00005588 '
Check whether the update is complete
SELECT * from SPKFJC the where spid in (the select SPID from SPKFK where left (spbh,2) = ' ZP ') and (chbdj<>0 or kcje<>0)
SELECT * from hwsp the where spid in (the select SPID from SPKFK where left (spbh,2) = ' ZP ') and (chbdj<>0 or hwje<>0)
SELECT * from Sphwph the where spid in (the select SPID from SPKFK where left (spbh,2) = ' ZP ') and gebjj<>0
Sales
Monitoring of sales invoicing for terminals (total 835) and distribution (16978) respectively
It's not possible to monitor someone's modification time
Select SUM (SHL) from PF_DJMX where DJBH in (select A.DJBH from pf_djmx a,pf_djhz b where a.djbh=b.djbh and a.spid in (Sele CT spid from SPKFK where left (spbh,2) = ' ZP ') and a.djbh like ' xsg% ' and bm= ' Terminal Department ' and b.rq= ' 2015-08-29 ' and ontime> ' 18:00 : 00 ')
Select SUM (SHL) from PF_DJMX where DJBH in (select A.DJBH from pf_djmx a,pf_djhz b where a.djbh=b.djbh and a.spid in (Sele CT spid from SPKFK where left (spbh,2) = ' ZP ') and a.djbh like ' xsg% ' and bm= ' distribution Department ' and b.rq= ' 2015-08-29 ' and ontime> ' 18:00 : 00 ')
Check out the tickets found that day and other gifts can only be limited to the time
Select SUM (SHL) from PF_CKMX where DJBH in (select A.DJBH from pf_ckmx a,pf_ckhz b where a.djbh=b.djbh and a.spid in (Sele CT spid from SPKFK where left (spbh,2) = ' ZP ') and a.djbh like ' xsa% ' and bm= ' Terminal Department ' and b.rq= ' 2015-08-29 ' and ontime> ' 18:00 : 00 '
)
Select SUM (SHL) from PF_CKMX where DJBH in (select A.DJBH from pf_ckmx a,pf_ckhz b where a.djbh=b.djbh and a.spid in (Sele CT spid from SPKFK where left (spbh,2) = ' ZP ') and a.djbh like ' xsa% ' and bm= ' distribution Department ' and b.rq= ' 2015-08-29 ' and ontime> ' 18:00 : 00 '
)
Discover how open the terminal is
Later on the specific varieties of a single check, found that there are numbers and lot number of open error phenomenon. and to re-correct it.
If the gift needs to transfer also need to set the premium cost unit price to 0.01
And to limit the gift invoicing can not open above 0.01 and hshj and PCKHDJ can only be 0
For the end of August giveaway processing