收银部分在kfp的代码中
销售排行
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetSalesSort]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[GetSalesSort]
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE GetSalesSort (@date1 datetime,@date2 datetime) AS
--一段时间内的销售
select nbbm,sum((case bz when 1 then -1 else 1 end)*sl*zyts) as sl into #time_sale from sun_pos_cymx where czrq>='2008-05-01' and czrq<='2008-05-30' group by nbbm
--select * from #time_sale
--最后一次的供货进货等信息
select nbbm,0 as xssl,bzdj,dw,' ' as lxfs,lsj,lsj-bzdj as ll,djbh into #last_stock from zy_yp1_sfmx a where a.cfbj='T' and left(a.dw,1)<>'9' and a.jzrq=(select max(b.jzrq) from zy_yp1_sfmx b where b.cfbj='T' and left(b.dw,1)<>'9' and a.nbbm=b.nbbm)
update #last_stock set xssl=b.sl from #last_stock a,#time_sale b where a.nbbm=b.nbbm
select a.gbm,a.ypm,a.gg,a.cd,a.zxdw,b.lsj,b.xssl,b.bzdj,b.dw,(select dmmc from zy_sys2_cgdw c where c.dm=b.dw) as dwmc,(select lxfs from zy_sys2_cgdw c where c.dm=b.dw) as lxfs,b.ll,b.djbh from zy_sys2_ypzdk a,#last_stock b where a.nbbm=b.nbbm
drop table #last_stock
drop table #time_sale
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
--报表
$PBExportHeader$dw_sales_sort.srd
$PBExportComments$销售排行榜
release 6;
datawindow(units=0 timer_interval=0 color=16777215 processing=1 print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no grid.lines=0 )
header(height=92 color="536870912" )
summary(height=0 color="536870912" )
footer(height=0 color="536870912" )
detail(height=96 color="536870912" )
table(column=(type=char(20) updatewhereclause=no name=gbm dbname="gbm" )
column=(type=char(32) updatewhereclause=no name=ypm dbname="ypm" )
column=(type=char(20) updatewhereclause=no name=gg dbname="gg" )
column=(type=char(8) updatewhereclause=no name=cd dbname="cd" )
column=(type=char(4) updatewhereclause=no name=zxdw dbname="zxdw" )
column=(type=number updatewhereclause=no name=lsj dbname="lsj" )
column=(type=number updatewhereclause=no name=xssl dbname="xssl" )
column=(type=number updatewhereclause=no name=bzdj dbname="bzdj" )
column=(type=char(10) updatewhereclause=no name=dw dbname="dw" )
column=(type=char(40) updatewhereclause=no name=dwmc dbname="dwmc" )
column=(type=char(20) updatewhereclause=no name=lxfs dbname="lxfs" )
column=(type=number updatewhereclause=no name=ll dbname="ll" )
column=(type=char(20) updatewhereclause=no name=djbh dbname="djbh" )
procedure="1 execute dbo.GetSalesSort;1 @date1 = :date1, @date2 = :date2" arguments=(("date1", string),("date2", string)) )
text(band=header alignment="0" text="序号"border="0" color="0" x="9" y="8" height="80" width="137" name=rowid_t font.face="宋体" font.height="-11" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="编码"border="0" color="0" x="155" y="8" height="80" width="361" name=gbm_t font.face="宋体" font.height="-11" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="品名"border="0" color="0" x="526" y="8" height="80" width="1024" name=ypm_t font.face="宋体" font.height="-11" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="规格"border="0" color="0" x="1559" y="8" height="80" width="553" name=gg_t font.face="宋体" font.height="-11" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="产地"border="0" color="0" x="2121" y="8" height="80" width="293" name=cd_t font.face="宋体" font.height="-11" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="单位"border="0" color="0" x="2423" y="8" height="80" width="155" name=zxdw_t font.face="宋体" font.height="-11" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="零价"border="0" color="0" x="2587" y="8" height="80" width="251" name=lsj_t font.face="宋体" font.height="-11" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="最后进价"border="0" color="0" x="2848" y="8" height="80" width="315" name=bzdj_t font.face="宋体" font.height="-11" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="区间销售数"border="0" color="0" x="3173" y="8" height="80" width="361" name=xssl_t font.face="宋体" font.height="-11" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="利率"border="0" color="0" x="3543" y="8" height="80" width="251" name=ll_t font.face="宋体" font.height="-11" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="供货单位"border="0" color="0" x="3803" y="8" height="80" width="1280" name=dwmc_t font.face="宋体" font.height="-11" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="联系方式"border="0" color="0" x="5093" y="8" height="80" width="640" name=lxfs_t font.face="宋体" font.height="-11" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="最后单据"border="0" color="0" x="5742" y="8" height="80" width="530" name=djbh_t font.face="宋体" font.height="-11" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
compute(band=detail alignment="0" expression="getrow()"border="0" color="0" x="9" y="4" height="88" width="137" format="[general]" name=rowid font.face="宋体" font.height="-11" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="16777215" )
column(band=detail id=1 alignment="0" tabsequence=10 border="0" color="0" x="155" y="4" height="88" width="361" format="[general]" name=gbm edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="宋体" font.height="-11" font.weight="400" font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
column(band=detail id=2 alignment="0" tabsequence=20 border="0" color="0" x="526" y="4" height="88" width="1024" format="[general]" name=ypm edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="宋体" font.height="-11" font.weight="400" font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
column(band=detail id=3 alignment="0" tabsequence=30 border="0" color="0" x="1559" y="4" height="88" width="553" format="[general]" name=gg edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="宋体" font.height="-11" font.weight="400" font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
column(band=detail id=4 alignment="0" tabsequence=40 border="0" color="0" x="2121" y="4" height="88" width="293" format="[general]" name=cd edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="宋体" font.height="-11" font.weight="400" font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
column(band=detail id=5 alignment="0" tabsequence=50 border="0" color="0" x="2423" y="4" height="88" width="155" format="[general]" name=zxdw edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="宋体" font.height="-11" font.weight="400" font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
column(band=detail id=6 alignment="1" tabsequence=60 border="0" color="0" x="2587" y="4" height="88" width="251" format="###0.00" name=lsj edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="宋体" font.height="-11" font.weight="400" font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
column(band=detail id=8 alignment="1" tabsequence=70 border="0" color="0" x="2848" y="4" height="88" width="315" format="###0.00" name=bzdj edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="宋体" font.height="-11" font.weight="400" font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
column(band=detail id=7 alignment="1" tabsequence=80 border="0" color="0" x="3173" y="4" height="88" width="361" format="###0.00" name=xssl edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="宋体" font.height="-11" font.weight="400" font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
column(band=detail id=12 alignment="1" tabsequence=90 border="0" color="0" x="3543" y="4" height="88" width="251" format="###0.00" name=ll edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="宋体" font.height="-11" font.weight="400" font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
column(band=detail id=10 alignment="0" tabsequence=100 border="0" color="0" x="3803" y="4" height="88" width="1280" format="[general]" name=dwmc edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="宋体" font.height="-11" font.weight="400" font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
column(band=detail id=11 alignment="0" tabsequence=110 border="0" color="0" x="5093" y="4" height="88" width="640" format="[general]" name=lxfs edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="宋体" font.height="-11" font.weight="400" font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
column(band=detail id=13 alignment="0" tabsequence=120 border="0" color="0" x="5742" y="4" height="88" width="530" format="[general]" name=djbh edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="宋体" font.height="-11" font.weight="400" font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )
htmltable(border="1" cellpadding="0" cellspacing="0" generatecss="no" nowrap="yes")