|
|
@@ -22,5 +22,5 @@ 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
|
|
|
-where t1.fstatus in('审核','关闭') and t1.siteid=@siteid and DateDiff(dd,t1.checkdate,getdate())<=365 and t1.fagentnum=$fagentnum$ and $where$ order by t1.fsonum desc,t2.frownum asc
|
|
|
+where t1.fstatus in('审核','关闭') and t1.siteid=@siteid and DateDiff(dd,t6.fdate,getdate())<=365 and t1.fagentnum=$fagentnum$ and $where$ order by t1.fsonum desc,t2.frownum asc
|
|
|
|