请上传宽度大于 1200px,高度大于 164px 的封面图片
    调整图片尺寸与位置
    滚轮可以放大缩小图片尺寸,按住图片拖动可调整位置,多余的会自动被裁剪掉
取消
zhangjinrui(uid:778105)
职业资格认证:尚未取得认证
  • 各位,我需要根据pbvid汇总每条pbvid对应的isum值,然后需要分别用iamount(同一个值)减去汇总的这个值,具体的语句应该如何描述,这个语句具体怎么改?select ta.iamount+isum-ta.iapplyamt as fsum,* from (select app.dVouchDate,apps.iApplyAmt,ap.cexch_name,app.cSSCode,app.cVouchID,app.cvouchtype,app.cDigest,app.dCloseDate,app.PID,ap.iamount,v.cVenName,v.cVenCode,ss.cSSNamefrom Ap_Vouch ap,AP_ApplyPayVouch app,AP_ApplyPayVouchs apps,Vendor v,SettleStyle sswhere ap.cFlag=app.cFlag and ap.bStartFlag=1 and app.PID=apps.PID and app.cSSCode=ss.cSSCode and  ap.cDwCode=v.cvencode) tafull join(select pb.cAuditDate,pbs.iSum,pb.cPBVMemo,pbs.cPZNum,pb.cVenCode,pb.cPBVVerifier,cPBVMaker,pb.dGatheringDate,pb.cOrderCode,pb.cPBVCode,pb.cPBVBillType,pb.cBusType,pbs.PBVIDfrom PurBillVouch pb,PurBillVouchs pbs,Vendor vwhere pbs.PBVID=pb.PBVID  and pb.cVenCode=v.cvencode) tbon ta.cVenCode=tb.cVenCodewhere dVouchDate is not null
  • 如何根据结果逐行相加,就是应付款金额相加,并且显示每一行相加的结果(就是逐行累加),最终需要根据供应商编码分类汇总
  • 各位,问题如下:需要按照票据类型的不同做加减运算,每个公司有个PO类型的期初数据,遇到应付金额就相加,遇到付款金额就相减,需要新增一个数据列,存放每一行的运算结果,数据需要循环累加或者累减,最后汇总得到当前供应商的最终数据select ta.单据日期, ta.凭证编号,ta.应付款金额,ta.付款申请金额,ta.供应商编码,ta.供应商名称,ta.票据类型,ta.单据号,ta.备注,ta.币种,ta.应收应付标志,ta.结算方式,ta.审核人,ta.制单人,ta.到期日或修改日期from (select ap.dVouchDate as 单据日期,ap.cPZNum as 凭证编号,ap.iAmount as 应付款金额,ap.cdefine5 as 付款申请金额,ap.cDwCode as 供应商编码,v.cVenName as 供应商名称 ,ap.cVouchType as 票据类型,ap.cVouchID as 单据号,case bStartFlag when 1 then '期初余额'   end as 备注/*数据属性*/,ap.cexch_name as 币种,ap.cFlag as 应收应付标志,ap.cDigest as 结算方式,ap.cDefine1 as 审核人,ap.cDefine1 as 制单人 ,ap.dmoddate as 到期日或修改日期from Ap_Vouch ap,Vendor vwhere bStartFlag=1/*期初余额表,数据正确*/ and ap.cdwcode=v.cVenCodeunion allselect pb.dpbvdate as 开票日期,pbs.cPZNum as 凭证号,sum(isum)as 本期应付 /*本期应付*/ ,pb.cdefine5 as 备用列,pb.cVenCode as 供应商编码,v.cVenName as 供应商名称,case bFirst when 0 then '采购发票'   end as 单据类型 ,cPBVCode as 单据号 ,pb.cPBVMemo as 摘要,pb.cexch_name as币种 ,pb.cdefine1 as 备用列 ,pb.cdefine1 as 备用列,pb.cPBVVerifier as 审核人,cPBVMaker as 制单人,pb.dGatheringDate as 到期日from PurBillVouch pb,PurBillVouchs pbs,Vendor vwhere pb.pbvid=pbs.PBVID and pb.cVenCode=v.cvencode and pb.cVenCode=v.cVenCodegroup by cPBVCode,pb.cPBVMemo ,pbs.cPZNum ,pb.cVenCode ,pb.cPBVVerifier ,cPBVMaker ,pb.cPBVCode ,pb.dGatheringDate ,pbs.PBVID,dpbvdate,bFirst,v.cVenName,pb.cDefine1,pb.cexch_name,cdefine5/*发票*/union allselect ap.dvouchdate as 票据日期,ap.cDefine9 as 凭证编号,ap.cdefine5 as 备用列,aps.iApplyAmt as 本期付款申请金额 ,ap.cdwcode as 供应商编码,v.cVenName as 供应商名称,case cVouchType when 'AP40' then '付款申请单'end as 单据类型, ap.cVouchID as 单据号,ap.cdigest as 摘要,ap.cexch_name as 币种,cdefine1,ss.cSSName as 结算方式,ap.cCheckMan as 检查人,cdefine1,ap.dCloseDate as 关闭日期from AP_ApplyPayVouch ap,AP_ApplyPayVouchs aps,Vendor v,SettleStyle sswhere ap.PID=aps.pid and ap.cDwCode=v.cVenCode and ap.cSSCode=ss.cSSCode/*付款申请表*/)tagroup by ta.供应商编码,ta.供应商名称,ta.单据日期, ta.凭证编号,ta.应付款金额,ta.票据类型,ta.单据号,ta.备注,ta.币种,ta.应收应付标志,ta.结算方式,ta.到期日或修改日期,ta.审核人,ta.制单人,ta.付款申请金额
  • select ap.dVouchDate as 单据日期,ap.cPZNum as 凭证编号,case bStartFlag when 1 then '期初余额'   end as 摘要/*数据属性*/,ap.cDwCode as 供应商编码,ap.cVouchID as 票据号,ap.cVouchType as 票据类型,ap.cexch_name as 币种,ap.iAmount as 期初余额,ap.cFlag as 应收应付标志,ap.cOperator as 操作人,ap.bStartFlag as 期初标志from Ap_Vouch apwhere bStartFlag=1/*期初余额表,数据正确*/union allselect pb.dpbvdate as 开票日期,pbs.cPZNum as 凭证号,pb.cPBVMemo as 摘要,sum(isum)as 本期应付 /*本期应付*/ ,pb.cVenCode as 供应商编码,cPBVCode as 单据号 ,pb.cPBVVerifier as 审核人,cPBVMaker as 制单人,pb.cPBVCode as 订单号,pb.dGatheringDate as 到期日,pbs.PBVID as 采购发票号from PurBillVouch pb,PurBillVouchs pbs,Vendor vwhere pb.pbvid=pbs.PBVID and pb.cVenCode=v.cvencodegroup by cPBVCode,pb.cPBVMemo ,pbs.cPZNum ,pb.cVenCode ,pb.cPBVVerifier ,cPBVMaker ,pb.cPBVCode ,pb.dGatheringDate ,pbs.PBVID,dpbvdate/*发票*/union allselect ap.dvouchdate as 票据日期,ap.cVouchID as 单据号,ap.cdigest as 摘要,aps.iApplyAmt as 本期付款申请金额 ,case cVouchType when 'AP40' then '付款申请单'end as 票据类型, ap.cdwcode as 供应商编码,v.cVenName as 供应商名称,ap.cexch_name as 币种,ss.cSSName as 结算方式,ap.cCheckMan as 检查人,ap.cFlagfrom AP_ApplyPayVouch ap,AP_ApplyPayVouchs aps,Vendor v,SettleStyle sswhere ap.PID=aps.pid and ap.cDwCode=v.cVenCode and ap.cSSCode=ss.cSSCode/*付款申请表*/
  • 这个bstartflags 是bit 类型的数据,我需要将等于1的值变成期初余额,应该如和戒绝
  • select OrderDId,so.cMaker as 制单人,sos.cSCloser as 关闭人,sos.dbclosesystime as 关闭时间,SO.cCusCode AS 客户编码,c.cCusName as 客户名称 ,so.cSOCode as 销售订单,so.iverifystate ,so.dDate as 订单日期,sos.cInvCode as 存货编码,i.cInvName as 存货名称,i.fGrossW as 毛重,sos.cFree1 as 色号 ,ie.cidefine10 as 是否定制,sos.iQuantity as 订单数量,ISNULL(sos.foutquantity,0) as 累计出库数量 ,(sos.iQuantity-ISNULL(sos.foutquantity,0)) as 未出库数量 ,a.CreateDate as 生产日期,a.Qty as 生产数量,a.dDate as 入库日期,a.iQuantity as 入库数量, dis.cDLCode as 发货单号 ,dis.dDate as 发货日期,diss.iQuantity as 发货数量,rd32.cCode as 出库单号,rd32.dDate as 出库日期,rds32.cBatch 系统出库批号,rds32.cDefine32 实际出库批号,rds32.iQuantity as 出库数量 from  SO_SOMain so with (nolock) left join SO_SODetails sos with (nolock) on so.ID=sos.IDleft join (select OrderDId,sum(qty)as qty,sum(rd10.iQuantity)as iQuantity,min(mom.CreateDate) as CreateDate ,max(rd10.ddate) as ddatefrom  mom_orderdetail momo with  (nolock) left join  mom_order mom with (nolock) on mom.MoId=momo.MoIdleft join  (select max(ddate) as ddate,cmocode,iMPoIds,sum(iQuantity) iQuantity from rdrecords10 rds10 with (nolock)  inner join  rdrecord10  rd10 with (nolock) on rd10.ID=rds10.ID group by cmocode,iMPoIds ) rd10 on rd10.cmocode=mom.MoCode and rd10.iMPoIds=momo.MoDId group by OrderDId) a on a.OrderDId=sos.iSOsID left join DispatchLists diss with (nolock) on diss.cSoCode=so.cSoCode  and diss.iSOsID=sos.iSOsIDleft join DispatchList dis with (nolock) on dis.DLID=diss.DLID left join  rdrecords32 rds32 with (nolock) on  rds32.iDLsID=diss.iDLsID left join rdrecord32 rd32 with (nolock) on rd32.id=rds32.IDleft join Inventory  I with(nolock) on sos.cinvcode=i.cinvcodeleft join Inventory_extradefine ie with(nolock) on ie.cInvCode=sos.cInvCodeleft join Customer  c with (nolock) on c.cCusCode=so.cCusCode 

23

8

23

10

个人成就
内容被浏览9,603
加入社区2年355天
返回顶部