科目明细账
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java
index 2c0fae9..f88623d 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/dao/SubjectDao.java
@@ -25,4 +25,7 @@
   String getSubjectname(@Param("subjno") String subjno);
 
   TSubject findBySubjno(String subjno);
+
+  @Query("from TSubject where displayflag='y' order by subjno ")
+  List<TSubject> findAllDisplaySubjects();
 }
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherDao.java
index e839c01..d8b831e 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherDao.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherDao.java
@@ -3,6 +3,9 @@
 import com.supwisdom.dlpay.framework.data.ExistBean;
 import com.supwisdom.dlpay.framework.data.MerchBean;
 import com.supwisdom.dlpay.framework.domain.TVoucher;
+import com.supwisdom.dlpay.system.bean.SubjectDetailShowBean;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.Lock;
 import org.springframework.data.jpa.repository.Modifying;
@@ -37,4 +40,9 @@
   @Lock(LockModeType.PESSIMISTIC_WRITE)
   @Query(value = "from TVoucher where voucherid=:voucherid ")
   TVoucher findByVoucheridWithLock(@Param("voucherid") Integer voucherid);
+
+  @Query(value = "select new com.supwisdom.dlpay.system.bean.SubjectDetailShowBean(a.voucherdate,a.voucherno,b.subjno,b.summary,b.dramt,b.cramt,b.balflag,b.balance,b.oppname) " +
+      "from TVoucher a,TVoucherEntry b where a.voucherid=b.voucherid and a.postflag=1 and a.voucherdate>=:startdate and a.voucherdate<=:enddate and b.subjno=:subjno order by a.voucherdate,a.voucherno ",
+      countQuery = "select count(a.voucherdate) from TVoucher a,TVoucherEntry b where a.voucherid=b.voucherid and a.postflag=1 and a.voucherdate>=:startdate and a.voucherdate<=:enddate and b.subjno=:subjno ")
+  Page<SubjectDetailShowBean> getSubjectDetailInfos(@Param("startdate") Integer startdate, @Param("enddate") Integer enddate, @Param("subjno") String subjno, Pageable pageable);
 }
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDetailShowBean.java b/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDetailShowBean.java
new file mode 100644
index 0000000..2cc3222
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/SubjectDetailShowBean.java
@@ -0,0 +1,100 @@
+package com.supwisdom.dlpay.system.bean;
+
+public class SubjectDetailShowBean {
+  private Integer voucherdate; //凭证日期
+  private Integer voucherno; //凭证编号
+  private String subjno;
+  private String summary;
+  private Double dramt;
+  private Double cramt;
+  private Integer balflag;//1-借;2-贷
+  private Double balance;
+  private String oppname;
+
+  public SubjectDetailShowBean() {
+  }
+
+  public SubjectDetailShowBean(Integer voucherdate, Integer voucherno, String subjno, String summary, Double dramt, Double cramt, Integer balflag, Double balance, String oppname) {
+    this.voucherdate = voucherdate;
+    this.voucherno = voucherno;
+    this.subjno = subjno;
+    this.summary = summary;
+    this.dramt = dramt;
+    this.cramt = cramt;
+    this.balflag = balflag;
+    this.balance = balance;
+    this.oppname = oppname;
+  }
+
+  public Integer getVoucherdate() {
+    return voucherdate;
+  }
+
+  public void setVoucherdate(Integer voucherdate) {
+    this.voucherdate = voucherdate;
+  }
+
+  public Integer getVoucherno() {
+    return voucherno;
+  }
+
+  public void setVoucherno(Integer voucherno) {
+    this.voucherno = voucherno;
+  }
+
+  public String getSubjno() {
+    return subjno;
+  }
+
+  public void setSubjno(String subjno) {
+    this.subjno = subjno;
+  }
+
+  public String getSummary() {
+    return summary;
+  }
+
+  public void setSummary(String summary) {
+    this.summary = summary;
+  }
+
+  public Double getDramt() {
+    return dramt;
+  }
+
+  public void setDramt(Double dramt) {
+    this.dramt = dramt;
+  }
+
+  public Double getCramt() {
+    return cramt;
+  }
+
+  public void setCramt(Double cramt) {
+    this.cramt = cramt;
+  }
+
+  public Integer getBalflag() {
+    return balflag;
+  }
+
+  public void setBalflag(Integer balflag) {
+    this.balflag = balflag;
+  }
+
+  public Double getBalance() {
+    return balance;
+  }
+
+  public void setBalance(Double balance) {
+    this.balance = balance;
+  }
+
+  public String getOppname() {
+    return oppname;
+  }
+
+  public void setOppname(String oppname) {
+    this.oppname = oppname;
+  }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/SettleReportController.java b/src/main/java/com/supwisdom/dlpay/system/controller/SettleReportController.java
index b86669e..71c00d9 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/SettleReportController.java
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/SettleReportController.java
@@ -1,11 +1,15 @@
 package com.supwisdom.dlpay.system.controller;
 
+import com.supwisdom.dlpay.api.bean.BaseResp;
 import com.supwisdom.dlpay.api.bean.JsonResult;
 import com.supwisdom.dlpay.framework.domain.TSubject;
 import com.supwisdom.dlpay.framework.util.DateUtil;
 import com.supwisdom.dlpay.framework.util.PageResult;
 import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.framework.util.WebConstant;
 import com.supwisdom.dlpay.system.bean.SubjectDayShowBean;
+import com.supwisdom.dlpay.system.bean.SubjectDetailShowBean;
+import com.supwisdom.dlpay.system.bean.TreeSelectNode;
 import com.supwisdom.dlpay.system.service.SettleReportService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -15,11 +19,30 @@
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 
+import java.util.List;
+
 @Controller
 public class SettleReportController {
   @Autowired
   private SettleReportService settleReportService;
 
+  private boolean checkReportDate(String startdate, String enddate, BaseResp resp) {
+    if (StringUtil.isEmpty(startdate) || StringUtil.isEmpty(enddate)) {
+      resp.setRetcode("99");
+      resp.setRetmsg("请选择时间段");
+      return false;
+    } else if (!DateUtil.checkDatetimeValid(DateUtil.unParseToDateFormat(startdate), "yyyyMMdd")) {
+      resp.setRetcode("99");
+      resp.setRetmsg("起始时间非法");
+      return false;
+    } else if (!DateUtil.checkDatetimeValid(DateUtil.unParseToDateFormat(enddate), "yyyyMMdd")) {
+      resp.setRetcode("99");
+      resp.setRetmsg("截止时间非法");
+      return false;
+    }
+    return true;
+  }
+
   /**
    * ====================================================
    * 科目日结表
@@ -35,16 +58,13 @@
   @GetMapping("/report/subjectdaylist")
   @PreAuthorize("hasPermission('/report/subjectday','')")
   @ResponseBody
-  public PageResult<SubjectDayShowBean> getSubjectdayData(@RequestParam(value = "startdate",required = false) String startdate,
-                                                          @RequestParam(value = "enddate",required = false) String enddate,
+  public PageResult<SubjectDayShowBean> getSubjectdayData(@RequestParam(value = "startdate", required = false) String startdate,
+                                                          @RequestParam(value = "enddate", required = false) String enddate,
                                                           @RequestParam(value = "nodealshow", required = false, defaultValue = "false") Boolean noDealShow) {
     try {
-      if (StringUtil.isEmpty(startdate) || StringUtil.isEmpty(enddate)) {
-        return new PageResult<>(99, "请选择时间段");
-      } else if (!DateUtil.checkDatetimeValid(DateUtil.unParseToDateFormat(startdate), "yyyyMMdd")) {
-        return new PageResult<>(99, "起始时间非法");
-      } else if (!DateUtil.checkDatetimeValid(DateUtil.unParseToDateFormat(enddate), "yyyyMMdd")) {
-        return new PageResult<>(99, "截止时间非法");
+      BaseResp resp = new BaseResp();
+      if (!checkReportDate(startdate, enddate, resp)) {
+        return new PageResult<>(99, resp.getRetmsg());
       }
       return settleReportService.getSubjectDayInfos(DateUtil.unParseToDateFormat(startdate), DateUtil.unParseToDateFormat(enddate), noDealShow);
     } catch (Exception e) {
@@ -53,5 +73,48 @@
     }
   }
 
+  /**
+   * ====================================================
+   * 科目明细账
+   * ====================================================
+   */
+  @GetMapping("/report/subjectdetail")
+  public String subjectDetailReport(ModelMap map) {
+    String settledate = settleReportService.getSystemSettledate();
+    map.addAttribute("maxdate", DateUtil.parseToDateFormat(DateUtil.getNewDay(settledate, -1)));
+    return "system/report/subjectdetail";
+  }
+
+  @GetMapping("/report/subjectdetaillist")
+  @PreAuthorize("hasPermission('/report/subjectdetail','')")
+  @ResponseBody
+  public PageResult<SubjectDetailShowBean> getSubjectData(@RequestParam("page") Integer pageNo,
+                                                          @RequestParam("limit") Integer pageSize,
+                                                          @RequestParam(value = "startdate", required = false) String startdate,
+                                                          @RequestParam(value = "enddate", required = false) String enddate,
+                                                          @RequestParam(value = "subjno", required = false) String subjno) {
+    try {
+      BaseResp resp = new BaseResp();
+      if (!checkReportDate(startdate, enddate, resp)) {
+        return new PageResult<>(99, resp.getRetmsg());
+      }
+      if (StringUtil.isEmpty(subjno)) {
+        return new PageResult<>(99, "请选择科目");
+      }
+      if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
+      if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
+      return settleReportService.getSubjectDetailInfos(DateUtil.unParseToDateFormat(startdate), DateUtil.unParseToDateFormat(enddate), subjno.trim(), pageNo, pageSize);
+    } catch (Exception e) {
+      e.printStackTrace();
+      return new PageResult<>(99, "系统查询错误");
+    }
+  }
+
+  @GetMapping("/report/subjectselecttree")
+  @PreAuthorize("hasPermission('/report/subjectdetail','')")
+  @ResponseBody
+  public List<TreeSelectNode> getSubjectSelectTree(){
+    return settleReportService.getSystemShowSubjectTree();
+  }
 
 }
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/SettleReportService.java b/src/main/java/com/supwisdom/dlpay/system/service/SettleReportService.java
index cf59944..7abff58 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/SettleReportService.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/SettleReportService.java
@@ -2,13 +2,23 @@
 
 import com.supwisdom.dlpay.framework.util.PageResult;
 import com.supwisdom.dlpay.system.bean.SubjectDayShowBean;
+import com.supwisdom.dlpay.system.bean.SubjectDetailShowBean;
+import com.supwisdom.dlpay.system.bean.TreeSelectNode;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.List;
+
 public interface SettleReportService {
   @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
   String getSystemSettledate();
 
   @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
   PageResult<SubjectDayShowBean> getSubjectDayInfos(String startdate,String enddate, boolean nodealshow);
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+  PageResult<SubjectDetailShowBean> getSubjectDetailInfos(String startdate,String enddate,String subjno, int pageNo,int pageSize);
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+  List<TreeSelectNode> getSystemShowSubjectTree();
 }
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java
index dabf5e8..8bce060 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java
@@ -1,16 +1,23 @@
 package com.supwisdom.dlpay.system.service.impl;
 
 import com.supwisdom.dlpay.framework.dao.SettleCtlDao;
+import com.supwisdom.dlpay.framework.dao.SubjectDao;
 import com.supwisdom.dlpay.framework.dao.SubjectdayDao;
+import com.supwisdom.dlpay.framework.dao.VoucherDao;
 import com.supwisdom.dlpay.framework.domain.TSettlectl;
+import com.supwisdom.dlpay.framework.domain.TSubject;
 import com.supwisdom.dlpay.framework.util.DateUtil;
-import com.supwisdom.dlpay.framework.util.MoneyUtil;
 import com.supwisdom.dlpay.framework.util.PageResult;
 import com.supwisdom.dlpay.framework.util.StringUtil;
 import com.supwisdom.dlpay.system.bean.SubjectDayInfo;
 import com.supwisdom.dlpay.system.bean.SubjectDayShowBean;
+import com.supwisdom.dlpay.system.bean.SubjectDetailShowBean;
+import com.supwisdom.dlpay.system.bean.TreeSelectNode;
 import com.supwisdom.dlpay.system.service.SettleReportService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
@@ -22,6 +29,10 @@
   private SubjectdayDao subjectdayDao;
   @Autowired
   private SettleCtlDao settleCtlDao;
+  @Autowired
+  private VoucherDao voucherDao;
+  @Autowired
+  private SubjectDao subjectDao;
 
   @Override
   public String getSystemSettledate() {
@@ -66,4 +77,57 @@
     }
     return new PageResult<SubjectDayShowBean>(result);
   }
