English

速达软件
     
当前位置:速达软件 >> 技术支持 >> 浏览文章

升到6.47及后续版型本,分支序号不对脚本修正

发布日期:2019年01月22日 浏览次数: 作者:佚名  

SET QUOTED_IDENTIFIER ON 

GO

SET ANSI_NULLS ON 

GO







-------qlp--------------------

ALTER     procedure aa_getnewcredorderno

  @billdate t_date,

  @shopid int,

  @credtypeid integer,

  @credno integer out,

  @orderno integer out,

  @shoporderno integer out

as  

 

declare @newcredyearmonth varchar(6);

declare @fyear int,@fmonth int;

begin

  set nocount on

  execute  aa_getyearmonthbydate @billdate,@fyear out ,@fmonth out;

  set @newcredyearmonth = cast((@fyear) as char(4)) +   dbo.fn_setlengthstr(cast((@fmonth) as char(2)),2,'0',1)


  set @credno = 1;


  select @credno = max(credno) from aa_cred 

  where credyearmonth=@newcredyearmonth

  and credtypeid=@credtypeid;


  if (@credno is null) set @credno = 1;

  else set @credno = @credno + 1;

  

  select @orderno = max(orderno) from aa_cred

  where credyearmonth=@newcredyearmonth

  

  if (@orderno is null) set @orderno = 1;

  else set @orderno = @orderno + 1;


  select @shoporderno = max(shoporderno) from aa_cred

  where credyearmonth=@newcredyearmonth and shopid=@shopid

  

  if (@shoporderno is null) set @shoporderno = 1;

  else set @shoporderno = @shoporderno + 1;

  --以前用日期时,当日期有时分秒时下面这样找会有问题,改用上面的确credyearmonth ediy by qlp 2011-12-9

  /*

  select @mindate = sdate, @maxdate= edate from al_calendar where sdate<=@billdate and edate>=@billdate;

  set @credno = 1;


  select @credno = max(credno) from aa_cred 

  where billdate>=@mindate and billdate<=@maxdate

  and credtypeid=@credtypeid;


  if (@credno is null) set @credno = 1;

  else set @credno = @credno + 1;

  

  select @orderno = max(orderno) from aa_cred

  where billdate>=@mindate and billdate<=@maxdate;

  

  if (@orderno is null) set @orderno = 1;

  else set @orderno = @orderno + 1;


  select @shoporderno = max(shoporderno) from aa_cred

  where billdate>=@mindate and billdate<=@maxdate and shopid=@shopid;

  

  if (@shoporderno is null) set @shoporderno = 1;

  else set @shoporderno = @shoporderno + 1;*/


end







GO

SET QUOTED_IDENTIFIER OFF 

GO

SET ANSI_NULLS ON 

GO


 
上一篇: 3000系列 8.93版补丁说明 下一篇:数量金额总帐和明细帐没数据的脚本