执行存储过程
exec IA_SP_WriteUnAccountVouchForST Null,'01'
exec IA_SP_WriteUnAccountVouchForST Null,'08'
exec IA_SP_WriteUnAccountVouchForST Null,'09'
exec IA_SP_WriteUnAccountVouchForST Null,'10'
exec IA_SP_WriteUnAccountVouchForST Null,'11'
exec IA_SP_WriteUnAccountVouchForST32 Null,'32'
exec IA_SP_WriteUnAccountVouchForSA Null,'05'
exec IA_SP_WriteUnAccountVouchForSA Null,'26'
exec IA_SP_WriteUnAccountVouchForSA Null,'27'
不行 IA_ST_UnAccountVouch09(未记账单据表) 无数据 强行写入
insert into IA_ST_UnAccountVouch01(IDUN,IDSUN,cVouTypeUN,cBustypeUN)
select a.ID,b.AutoID,cvouchtype,a.cBusType from rdrecord01 a inner join rdrecords01 b on a.ID=b.ID
where a.ID not in (select idun from IA_ST_UnAccountVouch01)
and b.AutoID not in (select idsun from IA_ST_UnAccountVouch01)
and isnull(cbaccounter,'') ='' and bcosting=1 and isnull(bisstqc,0)=0
insert into IA_ST_UnAccountVouch08(IDUN,IDSUN,cVouTypeUN,cBustypeUN)
select a.ID,b.AutoID,cvouchtype,a.cBusType from rdrecord08 a inner join rdrecords08 b on a.ID=b.ID
where a.ID not in (select idun from IA_ST_UnAccountVouch08)
and b.AutoID not in (select idsun from IA_ST_UnAccountVouch08)
and isnull(cbaccounter,'') ='' and bcosting=1 and isnull(bisstqc,0)=0
insert into IA_ST_UnAccountVouch09(IDUN,IDSUN,cVouTypeUN,cBustypeUN)
select a.ID,b.AutoID,cvouchtype,a.cBusType from rdrecord09 a inner join rdrecords09 b on a.ID=b.ID
where a.ID not in (select idun from IA_ST_UnAccountVouch09)
and b.AutoID not in (select idsun from IA_ST_UnAccountVouch09)
and isnull(cbaccounter,'') ='' and bcosting=1 and isnull(bisstqc,0)=0
insert into IA_SA_UnAccountVouch(IDUN,IDSUN,cVouTypeUN,cBustypeUN)
select a.sbvID,b.AutoID,cvouchtype,a.cBusType from salebillvouch inner join salebillvouchs b on a.sbvID=b.sbvID
where a.sbvID not in (select idun from IA_SA_UnAccountVouch)
and b.AutoID not in (select idsun from IA_SA_UnAccountVouch)
and isnull(cbaccounter,'') ='' and bcosting=1 and isnull(bisstqc,0)=0 and isnull(cbustype,'')='普通销售'
还不行 调拨单和其他出库单(特殊)
主子表ID写入出库单的 rdrecords09sub 一个控制两个表