+
+  @Override
+  public PageResult<SubjectDetailShowBean> getSubjectDetailInfos(String startdate, String enddate, String subjno, int pageNo, int pageSize) {
+    Pageable pageable = PageRequest.of(pageNo - 1, pageSize);
+    Page<SubjectDetailShowBean> page = voucherDao.getSubjectDetailInfos(Integer.valueOf(startdate),Integer.valueOf(enddate),subjno,pageable);
+    return new PageResult<>(page);
+  }
+
+  @Override
+  public List<TreeSelectNode> getSystemShowSubjectTree() {
+    List<TSubject> list = subjectDao.findAllDisplaySubjects();
+    List<TreeSelectNode> result = new ArrayList<>(0);
+    if (!StringUtil.isEmpty(list)) {
+      for (TSubject subject : list) {
+        if (subject.getSubjlevel() == 1) {
+          TreeSelectNode node = new TreeSelectNode();
+          node.setId(subject.getSubjno());
+          node.setName(subject.getSubjname());
+          node.setOpen(subject.getEndflag() == 0);
+          node.setChecked(false);
+          node.setChildren(null);
+          node.setAccno(subject.getEndflag().toString());
+          if (subject.getEndflag() == 0) {
+            node.setChildren(getSubjectSelectTree(list, subject.getSubjno())); //下级科目
+          }
+          result.add(node);
+        }
+      }
+    }
+    return result;
+  }
+
+  private List<TreeSelectNode> getSubjectSelectTree(List<TSubject> subjectList, String fsubjno) {
+    List<TreeSelectNode> result = null;
+    for (TSubject subject : subjectList) {
+      if (fsubjno.equals(subject.getFsubjno())) {
+        TreeSelectNode node = new TreeSelectNode();
+        node.setId(subject.getSubjno());
+        node.setName(subject.getSubjname());
+        node.setOpen(subject.getEndflag() == 0);
+        node.setChecked(false);
+        List<TreeSelectNode> children = null;
+        if (subject.getEndflag() == 0) {
+          children = getSubjectSelectTree(subjectList, subject.getSubjno());
+        }
+        node.setChildren(children);
+        node.setAccno(subject.getEndflag().toString());
+        if (null == result) result = new ArrayList<>(0); //初始化
+        result.add(node);
+      }
+    }
+    return result;
+  }
 }
