update
This commit is contained in:
parent
37f56f0e0a
commit
c9c98688e7
@ -12,10 +12,16 @@
|
|||||||
use app\common\model\contract\ContractNegotiation;
|
use app\common\model\contract\ContractNegotiation;
|
||||||
use app\common\model\contract\ProcurementContract;
|
use app\common\model\contract\ProcurementContract;
|
||||||
use app\common\model\contract\ProcurementContractDetail;
|
use app\common\model\contract\ProcurementContractDetail;
|
||||||
|
use app\common\model\contract\SubcontractingContract;
|
||||||
|
use app\common\model\contract\SubcontractingContractDetail;
|
||||||
|
use app\common\model\contract\SubcontractingContractNegotiation;
|
||||||
use app\common\model\custom\Custom;
|
use app\common\model\custom\Custom;
|
||||||
use app\common\model\custom\CustomerDemand;
|
use app\common\model\custom\CustomerDemand;
|
||||||
use app\common\model\custom\CustomerDemandSolution;
|
use app\common\model\custom\CustomerDemandSolution;
|
||||||
use app\common\model\finance\FinanceInvoiceApply;
|
use app\common\model\finance\FinanceInvoiceApply;
|
||||||
|
use app\common\model\finance\FinancePaymentApply;
|
||||||
|
use app\common\model\finance\FinancePaymentPlan;
|
||||||
|
use app\common\model\finance\FinanceReceiptRecord;
|
||||||
use app\common\model\finance\FinanceReturnedMoney;
|
use app\common\model\finance\FinanceReturnedMoney;
|
||||||
use app\common\model\finance\FinanceReturnedRecord;
|
use app\common\model\finance\FinanceReturnedRecord;
|
||||||
use app\common\model\project\Competitor;
|
use app\common\model\project\Competitor;
|
||||||
@ -250,11 +256,105 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//分包合同
|
//分包合同
|
||||||
public function subcontractingContract() {
|
public function subcontractingContract(): Json
|
||||||
|
{
|
||||||
$year = $this->request->get('year');
|
$year = $this->request->get('year');
|
||||||
if(empty($year)){
|
if(empty($year)){
|
||||||
$year = date('Y');
|
$year = date('Y');
|
||||||
}
|
}
|
||||||
$column = ['1','2','3','4','5','6','7','8','9','10','11','12'];
|
$column = ['1','2','3','4','5','6','7','8','9','10','11','12'];
|
||||||
|
//合同总数
|
||||||
|
$total_num = SubcontractingContract::field('id')->count();
|
||||||
|
//合同签约总金额
|
||||||
|
$total_sign_amount = SubcontractingContractDetail::sum('amount_including_tax');
|
||||||
|
//合同洽商金额
|
||||||
|
$total_negotiation_amount = SubcontractingContractNegotiation::sum('negotiation_amount');
|
||||||
|
//合同总金额
|
||||||
|
$total_amount = $total_sign_amount + $total_negotiation_amount;
|
||||||
|
//年度合同总数
|
||||||
|
$year_total_num = SubcontractingContract::field('id')->whereYear('signing_date',$year)->count();
|
||||||
|
//年度合同id
|
||||||
|
$year_subcontracting_contract_ids = SubcontractingContract::whereYear('signing_date',$year)->column('id');
|
||||||
|
//年度合同签约金额
|
||||||
|
$year_total_sign_amount = SubcontractingContractDetail::where('contract_id','in',$year_subcontracting_contract_ids)->sum('amount_including_tax');
|
||||||
|
//年度合同洽商金额
|
||||||
|
$year_total_negotiation_amount = SubcontractingContractNegotiation::where('subcontracting_contract_id','in',$year_subcontracting_contract_ids)->sum('negotiation_amount');
|
||||||
|
//年度合同总金额
|
||||||
|
$year_total_amount = $year_total_sign_amount + $year_total_negotiation_amount;
|
||||||
|
$series = [
|
||||||
|
'name' => '合同金额',
|
||||||
|
'data' => []
|
||||||
|
];
|
||||||
|
foreach($column as &$v){
|
||||||
|
$month = $v;
|
||||||
|
if($month < 10){
|
||||||
|
$month = '0'.$month;
|
||||||
|
}
|
||||||
|
$month_subcontracting_contract_ids = SubcontractingContract::whereMonth('signing_date',$year.'-'.$month)->column('id');
|
||||||
|
//月度合同签约金额
|
||||||
|
$month_total_sign_amount = SubcontractingContractDetail::where('contract_id','in',$month_subcontracting_contract_ids)->sum('amount_including_tax');
|
||||||
|
//月度合同洽商金额
|
||||||
|
$month_total_negotiation_amount = SubcontractingContractNegotiation::where('subcontracting_contract_id','in',$month_subcontracting_contract_ids)->sum('negotiation_amount');
|
||||||
|
$series['data'][] = $month_total_sign_amount + $month_total_negotiation_amount;
|
||||||
|
$v = $v.'月';
|
||||||
|
}
|
||||||
|
$result = [
|
||||||
|
'total_num' => $total_num,
|
||||||
|
'total_amount' => $total_amount,
|
||||||
|
'total_negotiation_amount' => $total_negotiation_amount,
|
||||||
|
'year_total_num' => $year_total_num,
|
||||||
|
'year_total_amount' => $year_total_amount,
|
||||||
|
'column' => $column,
|
||||||
|
'series' => $series,
|
||||||
|
];
|
||||||
|
return $this->success('success',$result);
|
||||||
|
}
|
||||||
|
|
||||||
|
//项目付款
|
||||||
|
public function projectPayment(): Json
|
||||||
|
{
|
||||||
|
$year = $this->request->get('year');
|
||||||
|
if(empty($year)){
|
||||||
|
$year = date('Y');
|
||||||
|
}
|
||||||
|
$column = ['1','2','3','4','5','6','7','8','9','10','11','12'];
|
||||||
|
//年度收票金额
|
||||||
|
$year_invoicing_amount = FinanceReceiptRecord::whereYear('invoicing_date',$year)->sum('invoice_amount');
|
||||||
|
//年度付款计划金额
|
||||||
|
$year_payment_plan_amount = FinancePaymentPlan::whereYear('pay_date',$year)->sum('amount');
|
||||||
|
//年度付款金额
|
||||||
|
$year_payment_amount = FinancePaymentApply::whereYear('pay_date',$year)->sum('amount');
|
||||||
|
$invoice_series = [
|
||||||
|
'name' => '收票金额',
|
||||||
|
'data' => []
|
||||||
|
];
|
||||||
|
$payment_plan_series = [
|
||||||
|
'name' => '付款计划金额',
|
||||||
|
'data' => []
|
||||||
|
];
|
||||||
|
$payment_series = [
|
||||||
|
'name' => '付款金额',
|
||||||
|
'data' => []
|
||||||
|
];
|
||||||
|
foreach($column as &$v){
|
||||||
|
$month = $v;
|
||||||
|
if($month < 10){
|
||||||
|
$month = '0'.$month;
|
||||||
|
}
|
||||||
|
$invoice_series['data'][] = FinanceReceiptRecord::whereMonth('invoicing_date',$year.'-'.$month)->sum('invoice_amount');
|
||||||
|
$payment_plan_series['data'][] = FinancePaymentPlan::whereMonth('pay_date',$year.'-'.$month)->sum('amount');
|
||||||
|
$payment_series['data'][] = FinancePaymentApply::whereMonth('pay_date',$year.'-'.$month)->sum('amount');
|
||||||
|
$v = $v.'月';
|
||||||
|
}
|
||||||
|
$result = [
|
||||||
|
'year_invoicing_amount' => $year_invoicing_amount,
|
||||||
|
'year_payment_plan_amount' => $year_payment_plan_amount,
|
||||||
|
'year_payment_amount' => $year_payment_amount,
|
||||||
|
'invoice_series' => $invoice_series,
|
||||||
|
'payment_plan_series' => $payment_plan_series,
|
||||||
|
'payment_series' => $payment_series,
|
||||||
|
'column' => $column,
|
||||||
|
];
|
||||||
|
return $this->success('success',$result);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user