$datearr[0], 'end_time' => $datearr[1]]); $marketingContract = new MarketingContract(); $consultProject = new ConsultProject(); $financialInvoice = new FinancialInvoice(); $financialRefund = new FinancialRefund(); $financialSettlement = new FinancialSettlement(); $supervisionProblem = new SupervisionProblem(); $supervisionProject = new SupervisionProject(); $supervisionProjectMonthlyReport = new SupervisionProjectMonthlyReport(); $where1=[ ['review_status', '=', 1], ['contract_type', '=', 0], ['status', '=', 0] ]; $DictData=DictData::where('type_value','approved')->column('value'); if($DictData){ $where1[]=['business_nature','in',$DictData]; } $total_apply_amount = $marketingContract->statistics_count($where1, $time, 'sum', ''); $apply_amount_value = $marketingContract->statistics_count($where1, $time, 'group', 'create_time'); $data[] = [ 'title' => '待立项项目', 'desc' => '', 'total_money' => $total_apply_amount, 'value' => $apply_amount_value['y'] ?? 0, 'type' => 1, ]; $total_apply_amount = $consultProject->statistics_count([], $time, 'sum', ''); $apply_amount_value = $consultProject->statistics_count([], $time, 'group', 'create_time'); $data[] = [ 'title' => '已立项项目', 'desc' => '', 'total_money' => $total_apply_amount, 'value' => $apply_amount_value['y'] ?? 0, 'type' => 1, ]; //项目问题统计 $problem_cate = DictData::where('type_value', 'problem_cate')->column('name', 'value'); foreach ($problem_cate as $k => $v) { $total = $supervisionProblem->statistics_count(['problem_cate' => $k], $time, 'sum', ''); $value = $supervisionProblem->statistics_count(['problem_cate' => $k], $time, 'group', 'create_time'); $data[] = [ 'title' => $v, 'desc' => '', 'total_money' => $total, 'value' => $value['y'] ?? 0, 'type' => 1, ]; } $contract_ids = $supervisionProject->group('contract')->column('contract'); //开票金额 $where[] = ['contract_id', 'in', $contract_ids]; $total_apply_amount = $financialInvoice->ContractFinancialMoney($where, $time, 'sum', '', 'apply_amount'); $apply_amount_value = $financialInvoice->ContractFinancialMoney($where, $time, 'group', 'create_time', 'apply_amount'); $data[] = [ 'title' => '开票金额', 'desc' => '', 'total_money' => $total_apply_amount, 'value' => $apply_amount_value['y'] ?? 0, 'type' => 1, ]; //回款金额 $total_amount = $financialRefund->statistics($where, $time, 'sum', '', 'amount'); $amount_value = $financialRefund->statistics($where, $time, 'group', 'create_time', 'amount'); $data[] = [ 'title' => '回款金额', 'desc' => '', 'total_money' => $total_amount, 'value' => $amount_value['y'] ?? 0, 'type' => 1, ]; //结算金额 $total_amount = $financialSettlement->statistics($where, $time, 'sum', '', 'amount'); $amount_value = $financialSettlement->statistics($where, $time, 'group', 'create_time', 'amount'); $data[] = [ 'title' => '结算金额', 'desc' => '', 'total_money' => $total_amount, 'value' => $amount_value['y'] ?? 0, 'type' => 1, ]; //工程进度 $total_apply_amount = $supervisionProjectMonthlyReport->statistics([], $time, 'sum', '', 'this_month_progress'); $apply_amount_value = $supervisionProjectMonthlyReport->statistics([], $time, 'group', 'create_time', 'this_month_progress'); $data[] = [ 'title' => '工程进度', 'desc' => '', 'total_money' => $total_apply_amount, 'value' => $apply_amount_value['y'] ?? 0, 'type' => 1, ]; //工程完成 $total_apply_amount = $supervisionProjectMonthlyReport->statistics([], $time, 'sum', '', 'total_amount'); $apply_amount_value = $supervisionProjectMonthlyReport->statistics([], $time, 'group', 'create_time', 'total_amount'); $data[] = [ 'title' => '工程完成', 'desc' => '', 'total_money' => $total_apply_amount, 'value' => $apply_amount_value['y'] ?? 0, 'type' => 1, ]; //支付总量 $total_apply_amount = $supervisionProjectMonthlyReport->statistics([], $time, 'sum', '', 'total_pay'); $apply_amount_value = $supervisionProjectMonthlyReport->statistics([], $time, 'group', 'create_time', 'total_pay'); $data[] = [ 'title' => '支付总量', 'desc' => '', 'total_money' => $total_apply_amount, 'value' => $apply_amount_value['y'] ?? 0, 'type' => 1, ]; return $data; } }