diff --git a/src/main/resources/static/libs/custom.js b/src/main/resources/static/libs/custom.js
index 0560c24..24dc9ad 100644
--- a/src/main/resources/static/libs/custom.js
+++ b/src/main/resources/static/libs/custom.js
@@ -92,4 +92,8 @@
     root.getTempDictValue = function (dicttype, key) {
         return DictPoolToolkit().getDictValue(dicttype, key);
     }
+
+    root.dateFormat = function (str) {
+        return str.replace(/^(\d{4})(\d{2})(\d{2})$/, '$1-$2-$3'); //yyyyMMdd --> yyyy-MM-dd
+    }
 }(window));
\ No newline at end of file
diff --git a/src/main/resources/templates/system/report/subjectday.html b/src/main/resources/templates/system/report/subjectday.html
index 75c140c..43acfa0 100644
--- a/src/main/resources/templates/system/report/subjectday.html
+++ b/src/main/resources/templates/system/report/subjectday.html
@@ -74,7 +74,7 @@
         var renderTable = function (obj) {
             layer.load(2);
             treetable.render({
-                id: 'subjectDayReport',
+                id: 'SubjectDayReport',
                 title: '科目汇总表',
                 treeColIndex: 0,
                 treeSpid: '-1',
@@ -113,7 +113,29 @@
                         {field: 'crbal', title: '贷方', align: 'center'}
                     ]
                 ],
+                // cols: [
+                //     [
+                //         {field: 'subjno', title: '科目号', align: 'left'},
+                //         {
+                //             field: 'subjname', title: '科目名称', align: 'left', templet: function (d) {
+                //                 if (d.subjlevel == 1) {
+                //                     return '<span>' + d.subjname + '</span>';
+                //                 } else {
+                //                     return '<span>&nbsp;&nbsp;&nbsp;&nbsp;' + d.subjname + '</span>';
+                //                 }
+                //
+                //             }
+                //         },
+                //         {field: 'lastdaydrbal', title: '期初余额(借方)', align: 'center'},
+                //         {field: 'lastdaycrbal', title: '期初余额(贷方)', align: 'center'},
+                //         {field: 'dramt', title: '本期发生额(借方)', align: 'center'},
+                //         {field: 'cramt', title: '本期发生额(贷方)', align: 'center'},
+                //         {field: 'drbal', title: '期末余额(借方)', align: 'center'},
+                //         {field: 'crbal', title: '期末余额(贷方)', align: 'center'}
+                //     ]
+                // ],
                 done: function (res, curr, count) {
+                    console.log(res);
                     layer.closeAll('loading');
                 }
             });
