function web_CardShowDateForm() { $curmonth = date("m"); $inputs = wf_YearSelector('yearsel'); $inputs .= wf_MonthSelector('monthsel', 'Month', $curmonth, false); $inputs .= wf_Submit('Show'); $form = wf_Form("", 'POST', $inputs, 'glamour'); show_window(__('Date'), $form); }
/** * Renders year-month search interface * * @return void */ function web_CardShowDateForm() { $curmonth = wf_CheckPost(array('monthsel')) ? vf($_POST['monthsel'], 3) : date("m"); $curyear = wf_CheckPost(array('yearsel')) ? vf($_POST['yearsel'], 3) : date("Y"); $inputs = wf_YearSelectorPreset('yearsel', __('Year'), false, $curyear) . ' '; $inputs .= wf_MonthSelector('monthsel', 'Month', $curmonth, false); $inputs .= wf_Submit('Show'); $form = wf_Form("", 'POST', $inputs, 'glamour'); show_window(__('Date'), $form); }
/** * Returns openpayz search form * * @return string */ public function renderSearchForm() { $inputs = wf_YearSelector('searchyear', __('Year'), false) . ' '; $inputs .= wf_MonthSelector('searchmonth', __('Month'), '', false) . ' '; $inputs .= wf_Selector('searchpaysys', $this->allPaySys, __('Payment system'), '', false) . ' '; $inputs .= wf_Submit(__('Search')); $result = wf_Form("", 'POST', $inputs, 'glamour'); return $result; }
/** * Returns year/month selectors form * * @return string */ public function renderCorpsFlowsDateForm() { $allagents = zb_ContrAhentGetAllData(); $tmpArr = array(); $tmpArr[''] = __('Any'); if (!empty($allagents)) { foreach ($allagents as $io => $eachagent) { $tmpArr[$eachagent['id']] = $eachagent['contrname']; } } /** * Again and again we're drowning in this web * Again and again we make the same mistake * Always hunting the same lamb * All we get is the same crap.... */ $inputs = wf_YearSelector('yearsel', __('Year'), false) . ' '; $inputs .= wf_MonthSelector('monthsel', __('Month'), '', false) . ' '; $inputs .= wf_Selector('agentsel', $tmpArr, __('Contrahent name'), '', false); $inputs .= wf_Submit(__('Show')); $result = wf_Form('', 'POST', $inputs, 'glamour'); return $result; }
$lasuseractivity = catv_ActivityGetLastByUser($userid); $lasuseractivitytime = catv_ActivityGetTimeLastByUser($userid); $userdata = catv_UserGetData($userid); $curyear = curyear(); $curmonth = date("m"); $curday = date("d"); $curtime = curtime(); $address = $userdata['street'] . ' ' . $userdata['build'] . '/' . $userdata['apt']; //if creating new activity if (wf_CheckPost(array('newacttime', 'newactday'))) { $customdate = $_POST['newactyear'] . '-' . $_POST['newactmonth'] . '-' . $_POST['newactday'] . ' ' . $_POST['newacttime']; deb($customdate); catv_ActivityCreateCustomDate($userid, $_POST['newactivity'], $customdate); rcms_redirect('?module=catv_useractivity&userid=' . $userid); } //edit form construct $actinputs = ''; $actinputs .= wf_Trigger('newactivity', 'Connected', $lasuseractivity, true) . '<hr>'; $actinputs .= wf_TextInput('newactday', 'Day', $curday, false, '2'); $actinputs .= wf_MonthSelector('newactmonth', 'Month', $curmonth, false); $actinputs .= wf_YearSelector('newactyear', 'Year', true) . '<br>'; $actinputs .= wf_HiddenInput('newacttime', $curtime); $actinputs .= wf_Submit('Change'); $actform = wf_Form('', 'POST', $actinputs, 'glamour'); show_window(__('User activity') . ' ' . $address, $actform); catv_ActivityShowAll($userid); catv_ProfileBack($userid); } } else { show_error(__('You cant control this module')); }
/** * Renders date remains report * * @return string */ public function reportDateRemains() { $result = ''; $curyear = wf_CheckPost(array('yearsel')) ? vf($_POST['yearsel'], 3) : date("Y"); $curmonth = wf_CheckPost(array('monthsel')) ? vf($_POST['monthsel'], 3) : date("m"); $inputs = wf_YearSelector('yearsel', __('Year')) . ' '; $inputs .= wf_MonthSelector('monthsel', __('Month'), $curmonth) . ' '; $inputs .= wf_CheckInput('printmode', __('Print'), false, false); $inputs .= wf_Submit(__('Show')); $searchForm = wf_Form('', 'POST', $inputs, 'glamour'); $searchForm .= wf_CleanDiv(); //append form to result if (!wf_CheckPost(array('printmode'))) { $result .= $searchForm; } $lowerOffset = strtotime($curyear . '-' . $curmonth . '-01'); $upperOffset = strtotime($curyear . '-' . $curmonth . '-01'); $upperOffset = date("t", $upperOffset); $upperOffset = strtotime($curyear . '-' . $curmonth . '-' . $upperOffset); $incomingLower = array(); $outcomingLower = array(); if (!empty($this->allIncoming)) { foreach ($this->allIncoming as $io => $each) { $incomingDate = strtotime($each['date']); if ($incomingDate < $lowerOffset) { if ($each['contractorid'] != 0) { //ignoring move ops $incomingLower[$each['id']] = $each; } } } } if (!empty($this->allOutcoming)) { foreach ($this->allOutcoming as $io => $each) { $outcomingDate = strtotime($each['date']); if ($outcomingDate < $lowerOffset) { if ($each['desttype'] != 'storage') { // ignoring move ops $outcomingLower[$each['id']] = $each; } } } } $lowerIncome = array(); if (!empty($incomingLower)) { foreach ($incomingLower as $io => $each) { if (isset($lowerIncome[$each['itemtypeid']])) { $lowerIncome[$each['itemtypeid']]['count'] = $lowerIncome[$each['itemtypeid']]['count'] + $each['count']; $lowerIncome[$each['itemtypeid']]['price'] = $lowerIncome[$each['itemtypeid']]['price'] + $each['count'] * $each['price']; } else { $lowerIncome[$each['itemtypeid']]['count'] = $each['count']; $lowerIncome[$each['itemtypeid']]['price'] = $each['count'] * $each['price']; } } } $lowerOutcome = array(); if (!empty($outcomingLower)) { foreach ($outcomingLower as $io => $each) { if ($each['price'] == 0) { $each['price'] = $this->getIncomeMiddlePrice($each['itemtypeid']); } if (isset($lowerOutcome[$each['itemtypeid']])) { $lowerOutcome[$each['itemtypeid']]['count'] = $lowerOutcome[$each['itemtypeid']]['count'] + $each['count']; $lowerOutcome[$each['itemtypeid']]['price'] = $lowerOutcome[$each['itemtypeid']]['price'] + $each['count'] * $each['price']; } else { $lowerOutcome[$each['itemtypeid']]['count'] = $each['count']; $lowerOutcome[$each['itemtypeid']]['price'] = $each['count'] * $each['price']; } } } //first report column here $lowerRemains = array(); if (!empty($incomingLower)) { foreach ($incomingLower as $io => $each) { $outcomeCount = isset($lowerOutcome[$each['itemtypeid']]) ? $lowerOutcome[$each['itemtypeid']]['count'] : 0; $outcomePrice = isset($lowerOutcome[$each['itemtypeid']]) ? $lowerOutcome[$each['itemtypeid']]['price'] : 0; $lowerRemains[$each['itemtypeid']]['count'] = $lowerIncome[$each['itemtypeid']]['count'] - $outcomeCount; $lowerRemains[$each['itemtypeid']]['price'] = $lowerIncome[$each['itemtypeid']]['price'] - $outcomePrice; } } //second column $upperIncome = array(); if (!empty($this->allIncoming)) { foreach ($this->allIncoming as $io => $each) { $incomeDate = strtotime($each['date']); if ($incomeDate >= $lowerOffset and $incomeDate <= $upperOffset) { if ($each['contractorid'] != 0) { //ignoring move ops if (isset($upperIncome[$each['itemtypeid']])) { $upperIncome[$each['itemtypeid']]['count'] = $upperIncome[$each['itemtypeid']]['count'] + $each['count']; $upperIncome[$each['itemtypeid']]['price'] = $upperIncome[$each['itemtypeid']]['price'] + $each['count'] * $each['price']; } else { $upperIncome[$each['itemtypeid']]['count'] = $each['count']; $upperIncome[$each['itemtypeid']]['price'] = $each['count'] * $each['price']; } } } } } //third column $upperOutcome = array(); if (!empty($this->allOutcoming)) { foreach ($this->allOutcoming as $io => $each) { $outcomeDate = strtotime($each['date']); if ($outcomeDate >= $lowerOffset and $outcomeDate <= $upperOffset) { if ($each['desttype'] != 'storage') { //ignoring move ops if ($each['price'] == 0) { $each['price'] = $this->getIncomeMiddlePrice($each['itemtypeid']); } if (isset($upperOutcome[$each['itemtypeid']])) { $upperOutcome[$each['itemtypeid']]['count'] = $upperOutcome[$each['itemtypeid']]['count'] + $each['count']; $upperOutcome[$each['itemtypeid']]['price'] = $upperOutcome[$each['itemtypeid']]['price'] + $each['count'] * $each['price']; } else { $upperOutcome[$each['itemtypeid']]['count'] = $each['count']; $upperOutcome[$each['itemtypeid']]['price'] = $each['count'] * $each['price']; } } } } } //mixing earlier non exists items into lower remains array if (!empty($upperIncome)) { foreach ($upperIncome as $io => $each) { if (!isset($lowerRemains[$io])) { $lowerRemains[$io]['count'] = 0; $lowerRemains[$io]['price'] = 0; } } } $result .= $this->reportDateRemainsHeader($curyear, $curmonth); if (!empty($lowerRemains)) { $firstColumnTotal = 0; $secondColumnTotal = 0; $thirdColumnTotal = 0; $fourthColumnTotal = 0; foreach ($lowerRemains as $io => $each) { $itemtypeId = $io; $firstColumnCount = isset($lowerRemains[$itemtypeId]) ? $lowerRemains[$itemtypeId]['count'] : 0; $firstColumnPrice = isset($lowerRemains[$itemtypeId]) ? $lowerRemains[$itemtypeId]['price'] : 0; $secondColumnCount = isset($upperIncome[$itemtypeId]) ? $upperIncome[$itemtypeId]['count'] : 0; $secondColumnPrice = isset($upperIncome[$itemtypeId]) ? $upperIncome[$itemtypeId]['price'] : 0; $thirdColumnCount = isset($upperOutcome[$itemtypeId]) ? $upperOutcome[$itemtypeId]['count'] : 0; $thirdColumnPrice = isset($upperOutcome[$itemtypeId]) ? $upperOutcome[$itemtypeId]['price'] : 0; $fourthColumnCount = $lowerRemains[$itemtypeId]['count'] + $secondColumnCount - $thirdColumnCount; $fourthColumnPrice = $lowerRemains[$itemtypeId]['price'] + $secondColumnPrice - $thirdColumnPrice; $result .= $this->reportDateRemainsAddRow($itemtypeId, array($firstColumnCount, round($firstColumnPrice, 2), $secondColumnCount, round($secondColumnPrice, 2), $thirdColumnCount, round($thirdColumnPrice, 2), $fourthColumnCount, round($fourthColumnPrice, 2))); $firstColumnTotal += $firstColumnPrice; $secondColumnTotal += $secondColumnPrice; $thirdColumnTotal += $thirdColumnPrice; $fourthColumnTotal += $firstColumnPrice; } $result .= $this->reportDateRemainsAddRow('', array('', $firstColumnTotal, '', $secondColumnTotal, '', $thirdColumnTotal, '', $fourthColumnTotal)); } $result .= wf_tag('tbody', true); $result .= wf_tag('table', true); if (wf_CheckPost(array('printmode'))) { die($this->reportPrintable(__('Date remains'), $result)); } return $result; }
/** * Returns * * @return string */ public function timesheetRenderPrintableForm() { $result = ''; $inputs = wf_YearSelector('tsheetprintyear', __('Year') . ' ', false); $inputs .= wf_MonthSelector('tsheetprintmonth', __('Month') . ' ', date('m'), false); $inputs .= wf_Submit(__('Show')); $result = wf_Form('', 'POST', $inputs, 'glamour'); return $result; }
/** * Renders default subscriptions report * * @return string */ public function renderSubscribtionsReportMonthly() { $result = ''; $selectedMonth = wf_CheckPost(array('monthsel')) ? $_POST['monthsel'] : date("m"); $inputs = wf_YearSelector('yearsel', __('Year'), false) . ' '; $inputs .= wf_MonthSelector('monthsel', __('Month'), $selectedMonth, false) . ' '; $inputs .= wf_Submit(__('Show')); $result .= wf_Form('', 'POST', $inputs, 'glamour'); $curYear = wf_CheckPost(array('yearsel')) ? vf($_POST['yearsel'], 3) : curyear(); $curMonth = wf_CheckPost(array('monthsel')) ? vf($_POST['monthsel'], 3) : date("m"); $query = "SELECT * from `payments` WHERE `date` LIKE '" . $curYear . "-" . $curMonth . "%' AND `note` LIKE 'MEGOGO:%';"; $raw = simple_queryall($query); $tmpArr = array(); if (!empty($raw)) { foreach ($raw as $io => $each) { $tariffId = explode(':', $each['note']); $tariffId = $tariffId[1]; if (isset($tmpArr[$tariffId])) { $tmpArr[$tariffId]['summ'] = $tmpArr[$tariffId]['summ'] + abs($each['summ']); $tmpArr[$tariffId]['count']++; //try&buy user if ($each['summ'] == 0) { $tmpArr[$tariffId]['freeperiod']++; } } else { $tmpArr[$tariffId]['summ'] = abs($each['summ']); $tmpArr[$tariffId]['count'] = 1; //try&buy user if ($each['summ'] == 0) { $tmpArr[$tariffId]['freeperiod'] = 1; } else { $tmpArr[$tariffId]['freeperiod'] = 0; } } } } if (!empty($tmpArr)) { $cells = wf_TableCell(__('Tariff')); $cells .= wf_TableCell(__('Fee')); $cells .= wf_TableCell(__('Users')); $cells .= wf_TableCell(__('Free period')); $cells .= wf_TableCell(__('Total payments')); $cells .= wf_TableCell(__('Profit')); $rows = wf_TableRow($cells, 'row1'); $totalUsers = 0; $totalFree = 0; $totalSumm = 0; foreach ($tmpArr as $io => $each) { $totalUsers = $totalUsers + $each['count']; $totalFree = $totalFree + $each['freeperiod']; $totalSumm = $totalSumm + $each['summ']; $cells = wf_TableCell(@$this->allTariffs[$io]['name']); $cells .= wf_TableCell(@$this->allTariffs[$io]['fee']); $cells .= wf_TableCell($each['count']); $cells .= wf_TableCell($each['freeperiod']); $cells .= wf_TableCell($each['summ']); $cells .= wf_TableCell(zb_Percent($each['summ'], $this->altCfg['MG_PERCENT'])); $rows .= wf_TableRow($cells, 'row3'); } $cells = wf_TableCell(wf_tag('b') . __('Total') . wf_tag('b', true)); $cells .= wf_TableCell(''); $cells .= wf_TableCell($totalUsers); $cells .= wf_TableCell($totalFree); $cells .= wf_TableCell($totalSumm); $cells .= wf_TableCell(zb_Percent($totalSumm, $this->altCfg['MG_PERCENT'])); $rows .= wf_TableRow($cells, 'row2'); $result .= wf_TableBody($rows, '100%', 0, ''); } else { $result .= $this->messages->getStyledMessage(__('Nothing found'), 'info'); } return $result; }
/** * Returns openpayz search form * * @return string */ public function renderSearchForm() { $curYear = wf_CheckPost(array('searchyear')) ? vf($_POST['searchyear'], 3) : date("Y"); $curMonth = wf_CheckPost(array('searchmonth')) ? vf($_POST['searchmonth'], 3) : date("m"); $curPaysys = wf_CheckPost(array('searchpaysys')) ? vf($_POST['searchpaysys']) : ''; /** * No lights, no sights, every fright, every night * Alone, hurt and cold, she‘s shackled to the pipes */ $paySysSelector['ANY'] = __('All'); $paySysSelector += $this->allPaySys; $inputs = wf_YearSelectorPreset('searchyear', __('Year'), false, $curYear) . ' '; $inputs .= wf_MonthSelector('searchmonth', __('Month'), $curMonth, false) . ' '; $inputs .= wf_Selector('searchpaysys', $paySysSelector, __('Payment system'), $curPaysys, false) . ' '; $inputs .= wf_Submit(__('Search')); $result = wf_Form("", 'POST', $inputs, 'glamour'); return $result; }
show_window(__('Error'), __('This month has already been assessed fee')); } } // tariff change subroutine if (wf_CheckPost(array('newtarchange'))) { catv_TariffChangeAllPlanned(); rcms_redirect("?module=catv&action=fees"); } //construct tariff change form $tarchangeinputs = wf_HiddenInput('newtarchange', 'true'); $tarchangeinputs .= wf_Submit('Change tariff for all users'); $tarform = wf_Form('', 'POST', $tarchangeinputs, 'glamour', ''); show_window(__('Check out the planned tariff changes'), $tarform); //construct charge form $feeinputs = wf_HiddenInput('newcharge', 'true'); $feeinputs .= wf_MonthSelector('chargemonthfee', 'Month', date("m"), false); $feeinputs .= wf_YearSelector('chargeyear', 'Year', false) . ' '; $feeinputs .= wf_Submit(__('Manual fee charge')); $feeform = wf_Form('', 'POST', $feeinputs, 'glamour', ''); show_window(__('Сharge monthly fee'), $feeform); } //reports list if ($_GET['action'] == 'reports') { if (!isset($_GET['showreport'])) { // show available reports list catv_ReportsShowList(); } else { // current debtors if ($_GET['showreport'] == 'current_debtors') { catv_ReportDebtors(); }