|
@@ -1949,4 +1949,124 @@ class OrderInv extends BaseController{
|
|
|
}
|
|
|
return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
|
|
|
}
|
|
|
+
|
|
|
+ public function downorder(){
|
|
|
+ $post=$this->request->only(["invNo"=>[]],"post","trim");
|
|
|
+ $condition=[["open_type","in",[2,3]],["is_del","=",0],["status","=",0]];
|
|
|
+ if(!empty($post['invNo'])){
|
|
|
+ $condition[]=['invNo',"in",$post['invNo']];
|
|
|
+ }
|
|
|
+ $invice = Db::name("invoice_pool")->where($condition)->select()->toArray();
|
|
|
+ if (empty($invice)){
|
|
|
+ return error_show(1003,"未找到数据");
|
|
|
+ }
|
|
|
+ $data=[];
|
|
|
+ foreach ($invice as $value){
|
|
|
+ $temp=[];
|
|
|
+ $orderNo = Db::name("assoc")->where([["status","=",1],["is_del","=",0],['viceNo',"=",$value['invNo']]])
|
|
|
+ ->find();
|
|
|
+ if(!$orderNo){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ $good = Db::name("qrd_info")->where([['sequenceNo',"=",$orderNo['orderCode']],["status","=",1]])
|
|
|
+ ->findOrEmpty();
|
|
|
+ if(empty($good)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(isset($value['inv_out'])&& $value['inv_out']!=''){
|
|
|
+ $invout = Db::name("company_info")->where([['companyNo',"=",$value['inv_out']]])->find();
|
|
|
+ }
|
|
|
+ $invinfo = Db::name("invoice_pool_info")->where("invNo","=",$value['invNo'])->findOrEmpty();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $temp['invNo'] = $value['invNo'];
|
|
|
+ $temp['qrdNo'] = $orderNo['orderCode'];
|
|
|
+ $temp['depart'] = $good['department'];
|
|
|
+ $temp['apply_name'] =$value['apply_name'];
|
|
|
+ $temp['code'] ="";
|
|
|
+ $temp['invoice_title'] =$invinfo['buyer_title']??"";
|
|
|
+ $temp['invoice_code'] =$invinfo['buyer_code']." ";
|
|
|
+ $temp['invoice_addr'] =$invinfo['buyer_addr']??"";
|
|
|
+ $temp['invoice_mobile'] =$invinfo['buyer_mobile']??"";
|
|
|
+ $temp['invoice_bank'] =$invinfo['buyer_bank']??"";
|
|
|
+ $temp['invoice_bankNo'] =$invinfo['buyer_bankNo']." ";
|
|
|
+ $temp['company'] =$good['customerName'];
|
|
|
+ $temp['goodname'] =$good['goodName'];
|
|
|
+ $temp['tax'] =$good['tax'];
|
|
|
+ $temp['inv_name'] =$good['goodName'];
|
|
|
+ $temp['diff_weight'] =$good['diff_weight'];
|
|
|
+ $temp['diff_price'] =$good['diff_fee'];
|
|
|
+ $temp['unit'] =$good['goodUnit'];
|
|
|
+ $temp['num'] =$good['goodNum'];
|
|
|
+ $temp['price'] =$good['goodPrice'];
|
|
|
+ $temp['total_fee'] =$good['totalPrice'];
|
|
|
+ switch ($value['inv_type']){
|
|
|
+ case 1:
|
|
|
+ $temp['inv_type'] = "增值税专用发票";
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ $temp['inv_type'] = "增值税普通发票";
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ $temp['inv_type'] = "增值税电子专用发票";
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ $temp['inv_type'] = "增值税电子普通发票";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $temp['inv_type'] = "-";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $temp['remark'] =$value['remark'];
|
|
|
+ $temp['kp_companyName'] = $invinfo['seller_title']??"";
|
|
|
+ $temp['kp_company_address'] = $invinfo['seller_addr']??"";
|
|
|
+ $temp['kp_company_license'] = $invinfo['seller_code']." ";
|
|
|
+ $temp['kp_bank_name'] = $invinfo['seller_bank']??"";
|
|
|
+ $temp['kp_bankNo'] = $invinfo['seller_bankNo']."";
|
|
|
+ $temp['kp_contector'] = $invout['contector']??"";
|
|
|
+ $temp['kp_mobile'] = $invinfo['seller_mobile']??"";
|
|
|
+ $data[]=$temp;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (empty($data)){
|
|
|
+ return error_show(1003,"未找到数据");
|
|
|
+ }
|
|
|
+ $header=[
|
|
|
+ "申请编号",
|
|
|
+ "公司订单号",
|
|
|
+ "申请部门(所属平台)",
|
|
|
+ "申请人",
|
|
|
+ "代码",
|
|
|
+ "发票开具全称",
|
|
|
+ "发票开具企业纳税识别号",
|
|
|
+ "发票开具企业地址",
|
|
|
+ "发票开具企业地址联系方式",
|
|
|
+ "发票开具企业收款银行",
|
|
|
+ "发票开具企业收款账户",
|
|
|
+ "分公司",
|
|
|
+ "采购商品名",
|
|
|
+ "税率",
|
|
|
+ "发票商品名",
|
|
|
+ "工差重量",
|
|
|
+ "工差金额",
|
|
|
+ "单位",
|
|
|
+ "数量",
|
|
|
+ "单价",
|
|
|
+ "总价",
|
|
|
+ "开票种类",
|
|
|
+ "备注说明",
|
|
|
+ '开票企业名称',
|
|
|
+ '开票企业地址',
|
|
|
+ '开票企业纳税号',
|
|
|
+ '开票企业银行名称',
|
|
|
+ '开票企业银行账户',
|
|
|
+ '开票企业法人',
|
|
|
+ '开票企业联系方式'
|
|
|
+ ];
|
|
|
+ $li = excelExport("待开票",$header,$data);
|
|
|
+ }
|
|
|
}
|