Просмотр исходного кода

订单统计明细下单,出货经销商由编号变为简称

hu 3 лет назад
Родитель
Сommit
6c9f1e8e9a

+ 3 - 2
src/rest/openapi/restcontroller/wechatapp/orderform/SQL/订单出货明细.sql

@@ -1,6 +1,6 @@
 declare @siteid varchar(20)
 set @siteid =$siteid$
-select (sainvoicedetail.famount-isnull(sainvoicedetail.finvoiceamount,0)) finvoiceamount ,t1.fsonum,t2.frownum,fpayagentnum,t1.frecagentnum,pp_hr.displayname,t2.fitemname,t2.fspec,t2.fmodel,tunit.fname,t2.fqty,t2.fprice,t2.frateamount,(sainvoicedetail.famount-isnull(sainvoicedetail.FWRITEOFFAMOUNT1,0)) fwriteoffamount,t1.checkdate,SAINVOICE.fdate,t3.fmaterial,t3.fdevice,t3.fspecalnote,t3.fitemno,t3.fnotes,TPROJECT.fprojectname,t4.kaipiaodate from saorder t1
+select (sainvoicedetail.famount-isnull(sainvoicedetail.finvoiceamount,0)) finvoiceamount ,t1.fsonum,t2.frownum,t8.fagentshortname fpayagentnum,t9.fagentshortname frecagentnum,pp_hr.displayname,t2.fitemname,t2.fspec,t2.fmodel,tunit.fname,t2.fqty,t2.fprice,t2.frateamount,(sainvoicedetail.famount-isnull(sainvoicedetail.FWRITEOFFAMOUNT1,0)) fwriteoffamount,t1.checkdate,SAINVOICE.fdate,t3.fmaterial,t3.fdevice,t3.fspecalnote,t3.fitemno,t3.fnotes,TPROJECT.fprojectname,t4.kaipiaodate from saorder t1
 inner join saorderdetail t2 on t1.siteid=t2.siteid and t1.saorderid=t2.fparentid
 left join pp_hr on pp_hr.hrid=t1.fsaler and pp_hr.siteid=t1.siteid
 inner join tunit on tunit.FUNITID=t2.FUNITID
@@ -20,6 +20,7 @@ inner join sainvoice t3 on t4.siteid=t3.siteid and t4.fparentid=t3.sainvoiceid
 where t1.fstatus in('ÉóºË','¹Ø±Õ') and t3.fstatus='¹Ø±Õ' and t1.siteid=@siteid) t7 on t7.saorderdetailid=t2.saorderdetailid and t7.siteid=t2.siteid
 left join (select saorderdetail.SAORDERDETAILID,max(TINVOICEAPPLY.checkdate) kaipiaodate from  saorderdetail left join TINVOICEAPPLYORDER  on saorderdetail.SAORDERDETAILID=TINVOICEAPPLYORDER.SAORDERDETAILID and saorderdetail.siteid=TINVOICEAPPLYORDER.siteid
                              left join TINVOICEAPPLY on TINVOICEAPPLY.TINVOICEAPPLYID=TINVOICEAPPLYORDER.TINVOICEAPPLYID and TINVOICEAPPLY.siteid=TINVOICEAPPLYORDER.siteid where TINVOICEAPPLY.checkdate is not null  group by saorderdetail.SAORDERDETAILID ) t4 on t2.saorderdetailid=t4.saorderdetailid
-
+left join tagents t8 on fpayagentnum=t8.fagentnum and t1.siteid=t8.siteid
+left join tagents t9 on t1.frecagentnum=t9.fagentnum and t1.siteid=t9.siteid
 where t1.fstatus in('ÉóºË','¹Ø±Õ') and t1.siteid=@siteid and CONVERT(VARCHAR(10),SAINVOICE.fdate,120)<=CONVERT(VARCHAR(10),DATEADD(mm,0,getdate()),120) and t1.fagentnum=$fagentnum$ and $where$ order by t1.fsonum desc,t2.frownum asc
 

+ 3 - 2
src/rest/openapi/restcontroller/wechatapp/orderform/SQL/订单出货明细1.sql

@@ -1,6 +1,6 @@
 declare @siteid varchar(20)
 set @siteid =$siteid$
-select (sainvoicedetail.famount-isnull(sainvoicedetail.finvoiceamount,0)) finvoiceamount ,t1.fsonum,t2.frownum,fpayagentnum,t1.frecagentnum,pp_hr.displayname,t2.fitemname,t2.fspec,t2.fmodel,tunit.fname,t2.fqty,t2.fprice,t2.frateamount,(sainvoicedetail.famount-isnull(sainvoicedetail.FWRITEOFFAMOUNT1,0)) fwriteoffamount,t1.checkdate,SAINVOICE.fdate,t3.fmaterial,t3.fdevice,t3.fspecalnote,t3.fitemno,t3.fnotes,TPROJECT.fprojectname,t4.kaipiaodate from saorder t1
+select (sainvoicedetail.famount-isnull(sainvoicedetail.finvoiceamount,0)) finvoiceamount ,t1.fsonum,t2.frownum,t8.fagentshortname fpayagentnum,t9.fagentshortname frecagentnum,pp_hr.displayname,t2.fitemname,t2.fspec,t2.fmodel,tunit.fname,t2.fqty,t2.fprice,t2.frateamount,(sainvoicedetail.famount-isnull(sainvoicedetail.FWRITEOFFAMOUNT1,0)) fwriteoffamount,t1.checkdate,SAINVOICE.fdate,t3.fmaterial,t3.fdevice,t3.fspecalnote,t3.fitemno,t3.fnotes,TPROJECT.fprojectname,t4.kaipiaodate from saorder t1
 inner join saorderdetail t2 on t1.siteid=t2.siteid and t1.saorderid=t2.fparentid
 left join pp_hr on pp_hr.hrid=t1.fsaler and pp_hr.siteid=t1.siteid
 inner join tunit on tunit.FUNITID=t2.FUNITID
