| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- <?php
- if (!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
- if (!defined('APP_PATH_ROOT')) define('APP_PATH_ROOT', realpath(dirname(__FILE__) . '/../'));
- if (!defined('APP_PATH_WWW')) define('APP_PATH_WWW', realpath(dirname(__FILE__) . '/../'));
- if (!defined('APP_PATH_CONFIG')) define('APP_PATH_CONFIG', APP_PATH_ROOT . DS . 'config');
- function IN7_DZIENNIK_KORESP() {
- global $thiss;
- // init columns if not set
- if (empty($_SESSION['IN7_DZIENNIK_KORESP_COLUMN']['ID'])) {
- SEF('USERS_COLUMN_INIT2');
- USERS_COLUMN_INIT2('IN7_DZIENNIK_KORESP', '', 'N');
- }
- require_once APP_PATH_ROOT . '/' . 'se-lib' . '/' . 'Lib.php';
- Lib::loadClass('V');
- Lib::loadClass('DB');
- $params = array();
- $params['toolbar'] = array();
- $params['toolbar'] []= '<a href="' . "?MENU_INIT=IN7_DZIENNIK_KORESP" . "&ARG1=OUTBOX" . '" title="' . "Ksiazka nadawcza" . '">' . "Ksiazka nadawcza" . '</a>';
- // router
- global $ARG1, $ARG1_VAL;
- switch ($ARG1) {
- case 'OUTBOX':
- IN7_DZIENNIK_KORESP_OUTBOX();
- break;
- default:
- SEF('WIEVTABLE');
- WIEVTABLE($params);
- }
- }
- class Koresp_Outbox_View {
- function css() {
- echo '<style type="text/css">' . "
- .tbl-view th,
- .tbl-view td {padding:0 1px;font-size:11px;border-color:#000;}
- .tbl-view-koresp {page-break-after:always;}
- " . '</style>';
- }
- function page($koresp) {
- echo '<p style="text-align:right">' . "Za³±cznik nr ........................" . '</p>';
- echo '<p style="text-align:left">' . "Imiê i nazwisko (nazwa) oraz adres nadawcy ..........................................................................." . '</p>';
- echo '<table cellspacing="0" cellpadding="0" border="1" class="tbl-view tbl-view-koresp">';
- echo '<thead>';
- echo '<tr>';
- echo '<th rowspan="2">' . "Lp." . '</th>';
- echo '<th rowspan="2">' . "A D R E S A T<br />(imiê i nazwisko lub nazwa)" . '</th>';
- echo '<th rowspan="2">' . "Dok³adne miejsce dorêczenia" . '</th>';
- echo '<th colspan="2">' . "Warto¶æ<br />Kwota" . '</th>';
- echo '<th colspan="2">' . "Masa" . '</th>';
- echo '<th rowspan="2">' . "Nr nadawczy" . '</th>';
- echo '<th rowspan="2">' . "Uwagi" . '</th>';
- echo '<th colspan="2">' . "Op³ata" . '</th>';
- echo '<th colspan="2">' . "Kwota<br />pobraniowa" . '</th>';
- echo '<th colspan="2">' . "Op³ata za<br />pobranie" . '</th>';
- echo '</tr>';
- echo '<tr>';
- echo '<th>' . "z³" . '</th>';
- echo '<th>' . "gr" . '</th>';
- echo '<th>' . "kg" . '</th>';
- echo '<th>' . "g" . '</th>';
- echo '<th>' . "z³" . '</th>';
- echo '<th>' . "gr" . '</th>';
- echo '<th>' . "z³" . '</th>';
- echo '<th>' . "gr" . '</th>';
- echo '<th>' . "z³" . '</th>';
- echo '<th>' . "gr" . '</th>';
- echo '</tr>';
- echo '<tr>';
- echo '<th>' . "1" . '</th>';
- echo '<th>' . "2" . '</th>';
- echo '<th>' . "3" . '</th>';
- echo '<th colspan="2">' . "4" . '</th>';
- echo '<th colspan="2">' . "5" . '</th>';
- echo '<th>' . "6" . '</th>';
- echo '<th>' . "7" . '</th>';
- echo '<th colspan="2">' . "8" . '</th>';
- echo '<th colspan="2">' . "9" . '</th>';
- echo '<th colspan="2">' . "10" . '</th>';
- echo '</tr>';
- echo '<tr>';
- echo '<th colspan="3" style="padding:0 20px;text-align:right;">' . "Z przeniesienia" . '</th>';
- echo '<th>' . "" . '</th>';
- echo '<th>' . "" . '</th>';
- echo '<th colspan="3" style="text-align:right;">' . "Z przeniesienia" . '</th>';
- echo '<th>' . "" . '</th>';
- echo '<th>' . "" . '</th>';
- echo '<th>' . "" . '</th>';
- echo '<th>' . "" . '</th>';
- echo '<th>' . "" . '</th>';
- echo '<th>' . "" . '</th>';
- echo '<th>' . "" . '</th>';
- echo '</tr>';
- echo '</thead>';
- echo '<tfoot>';
- echo '<tr>';
- echo '<td colspan="3" style="border:none;padding:0 20px 0 0;text-align:right;">' . "Do przeniesienia" . '</td>';
- echo '<td>' . "" . '</td>';
- echo '<td>' . "" . '</td>';
- echo '<td colspan="4" style="border:none">' . "" . '</td>';
- echo '<td>' . "" . '</td>';
- echo '<td>' . "" . '</td>';
- echo '<td colspan="2" style="border:none">' . "" . '</td>';
- echo '<td>' . "" . '</td>';
- echo '<td>' . "" . '</td>';
- echo '</tr>';
- echo '</tfoot>';
- echo '<tbody>';
- foreach ($koresp as $r) {
- echo '<tr>';
- echo '<td>' . "" . '</td>';
- echo '<td>' . $r->K_OD_KOGO . '</td>';
- echo '<td>' . $r->OD_KOGO_ADRES . '</td>';
- echo '<td>' . "" . '</td>';
- echo '<td>' . "" . '</td>';
- echo '<td>' . "" . '</td>';
- echo '<td>' . "" . '</td>';
- echo '<td>' . $r->ID . '</td>';
- echo '<td>' . "" . '</td>';
- echo '<td>' . "" . '</td>';
- echo '<td>' . "" . '</td>';
- echo '<td>' . "" . '</td>';
- echo '<td>' . "" . '</td>';
- echo '<td>' . "" . '</td>';
- echo '<td>' . "" . '</td>';
- echo '</tr>';
- }
- echo '</tbody>';
- echo '</table>';
- }
-
- }
- function IN7_DZIENNIK_KORESP_OUTBOX() {
- $page_limit = 20;
- $db = DB::getDB();
- $koresp = array();
- $sql = "select
- `ID`
- , `K_OD_KOGO`
- , `OD_KOGO_ADRES`
- from `IN7_DZIENNIK_KORESP` as t
- where t.`A_STATUS`='NORMAL'
- and t.`K_TYP_KORESP`='OUT'
- and t.`K_TYP_RODZAJ` in('POLECONY', 'POLECONY PRIORYTET')
- ";
- $res = $db->query($sql);
- while ($r = $db->fetch($res)) {
- $koresp []= $r;
- }
- if (empty($koresp)) {
- echo '<p>' . "Brak danych." . '</p>';
- return;
- }
- // split table by $page_limit
- $koresp_pages = array();
- $page_nr = 0;
- $page_cur_nr = 0;
- foreach ($koresp as $r) {
- $koresp_pages[$page_nr] []= $r;
- $page_cur_nr++;
- if ($page_cur_nr >= $page_limit) {
- $page_nr++;
- $page_cur_nr = 0;
- }
- }
- Koresp_Outbox_View::css();
- foreach ($koresp_pages as $koresp_page) {
- Koresp_Outbox_View::page($koresp_page);
- }
- }
|