@ -11,7 +11,7 @@ class AggregateFinanceStatementController extends ThinkController
"-4"=>"汇总审批拒绝",
"-3"=>"撤销汇总",
"-1"=>"审批拒绝",
"0"=>"未申请开票",
"0"=>"未审批",
"1"=>"申请开票",
"2"=>"审批同意",
"3"=>"已开票",
@ -162,7 +162,11 @@ class AggregateFinanceStatementController extends ThinkController
$this->setAggregateDetail(2,1,'申请开票',$id);
if ($company_info['collection'] == 1) {
$pay_company_id = 0;
$this->assign('first_channel_id',$id);
$this->assign('second_company_id',$id);
} else if ($company_info['collection'] == 2) {
$this->assign('first_channel_id',$id);
$this->assign('second_company_id',$id);
$pay_company_id = 1;
}
// dump($pay_company_id);die();
@ -170,8 +174,7 @@ class AggregateFinanceStatementController extends ThinkController
$this->assign("pay_company_id",$pay_company_id);
$this->assign('first_partner_type',$first_partner_type);
$this->assign('first_channel_id',$company_info['first_company_id']);
$this->assign('second_company_id',$company_info['second_company_id']);
$statement_info = json_decode($info['statement_info'],true);
$this->assign('company_info',$company_info);
@ -212,6 +215,7 @@ class AggregateFinanceStatementController extends ThinkController
"verify_status"=>$verify_status,
"create_time"=>time()
);
$id = $_REQUEST['statement_id'];
$res = M("aggregate_statement","tab_")->where("id = '{$id}'")->save($adddata);
if($res !== false){
@ -226,11 +230,15 @@ class AggregateFinanceStatementController extends ThinkController
public function getCompanyList()
{
$id = $_REQUEST['id'];
$cpCompany = M("aggregate_statement","tab_")->field("channel_id id ,second_party_info")->where("id={$id}")->find();
$cpCompany = M("aggregate_statement","tab_")->field("id,first_party_info ,second_party_info")->where("id={$id}")->find();
$data = array();
$data['ptCompany']= M("CompanyInfo","tab_")->field('id,partner')->select();
$data['cpCompany']= [[
// $data['ptCompany']= M("CompanyInfo","tab_")->field('id,partner')->select();
$data['ptCompany']=[[
"id"=> $cpCompany['id'],
"partner"=>json_decode($cpCompany['first_party_info'],true)['partner']
]];
$data['cpCompany']= [[
"id"=> $cpCompany['id'],
"partner"=>json_decode($cpCompany['second_party_info'],true)['partner']
]];
@ -241,12 +249,16 @@ class AggregateFinanceStatementController extends ThinkController
$CompanyId = $_REQUEST['company_id'];
$company_type = $_REQUEST['company_type'];
if($company_type == 'pt'){
$info = M("CompanyInfo","tab_")->field("id,partner,link_man,link_phone,address,company_tax_no,payee_name,bank_account,opening_bank")->where("id = '{$CompanyId}'")->find();
// $info = M("CompanyInfo","tab_")->field("id,partner,link_man,link_phone,address,company_tax_no,payee_name,bank_account,opening_bank")->where("id = '{$CompanyId}'")->find();
$cpCompany = M("aggregate_statement","tab_")->field("channel_id id,first_party_info,channel_id")->where("id={$CompanyId}")->find();
$info = json_decode($cpCompany['first_party_info'],true);
}else{
$cpCompany = M("aggregate_statement","tab_")->field("channel_id id,second_party_info,channel_id")->where("channel_id={$CompanyId}")->find();
$cpCompany = M("aggregate_statement","tab_")->field("channel_id id,second_party_info,channel_id")->where("id={$CompanyId}")->find();
$info = json_decode($cpCompany['second_party_info'],true);
$relation = M("company_relation","tab_")->where("first_company_id={$cpCompany['channel_id']} or second_company_id = {$cpCompany['channel_id']}")->find();
// $relation = M("company_relation","tab_")->where("( first_company_id={$cpCompany['channel_id']} and first_company_type=3) or ( second_company_id = {$cpCompany['channel_id']} and first_company_type=3) ")->find();
// $info['link_man'] = $info['connection_person'];
// $info['link_phone'] = $info['phone'];
// $info['address'] = $info['send_address'];
@ -257,17 +269,17 @@ class AggregateFinanceStatementController extends ThinkController
// $info['company_tax_no'] = $info['tax_identification_number'];
}
$info['invoice_item'] = "信息技术服务费";
$info['invoice_type'] = "增值税专用发票";
if ($relation['invoice_type'] == 1) {
$info['invoice_type'] = "专票";
} else if($relation['invoice_type'] == 2) {
$info['invoice_type'] = "普票";
}
if($relation['invoice_content']) {
$info['invoice_item'] = $relation['invoice_content'];
}
// $info['invoice_item'] = "信息技术服务费";
// $info['invoice_type'] = "增值税专用发票";
//
// if ($relation['invoice_type'] == 1) {
// $info['invoice_type'] = "专票";
// } else if($relation['invoice_type'] == 2) {
// $info['invoice_type'] = "普票";
// }
// if($relation['invoice_content']) {
// $info['invoice_item'] = $relation['invoice_content'];
// }
if(empty($info)){
$this->ajaxReturn(array("error"=>"no find","code"=>2000));