管家婆分销ERPV3A8应收查询->往来对账->显示业务凭证摘要

寵の児 提交于 2020-02-12 14:24:36

--特殊处理会计凭证
INSERT INTO #BillIndex
SELECT DISTINCT
A.BillCode,
A.BillNumberId,
A.BillDate,
A.ETypeid,
A.DTypeId,
A.ktypeid,
L.BTypeid,
A.BillType,
L.Total,
L.NTotal,
0 AS totalinmoney,
0 AS ntotalinmoney,
C.Comment,
L.ATypeid,
A.TeamNo,
A.RedWord,
A.preferencemoney,
A.npreferencemoney,
A.ifmulaccount,
AC.fullname AS cfullname,
AC.rate
FROM BillIndex A
INNER JOIN ListTable L ON A.BillNumberID=L.BillNumberID and a.BillType=l.BillType
INNER JOIN AC_currency AC ON L.CID=AC.CID
INNER JOIN #stype S ON A.Stypeid=s.typeid
INNER JOIN #Dtype D ON D.typeid = A.DTypeId
INNER JOIN AC_Items ACI ON L.AtypeId=ACI.nid
INNER JOIN AccountCredence C ON C.BillNumberId = L.BillNumberID and C.ATypeID=L.BTypeID
WHERE A.BillType = 159
AND A.IfCheck = 't'
AND A.Draft = 0
AND ACI.UserCode IN (SELECT typeid FROM #atype1)
AND L.BTypeId = @BTypeId
AND A.BillDate>=@StartDate
AND A.BillDate<=@ENDDate
AND L.CID LIKE @CID

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!