X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fir.pl;h=1515fa450dda1133dbb539fac95b397fc21d04a2;hb=1b3fe156b5ddfd588c1e55af5e21a36e84d9caf8;hp=f6df8494ba2ad69230f6c984ab28a53a41e5b97a;hpb=4dbb09950c9f5596646537c12d991c99086fe7c1;p=kivitendo-erp.git
diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl
index f6df8494b..1515fa450 100644
--- a/bin/mozilla/ir.pl
+++ b/bin/mozilla/ir.pl
@@ -31,69 +31,96 @@
#
#======================================================================
-
use SL::IR;
use SL::PE;
-
require "$form->{path}/io.pl";
require "$form->{path}/arap.pl";
+require "$form->{path}/common.pl";
+require "bin/mozilla/drafts.pl";
1;
-# end of main
-
+# end of main
sub add {
$lxdebug->enter_sub();
+ return $lxdebug->leave_sub() if (load_draft_maybe());
+
$form->{title} = $locale->text('Add Vendor Invoice');
&invoice_links;
&prepare_invoice;
&display_form;
-
+
$lxdebug->leave_sub();
}
-
sub edit {
$lxdebug->enter_sub();
-
+
+ # show history button
+ $form->{javascript} = qq||;
+ #/show hhistory button
+
$form->{title} = $locale->text('Edit Vendor Invoice');
&invoice_links;
&prepare_invoice;
&display_form;
-
+
$lxdebug->leave_sub();
}
-
sub invoice_links {
$lxdebug->enter_sub();
# create links
$form->{webdav} = $webdav;
-
+
# set jscalendar
$form->{jscalendar} = $jscalendar;
-
+
$form->create_links("AP", \%myconfig, "vendor");
+ #quote all_vendor Bug 133
+ foreach $ref (@{ $form->{all_vendor} }) {
+ $ref->{name} = $form->quote($ref->{name});
+ }
+
if ($form->{all_vendor}) {
unless ($form->{vendor_id}) {
$form->{vendor_id} = $form->{all_vendor}->[0]->{id};
}
}
-
+ if ($form->{payment_id}) {
+ $payment_id = $form->{payment_id};
+ }
+ if ($form->{language_id}) {
+ $language_id = $form->{language_id};
+ }
+ if ($form->{taxzone_id}) {
+ $taxzone_id = $form->{taxzone_id};
+ }
+
$cp_id = $form->{cp_id};
IR->get_vendor(\%myconfig, \%$form);
IR->retrieve_invoice(\%myconfig, \%$form);
$form->{cp_id} = $cp_id;
-
+
+ if ($payment_id) {
+ $form->{payment_id} = $payment_id;
+ }
+ if ($language_id) {
+ $form->{language_id} = $language_id;
+ }
+ if ($taxzone_id) {
+ $form->{taxzone_id} = $taxzone_id;
+ }
+
# currencies
- @curr = split /:/, $form->{currencies};
+ @curr = split(/:/, $form->{currencies});
chomp $curr[0];
$form->{defaultcurrency} = $curr[0];
@@ -102,23 +129,27 @@ sub invoice_links {
$form->{oldvendor} = "$form->{vendor}--$form->{vendor_id}";
# vendors
- if ($form->{all_vendor}) {
+ if (@{ $form->{all_vendor} }) {
$form->{vendor} = "$form->{vendor}--$form->{vendor_id}";
- map { $form->{selectvendor} .= "";
+ } else {
+ $form->{selecttaxzone} .=
+ "";
+ }
+
+ }
+ } else {
+ $form->{selecttaxzone} =~ s/ selected//g;
+ if ($form->{taxzone_id} ne "") {
+ $form->{selecttaxzone} =~ s/value=$form->{taxzone_id}/value=$form->{taxzone_id} selected/;
+ }
+ }
+
+ $taxzone = qq|
+
+ | . $locale->text('Steuersatz') . qq| |
+ |
+
+
|;
+
+
+
+ $vendor =
+ ($form->{selectvendor})
+ ? qq|\n|
+ : qq||;
+
$department = qq|
- |.$locale->text('Department').qq| |
+ | . $locale->text('Department') . qq| |
|
@@ -247,27 +345,40 @@ sub form_header {
# use JavaScript Calendar or not
$form->{jsscript} = $form->{jscalendar};
$jsscript = "";
- if ($form->{jsscript})
- {
+ if ($form->{jsscript}) {
+
# with JavaScript Calendar
$button1 = qq|
{invdate}> |
- text('button').qq|> |
+ text('button') . qq|> |
|;
- $button2 = qq|
+ $button2 = qq|
{duedate}> |
- text('button').qq|> |
+ text('button') . qq|> |
|;
- #write Trigger
- $jsscript = Form->write_trigger(\%myconfig,"2","invdate","BL","trigger1","duedate","BL","trigger2");
- }
- else
- {
- # without JavaScript Calendar
- $button1 = qq|{invdate}> | |;
- $button2 = qq|{duedate}> | |;
- }
-
+
+ #write Trigger
+ $jsscript =
+ Form->write_trigger(\%myconfig, "2", "invdate", "BL", "trigger1",
+ "duedate", "BL", "trigger2");
+ } else {
+
+ # without JavaScript Calendar
+ $button1 =
+ qq|{invdate}> | |;
+ $button2 =
+ qq|{duedate}> | |;
+ }
+
+ $form->{"javascript"} .= qq||;
+
+ $jsscript .=
+ $form->write_trigger(\%myconfig, 2,
+ "orddate", "BL", "trigger_orddate",
+ "quodate", "BL", "trigger_quodate");
+
$form->header;
print qq|
@@ -279,6 +390,7 @@ sub form_header {
{type}>
+{level}>
{creditlimit}>
{creditremaining}>
@@ -287,7 +399,10 @@ sub form_header {
{locked}>
{shipped}>
+{storno}>
+{storno_id}>
+| . ($form->{saved_message} ? qq|$form->{saved_message}
| : "") . qq|
@@ -301,12 +416,13 @@ sub form_header {
|
@@ -364,7 +495,7 @@ sub form_header {
$jsscript
-
+
{defaultcurrency}>
{fxgain_accno}>
@@ -387,13 +518,11 @@ $jsscript
$lxdebug->leave_sub();
}
-
-
sub form_footer {
$lxdebug->enter_sub();
$form->{invtotal} = $form->{invsubtotal};
-
+
if (($rows = $form->numtextrows($form->{notes}, 25, 8)) < 2) {
$rows = 2;
}
@@ -401,26 +530,33 @@ sub form_footer {
$introws = 2;
}
$rows = ($rows > $introws) ? $rows : $introws;
- $notes = qq||;
- $intnotes = qq||;
-
+ $notes =
+ qq||;
+ $intnotes =
+ qq||;
+
$form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
$taxincluded = "";
if ($form->{taxaccounts}) {
$taxincluded = qq|
- {taxincluded}> |.$locale->text('Tax Included').qq|
+ {taxincluded}> |
+ . $locale->text('Tax Included') . qq|
|;
}
-
+
if (!$form->{taxincluded}) {
-
+
foreach $item (split / /, $form->{taxaccounts}) {
if ($form->{"${item}_base"}) {
- $form->{invtotal} += $form->{"${item}_total"} = $form->round_amount($form->{"${item}_base"} * $form->{"${item}_rate"}, 2);
- $form->{"${item}_total"} = $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
-
- $tax .= qq|
+ $form->{invtotal} += $form->{"${item}_total"} =
+ $form->round_amount(
+ $form->{"${item}_base"} * $form->{"${item}_rate"},
+ 2);
+ $form->{"${item}_total"} =
+ $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
+
+ $tax .= qq|
$form->{"${item}_description"} |
$form->{"${item}_total"} |
@@ -428,30 +564,40 @@ sub form_footer {
|;
}
}
-
+ $form->{invsubtotal} =
+ $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
- $form->{invsubtotal} = $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
-
$subtotal = qq|
- |.$locale->text('Subtotal').qq| |
+ | . $locale->text('Subtotal') . qq| |
$form->{invsubtotal} |
|;
}
-
+
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}_base"} = $form->round_amount($form->{"${item}_base"}, 2);
- $form->{"${item}_netto"} = $form->round_amount(($form->{"${item}_base"}-$form->{"${item}_total"}), 2);
- $form->{"${item}_netto"} = $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2);
- $form->{"${item}_total"} = $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
-
- $tax .= qq|
+ 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}_base"} =
+ $form->round_amount($form->{"${item}_base"}, 2);
+ $form->{"${item}_netto"} =
+ $form->round_amount(
+ ($form->{"${item}_base"} - $form->{"${item}_total"}),
+ 2);
+ $form->{"${item}_netto"} =
+ $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2);
+ $form->{"${item}_total"} =
+ $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
+
+ $tax .= qq|
Enthaltene $form->{"${item}_description"} |
$form->{"${item}_total"} |
@@ -463,12 +609,12 @@ sub form_footer {
|;
}
}
-
-
+
}
- $form->{oldinvtotal} = $form->{invtotal};
- $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
+ $form->{oldinvtotal} = $form->{invtotal};
+ $form->{invtotal} =
+ $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
print qq|
@@ -478,8 +624,8 @@ sub form_footer {
- |.$locale->text('Notes').qq| |
- |.$locale->text('Internal Notes').qq| |
+ | . $locale->text('Notes') . qq| |
+ | . $locale->text('Internal Notes') . qq| |
$notes |
@@ -494,7 +640,7 @@ sub form_footer {
$subtotal
$tax
0
- |.$locale->text('Total').qq| |
+ | . $locale->text('Total') . qq| |
$form->{invtotal} |
@@ -505,106 +651,121 @@ sub form_footer {
|
|;
if ($webdav) {
- $webdav_list = qq|
+ $webdav_list = qq|
|
-
+
Dokumente im Webdav-Repository |
Dateiname |
Webdavlink |
|;
- foreach $file (keys %{ $form->{WEBDAV}}) {
- $webdav_list .= qq|
-
+ foreach $file (keys %{ $form->{WEBDAV} }) {
+ $webdav_list .= qq|
+
$file |
$form->{WEBDAV}{$file} |
|;
- }
- $webdav_list .= qq|
+ }
+ $webdav_list .= qq|
|;
-print $webdav_list;
-}
-print qq|
+ print $webdav_list;
+ }
+ print qq|
{jscalendar}>
|;
-print qq|
+ print qq|
- |.$locale->text('Payments').qq| |
+ | . $locale->text('Payments') . qq| |
|;
- if ($form->{currency} eq $form->{defaultcurrency}) {
- @column_index = qw(datepaid source memo paid AP_paid);
- } else {
- @column_index = qw(datepaid source memo paid exchangerate AP_paid);
- }
+ if ($form->{currency} eq $form->{defaultcurrency}) {
+ @column_index = qw(datepaid source memo paid AP_paid);
+ } else {
+ @column_index = qw(datepaid source memo paid exchangerate AP_paid);
+ }
- $column_data{datepaid} = "".$locale->text('Date')." | ";
- $column_data{paid} = "".$locale->text('Amount')." | ";
- $column_data{exchangerate} = "".$locale->text('Exch')." | ";
- $column_data{AP_paid} = "".$locale->text('Account')." | ";
- $column_data{source} = "".$locale->text('Source')." | ";
- $column_data{memo} = "".$locale->text('Memo')." | ";
+ $column_data{datepaid} = "" . $locale->text('Date') . " | ";
+ $column_data{paid} = "" . $locale->text('Amount') . " | ";
+ $column_data{exchangerate} = "" . $locale->text('Exch') . " | ";
+ $column_data{AP_paid} = "" . $locale->text('Account') . " | ";
+ $column_data{source} = "" . $locale->text('Source') . " | ";
+ $column_data{memo} = "" . $locale->text('Memo') . " | ";
- print qq|
+ print qq|
|;
- map { print "$column_data{$_}\n" } @column_index;
- print qq|
+ map { print "$column_data{$_}\n" } @column_index;
+ print qq|
|;
- $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
- for $i (1 .. $form->{paidaccounts}) {
+ my @triggers = ();
+ $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
+ for $i (1 .. $form->{paidaccounts}) {
- print qq|
+ print qq|
|;
- $form->{"selectAP_paid_$i"} = $form->{selectAP_paid};
- $form->{"selectAP_paid_$i"} =~ s/option>\Q$form->{"AP_paid_$i"}\E/option selected>$form->{"AP_paid_$i"}/;
-
- # format amounts
- $form->{"paid_$i"} = $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
- $form->{"exchangerate_$i"} = $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
+ $form->{"selectAP_paid_$i"} = $form->{selectAP_paid};
+ $form->{"selectAP_paid_$i"} =~
+ s/option>\Q$form->{"AP_paid_$i"}\E/option selected>$form->{"AP_paid_$i"}/;
- $exchangerate = qq| |;
- if ($form->{currency} ne $form->{defaultcurrency}) {
- if ($form->{"forex_$i"}) {
- $exchangerate = qq|{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
- } else {
- $exchangerate = qq|{"exchangerate_$i"}>|;
- }
+ # format amounts
+ if ($form->{"paid_$i"}) {
+ $form->{"paid_$i"} =
+ $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
+ }
+ $form->{"exchangerate_$i"} =
+ $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
+
+ $exchangerate = qq| |;
+ if ($form->{currency} ne $form->{defaultcurrency}) {
+ if ($form->{"forex_$i"}) {
+ $exchangerate =
+ qq|{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
+ } else {
+ $exchangerate =
+ qq|{"exchangerate_$i"}>|;
}
- $exchangerate .= qq|
+ }
+ $exchangerate .= qq|
{"forex_$i"}>
|;
- $column_data{"paid_$i"} = qq|{"paid_$i"}> | |;
- $column_data{"exchangerate_$i"} = qq|$exchangerate | |;
- $column_data{"AP_paid_$i"} = qq| | |;
- $column_data{"datepaid_$i"} = qq|{"datepaid_$i"}> | |;
- $column_data{"source_$i"} = qq|{"source_$i"}> | |;
- $column_data{"memo_$i"} = qq|{"memo_$i"}> | |;
+ $column_data{"paid_$i"} =
+ qq|{"paid_$i"}> | |;
+ $column_data{"exchangerate_$i"} = qq|$exchangerate | |;
+ $column_data{"AP_paid_$i"} =
+ qq| | |;
+ $column_data{"datepaid_$i"} =
+ qq|{"datepaid_$i"}>
+ | |;
+ $column_data{"source_$i"} =
+ qq|{"source_$i"}> | |;
+ $column_data{"memo_$i"} =
+ qq|{"memo_$i"}> | |;
+
+ map { print qq|$column_data{"${_}_$i"}\n| } @column_index;
- map { print qq|$column_data{"${_}_$i"}\n| } @column_index;
-
- print qq|
+ print qq|
|;
- }
-
- print qq|
+ push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
+ }
+
+ print qq|
{oldinvtotal}>
{paidaccounts}>
@@ -618,42 +779,40 @@ print qq|
|;
- $invdate = $form->datetonum($form->{invdate}, \%myconfig);
+ $invdate = $form->datetonum($form->{invdate}, \%myconfig);
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
-
+
if ($form->{id}) {
- print qq|
+ print qq|
|;
-
- if (!$form->{revtrans}) {
- if (!$form->{locked}) {
- print qq|
-
-
+ print qq|
+| unless ($form->{storno});
+ if ($form->{radier}) {
+ print qq|
+
|;
- }
- }
-
- if ($invdate > $closedto) {
- print qq|
-
-
+ }
+ print qq|
|;
- }
- } else {
- if ($invdate > $closedto) {
- print qq|
- |;
- }
}
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
+ print qq||;
+
+ if (!$form->{id} && ($invdate > $closedto)) {
+ print qq| | .
+ NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'),
+ '-class' => 'submit'));
}
-
-print qq|
+
+ print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
+ qq|
{rowcount}>
@@ -662,8 +821,22 @@ print qq|
{path}>
{login}>
{password}>
+|
+ . $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}])
+ . $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}]);
-
+ # button for saving history
+ if($form->{id} ne "") {
+ print qq|
+ |;
+ }
+ # /button for saving history
+
+print qq|
|