|
@@ -940,31 +940,50 @@ class Payment extends BaseController
|
|
|
if($type==''){
|
|
|
return error_show(1004,"参数 invType 不能为空");
|
|
|
}
|
|
|
- $invNumber =isset($post['invNumber'])&& $post['invNumber']!='' ? trim($post['invNumber']):"";
|
|
|
- $invCode =isset($post['invCode'])&& $post['invCode']!='' ? trim($post['invCode']):"";
|
|
|
- $checkNumber =isset($post['checkNumber'])&& $post['checkNumber']!='' ? trim($post['checkNumber']):"";
|
|
|
- $openTime =isset($post['open_time'])&& $post['open_time']!='' ? trim($post['open_time']):"";
|
|
|
- $subtotal_amount =isset($post['subtotal_amount'])&& $post['subtotal_amount']!='' ? floatval($post['subtotal_amount']):"0";
|
|
|
- if($type==1){
|
|
|
- if($invNumber=="") return error_show(1004,"参数 invNumber 不能为空");
|
|
|
- if($invCode=="") return error_show(1004,"参数 invCode 不能为空");
|
|
|
-// if($checkNumber=="") return error_show(1004,"参数 checkNumber 不能为空");
|
|
|
- if($openTime=="") return error_show(1004,"参数 open_time 不能为空");
|
|
|
- if($subtotal_amount=="") return error_show(1004,"参数 subtotal_amount 不能为空");
|
|
|
- }
|
|
|
- $invimg = isset($post['inv_img'])&& $post['inv_img']!='' ? trim($post['inv_img']):"";
|
|
|
- $invName = isset($post['invName'])&& $post['invName']!='' ? trim($post['invName']):"";
|
|
|
- if($type==2){
|
|
|
- if($invimg=="")return error_show(1004,"参数 inv_img 不能为空");
|
|
|
- if($invName=="")return error_show(1004,"参数 invName 不能为空");
|
|
|
- }
|
|
|
- if ($type==3){
|
|
|
|
|
|
+ $invArr=isset($post['invArr']) && !empty($post['invArr']) ? $post['invArr'] :'';
|
|
|
+ if($invArr==''|| empty($invArr)){
|
|
|
+ return error_show(1004,"参数 invArr 不能为空");
|
|
|
}
|
|
|
- $cgdNo =Db::name("pay_info")->where(["payNo"=>$payNo,"is_del"=>0])->column("cgdNo");
|
|
|
- if(empty($cgdNo)) return error_show(1004,"未找到对账采购单信息");
|
|
|
- Db::startTrans();
|
|
|
- try{
|
|
|
+
|
|
|
+
|
|
|
+// $invNumber =isset($post['invNumber'])&& $post['invNumber']!='' ? trim($post['invNumber']):"";
|
|
|
+// $invCode =isset($post['invCode'])&& $post['invCode']!='' ? trim($post['invCode']):"";
|
|
|
+// $checkNumber =isset($post['checkNumber'])&& $post['checkNumber']!='' ? trim($post['checkNumber']):"";
|
|
|
+// $openTime =isset($post['open_time'])&& $post['open_time']!='' ? trim($post['open_time']):"";
|
|
|
+// $subtotal_amount =isset($post['subtotal_amount'])&& $post['subtotal_amount']!='' ? floatval($post['subtotal_amount']):"0";
|
|
|
+// if($type==1){
|
|
|
+// if($invNumber=="") return error_show(1004,"参数 invNumber 不能为空");
|
|
|
+// if($invCode=="") return error_show(1004,"参数 invCode 不能为空");
|
|
|
+//// if($checkNumber=="") return error_show(1004,"参数 checkNumber 不能为空");
|
|
|
+// if($openTime=="") return error_show(1004,"参数 open_time 不能为空");
|
|
|
+// if($subtotal_amount=="") return error_show(1004,"参数 subtotal_amount 不能为空");
|
|
|
+// }
|
|
|
+// $invimg = isset($post['inv_img'])&& $post['inv_img']!='' ? trim($post['inv_img']):"";
|
|
|
+// $invName = isset($post['invName'])&& $post['invName']!='' ? trim($post['invName']):"";
|
|
|
+// if($type==2){
|
|
|
+// if($invimg=="")return error_show(1004,"参数 inv_img 不能为空");
|
|
|
+// if($invName=="")return error_show(1004,"参数 invName 不能为空");
|
|
|
+// }
|
|
|
+// if ($type==3){
|
|
|
+//
|
|
|
+// }
|
|
|
+ $daList=[];
|
|
|
+ foreach ($invArr as $item){
|
|
|
+ if($type==1){
|
|
|
+ if(!isset($item['invNumber'])||$item['invNumber']=='') return error_show(1004,"参数 invNumber 不能为空");
|
|
|
+ if(!isset($item['invCode'])||$item['invCode']=='') return error_show(1004,"参数 invCode 不能为空");
|
|
|
+ if(!isset($item['openTime'])||$item['openTime']=='') return error_show(1004,"参数 invNumber 不能为空");
|
|
|
+ if(!isset($item['subtotal_amount'])||$item['subtotal_amount']=='') return error_show(1004,"参数 subtotal_amount 不能为空");
|
|
|
+ }
|
|
|
+ if($type==2){
|
|
|
+ if(!isset($item['inv_img'])||$item['inv_img']=='') return error_show(1004,"参数 inv_img 不能为空");
|
|
|
+ if(!isset($item['invName'])||$item['invName']=='') return error_show(1004,"参数 invName 不能为空");
|
|
|
+ }
|
|
|
+ if($type==3){
|
|
|
+ if(!isset($item['inv_img'])||$item['inv_img']=='') return error_show(1004,"参数 inv_img 不能为空");
|
|
|
+ if(!isset($item['invName'])||$item['invName']=='') return error_show(1004,"参数 invName 不能为空");
|
|
|
+ }
|
|
|
$hpNo=makeNo("hp");
|
|
|
$data=[
|
|
|
"payNo"=>$payNo,
|
|
@@ -972,27 +991,36 @@ class Payment extends BaseController
|
|
|
"apply_id"=>$this->uid,
|
|
|
"apply_name"=>$this->uname,
|
|
|
"inv_fee"=> 0,//核算金额
|
|
|
- "inv_subtotal_amount"=> $subtotal_amount, //票面金额
|
|
|
+ "inv_subtotal_amount"=> $item['subtotal_amount']??0, //票面金额
|
|
|
"invType"=> $type,
|
|
|
"invoiceType"=>'',
|
|
|
- "inv_img"=>$invimg,
|
|
|
- "invName"=>$invName,
|
|
|
- "invoiceNumber"=>$invNumber,
|
|
|
- "invoiceCode"=>$invCode,
|
|
|
+ "inv_img"=>$item['inv_img']??'',
|
|
|
+ "invName"=>$item['invName']??'',
|
|
|
+ "invoiceNumber"=>$item['invNumber']??'',
|
|
|
+ "invoiceCode"=>$item['invCode']??'',
|
|
|
"status"=>$type==2?1:2,
|
|
|
- "checkNumber"=>$checkNumber,
|
|
|
- "open_time"=>$openTime!=''? date("Y-m-d",strtotime($openTime)):"",
|
|
|
+ "checkNumber"=>$item['checkNumber']??'',
|
|
|
+ "open_time"=>$item['openTime']!=''? date("Y-m-d",strtotime($item['openTime'])):"",
|
|
|
"addtime"=>date("Y-m-d H:i:s"),
|
|
|
"updatetime"=>date("Y-m-d H:i:s")
|
|
|
];
|
|
|
- $inadd =Db::name("pay_invoice")->insert($data);
|
|
|
+ $daList[]=$data;
|
|
|
+ }
|
|
|
+ if(empty($daList)) return error_show(1004,"录入数据不能为空");
|
|
|
+ $cgdNo =Db::name("pay_info")->where(["payNo"=>$payNo,"is_del"=>0])->column("cgdNo");
|
|
|
+ if(empty($cgdNo)) return error_show(1004,"未找到对账采购单信息");
|
|
|
+ Db::startTrans();
|
|
|
+ try{
|
|
|
+
|
|
|
+
|
|
|
+ $inadd =Db::name("pay_invoice")->insertAll($daList);
|
|
|
if ($inadd){
|
|
|
foreach ($cgdNo as $value){
|
|
|
$report=ReportCode::where(["cgdNo"=>$value])->find();
|
|
|
if($report)$report->setField("hpNo",$hpNo);
|
|
|
}
|
|
|
Db::commit();
|
|
|
- return app_show(0,"回票新建成功",['hpNo'=>$hpNo]);
|
|
|
+ return app_show(0,"回票新建成功");
|
|
|
}
|
|
|
Db::rollback();
|
|
|
return error_show(1004,"回票申请新建失败");
|