/** * Returns users finance operations history * * @param string $customerId * * @return array */ protected function getUserFinanceHistory($customerId) { $result = array(); if (isset($this->allUserData[$customerId])) { $allServices = zb_VservicesGetAllNamesLabeled(); $fundsFlow = new FundsFlow(); $allfees = $fundsFlow->getFees($customerId); $allpayments = $fundsFlow->getPayments($customerId); $allcorrectings = $fundsFlow->getPaymentsCorr($customerId); $allOps = $allfees + $allpayments + $allcorrectings; $allOps = $fundsFlow->transformArray($allOps); $i = 0; if (!empty($allOps)) { foreach ($allOps as $io => $each) { // print_r($each); $result[] = array('id' => $i, 'date' => $each['date'], 'type' => 'financial', 'name' => __($each['operation']), 'data' => json_encode(array('amount' => $each['summ'], 'from' => $each['from'], 'to' => $each['to'], 'operator_name' => $each['admin'])), 'comment' => zb_TranslatePaymentNote($each['note'], $allServices)); $i++; } } } else { $result = array('result' => 'error', 'error' => $this->errorNotices['EX_USER_NOT_EXISTS'] . ': ' . $customerId); } return $result; }
<?php if (cfr('PLFUNDS')) { if (isset($_GET['username'])) { $login = $_GET['username']; $funds = new FundsFlow(); show_window('', $funds->getOnlineLeftCount($login)); $allfees = $funds->getFees($login); $allpayments = $funds->getPayments($login); $allcorrectings = $funds->getPaymentsCorr($login); $fundsflow = $allfees + $allpayments + $allcorrectings; $fundsflow = $funds->transformArray($fundsflow); show_window(__('Funds flow'), $funds->renderArray($fundsflow)); show_window('', web_UserControls($login)); } } else { show_error(__('You cant control this module')); }
$date = $needYear . '-' . $needMonth . '-'; if (!empty($corpUsers)) { $rows = $funds->renderCorpsFlowsHeaders($needYear, $needMonth); //contragent filter if (wf_CheckPost(array('agentsel'))) { $agentFilter = $_POST['agentsel']; $allassigns = zb_AgentAssignGetAllData(); $allassignsStrict = zb_AgentAssignStrictGetAllData(); $alladdress = zb_AddressGetFulladdresslistCached(); } else { $agentFilter = ''; } foreach ($corpUsers as $eachlogin => $eachcorpid) { $count++; $fees = $funds->getFees($eachlogin); $payments = $funds->getPayments($eachlogin); $paymentscorr = $funds->getPaymentsCorr($eachlogin); $fundsflow = $fees + $payments + $paymentscorr; $dateFunds = $funds->filterByDate($fundsflow, $date); if (!$agentFilter) { $rows .= $funds->renderCorpsFlows($count, $dateFunds, $corpsData, $corpUsers, $allUserContracts, $allUsersCash, $allUserTariffs, $allTariffPrices); } else { @($userAddress = $alladdress[$eachlogin]); $assigned_agent = zb_AgentAssignCheckLoginFast($eachlogin, $allassigns, $userAddress, $allassignsStrict); if ($assigned_agent == $agentFilter) { $rows .= $funds->renderCorpsFlows($count, $dateFunds, $corpsData, $corpUsers, $allUserContracts, $allUsersCash, $allUserTariffs, $allTariffPrices); } } } $rows .= $funds->renderCorpsFlowsTotal(); $report = wf_TableBody($rows, '100%', 0, '');