+ $form->{title} = $locale->text('Type of Business');
+
+ @column_index = qw(description discount customernumberinit);
+
+ $column_header{description} =
+ qq|<th class=listheading width=60%>|
+ . $locale->text('Description')
+ . qq|</th>|;
+ $column_header{discount} =
+ qq|<th class=listheading width=10%>|
+ . $locale->text('Discount')
+ . qq| %</th>|;
+ $column_header{customernumberinit} =
+ qq|<th class=listheading>|
+ . $locale->text('Customernumberinit')
+ . qq|</th>|;
+
+ $form->header;
+
+ print qq|
+<body>
+
+<table width=100%>
+ <tr>
+ <th class=listtop>$form->{title}</th>
+ </tr>
+ <tr height="5"></tr>
+ <tr>
+ <td>
+ <table width=100%>
+ <tr class=listheading>
+|;
+
+ map { print "$column_header{$_}\n" } @column_index;
+
+ print qq|
+ </tr>
+|;
+
+ foreach $ref (@{ $form->{ALL} }) {
+
+ $i++;
+ $i %= 2;
+
+ print qq|
+ <tr valign=top class=listrow$i>
+|;
+
+ $discount =
+ $form->format_amount(\%myconfig, $ref->{discount} * 100);
+ $description =
+ $ref->{description};
+ $column_data{description} =
+ qq|<td><a href=$form->{script}?action=edit_business&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$description</td>|;
+ $column_data{discount} = qq|<td align=right>$discount</td>|;
+ $column_data{customernumberinit} =
+ qq|<td align=right>$ref->{customernumberinit}</td>|;
+
+ map { print "$column_data{$_}\n" } @column_index;
+
+ print qq|
+ </tr>
+|;
+ }
+
+ print qq|
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td><hr size=3 noshade></td>
+ </tr>
+</table>
+
+<br>
+<form method=post action=$form->{script}>
+
+<input name=callback type=hidden value="$form->{callback}">
+
+<input type=hidden name=type value=business>
+
+<input type=hidden name=login value=$form->{login}>
+<input type=hidden name=password value=$form->{password}>
+
+<input class=submit type=submit name=action value="|
+ . $locale->text('Add') . qq|">
+
+ </form>
+
+ </body>
+ </html>
+|;
+
+ $lxdebug->leave_sub();
+}
+
+sub business_header {
+ $lxdebug->enter_sub();
+
+ $form->{title} = $locale->text("$form->{title} Business");
+
+ # $locale->text('Add Business')
+ # $locale->text('Edit Business')
+
+ $form->{description} =~ s/\"/"/g;
+ $form->{discount} =
+ $form->format_amount(\%myconfig, $form->{discount} * 100);
+
+ $form->header;
+
+ print qq|
+<body>
+
+<form method=post action=$form->{script}>
+
+<input type=hidden name=id value=$form->{id}>
+<input type=hidden name=type value=business>
+
+<table width=100%>
+ <tr>
+ <th class=listtop colspan=2>$form->{title}</th>
+ </tr>
+ <tr height="5"></tr>
+ <tr>
+ <th align=right>| . $locale->text('Type of Business') . qq|</th>
+ <td><input name=description size=30 value="$form->{description}"></td>
+ <tr>
+ <tr>
+ <th align=right>| . $locale->text('Discount') . qq| %</th>
+ <td><input name=discount size=5 value=$form->{discount}></td>
+ </tr>
+ <tr>
+ <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
+ <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
+ </tr>
+ <td colspan=2><hr size=3 noshade></td>
+ </tr>
+</table>
+|;
+
+ $lxdebug->leave_sub();
+}
+
+sub save_business {
+ $lxdebug->enter_sub();
+
+ $form->isblank("description", $locale->text('Description missing!'));
+ $form->{discount} = $form->parse_amount(\%myconfig, $form->{discount}) / 100;
+ AM->save_business(\%myconfig, \%$form);
+ $form->redirect($locale->text('Business saved!'));
+
+ $lxdebug->leave_sub();
+}
+
+sub delete_business {
+ $lxdebug->enter_sub();
+
+ AM->delete_business(\%myconfig, \%$form);
+ $form->redirect($locale->text('Business deleted!'));
+
+ $lxdebug->leave_sub();
+}
+
+sub add_language {
+ $lxdebug->enter_sub();
+
+ $form->{title} = "Add";
+
+ $form->{callback} =
+ "$form->{script}?action=add_language&login=$form->{login}&password=$form->{password}"
+ unless $form->{callback};
+
+ &language_header;
+ &form_footer;
+
+ $lxdebug->leave_sub();
+}
+
+sub edit_language {
+ $lxdebug->enter_sub();
+
+ $form->{title} = "Edit";
+
+ AM->get_language(\%myconfig, \%$form);
+
+ &language_header;
+
+ $form->{orphaned} = 1;
+ &form_footer;
+
+ $lxdebug->leave_sub();
+}
+
+sub list_language {
+ $lxdebug->enter_sub();
+
+ AM->language(\%myconfig, \%$form);
+
+ $form->{callback} =
+ "$form->{script}?action=list_language&login=$form->{login}&password=$form->{password}";
+
+ $callback = $form->escape($form->{callback});
+
+ $form->{title} = $locale->text('Languages');
+
+ @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates);
+
+ $column_header{description} =
+ qq|<th class=listheading width=60%>|
+ . $locale->text('Description')
+ . qq|</th>|;
+ $column_header{template_code} =
+ qq|<th class=listheading width=10%>|
+ . $locale->text('Template Code')
+ . qq|</th>|;
+ $column_header{article_code} =
+ qq|<th class=listheading>|
+ . $locale->text('Article Code')
+ . qq|</th>|;
+ $column_header{output_numberformat} =
+ qq|<th class=listheading>|
+ . $locale->text('Number Format')
+ . qq|</th>|;
+ $column_header{output_dateformat} =
+ qq|<th class=listheading>|
+ . $locale->text('Date Format')
+ . qq|</th>|;
+ $column_header{output_longdates} =
+ qq|<th class=listheading>|
+ . $locale->text('Long Dates')
+ . qq|</th>|;
+
+ $form->header;
+
+ print qq|
+<body>
+
+<table width=100%>
+ <tr>
+ <th class=listtop>$form->{title}</th>
+ </tr>
+ <tr height="5"></tr>
+ <tr>
+ <td>
+ <table width=100%>
+ <tr class=listheading>
+|;
+
+ map { print "$column_header{$_}\n" } @column_index;
+
+ print qq|
+ </tr>
+|;
+
+ foreach $ref (@{ $form->{ALL} }) {
+
+ $i++;
+ $i %= 2;
+
+ print qq|
+ <tr valign=top class=listrow$i>
+|;
+
+
+ $column_data{description} =
+ qq|<td><a href=$form->{script}?action=edit_language&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
+ $column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
+ $column_data{article_code} =
+ qq|<td align=right>$ref->{article_code}</td>|;
+ $column_data{output_numberformat} =
+ "<td nowrap>" .
+ ($ref->{output_numberformat} ? $ref->{output_numberformat} :
+ $locale->text("use program settings")) .
+ "</td>";
+ $column_data{output_dateformat} =
+ "<td nowrap>" .
+ ($ref->{output_dateformat} ? $ref->{output_dateformat} :
+ $locale->text("use program settings")) .
+ "</td>";
+ $column_data{output_longdates} =
+ "<td nowrap>" .
+ ($ref->{output_longdates} ? $locale->text("Yes") : $locale->text("No")) .
+ "</td>";
+
+ map { print "$column_data{$_}\n" } @column_index;
+
+ print qq|
+ </tr>
+|;
+ }
+
+ print qq|
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td><hr size=3 noshade></td>
+ </tr>
+</table>
+
+<br>
+<form method=post action=$form->{script}>
+
+<input name=callback type=hidden value="$form->{callback}">
+
+<input type=hidden name=type value=language>
+
+<input type=hidden name=login value=$form->{login}>
+<input type=hidden name=password value=$form->{password}>
+
+<input class=submit type=submit name=action value="|
+ . $locale->text('Add') . qq|">
+
+ </form>
+
+ </body>
+ </html>
+|;
+
+ $lxdebug->leave_sub();
+}
+
+sub language_header {
+ $lxdebug->enter_sub();
+
+ $form->{title} = $locale->text("$form->{title} Language");
+
+ # $locale->text('Add Language')
+ # $locale->text('Edit Language')
+
+ $form->{description} =~ s/\"/"/g;
+ $form->{template_code} =~ s/\"/"/g;
+ $form->{article_code} =~ s/\"/"/g;
+
+
+ $form->header;
+
+ my $numberformat =
+ qq|<option value="">| . $locale->text("use program settings") .
+ qq|</option>|;
+ foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
+ $numberformat .=
+ ($item eq $form->{output_numberformat})
+ ? "<option selected>$item"
+ : "<option>$item"
+ . "</option>";
+ }
+
+ my $dateformat =
+ qq|<option value="">| . $locale->text("use program settings") .
+ qq|</option>|;
+ foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
+ $dateformat .=
+ ($item eq $form->{output_dateformat})
+ ? "<option selected>$item"
+ : "<option>$item"
+ . "</option>";
+ }
+
+ print qq|
+<body>
+
+<form method=post action=$form->{script}>
+
+<input type=hidden name=id value=$form->{id}>
+<input type=hidden name=type value=language>
+
+<table width=100%>
+ <tr>
+ <th class=listtop colspan=2>$form->{title}</th>
+ </tr>
+ <tr height="5"></tr>
+ <tr>
+ <th align=right>| . $locale->text('Language') . qq|</th>
+ <td><input name=description size=30 value="| . $form->quote($form->{description}) . qq|"></td>
+ <tr>
+ <tr>
+ <th align=right>| . $locale->text('Template Code') . qq|</th>
+ <td><input name=template_code size=5 value="| . $form->quote($form->{template_code}) . qq|"></td>
+ </tr>
+ <tr>
+ <th align=right>| . $locale->text('Article Code') . qq|</th>
+ <td><input name=article_code size=10 value="| . $form->quote($form->{article_code}) . qq|"></td>
+ </tr>
+ <tr>
+ <th align=right>| . $locale->text('Number Format') . qq|</th>
+ <td><select name="output_numberformat">$numberformat</select></td>
+ </tr>
+ <tr>
+ <th align=right>| . $locale->text('Date Format') . qq|</th>
+ <td><select name="output_dateformat">$dateformat</select></td>
+ </tr>
+ <tr>
+ <th align=right>| . $locale->text('Long Dates') . qq|</th>
+ <td><input type="radio" name="output_longdates" value="1"| .
+ ($form->{output_longdates} ? " checked" : "") .
+ qq|>| . $locale->text("Yes") .
+ qq|<input type="radio" name="output_longdates" value="0"| .
+ ($form->{output_longdates} ? "" : " checked") .
+ qq|>| . $locale->text("No") .
+ qq|</td>
+ </tr>
+ <td colspan=2><hr size=3 noshade></td>
+ </tr>
+</table>
+|;
+
+ $lxdebug->leave_sub();
+}
+
+sub save_language {
+ $lxdebug->enter_sub();
+
+ $form->isblank("description", $locale->text('Language missing!'));
+ $form->isblank("template_code", $locale->text('Template Code missing!'));
+ $form->isblank("article_code", $locale->text('Article Code missing!'));
+ AM->save_language(\%myconfig, \%$form);
+ $form->redirect($locale->text('Language saved!'));
+
+ $lxdebug->leave_sub();
+}
+
+sub delete_language {
+ $lxdebug->enter_sub();
+
+ AM->delete_language(\%myconfig, \%$form);
+ $form->redirect($locale->text('Language deleted!'));
+
+ $lxdebug->leave_sub();
+}
+
+
+sub add_buchungsgruppe {
+ $lxdebug->enter_sub();
+
+ # $locale->text("Add Buchungsgruppe")
+ # $locale->text("Edit Buchungsgruppe")
+ $form->{title} = "Add";
+
+ $form->{callback} =
+ "$form->{script}?action=add_buchungsgruppe&login=$form->{login}&password=$form->{password}"
+ unless $form->{callback};
+ AM->get_buchungsgruppe(\%myconfig, \%$form);
+ $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"};
+ for (my $i = 0; 4 > $i; $i++) {
+ map({ $form->{"${_}_accno_id_$i"} = $form->{"std_${_}_accno_id"}; }
+ qw(income expense));
+ }
+
+ &buchungsgruppe_header;
+ &form_footer;
+
+ $lxdebug->leave_sub();
+}
+
+sub edit_buchungsgruppe {
+ $lxdebug->enter_sub();
+
+ $form->{title} = "Edit";
+
+ AM->get_buchungsgruppe(\%myconfig, \%$form);
+
+ &buchungsgruppe_header;
+
+ &form_footer;
+
+ $lxdebug->leave_sub();
+}
+
+sub list_buchungsgruppe {
+ $lxdebug->enter_sub();
+
+ AM->buchungsgruppe(\%myconfig, \%$form);
+
+ $form->{callback} =
+ "$form->{script}?action=list_buchungsgruppe&login=$form->{login}&password=$form->{password}";
+
+ $callback = $form->escape($form->{callback});
+
+ $form->{title} = $locale->text('Buchungsgruppen');