public function actionMonthCredit() { $form = new MonthSearchForm(); $years = DateUtil::getYears(); $monthes = DateUtil::getMonthes(); $query = new Account(); $accounts = $query->findFormListArray(['type_id' => 2], -1, '余额'); $query = new CreditAccount(); if (Yii::$app->request->isPost) { $form->load(Yii::$app->request->post()); $rel['credit'] = $query->findMonthCreditInfo($form); $ym = $form['ym']; } else { $rel['credit'] = $query->findMonthCreditInfo(); $ym = DateUtil::getCurrentMonth('ch'); } return $this->render('month/creditDetail', ['model' => $form, 'years' => $years, 'monthes' => $monthes, 'accounts' => $accounts, 'rel' => $rel, 'ym' => $ym]); }
protected function insertFeeRecord($form, $io_type) { $form['io_type'] = $io_type; $accountRecordsearch = new AccountRecord(); $accountRecordsearch->loadForm($form); $accountRecordsearch['money'] = isset($form['stage_number']) ? $form['stage_number'] * $form['fee_per_stage'] : 0; $creditAccoutnsearch = new CreditAccount(); $accountRecordsearch['in_account_id'] = $creditAccoutnsearch->findFinanceId($accountRecordsearch['out_account_id']); if ($accountRecordsearch['money'] > 0) { if ($accountRecordsearch->save()) { return $accountRecordsearch['id']; } else { return false; } } else { return 0; } }