rtf_over.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <?php
  2. require_once "../auth.php";
  3. //require_once "../init.php";
  4. $pairs = array(
  5. 'MM' => '10',
  6. 'VÖH' => '20',
  7. 'KRU' => '30',
  8. 'ULM' => '40',
  9. 'LL' => '50',
  10. 'GZ' => '55',
  11. 'AAM' => '60',
  12. 'LEH' => '70',
  13. 'WTB' => '80'
  14. );
  15. function format_date($entry) {
  16. if ($entry == "0000-00-00") {
  17. return "";
  18. }
  19. $d = explode("-", $entry);
  20. return $d[2] . "." . $d[1] . "." . $d[0];
  21. }
  22. function format_amount($entry) {
  23. return number_format($entry, 2, ",", ".");
  24. }
  25. /* Function to extract headline...
  26. * First the actual php-file is opened, then it is parsed and searched for $reportName=title.
  27. * The title will be extracted.
  28. * This title is used to perform a Database SELECT on qb_report.
  29. * The column readonly contains the reports column names. unified with the column hidden,
  30. * the output will be the actual column names, that just need to be translated using __().
  31. */
  32. $part = substr($_GET['report'], strpos($_GET['report'], "/")+1);
  33. $strDoc = '';
  34. $strDoc = file_get_contents('..' . substr($part, strpos($part, "/")));
  35. $match = substr($strDoc, strpos($strDoc, 'reportName')+14);
  36. $match = substr($match, 0, strpos($match, ';')-1);
  37. //echo $match;exit; //--> $match now contains the report's name'
  38. $sql = $adodb->Execute("SELECT * FROM qb_report WHERE name='" . $match . "'");
  39. while ( !$sql->EOF )
  40. {
  41. $query = $sql->fields['sql'];
  42. $id = $sql->fields['id'];
  43. $head_raw = $sql->fields['readonly'];
  44. $head_filter = $sql->fields['hidden'];
  45. $sql->moveNext();
  46. }
  47. $head_filter = explode(',', $head_filter);
  48. $header = preg_replace('@' . $head_filter[0] . '@', '', $head_raw);
  49. foreach ( $head_filter as $filter )
  50. {
  51. //echo $filter. "<br>";
  52. $header = preg_replace('@' . $filter . '@', '', $header);
  53. }
  54. while ( strpos($query, '[userid]') != FALSE) $query = preg_replace('/\[userid\]/i', "'" . $_SESSION['userid'] . "'", $query);
  55. //echo strpos($query, 'order');
  56. /*
  57. * Hier den Filter hin
  58. * Beginn
  59. * Wird aus der Datei '/query2.txt' geladen.
  60. * Diese Datei wird von der phpMyEdit3.class.php geschrieben.
  61. */
  62. if ( $_GET['Betrieb'] )
  63. {
  64. $query = substr($query, 0, strpos($query, 'order')-1) . ' AND FFIRM="' . strtr($_GET['Betrieb'], $pairs) . '" ' . substr($query, strpos($query, 'order'));
  65. }
  66. if ( $_GET['Stufe2'] )
  67. {
  68. $query = substr($query, 0, strpos($query, 'order')-1) . ' AND Stufe2="' . $_GET['Stufe2'] . '" ' . substr($query, strpos($query, 'order'));
  69. }
  70. if ( $_GET['Stufe5'] )
  71. {
  72. $query = substr($query, 0, strpos($query, 'order')-1) . ' AND Stufe5="' . $_GET['Stufe5'] . '" ' . substr($query, strpos($query, 'order'));
  73. }
  74. if ( $_GET['Mahnstufe'] )
  75. {
  76. $query = substr($query, 0, strpos($query, 'order')-1) . ' AND O500_MAHNSTUFE="' . $_GET['Mahnstufe'] . '" ' . substr($query, strpos($query, 'order'));
  77. }
  78. if ( $_GET['from'] )
  79. {
  80. $query = substr($query, 0, strpos($query, 'order')-1) . ' AND FLDAT >= STR_TO_DATE("' . $_GET['from'] . '", GET_FORMAT(DATE,"EUR")) ' . substr($query, strpos($query, 'order'));
  81. }
  82. if ( $_GET['until'] )
  83. {
  84. $query = substr($query, 0, strpos($query, 'order')-1) . ' AND FLDAT <= STR_TO_DATE("' . $_GET['until'] . '", GET_FORMAT(DATE,"EUR")) ' . substr($query, strpos($query, 'order'));
  85. }
  86. if ( $_GET['wv'] )
  87. {
  88. $query = substr($query, 0, strpos($query, 'order')-1) . ' AND Wiedervorlage = STR_TO_DATE("' . $_GET['wv'] . '", GET_FORMAT(DATE,"EUR")) ' . substr($query, strpos($query, 'order'));
  89. }
  90. if ( $_GET['Kunde'] )
  91. {
  92. if ( substr($_GET['Kunde'], 0, 1) != '-' ) $query = substr($query, 0, strpos($query, 'order')-1) . ' AND KNDNR="' . substr(substr($_GET['Kunde'], 0, strpos($_GET['Kunde'], ' - ')), 0, 10) . '" ' . substr($query, strpos($query, 'order'));
  93. else $query = substr($query, 0, strpos($query, 'order')-1) . ' AND KNDNR="" ' . substr($query, strpos($query, 'order'));
  94. }
  95. if ( $_GET['Wochen'] )
  96. {
  97. //1 Woche, 2 Wochen, 3 Wochen, 4 Wochen, > 4 Wochen
  98. if ( $_GET['Wochen'] == '0-2 Wochen' ) {
  99. $query = substr($query, 0, strpos($query, 'order')-1) . ' AND round((unix_timestamp(current_date())-unix_timestamp(FLDAT))/86400) < 14 ' . substr($query, strpos($query, 'order'));
  100. }
  101. if ( $_GET['Wochen'] == '2-4 Wochen' ) {
  102. $query = substr($query, 0, strpos($query, 'order')-1) . ' AND round((unix_timestamp(current_date())-unix_timestamp(FLDAT))/86400) between 14 and 27 ' . substr($query, strpos($query, 'order'));
  103. }
  104. if ( $_GET['Wochen'] == '4-6 Wochen' ) {
  105. $query = substr($query, 0, strpos($query, 'order')-1) . ' AND round((unix_timestamp(current_date())-unix_timestamp(FLDAT))/86400) between 28 and 41 ' . substr($query, strpos($query, 'order'));
  106. }
  107. if ( $_GET['Wochen'] == '> 6 Wochen' ) {
  108. $query = substr($query, 0, strpos($query, 'order')-1) . ' AND round((unix_timestamp(current_date())-unix_timestamp(FLDAT))/86400) >= 42 ' . substr($query, strpos($query, 'order'));
  109. }
  110. }
  111. if ( $_GET['Reklamation'] )
  112. {
  113. $query = substr($query, 0, strpos($query, 'order')-1) . ' AND Reklamation="' . $_GET['Reklamation'] . '" ' . substr($query, strpos($query, 'order'));
  114. }
  115. if ( $_GET['Versicherung'] )
  116. {
  117. $query = substr($query, 0, strpos($query, 'order')-1) . ' AND Versicherung="' . $_GET['Versicherung'] . '" ' . substr($query, strpos($query, 'order'));
  118. }
  119. if ( $_GET['Mahnen'] )
  120. {
  121. $query = substr($query, 0, strpos($query, 'order')-1) . ' AND Mahnen="' . $_GET['Mahnen'] . '" ' . substr($query, strpos($query, 'order'));
  122. }
  123. if ( $_GET['Rechtsanwalt'] )
  124. {
  125. $query = substr($query, 0, strpos($query, 'order')-1) . ' AND Rechtsanwalt="' . $_GET['Rechtsanwalt'] . '" ' . substr($query, strpos($query, 'order'));
  126. }
  127. if ( $_GET['Reserve_3'] )
  128. {
  129. $query = substr($query, 0, strpos($query, 'order')-1) . ' AND Reserve_3="' . $_GET['Reserve_3'] . '" ' . substr($query, strpos($query, 'order'));
  130. }
  131. // DEBUG
  132. // echo $query;
  133. /*
  134. * Filter
  135. * Ende
  136. */
  137. //echo $query;exit;
  138. $insdoc = '';
  139. $sql = $adodb->Execute($query);
  140. $insdoc .= '\plain \fs30\ql \b Forderungsmanagement';
  141. $insdoc .= '\tab \tab \tab \tab \tab \tab ';
  142. if (in_array($id, array('1', '2', '3', '4'))) {
  143. $insdoc .= '\tab \tab \tab ';
  144. }
  145. $insdoc .= __('TITLE', $match, "qb_report_{$id}");
  146. $insdoc .= ' \tab \tab \b0\qr0\fs0\par \fs30\qr \b ________________________________________________________________________________\tab \tab \b0\qr0 \par \par ';
  147. if ( $match == 'NAGA' || $match == 'FM_NaGa' || $match == 'fm_ahr_naga' || $match == 'fm_aha_naga' || $match == 'fm_rem_naga')
  148. {
  149. $colwidth = array(615, 1020, 1636, 2495, 4328, 5771, 6648, 7410, 8237, 9275, 10019, 11300, 12290, 13461, 13661, 13851, 14810);
  150. $colwidth = array(570, 430, 720, 800, 1830, 1440, 840, 820, 850, 1040, 850, 1280, 840, 1170, 840, 340, 340);
  151. $colname = array("Fil.", "Abt", "Fzg-Nr", "Typ", "Kunde", "VK", "Rg.Dat.", "Rg.Betr.", "fällig", "Mahnst.", "offen", "Bemerkung FIBU", "WV", "Bemerkung Abt.", "Lieferdat.", "Bearb.", "Mahnen?");
  152. $insdoc .= '\trowd \trgaph70\trleft-70 \trbrdrt\brdrs\brdrw10 ' .
  153. '\trpaddl10\trpaddr10\trpaddfl3\trpaddfr3\clbrdrt\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \clvertalc ';
  154. $colsum = 0;
  155. foreach ($colwidth as $w) {
  156. $colsum += $w;
  157. $insdoc .= '\cellx' . $colsum .'\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ';
  158. }
  159. $insdoc .= '\intbl\sl2\slmult0\qj\f0\fs12 ';
  160. $insdoc .= '\b \qc \fs12 \trhdr ';
  161. $insdoc .= implode("\cell ", $colname);
  162. $insdoc .= '\qc0\b0\cell \row ';
  163. $index = 0;
  164. $sum = 0;
  165. while ( !$sql->EOF )
  166. {
  167. $index += 1;
  168. $bem = $sql->fields['Bemerkung'];
  169. $bem_2 = $sql->fields['Bemerkung_2'];
  170. //if ( strlen($sql->fields['Bemerkung']) > 28 ) { $bem = substr($sql->fields['Bemerkung'], 0, 25) . '...'; }
  171. //if ( strlen($sql->fields['Bemerkung_2']) > 28 ) { $bem_2 = substr($sql->fields['Bemerkung'], 0, 25) . '...'; }
  172. if ( $index % 2 == 0 ) {
  173. $insdoc .= ' \trowd \trgaph70' . '\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ';
  174. $colsum = 0;
  175. foreach ($colwidth as $w) {
  176. $colsum += $w;
  177. $insdoc .= '\cellx' . $colsum . '\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ';
  178. }
  179. $insdoc .= '\intbl\sl2\slmult0\qj\f0\fs12 \plain \fs12\clcbpat3';
  180. } else {
  181. $insdoc .= ' \trowd \trgaph70\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ';
  182. $colsum = 0;
  183. foreach ($colwidth as $w) {
  184. $colsum += $w;
  185. $insdoc .= '\cellx' . $colsum . '\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ';
  186. }
  187. $insdoc .= '\intbl\sl2\slmult0\qj\f0\fs12 \plain \fs12\clcbpat2';
  188. }
  189. $insdoc .= ' \pard \intbl \fs12\ql {' . $sql->fields['Betrieb'] .
  190. '}\cell \pard \intbl \fs12\ql {' . $sql->fields['Stufe2'] .
  191. '}\cell \pard \intbl \fs10\qc {' . $sql->fields['FAGNR'] .
  192. '}\cell \pard \intbl \fs10\qc {' . $sql->fields['FTYPE'] .
  193. '}\cell \pard \intbl \fs10\ql {' . $sql->fields['KNAME'] .
  194. '}\cell \pard \intbl \fs10\ql {' . $sql->fields['Stufe5'] .
  195. '}\cell \pard \intbl \fs10\qc {' . format_date($sql->fields['REDAT']) .
  196. '}\cell \pard \intbl \fs12\qr {' . format_amount($sql->fields['O500_HW2BUCHGBETR']) .
  197. '}\cell \pard \intbl \fs10\qc {' . format_date($sql->fields['FLDAT']) .
  198. '}\cell \pard \intbl \fs10\qc {' . $sql->fields['O500_MAHNSTUFE'] .
  199. '}\cell \pard \intbl \fs12\qr {' . format_amount($sql->fields['O500_HW2BETR_OFFEN']) .
  200. '}\cell \pard \intbl \fs10\ql {' . $bem .
  201. '}\cell \pard \intbl \fs10\qc {' . format_date($sql->fields['Wiedervorlage']) .
  202. '}\cell \pard \intbl \fs10\ql {' . $bem_2 .
  203. '}\cell \pard \intbl \fs10\qc {' . format_date($sql->fields['shipment_date']) .
  204. '}\cell \pard \intbl \fs12\qc {' . $sql->fields['Bearbeitet'] .
  205. '}\cell \pard \intbl \fs12\qc {' . $sql->fields['Mahnen'] .
  206. '}\qc0\cell \row ';
  207. // $sql->fields['Betrieb'];
  208. $bem = '';
  209. $bem_2 = '';
  210. $sum += (float) $sql->fields['O500_HW2BETR_OFFEN'];
  211. $sql->MoveNext();
  212. }
  213. //$insdoc = substr($insdoc, 0, -4);
  214. $sum = number_format($sum, 2, ',', '.');
  215. $insdoc .= ' \pard \par \par \plain \fs12\qr \b \tab \tab \tab {Gesamtsumme: ' . $sum . '} \tab \tab \b0\qr0';
  216. $doc = file_get_contents('Uebersicht_' . $match . '_vorl.rtf');
  217. $doc = preg_replace('@<header>@', $insdoc, $doc);
  218. $fd = fopen('temp/Uebersicht.rtf', 'w');
  219. rewind($fd);
  220. fwrite($fd, $doc);
  221. fclose($fd);
  222. } elseif ( $match == 'SC-TuZ' || $match == 'FM_SC-TuZ' || $match == 'fm_ahr_sc' || $match == 'fm_aha_sc' || $match == 'fm_rem_sc' )
  223. {
  224. $insdoc .= '\trowd \trgaph70\trleft-70 \trbrdrt\brdrs\brdrw10 ' .
  225. '\trpaddl10\trpaddr10\trpaddfl3\trpaddfr3\clbrdrt\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \clvertalc ' .
  226. '\cellx615\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  227. '\cellx1020\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  228. '\cellx1636\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  229. '\cellx2495\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  230. '\cellx4328\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  231. '\cellx5771\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  232. '\cellx6648\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  233. '\cellx7410\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  234. '\cellx8237\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  235. '\cellx9275\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  236. '\cellx10019\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  237. '\cellx11300\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  238. '\cellx12290\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  239. '\cellx13461\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  240. '\cellx13851\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  241. '\cellx14810\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc \intbl\sl2\slmult0\qj\f0\fs12 ';
  242. $insdoc .= '\b \qc \fs12 ' . __('Betrieb', 'Betrieb', 'qb_report_' . $id) . '\cell ' . __('Stufe2', 'Stufe2', 'qb_report_' . $id) . '\cell ' .
  243. __('FAGNR', 'FAGNR', 'qb_report_' . $id) . '\cell ' . __('FTYPE', 'FTYPE', 'qb_report_' . $id) . '\cell ' .
  244. __('KNAME', 'KNAME', 'qb_report_' . $id) . '\cell ' . __('Stufe5', 'Stufe5', 'qb_report_' . $id) . '\cell ' .
  245. __('REDAT', 'REDAT', 'qb_report_' . $id) . '\cell ' . __('O500_HW2BUCHGBETR', 'O500_HW2BUCHGBETR', 'qb_report_' . $id) . '\cell ' .
  246. __('FLDAT', 'FLDAT', 'qb_report_' . $id) . '\cell ' . __('O500_MAHNSTUFE', 'O500_MAHNSTUFE', 'qb_report_' . $id) . '\cell ' .
  247. __('O500_HW2BETR_OFFEN', 'O500_HW2BETR_OFFEN', 'qb_report_' . $id) . '\cell ' . __('Bemerkung', 'Bemerkung', 'qb_report_' . $id) . '\cell ' .
  248. __('Wiedervorlage', 'Wiedervorlage', 'qb_report_' . $id) . '\cell ' . __('Bemerkung_2', 'Bemerkung_2', 'qb_report_' . $id) . '\cell ' .
  249. __('Bearbeitet', 'Bearbeitet', 'qb_report_' . $id) . '\cell ' . __('Mahnen', 'Mahnen', 'qb_report_' . $id) . '\qc0\b0\cell\row ';
  250. $index = 0;
  251. while ( !$sql->EOF )
  252. {
  253. $index += 1;
  254. $bem = $sql->fields['Bemerkung'];
  255. $bem_2 = $sql->fields['Bemerkung_2'];
  256. //if ( strlen($sql->fields['Bemerkung']) > 28 ) { $bem = substr($sql->fields['Bemerkung'], 0, 25) . '...'; }
  257. //if ( strlen($sql->fields['Bemerkung_2']) > 28 ) { $bem_2 = substr($sql->fields['Bemerkung_2'], 0, 25) . '...'; }
  258. if ( $index % 2 == 0 ) $insdoc .= ' \trowd \trgaph70\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ' .
  259. '\cellx615\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ' .
  260. '\cellx1020\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ' .
  261. '\cellx1636\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ' .
  262. '\cellx2495\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ' .
  263. '\cellx4328\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ' .
  264. '\cellx5771\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ' .
  265. '\cellx6648\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ' .
  266. '\cellx7410\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ' .
  267. '\cellx8300\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ' .
  268. '\cellx9275\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ' .
  269. '\cellx10019\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ' .
  270. '\cellx11300\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ' .
  271. '\cellx12290\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ' .
  272. '\cellx13461\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ' .
  273. '\cellx13851\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc ' .
  274. '\cellx14810\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clcbpat3\clvertalc \intbl\sl2\slmult0\qj\f0\fs12 ' .
  275. '\plain \fs12\clcbpat3';
  276. else $insdoc .= ' \trowd \trgaph70\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  277. '\cellx615\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  278. '\cellx1020\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  279. '\cellx1636\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  280. '\cellx2495\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  281. '\cellx4328\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  282. '\cellx5771\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  283. '\cellx6648\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  284. '\cellx7410\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  285. '\cellx8300\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  286. '\cellx9275\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  287. '\cellx10019\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  288. '\cellx11300\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  289. '\cellx12290\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  290. '\cellx13461\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  291. '\cellx13851\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc ' .
  292. '\cellx14810\clbrdrt\brdrs\brdrw1\brdrcf1\clbrdrb\brdrs\brdrw1\brdrcf1\clvertalc \intbl\sl2\slmult0\qj\f0\fs12 ' .
  293. '\plain \fs12\clcbpat2';
  294. $insdoc .= ' \pard \intbl \fs12\qc {' . $sql->fields['Betrieb'] . '}\cell \pard \intbl \fs12\qc {' . $sql->fields['Stufe2'] . '}\cell \pard \intbl \fs12\qc {' .
  295. $sql->fields['FAGNR'] . '}\cell \pard \intbl \fs12\qc{ ' . $sql->fields['FTYPE'] . '}\cell \pard \intbl \fs12\qc {' .
  296. $sql->fields['KNAME'] . '}\cell \pard \intbl \fs12\qc {' . $sql->fields['Stufe5'] . '}\cell \pard \intbl \fs12\qc {' .
  297. $sql->fields['REDAT'] . '}\cell \pard \intbl \fs12\qc {' . $sql->fields['O500_HW2BUCHGBETR'] . '}\cell \pard \intbl \fs12\qc {' .
  298. $sql->fields['FLDAT'] . '}\cell \pard \intbl \fs12\qc {' . $sql->fields['O500_MAHNSTUFE'] . '}\cell \pard \intbl \fs12\qc {'
  299. . $sql->fields['O500_HW2BETR_OFFEN'] . '}\cell \pard \intbl \fs12\qc {' . $bem . '}\cell \pard \intbl \fs12\qc {' .
  300. $sql->fields['Wiedervorlage'] . '}\cell \pard \intbl \fs12\qc {' . $bem_2 . '} \cell \pard \intbl \fs12\qc {' .
  301. $sql->fields['Bearbeitet'] . '}\cell \pard \intbl \fs12\qc {' . $sql->fields['Mahnen'] . '}\qc0\cell \row ';
  302. $bem = '';
  303. $bem_2 = '';
  304. $sum += (float) $sql->fields['O500_HW2BETR_OFFEN'];
  305. $sql->MoveNext();
  306. }
  307. //$insdoc = substr($insdoc, 0, -4);
  308. $sum = number_format($sum, 2, ',', '.');
  309. $insdoc .= ' \pard \par \par \plain \fs12\qr \b \tab \tab \tab {Gesamtsumme: ' . $sum . '} \tab \tab \b0\qr0';
  310. $doc = file_get_contents('Uebersicht_' . $match . '_vorl.rtf');
  311. $doc = preg_replace('@<header>@', $insdoc, $doc);
  312. $fd = fopen('temp/Uebersicht.rtf', 'w');
  313. fwrite($fd, $doc);
  314. fclose($fd);
  315. }
  316. /*\trowd\trgaph70\trleft-70\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trpaddl70\trpaddr70\trpaddfl3\trpaddfr3\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx1418\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx2835\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx4636\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx6096\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx8222\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx10134\pard\intbl\sl360\slmult0\qj\f0\fs16*/
  317. echo '
  318. <html>
  319. <head>
  320. <title></title>
  321. <meta http-equiv="refresh" content="0; URL=temp/Uebersicht.rtf">
  322. </head>
  323. <body>
  324. </body>
  325. </html>';
  326. ?>