From 0f93cda537fc2e5e7cfbcf2db49abc70f95ad4d9 Mon Sep 17 00:00:00 2001 From: hdm Date: Thu, 18 Nov 2021 23:37:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=8F=91=E7=A5=A8=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/home/controller/Expense.php | 248 ++++---- app/home/controller/Invoice.php | 82 +-- app/home/view/expense/add.html | 10 +- app/home/view/expense/check.html | 175 ------ app/home/view/expense/index.html | 38 +- app/home/view/expense/list.html | 161 ----- app/home/view/expense/view.html | 77 ++- app/home/view/invoice/add.html | 268 +++------ app/home/view/invoice/check.html | 175 ------ app/home/view/invoice/index.html | 93 +-- app/home/view/invoice/list.html | 161 ----- app/home/view/invoice/view.html | 77 ++- app/home/view/schedule/calendar.html | 10 +- app/home/view/schedule/user.html | 734 ----------------------- app/install/data/gouguoa.sql | 4 +- public/static/home/js/module/gougucms.js | 2 +- 16 files changed, 460 insertions(+), 1855 deletions(-) delete mode 100644 app/home/view/expense/check.html delete mode 100644 app/home/view/expense/list.html delete mode 100644 app/home/view/invoice/check.html delete mode 100644 app/home/view/invoice/list.html delete mode 100644 app/home/view/schedule/user.html diff --git a/app/home/controller/Expense.php b/app/home/controller/Expense.php index 2c3e585..ef053a8 100644 --- a/app/home/controller/Expense.php +++ b/app/home/controller/Expense.php @@ -132,155 +132,133 @@ class Expense extends BaseController } } - function list() { - if (request()->isAjax()) { - $param = get_params(); - $where = []; - $where[] = ['admin_id', '=', $this->uid]; - $where[] = ['status', '=', 1]; - //按时间检索 - $start_time = isset($param['start_time']) ? strtotime(urldecode($param['start_time'])) : 0; - $end_time = isset($param['end_time']) ? strtotime(urldecode($param['end_time'])) : 0; - if ($start_time > 0 && $end_time > 0) { - $where[] = ['expense_time', 'between', [$start_time, $end_time]]; - } - $expense = $this->get_list($param, $where); - return table_assign(0, '', $expense); - } else { - return view(); - } - } - //添加 public function add() { - $id = empty(get_params('id')) ? 0 : get_params('id'); - if ($id > 0) { - $expense = $this->detail($id); - View::assign('expense', $expense); - } - $expense_cate = Db::name('ExpenseCate')->where(['status' => 1])->select()->toArray(); - View::assign('user', get_admin($this->uid)); - View::assign('expense_cate', $expense_cate); - View::assign('id', $id); - return view(); - } - - //提交添加 - public function post_submit() - { - $admin_id = $this->uid; - $dbRes = false; $param = get_params(); - $param['admin_id'] = $admin_id; - $param['income_month'] = isset($param['income_month']) ? strtotime(urldecode($param['income_month'])) : 0; - $param['expense_time'] = isset($param['expense_time']) ? strtotime(urldecode($param['expense_time'])) : 0; - $param['check_status'] = 1; - if (!empty($param['id']) && $param['id'] > 0) { - try { - validate(ExpenseCheck::class)->scene('edit')->check($param); - } catch (ValidateException $e) { - // 验证失败 输出错误信息 - return to_assign(1, $e->getError()); - } - $param['update_time'] = time(); - Db::startTrans(); - try { - $res = ExpenseList::where('id', $param['id'])->strict(false)->field(true)->update($param); - if ($res !== false) { - $exid = $param['id']; - //相关内容多个数组; - $amountData = isset($param['amount']) ? $param['amount'] : ''; - $remarksData = isset($param['remarks']) ? $param['remarks'] : ''; - $cateData = isset($param['cate_id']) ? $param['cate_id'] : ''; - $idData = isset($param['expense_id']) ? $param['expense_id'] : 0; - if ($amountData) { - foreach ($amountData as $key => $value) { - if (!$value) { - continue; + if (request()->isAjax()) { + $dbRes = false; + $admin_id = $this->uid; + $param['admin_id'] = $admin_id; + $param['income_month'] = isset($param['income_month']) ? strtotime(urldecode($param['income_month'])) : 0; + $param['expense_time'] = isset($param['expense_time']) ? strtotime(urldecode($param['expense_time'])) : 0; + $param['check_status'] = 1; + if (!empty($param['id']) && $param['id'] > 0) { + try { + validate(ExpenseCheck::class)->scene('edit')->check($param); + } catch (ValidateException $e) { + // 验证失败 输出错误信息 + return to_assign(1, $e->getError()); + } + $param['update_time'] = time(); + Db::startTrans(); + try { + $res = ExpenseList::where('id', $param['id'])->strict(false)->field(true)->update($param); + if ($res !== false) { + $exid = $param['id']; + //相关内容多个数组; + $amountData = isset($param['amount']) ? $param['amount'] : ''; + $remarksData = isset($param['remarks']) ? $param['remarks'] : ''; + $cateData = isset($param['cate_id']) ? $param['cate_id'] : ''; + $idData = isset($param['expense_id']) ? $param['expense_id'] : 0; + if ($amountData) { + foreach ($amountData as $key => $value) { + if (!$value) { + continue; + } + $data = []; + $data['id'] = $idData[$key]; + $data['exid'] = $exid; + $data['admin_id'] = $admin_id; + $data['amount'] = $amountData[$key]; + $data['cate_id'] = $cateData[$key]; + $data['remarks'] = $remarksData[$key]; + if ($data['amount'] == 0) { + Db::rollback(); + return to_assign(1, '第' . ($key + 1) . '条报销金额不能为零'); + } + if ($data['id'] > 0) { + $data['update_time'] = time(); + $resa = Db::name('ExpenseInterfix')->strict(false)->field(true)->update($data); + } else { + $data['create_time'] = time(); + $eid = Db::name('ExpenseInterfix')->strict(false)->field(true)->insertGetId($data); + } } - - $data = []; - $data['id'] = $idData[$key]; - $data['exid'] = $exid; - $data['admin_id'] = $admin_id; - $data['amount'] = $amountData[$key]; - $data['cate_id'] = $cateData[$key]; - $data['remarks'] = $remarksData[$key]; - if ($data['amount'] == 0) { - Db::rollback(); - return to_assign(1, '第' . ($key + 1) . '条报销金额不能为零'); - } - if ($data['id'] > 0) { - $data['update_time'] = time(); - $resa = Db::name('ExpenseInterfix')->strict(false)->field(true)->update($data); - } else { + } + add_log('edit', $exid, $param); + Db::commit(); + $dbRes = true; + } else { + Db::rollback(); + } + } catch (\Exception $e) { ##这里参数不能删除($e:错误信息) + Db::rollback(); + return to_assign(1, $e->getMessage()); + } + } else { + try { + validate(ExpenseCheck::class)->scene('add')->check($param); + } catch (ValidateException $e) { + // 验证失败 输出错误信息 + return to_assign(1, $e->getError()); + } + $param['create_time'] = time(); + Db::startTrans(); + try { + $exid = ExpenseList::strict(false)->field(true)->insertGetId($param); + if ($exid) { + //相关内容多个数组; + $amountData = isset($param['amount']) ? $param['amount'] : ''; + $remarksData = isset($param['remarks']) ? $param['remarks'] : ''; + $cateData = isset($param['cate_id']) ? $param['cate_id'] : ''; + if ($amountData) { + foreach ($amountData as $key => $value) { + if (!$value) { + continue; + } + $data = []; + $data['exid'] = $exid; + $data['admin_id'] = $admin_id; + $data['amount'] = $amountData[$key]; + $data['cate_id'] = $cateData[$key]; + $data['remarks'] = $remarksData[$key]; $data['create_time'] = time(); + if ($data['amount'] == 0) { + Db::rollback(); + return to_assign(1, '第' . ($key + 1) . '条报销金额不能为零'); + } $eid = Db::name('ExpenseInterfix')->strict(false)->field(true)->insertGetId($data); } } + add_log('add', $exid, $param); + Db::commit(); + $dbRes = true; + } else { + Db::rollback(); } - add_log('edit', $exid, $param); - Db::commit(); - $dbRes = true; - } else { - Db::rollback(); + } catch (\Exception $e) { ##这里参数不能删除($e:错误信息) + Db::rollback(); + return to_assign(1, $e->getMessage()); } - } catch (\Exception $e) { ##这里参数不能删除($e:错误信息) - Db::rollback(); - return to_assign(1, $e->getMessage()); } - } else { - try { - validate(ExpenseCheck::class)->scene('add')->check($param); - } catch (ValidateException $e) { - // 验证失败 输出错误信息 - return to_assign(1, $e->getError()); - } - $param['create_time'] = time(); - Db::startTrans(); - try { - $exid = ExpenseList::strict(false)->field(true)->insertGetId($param); - if ($exid) { - //相关内容多个数组; - $amountData = isset($param['amount']) ? $param['amount'] : ''; - $remarksData = isset($param['remarks']) ? $param['remarks'] : ''; - $cateData = isset($param['cate_id']) ? $param['cate_id'] : ''; - if ($amountData) { - foreach ($amountData as $key => $value) { - if (!$value) { - continue; - } - - $data = []; - $data['exid'] = $exid; - $data['admin_id'] = $admin_id; - $data['amount'] = $amountData[$key]; - $data['cate_id'] = $cateData[$key]; - $data['remarks'] = $remarksData[$key]; - $data['create_time'] = time(); - if ($data['amount'] == 0) { - Db::rollback(); - return to_assign(1, '第' . ($key + 1) . '条报销金额不能为零'); - } - $eid = Db::name('ExpenseInterfix')->strict(false)->field(true)->insertGetId($data); - } - } - add_log('add', $exid, $param); - Db::commit(); - $dbRes = true; - } else { - Db::rollback(); - } - } catch (\Exception $e) { ##这里参数不能删除($e:错误信息) - Db::rollback(); - return to_assign(1, $e->getMessage()); + if ($dbRes == true) { + return to_assign(); + } else { + return to_assign(1, '保存失败'); } } - if ($dbRes == true) { - return to_assign(); - } else { - return to_assign(1, '保存失败'); + else{ + $id = isset($param['id']) ? $param['id'] : 0; + if ($id > 0) { + $expense = $this->detail($id); + View::assign('expense', $expense); + } + $expense_cate = Db::name('ExpenseCate')->where(['status' => 1])->select()->toArray(); + View::assign('user', get_admin($this->uid)); + View::assign('expense_cate', $expense_cate); + View::assign('id', $id); + return view(); } } diff --git a/app/home/controller/Invoice.php b/app/home/controller/Invoice.php index ee892c8..899c481 100644 --- a/app/home/controller/Invoice.php +++ b/app/home/controller/Invoice.php @@ -10,10 +10,9 @@ declare (strict_types = 1); namespace app\home\controller; use app\home\BaseController; -use app\home\model\Invoice as InvoiceList; use app\home\model\InvoiceSubject; +use app\home\model\Invoice as InvoiceList; use app\home\validate\InvoiceSubjectCheck; -use app\home\validate\InvoiceCheck; use think\exception\ValidateException; use think\facade\Db; use think\facade\View; @@ -67,7 +66,7 @@ class Invoice extends BaseController public function get_list($param = [], $where = []) { $rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit']; - $expense = ExpenseList::where($where) + $expense = InvoiceList::where($where) ->order('create_time asc') ->paginate($rows, false, ['query' => $param]) ->each(function ($item, $key) { @@ -80,37 +79,28 @@ class Invoice extends BaseController $item->check_time = empty($item->check_time) ? '-' : date('Y-m-d H:i', $item->check_time); $item->pay_name = Db::name('Admin')->where(['id' => $item->pay_admin_id])->value('name'); $item->pay_time = empty($item->pay_time) ? '-' : date('Y-m-d H:i', $item->pay_time); - $item->amount = Db::name('ExpenseInterfix')->where(['exid' => $item->id])->sum('amount'); }); return $expense; } public function detail($id = 0) { - $expense = Db::name('Expense')->where(['id' => $id])->find(); - if ($expense) { - $expense['income_month'] = empty($expense['income_month']) ? '-' : date('Y-m', $expense['income_month']); - $expense['expense_time'] = empty($expense['expense_time']) ? '-' : date('Y-m-d', $expense['expense_time']); - $expense['user_name'] = Db::name('Admin')->where(['id' => $expense['uid']])->value('name'); - $expense['department'] = Db::name('Department')->where(['id' => $expense['did']])->value('title'); - $expense['amount'] = Db::name('ExpenseInterfix')->where(['exid' => $expense['id']])->sum('amount'); - - if ($expense['check_admin_id'] > 0) { - $expense['check_admin'] = Db::name('Admin')->where(['id' => $expense['check_admin_id']])->value('name'); - $expense['check_time'] = date('Y-m-d H:i:s', $expense['check_time']); + $invoice = Db::name('Invoice')->where(['id' => $id])->find(); + if ($invoice) { + $invoice['income_month'] = empty($invoice['income_month']) ? '-' : date('Y-m', $invoice['income_month']); + $invoice['expense_time'] = empty($invoice['expense_time']) ? '-' : date('Y-m-d', $invoice['expense_time']); + $invoice['user_name'] = Db::name('Admin')->where(['id' => $invoice['uid']])->value('name'); + $invoice['department'] = Db::name('Department')->where(['id' => $invoice['did']])->value('title'); + if ($invoice['check_admin_id'] > 0) { + $invoice['check_admin'] = Db::name('Admin')->where(['id' => $invoice['check_admin_id']])->value('name'); + $invoice['check_time'] = date('Y-m-d H:i:s', $invoice['check_time']); } - if ($expense['pay_admin_id'] > 0) { - $expense['pay_admin'] = Db::name('Admin')->where(['id' => $expense['pay_admin_id']])->value('name'); - $expense['pay_time'] = date('Y-m-d H:i:s', $expense['pay_time']); + if ($invoice['pay_admin_id'] > 0) { + $invoice['pay_admin'] = Db::name('Admin')->where(['id' => $invoice['pay_admin_id']])->value('name'); + $invoice['pay_time'] = date('Y-m-d H:i:s', $invoice['pay_time']); } - $expense['list'] = Db::name('ExpenseInterfix') - ->field('a.*,c.title as cate_title') - ->alias('a') - ->join('ExpenseCate c', 'a.cate_id = c.id') - ->where(['a.exid' => $expense['id']]) - ->select(); } - return $expense; + return $invoice; } public function index() @@ -125,27 +115,8 @@ class Invoice extends BaseController if ($start_time > 0 && $end_time > 0) { $where[] = ['expense_time', 'between', [$start_time, $end_time]]; } - $expense = $this->get_list($param, $where); - return table_assign(0, '', $expense); - } else { - return view(); - } - } - - function list() { - if (request()->isAjax()) { - $param = get_params(); - $where = []; - $where[] = ['admin_id', '=', $this->uid]; - $where[] = ['status', '=', 1]; - //按时间检索 - $start_time = isset($param['start_time']) ? strtotime(urldecode($param['start_time'])) : 0; - $end_time = isset($param['end_time']) ? strtotime(urldecode($param['end_time'])) : 0; - if ($start_time > 0 && $end_time > 0) { - $where[] = ['expense_time', 'between', [$start_time, $end_time]]; - } - $expense = $this->get_list($param, $where); - return table_assign(0, '', $expense); + $invoice = $this->get_list($param, $where); + return table_assign(0, '', $invoice); } else { return view(); } @@ -156,12 +127,10 @@ class Invoice extends BaseController { $id = empty(get_params('id')) ? 0 : get_params('id'); if ($id > 0) { - $expense = $this->detail($id); - View::assign('expense', $expense); + $detail = $this->detail($id); + View::assign('detail', $detail); } - $expense_cate = Db::name('ExpenseCate')->where(['status' => 1])->select()->toArray(); View::assign('user', get_admin($this->uid)); - View::assign('expense_cate', $expense_cate); View::assign('id', $id); return view(); } @@ -288,9 +257,9 @@ class Invoice extends BaseController public function view() { $id = empty(get_params('id')) ? 0 : get_params('id'); - $expense = $this->detail($id); + $detail = $this->detail($id); View::assign('uid', $this->uid); - View::assign('expense', $expense); + View::assign('detail', $detail); return view(); } @@ -308,7 +277,7 @@ class Invoice extends BaseController $data['status'] = '-1'; $data['id'] = $id; $data['update_time'] = time(); - if (Db::name('expense')->update($data) !== false) { + if (Db::name('Invoice')->update($data) !== false) { add_log('delete', $id); return to_assign(0, "删除成功"); } else { @@ -328,17 +297,12 @@ class Invoice extends BaseController $param['pay_admin_id'] = $this->uid; $param['pay_time'] = time(); } - $res = ExpenseList::where('id', $param['id'])->strict(false)->field(true)->update($param); + $res = InvoiceList::where('id', $param['id'])->strict(false)->field(true)->update($param); if ($res !== false) { return to_assign(); } else { return to_assign(1, "操作失败"); } - } else { - $expense = $this->detail($param['id']); - View::assign('expense', $expense); - View::assign('uid', $this->uid); - return view(); } } } diff --git a/app/home/view/expense/add.html b/app/home/view/expense/add.html index 71c96af..ab55715 100644 --- a/app/home/view/expense/add.html +++ b/app/home/view/expense/add.html @@ -10,7 +10,7 @@ {block name="body"}
-

报销信息

+

报销信息

{if condition="($id == 0)"} @@ -40,7 +40,7 @@ - +
费用金额*报销选项*
@@ -65,6 +65,7 @@
+
@@ -97,7 +98,7 @@ - 费用金额* + 报销选项*
@@ -124,6 +125,7 @@ {/volist}
+ @@ -195,7 +197,7 @@ return false; } $.ajax({ - url:"{:url('/home/expense/post_submit')}", + url:"{:url('/home/expense/add')}", type:'post', data:data.field, success:function(e){ diff --git a/app/home/view/expense/check.html b/app/home/view/expense/check.html deleted file mode 100644 index 91518dd..0000000 --- a/app/home/view/expense/check.html +++ /dev/null @@ -1,175 +0,0 @@ -{extend name="common/base"/} -{block name="style"} - -{/block} - -{block name="body"} -
-

报销详情

- - - - - - - - - - - - - - - - - - - - - - {if condition="$expense.check_admin_id > 0"} - - - - - - - {/if} - {if condition="$expense.pay_admin_id > 0"} - - - - - - - {/if} - - - - -
报销凭证编号{$expense.code}入账月份{$expense.income_month}原始单据日期{$expense.expense_time}
报销人{$expense.user_name}报销部门{$expense.department}报销总费用(元){$expense.amount}
报销状态 - {if condition="$expense.check_status == 0"} - 审核不通过 【原因:{$expense.check_remark}】 - {elseif condition="$expense.check_status == 1"} - 报销审核中 - {elseif condition="$expense.check_status == 2"} - 审核通过 - {elseif condition="$expense.check_status == 3"} - 已打款 - {/if} -
审核人{$expense.check_admin}审核时间{$expense.check_time}
打款确认人{$expense.pay_admin}打款确认时间{$expense.pay_time}
费用金额 -
- - - - - - - {volist name="$expense.list" id="vo"} - - - - - - {/volist} -
报销金额(元)报销类别备注信息
{$vo.amount}{$vo.cate_title}{$vo.remarks}
-
-
- -
- - {if condition="($expense.check_status == 0) AND ($uid == $expense.admin_id)"} - 编辑 - {/if} - {eq name="$expense.check_status" value="1"} - - - {/eq} - {eq name="$expense.check_status" value="2"} - - {/eq} -
-
-{/block} - - - -{block name="script"} - -{include file="common/layui" base='base' extend="[]" callback="init" /} -{/block} - \ No newline at end of file diff --git a/app/home/view/expense/index.html b/app/home/view/expense/index.html index 536f145..3a6c4b6 100644 --- a/app/home/view/expense/index.html +++ b/app/home/view/expense/index.html @@ -4,8 +4,10 @@
- {/block} @@ -60,7 +62,7 @@ field: 'income_month', title: '入账月份', align: 'center', - width: 100 + width: 90 },{ field: 'admin_name', title: '登记人', @@ -113,14 +115,34 @@ field: 'right', fixed: 'right', title: '操作', - toolbar: '#barDemo', - width: 100, - align: 'center' + width: 130, + align: 'right', + templet:function(d){ + var html='
'; + var btn1='详情'; + var btn2='编辑'; + var btn3='删除'; + if(d.admin_id==login_user){ + html+=btn1+btn2+btn3; + } + else{ + html+=btn1+btn3; + } + html+='
'; + return html; + } } ] ] }); + //表头工具栏事件 + table.on('toolbar(test)', function(obj){ + if (obj.event === 'add') { + rightpage.open("{:url('home/expense/add')}"); + return; + } + }); //监听行工具事件 table.on('tool(test)', function(obj) { var data = obj.data; @@ -128,6 +150,10 @@ rightpage.open("/home/expense/check?id="+data.id); return; } + if (obj.event === 'edit') { + rightpage.open("/home/expense/add?id="+data.id); + return; + } if (obj.event === 'del') { layer.confirm('确定删除该报销记录吗?', { icon: 3, diff --git a/app/home/view/expense/list.html b/app/home/view/expense/list.html deleted file mode 100644 index c572226..0000000 --- a/app/home/view/expense/list.html +++ /dev/null @@ -1,161 +0,0 @@ -{extend name="common/base"/} - -{block name="body"} -
-
-
- - -{/block} - - - -{block name="script"} - -{include file="common/layui" base='base' extend="['rightpage']" use="['table','form']" callback="init" /} -{/block} - diff --git a/app/home/view/expense/view.html b/app/home/view/expense/view.html index abd5428..bd1f2e5 100644 --- a/app/home/view/expense/view.html +++ b/app/home/view/expense/view.html @@ -8,7 +8,7 @@ {block name="body"}
-

报销详情

+

报销详情

@@ -78,11 +78,19 @@
报销凭证编号
- {if condition="($expense.check_status == 0) AND ($uid == $expense.admin_id)"}
+ + {if condition="($expense.check_status == 0) AND ($uid == $expense.admin_id)"} 编辑 + {/if} + {if condition="($expense.check_status == 1) AND ($uid == $expense.check_admin_id)"} + + + {/if} + {if condition="($expense.check_status == 2) AND ($uid == $expense.pay_admin_id)"} + + {/eq}
- {/if}
{/block} @@ -90,10 +98,69 @@ {block name="script"} {include file="common/layui" base='base' extend="[]" callback="init" /} {/block} diff --git a/app/home/view/invoice/add.html b/app/home/view/invoice/add.html index 71c96af..e69b974 100644 --- a/app/home/view/invoice/add.html +++ b/app/home/view/invoice/add.html @@ -10,123 +10,114 @@ {block name="body"} -

报销信息

+

开票信息

{if condition="($id == 0)"} - + - + - + - + - - + + + + - - + + + + + + + + + + + + + + + +
报销凭证编号*开票金额* - + 入账月份*开票类型* - + 原始单据日期*发票审核人* - +
报销人*抬头类型* - - - 报销部门 - - + + 开票抬头*电话号码*
费用金额* -
- - - - - - - - - - - - - -
报销金额报销项目备注信息操作
- - 删除
-
-
纳税人识别号*开户行*银行账号*
银行营业网点*地址*
备注信息
{else/} - + - + - + - + - - + + + + - - + + + + + + + + + + + + + + + + -
报销凭证编号*开票金额* - + 入账月份*开票类型* - + 原始单据日期*发票审核人* - +
报销人*抬头类型* - - - 报销部门 - - + + 开票抬头*电话号码*
费用金额* -
- - - - - - - - {volist name="$expense.list" id="val"} - - - - - - - {/volist} -
报销金额报销类别备注信息操作
- - 删除
-
-
纳税人识别号*开户行*银行账号*
银行营业网点*地址*
备注信息
{/if}
@@ -135,14 +126,6 @@
- {/block} @@ -152,41 +135,8 @@ function init(layui){ var form = layui.form ,layer = layui.layer - ,table = layui.table - ,employeepicker = layui.employeepicker//很重要 ,laydate = layui.laydate; - laydate.render({ - elem: '#income_month', - type:'month', - showBottom: false - }); - - laydate.render({ - elem: '#expense_time', - max:0, - showBottom: false - }); - - // 选择员工 - $('.body-content').on('click','[name="name"]',function(){ - var that = $(this); - var names = that.val(), ids = $('[name="uid"]').val(); - employeepicker.init({ - ids: ids, - names: names, - type: 0, - department_url:"{:url('/home/api/get_department_tree')}", - employee_url:"{:url('/home/api/get_employee')}", - callback: function (ids, names, dids, departments) { - $('[name="uid"]').val(ids); - $('[name="did"]').val(dids); - $('[name="department"]').val(departments); - that.val(names); - } - }) - }); - //监听提交 form.on('submit(webform)', function(data){ var interfix = $('.more_interfix'); @@ -195,7 +145,7 @@ return false; } $.ajax({ - url:"{:url('/home/expense/post_submit')}", + url:"{:url('/home/expense/add')}", type:'post', data:data.field, success:function(e){ @@ -207,73 +157,9 @@ }) return false; }); - - //添加报销信息表格 - $('#addInterfix').on('click',function(){ - var html = ''; - var selectTem=$('#selectTem').html(); - html += '\ - \ - '+selectTem+'\ - \ - 删除\ - '; - $("#interfix").append(html).find('.tr-none').remove(); - form.render(); - }); - - $('#interfix').on('click', '[lay-event="del"]', function() { - if($('.more_interfix').length<2){ - layer.msg('至少保留一个报销选项'); - return false; - } - var that=$(this); - var _id = that.data('id'); - if(_id>0){ - layer.confirm('确定删除该报销数据项?', { - icon: 3, - title: '提示' - }, function(index) { - $.ajax({ - url: "{:url('home/api/del_expense_interfix')}", - data: { - id: _id - }, - success: function(res) { - layer.msg(res.msg); - if (res.code == 0) { - that.parents(".more_interfix").remove(); - } - } - }) - layer.close(index); - }); - } - else{ - that.parents(".more_interfix").remove(); - } - }); - - //报销成员修改 - $('[name="nickname"]').on('click',function() { - var that=$(this); - var ids=that.next().val(),names=that.val(); - employeepicker.init({ - ids:ids, - names:names, - type:0, - callback:function(ids,names,dids,departments){ - that.val(names); - that.next().val(ids); - $('[name="department"]').val(departments); - $('[name="did"]').val(dids); - } - }); - }); - } -{include file="common/layui" base='base' extend="['employeepicker']" callback="init" /} +{include file="common/layui" base='base' extend="[]" callback="init" /} {/block} \ No newline at end of file diff --git a/app/home/view/invoice/check.html b/app/home/view/invoice/check.html deleted file mode 100644 index 91518dd..0000000 --- a/app/home/view/invoice/check.html +++ /dev/null @@ -1,175 +0,0 @@ -{extend name="common/base"/} -{block name="style"} - -{/block} - -{block name="body"} -
-

报销详情

- - - - - - - - - - - - - - - - - - - - - - {if condition="$expense.check_admin_id > 0"} - - - - - - - {/if} - {if condition="$expense.pay_admin_id > 0"} - - - - - - - {/if} - - - - -
报销凭证编号{$expense.code}入账月份{$expense.income_month}原始单据日期{$expense.expense_time}
报销人{$expense.user_name}报销部门{$expense.department}报销总费用(元){$expense.amount}
报销状态 - {if condition="$expense.check_status == 0"} - 审核不通过 【原因:{$expense.check_remark}】 - {elseif condition="$expense.check_status == 1"} - 报销审核中 - {elseif condition="$expense.check_status == 2"} - 审核通过 - {elseif condition="$expense.check_status == 3"} - 已打款 - {/if} -
审核人{$expense.check_admin}审核时间{$expense.check_time}
打款确认人{$expense.pay_admin}打款确认时间{$expense.pay_time}
费用金额 -
- - - - - - - {volist name="$expense.list" id="vo"} - - - - - - {/volist} -
报销金额(元)报销类别备注信息
{$vo.amount}{$vo.cate_title}{$vo.remarks}
-
-
- -
- - {if condition="($expense.check_status == 0) AND ($uid == $expense.admin_id)"} - 编辑 - {/if} - {eq name="$expense.check_status" value="1"} - - - {/eq} - {eq name="$expense.check_status" value="2"} - - {/eq} -
-
-{/block} - - - -{block name="script"} - -{include file="common/layui" base='base' extend="[]" callback="init" /} -{/block} - \ No newline at end of file diff --git a/app/home/view/invoice/index.html b/app/home/view/invoice/index.html index 536f145..c9ce538 100644 --- a/app/home/view/invoice/index.html +++ b/app/home/view/invoice/index.html @@ -4,8 +4,10 @@
- {/block} @@ -20,9 +22,9 @@ var tableIns = table.render({ elem: '#test', - title: '报销管理列表', + title: '发票列表', toolbar: '#toolbarDemo', - url: "{:url('home/expense/index')}", //数据接口 + url: "{:url('home/invoice/index')}", //数据接口 page: true, //开启分页 limit: 20, cols: [ @@ -34,46 +36,36 @@ width: 80 }, { field: 'amount', - title: '报销总金额(元)', + title: '客户名称', + width: 240, + },{ + field: 'amount', + title: '开票金额(元)', align: 'right', width: 120, + },{ + field: 'invoice_type', + title: '开票类型', + align: 'right', + width: 90, },{ field: 'user_name', - title: '报销人', + title: '申请人', align: 'center', - width: 90 + width: 100 },{ field: 'department', - title: '报销部门', + title: '所属部门', align: 'center', width: 120 - },{ - field: 'code', - title: '报销凭证编号', - width: 150, - },{ - field: 'expense_time', - title: '原始单据日期', - align: 'center', - width: 110 - },{ - field: 'income_month', - title: '入账月份', - align: 'center', - width: 100 - },{ - field: 'admin_name', - title: '登记人', - align: 'center', - width: 100 },{ field: 'create_time', - title: '录入时间', + title: '申请时间', align: 'center', width: 150 },{ field: 'status', - title: '状态', + title: '审核状态', align: 'center', width: 120, templet:function(d){ @@ -101,31 +93,60 @@ width: 136 },{ field: 'pay_name', - title: '打款确认人', + title: '开票人', align: 'center', width: 90 },{ field: 'pay_time', - title: '打款确认时间', + title: '开票时间', + align: 'center', + width: 136 + },{ + field: 'pay_time', + title: '发票号码', align: 'center', width: 136 }, { field: 'right', fixed: 'right', title: '操作', - toolbar: '#barDemo', - width: 100, - align: 'center' + width: 130, + align: 'right', + templet:function(d){ + var html='
'; + var btn1='详情'; + var btn2='编辑'; + var btn3='删除'; + if(d.admin_id==login_user){ + html+=btn1+btn2+btn3; + } + else{ + html+=btn1+btn3; + } + html+='
'; + return html; + } } ] ] }); + //表头工具栏事件 + table.on('toolbar(test)', function(obj){ + if (obj.event === 'add') { + rightpage.open("{:url('home/invoice/add')}"); + return; + } + }); //监听行工具事件 table.on('tool(test)', function(obj) { var data = obj.data; if (obj.event === 'view') { - rightpage.open("/home/expense/check?id="+data.id); + rightpage.open("/home/invoice/check?id="+data.id); + return; + } + if (obj.event === 'edit') { + rightpage.open("/home/invoice/add?id="+data.id); return; } if (obj.event === 'del') { @@ -134,7 +155,7 @@ title: '提示' }, function(index) { $.ajax({ - url: "{:url('home/expense/delete')}", + url: "{:url('home/invoice/delete')}", data: { id: data.id }, diff --git a/app/home/view/invoice/list.html b/app/home/view/invoice/list.html deleted file mode 100644 index c572226..0000000 --- a/app/home/view/invoice/list.html +++ /dev/null @@ -1,161 +0,0 @@ -{extend name="common/base"/} - -{block name="body"} -
-
-
- - -{/block} - - - -{block name="script"} - -{include file="common/layui" base='base' extend="['rightpage']" use="['table','form']" callback="init" /} -{/block} - diff --git a/app/home/view/invoice/view.html b/app/home/view/invoice/view.html index abd5428..bd1f2e5 100644 --- a/app/home/view/invoice/view.html +++ b/app/home/view/invoice/view.html @@ -8,7 +8,7 @@ {block name="body"}
-

报销详情

+

报销详情

@@ -78,11 +78,19 @@
报销凭证编号
- {if condition="($expense.check_status == 0) AND ($uid == $expense.admin_id)"}
+ + {if condition="($expense.check_status == 0) AND ($uid == $expense.admin_id)"} 编辑 + {/if} + {if condition="($expense.check_status == 1) AND ($uid == $expense.check_admin_id)"} + + + {/if} + {if condition="($expense.check_status == 2) AND ($uid == $expense.pay_admin_id)"} + + {/eq}
- {/if}
{/block} @@ -90,10 +98,69 @@ {block name="script"} {include file="common/layui" base='base' extend="[]" callback="init" /} {/block} diff --git a/app/home/view/schedule/calendar.html b/app/home/view/schedule/calendar.html index 3753119..41daa1b 100644 --- a/app/home/view/schedule/calendar.html +++ b/app/home/view/schedule/calendar.html @@ -310,10 +310,10 @@ eventLimit: false, // 当事件过多时是否显示更多按钮 selectable: true, select: function(arg) { - detail=default_detail; - - var startTime=arg.start.getFullYear()+'-'+toNumer(arg.start.getMonth()+1)+'-'+toNumer(arg.start.getDate())+' '+toNumer(arg.start.getHours())+':'+toNumer(arg.start.getMinutes()); - var endTime=arg.end.getFullYear()+'-'+toNumer(arg.end.getMonth()+1)+'-'+toNumer(arg.end.getDate())+' '+toNumer(arg.end.getHours())+':'+toNumer(arg.end.getMinutes()); + console.log(arg); + detail={}; + var startTime=arg.start.getFullYear()+'-'+(arg.start.getMonth()+1)+'-'+(arg.start.getDate())+' '+(arg.start.getHours())+':'+(arg.start.getMinutes()); + var endTime=arg.end.getFullYear()+'-'+(arg.end.getMonth()+1)+'-'+(arg.end.getDate())+' '+(arg.end.getHours())+':'+(arg.end.getMinutes()); detail['start_time']=startTime; detail['end_time']= endTime; @@ -328,7 +328,7 @@ events: function(fetchInfo, successCallback, failureCallback ){ $.ajax({ type:"POST", - url:"/home/schedule/index", + url:"/home/schedule/calendar", dataType:"json", data:{start:fetchInfo.startStr,end:fetchInfo.endStr,uid:uid}, success:function(result){ diff --git a/app/home/view/schedule/user.html b/app/home/view/schedule/user.html deleted file mode 100644 index 56aee37..0000000 --- a/app/home/view/schedule/user.html +++ /dev/null @@ -1,734 +0,0 @@ -{extend name="common/base"/} -{block name="style"} - - -{/block} - -{block name="body"} -
-
- -
-
-
-
-

项目统计

-
-
-
-
项目总数
-
-
-
-
-
已完成的
-
-
-
-
-
正在进行的
-
-
-
-
-
-
-
-
-
-

工作任务

-
-
-
-
任务总数
-
-
-
-
-
已完成的
-
-
-
-
-
未完成的
-
-
-
-
-
-
-
-
-
-

工时统计

-
-
-
-
总工时
-
-
-
-
-
外勤工时
-
-
-
-
-
案头工时
-
-
-
-
-
-
-
-
-
-

工作记录

-
-
-
-
总记录
-
-
-
-
-
项目记录
-
-
-
-
-
日常记录
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-{/block} - - - -{block name="script"} - - -{include file="common/layui" base='base' extend="[]" use="['form']" callback="init" /} -{/block} - diff --git a/app/install/data/gouguoa.sql b/app/install/data/gouguoa.sql index 2d578c4..68a4c96 100644 --- a/app/install/data/gouguoa.sql +++ b/app/install/data/gouguoa.sql @@ -578,14 +578,14 @@ CREATE TABLE `oa_invoice` ( `sid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '关联发票主体ID', `cash_type` tinyint(1) UNSIGNED NULL DEFAULT 1 COMMENT '付款方式:1现金 2转账 3微信支付 4支付宝 5信用卡 6支票 7其他', `is_cash` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '是否直接到账:0否 1是', - `remark_desc` text NULL COMMENT '备注', + `remark` text NULL COMMENT '备注', `amount` decimal(15, 2) NULL DEFAULT 0.00 COMMENT '发票金额', `enter_amount` decimal(15, 2) NULL DEFAULT 0.00 COMMENT '到账金额', `did` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '开发票部门', `admin_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '发票申请人', `check_admin_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '发票审核人', `open_admin_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '发票开具人', - `invoice_type` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '发票类型:0普票 1专票', + `invoice_type` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '发票类型:1增值税专用发票2增值税普通发票', `invoice_tax` varchar(100) NOT NULL DEFAULT '' COMMENT '纳税人识别号', `invoice_title` varchar(100) NOT NULL DEFAULT '' COMMENT '纳税人名称', `invoice_bank` varchar(100) NOT NULL DEFAULT '' COMMENT '开户银行', diff --git a/public/static/home/js/module/gougucms.js b/public/static/home/js/module/gougucms.js index 47db7d9..840c3b8 100644 --- a/public/static/home/js/module/gougucms.js +++ b/public/static/home/js/module/gougucms.js @@ -172,7 +172,7 @@ layui.define(['element'], function(exports){ layer.tips('正在清理系统缓存...',this); that.attr('class','clearThis'); $.ajax({ - url:"/admin/api/cache_clear", + url:"/home/api/cache_clear", success:function(res){ if(res.code == 1){ setTimeout(function(){