原因为K3结算查询代码多了个
select a.FExchangeRateType,b.FID,a.FClassTypeID,a.FCurrencyID,a.FCustomer,a.FDepartment ,a.FEmployee,a.FItemClassID,a.FBillID FInterID,0 FPre,
0 FIsInit,b.FK3Import,b.FStatus,b.FCheckType, 0 FInvoiceID,a.FBillID FRPBillID,0 FBillID,b.FType,
a.FNumber,a.FDate,a.FFIncDate,a.FAdjustExchangeRate FExchangeRate,a.fcontractno,a.FExplanation,cur.FName FCurrencyName,cur.FScale FScaleFor,
(case b.FType when 1 then '其他应收单'when 2 then '其他应付单' end) FBillTypeName,
i.FNumber FCustomerNo,i.FName FCustomerName,ii.FName FDepartmentName,iii.FName FEmployeeName,
s.FName FPrepareName,t.FName FCheckName,
v.FName+'-'+cast(v.FNumber as Varchar) FVoucherNumber ,''FReceiveTypeName,''FSettleName,''FSettleNo,
'' FOrgNumber,'' FARNumber,''FBankName,'' FBankAccount,
'' FContractNo,''FOrderNo,
0 FReceiveBillID, (case when abs(c.FRemainAmount)>=abs(c.FAmount_commit-c.FLinkCheckAmount-c.FInvoiceAmount-c.FInvLinkCheckAmount) then (c.FRemainAmount-c.FAmount_commit+c.FLinkCheckAmount+c.FInvoiceAmount+c.FInvLinkCheckAmount) else c.FRemainAmount end)FRemainAmount,
(case when abs(c.FRemainAmountFor)>=abs(c.FAmountFor_commit-c.FLinkCheckAmountFor-c.FInvoiceAmountFor-c.FInvLinkCheckAmountFor) then (c.FRemainAmountFor-c.FAmountFor_commit+c.FLinkCheckAmountFor+c.FInvoiceAmountFor+c.FInvLinkCheckAmountFor) else c.FRemainAmountFor end)FRemainAmountFor,
a.FCheckStatus,c.FRemainAmount,c.FRemainAmountFor,c.FAmount,c.FAmountFor,
0 FReceiveAmountFor,0 FReceiveAmount,0 FDiscountAmount,0 FDiscountAmountFor,
0 FSettleAmount,0 FSettleAmountFor,0 FSettleDiscount,0 FSettleDiscountfor,
0 FClassTypeID
,c.FClassID_Src
from t_rp_arpbill a
inner join t_rp_arpbillEntry c on a.FBillID=c.FBillID join t_rp_contact b on a.FBillID=b.FRPBillID
left join t_currency cur on a.FCurrencyID=cur.FCurrencyID
left join t_item i on a.FCustomer=i.FItemID
left join t_item ii on a.FDepartment=ii.FItemID
left join t_item iii on a.FEmployee=iii.FItemID
left join t_user s on a.FPreParer=s.FUserID
left join t_user t on a.FChecker=t.FUserID
Left join (select v1.FVoucherID,v1.FNumber,v2.Fname FName from t_voucher v1
inner join t_vouchergroup v2 on v1.FGroupid=v2.fgroupid)v on b.FVoucherID=v.FVoucherID
where a.FRP=1
and c.FClassID_Src not in (1000021,1000022)
and b.FType not in(8,9) and a.FCheckStatus<>1
and a.FDate>= '1900-1-1'
and a.FDate<= '9999-12-1'
and a.FItemClassID=3
and (b.FStatus & 1)=1
and (b.FStatus & 16)=0
and i.FNumber>='03.0001'
and i.FNumber<='03.0001'
and a.FCurrencyID=1
对于应收款转销,应付款转销无法再进行应收冲应付核算,执行以下代码即可。
/**应收应付转销后bug解决代码**/
set nocount on
update c
set c.FClassID_Src=0
FROM t_RP_ARPBill a INNER JOIN
t_rp_arpbillEntry c ON a.FBillID = c.FBillID
WHERE a.FBillType in (994,991) and c.FClassID_Src in(1000021,1000022)
select '数据处理完成' as sqlnote
set nocount off
/**应收应付转销后bug解决代码*/