记账凭证

This commit is contained in:
CRM8000 2024-11-21 10:40:21 +08:00
parent 4e903a60a6
commit 32fdfbd36f
3 changed files with 77 additions and 3 deletions

View File

@ -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")
];

View File

@ -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,
];
}

View File

@ -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();
}
}
}