|
@@ -1,9 +1,9 @@
|
|
|
select *,t2.freceivedamount,tp.fprojectname,sdate.closedate1 from saorderdetail t1
|
|
select *,t2.freceivedamount,tp.fprojectname,sdate.closedate1 from saorderdetail t1
|
|
|
inner join saorder_receivedview t2 on t1.siteid=t2.siteid and t1.saorderdetailid=t2.saorderdetailid and isnull(t2.freceivedamount,0)>isnull(t1.finvoiceamount,0)
|
|
inner join saorder_receivedview t2 on t1.siteid=t2.siteid and t1.saorderdetailid=t2.saorderdetailid and isnull(t2.freceivedamount,0)>isnull(t1.finvoiceamount,0)
|
|
|
-inner join saorder sa on t1.fparentid = sa.saorderid
|
|
|
|
|
-left join tproject tp on sa.fprojectnum = tp.fprojectnum
|
|
|
|
|
|
|
+inner join saorder sa on t1.fparentid = sa.saorderid and sa.fpayagentnum=$fagentnum$ and sa.fstatus in('ÉóºË','¹Ø±Õ')
|
|
|
|
|
+left join tproject tp on sa.fprojectnum = tp.fprojectnum and sa.siteid=tp.siteid
|
|
|
left join sainvoice_closedate sdate on sdate.fsourceid = t1.saorderdetailid
|
|
left join sainvoice_closedate sdate on sdate.fsourceid = t1.saorderdetailid
|
|
|
-where t1.siteid=$siteid$ and sa.fpayagentnum=$fagentnum$ and sa.fstatus in('ÉóºË','¹Ø±Õ')
|
|
|
|
|
|
|
+where t1.siteid=$siteid$
|
|
|
and not exists(
|
|
and not exists(
|
|
|
select *from tinvoiceapplyorder where siteid=$siteid$ and tinvoiceapplyid=$tinvoiceapplyid$ and saorderdetailid=t1.saorderdetailid
|
|
select *from tinvoiceapplyorder where siteid=$siteid$ and tinvoiceapplyid=$tinvoiceapplyid$ and saorderdetailid=t1.saorderdetailid
|
|
|
) and $where$
|
|
) and $where$
|