- $form->{invsubtotal} =
- $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
-
- $subtotal = qq|
- <tr>
- <th align=right>| . $locale->text('Subtotal') . qq|</th>
- <td align=right>$form->{invsubtotal}</td>
- </tr>
-|;
-
- }
-
- if ($form->{taxincluded}) {
- foreach $item (split / /, $form->{taxaccounts}) {
- if ($form->{"${item}_base"}) {
- $form->{"${item}_total"} =
- $form->round_amount(
- ($form->{"${item}_base"} * $form->{"${item}_rate"} /
- (1 + $form->{"${item}_rate"})
- ),
- 2);
- $form->{"${item}_netto"} =
- $form->round_amount(
- ($form->{"${item}_base"} - $form->{"${item}_total"}),
- 2);
- $form->{"${item}_total"} =
- $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
- $form->{"${item}_netto"} =
- $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2);
-
- $tax .= qq|
- <tr>
- <th align=right>Enthaltene $form->{"${item}_description"}</th>
- <td align=right>$form->{"${item}_total"}</td>
- </tr>
- <tr>
- <th align=right>Nettobetrag</th>
- <td align=right>$form->{"${item}_netto"}</td>
- </tr>
-|;
- }
- }
-
- }
-
- $form->{oldinvtotal} = $form->{invtotal};
- $form->{invtotal} =
- $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
-
- print qq|
- <tr>
- <td>
- <table width=100%>
- <tr valign=bottom>
- <td>
- <table>
- <tr>
- <th align=left>| . $locale->text('Notes') . qq|</th>
- <th align=left>| . $locale->text('Internal Notes') . qq|</th>
- </tr>
- <tr valign=top>
- <td>$notes</td>
- <td>$intnotes</td>
- </tr>
- </table>
- </td>
- <td align=right width=100%>
- $taxincluded
- <table width=100%>
- $subtotal
- $tax
- <tr>
- <th align=right>| . $locale->text('Total') . qq|</th>
- <td align=right>$form->{invtotal}</td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-<input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
-<input type=hidden name=oldtotalpaid value=$totalpaid>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-|;
-
- if ($webdav) {
- $webdav_list = qq|
-
- <tr>
- <th class=listtop align=left>Dokumente im Webdav-Repository</th>
- </tr>
- <table width=100%>
- <td align=left width=30%><b>Dateiname</b></td>
- <td align=left width=70%><b>Webdavlink</b></td>
-|;
- foreach $file (keys %{ $form->{WEBDAV} }) {
- $webdav_list .= qq|
- <tr>
- <td align=left>$file</td>
- <td align=left><a href="$form->{WEBDAV}{$file}">$form->{WEBDAV}{$file}</a></td>
- </tr>
-|;
- }
- $webdav_list .= qq|
- </table>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-|;
-
- print $webdav_list;
- }
- print qq|
-<input type=hidden name=jscalendar value=$form->{jscalendar}>
-|;
- print qq|
- <tr>
- <td>
-|;
- &print_options;
-
- print qq|
- </td>
- </tr>
-</table>
-
-Bearbeiten des $form->{heading}<br>
-<input class=submit type=submit name=action value="|
- . $locale->text('Update') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('Ship to') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('Print') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('E-mail') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('Save') . qq|">
-|;
-
- if ($form->{id}) {
- print qq|
-<br>Workflow $form->{heading}<br>
-<input class=submit type=submit name=action value="|
- . $locale->text('Save as new') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('Delete') . qq|">|;
- if ($form->{type} =~ /sales_quotation$/) {
- print qq|
-<input class=submit type=submit name=action value="|
- . $locale->text('Sales Order') . qq|">|;
- }
- if ($form->{type} =~ /request_quotation$/) {
- print qq|
-<input class=submit type=submit name=action value="|
- . $locale->text('Purchase Order') . qq|">|;
- }
- print qq|
-<input class=submit type=submit name=action value="|
- . $locale->text('Invoice') . qq|">
-|;
-
- if ($form->{type} =~ /sales_order$/) {
- print qq|
-<br>$form->{heading} als neue Vorlage verwenden für<br>
-<input class=submit type=submit name=action value="|
- . $locale->text('Purchase Order') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('Quotation') . qq|">
-|;
-
- } elsif ($form->{type} =~ /purchase_order$/) {
- print qq|
-<br>$form->{heading} als neue Vorlage verwenden für<br>
-<input class=submit type=submit name=action value="|
- . $locale->text('Sales Order') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('Quotation') . qq|">
-|;
-
- } else {
- print qq|
-<br>$form->{heading} als neue Vorlage verwenden für<br>
-<input class=submit type=submit name=action value="|
- . $locale->text('Order') . qq|">
-|;
- }
- } elsif ($form->{type} =~ /sales_order$/ && $form->{rowcount}) {
- print qq|
-<br>Workflow $form->{heading}<br>
-<input class=submit type=submit name=action value="|
- . $locale->text('Save as new') . qq|">
-<input class=submit type=submit name=action value="|
- . $locale->text('Invoice') . qq|">
-|;
- }
-
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
-
-<input type=hidden name=rowcount value=$form->{rowcount}>
-
-<input name=callback type=hidden value="$form->{callback}">
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
-
-</form>
-
-</body>
-</html>
-|;
- $lxdebug->leave_sub();
-}
-
-sub update {
- $lxdebug->enter_sub();
-
- map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
- qw(exchangerate creditlimit creditremaining);
-
- &check_name($form->{vc});
-
- &check_project;
-
- $buysell = 'buy';
- $buysell = 'sell' if ($form->{vc} eq 'vendor');
- $form->{exchangerate} = $exchangerate
- if (
- $form->{forex} = (
- $exchangerate =
- $form->check_exchangerate(
- \%myconfig, $form->{currency}, $form->{transdate}, $buysell
- )));
-
- # for pricegroups
- $i = $form->{rowcount};
-
- $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
-
- if ( ($form->{"partnumber_$i"} eq "")
- && ($form->{"description_$i"} eq "")
- && ($form->{"partsgroup_$i"} eq "")) {
-
- $form->{creditremaining} += ($form->{oldinvtotal} - $form->{oldtotalpaid});
- &check_form;
-
- } else {
-
- if ( $form->{type} eq 'purchase_order'
- || $form->{type} eq 'request_quotation') {
- IR->retrieve_item(\%myconfig, \%$form);
- }
- if ($form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') {
- IS->retrieve_item(\%myconfig, \%$form);
- }
-
- my $rows = scalar @{ $form->{item_list} };
-
- $form->{"discount_$i"} =
- $form->format_amount(\%myconfig, $form->{discount} * 100);
-
- if ($rows) {
- $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
-
- if ($rows > 1) {
-
- &select_item;
- exit;
-
- } else {
-
- $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
-
- map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
- qw(partnumber description unit);
- map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
- keys %{ $form->{item_list}[0] };
-
- $s = ($sellprice) ? $sellprice : $form->{"sellprice_$i"};
-
- ($dec) = ($s =~ /\.(\d+)/);
- $dec = length $dec;
- $decimalplaces = ($dec > 2) ? $dec : 2;
-
- if ($sellprice) {
- $form->{"sellprice_$i"} = $sellprice;
- } else {
-
- $form->{"sellprice_$i"} *= (1 - $form->{tradediscount});
- # if there is an exchange rate adjust sellprice
- $form->{"sellprice_$i"} /= $exchangerate;
- }
-
- $amount =
- $form->{"sellprice_$i"} * $form->{"qty_$i"} *
- (1 - $form->{"discount_$i"} / 100);
- map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
- map { $form->{"${_}_base"} += $amount }
- (split / /, $form->{"taxaccounts_$i"});
- map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
- split / /, $form->{taxaccounts}
- if !$form->{taxincluded};