select * from RSM_GatheringBill where shopcode='门店编号' and debitaccountcode='科目编号' and code not in (select ChargeUpGatheringBillCode from RSM_SettleGatheringBillDetail where shopcode='门店编号' and ChargeUpReceivableAccountCode='科目编号')
select * from RSM_SettleGatheringBillDetail where shopcode='门店编号' and ChargeUpReceivableAccountCode='科目编号')
查询已经销账的结算单,但是在结算单上却为显示已销,没有显示关联的销账单号。
--------------------------------------------------------------------------------
select RSM_GatheringBill.ExtDecimalA,RSM_SettleGatheringBillDetail.SettleAmount,Code,* from RSM_GatheringBill inner join RSM_SettleGatheringBillDetail
on RSM_GatheringBill.Code=RSM_SettleGatheringBillDetail.ChargeUpGatheringBillCode
where Code in(select ChargeUpGatheringBillCode from RSM_SettleGatheringBillDetail where ParentBillCode='销账单号')
order by RSM_GatheringBill.Code
-----------/*修改已销的结算单状态为已销状态*/---------------
update RSM_GatheringBill set RSM_GatheringBill.ExtDecimalA=RSM_SettleGatheringBillDetail.SettleAmount
from RSM_SettleGatheringBillDetail
where RSM_GatheringBill.Code=RSM_SettleGatheringBillDetail.ChargeUpGatheringBillCode
and Code in(select ChargeUpGatheringBillCode from RSM_SettleGatheringBillDetail where ParentBillCode='销账单号')
-----------/*同步调整门店已销的结算单状态为已销状态*/---------------
exec SYS_SyncPushToShop_InsertAsSQL '门店编号','
update RSM_GatheringBill set RSM_GatheringBill.ExtDecimalA=RSM_SettleGatheringBillDetail.SettleAmount
from RSM_SettleGatheringBillDetail
where RSM_GatheringBill.Code=RSM_SettleGatheringBillDetail.ChargeUpGatheringBillCode
and Code in(select ChargeUpGatheringBillCode from RSM_SettleGatheringBillDetail where ParentBillCode=''销账单号'')
',10,10