@@ -20,6 +20,7 @@ inner join sainvoice t3 on t4.siteid=t3.siteid and t4.fparentid=t3.sainvoiceid
 where t1.fstatus in('ÉóºË','¹Ø±Õ') and t3.fstatus='¹Ø±Õ' and t1.siteid=@siteid) t7 on t7.saorderdetailid=t2.saorderdetailid and t7.siteid=t2.siteid
 left join (select saorderdetail.SAORDERDETAILID,max(TINVOICEAPPLY.checkdate) kaipiaodate from  saorderdetail left join TINVOICEAPPLYORDER  on saorderdetail.SAORDERDETAILID=TINVOICEAPPLYORDER.SAORDERDETAILID and saorderdetail.siteid=TINVOICEAPPLYORDER.siteid
                              left join TINVOICEAPPLY on TINVOICEAPPLY.TINVOICEAPPLYID=TINVOICEAPPLYORDER.TINVOICEAPPLYID and TINVOICEAPPLY.siteid=TINVOICEAPPLYORDER.siteid where TINVOICEAPPLY.checkdate is not null  group by saorderdetail.SAORDERDETAILID ) t4 on t2.saorderdetailid=t4.saorderdetailid
-
+left join tagents t8 on fpayagentnum=t8.fagentnum and t1.siteid=t8.siteid
+left join tagents t9 on t1.frecagentnum=t9.fagentnum and t1.siteid=t9.siteid
 where t1.fstatus in('ÉóºË','¹Ø±Õ') and t1.siteid=@siteid and CONVERT(VARCHAR(10),SAINVOICE.fdate,120)<=CONVERT(VARCHAR(10),DATEADD(mm,0,getdate()),120) and t1.fagentnum=$fagentnum$ and $where$ order by t1.fsonum desc,t2.frownum asc
 

+ 3 - 1
src/rest/openapi/restcontroller/wechatapp/orderform/SQL/订单审核明细.sql

@@ -1,6 +1,6 @@
 declare @siteid varchar(20)
 set @siteid = $siteid$
-select t1.fsonum,t2.frownum,fpayagentnum,t1.frecagentnum,pp_hr.displayname,t2.fitemname,t2.fspec,t2.fmodel,tunit.fname,t2.fqty,t2.fprice,t2.frateamount,(t2.frateamount-isnull(t2.fwriteoffamount,0)) fwriteoffamount,CONVERT(VARCHAR(10),t1.checkdate,120) checkdate,t6.fdate,t3.fmaterial,t3.fdevice,t3.fspecalnote,t3.fitemno,t3.fnotes,TPROJECT.fprojectname,t4.kaipiaodate,(t2.frateamount-isnull(t2.finvoiceamount,0)) finvoiceamount from saorder t1
+select t1.fsonum,t2.frownum,t5.fagentshortname fpayagentnum,t7.fagentshortname frecagentnum,pp_hr.displayname,t2.fitemname,t2.fspec,t2.fmodel,tunit.fname,t2.fqty,t2.fprice,t2.frateamount,(t2.frateamount-isnull(t2.fwriteoffamount,0)) fwriteoffamount,CONVERT(VARCHAR(10),t1.checkdate,120) checkdate,t6.fdate,t3.fmaterial,t3.fdevice,t3.fspecalnote,t3.fitemno,t3.fnotes,TPROJECT.fprojectname,t4.kaipiaodate,(t2.frateamount-isnull(t2.finvoiceamount,0)) finvoiceamount from saorder t1
 inner join saorderdetail t2 on t1.siteid=t2.siteid and t1.saorderid=t2.fparentid 
 inner join pp_hr on pp_hr.hrid=t1.fsaler and pp_hr.siteid=@siteid
 inner join tunit on tunit.FUNITID=t2.FUNITID
@@ -14,5 +14,7 @@ inner join titem t3 on  t2.fitemno=t3.fitemno and t2.siteid=t3.siteid
 left join TPROJECT on TPROJECT.fprojectnum=t1.fprojectnum and TPROJECT.siteid=t1.siteid
 left join (select saorderdetail.SAORDERDETAILID,max(TINVOICEAPPLY.checkdate) kaipiaodate from  saorderdetail left join TINVOICEAPPLYORDER  on saorderdetail.SAORDERDETAILID=TINVOICEAPPLYORDER.SAORDERDETAILID and saorderdetail.siteid=TINVOICEAPPLYORDER.siteid 
                              left join TINVOICEAPPLY on TINVOICEAPPLY.TINVOICEAPPLYID=TINVOICEAPPLYORDER.TINVOICEAPPLYID and TINVOICEAPPLY.siteid=TINVOICEAPPLYORDER.siteid where TINVOICEAPPLY.checkdate is not null  group by saorderdetail.SAORDERDETAILID ) t4 on t2.saorderdetailid=t4.saorderdetailid
+left join tagents t5 on fpayagentnum=t5.fagentnum and t1.siteid=t5.siteid
+left join tagents t7 on t1.frecagentnum=t7.fagentnum and t1.siteid=t7.siteid
 where t1.fstatus in('ÉóºË','¹Ø±Õ') and t1.siteid=@siteid and CONVERT(VARCHAR(10),t1.checkdate,120)<=CONVERT(VARCHAR(10),DATEADD(mm,0,getdate()),120) and t1.fagentnum=$fagentnum$ and $where$ order by t1.fsonum desc,t2.frownum asc