superedit-IN7_DZIENNIK_KORESP.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <?php
  2. if (!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
  3. if (!defined('APP_PATH_ROOT')) define('APP_PATH_ROOT', realpath(dirname(__FILE__) . '/../'));
  4. if (!defined('APP_PATH_WWW')) define('APP_PATH_WWW', realpath(dirname(__FILE__) . '/../'));
  5. if (!defined('APP_PATH_CONFIG')) define('APP_PATH_CONFIG', APP_PATH_ROOT . DS . 'config');
  6. function IN7_DZIENNIK_KORESP() {
  7. global $thiss;
  8. // init columns if not set
  9. if (empty($_SESSION['IN7_DZIENNIK_KORESP_COLUMN']['ID'])) {
  10. SEF('USERS_COLUMN_INIT2');
  11. USERS_COLUMN_INIT2('IN7_DZIENNIK_KORESP', '', 'N');
  12. }
  13. require_once APP_PATH_ROOT . '/' . 'se-lib' . '/' . 'Lib.php';
  14. Lib::loadClass('V');
  15. Lib::loadClass('DB');
  16. $params = array();
  17. $params['toolbar'] = array();
  18. $params['toolbar'] []= '<a href="' . "?MENU_INIT=IN7_DZIENNIK_KORESP" . "&ARG1=OUTBOX" . '" title="' . "Ksiazka nadawcza" . '">' . "Ksiazka nadawcza" . '</a>';
  19. // router
  20. global $ARG1, $ARG1_VAL;
  21. switch ($ARG1) {
  22. case 'OUTBOX':
  23. IN7_DZIENNIK_KORESP_OUTBOX();
  24. break;
  25. default:
  26. SEF('WIEVTABLE');
  27. WIEVTABLE($params);
  28. }
  29. }
  30. class Koresp_Outbox_View {
  31. function css() {
  32. echo '<style type="text/css">' . "
  33. .tbl-view th,
  34. .tbl-view td {padding:0 1px;font-size:11px;border-color:#000;}
  35. .tbl-view-koresp {page-break-after:always;}
  36. " . '</style>';
  37. }
  38. function page($koresp) {
  39. echo '<p style="text-align:right">' . "Za³±cznik nr ........................" . '</p>';
  40. echo '<p style="text-align:left">' . "Imiê i nazwisko (nazwa) oraz adres nadawcy ..........................................................................." . '</p>';
  41. echo '<table cellspacing="0" cellpadding="0" border="1" class="tbl-view tbl-view-koresp">';
  42. echo '<thead>';
  43. echo '<tr>';
  44. echo '<th rowspan="2">' . "Lp." . '</th>';
  45. echo '<th rowspan="2">' . "A D R E S A T<br />(imiê i nazwisko lub nazwa)" . '</th>';
  46. echo '<th rowspan="2">' . "Dok³adne miejsce dorêczenia" . '</th>';
  47. echo '<th colspan="2">' . "Warto¶æ<br />Kwota" . '</th>';
  48. echo '<th colspan="2">' . "Masa" . '</th>';
  49. echo '<th rowspan="2">' . "Nr nadawczy" . '</th>';
  50. echo '<th rowspan="2">' . "Uwagi" . '</th>';
  51. echo '<th colspan="2">' . "Op³ata" . '</th>';
  52. echo '<th colspan="2">' . "Kwota<br />pobraniowa" . '</th>';
  53. echo '<th colspan="2">' . "Op³ata za<br />pobranie" . '</th>';
  54. echo '</tr>';
  55. echo '<tr>';
  56. echo '<th>' . "z³" . '</th>';
  57. echo '<th>' . "gr" . '</th>';
  58. echo '<th>' . "kg" . '</th>';
  59. echo '<th>' . "g" . '</th>';
  60. echo '<th>' . "z³" . '</th>';
  61. echo '<th>' . "gr" . '</th>';
  62. echo '<th>' . "z³" . '</th>';
  63. echo '<th>' . "gr" . '</th>';
  64. echo '<th>' . "z³" . '</th>';
  65. echo '<th>' . "gr" . '</th>';
  66. echo '</tr>';
  67. echo '<tr>';
  68. echo '<th>' . "1" . '</th>';
  69. echo '<th>' . "2" . '</th>';
  70. echo '<th>' . "3" . '</th>';
  71. echo '<th colspan="2">' . "4" . '</th>';
  72. echo '<th colspan="2">' . "5" . '</th>';
  73. echo '<th>' . "6" . '</th>';
  74. echo '<th>' . "7" . '</th>';
  75. echo '<th colspan="2">' . "8" . '</th>';
  76. echo '<th colspan="2">' . "9" . '</th>';
  77. echo '<th colspan="2">' . "10" . '</th>';
  78. echo '</tr>';
  79. echo '<tr>';
  80. echo '<th colspan="3" style="padding:0 20px;text-align:right;">' . "Z przeniesienia" . '</th>';
  81. echo '<th>' . "" . '</th>';
  82. echo '<th>' . "" . '</th>';
  83. echo '<th colspan="3" style="text-align:right;">' . "Z przeniesienia" . '</th>';
  84. echo '<th>' . "" . '</th>';
  85. echo '<th>' . "" . '</th>';
  86. echo '<th>' . "" . '</th>';
  87. echo '<th>' . "" . '</th>';
  88. echo '<th>' . "" . '</th>';
  89. echo '<th>' . "" . '</th>';
  90. echo '<th>' . "" . '</th>';
  91. echo '</tr>';
  92. echo '</thead>';
  93. echo '<tfoot>';
  94. echo '<tr>';
  95. echo '<td colspan="3" style="border:none;padding:0 20px 0 0;text-align:right;">' . "Do przeniesienia" . '</td>';
  96. echo '<td>' . "" . '</td>';
  97. echo '<td>' . "" . '</td>';
  98. echo '<td colspan="4" style="border:none">' . "" . '</td>';
  99. echo '<td>' . "" . '</td>';
  100. echo '<td>' . "" . '</td>';
  101. echo '<td colspan="2" style="border:none">' . "" . '</td>';
  102. echo '<td>' . "" . '</td>';
  103. echo '<td>' . "" . '</td>';
  104. echo '</tr>';
  105. echo '</tfoot>';
  106. echo '<tbody>';
  107. foreach ($koresp as $r) {
  108. echo '<tr>';
  109. echo '<td>' . "" . '</td>';
  110. echo '<td>' . $r->K_OD_KOGO . '</td>';
  111. echo '<td>' . $r->OD_KOGO_ADRES . '</td>';
  112. echo '<td>' . "" . '</td>';
  113. echo '<td>' . "" . '</td>';
  114. echo '<td>' . "" . '</td>';
  115. echo '<td>' . "" . '</td>';
  116. echo '<td>' . $r->ID . '</td>';
  117. echo '<td>' . "" . '</td>';
  118. echo '<td>' . "" . '</td>';
  119. echo '<td>' . "" . '</td>';
  120. echo '<td>' . "" . '</td>';
  121. echo '<td>' . "" . '</td>';
  122. echo '<td>' . "" . '</td>';
  123. echo '<td>' . "" . '</td>';
  124. echo '</tr>';
  125. }
  126. echo '</tbody>';
  127. echo '</table>';
  128. }
  129. }
  130. function IN7_DZIENNIK_KORESP_OUTBOX() {
  131. $page_limit = 20;
  132. $db = DB::getDB();
  133. $koresp = array();
  134. $sql = "select
  135. `ID`
  136. , `K_OD_KOGO`
  137. , `OD_KOGO_ADRES`
  138. from `IN7_DZIENNIK_KORESP` as t
  139. where t.`A_STATUS`='NORMAL'
  140. and t.`K_TYP_KORESP`='OUT'
  141. and t.`K_TYP_RODZAJ` in('POLECONY', 'POLECONY PRIORYTET')
  142. ";
  143. $res = $db->query($sql);
  144. while ($r = $db->fetch($res)) {
  145. $koresp []= $r;
  146. }
  147. if (empty($koresp)) {
  148. echo '<p>' . "Brak danych." . '</p>';
  149. return;
  150. }
  151. // split table by $page_limit
  152. $koresp_pages = array();
  153. $page_nr = 0;
  154. $page_cur_nr = 0;
  155. foreach ($koresp as $r) {
  156. $koresp_pages[$page_nr] []= $r;
  157. $page_cur_nr++;
  158. if ($page_cur_nr >= $page_limit) {
  159. $page_nr++;
  160. $page_cur_nr = 0;
  161. }
  162. }
  163. Koresp_Outbox_View::css();
  164. foreach ($koresp_pages as $koresp_page) {
  165. Koresp_Outbox_View::page($koresp_page);
  166. }
  167. }