فهرست منبع

资金流水账导出

hu 3 سال پیش
والد
کامیت
7057947b22

+ 19 - 0
src/custom/restcontroller/sale/cashbill/SQL/资金流水账查询导出.sql

@@ -0,0 +1,19 @@
+select t1.billno,
+       if(t1.type=1,"收入","支出") type,
+       t1.sa_accountclassid,
+       t4.accountname,
+       t1.amount,
+       ifnull(t1.balance,0) balance,
+       t1.remarks,
+       t1.source,
+       t1.createby,
+       t1.createdate,
+       t1.checkby,
+       t1.checkdate 
+from sa_cashbill t1
+         inner join sa_accountclass t4 on t1.sa_accountclassid = t4.sa_accountclassid and t1.siteid = t4.siteid
+where t1.status = '审核'
+  and t1.siteid = $siteid$
+  and $where$
+  and t1.sa_accountclassid = $sa_accountclassid$
+  and t1.sys_enterpriseid = $sys_enterpriseid$

+ 28 - 1
src/custom/restcontroller/sale/cashbill/cashbill.java

@@ -21,6 +21,7 @@ import org.apache.poi.xssf.usermodel.*;
 import restcontroller.R;
 import restcontroller.R;
 import restcontroller.system.attachment.Attachment;
 import restcontroller.system.attachment.Attachment;
 
 
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.ArrayList;
@@ -753,7 +754,7 @@ public class cashbill extends Controller {
 
 
     @API(title = "资金流水账列表查询", apiversion = R.ID20230111103403.v1.class)
     @API(title = "资金流水账列表查询", apiversion = R.ID20230111103403.v1.class)
     @CACHEING
     @CACHEING
-    public String query_cashBill() throws YosException {
+    public String query_cashBill() throws YosException, IOException {
 		/*
 		/*
         过滤条件
         过滤条件
          */
          */
@@ -787,13 +788,26 @@ public class cashbill extends Controller {
         /**
         /**
          * SQL资金流水账查询参数设置并查询
          * SQL资金流水账查询参数设置并查询
          */
          */
+        boolean isExport = content.getBooleanValue("isExport");
         SQLFactory factory = new SQLFactory(this, "资金流水账查询", pageSize, pageNumber, pageSorting);
         SQLFactory factory = new SQLFactory(this, "资金流水账查询", pageSize, pageNumber, pageSorting);
+        if(isExport){
+            factory = new SQLFactory(this, "资金流水账查询导出");
+        }
         factory.addParameter("sys_enterpriseid", sys_enterpriseid);
         factory.addParameter("sys_enterpriseid", sys_enterpriseid);
         factory.addParameter("sa_accountclassid", sa_accountclassid);
         factory.addParameter("sa_accountclassid", sa_accountclassid);
         factory.addParameter("siteid", siteid);
         factory.addParameter("siteid", siteid);
         factory.addParameter_SQL("where", where);
         factory.addParameter_SQL("where", where);
         Rows rows = dbConnect.runSqlQuery(factory.getSQL());
         Rows rows = dbConnect.runSqlQuery(factory.getSQL());
 
 
+        if (isExport) {
+            //去除不需要导出项
+            rows.getFieldList().remove("sa_accountclassid");
+            rows.getFieldList().remove("balance");
+            rows.getFieldList().remove("createby");
+            rows.getFieldList().remove("createdate");
+            Rows uploadRows = uploadExcelToObs("cashBill", "资金流水账列表", rows, getTitleMap());
+            return getSucReturnObject().setData(uploadRows).toString();
+        }
 
 
         /**
         /**
          * SQL资金流水账汇总信息查询参数设置并查询
          * SQL资金流水账汇总信息查询参数设置并查询
@@ -1001,4 +1015,17 @@ public class cashbill extends Controller {
         }
         }
         return sheet;
         return sheet;
     }
     }
+    //返回导出的标题
+    public HashMap<String, String> getTitleMap() {
+        HashMap<String, String> titleMap = new HashMap<>();
+        titleMap.put("billno", "凭证编号");
+        titleMap.put("type", "收支类型");
+        titleMap.put("accountname", "账户名称");
+        titleMap.put("amount", "收支金额");
+        titleMap.put("source", "凭证来源");
+        titleMap.put("checkby", "审核人");
+        titleMap.put("checkdate", "审核时间");
+        titleMap.put("remarks", "备注");
+        return titleMap;
+    }
 }
 }