|
@@ -8,7 +8,7 @@ use think\App;
|
|
use think\Exception;
|
|
use think\Exception;
|
|
use think\facade\Config;
|
|
use think\facade\Config;
|
|
use think\facade\Db;
|
|
use think\facade\Db;
|
|
-use think\facade\Cache;
|
|
|
|
|
|
+use think\facade\Cache;use think\facade\Validate;
|
|
|
|
|
|
class OrderInv extends BaseController{
|
|
class OrderInv extends BaseController{
|
|
protected $typename;
|
|
protected $typename;
|
|
@@ -291,20 +291,20 @@ class OrderInv extends BaseController{
|
|
if($status==3){
|
|
if($status==3){
|
|
$open_type = $invinfo['open_type'];
|
|
$open_type = $invinfo['open_type'];
|
|
if($open_type!=1){
|
|
if($open_type!=1){
|
|
- if($invCode==='') return error_show(1004,"参数 invCode 不能为空");
|
|
|
|
|
|
+
|
|
if($invNum==='') return error_show(1004,"参数 invNum 不能为空");
|
|
if($invNum==='') return error_show(1004,"参数 invNum 不能为空");
|
|
if($open_date==='') return error_show(1004,"参数 open_date 不能为空");
|
|
if($open_date==='') return error_show(1004,"参数 open_date 不能为空");
|
|
if(in_array($invinfo['inv_type'],['normal','roll',"toll",'electronic'])){
|
|
if(in_array($invinfo['inv_type'],['normal','roll',"toll",'electronic'])){
|
|
if($checkCode==='') return error_show(1004,"参数 checkCode 不能为空");
|
|
if($checkCode==='') return error_show(1004,"参数 checkCode 不能为空");
|
|
}
|
|
}
|
|
- if($subtotal_fee==='') return error_show(1004,"参数 subtotal_fee 不能为空");
|
|
|
|
- //全电子发票 信息需要全填补充切无法接口识别验真
|
|
|
|
|
|
+ //全电子发票
|
|
if(in_array($invinfo['inv_type'],['fully_digitalized_special_electronic','fully_digitalized_normal_electronic'])){
|
|
if(in_array($invinfo['inv_type'],['fully_digitalized_special_electronic','fully_digitalized_normal_electronic'])){
|
|
- if($invNum==='') return error_show(1004,"参数 invNum 不能为空");
|
|
|
|
- if($open_date==='') return error_show(1004,"参数 open_date 不能为空");
|
|
|
|
- if($subtotal_fee==='') return error_show(1004,"参数 subtotal_fee 不能为空");
|
|
|
|
|
|
+ //全电发票传含税金额
|
|
if($total_fee=='') return error_show(1004,"参数 total_fee 不能为空");
|
|
if($total_fee=='') return error_show(1004,"参数 total_fee 不能为空");
|
|
- $status=3;
|
|
|
|
|
|
+ }else{
|
|
|
|
+ //全电发票无invCode
|
|
|
|
+ if($invCode==='') return error_show(1004,"参数 invCode 不能为空");
|
|
|
|
+ if($subtotal_fee==='') return error_show(1004,"参数 subtotal_fee 不能为空");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1170,7 +1170,6 @@ class OrderInv extends BaseController{
|
|
->field("c.*,a.cancel_fee")
|
|
->field("c.*,a.cancel_fee")
|
|
->select()->toArray();
|
|
->select()->toArray();
|
|
foreach ($orderinfo as &$item){
|
|
foreach ($orderinfo as &$item){
|
|
-// $good_num = Db::name("qrd_info")->where("sequenceNo",$item['orderCode'])->value("goodNum",0);
|
|
|
|
$item['ainv_num'] = Db::name("invoice_pool")
|
|
$item['ainv_num'] = Db::name("invoice_pool")
|
|
->alias("a")
|
|
->alias("a")
|
|
->leftJoin("invoice_good b", "a.invNo=b.invNo and b.is_del=0")
|
|
->leftJoin("invoice_good b", "a.invNo=b.invNo and b.is_del=0")
|
|
@@ -1182,6 +1181,70 @@ class OrderInv extends BaseController{
|
|
}
|
|
}
|
|
$poolinfo['orderinfo']=$orderinfo;
|
|
$poolinfo['orderinfo']=$orderinfo;
|
|
return app_show(0,"获取成功",$poolinfo);
|
|
return app_show(0,"获取成功",$poolinfo);
|
|
|
|
+ }
|
|
|
|
+ //开票异常失败后修改票面信息
|
|
|
|
+ public function TicketEdit(){
|
|
|
|
+ $post=$this->request->only([
|
|
|
|
+ "invNo"=>"", //开票申请编号
|
|
|
|
+ "inv_code"=>"",//发票编码
|
|
|
|
+ "inv_number"=>"",//发票号码
|
|
|
|
+ "inv_subtotal"=>"",//发票税前额度
|
|
|
|
+ "inv_total"=>"",//发票额度
|
|
|
|
+ "open_date"=>"",//开票日期
|
|
|
|
+ "check_code"=>"",//发票校验码
|
|
|
|
+ ],"post","trim");
|
|
|
|
+ $valid=Validate::rule([
|
|
|
|
+ "invNo|开票申请编号"=>"require|max:255",
|
|
|
|
+ "inv_code|开票代码"=>"number",
|
|
|
|
+ "inv_number|开票编号"=>"number",
|
|
|
|
+ "inv_subtotal|不含税金额"=>"float",
|
|
|
|
+ "inv_total|价税合计"=>"float",
|
|
|
|
+ "open_date|开票日期"=>"date",
|
|
|
|
+ "check_code|校验码"=>"max:255",
|
|
|
|
+ ]);
|
|
|
|
+ if($valid->check($post)==false) return error_show(1004,$valid->getError());
|
|
|
|
+ $ticketinfo =Db::name("invoice_ticket")->where(["invNo"=>$post['invNo'],"is_del"=>0,"type"=>0])->findOrEmpty();
|
|
|
|
+ if(empty($ticketinfo)) return error_show(1004,"未找到开票数据");
|
|
|
|
+ $pool = Db::name("invoice_pool")->where(["invNo"=>$post['invNo'],"is_del"=>0,"status"=>[5,9]])->findOrEmpty();
|
|
|
|
+ if(empty($pool)) return error_show(1004,"开票申请数据不可修改");
|
|
|
|
+ if($pool['open_type']==1)return error_show(1004,"金税开票数据不可修改");
|
|
|
|
+ if($post['inv_number']==='') return error_show(1004,"参数 inv_number不能为空");
|
|
|
|
+ if($post['open_date']==='') return error_show(1004,"参数 open_date 不能为空");
|
|
|
|
+ if(in_array($pool['inv_type'],['normal','roll',"toll",'electronic'])){
|
|
|
|
+ if($post['check_code']==='') return error_show(1004,"参数 check_code不能为空");
|
|
|
|
+ }
|
|
|
|
+ //全电子发票
|
|
|
|
+ if(in_array($pool['inv_type'],['fully_digitalized_special_electronic','fully_digitalized_normal_electronic'])){
|
|
|
|
+ //全电发票传含税金额
|
|
|
|
+ if($post['inv_total']=='') return error_show(1004,"参数 inv_total 不能为空");
|
|
|
|
+ }else{
|
|
|
|
+ //全电发票无invCode
|
|
|
|
+ if($post['inv_code']==='') return error_show(1004,"参数 inv_code不能为空");
|
|
|
|
+ if($post['inv_subtotal']==='') return error_show(1004,"参数 inv_subtotal 不能为空");
|
|
|
|
+ }
|
|
|
|
+ Db::startTrans();
|
|
|
|
+ try{
|
|
|
|
+ $Ticket=[
|
|
|
|
+ "inv_code"=>$post['inv_code'],//发票编码
|
|
|
|
+ "inv_number"=>$post['inv_number'],//发票号码
|
|
|
|
+ "inv_subtotal"=>$post['inv_subtotal'],//发票税前额度
|
|
|
|
+ "inv_total"=>$post['inv_total'],//发票额度
|
|
|
|
+ "open_date"=>$post['open_date'],//开票日期
|
|
|
|
+ "check_code"=>$post['check_code'],//发票校验码
|
|
|
|
+ "status"=>0,//带校验
|
|
|
|
+ "updatetime"=>date("Y-m-d H:i:s")//发票校验码
|
|
|
|
+ ];
|
|
|
|
+ $ticket =Db::name("invoice_ticket")->where($ticketinfo)->update($Ticket);
|
|
|
|
+ if($ticket==false) throw new \Exception("开票信息更新失败");
|
|
|
|
+ $polup =Db::name("invoice_pool")->where($pool)->update(["status"=>3,"check_remark"=>"","updatetime"=>date("Y-m-d H:i:s")]);
|
|
|
|
+ if($polup==false) throw new \Exception("开票申请信息更新失败");
|
|
|
|
+ Db::commit();
|
|
|
|
+ return app_show(0,"开票信息更新成功");
|
|
|
|
+ }catch (Exception $e){
|
|
|
|
+ Db::rollback();
|
|
|
|
+ return error_show(1005,$e->getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
//退票列表
|
|
//退票列表
|
|
public function returnList(){
|
|
public function returnList(){
|