+|;
+ }
+
+ 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=path value=$form->{path}>
+<input type=hidden name=login value=$form->{login}>
+<input type=hidden name=sessionid value=$form->{sessionid}>
+
+<input class=submit type=submit name=action value="|.$locale->text('Add Business').qq|">|;
+
+ if ($form->{menubar}) {
+ require "$form->{path}/menu.pl";
+ &menubar;
+ }
+
+ print qq|
+
+ </form>
+
+ </body>
+ </html>
+|;
+
+}
+
+
+sub business_header {
+
+ $form->{title} = $locale->text("$form->{title} Business");
+
+# $locale->text('Add Business')
+# $locale->text('Edit Business')
+
+ $form->{description} = $form->quote($form->{description});
+ $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>$form->{title}</th>
+ </tr>
+ <tr height="5"></tr>
+ <tr>
+ <td>
+ <table>
+ <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>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td><hr size=3 noshade></td>
+ </tr>
+</table>
+|;
+
+}
+
+
+sub save_business {
+
+ $form->isblank("description", $locale->text('Description missing!'));
+ AM->save_business(\%myconfig, \%$form);
+ $form->redirect($locale->text('Business saved!'));
+
+}
+
+
+sub delete_business {
+
+ AM->delete_business(\%myconfig, \%$form);
+ $form->redirect($locale->text('Business deleted!'));
+
+}
+
+
+
+sub add_sic {
+
+ $form->{title} = "Add";
+
+ $form->{callback} = "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback};
+
+ &sic_header;
+ &form_footer;
+
+}
+
+
+sub edit_sic {
+
+ $form->{title} = "Edit";
+
+ $form->{code} =~ s/\\'/'/g;
+ $form->{code} =~ s/\\\\/\\/g;
+
+ AM->get_sic(\%myconfig, \%$form);
+ $form->{id} = $form->{code};
+
+ &sic_header;
+
+ $form->{orphaned} = 1;
+ &form_footer;
+
+}
+
+
+sub list_sic {
+
+ AM->sic(\%myconfig, \%$form);
+
+ $href = "$form->{script}?action=list_sic&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
+
+ $form->sort_order();
+
+ $form->{callback} = "$form->{script}?action=list_sic&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
+
+ $callback = $form->escape($form->{callback});
+
+ $form->{title} = $locale->text('Standard Industrial Codes');
+
+ @column_index = $form->sort_columns(qw(code description));
+
+ $column_header{code} = qq|<th><a class=listheading href=$href&sort=code>|.$locale->text('Code').qq|</a></th>|;
+ $column_header{description} = qq|<th><a class=listheading href=$href&sort=description>|.$locale->text('Description').qq|</a></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;
+
+ if ($ref->{sictype} eq 'H') {
+ print qq|
+ <tr valign=top class=listheading>
+|;
+ $column_data{code} = qq|<th><a href=$form->{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{code}</th>|;
+ $column_data{description} = qq|<th>$ref->{description}</th>|;
+
+ } else {
+ print qq|
+ <tr valign=top class=listrow$i>
+|;
+
+ $column_data{code} = qq|<td><a href=$form->{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{code}</td>|;
+ $column_data{description} = qq|<td>$ref->{description}</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=sic>
+
+<input type=hidden name=path value=$form->{path}>
+<input type=hidden name=login value=$form->{login}>
+<input type=hidden name=sessionid value=$form->{sessionid}>
+
+<input class=submit type=submit name=action value="|.$locale->text('Add SIC').qq|">|;
+
+ if ($form->{menubar}) {
+ require "$form->{path}/menu.pl";
+ &menubar;
+ }
+
+ print qq|
+ </form>
+
+ </body>
+ </html>
+|;
+
+}
+
+
+sub sic_header {
+
+ $form->{title} = $locale->text("$form->{title} SIC");
+
+# $locale->text('Add SIC')
+# $locale->text('Edit SIC')
+
+ map { $form->{$_} = $form->quote($form->{$_}) } qw(code description);
+
+ $checked = ($form->{sictype} eq 'H') ? "checked" : "";
+
+ $form->header;
+
+ print qq|
+<body>
+
+<form method=post action=$form->{script}>
+
+<input type=hidden name=type value=sic>
+<input type=hidden name=id value="$form->{code}">
+
+<table width=100%>
+ <tr>
+ <th class=listtop colspan=2>$form->{title}</th>
+ </tr>
+ <tr height="5"></tr>
+ <tr>
+ <th align=right>|.$locale->text('Code').qq|</th>
+ <td><input name=code size=10 value="$form->{code}"></td>
+ <tr>
+ <tr>
+ <td></td>
+ <th align=left><input name=sictype type=checkbox style=checkbox value="H" $checked> |.$locale->text('Heading').qq|</th>
+ <tr>
+ <tr>
+ <th align=right>|.$locale->text('Description').qq|</th>
+ <td><input name=description size=60 value="$form->{description}"></td>
+ </tr>
+ <td colspan=2><hr size=3 noshade></td>
+ </tr>
+</table>
+|;
+
+}
+
+
+sub save_sic {
+
+ $form->isblank("code", $locale->text('Code missing!'));
+ $form->isblank("description", $locale->text('Description missing!'));
+ AM->save_sic(\%myconfig, \%$form);
+ $form->redirect($locale->text('SIC saved!'));
+
+}
+
+
+sub delete_sic {
+
+ AM->delete_sic(\%myconfig, \%$form);
+ $form->redirect($locale->text('SIC deleted!'));
+
+}
+
+
+sub add_language {
+
+ $form->{title} = "Add";
+
+ $form->{callback} = "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback};
+
+ &language_header;
+ &form_footer;
+
+}
+
+
+sub edit_language {
+
+ $form->{title} = "Edit";
+
+ $form->{code} =~ s/\\'/'/g;
+ $form->{code} =~ s/\\\\/\\/g;
+
+ AM->get_language(\%myconfig, \%$form);
+ $form->{id} = $form->{code};
+
+ &language_header;
+
+ $form->{orphaned} = 1;
+ &form_footer;
+
+}
+
+
+sub list_language {
+
+ AM->language(\%myconfig, \%$form);
+
+ $href = "$form->{script}?action=list_language&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
+
+ $form->sort_order();
+
+ $form->{callback} = "$form->{script}?action=list_language&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
+
+ $callback = $form->escape($form->{callback});
+
+ $form->{title} = $locale->text('Languages');
+
+ @column_index = $form->sort_columns(qw(code description));
+
+ $column_header{code} = qq|<th><a class=listheading href=$href&sort=code>|.$locale->text('Code').qq|</a></th>|;
+ $column_header{description} = qq|<th><a class=listheading href=$href&sort=description>|.$locale->text('Description').qq|</a></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{code} = qq|<td><a href=$form->{script}?action=edit_language&code=$ref->{code}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{code}</td>|;
+ $column_data{description} = qq|<td>$ref->{description}</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=path value=$form->{path}>
+<input type=hidden name=login value=$form->{login}>
+<input type=hidden name=sessionid value=$form->{sessionid}>
+
+<input class=submit type=submit name=action value="|.$locale->text('Add Language').qq|">|;
+
+ if ($form->{menubar}) {
+ require "$form->{path}/menu.pl";
+ &menubar;
+ }
+
+ print qq|
+ </form>
+
+ </body>
+ </html>
+|;
+
+}
+
+
+sub language_header {
+
+ $form->{title} = $locale->text("$form->{title} Language");
+
+# $locale->text('Add Language')
+# $locale->text('Edit Language')
+
+ map { $form->{$_} = $form->quote($form->{$_}) } qw(code description);
+
+ $form->header;
+
+ print qq|
+<body>
+
+<form method=post action=$form->{script}>
+
+<input type=hidden name=type value=language>
+<input type=hidden name=id value="$form->{code}">
+
+<table width=100%>
+ <tr>
+ <th class=listtop colspan=2>$form->{title}</th>
+ </tr>
+ <tr height="5"></tr>
+ <tr>
+ <th align=right>|.$locale->text('Code').qq|</th>
+ <td><input name=code size=10 value="$form->{code}"></td>
+ <tr>
+ <tr>
+ <th align=right>|.$locale->text('Description').qq|</th>
+ <td><input name=description size=60 value="$form->{description}"></td>
+ </tr>
+ <td colspan=2><hr size=3 noshade></td>
+ </tr>
+</table>
+|;
+
+}
+
+
+sub save_language {
+
+ $form->isblank("code", $locale->text('Code missing!'));
+ $form->isblank("description", $locale->text('Description missing!'));
+ AM->save_language(\%myconfig, \%$form);
+ $form->redirect($locale->text('Language saved!'));
+
+}
+
+
+sub delete_language {
+
+ AM->delete_language(\%myconfig, \%$form);
+ $form->redirect($locale->text('Language deleted!'));
+
+}
+
+
+sub display_stylesheet {
+
+ $form->{file} = "css/$myconfig{stylesheet}";
+ &display_form;
+
+}
+
+
+sub display_form {
+
+ $form->{file} =~ s/^(.:)*?\/|\.\.\///g;
+ $form->{file} =~ s/^\/*//g;
+ $form->{file} =~ s/$userspath//;
+
+ $form->error("$!: $form->{file}") unless -f $form->{file};
+
+ AM->load_template(\%$form);
+
+ $form->{title} = $form->{file};
+
+ # if it is anything but html
+ if ($form->{file} !~ /\.html$/) {
+ $form->{body} = "<pre>\n$form->{body}\n</pre>";
+ }
+
+ $form->header;
+
+ print qq|
+<body>
+
+$form->{body}
+
+<form method=post action=$form->{script}>
+
+<input name=file type=hidden value=$form->{file}>
+<input name=type type=hidden value=template>
+
+<input type=hidden name=path value=$form->{path}>
+<input type=hidden name=login value=$form->{login}>
+<input type=hidden name=sessionid value=$form->{sessionid}>
+
+<input name=action type=submit class=submit value="|.$locale->text('Edit').qq|">|;
+
+ if ($form->{menubar}) {
+ require "$form->{path}/menu.pl";
+ &menubar;
+ }
+
+ print qq|
+ </form>
+
+</body>
+</html>
+|;
+
+}
+
+
+sub edit_template {
+
+ AM->load_template(\%$form);
+
+ $form->{title} = $locale->text('Edit Template');
+ # convert   to &nbsp;
+ $form->{body} =~ s/ /&nbsp;/gi;
+
+
+ $form->header;
+
+ print qq|
+<body>
+
+<form method=post action=$form->{script}>
+
+<input name=file type=hidden value=$form->{file}>
+<input name=type type=hidden value=template>
+
+<input type=hidden name=path value=$form->{path}>
+<input type=hidden name=login value=$form->{login}>
+<input type=hidden name=sessionid value=$form->{sessionid}>
+
+<input name=callback type=hidden value="$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}">
+
+<textarea name=body rows=25 cols=70>
+$form->{body}
+</textarea>
+
+<br>
+<input type=submit class=submit name=action value="|.$locale->text('Save').qq|">|;
+
+ if ($form->{menubar}) {
+ require "$form->{path}/menu.pl";
+ &menubar;
+ }
+
+ print q|
+ </form>
+
+
+</body>
+</html>
+|;
+
+}
+
+
+sub save_template {
+
+ AM->save_template(\%$form);
+ $form->redirect($locale->text('Template saved!'));
+
+}
+
+
+sub defaults {
+
+ # get defaults for account numbers and last numbers
+ AM->defaultaccounts(\%myconfig, \%$form);
+
+ foreach $key (keys %{ $form->{IC} }) {
+ foreach $accno (sort keys %{ $form->{IC}{$key} }) {
+ $form->{account}{$key} .= ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key}) ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n" : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
+ }
+ }
+
+ $form->{title} = $locale->text('System Defaults');
+
+ $form->header;
+
+ print qq|
+<body>
+
+<form method=post action=$form->{script}>
+
+<input type=hidden name=type value=defaults>
+
+<table width=100%>
+ <tr><th class=listtop>$form->{title}</th></tr>
+ <tr>
+ <td>
+ <table>