aa
This commit is contained in:
parent
e2fd66c9cc
commit
39b4916463
@ -25,10 +25,17 @@
|
||||
use app\common\model\finance\FinanceReturnedMoney;
|
||||
use app\common\model\finance\FinanceReturnedRecord;
|
||||
use app\common\model\project\Competitor;
|
||||
use app\common\model\project\ProjectCostBudget;
|
||||
use app\common\model\project\ProjectCostBudgetDetail;
|
||||
use app\common\model\project\ProjectEquipmentBudgetDetail;
|
||||
use app\common\model\project\ProjectEstimate;
|
||||
use app\common\model\project\ProjectFollowUp;
|
||||
use app\common\model\project\ProjectLaborBudgetDetail;
|
||||
use app\common\model\project\ProjectMaterialBudgetDetail;
|
||||
use app\common\model\project\ProjectSettlement;
|
||||
use app\common\model\project\ProjectSubcontractSettlement;
|
||||
use app\common\model\project\ProjectSubpackageBudgetDetail;
|
||||
use app\common\model\project\ProjectTotalBudget;
|
||||
use think\response\Json;
|
||||
|
||||
class ProjectStatisticsController extends BaseAdminController
|
||||
@ -138,12 +145,59 @@
|
||||
}
|
||||
|
||||
//项目预算统计
|
||||
public function budget() {
|
||||
public function budget(): Json
|
||||
{
|
||||
$id = $this->request->get('project_id');
|
||||
if(empty($id)){
|
||||
return $this->fail('缺少必要参数');
|
||||
}
|
||||
$column = ['总预算','材料预算','分包预算','人工预算','费用预算','机具预算'];
|
||||
halt();
|
||||
//总预算
|
||||
$project_budget = ProjectTotalBudget::field('id,cl_cost,fb_cost,rg_cost,fy_cost,jj_cost')->where('project_id',$id)->findOrEmpty();
|
||||
$total_budget = $project_budget['cl_cost'] + $project_budget['fb_cost'] + $project_budget['rg_cost'] + $project_budget['fy_cost'] + $project_budget['jj_cost'];
|
||||
//材料清单预算
|
||||
$material_budget = ProjectMaterialBudgetDetail::where('project_id',$id)->sum('amount');
|
||||
//分包清单预算
|
||||
$subpackage_budget = ProjectSubpackageBudgetDetail::where('project_id',$id)->sum('amount');
|
||||
//人工清单预算
|
||||
$labor_budget = ProjectLaborBudgetDetail::where('project_id',$id)->sum('amount');
|
||||
//费用清单预算
|
||||
$cost_budget = ProjectCostBudgetDetail::where('project_id',$id)->sum('amount');
|
||||
//机具清单预算
|
||||
$equipment_budget = ProjectEquipmentBudgetDetail::where('project_id',$id)->sum('amount');
|
||||
$total_budget_series = [
|
||||
'name' => '总预算',
|
||||
'data' => [$total_budget,($material_budget+$subpackage_budget+$labor_budget+$cost_budget+$equipment_budget)]
|
||||
];
|
||||
$material_budget_series = [
|
||||
'name' => '材料预算',
|
||||
'data' => [$project_budget['cl_cost'],$material_budget]
|
||||
];
|
||||
$subpackage_budget_series = [
|
||||
'name' => '分包预算',
|
||||
'data' => [$project_budget['fb_cost'],$subpackage_budget]
|
||||
];
|
||||
$labor_budget_series = [
|
||||
'name' => '人工预算',
|
||||
'data' => [$project_budget['rg_cost'],$labor_budget]
|
||||
];
|
||||
$cost_budget_series = [
|
||||
'name' => '费用预算',
|
||||
'data' => [$project_budget['fy_cost'],$cost_budget]
|
||||
];
|
||||
$equipment_budget_series = [
|
||||
'name' => '机具预算',
|
||||
'data' => [$project_budget['jj_cost'],$equipment_budget]
|
||||
];
|
||||
$result = [
|
||||
'total_budget_series' => $total_budget_series,
|
||||
'material_budget_series' => $material_budget_series,
|
||||
'subpackage_budget_series' => $subpackage_budget_series,
|
||||
'labor_budget_series' => $labor_budget_series,
|
||||
'cost_budget_series' => $cost_budget_series,
|
||||
'equipment_budget_series' => $equipment_budget_series,
|
||||
'column' => $column,
|
||||
];
|
||||
return $this->success('success',$result);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user