143 lines
6.0 KiB
PHP
143 lines
6.0 KiB
PHP
<?php
|
|
|
|
namespace app\adminapi\logic\financial;
|
|
|
|
use app\common\logic\BaseLogic;
|
|
use app\common\model\dict\DictData;
|
|
use app\common\model\financial\FinancialBidMargin;
|
|
use app\common\model\financial\FinancialBidMarginRecovery;
|
|
use app\common\model\financial\FinancialBorrowMoney;
|
|
use app\common\model\financial\FinancialInvoice;
|
|
use app\common\model\financial\FinancialPerformanceMoneyApply;
|
|
use app\common\model\financial\FinancialPerformanceMoneyRecovery;
|
|
use app\common\model\financial\FinancialRefund;
|
|
use app\common\model\financial\FinancialRepayment;
|
|
use app\common\model\financial\FinancialSettlement;
|
|
use app\common\model\financial\FinancialUsingFunds;
|
|
|
|
class FinancialStatisticsLogic extends BaseLogic
|
|
{
|
|
|
|
/**
|
|
* 统计
|
|
*/
|
|
public static function financialStatistics($where, $time)
|
|
{
|
|
$data = [];
|
|
$datearr = explode('-', $time);
|
|
$time = TimeConvert(['start_time' => $datearr[0], 'end_time' => $datearr[1]]);
|
|
$marketingContract = new FinancialInvoice();
|
|
$financialRefund = new FinancialRefund();
|
|
$financialBidMargin = new FinancialBidMargin();
|
|
$financialBidMarginRecovery = new FinancialBidMarginRecovery();
|
|
$financialPerformanceMoneyApply = new FinancialPerformanceMoneyApply();
|
|
$financialPerformanceMoneyRecovery = new FinancialPerformanceMoneyRecovery();
|
|
$financialUsingFunds = new FinancialUsingFunds();
|
|
$financialBorrowMoney = new FinancialBorrowMoney();
|
|
$financialRepayment = new FinancialRepayment();
|
|
$financialSettlement = new FinancialSettlement();
|
|
//开票金额
|
|
$total_apply_amount = $marketingContract->ContractFinancialMoney([], $time, 'sum', '', 'apply_amount');
|
|
$apply_amount_value = $marketingContract->ContractFinancialMoney([], $time, 'group', 'create_time', 'apply_amount');
|
|
$data[] = [
|
|
'title' => '开票金额',
|
|
'desc' => '',
|
|
'total_money' => $total_apply_amount,
|
|
'value' => $apply_amount_value['y'],
|
|
'type' => 1,
|
|
];
|
|
//回款金额
|
|
$total_amount = $financialRefund->statistics([], $time, 'sum', '', 'amount');
|
|
$amount_value = $financialRefund->statistics([], $time, 'group', 'create_time', 'amount');
|
|
$data[] = [
|
|
'title' => '回款金额',
|
|
'desc' => '',
|
|
'total_money' => $total_amount,
|
|
'value' => $amount_value['y'],
|
|
'type' => 1,
|
|
];
|
|
//结算金额
|
|
$total_capply_amount=$financialSettlement->statistics([],$time,'sum','','amount');
|
|
$total_apply_amount_value=$financialSettlement->statistics([],$time,'group','create_time','amount');
|
|
$data[]=[
|
|
'title' => '结算金额',
|
|
'desc' => '',
|
|
'total_money' => $total_capply_amount,
|
|
'value' => $total_apply_amount_value['y'],
|
|
'type' => 1,
|
|
];
|
|
|
|
//保证金申请
|
|
$total_bid_margin = $financialBidMargin->statistics([], $time, 'sum', '', 'bid_margin');
|
|
$bid_margin_value = $financialBidMargin->statistics([], $time, 'group', 'create_time', 'bid_margin');
|
|
$data[] = [
|
|
'title' => '保证金申请',
|
|
'desc' => '',
|
|
'total_money' => $total_bid_margin,
|
|
'value' => $bid_margin_value['y']??[],
|
|
'type' => 1,
|
|
];
|
|
//保证金回收
|
|
$total_pay_amount = $financialBidMarginRecovery->statistics([], $time, 'sum', '', 'pay_amount');
|
|
$pay_amount_value = $financialBidMarginRecovery->statistics([], $time, 'group', 'create_time', 'pay_amount');
|
|
$data[] = [
|
|
'title' => '保证金回收',
|
|
'desc' => '',
|
|
'total_money' => $total_pay_amount,
|
|
'value' => $pay_amount_value['y']??[],
|
|
'type' => 1,
|
|
];
|
|
//履约申请
|
|
$apply_amount = $financialPerformanceMoneyApply->statistics([], $time, 'sum', '', 'apply_amount');
|
|
$apply_amount_value = $financialPerformanceMoneyApply->statistics([], $time, 'group', 'create_time', 'apply_amount');
|
|
$data[] = [
|
|
'title' => '履约申请',
|
|
'desc' => '',
|
|
'total_money' => $apply_amount,
|
|
'value' => $apply_amount_value['y']??[],
|
|
'type' => 1,
|
|
];
|
|
//履约回收
|
|
$recovery_amount = $financialPerformanceMoneyRecovery->statistics([], $time, 'sum', '', 'recovery_amount');
|
|
$recovery_amount_value = $financialPerformanceMoneyRecovery->statistics([], $time, 'group', 'create_time', 'recovery_amount');
|
|
$data[] = [
|
|
'title' => '履约回收',
|
|
'desc' => '',
|
|
'total_money' => $recovery_amount,
|
|
'value' => $recovery_amount_value['y']??[],
|
|
'type' => 1,
|
|
];
|
|
//用款
|
|
$has_pay_amount = $financialUsingFunds->statistics([], $time, 'sum', '', 'has_pay_amount');
|
|
$has_pay_amount_value = $financialUsingFunds->statistics([], $time, 'group', 'create_time', 'has_pay_amount');
|
|
$data[] = [
|
|
'title' => '用款',
|
|
'desc' => '',
|
|
'total_money' => $has_pay_amount,
|
|
'value' => $has_pay_amount_value['y']??[],
|
|
'type' => 1,
|
|
];
|
|
//借款
|
|
$amount = $financialBorrowMoney->statistics([], $time, 'sum', '', 'amount');
|
|
$amount_value = $financialBorrowMoney->statistics([], $time, 'group', 'create_time', 'amount');
|
|
$data[] = [
|
|
'title' => '借款',
|
|
'desc' => '',
|
|
'total_money' => $amount,
|
|
'value' => $amount_value['y']??[],
|
|
'type' => 1,
|
|
];
|
|
//还款
|
|
$amount = $financialRepayment->statistics([], $time, 'sum', '', 'amount');
|
|
$amount_value = $financialRepayment->statistics([], $time, 'group', 'create_time', 'amount');
|
|
$data[] = [
|
|
'title' => '还款',
|
|
'desc' => '',
|
|
'total_money' => $amount,
|
|
'value' => $amount_value['y']??[],
|
|
'type' => 1,
|
|
];
|
|
return $data;
|
|
}
|
|
}
|