unstable-Zweig als Kopie des "alten" trunks erstellt.
[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
29 use SL::DATEV;
30
31 1;
32 # end of main
33
34 sub continue { &{ $form->{nextsub} } };
35
36
37
38 sub export {
39   $lxdebug->enter_sub();
40
41
42   $form->{title} = $locale->text("DATEX - Export Assistent");
43
44   
45   DATEV->get_datev_stamm(\%myconfig, \%$form); 
46   $form->header;
47   
48   print qq|
49 <body>
50
51 <form method=post action=$form->{script}>
52
53
54 <table width=100%>
55   <tr>
56     <th class=listtop>$form->{title}</th>
57   </tr>
58   <tr>
59     <th align=left>|.$locale->text("DATEV Angaben").qq|</th>
60   </tr>
61   <tr height="5"></tr>
62   <tr valign=top>
63     <td>
64       <table>
65         <tr>
66           <td align=left nowrap>|.$locale->text("Beraternummer").qq|</td>
67           <td><input name=beraternr size=10 maxlength=7 value="$form->{beraternr}"></td>
68         
69           <td align=left nowrap>|.$locale->text("DFV-Kennzeichen").qq|</td>
70           <td><input name=dfvkz size=5 maxlength=2 value="$form->{dfvkz}"></td>
71         </tr>
72         <tr>
73           <td align=left nowrap>|.$locale->text("Beratername").qq|</td>
74           <td><input name=beratername size=10 maxlength=9 value="$form->{beratername}"></td>
75         
76           <td align=left nowrap>|.$locale->text("Password").qq|</td>
77           <td><input name=passwort size=5 maxlength=4 value="$form->{passwort}"></td>
78         </tr>
79         <tr>
80           <td align=left nowrap>|.$locale->text("Mandantennummer").qq|</td>
81           <td><input name=mandantennr size=10 maxlength=5 value="$form->{mandantennr}"></td>
82         
83           <td align=left nowrap>|.$locale->text("Datenträgernummer").qq|</td>
84           <td><input name=datentraegernr size=5 maxlength=3 value="$form->{datentraegernr}"></td>
85         </tr>   
86         <tr>
87           <td><input checked name=kne type=checkbox class=checkbox value=1> |.$locale->text("Kontonummernerweiterung (KNE)").qq|</td>
88           <td></td>
89         
90           <td align=left nowrap>|.$locale->text("Abrechnungsnummer").qq|</td>
91           <td><input name=abrechnungsnr size=5 maxlength=3 value="$form->{abrechnungsnr}"></td>
92         </tr>
93         <tr>
94           <td><input name=exporttype type=radio class=radio value=0 checked> |.$locale->text("Export Buchungsdaten").qq|</td>
95           <td></td>
96           
97           <td><input name=exporttype type=radio class=radio value=1> |.$locale->text("Export Stammdaten").qq|</td>
98           <td></td>
99         </td>
100       </table>
101     </td>
102   </tr>
103   <tr>
104     <td><hr size=3 noshade></td>
105   </tr>
106 </table>
107
108 <input type=hidden name=nextsub value=export2>
109
110 <input type=hidden name=path value=$form->{path}>
111 <input type=hidden name=login value=$form->{login}>
112 <input type=hidden name=password value=$form->{password}>
113
114 <br>
115 <input type=submit class=submit name=action value="|.$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 {&export_stammdaten();}
130   $lxdebug->leave_sub();
131 }
132
133 sub export_bewegungsdaten {
134   $lxdebug->enter_sub();
135
136
137   $form->{title} = $locale->text("DATEX - Export Assistent");
138
139   $form->{allemonate}=qq|<option value=1>|.$locale->text('January').qq|</option>
140                          <option value=2>|.$locale->text('February').qq|</option>
141                          <option value=3>|.$locale->text('March').qq|</option>
142                          <option value=4>|.$locale->text('April').qq|</option>
143                          <option value=5>|.$locale->text('May').qq|</option>
144                          <option value=6>|.$locale->text('June').qq|</option>
145                          <option value=7>|.$locale->text('July').qq|</option>
146                          <option value=8>|.$locale->text('August').qq|</option>
147                          <option value=9>|.$locale->text('September').qq|</option>
148                          <option value=10>|.$locale->text('October').qq|</option>
149                          <option value=11>|.$locale->text('November').qq|</option>
150                          <option value=12>|.$locale->text('December').qq|</option>|;
151     
152     $form->{allequartale}=qq|<option selected value=1>|.$locale->text('I').qq|</option>
153                          <option value=2>|.$locale->text('II').qq|</option>
154                          <option value=3>|.$locale->text('III').qq|</option>
155                          <option value=4>|.$locale->text('IV').qq|</option>|;
156   $form->header;
157   
158   print qq|
159 <body>
160
161 <form method=post action=$form->{script}>
162
163
164 <table width=100%>
165   <tr>
166     <th class=listtop>$form->{title}</th>
167   </tr>
168   <tr>
169     <th align=left>|.$locale->text("Zeitraum").qq|</th>
170   </tr>
171   <tr height="5"></tr>
172   <tr valign=top>
173     <td>
174       <table>
175         <tr>
176           <td align=left><input checked name=zeitraum class=radio type=radio value=monat>&nbsp;</td><td align=left>|.$locale->text('Monat').qq|</td>
177           <td align=left></td>
178           <td align=left></td>
179           <td align=left><select name=monat>$form->{allemonate}</select></td>
180         </tr>
181         <tr>  
182           <td align=left><input name=zeitraum class=radio type=radio value=quartal>&nbsp;</td><td align=left>|.$locale->text('Quartal').qq|</td>
183           <td align=left></td>
184           <td align=left></td>
185           <td align=left><select name=quartal>$form->{allequartale}</select></td>
186         </tr>
187         <tr> 
188           <td align=left><input name=zeitraum class=radio type=radio value=zeit>&nbsp;</td><td align=left>|.$locale->text('Datum von').qq|</td>
189           <td align=left><input name=transdatefrom size=8></td>
190           <td align=left>|.$locale->text('bis').qq|</td>
191           <td align=left><input name=transdateto size=8></td>           
192         </tr>
193       </table>
194     </td>
195   </tr>
196   <tr>
197     <td><hr size=3 noshade></td>
198   </tr>
199 </table>
200
201 <input type=hidden name=beraternr value="$form->{beraternr}">
202 <input type=hidden name=dfvkz value="$form->{dfvkz}">
203 <input type=hidden name=beratername value="$form->{beratername}">
204 <input type=hidden name=passwort value="$form->{passwort}">
205 <input type=hidden name=mandantennr value="$form->{mandantennr}">
206 <input type=hidden name=datentraegernr value="$form->{datentraegernr}">
207 <input type=hidden name=kne value="$form->{kne}">
208 <input type=hidden name=abrechnungsnr value="$form->{abrechnungsnr}">
209
210 <input type=hidden name=exporttype value="$form->{exporttype}">
211
212 <input type=hidden name=nextsub value=export3>
213
214 <input type=hidden name=path value=$form->{path}>
215 <input type=hidden name=login value=$form->{login}>
216 <input type=hidden name=password value=$form->{password}>
217
218 <br>
219 <input type=submit class=submit name=action value="|.$locale->text('Continue').qq|">
220 </form>
221
222 </body>
223 </html>
224 |;
225
226   $lxdebug->leave_sub();
227 }
228
229 sub export_stammdaten {
230   $lxdebug->enter_sub();
231
232
233   $form->{title} = $locale->text("DATEX - Export Assistent");
234
235
236   $form->header;
237   
238   print qq|
239 <body>
240
241 <form method=post action=$form->{script}>
242 <table width=100%>
243   <tr>
244     <th class=listtop>$form->{title}</th>
245   </tr>
246   <tr>
247     <th align=left>|.$locale->text("Konten").qq|</th>
248   </tr>
249   <tr height="5"></tr>
250   <tr valign=top>
251     <td>
252       <table>
253         <tr>
254           <td align=left>|.$locale->text('Von Konto: ').qq|</td>
255           <td align=left><input name=accnofrom size=8 maxlength=8></td>
256         </tr>
257         <tr>
258           <td align=left>|.$locale->text('Bis Konto: ').qq|</td>
259           <td align=left><input name=accnoto size=8 maxlength=8></td>
260         </tr>
261       </table>
262     </td>
263   </tr>
264   <tr>
265     <td><hr size=3 noshade></td>
266   </tr>
267 </table>
268 <input type=hidden name=beraternr value="$form->{beraternr}">
269 <input type=hidden name=dfvkz value="$form->{dfvkz}">
270 <input type=hidden name=beratername value="$form->{beratername}">
271 <input type=hidden name=passwort value="$form->{passwort}">
272 <input type=hidden name=mandantennr value="$form->{mandantennr}">
273 <input type=hidden name=datentraegernr value="$form->{datentraegernr}">
274 <input type=hidden name=kne value="$form->{kne}">
275 <input type=hidden name=abrechnungsnr value="$form->{abrechnungsnr}">
276
277 <input type=hidden name=exporttype value="$form->{exporttype}">
278
279 <input type=hidden name=nextsub value=export3>
280
281 <input type=hidden name=path value=$form->{path}>
282 <input type=hidden name=login value=$form->{login}>
283 <input type=hidden name=password value=$form->{password}>
284
285 <br>
286 <input type=submit class=submit name=action value="|.$locale->text('Continue').qq|">
287 </form>
288
289 </body>
290 </html>
291 |;
292
293   $lxdebug->leave_sub();
294 }
295
296
297 sub export3 {
298   $lxdebug->enter_sub();
299
300   DATEV->save_datev_stamm(\%myconfig, \%$form);
301   
302   if ($form->{kne}) {
303   if (DATEV->kne_export(\%myconfig, \%$form)) {
304   $form->redirect($locale->text('KNE Export erfolgreich!'))}
305   } else {
306   if (DATEV->obe_export(\%myconfig, \%$form)) { 
307   $form->redirect($locale->text('OBE Export erfolgreich!'));}
308   }
309   $lxdebug->leave_sub();
310 }