diff --git a/app/home/controller/Invoice.php b/app/home/controller/Invoice.php index 2e3086a..a7ca513 100644 --- a/app/home/controller/Invoice.php +++ b/app/home/controller/Invoice.php @@ -68,7 +68,7 @@ class Invoice extends BaseController { $rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit']; $expense = InvoiceList::where($where) - ->order('create_time asc') + ->order('id desc') ->paginate($rows, false, ['query' => $param]) ->each(function ($item, $key) { $item->user = Db::name('Admin')->where(['id' => $item->admin_id])->value('name'); @@ -87,14 +87,17 @@ class Invoice extends BaseController if ($invoice) { $invoice['user'] = Db::name('Admin')->where(['id' => $invoice['admin_id']])->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_admin'] = Db::name('Admin')->where(['id' => $invoice['check_admin_id']])->value('name'); + $invoice['open_admin'] = Db::name('Admin')->where(['id' => $invoice['open_admin_id']])->value('name'); + if ($invoice['check_time'] > 0) { $invoice['check_time'] = empty($invoice['check_time']) ? '0' : date('Y-m-d H:i', $invoice['check_time']); } - if ($invoice['open_admin_id'] > 0) { - $invoice['open_name'] = Db::name('Admin')->where(['id' => $invoice['open_admin_id']])->value('name'); + if ($invoice['open_time'] > 0) { $invoice['open_time'] = empty($invoice['open_time']) ? '0' : date('Y-m-d H:i', $invoice['open_time']); } + else{ + $invoice['open_time'] = '-'; + } } return $invoice; } @@ -109,7 +112,11 @@ class Invoice extends BaseController $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]]; + $where[] = ['create_time', 'between', [$start_time, $end_time]]; + } + + if (isset($param['invoice_status']) && $param['invoice_status']!='') { + $where[] = ['invoice_status', '=', $param['invoice_status']]; } $invoice = $this->get_list($param, $where); return table_assign(0, '', $invoice); @@ -123,8 +130,8 @@ class Invoice extends BaseController { $param = get_params(); if (request()->isAjax()) { - //人类型判断 - if ($param['type'] == 2) { + $param['invoice_status'] = 1; + if ($param['type'] == 1) { if (!$param['invoice_tax']) { return to_assign(1, '纳税人识别号不能为空'); } diff --git a/app/home/view/income/index.html b/app/home/view/income/index.html index d2243ba..c5fe860 100644 --- a/app/home/view/income/index.html +++ b/app/home/view/income/index.html @@ -34,16 +34,22 @@ title: '到账状态', align: 'center', width: 100, + { + field: 'is_cash', + title: '审核状态', + align: 'center', + width: 100, templet:function(d){ var html='未到账'; - if(d.invoice_status==4){ - html='部分到账'; + if(d.is_cash==1){ + html='部分到账'; } - else if(d.invoice_status==5){ + else if(d.is_cash==2){ html='全部到账'; } return html; } + }, },{ field: 'enter_amount', title: '到账金额(元)', @@ -66,10 +72,10 @@ templet:function(d){ var html='-'; if(d.invoice_type==1){ - html='普票'; + html='专票'; } else if(d.invoice_type==2){ - html='专票'; + html='普票'; } return html; } diff --git a/app/home/view/invoice/add.html b/app/home/view/invoice/add.html index 65b40c1..35cdf5d 100644 --- a/app/home/view/invoice/add.html +++ b/app/home/view/invoice/add.html @@ -20,7 +20,7 @@ 开票类型* - @@ -28,7 +28,7 @@ 开票主体* - {volist name=":get_invoice_subject()" id="vo"} @@ -53,7 +53,7 @@ 开户行* 银行账号* - + 银行营业网点* @@ -69,7 +69,7 @@ 发票审核人*
- {volist name=":get_check_user(3)" id="vo"} @@ -96,7 +96,7 @@ 开票主体* - {volist name=":get_invoice_subject()" id="vo"} @@ -137,7 +137,7 @@ 发票审核人*
- {volist name=":get_check_user(3)" id="vo"} @@ -151,7 +151,7 @@
- +
diff --git a/app/home/view/invoice/index.html b/app/home/view/invoice/index.html index 5e407e5..7f59df0 100644 --- a/app/home/view/invoice/index.html +++ b/app/home/view/invoice/index.html @@ -2,6 +2,28 @@ {block name="body"}
+
+
+
+ +
+ ~ +
+ +
+
+
+ +
+ +
diff --git a/app/home/view/invoice/view.html b/app/home/view/invoice/view.html index e991173..5e6d535 100644 --- a/app/home/view/invoice/view.html +++ b/app/home/view/invoice/view.html @@ -18,7 +18,7 @@ 开票类型 {eq name="$detail.invoice_type" value="1"}增值税专用发票{/eq} - {eq name="$detail.invoice_type" value="2"}增值税普通发票{/eq}> + {eq name="$detail.invoice_type" value="2"}增值税普通发票{/eq} 开票主体 @@ -62,44 +62,65 @@ 发票状态 {if condition="($detail.invoice_status == 0)"} - 审核不通过 + 审核不通过 【原因:{$detail.check_remark}】 {elseif condition="($detail.invoice_status == 1)"} 审核中 {elseif condition="($detail.invoice_status == 2)"} - 审核通过 + 审核通过,待开具 {elseif condition="($detail.invoice_status == 3)"} - 待开具 - {elseif condition="($detail.invoice_status == 4)"} 已开具 - {elseif condition="($detail.invoice_status == 5)"} - 部分到账 - {elseif condition="($detail.invoice_status == 5)"} - 全部到账 {elseif condition="($detail.invoice_status == 10)"} 已作废 {/if} + {if condition="$detail.check_time > 0"} - {if condition="($detail.check_time == 0)"} - 当前审核人 - {$detail.check_admin} - {else/} - 发票审核人 + 审核人 {$detail.check_admin} - 审核时间 - {$detail.check_admin} - {/if} + 审核时间 + {$detail.check_time} + {else/} + + 审核人 + {$detail.check_admin} + + {/if} + {if condition="$detail.open_admin_id > 0"} + + 开票人 + {$detail.open_admin} + 开票时间 + {$detail.open_time} + 发票号码 + {$detail.code} + + {/if} + {if condition="($detail.invoice_status == 1) AND ($uid == $detail.check_admin_id)"} + + 选择开票人* + +
+ +
+ + + + + + + {/if}
{if condition="($detail.invoice_status == 0) AND ($uid == $detail.admin_id)"} - 编辑 - {/if} - {if condition="($detail.invoice_status == 1) AND ($uid == $detail.check_admin_id)"} - - + 编辑 {/if} {if condition="($detail.invoice_status == 2) AND ($uid == $detail.open_admin_id)"} @@ -115,10 +136,15 @@ function init(layui) { $('.body-content').on('click', '[lay-event="checkok"]', function () { var id=$('#id').val(); + var open_admin=$('[name="open_admin_id"]').val(); + if(open_admin == ''){ + layer.msg('请选择发票开具人'); + return false; + } layer.confirm('确定审核通过该发票申请?', {icon: 3, title:'提示'}, function(index){ $.ajax({ url:"{:url('home/invoice/check')}", - data:{id:id,invoice_status:2}, + data:{id:id,invoice_status:2,open_admin_id:open_admin}, success:function(res){ layer.msg(res.msg); if(res.code==0){ @@ -160,17 +186,23 @@ function init(layui) { $('.body-content').on('click', '[lay-event="payed"]', function () { var id=$('#id').val(); layer.confirm('确定已经开具发票?', {icon: 3, title:'提示'}, function(index){ - $.ajax({ - url:"{:url('home/invoice/check')}", - data:{id:id,invoice_status:3}, - success:function(res){ - layer.msg(res.msg); - if(res.code==0){ - window.setTimeout(function(){ - parent.location.reload(); - },1200) - } + layer.prompt({title: '输入发票号码', formType: 3,value :''}, function(text, index){ + if(text ==''){ + layer.msg('请输入发票号码'); + return false; } + $.ajax({ + url:"{:url('home/invoice/check')}", + data:{id:id,invoice_status:3,code:text}, + success:function(res){ + layer.msg(res.msg); + if(res.code==0){ + window.setTimeout(function(){ + parent.location.reload(); + },1200) + } + } + }) }) }) }) diff --git a/app/install/data/gouguoa.sql b/app/install/data/gouguoa.sql index 69f5584..1fd23a6 100644 --- a/app/install/data/gouguoa.sql +++ b/app/install/data/gouguoa.sql @@ -614,7 +614,7 @@ CREATE TABLE `oa_invoice` ( `crid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '预定字段:关联合同协议号ID', `ptid` 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是', + `is_cash` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '是否到账:0未到账 1部分到账 2全部到账', `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 '开发票部门', @@ -633,7 +633,7 @@ CREATE TABLE `oa_invoice` ( `invoice_account` varchar(100) NOT NULL DEFAULT '' COMMENT '银行账号', `invoice_banking` varchar(100) NOT NULL DEFAULT '' COMMENT '银行营业网点', `invoice_address` varchar(100) NOT NULL DEFAULT '' COMMENT '地址', - `invoice_status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '发票状态:0审核不通过 1审核中 2待开具 3已开具 4部分到账 5全部到账 10已作废', + `invoice_status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '发票状态:0审核不通过 1审核中 2审核通过,待开具 3 已开具 10已作废', `check_remark` text NULL COMMENT '审核不通过的理由', `remark` text NULL COMMENT '备注', `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:-1删除 0禁用 1正常',