目前根据SAPBO的存储过程可以实现此需求,
下面我将具体的实现方法如下:
1.在日记账分录增加了2个字段“U_PZLX”(凭证类型)(注:和自定表进行关联,在自定义表里,Z对应转,Z1对应转1。。。,此对应关系需要和客户确认的,可以根据财务需求进行更改对应关系。),“U_PZH(凭证号)”,
2.编写存储过程语句:
如:生产收货单,根据类型,将u_pzlx 更改为“Z”,“U_PZH”自动更改为当前的凭证类型的凭证号+1
_declare@PZCODE as int
if @object_type='59' and @transaction_type in ( N'A',N'U') and @list_of_key_cols_tab_del=N'DocEntry'
begin
if exists (_select1
from ign1
where ign1.docentry=@list_of_cols_val_tab_del and ign1.BaseType='202'
)
begin
_select@PZCODE=max(isnull(ojdt.u_pzh,0))
from ojdt where u_pzlx='Z'
_updateojdt set u_PZLX ='Z'
from oign where ojdt.TransId=oign.TransId and oign.docentry=@list_of_cols_val_tab_del
_updateojdt set u_pzh=@PZCODE+1
from oign where ojdt.TransId=oign.TransId and oign.docentry=@list_of_cols_val_tab_del
and ojdt.u_PZLX ='Z'
end
end
其他的业务单据类型同理。如:销售发货单,根据类型,将u_pzlx 更改为“Z1”,“U_PZH”自动更改为当前的凭证类型的凭证号+1
if @object_type='15' and @transaction_type in ( N'A',N'U') and @list_of_key_cols_tab_del=N'DocEntry'
begin
if exists (_select1
from ODLN
where ODLN.docentry=@list_of_cols_val_tab_del
)
begin
_select@PZCODE=max(isnull(ojdt.u_pzh,0))
from ojdt where u_pzlx='Z1'
group by ojdt.u_pzlx
_updateojdt set u_PZLX ='Z1'
from ODLN where ojdt.TransId=ODLN.TransId and ODLN.docentry=@list_of_cols_val_tab_del
_updateojdt set u_pzh=@PZCODE+1
from ODLN where ojdt.TransId=ODLN.TransId and ODLN.docentry=@list_of_cols_val_tab_del
and ojdt.u_PZLX ='Z1'
end
end
3.建议再写个格式化搜索,主要作用是:用来财务在做手工凭证如费用类凭证等,当财务做手工凭证时选择相对应的凭证类型,凭证号自动进行取最大值+1.
今天懒得开B1了,我保存在B1里,这个语句很简单的。大家自己写下,(也就是屏幕取值),或者明天我打开B1再把语句写上来吧。
那么采用以上方法,可以解决了此需求,通过存储过程和格式化搜索,既解决了自动生成的财务凭证的凭证类型(凭证字)的分类统计,也解决了手工凭证的凭证类型(凭证字)的分类统计。