Update: refactor code and improve statistics functions in ConsultStatisticsLogic, CostProjectStatisticsLogic, ManageStatisticsLogic, and SupervisionProjectStatisticsLogic

This commit is contained in:
mkm 2024-07-05 10:50:42 +08:00
parent 093739a853
commit 408212d1a7
4 changed files with 5 additions and 5 deletions

View File

@ -21,7 +21,6 @@ class ConsultStatisticsLogic extends BaseLogic
$financialInvoice = new FinancialInvoice(); $financialInvoice = new FinancialInvoice();
$financialRefund = new FinancialRefund(); $financialRefund = new FinancialRefund();
$financialSettlement = new FinancialSettlement(); $financialSettlement = new FinancialSettlement();
$total_apply_amount = $marketingContract->statistics_count([], $time, 'sum', ''); $total_apply_amount = $marketingContract->statistics_count([], $time, 'sum', '');
$apply_amount_value = $marketingContract->statistics_count([], $time, 'group', 'create_time'); $apply_amount_value = $marketingContract->statistics_count([], $time, 'group', 'create_time');
$data[] = [ $data[] = [
@ -42,7 +41,7 @@ class ConsultStatisticsLogic extends BaseLogic
]; ];
$contract_ids = $consultProject->column('contract'); $contract_ids = $consultProject->group('contract')->column('contract');
//开票金额 //开票金额
$where[]=['contract_id','in',$contract_ids]; $where[]=['contract_id','in',$contract_ids];
$total_apply_amount = $financialInvoice->ContractFinancialMoney($where, $time, 'sum', '', 'apply_amount'); $total_apply_amount = $financialInvoice->ContractFinancialMoney($where, $time, 'sum', '', 'apply_amount');

View File

@ -81,7 +81,7 @@ class CostProjectStatisticsLogic extends BaseLogic
'value' => $apply_amount_value['y'] ?? 0, 'value' => $apply_amount_value['y'] ?? 0,
'type' => 1, 'type' => 1,
]; ];
$contract_ids = $CostProject->column('contract_id'); $contract_ids = $CostProject->group('contract_id')->column('contract_id');
$where[]=['contract_id','in',$contract_ids]; $where[]=['contract_id','in',$contract_ids];
$total_apply_amount = $financialInvoice->ContractFinancialMoney($where, $time, 'sum', '', 'apply_amount'); $total_apply_amount = $financialInvoice->ContractFinancialMoney($where, $time, 'sum', '', 'apply_amount');

View File

@ -56,7 +56,7 @@ class ManageStatisticsLogic extends BaseLogic
'type' => 1, 'type' => 1,
]; ];
$contract_ids = $consultProject->column('contract'); $contract_ids = $consultProject->group('contract')->column('contract');
//开票金额 //开票金额
$where[]=['contract_id','in',$contract_ids]; $where[]=['contract_id','in',$contract_ids];
$total_apply_amount = $financialInvoice->ContractFinancialMoney($where, $time, 'sum', '', 'apply_amount'); $total_apply_amount = $financialInvoice->ContractFinancialMoney($where, $time, 'sum', '', 'apply_amount');

View File

@ -62,7 +62,8 @@ class SupervisionProjectStatisticsLogic extends BaseLogic
'type' => 1, 'type' => 1,
]; ];
} }
$contract_ids = $supervisionProject->column('contract'); $contract_ids = $supervisionProject->group('contract')->column('contract');
//开票金额 //开票金额
$where[] = ['contract_id', 'in', $contract_ids]; $where[] = ['contract_id', 'in', $contract_ids];
$total_apply_amount = $financialInvoice->ContractFinancialMoney($where, $time, 'sum', '', 'apply_amount'); $total_apply_amount = $financialInvoice->ContractFinancialMoney($where, $time, 'sum', '', 'apply_amount');