Explorar el Código

订单行选择项更新2022年3月23日11:42:35

hu hace 4 años
padre
commit
9cc8f8f841

+ 8 - 1
src/rest/openapi/restcontroller/wechatapp/tinvoiceapply/SQL/开票订单行选择查询.sql

@@ -1,5 +1,8 @@
-select *,t2.freceivedamount from saorderdetail t1
+select *,t2.freceivedamount,tp.fprojectname,sdate.closedate1 from saorderdetail t1
 left join saorder_receivedview t2 on t1.siteid=t2.siteid and t1.saorderdetailid=t2.saorderdetailid
+left join saorder sa on t1.fparentid = sa.saorderid
+left join tproject tp on sa.fprojectnum = tp.fprojectnum
+left join sainvoice_closedate sdate on sdate.fsourceid = t1.saorderdetailid
 where
 t1.siteid=$siteid$ and
 exists(
@@ -7,6 +10,10 @@ exists(
         where siteid=t1.siteid and saorderid=t1.fparentid and saorderdetailid=t1.saorderdetailid
         and isnull(freceivedamount,0)>isnull(t1.finvoiceamount,0)
 )
+and exists(select * from sainvoice_closedate sdate left join saorderdetail t1 on sdate.fsourceid = t1.saorderdetailid
+                where sdate.closedate1 is not null and $where$)
+and exists(select * from tproject tp left join saorder sa on sa.fprojectnum = tp.fprojectnum
+                left join saorderdetail t1 on t1.fparentid = sa.saorderid where $where$)
 and exists(
         select * from saorder
         where fstatus in('ÉóºË','¹Ø±Õ') and siteid=t1.siteid

+ 19 - 1
src/rest/openapi/restcontroller/wechatapp/tinvoiceapply/Tinvoiceapply.java

@@ -11,10 +11,14 @@ import p2.pao.PaoRemote;
 import p2.pao.PaoSetRemote;
 import tinvoiceapply.tinvoiceapply;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 
+import org.apache.commons.lang.StringUtils;
+
 public class Tinvoiceapply extends Controller {
 
     public Tinvoiceapply(JSONObject content) {
@@ -221,18 +225,32 @@ public class Tinvoiceapply extends Controller {
      * 역튿땐데契朞嶝
      *
      * @return
+     * @throws ParseException 
      */
-    public String querySaorderDetail() {
+    public String querySaorderDetail() throws ParseException {
         //String finvoicetaxnumber = content.getString("finvoicetaxnumber");
         long tinvoiceapplyid = content.getLong("tinvoiceapplyid");
+        JSONObject where = content.getJSONObject("where");
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        String wherestr="1=1";
+        if(where!=null){
+            if(where.containsKey("closedate1")&&!StringUtils.isBlank(where.getString("closedate1"))){
+                wherestr = "sdate.closedate1 >="+sdf.parse( where.getString("fbegdate"))+"and sdate.closedate1 <="+sdf.parse( where.getString("fenddate"));
+            }
+            if(where.containsKey("fprojectname")&&!StringUtils.isBlank(where.getString("fprojectname"))){
+                wherestr = "tp.fprojectname like '%"+where.getString("fprojectname")+"%'";
+            }
+        }
         SQLFactory factory = new SQLFactory(this, "역튿땐데契朞嶝꿴璂");
         factory.addParameter("siteid", siteid);
         factory.addParameter("fagentnum", fagentnum);
+        factory.addParameter_SQL("where", wherestr);
         //factory.addParameter("finvoicetaxnumber", finvoicetaxnumber);
         factory.addParameter("tinvoiceapplyid", tinvoiceapplyid);
 
         DBConnect connect = new DBConnect();
         Rows rows = connect.runSqlQuery(factory.getSQL());
         return getReturnObject_suc(rows, false).toString();
+
     }
 }

+ 17 - 3
src/rest/openapi/restcontroller/wechatapp/tinvoiceapply/Tinvoiceapply_saler.java

@@ -10,7 +10,9 @@ import openapi.base.data.db.DBConnect;
 import p2.pao.PaoRemote;
 import p2.pao.PaoSetRemote;
 import tinvoiceapply.tinvoiceapply;
-
+import org.apache.commons.lang.StringUtils;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -256,18 +258,30 @@ public class Tinvoiceapply_saler extends Controller {
      *
      * @return
      */
-    public String querySaorderDetail() {
-        String fagentnum = content.getString("fagentnum");
+    public String querySaorderDetail() throws ParseException {
         //String finvoicetaxnumber = content.getString("finvoicetaxnumber");
         long tinvoiceapplyid = content.getLong("tinvoiceapplyid");
+        JSONObject where = content.getJSONObject("where");
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        String wherestr="1=1";
+        if(where!=null){
+            if(where.containsKey("closedate1")&&!StringUtils.isBlank(where.getString("closedate1"))){
+                wherestr = "sdate.closedate1 >="+sdf.parse( where.getString("fbegdate"))+"and sdate.closedate1 <="+sdf.parse( where.getString("fenddate"));
+            }
+            if(where.containsKey("fprojectname")&&!StringUtils.isBlank(where.getString("fprojectname"))){
+                wherestr = "tp.fprojectname like '%"+where.getString("fprojectname")+"%'";
+            }
+        }
         SQLFactory factory = new SQLFactory(this, "¿ªÆ±¶©µ¥ÐÐÑ¡Ôñ²éѯ");
         factory.addParameter("siteid", siteid);
         factory.addParameter("fagentnum", fagentnum);
+        factory.addParameter_SQL("where", wherestr);
         //factory.addParameter("finvoicetaxnumber", finvoicetaxnumber);
         factory.addParameter("tinvoiceapplyid", tinvoiceapplyid);
 
         DBConnect connect = new DBConnect();
         Rows rows = connect.runSqlQuery(factory.getSQL());
         return getReturnObject_suc(rows, false).toString();
+
     }
 }