Beim Anlegen einer Einheit bei allen Einheiten nachsehen, ob es eine Einheit mit...
[kivitendo-erp.git] / bin / mozilla / datev.pl
1 #=====================================================================
2 # Lx-Office ERP
3 # Copyright (c) 2004
4 #
5 #  Author: Philip Reetz
6 #   Email: p.reetz@linet-services.de
7 #     Web: http://www.lx-office.org
8 #
9 #
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
14 #
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #======================================================================
23 #
24 # Datev export module
25 #
26 #======================================================================
27
28 use SL::DATEV;
29
30 1;
31
32 # end of main
33
34 sub continue { &{ $form->{nextsub} } }
35
36 sub export {
37   $lxdebug->enter_sub();
38
39   $form->{title} = $locale->text("DATEX - Export Assistent");
40
41   DATEV->get_datev_stamm(\%myconfig, \%$form);
42   $form->header;
43
44   print qq|
45 <body>
46
47 <form method=post action=$form->{script}>
48
49
50 <table width=100%>
51   <tr>
52     <th class=listtop>$form->{title}</th>
53   </tr>
54   <tr>
55     <th align=left>| . $locale->text("DATEV Angaben") . qq|</th>
56   </tr>
57   <tr height="5"></tr>
58   <tr valign=top>
59     <td>
60       <table>
61         <tr>
62           <td align=left nowrap>| . $locale->text("Beraternummer") . qq|</td>
63           <td><input name=beraternr size=10 maxlength=7 value="$form->{beraternr}"></td>
64
65           <td align=left nowrap>| . $locale->text("DFV-Kennzeichen") . qq|</td>
66           <td><input name=dfvkz size=5 maxlength=2 value="$form->{dfvkz}"></td>
67         </tr>
68         <tr>
69           <td align=left nowrap>| . $locale->text("Beratername") . qq|</td>
70           <td><input name=beratername size=10 maxlength=9 value="$form->{beratername}"></td>
71
72           <td align=left nowrap>| . $locale->text("Password") . qq|</td>
73           <td><input name=passwort size=5 maxlength=4 value="$form->{passwort}"></td>
74         </tr>
75         <tr>
76           <td align=left nowrap>| . $locale->text("Mandantennummer") . qq|</td>
77           <td><input name=mandantennr size=10 maxlength=5 value="$form->{mandantennr}"></td>
78
79           <td align=left nowrap>| . $locale->text("Datenträgernummer") . qq|</td>
80           <td><input name=datentraegernr size=5 maxlength=3 value="$form->{datentraegernr}"></td>
81         </tr>
82         <tr>
83           <td><input checked name=kne type=checkbox class=checkbox value=1> |
84     . $locale->text("Kontonummernerweiterung (KNE)") . qq|</td>
85           <td></td>
86
87           <td align=left nowrap>| . $locale->text("Abrechnungsnummer") . qq|</td>
88           <td><input name=abrechnungsnr size=5 maxlength=3 value="$form->{abrechnungsnr}"></td>
89         </tr>
90         <tr>
91           <td><input name=exporttype type=radio class=radio value=0 checked> |
92     . $locale->text("Export Buchungsdaten") . qq|</td>
93           <td></td>
94
95           <td><input name=exporttype type=radio class=radio value=1> |
96     . $locale->text("Export Stammdaten") . qq|</td>
97           <td></td>
98         </td>
99       </table>
100     </td>
101   </tr>
102   <tr>
103     <td><hr size=3 noshade></td>
104   </tr>
105 </table>
106
107 <input type=hidden name=nextsub value=export2>
108
109 <input type=hidden name=path value=$form->{path}>
110 <input type=hidden name=login value=$form->{login}>
111 <input type=hidden name=password value=$form->{password}>
112
113 <br>
114 <input type=submit class=submit name=action value="|
115     . $locale->text('Continue') . qq|">
116 </form>
117
118 </body>
119 </html>
120 |;
121   $lxdebug->leave_sub();
122 }
123
124 sub export2 {
125   $lxdebug->enter_sub();
126
127   if ($form->{exporttype} == 0) {
128     &export_bewegungsdaten();
129   } else {
130     &export_stammdaten();
131   }
132   $lxdebug->leave_sub();
133 }
134
135 sub export_bewegungsdaten {
136   $lxdebug->enter_sub();
137
138   $form->{title} = $locale->text("DATEX - Export Assistent");
139
140   $form->{allemonate} =
141       qq|<option value=1>|
142     . $locale->text('January')
143     . qq|</option>
144                          <option value=2>|
145     . $locale->text('February') . qq|</option>
146                          <option value=3>|
147     . $locale->text('March') . qq|</option>
148                          <option value=4>|
149     . $locale->text('April') . qq|</option>
150                          <option value=5>|
151     . $locale->text('May') . qq|</option>
152                          <option value=6>|
153     . $locale->text('June') . qq|</option>
154                          <option value=7>|
155     . $locale->text('July') . qq|</option>
156                          <option value=8>|
157     . $locale->text('August') . qq|</option>
158                          <option value=9>|
159     . $locale->text('September') . qq|</option>
160                          <option value=10>|
161     . $locale->text('October') . qq|</option>
162                          <option value=11>|
163     . $locale->text('November') . qq|</option>
164                          <option value=12>|
165     . $locale->text('December') . qq|</option>|;
166
167   $form->{allequartale} =
168       qq|<option selected value=1>|
169     . $locale->text('I')
170     . qq|</option>
171                          <option value=2>| . $locale->text('II') . qq|</option>
172                          <option value=3>|
173     . $locale->text('III') . qq|</option>
174                          <option value=4>|
175     . $locale->text('IV') . qq|</option>|;
176   $form->header;
177
178   print qq|
179 <body>
180
181 <form method=post action=$form->{script}>
182
183
184 <table width=100%>
185   <tr>
186     <th class=listtop>$form->{title}</th>
187   </tr>
188   <tr>
189     <th align=left>| . $locale->text("Zeitraum") . qq|</th>
190   </tr>
191   <tr height="5"></tr>
192   <tr valign=top>
193     <td>
194       <table>
195         <tr>
196           <td align=left><input checked name=zeitraum class=radio type=radio value=monat>&nbsp;</td><td align=left>|
197     . $locale->text('Monat') . qq|</td>
198           <td align=left></td>
199           <td align=left></td>
200           <td align=left><select name=monat>$form->{allemonate}</select></td>
201         </tr>
202         <tr>
203           <td align=left><input name=zeitraum class=radio type=radio value=quartal>&nbsp;</td><td align=left>|
204     . $locale->text('Quartal') . qq|</td>
205           <td align=left></td>
206           <td align=left></td>
207           <td align=left><select name=quartal>$form->{allequartale}</select></td>
208         </tr>
209         <tr>
210           <td align=left><input name=zeitraum class=radio type=radio value=zeit>&nbsp;</td><td align=left>|
211     . $locale->text('Datum von') . qq|</td>
212           <td align=left><input name=transdatefrom size=8></td>
213           <td align=left>| . $locale->text('bis') . qq|</td>
214           <td align=left><input name=transdateto size=8></td>
215         </tr>
216       </table>
217     </td>
218   </tr>
219   <tr>
220     <td><hr size=3 noshade></td>
221   </tr>
222 </table>
223
224 <input type=hidden name=beraternr value="$form->{beraternr}">
225 <input type=hidden name=dfvkz value="$form->{dfvkz}">
226 <input type=hidden name=beratername value="$form->{beratername}">
227 <input type=hidden name=passwort value="$form->{passwort}">
228 <input type=hidden name=mandantennr value="$form->{mandantennr}">
229 <input type=hidden name=datentraegernr value="$form->{datentraegernr}">
230 <input type=hidden name=kne value="$form->{kne}">
231 <input type=hidden name=abrechnungsnr value="$form->{abrechnungsnr}">
232
233 <input type=hidden name=exporttype value="$form->{exporttype}">
234
235 <input type=hidden name=nextsub value=export3>
236
237 <input type=hidden name=path value=$form->{path}>
238 <input type=hidden name=login value=$form->{login}>
239 <input type=hidden name=password value=$form->{password}>
240
241 <br>
242 <input type=submit class=submit name=action value="|
243     . $locale->text('Continue') . qq|">
244 </form>
245
246 </body>
247 </html>
248 |;
249
250   $lxdebug->leave_sub();
251 }
252
253 sub export_stammdaten {
254   $lxdebug->enter_sub();
255
256   $form->{title} = $locale->text("DATEX - Export Assistent");
257
258   $form->header;
259
260   print qq|
261 <body>
262
263 <form method=post action=$form->{script}>
264 <table width=100%>
265   <tr>
266     <th class=listtop>$form->{title}</th>
267   </tr>
268   <tr>
269     <th align=left>| . $locale->text("Konten") . qq|</th>
270   </tr>
271   <tr height="5"></tr>
272   <tr valign=top>
273     <td>
274       <table>
275         <tr>
276           <td align=left>| . $locale->text('Von Konto: ') . qq|</td>
277           <td align=left><input name=accnofrom size=8 maxlength=8></td>
278         </tr>
279         <tr>
280           <td align=left>| . $locale->text('Bis Konto: ') . qq|</td>
281           <td align=left><input name=accnoto size=8 maxlength=8></td>
282         </tr>
283       </table>
284     </td>
285   </tr>
286   <tr>
287     <td><hr size=3 noshade></td>
288   </tr>
289 </table>
290 <input type=hidden name=beraternr value="$form->{beraternr}">
291 <input type=hidden name=dfvkz value="$form->{dfvkz}">
292 <input type=hidden name=beratername value="$form->{beratername}">
293 <input type=hidden name=passwort value="$form->{passwort}">
294 <input type=hidden name=mandantennr value="$form->{mandantennr}">
295 <input type=hidden name=datentraegernr value="$form->{datentraegernr}">
296 <input type=hidden name=kne value="$form->{kne}">
297 <input type=hidden name=abrechnungsnr value="$form->{abrechnungsnr}">
298
299 <input type=hidden name=exporttype value="$form->{exporttype}">
300
301 <input type=hidden name=nextsub value=export3>
302
303 <input type=hidden name=path value=$form->{path}>
304 <input type=hidden name=login value=$form->{login}>
305 <input type=hidden name=password value=$form->{password}>
306
307 <br>
308 <input type=submit class=submit name=action value="|
309     . $locale->text('Continue') . qq|">
310 </form>
311
312 </body>
313 </html>
314 |;
315
316   $lxdebug->leave_sub();
317 }
318
319 sub export3 {
320   $lxdebug->enter_sub();
321
322   DATEV->save_datev_stamm(\%myconfig, \%$form);
323
324   if ($form->{kne}) {
325     if (DATEV->kne_export(\%myconfig, \%$form)) {
326       $form->redirect($locale->text('KNE Export erfolgreich!'));
327     }
328   } else {
329     if (DATEV->obe_export(\%myconfig, \%$form)) {
330       $form->redirect($locale->text('OBE Export erfolgreich!'));
331     }
332   }
333   $lxdebug->leave_sub();
334 }