diff --git a/src/main/resources/templates/system/report/subjectdetail.html b/src/main/resources/templates/system/report/subjectdetail.html
new file mode 100644
index 0000000..7b3bb58
--- /dev/null
+++ b/src/main/resources/templates/system/report/subjectdetail.html
@@ -0,0 +1,174 @@
+<div class="layui-card">
+    <div class="layui-card-header">
+        <h2 class="header-title">科目明细账</h2>
+        <span class="layui-breadcrumb pull-right">
+          <a href="#">结算中心</a>
+          <a><cite>科目明细账</cite></a>
+        </span>
+    </div>
+    <div class="layui-card-body">
+        <div class="layui-form" lay-filter="subjectdetail-search-form">
+            <input type="hidden" id="subjectdetail-hidden-maxdate" th:value="${maxdate}" />
+            <div class="layui-form-item" style="margin-bottom: 0;">
+                <div class="layui-inline">
+                    <label class="layui-form-label">结算日期</label>
+                    <div class="layui-input-inline">
+                        <input type="text" name="startdate" id="subjectdetail-search-startdate" placeholder="起始日期" th:value="${maxdate}"
+                               autocomplete="off" class="layui-input"/>
+                    </div>
+                    <div class="layui-form-mid">-</div>
+                    <div class="layui-input-inline">
+                        <input type="text" name="enddate" id="subjectdetail-search-enddate" placeholder="截止日期" th:value="${maxdate}"
+                               autocomplete="off" class="layui-input"/>
+                    </div>
+                </div>
+
+                <div class="layui-inline">
+                    <label class="layui-form-label">选择科目</label>
+                    <div class="layui-input-block">
+                        <input type="text" name="subjno" id="subjectdetail-search-subjno" placeholder="选择科目" lay-filter="subjectdetail-search-subjno-filter"
+                               autocomplete="off" class="layui-input"/>
+                    </div>
+                </div>
+
+                <div class="layui-inline">
+                    <button id="subjectdetail-search-btn" class="layui-btn icon-btn" data-type="search"><i
+                            class="layui-icon">&#xe615;</i>搜索
+                    </button>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="layui-card-body">
+        <table class="layui-table" id="subjectDetailTable" lay-filter="subjectDetailTable-filter"></table>
+    </div>
+</div>
+
+<script type="text/html" id="subjectdetail-toolbar">
+    <div class="layui-btn-container">
+
+    </div>
+</script>
+
+<script>
+    layui.use(['form', 'table', 'layer', 'admin', 'element', 'laydate', 'treeSelect'], function () {
+        var $ = layui.jquery;
+        var form = layui.form;
+        var table = layui.table;
+        var admin = layui.admin;
+        var laydate = layui.laydate;
+        var treeSelect = layui.treeSelect;
+
+        form.render("select");
+        laydate.render({
+            elem: '#subjectdetail-search-startdate',
+            max: $("#subjectdetail-hidden-maxdate").val()
+        });
+        laydate.render({
+            elem: '#subjectdetail-search-enddate',
+            max: $("#subjectdetail-hidden-maxdate").val()
+        });
+
+        treeSelect.render({
+            elem: '#subjectdetail-search-subjno',
+            data: '/report/subjectselecttree',
+            type: 'get',
+            placeholder: '选择科目',
+            search: false,
+            style: {
+                folder: {
+                    enable: false
+                },
+                line: {
+                    enable: true
+                }
+            },
+            // 点击回调
+            click: function (d) {
+                var treeNode = d.current;
+                console.log(treeNode);
+                if(treeNode.accno == '0'){
+                    layer.msg("请选择末级科目", {icon: 2, time:1500});
+                    $("#subjectdetail-search-subjno").val("");
+                    treeSelect.revokeNode('subjectdetail-search-subjno-filter');
+                    return false;
+                }
+                return true;
+            },
+            success: function (d) {
+                console.log(d); // 加载完成后的回调函数
+            }
+        });
+
+        // 渲染表格
+        var renderTable = function(obj){
+            table.render({
+                id: 'SubjectDetailReport',
+                title: '科目明细账',
+                elem: '#subjectDetailTable',
+                url: '/report/subjectdetaillist',
+                page: true,
+                where: obj,
+                toolbar: '#subjectdetail-toolbar',
+                cols: [
+                    [
+                        {
+                            field: 'voucherdate', title: '结算日期', align: 'center', width: 120, sort: true, templet: function (d) {
+                                return dateFormat('' + d.voucherdate);
+                            }
+                        },
+                        {field: 'voucherno', title: '凭证号', align: 'center', width: 80, sort: true},
+                        {field: 'summary', title: '摘要', align: 'center'},
+                        {field: 'dramt', title: '借方发生额', align: 'center'},
+                        {field: 'cramt', title: '贷方发生额', align: 'center'},
+                        {
+                            field: 'balflag', title: '方向', align: 'center', width: 80, templet: function (d) {
+                                if (d.balflag == 1) {
+                                    return '借';
+                                } else {
+                                    return '贷';
+                                }
+                            }
+                        },
+                        {field: 'balance', title: '余额', align: 'center'},
+                        {field: 'oppname', title: '对方户名', align: 'center'}
+                    ]
+                ]
+            });
+        }
+        renderTable({
+            startdate: $('#subjectdetail-search-startdate').val(),
+            enddate: $('#subjectdetail-search-enddate').val(),
+            subjno: null
+        })
+
+
+        $('#subjectdetail-search-btn').click(function () {
+            var startdate = $("#subjectdetail-search-startdate").val();
+            var enddate = $("#subjectdetail-search-enddate").val();
+            var subjno = $("#subjectdetail-search-subjno").val();
+            if (null == startdate || "" == $.trim(startdate)) {
+                layer.msg('请选择起始日期', {icon: 2, time: 1500});
+                return;
+            }
+            if (null == enddate || "" == $.trim(enddate)) {
+                layer.msg('请选择截止日期', {icon: 2, time: 1500});
+                return;
+            }
+            if (null == subjno || "" == $.trim(subjno)) {
+                layer.msg('请选择科目', {icon: 2, time: 1500});
+                return;
+            }
+            //数据重载
+            renderTable({
+                startdate: startdate,
+                enddate: enddate,
+                subjno: subjno
+            })
+        });
+
+        table.on('toolbar(subjectDetailTable-filter)', function(obj){
+            //
+        });
+    });
+</script>
\ No newline at end of file