Esempio n. 1
0
        if (preg_match('~(?:СБР|БС)-(\\d+)-[ТАПБ]/О~', $historyItem['comments'], $m)) {
            if ((int) $m[1]) {
                $sbrIds[] = (int) $m[1];
                $historyItem['sbrId'] = (int) $m[1];
                $nSbr++;
            }
        }
    }
}
unset($historyItem);
if ($nSbr) {
    $sbrSchemes = sbr_meta::getShemesSbr($sbrIds);
    if ($sbrSchemes) {
        foreach ($history['items'] as &$historyItem) {
            if ((int) $historyItem["sbrId"]) {
                $historyItem['comments'] = sbr_meta::parseOpComment($historyItem['comments'], null, null, $sbrSchemes[$historyItem["sbrId"]]);
            }
        }
    }
}
unset($historyItem);
// делаем уведомления прочитанными
$barNotify = new bar_notify($_SESSION['uid']);
$barNotify->delNotifies(array('page' => 'bill'));
if ($page > 1 && $page > $history['pagesCount']) {
    header_location_exit('/404.php');
}
$events = account::searchBillEvent($startTime ? $startTime : '2000-01-01', time());
$js_file = array('billing.js');
$is_jury = sbr_meta::isFtJuri($uid);
$is_emp = is_emp();
Esempio n. 2
0
 /**
  * Вывод страницы /history/ - "история счета".
  */
 public function historyAction()
 {
     front::og('tpl')->page = 'history';
     front::og('tpl')->my_uid = get_uid();
     front::og('tpl')->caltype = 2;
     // Типа нажатия кнопки календаря (Дата=1, Интервал дат=2)
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sbr.php';
     /**
      * Подгружаем класс для работы с AJAX.
      */
     require_once $_SERVER['DOCUMENT_ROOT'] . '/xajax/bill.common.php';
     front::og('tpl')->xajax = $xajax;
     // переменные для фильтров
     $v0 = intval($this->uri[0]);
     // страница
     $v1 = intval($this->uri[1]);
     // Переменная для сортировки по столбцам
     $v2 = (string) $this->uri[2];
     // Сортировка по дате
     $v3 = (string) $this->uri[3];
     // Прочие сортировки
     // сброс страницы при смене сортировки
     if (!isset($_SESSION['v3_sorting_key']) || $_SESSION['v3_sorting_key'] != $v3) {
         $_SESSION['v3_sorting_key'] = $v3;
         $v0 = 1;
     }
     front::og('tpl')->v1 = $v1;
     front::og('tpl')->v2 = htmlspecialchars($v2);
     front::og('tpl')->v3 = htmlspecialchars($v3);
     $month = date('m');
     // текущий месяц
     $sday = mktime(0, 0, 0, date('m'), 1, date('Y'));
     $eday = mktime(23, 59, 59, date('m'), date('t'), date('Y'));
     front::og('tpl')->date_input = '01.' . date('m.y') . ' - ' . date('t') . '.' . date('m.y');
     // Обработка фильтров
     if ($v2 != '') {
         if (strlen($v2) == 8) {
             front::og('tpl')->is_calendar = true;
             $day = intval(substr($v2, 0, 2));
             $month = intval(substr($v2, 2, 2));
             $year = intval(substr($v2, 4, 6));
             $day = $day < 10 ? '0' . $day : $day;
             $month = $month < 10 ? '0' . $month : $month;
             $sday = mktime(0, 0, 0, $month, $day, $year);
             $eday = mktime(23, 59, 59, $month, $day, $year);
             front::og('tpl')->month = $month;
             front::og('tpl')->monthDay = date('t', $sday);
             front::og('tpl')->year = $year;
             front::og('tpl')->date_input = $day . '.' . $month . '.' . $year;
             front::og('tpl')->caltype = 1;
         } elseif (strlen($v2) == 6) {
             front::og('tpl')->is_calendar = true;
             $month = intval(substr($v2, 0, 2));
             $year = intval(substr($v2, 2, 4));
             $month = $month < 10 ? '0' . $month : $month;
             $sday = mktime(0, 0, 0, $month, 1, $year);
             $eday = mktime(23, 59, 59, $month, date('t', $sday), $year);
             front::og('tpl')->month = $month;
             front::og('tpl')->monthDay = date('t', $sday);
             front::og('tpl')->year = $year;
             front::og('tpl')->date_input = '01.' . $month . '.' . substr($year, 2, 2) . ' - ' . date('t', $sday) . '.' . $month . '.' . substr($year, 2, 2);
             front::og('tpl')->caltype = 1;
         } elseif (strpos($v2, '-') == 6) {
             front::og('tpl')->is_calendar = true;
             $e = explode('-', $v2);
             $fday = intval(substr($e[0], 0, 2));
             $fmonth = intval(substr($e[0], 2, 2));
             $fyear = intval(substr($e[0], 4, 2));
             $tday = intval(substr($e[1], 0, 2));
             $tmonth = intval(substr($e[1], 2, 2));
             $tyear = intval(substr($e[1], 4, 2));
             $fday = $fday < 10 ? '0' . $fday : $fday;
             $tday = $tday < 10 ? '0' . $tday : $tday;
             $fmonth = $fmonth < 10 ? '0' . $fmonth : $fmonth;
             $tmonth = $tmonth < 10 ? '0' . $tmonth : $tmonth;
             front::og('tpl')->from_day = $fday;
             front::og('tpl')->from_month = $fmonth;
             front::og('tpl')->from_year = $fyear;
             front::og('tpl')->to_day = $tday;
             front::og('tpl')->to_month = $tmonth;
             front::og('tpl')->to_year = $tyear;
             $sday = mktime(0, 0, 0, $fmonth, $fday, $fyear);
             $eday = mktime(23, 59, 59, $tmonth, $tday, $tyear);
             front::og('tpl')->month = date('m');
             front::og('tpl')->monthDay = date('t');
             front::og('tpl')->year = date('Y');
             if (date('Y', $eday) == date('Y')) {
                 front::og('tpl')->date_input = date('d.m', $sday) . date('.y', $sday) . ' - ' . date('d.m', $eday) . date('.y', $eday);
             } else {
                 front::og('tpl')->date_input = date('d.m', $sday) . date('.y', $sday) . ' - ' . date('d.m', $eday) . date('.y', $eday);
                 //$fday.".".$fmonth.($fyear!=date('Y')?".".$fyear:"")." - ".$tday.".".$tmonth.($tyear!=date('Y')?".".$tyear:"");
             }
             front::og('tpl')->caltype = 2;
         }
     } else {
         front::og('tpl')->v2 = date('mY');
     }
     $type = false;
     // Дополнительная переменная для фильтровки результатов
     if ($v3 != '') {
         $case = substr($v3, 0, 1);
         switch ($case) {
             case 'p':
                 // Ввод средств
                 $type = ' AND ammount > 0';
                 break;
             case 'm':
                 // Вывод средств
                 $type = ' AND ammount < 0';
                 break;
             case 'f':
                 // Определенные значения ввода вывода средств
                 $ammount = round(substr($v3, 1, strlen($v3) - 1), 2);
                 $type = ' AND ammount = ' . $ammount;
                 front::og('tpl')->f = $ammount;
                 break;
             case 'e':
                 // Фильтр по событиям
                 $op_code = intval(substr($v3, 1, strlen($v3) - 1));
                 $opcode = $op_code;
                 if ($op_code == 0) {
                     break;
                 }
                 if ($op_code == 77) {
                     $op_code = '36,77';
                 }
                 if ($op_code == 78) {
                     $op_code = '37,78';
                 }
                 if ($op_code == 79) {
                     $op_code = '38,79';
                 }
                 $type = ' AND op_code IN (' . $op_code . ')';
                 front::og('tpl')->opselect = $opcode;
                 break;
                 /*case "i":
                 		$page = intval(substr($v3, 1, strlen($v3)-1));
                 		break;	*/
             /*case "i":
             		$page = intval(substr($v3, 1, strlen($v3)-1));
             		break;	*/
             case 'a':
                 // По умолчанию
             // По умолчанию
             default:
                 $type = false;
                 break;
         }
     }
     $page = $v0;
     if ($page <= 0) {
         $page = 1;
     }
     if (strlen($page) > 6) {
         header('Location: /404.php');
         exit;
     }
     front::og('tpl')->sort = $v1 == 0 ? $v1 + 1 : $v1;
     // Сортировка по столбцам
     if (!isset($_COOKIE['bill_history_pp'])) {
         setcookie('bill_history_pp', 20, time() + 24 * 60 * 60 * 1000, '/');
         $perpage = 20;
     } else {
         $perpage = (int) $_COOKIE['bill_history_pp'];
     }
     $history = $this->account->searchBillHistory($sday, $eday, $v1, $type, $page, $pages, $total, $perpage);
     // Берем историю по конкретному промежутку времени
     //Идентификаторы СБР для получения признака новая или старая
     $sbrIds = array();
     $nSbr = 0;
     foreach ($history as $key => $val) {
         if (in_array($val['op_code'], array(sbr::OP_RESERVE, sbr::OP_DEBIT, sbr::OP_CREDIT))) {
             if (preg_match('~СБР-(\\d+)-[ТАПБ]/О~', $val['comments'], $m)) {
                 if ((int) $m[1]) {
                     $sbrIds[] = (int) $m[1];
                     $history[$key]['sbrId'] = (int) $m[1];
                     ++$nSbr;
                 }
             }
             //$comments = sbr_meta::parseOpComment($comments);
         }
     }
     if ($nSbr) {
         $sbrSchemes = sbr_meta::getShemesSbr($sbrIds);
         if ($sbrSchemes) {
             foreach ($history as $key => $val) {
                 if ((int) $val['sbrId']) {
                     $val['comments'] = sbr_meta::parseOpComment($val['comments'], null, null, $sbrSchemes[$val['sbrId']]);
                     $history[$key] = $val;
                 }
             }
         }
     }
     front::og('tpl')->per_page = $perpage;
     front::og('tpl')->page_h = $page;
     front::og('tpl')->pages_h = $pages;
     front::og('tpl')->total_h = $total;
     //    	echo $pages." - ".$total;
     /*
      * Тестовый функционал.
      */
     if ($history) {
         $acc = null;
         foreach ($history as $k => &$v) {
             if ($v['op_code'] == 23) {
                 $exec[$v['id']] = $v['id'];
             }
             if ($v['op_code'] == 12 && !trim($v['comments'])) {
                 $v['comments'] = 'Пополнение счета через ' . account::GetPSName($v['payment_sys']);
             }
         }
     }
     front::og('tpl')->total_fm = $this->account->getSumAmmountSpentService(get_uid(false));
     //$o_mny;
     front::og('tpl')->history = $history;
     front::og('tpl')->exec = @$exec;
     front::og('tpl')->event = $this->account->searchBillEvent($sday, $eday);
     // Имена событий использующие в данном промежутке времени
     front::og('tpl')->calendar = $this->account->getDateBillOperation($month, false, false, $year);
     front::og('tpl')->display('bill/bill_history.tpl');
 }
Esempio n. 3
0
	<td colspan="6" class="small">&nbsp;</td>
</tr>
<tr>
	<td width="100">№</td>
    <td width="120">Дата</td>
    <td width="80">Баланс</td>
    <td width="80">Сумма</td>
    <td width="220">Событие</td>
    <td>Комментарии</td>
</tr>
<?php 
    foreach ($history as $ikey => $hist) {
        $comments = $hist['comments'];
        if (in_array($hist['op_code'], array(sbr::OP_RESERVE, sbr::OP_DEBIT, sbr::OP_CREDIT))) {
            $scheme = strtotime($hist['op_date']) > mktime(0, 0, 0, 11, 1, 2012) ? sbr::SCHEME_LC : sbr::SCHEME_AGNT;
            $comments = sbr_meta::parseOpComment($comments, $user->login, is_emp($user->role), $scheme);
        }
        ?>
<tr class="small" valign="baseline">
	<td><a name="<?php 
        echo $hist['id'];
        ?>
"></a><?php 
        echo $hist['id'];
        ?>
</td>
	<td><?php 
        echo date("d.m.Y | H:i", strtotimeEx($hist['op_date']));
        ?>
</td>
    <td><?php