www.gusucode.com > 精典源码Delphi130:顺某指纹考勤管理系统 > 精典源码Delphi130:顺某指纹考勤管理系统/11065顺某指纹考勤管理系统delphi/newNoMiMa_SP/wbSP_AddorUpdateKQJieGuo.txt
/****** Object: Stored Procedure dbo.wbSP_AddorUpdateKQJieGuo Script Date: 2000-02-24 11:48:00 ******/ CREATE PROCEDURE wbSP_AddorUpdateKQJieGuo @KQNO char(5), @KQDate DateTime, @KQYear int, @KQMonth int, @KQDay int, @BCType char(6), @BCCode char(2), @BCXH int, @SBTime Decimal(6,2), @XBTime Decimal(6,2), @CDTime int, @ZTTime int, @BCJGCode char(20), @BCJGBJ char(2), @isUpdate bit AS declare @DayField char(6) declare @SQLStr Varchar(250) begin ----^^^^^^^insert into bAA(KQNO,KQDate) values(@KQNO,@KQDate) -- First. Deal 出勤结果表 if not Exists(Select KQNO from bCQJieG where KQNO=@KQNO and KQDate=@KQDate and BCCode=@BCCode and BCXH=@BCXH) begin insert Into bCQJieG(KQNO,KQDate,BCType,BCCode,BCXH,SBTime,CDTime,XBTime,ZTTime,BCJGCode) values (@KQNO,@KQDate,@BCType,@BCCode,@BCXH,@SBTime,@CDTime,@XBTime,@ZTTime,@BCJGCode) end else begin -- if @isUpdate=1 Update bCQJieG Set BCType=@BCType,SBTime=@SBTime,CDTime=@CDTime,XBTime=@XBTime,ZTTime=@ZTTime,BCJGCode=@BCJGCode where KQNO=@KQNO and KQDate=@KQDate and BCCode=@BCCode and BCXH=@BCXH end --second. Deal 考勤结果标记表 Set @DayField='RQ'+rtrim(Convert(char(2),@KQDay))+'BJ' Set @SQLStr='Insert into btmpJL_DBLX Select '+ @DayField+' from bKQDayHuiZJL Where KQNO='+''''+@KQNO+''''+' and DBYear='+Convert(char(4),@KQYear)+' and DBMonth='+Convert(varchar(2),@KQMonth)+' and '+@DayField+' is not Null' Set @SQLStr=@SQLStr+' and ZCBorDB='+''''+@BCType+''''+' and BCLXCode='+''''+@BCCode+''''+' and BXHao='+Convert(char(1),@BCXH) Delete from btmpJL_DBLX Execute (@SQLStr) -- 当日已经有考勤标记 if Exists(Select LXCode from btmpJL_DBLX where LXCode is not null or LXCode<>'') begin if @isUpdate=1 begin Set @SQLStr='Update bKQDayHuiZJL Set '+ @DayField+'='+''''+@BCJGBJ+''''+'Where KQNO='+''''+@KQNO+''''+' and DBYear='+Convert(char(4),@KQYear)+' and DBMonth='+Convert(varchar(2),@KQMonth)+' and ZCBorDB='+''''+@BCType+''''+' and BCLXCode='+''''+@BCCode+''''+' and BXHao='+Convert(char(1),@BCXH) Execute (@SQLStr) end end else -- 当日无考勤标记 begin -- 当月有无记录 if Exists(Select KQNO from bKQDayHuiZJL where KQNO=@KQNO and DBYear=@KQYear and DBMonth=@KQMonth and ZCBorDB=@BCType and BCLXCode=@BCCode and BXHao=@BCXH) begin Set @SQLStr='Update bKQDayHuiZJL Set '+ @DayField+'='+''''+@BCJGBJ+''''+'Where KQNO='+''''+@KQNO+''''+' and DBYear='+Convert(char(4),@KQYear)+' and DBMonth='+Convert(varchar(2),@KQMonth)+' and ZCBorDB='+''''+@BCType+''''+' and BCLXCode='+''''+@BCCode+''''+' and BXHao='+Convert(char(1),@BCXH) Execute (@SQLStr) end else begin Set @SQLStr='Insert into bKQDayHuiZJL(KQNO,DBYear,DBMonth,ZCBorDB,BCLXCode,BXHao,'+@DayField+') values(' Set @SQLStr=@SQLStr+''''+@KQNO+''''+','+Convert(char(4),@KQYear)+','+Convert(varchar(2),@KQMonth) Set @SQLStr=@SQLStr+','+''''+@BCType+''''+','+''''+@BCCode+''''+','+Convert(char(1),@BCXH)+','+''''+@BCJGBJ+''''+')' Execute (@SQLStr) end end return end