|
@@ -238,7 +238,7 @@ class OrderInv extends BaseController{
|
|
|
$invCode =isset($this->post['invCode'])&&$this->post['invCode']!=''?trim($this->post['invCode']):"";
|
|
|
$invNum =isset($this->post['invNum'])&&$this->post['invNum']!=''?trim($this->post['invNum']):"";
|
|
|
$open_date =isset($this->post['open_date'])&&$this->post['open_date']!=''?trim($this->post['open_date']):"";
|
|
|
- $total_fee =isset($this->post['total_fee'])&&$this->post['total_fee']!=''?floatval($this->post['total_fee']):"";
|
|
|
+// $total_fee =isset($this->post['total_fee'])&&$this->post['total_fee']!=''?floatval($this->post['total_fee']):"";
|
|
|
$subtotal_fee =isset($this->post['subtotal_fee'])&&$this->post['subtotal_fee']!=''?floatval($this->post['subtotal_fee']):"";
|
|
|
|
|
|
if($status==1){
|
|
@@ -247,9 +247,10 @@ class OrderInv extends BaseController{
|
|
|
if($invCode==='') return error_show(1004,"参数 invCode 不能为空");
|
|
|
if($invNum==='') return error_show(1004,"参数 invNum 不能为空");
|
|
|
if($open_date==='') return error_show(1004,"参数 open_date 不能为空");
|
|
|
- if($total_fee==='') return error_show(1004,"参数 tatal_fee 不能为空");
|
|
|
+// if($total_fee==='') return error_show(1004,"参数 tatal_fee 不能为空");
|
|
|
if($subtotal_fee==='') return error_show(1004,"参数 subtotal_fee 不能为空");
|
|
|
- if($total_fee!=$invinfo['inv_value'])return error_show(1004,"发票金额不足");
|
|
|
+// if($total_fee!=$invinfo['inv_value'])return error_show(1004,"发票金额不足");
|
|
|
+ $status=7;
|
|
|
}else{
|
|
|
$status=7;
|
|
|
}
|
|
@@ -265,14 +266,14 @@ class OrderInv extends BaseController{
|
|
|
|
|
|
$invup =Db::name("invoice_pool")->where($invinfo)->update($update);
|
|
|
if($invup){
|
|
|
- if($status==1&& $open_type!=1){
|
|
|
+ if($status==7&& $open_type!=1){
|
|
|
|
|
|
$invpool=[
|
|
|
"invNo"=>$invinfo['invNo'],
|
|
|
"inv_type"=>$open_type,
|
|
|
"inv_code"=>$invCode,
|
|
|
"inv_number"=>$invNum,
|
|
|
- "inv_total"=>$total_fee,
|
|
|
+ "inv_total"=>0,
|
|
|
"inv_subtotal"=>$subtotal_fee,
|
|
|
"open_date"=>$open_date,
|
|
|
"item"=>'',
|
|
@@ -638,6 +639,8 @@ class OrderInv extends BaseController{
|
|
|
if ($return_type==""){
|
|
|
return error_show(1005,"参数 return_type 不能为空");
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
$remark =isset($this->post['remark'])&&$this->post['remark']!="" ? trim($this->post['remark']):"";
|
|
|
if($remark==""){
|
|
|
return error_show(1005,"参数 remark 不能为空");
|
|
@@ -663,27 +666,63 @@ class OrderInv extends BaseController{
|
|
|
if(empty($ticket)){
|
|
|
return error_show(1004,"未找到开票的票面信息");
|
|
|
}
|
|
|
- $red =0;
|
|
|
- if($ticket["inv_type"]=='004' || $ticket["inv_type"]=='028'){
|
|
|
- $red =1;
|
|
|
- }
|
|
|
+ if($return_type==1){
|
|
|
+ $red =0;
|
|
|
+ if($ticket["inv_type"]=='004' || $ticket["inv_type"]=='028'){
|
|
|
+ $red =1;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $invCode =isset($this->post['invCode'])&&$this->post['invCode']!=''?trim($this->post['invCode']):"";
|
|
|
+ $invNum =isset($this->post['invNum'])&&$this->post['invNum']!=''?trim($this->post['invNum']):"";
|
|
|
+ $open_date =isset($this->post['open_date'])&&$this->post['open_date']!=''?trim($this->post['open_date']):"";
|
|
|
+// $total_fee =isset($this->post['total_fee'])&&$this->post['total_fee']!=''?floatval($this->post['total_fee']):"";
|
|
|
+ $subtotal_fee =isset($this->post['subtotal_fee'])&&$this->post['subtotal_fee']!=''?floatval($this->post['subtotal_fee']):"";
|
|
|
+ if($invCode==='') return error_show(1004,"参数 invCode 不能为空");
|
|
|
+ if($invNum==='') return error_show(1004,"参数 invNum 不能为空");
|
|
|
+ if($open_date==='') return error_show(1004,"参数 open_date 不能为空");
|
|
|
+// if($total_fee==='') return error_show(1004,"参数 tatal_fee 不能为空");
|
|
|
+ if($subtotal_fee==='') return error_show(1004,"参数 subtotal_fee 不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
Db::startTrans();
|
|
|
try{
|
|
|
$update=["status"=>$status, "return_reason"=>$return_reason,"return_type"=>$return_type,"remark"=>$remark,"updatetime"=>date("Y-m-d H:i:s")];
|
|
|
$up =Db::name("invoice_return")->where($return)->update($update);
|
|
|
if($up){
|
|
|
- if($status==1 && $return_type==1){
|
|
|
- if($red==0){
|
|
|
- $this->addRedOpen($ticket,$return_reason,$invinfo['company_type'], $returnCode);
|
|
|
- }
|
|
|
- if($red==1){
|
|
|
- if(date("Y-m",strtotime($ticket["open_date"]))==date("Y-m")){
|
|
|
- $this->addDiscard($ticket,$returnCode);
|
|
|
- }else{
|
|
|
- $this->addApplyRed($ticket,$returnCode);
|
|
|
- }
|
|
|
- }
|
|
|
+ if($status==1){
|
|
|
+ if($return_type==1){
|
|
|
+ if($red==0){
|
|
|
+ $this->addRedOpen($ticket,$return_reason,$invinfo['company_type'], $returnCode);
|
|
|
+ }
|
|
|
+ if($red==1){
|
|
|
+ if(date("Y-m",strtotime($ticket["open_date"]))==date("Y-m")){
|
|
|
+ $this->addDiscard($ticket,$returnCode);
|
|
|
+ }else{
|
|
|
+ $this->addApplyRed($ticket,$returnCode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $invpool=[
|
|
|
+ "invNo"=>$invinfo['invNo'],
|
|
|
+ "inv_type"=>$ticket['inv_type'],
|
|
|
+ "inv_code"=>$invCode,
|
|
|
+ "inv_number"=>$invNum,
|
|
|
+ "inv_total"=>0,
|
|
|
+ "inv_subtotal"=>$subtotal_fee,
|
|
|
+ "open_date"=>$open_date,
|
|
|
+ "item"=>'',
|
|
|
+ "status"=>0,
|
|
|
+ "addtime"=>date("Y-m-d H:i:s"),
|
|
|
+ "updatetime"=>date("Y-m-d H:i:s")
|
|
|
+ ];
|
|
|
+
|
|
|
+ $in = Db::name("invoice_ticket")->insert($invpool);
|
|
|
+ if($in==false){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004,"发票信息添加失败");
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
if($status==2){
|
|
|
$qrdArr=Db::name("assoc")->where(["viceCode"=>$return['invNo'],"is_del"=>0,"status"=>[1,2]])->column("id,orderCode,cancel_fee");
|
|
|
if(!empty($qrdArr)){
|
|
@@ -1738,7 +1777,8 @@ class OrderInv extends BaseController{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //退票列表
|
|
|
+
|
|
|
+ //退票列表
|
|
|
public function returnRedList(){
|
|
|
$page=isset($this->post['page'])&&$this->post['page']!="" ? intval($this->post['page']) :1;
|
|
|
$size=isset($this->post['size'])&&$this->post['size']!="" ? intval($this->post['size']) :15;
|