dbXapp 2.0
RAD, CMS, Module und Runtime-IDE fuer dbXapp
Loading...
Searching...
No Matches
myLKW_report.class.php
Go to the documentation of this file.
1<?php
2namespace dbx\myLKW;
3
4dbx()->use_system_class('dbxReport');
5use function dbx\myLKW\dbx_get_datum;
6
7
9
10 public function run_body($content) {
11 $activ_id = $this->_activ_id;
12 $record = $this->_record;
13
14
15 $record['observacion'] = str_repeat('&nbsp;', 10);
16 $record['d2_carga_lugar'] = substr($record['d2_carga_lugar'], 0, 10);
17 $record['d2_observaciones'] = substr($record['d2_observaciones'], 0, 7);
18
19 $this->_class_body['TIPO']=$record['TIPO'] ;
20
21
22
23 $this->_class_body['d2_carga_region']=$this->_class_body['d2_carga_region'] = strtoupper(substr($record['d2_carga_region'], 0, 1));
24
25 $record['TIPO'] = str_replace('-', '&#8209;', $record['TIPO']);
26 $this->_record=$record;
27 $content=$this->forward_run_body($content);
28 return $content;
29 }
30}
31
32// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
33
34
35
36
37
38
39
40
41
43
44private function get_report_dispo($page=0,$col=0) {
45
46 $dd = 'lkw';
47 $form_id = 'report-dispo-prn-'.$page.'-'.$col;
48
49 $oReport = new dbxReport_Dispo;
50
51 // WICHTIG: Keine interne Pagination
52 $oReport->init($form_id, 'report-dispo-prn', 999999, 999999, 0);
53
54 $oReport->_dd = $dd;
55
56
57 $oDB = dbx()->get_system_obj('dbxDB');
58
59 $flds = [
60 'id' => '',
61 'TRACTOR' => 'TRACTOR',
62 'TIPO' => 'TIPO',
63 'd2_carga_region' => 'Reg.',
64 'd2_carga_lugar' => 'Lugar',
65 'd2_observaciones' => 'Obser.',
66 'observacion' => 'observación',
67 ];
68
69
70
71 // -----------------------------------------
72 // NEU: TIPO BASIERTE SEITENLOGIK
73 // -----------------------------------------
74
75 $perColumn = 54;
76
77 // Seite 1 definierte TIPOs
78 $tipos_page1 = [
79 'PM',
80 'TL-PM',
81 'DK-PM',
82 'TAL',
83 'BAN',
84 'LT-BAS',
85 'AST'
86 ];
87
88 $rwhere = 'TRACTOR > " "';
89
90 // -----------------------------------------
91 // WHERE nach Seite
92 // -----------------------------------------
93
94 if ($page == 1) {
95
96 $tipoList = "'" . implode("','", $tipos_page1) . "'";
97 $rwhere .= " AND TIPO IN ($tipoList)";
98
99 } else {
100
101 $tipoList = "'" . implode("','", $tipos_page1) . "'";
102 $rwhere .= " AND (TIPO NOT IN ($tipoList) OR TIPO IS NULL OR TIPO='')";
103
104 }
105
106 // -----------------------------------------
107 // OFFSET NUR innerhalb gefilterter Daten
108 // -----------------------------------------
109
110 $rrows = $perColumn;
111 $rpos = ($col - 1) * $perColumn;
112
113 // -----------------------------------------
114 // SORT
115 // -----------------------------------------
116
117 $rsort = 'TIPO DESC, d2_carga_region ASC, TRACTOR ASC';
118 $rdesc = '';
119 $rgroup = '';
120
121 $count = $oDB->count($dd,$rwhere);
122
123 $rdata = $oDB->select(
124 $dd,
125 $rwhere,
126 $flds,
127 $rsort,
128 $rdesc,
129 $rgroup,
130 $rrows,
131 $rpos
132 );
133
134 dbx()->debug("LKW Print page=($page) col=($col) rpos=($rpos) rows=($rrows)");
135
136 // -----------------------------------------
137 // Report Setup – DRUCKMODUS
138 // -----------------------------------------
139
140 $oReport->_rcount = count($rdata);
141 $oReport->_rdata = $rdata;
142
143 $oReport->_pages = 0;
144 $oReport->_mode = 'table';
145 $oReport->_rflds = $flds;
146
147 // WICHTIG: Alles deaktivieren
148 $oReport->_create_sel_flds = 0;
149 $oReport->_create_row_select = 0;
150 $oReport->_create_row_edit = 0;
151 $oReport->_create_row_copy = 0;
152 $oReport->_create_row_delete = 0;
153 $oReport->_create_row_print = 0;
154 $oReport->_data_table = 0;
155
156 $oReport->set_style_haeder('TIPO','width:42px');
157
158 $oReport->set_style_haeder('TRACTOR','width:74px');
159 $oReport->set_style_haeder('d2_carga_region','width:30px');
160
161 $oReport->set_style_haeder('d2_carga_lugar','width:80px');
162
163 $oReport->set_style_haeder('d2_observaciones','width:40px');
164
165 //$oReport->set_style_haeder('observacion','width:100%');
166
167
168
169 $content= $oReport->run(0,$flds);
170 return $content;
171}
172
173
174 /* ========================================================= */
175
177 public function run() {
178 $oTPL = dbx()->get_system_obj('dbxTPL');
179 $page = dbx()->get_modul_var('page',0,'int');
180 $col = dbx()->get_modul_var('col' ,0,'int');
181
182
183 $data['date'] = dbx_get_datum('day dd month yyyy', 1);
184 dbx()->debug("myLKW_report page=($page) col=($col)");
185 if (!$page && !$col) {
186 $page=dbx()->get_modul_var('dbx_page',0,'parameter');
187 if ($page) dbx()->set_system_var('dbx_page',$page); // window support
188 $data = array_merge($data, array(
189 'frame_id' => 'lkw_report',
190 'frame_panel_class' => 'dbxReport noPrint',
191 'frame_panel_attrs' => '',
192 'frame_subbar' => '',
193 'frame_form_open' => '',
194 'frame_form_close' => '',
195 'frame_body_class' => '',
196 'frame_body_head' => '',
197 'frame_body_tail' => '',
198 'bar_class' => 'dbx-module-bar noPrint',
199 'bar_title_class' => 'dbx-module-bar-titleblock',
200 'bar_actions_class' => 'dbx-module-bar-actions',
201 'bar_title' => 'LKW Report',
202 'bar_icon' => 'bi-printer',
203 'bar_subtitle' => '',
204 'bar_title_pre' => '',
205 'bar_title_heading_attrs' => '',
206 'bar_middle' => '',
207 'bar_extra' => '',
208 'bar_actions' => $oTPL->get_tpl('myLKW|report-lkw-print-action'),
209 ));
210 $content=$oTPL->get_tpl('myLKW|report-lkw-cols',$data);
211
212 }
213 if ($page && $col) {
214 $content=$this->get_report_dispo($page,$col);
215 // hier kommt dann der Report Aufruf hin der den content einer seiter einer spalte zurück gibt
216
217 }
218 return $content;
219 }
220
221 /* ========================================================= */
222
223}
224
$_activ_id
Optional aktive ID.
init($fid, $tpl='', $first_page_lines=-1, $next_page_lines=-1, $current_line=-1)
$_record
Aktueller Datensatz im Body-Lauf.
forward_run_body($content)
dbx_get_datum(string $format='day, dd.mm.yyyy', int $offset=0, ?DateTime $base=null)
DBX schema administration.