|
@@ -240,7 +240,8 @@ class OrderInv extends BaseController{
|
|
|
return error_show(1004,$e->getMessage());
|
|
|
}
|
|
|
}
|
|
|
- // 1财务审核通过 2 金税开票中/验票中 3 开票成功 4 财务驳回 5 开票失败 6 发票退票/废弃 7取消申请
|
|
|
+ // 1财务审核通过 2 金税开票中/验票中 3 开票成功 4 财务驳回 5 开票失败 6 发票退票/废弃 7取消申请
|
|
|
+ // 1财务审核通过 2 待财务上传发票 3 金税开票中/验票中 4 开票成功 5 开票失败 6发票退票/废弃 7取消申请 8 财务驳回 9验票失败
|
|
|
public function status(){
|
|
|
$invNo = isset($this->post['invNo'])&&$this->post['invNo']!=''?trim($this->post['invNo']):"";
|
|
|
if($invNo==""){
|
|
@@ -283,9 +284,12 @@ class OrderInv extends BaseController{
|
|
|
"exam_remark"=>$remark,
|
|
|
"updatetime" => date("Y-m-d H:i:s")
|
|
|
];
|
|
|
- if($status==2){
|
|
|
- if($open_type==='')return error_show(1004,"参数 open_type 不能为空");
|
|
|
+ if($status==2){
|
|
|
+ if($open_type==='')return error_show(1004,"参数 open_type 不能为空");
|
|
|
$update['open_type']=$open_type;
|
|
|
+ }
|
|
|
+ if($status==3){
|
|
|
+ $open_type = $invinfo['open_type'];
|
|
|
if($open_type!=1){
|
|
|
if($invCode==='') return error_show(1004,"参数 invCode 不能为空");
|
|
|
if($invNum==='') return error_show(1004,"参数 invNum 不能为空");
|
|
@@ -307,7 +311,7 @@ class OrderInv extends BaseController{
|
|
|
}
|
|
|
|
|
|
if($status==7){
|
|
|
- if(!in_array($invinfo['status'],[1,4,5])) return error_show(1004,"开票申请状态有误");
|
|
|
+ if(!in_array($invinfo['status'],[1,2,3,5,8])) return error_show(1004,"开票申请状态有误");
|
|
|
}
|
|
|
$update['status']=$status;
|
|
|
Db::startTrans();
|
|
@@ -315,7 +319,7 @@ class OrderInv extends BaseController{
|
|
|
|
|
|
$invup =Db::name("invoice_pool")->where($invinfo)->update($update);
|
|
|
if($invup){
|
|
|
- if(($status==2&& $open_type!=1) || ($invinfo['inv_type']==5 &&$status==2)){
|
|
|
+ if(($status==3&& $open_type!=1) || ($invinfo['inv_type']==5 &&$status==3)){
|
|
|
$invpool=[
|
|
|
"invNo"=>$invinfo['invNo'],
|
|
|
"inv_type"=>$this->kingInvoice[$invinfo['inv_type']],
|
|
@@ -353,7 +357,7 @@ class OrderInv extends BaseController{
|
|
|
return error_show(1004,"发票信息添加失败");
|
|
|
}
|
|
|
}
|
|
|
- if($status==2 && $open_type==1){
|
|
|
+ if($status==3 && $open_type==1){
|
|
|
$invpoolinfo =Db::name("invoice_pool_info")->where(["invNo"=>$invNo])->findOrEmpty();
|
|
|
if(empty($invpoolinfo)){
|
|
|
Db::rollback();
|
|
@@ -424,7 +428,7 @@ class OrderInv extends BaseController{
|
|
|
}
|
|
|
Cache::push("invoiceList",$data["DDQQLSH"]);
|
|
|
}
|
|
|
- if( $update['status']==3){
|
|
|
+ if( $update['status']==4){
|
|
|
$qrdArr=Db::name("assoc")->where(["viceCode"=>$invNo,"is_del"=>0])->column("id,orderCode,cancel_fee");
|
|
|
if(!empty($qrdArr)){
|
|
|
foreach ($qrdArr as $value){
|
|
@@ -588,7 +592,7 @@ class OrderInv extends BaseController{
|
|
|
if($invNo=='') return error_show(1004,"参数invNo不能为空");
|
|
|
$invinfo =Db::name("invoice_pool")->where(["invNo"=>$invNo,"is_del"=>0])->find();
|
|
|
if($invinfo==false) return error_show(1004,"未找到对应发票申请数据");
|
|
|
- if(!in_array($invinfo['status'],[1,2,3,4,5]))return error_show(1004,"发票状态无法废弃");
|
|
|
+ if(!in_array($invinfo['status'],[1,2,3,4,5,8]))return error_show(1004,"发票状态无法废弃");
|
|
|
$company =Db::name("company_info")->where(["companyNo"=>$invinfo['inv_out']])->find();
|
|
|
if($company==false)return error_show(1004,"开票业务公司未找到");
|
|
|
$invoiceinfo =Db::name("invoice_ticket")->where(["invNo"=>$invNo])->find();
|
|
@@ -682,7 +686,7 @@ class OrderInv extends BaseController{
|
|
|
if($invinfo==false){
|
|
|
return error_show(1004,"发票申请数据未找到");
|
|
|
}
|
|
|
- if($invinfo['status']!=3){
|
|
|
+ if($invinfo['status']!=4){
|
|
|
return error_show(1004,"发票申请未完成");
|
|
|
}
|
|
|
$qrd =Db::name("assoc")->where(["viceCode"=>$invNo,"status"=>2,"is_del"=>0])->column("orderCode");
|
|
@@ -746,7 +750,7 @@ class OrderInv extends BaseController{
|
|
|
if($invinfo==false){
|
|
|
return error_show(1004,"发票申请数据未找到");
|
|
|
}
|
|
|
- if($invinfo['status']!=3){
|
|
|
+ if($invinfo['status']!=4){
|
|
|
return error_show(1004,"发票申请未完成");
|
|
|
}
|
|
|
$qrd =Db::name("assoc")->where(["viceCode"=>$return['invNo'],"status"=>2,"is_del"=>0])->column("orderCode");
|
|
@@ -1222,7 +1226,7 @@ class OrderInv extends BaseController{
|
|
|
if($invNo=='')return error_show(1004,"参数 invNo 不能为空");
|
|
|
$invfo =Db::name("invoice_pool")->where(["invNo"=>$invNo,"is_del"=>0])->find();
|
|
|
if($invfo==false) return error_show(1004,"发票数据未找到");
|
|
|
- if(!in_array($invfo['status'],[1,2,3,4,5]))return error_show(1004,"发票数据状态无法申请");
|
|
|
+ if(!in_array($invfo['status'],[1,2,3,4,5,8]))return error_show(1004,"发票数据状态无法申请");
|
|
|
$ticket =Db::name("invoice_ticket")->where(["invNo"=>$invNo])->findOrEmpty();
|
|
|
if(empty($ticket)) return error_show(1004,"未找到开票信息");
|
|
|
$company =Db::name("company_info")->where(["companyNo"=>'GS2207150956046617'])->findOrEmpty();
|
|
@@ -1382,7 +1386,7 @@ class OrderInv extends BaseController{
|
|
|
];
|
|
|
$redticketList=[];
|
|
|
foreach ($invfo as $value){
|
|
|
- if(!in_array($value['status'],[1,2,3,4,5])){
|
|
|
+ if(!in_array($value['status'],[1,2,3,4,5,8])){
|
|
|
Db::rollback();
|
|
|
return error_show(1004,"发票数据状态无法申请");
|
|
|
}
|
|
@@ -2231,16 +2235,16 @@ class OrderInv extends BaseController{
|
|
|
Db::startTrans();
|
|
|
try{
|
|
|
$keyarr =array_keys($total);
|
|
|
- $inpool = Db::name("invoice_pool")->where([["invNo","in",$keyarr],["open_type","in",[0,2,3]],["is_del","=",0],["status","=",1]])->column("winv_fee,invNo,inv_value,inv_type","invNo");
|
|
|
+ $inpool = Db::name("invoice_pool")->where([["invNo","in",$keyarr],["open_type","in",[0,2,3]],["is_del","=",0],["status","=",2]])->column("winv_fee,invNo,inv_value,inv_type","invNo");
|
|
|
|
|
|
foreach ($total as $key=>$val){
|
|
|
- if(!isset($inpool[$key])) continue;
|
|
|
+ if(!isset($inpool[$key])) throw new Exception("{$key}发票数据不存在或状态有误");
|
|
|
if(in_array($val['inv_type'],["fully_digitalized_special_electronic", "fully_digitalized_normal_electronic"]) && $inpool[$key]['winv_fee']!=$val['total']){
|
|
|
throw new Exception("{$key}全电发票面金额小于未开票金额");
|
|
|
}
|
|
|
if($inpool[$key]['inv_type']!= $val['inv_type']) throw new Exception("{$key}发票类型有误");
|
|
|
$update=[
|
|
|
- "status"=>in_array($val['inv_type'],["fully_digitalized_special_electronic", "fully_digitalized_normal_electronic"])?3:2,
|
|
|
+ "status"=>in_array($val['inv_type'],["fully_digitalized_special_electronic", "fully_digitalized_normal_electronic"])?4:3,
|
|
|
"open_type"=>$inpool[$key]['open_type']??3,
|
|
|
"updatetime"=>date("Y-m-d H:i:s")
|
|
|
];
|
|
@@ -2250,7 +2254,7 @@ class OrderInv extends BaseController{
|
|
|
return error_show(1005,"发票状态更新失败");
|
|
|
}
|
|
|
|
|
|
- if($update['status']==3){
|
|
|
+ if($update['status']==4){
|
|
|
$qrdArr=Db::name("assoc")->where(["viceCode"=>$key,"is_del"=>0])->column("id,orderCode,cancel_fee");
|
|
|
if(!empty($qrdArr)){
|
|
|
foreach ($qrdArr as $value){
|