$allUsers=zb_UserGetAllDataCache(); $allTariffs=zb_TariffGetAllData(); $result=''; $monthDebtLimit=ubRouting::checkPost('monthdebtlimit') ? ubRouting::post('monthdebtlimit', 'int') : 6; $inputs=wf_TextInput('monthdebtlimit', __('Month'), $monthDebtLimit, false, '3', 'digits'); $inputs.=wf_Submit(__('Show')); $form=wf_Form('', 'POST', $inputs, 'glamour'); show_window(__(''),$form); $debtors=array(); if (!empty($allUsers) and !empty($allTariffs)) { foreach ($allUsers as $userLogin=>$userData) { $login=$userLogin; $tariff=$userData['Tariff']; if (isset($allTariffs[$tariff])) { $tariffData=$allTariffs[$tariff]; $tariffName=$tariffData['name']; $tariffFee=$tariffData['Fee']; $tariffPeriod=$tariffData['period']; $monthFee=$tariffFee; if ($tariffPeriod=='day') { $monthFee=$tariffFee*30; } $maxDebt=$monthFee*$monthDebtLimit; if ($monthFee>0 and $userData['Cash']<=('-'.$maxDebt)) { $debtors[$login]=$userData['login']; } } } $result=web_UserArrayShower($debtors); show_window(__('Debtors').' > '.$monthDebtLimit.' '.__('month'),$result); } else { show_error('No users or tariffs found'); }