diff --git a/web/Application/SLN0002/Controller/VoucherController.class.php b/web/Application/SLN0002/Controller/VoucherController.class.php index d5a72fd0..e26aefe3 100644 --- a/web/Application/SLN0002/Controller/VoucherController.class.php +++ b/web/Application/SLN0002/Controller/VoucherController.class.php @@ -91,7 +91,6 @@ class VoucherController extends PSIBaseController "inputUserId" => I("post.inputUserId"), "commitUserId" => I("post.commitUserId"), "status" => I("post.status"), - "page" => I("post.page"), "start" => I("post.start"), "limit" => I("post.limit") ]; diff --git a/web/Application/SLN0002/DAO/VoucherDAO.class.php b/web/Application/SLN0002/DAO/VoucherDAO.class.php index dc860abe..6dea4926 100644 --- a/web/Application/SLN0002/DAO/VoucherDAO.class.php +++ b/web/Application/SLN0002/DAO/VoucherDAO.class.php @@ -25,12 +25,85 @@ class VoucherDAO extends PSIBaseExDAO return $this->emptyResult(); } + $orgId = $params["orgId"]; + $year = $params["year"]; + $month = $params["month"]; + $ref = $params["ref"]; + $inputUserId = $params["inputUserId"]; + $commitUserId = $params["commitUserId"]; + $status = $params["status"]; + $start = $params["start"]; $limit = $params["limit"]; + $sql = "select id, v_status, v_word, ref + from t_voucher + where (company_id = '%s') and (v_year = %d) and (v_month = %d)"; + $queryParams = []; + $queryParams[] = $orgId; + $queryParams[] = $year; + $queryParams[] = $month; + if ($ref) { + $sql .= " and (ref like '%s') "; + $queryParams[] = "%{$ref}%"; + } + if ($inputUserId) { + $sql .= " and (input_user_id = '%s') "; + $queryParams[] = $inputUserId; + } + if ($commitUserId) { + $sql .= " and (confirm_user_id = '%s') "; + $queryParams[] = $commitUserId; + } + if ($status != -1) { + $sql .= " and (v_status = %d) "; + $queryParams[] = $status; + } + + $sql .= " order by v_ref desc + limit %d, %d"; + $queryParams[] = $start; + $queryParams[] = $limit; + $result = []; + $data = $db->query($sql, $queryParams); + foreach ($data as $v) { + $result[] = [ + "id" => $v["id"], + "word" => $v["v_word"], + "ref" => $v["ref"], + ]; + } + + $sql = "select count(*) as cnt + from t_voucher + where (company_id = '%s') and (v_year = %d) and (v_month = %d)"; + $queryParams = []; + $queryParams[] = $orgId; + $queryParams[] = $year; + $queryParams[] = $month; + if ($ref) { + $sql .= " and (ref like '%s') "; + $queryParams[] = "%{$ref}%"; + } + if ($inputUserId) { + $sql .= " and (input_user_id = '%s') "; + $queryParams[] = $inputUserId; + } + if ($commitUserId) { + $sql .= " and (confirm_user_id = '%s') "; + $queryParams[] = $commitUserId; + } + if ($status != -1) { + $sql .= " and (v_status = %d) "; + $queryParams[] = $status; + } + + $data = $db->query($sql, $queryParams); + $cnt = $data[0]["cnt"]; + return [ - "dataList" => [], - "totalCount" => 0, + "dataList" => $result, + "totalCount" => $cnt, ]; } diff --git a/web/Public/Scripts/PSI/SLN0002/Voucher/MainForm.js b/web/Public/Scripts/PSI/SLN0002/Voucher/MainForm.js index c1931bec..4dadb1e9 100644 --- a/web/Public/Scripts/PSI/SLN0002/Voucher/MainForm.js +++ b/web/Public/Scripts/PSI/SLN0002/Voucher/MainForm.js @@ -895,6 +895,8 @@ PCL.define("PSI.SLN0002.Voucher.MainForm", { store.add(data); if (data.length > 0) { me.editQueryOrg.setValue(data[0]["id"]); + + me.refreshMainGrid(); } } }