diff --git a/Application/Admin/Controller/AggregateFinanceStatementController.class.php b/Application/Admin/Controller/AggregateFinanceStatementController.class.php index 7f72a3510..b004f839a 100644 --- a/Application/Admin/Controller/AggregateFinanceStatementController.class.php +++ b/Application/Admin/Controller/AggregateFinanceStatementController.class.php @@ -115,6 +115,15 @@ class AggregateFinanceStatementController extends ThinkController $data[$key]['detail'] = json_decode($value['detail'],true); + $data[$key]['detail']['pool'] = str_replace(")",")
",$data[$key]['detail']['pool']); + + $data[$key]['detail']['apply'] = str_replace(")",")
",$data[$key]['detail']['apply']); + + $data[$key]['detail']['invoiced'] = str_replace(")",")
",$data[$key]['detail']['invoiced']); + + $data[$key]['detail']['received'] = str_replace(")",")
",$data[$key]['detail']['received']); + + $data[$key]['oplist'] = $this->OpAuth($value); } // dump($data);die(); @@ -670,7 +679,8 @@ class AggregateFinanceStatementController extends ThinkController $objPHPExcel->getActiveSheet()->setCellValue('E'.$line, $value['fax_ratio'] . '%'); $objPHPExcel->getActiveSheet()->setCellValue('C'.$line, $value['money']); $objPHPExcel->getActiveSheet()->setCellValue('B'.$line, $product_name); - $objPHPExcel->getActiveSheet()->setCellValue('F'.$line, $value['ratio_money']); +// $objPHPExcel->getActiveSheet()->setCellValue('F'.$line, $value['ratio_money']); + $objPHPExcel->getActiveSheet()->setCellValue('F'.$line,"=C{$line}*D{$line}*(1-E{$line})"); $objPHPExcel->getActiveSheet()->getStyle('A'.$line)->getFont()->setBold(false); $objPHPExcel->getActiveSheet()->getStyle('B'.$line)->getFont()->setBold(false); diff --git a/Application/Admin/Controller/AggregateRelationController.class.php b/Application/Admin/Controller/AggregateRelationController.class.php index 5703b6540..e222df899 100644 --- a/Application/Admin/Controller/AggregateRelationController.class.php +++ b/Application/Admin/Controller/AggregateRelationController.class.php @@ -517,6 +517,8 @@ class AggregateRelationController extends AdminController $p['second_company_id'] = $y['second_company_id']; $p['second_company_name'] = $y['second_company_name']; $p['second_company_type'] = $y['second_company_type']; + } else { + $this->error('未做任何修改'); } if($p['first_company_type'] > 0){ $where = " @@ -532,15 +534,39 @@ class AggregateRelationController extends AdminController "; } - if ($y['first_company_type'] == 3) { - $company_info = json_decode($y['first_company_info'],true); + + $p['first_company_info'] = $this->getCompanyInfo($p['first_company_type'],$p['first_company_id']); + $p['first_company_info']['type'] = 'first_party_info'; + $p['first_company_info'] = json_encode($p['first_company_info']); + + $p['second_company_info'] = $this->getCompanyInfo($p['second_company_type'],$p['second_company_id']); + $p['second_company_info']['type'] = 'second_party_info'; + $p['second_company_info'] = json_encode($p['second_company_info']); + + if ($y['collection'] == 1) { + + $company_info = json_decode($p['first_company_info'],true); $company_info['invoice_item'] = $p['invoice_content']; + + if ($p['invoice_type'] == 1) { + $company_info['invoice_type'] = "专票"; + } elseif($p['invoice_type'] == 2) { + $company_info['invoice_type'] = "普票"; + } + $p['first_company_info'] = json_encode($company_info); - }else if ($y['second_company_type'] == 3) { - $company_info = json_decode($y['second_company_info'],true); + }else if ($y['collection'] == 2) { + + $company_info = json_decode($p['second_company_info'],true); $company_info['invoice_item'] = $p['invoice_content']; + if ($p['invoice_type'] == 1) { + $company_info['invoice_type'] = "专票"; + } elseif($p['invoice_type'] == 2) { + $company_info['invoice_type'] = "普票"; + } $p['second_company_info'] = json_encode($company_info); + } $hasdb = $this->DBlogModel->where($where)->find(); @@ -632,7 +658,16 @@ class AggregateRelationController extends AdminController $companyInfo = []; if($type == 0){ //己方公司 - $companyInfo = M("CompanyInfo","tab_")->field("id,partner company_name,link_man,link_phone")->where("status='1'")->select(); + $companyInfo = M("CompanyInfo","tab_")->field("id,partner company_name,link_man,link_phone,invoice_type,invoice_item,1 type")->where("status='1'")->select(); + + foreach ($companyInfo as $key => $value) { + if (strstr($value['invoice_type'],'专')) { + $companyInfo[$key]['invoice_type'] = 1; + } else if (strstr($value['invoice_type'],'普')) { + $companyInfo[$key]['invoice_type'] = 2; + } + } + } $b = $this->getBindCompanyId($type); diff --git a/Application/Admin/Controller/AggregateStatementPoolController.class.php b/Application/Admin/Controller/AggregateStatementPoolController.class.php index 6edde72ac..bc92958b6 100644 --- a/Application/Admin/Controller/AggregateStatementPoolController.class.php +++ b/Application/Admin/Controller/AggregateStatementPoolController.class.php @@ -252,6 +252,7 @@ class AggregateStatementPoolController extends ThinkController }else{ $va['sum_money'] = "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}"; } + $va['ratio_money'] = "=ROUND(G{$line}*H{$line}*(1-I{$line})-J{$line}-K{$line},2)"; }else{ $count['platform_amount'] += $va['money']; $count['sum_money'] += $va['ratio_money']; diff --git a/Application/Admin/View/AggregateRelation/addRelation.html b/Application/Admin/View/AggregateRelation/addRelation.html index 4bc8c5701..35b523dba 100644 --- a/Application/Admin/View/AggregateRelation/addRelation.html +++ b/Application/Admin/View/AggregateRelation/addRelation.html @@ -174,7 +174,7 @@ *结算周期: - @@ -197,7 +197,7 @@ 开票内容: - + @@ -345,7 +345,7 @@ $(function(){ }) console.log(companyinfo) if (companyinfo.type) { - setAggregateInfo(companyinfo.invoice_item,companyinfo.withdraw_type,companyinfo.invoice_type); + setAggregateInfo(companyinfo.invoice_item,companyinfo.withdraw_type,companyinfo.invoice_type,1); } $("#first_company_name").val(companyinfo.company_name); @@ -382,41 +382,68 @@ $(function(){ }) if (companyinfo.type) { - setAggregateInfo(companyinfo.invoice_item,companyinfo.withdraw_type,companyinfo.invoice_type); + setAggregateInfo(companyinfo.invoice_item,companyinfo.withdraw_type,companyinfo.invoice_type,2); } $("#second_company_name").val(companyinfo.company_name); $("#second_company_info").html(setCompanyInfo(companyinfo)); }); - function setAggregateInfo(invoice_content,settlement_type,invoice_type) { - if (invoice_content) { + $("#collection").on("change",function() { + var get_collection = $(this).find("option:selected").val(); + var companyinfo; + var id; + + if (get_collection == 1) { + id = $("#first_company_id").find("option:selected").val(); + companyinfo = first_company.find(function(x){ + return x.id == id; + }); + } else if (get_collection == 2) { + id = $("#second_company_id").find("option:selected").val(); + companyinfo = second_company.find(function(x){ + return x.id == id; + }); + } + setAggregateInfo(companyinfo.invoice_item,companyinfo.withdraw_type,companyinfo.invoice_type,get_collection); + }); + + $('#invoice_content').on("change",function() { + $('#invoice_content').val($(this).val()); + }); + + function setAggregateInfo(invoice_content,settlement_type,invoice_type,collection) { + var get_collection = $("#collection").find("option:selected").val(); + if (collection == get_collection) { + + $('.invoice_content').val(invoice_content); $('#invoice_content').val(invoice_content); - } + $('#settlement_type').find("option").each(function() { + $(this).removeAttr("selected"); + }); + // if (!settlement_type) { + // $('#settlement_type').removeAttr("disabled"); + // } else { + // $('#settlement_type').prop("disabled",true); + // } + $('#invoice_type').find("option").each(function() { + $(this).removeAttr("selected"); + }); - $('#settlement_type').find("option").each(function() { - $(this).removeAttr("selected"); - }); - // if (!settlement_type) { - // $('#settlement_type').removeAttr("disabled"); - // } else { - $('#settlement_type').prop("disabled",true); - // } - $('#invoice_type').find("option").each(function() { - $(this).removeAttr("selected"); - }); + // if (!invoice_type) { + // $('#invoice_type').removeAttr("disabled"); + // } else { + // $('#invoice_type').prop("disabled",true); + // } + $("#settlement_type").find("option[value="+settlement_type+"]").prop("selected",true); + + $("#invoice_type").find("option[value="+invoice_type+"]").prop("selected",true); + $("#settlement_type").change(); + $("#invoice_type").change(); - // if (!invoice_type) { - // $('#invoice_type').removeAttr("disabled"); - // } else { - $('#invoice_type').prop("disabled",true); - // } - $("#settlement_type").find("option[value="+settlement_type+"]").prop("selected",true); - $("#invoice_type").find("option[value="+invoice_type+"]").prop("selected",true); - $("#settlement_type").change(); - $("#invoice_type").change(); + } } diff --git a/Application/Admin/View/AggregateRelation/edit.html b/Application/Admin/View/AggregateRelation/edit.html index 2c100ae01..96a3a7a87 100644 --- a/Application/Admin/View/AggregateRelation/edit.html +++ b/Application/Admin/View/AggregateRelation/edit.html @@ -151,7 +151,7 @@ *结算周期: - @@ -162,7 +162,7 @@ *开票类型: -