superedit-IN7_DZIENNIK_KORESP.php 5.6 KB

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