X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fir.pl;h=4f40da73f3eaf0f5b7809dbac9496b11462a3e12;hb=98ad02ca3b8d9e9c00775b4768e7060388efbed1;hp=ee0e813a403a08624f937078a26721ea854e1d5a;hpb=e44cbe168d7cdaedc952a23102d8c834bd3a2993;p=kivitendo-erp.git
diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl
index ee0e813a4..4f40da73f 100644
--- a/bin/mozilla/ir.pl
+++ b/bin/mozilla/ir.pl
@@ -32,10 +32,13 @@
#======================================================================
use SL::IR;
+use SL::IS;
use SL::PE;
require "$form->{path}/io.pl";
require "$form->{path}/arap.pl";
+require "$form->{path}/common.pl";
+require "bin/mozilla/drafts.pl";
1;
@@ -43,7 +46,9 @@ require "$form->{path}/arap.pl";
sub add {
$lxdebug->enter_sub();
-print STDERR "ir.pl-add\n";
+
+ return $lxdebug->leave_sub() if (load_draft_maybe());
+
$form->{title} = $locale->text('Add Vendor Invoice');
&invoice_links;
@@ -55,7 +60,11 @@ print STDERR "ir.pl-add\n";
sub edit {
$lxdebug->enter_sub();
-
+
+ # show history button
+ $form->{javascript} = qq||;
+ #/show hhistory button
+
$form->{title} = $locale->text('Edit Vendor Invoice');
&invoice_links;
@@ -67,7 +76,7 @@ sub edit {
sub invoice_links {
$lxdebug->enter_sub();
-print STDERR "ir.pl-invoice_links\n";
+
# create links
$form->{webdav} = $webdav;
@@ -76,19 +85,43 @@ print STDERR "ir.pl-invoice_links\n";
$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];
@@ -97,7 +130,7 @@ print STDERR "ir.pl-invoice_links\n";
$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|\n|
: qq||;
- $contact =
- ($form->{selectcontact})
- ? qq|\n|
- : qq||;
-
$department = qq|
| . $locale->text('Department') . qq| |
@@ -274,14 +359,12 @@ print STDERR "ir.pl-form_header\n";
$button1 = qq|
{invdate}> |
text('button')
- . qq|> |
+ . $locale->text('button') . qq|>
|;
$button2 = qq|
{duedate}> |
text('button')
- . qq|> |
+ . $locale->text('button') . qq|>
|;
#write Trigger
@@ -297,6 +380,13 @@ print STDERR "ir.pl-form_header\n";
qq|{duedate}> | |;
}
+ $form->{"javascript"} .= qq||;
+
+ $jsscript .=
+ $form->write_trigger(\%myconfig, 2,
+ "orddate", "BL", "trigger_orddate",
+ "quodate", "BL", "trigger_quodate");
+
$form->header;
print qq|
@@ -317,7 +407,10 @@ print STDERR "ir.pl-form_header\n";
{locked}>
{shipped}>
+{storno}>
+{storno_id}>
+| . ($form->{saved_message} ? qq|$form->{saved_message}
| : "") . qq|
+
+ | . $locale->text('Order Date') . qq| |
+ |
+ |
+
+
+ | . $locale->text('Quotation Date') . qq| |
+ |
+ |
+
+
+ | . $locale->text('Project Number') . qq| |
+ $globalprojectnumber |
+
+
@@ -421,7 +528,7 @@ $jsscript
sub form_footer {
$lxdebug->enter_sub();
-print STDERR "ir.pl-form_footer\n";
+
$form->{invtotal} = $form->{invsubtotal};
if (($rows = $form->numtextrows($form->{notes}, 25, 8)) < 2) {
@@ -459,7 +566,8 @@ print STDERR "ir.pl-form_footer\n";
$tax .= qq|
- $form->{"${item}_description"} |
+ $form->{"${item}_description"} |
+ . $form->{"${item}_rate"} * 100 .qq|% |
$form->{"${item}_total"} |
|;
@@ -500,7 +608,8 @@ print STDERR "ir.pl-form_footer\n";
$tax .= qq|
- Enthaltene $form->{"${item}_description"} |
+ Enthaltene $form->{"${item}_description"} |
+ . $form->{"${item}_rate"} * 100 .qq|% |
$form->{"${item}_total"} |
@@ -611,6 +720,7 @@ print STDERR "ir.pl-form_footer\n";
|;
+ my @triggers = ();
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
for $i (1 .. $form->{paidaccounts}) {
@@ -623,8 +733,10 @@ print STDERR "ir.pl-form_footer\n";
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);
+ 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"});
@@ -648,7 +760,8 @@ print STDERR "ir.pl-form_footer\n";
$column_data{"AP_paid_$i"} =
qq| | |;
$column_data{"datepaid_$i"} =
- qq|{"datepaid_$i"}> | |;
+ qq|{"datepaid_$i"}>
+ | |;
$column_data{"source_$i"} =
qq|{"source_$i"}> | |;
$column_data{"memo_$i"} =
@@ -659,6 +772,7 @@ print STDERR "ir.pl-form_footer\n";
print qq|
|;
+ push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
}
print qq|
@@ -679,45 +793,38 @@ print STDERR "ir.pl-form_footer\n";
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
if ($form->{id}) {
+ my $show_storno = !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ap");
+
print qq|
+ . $locale->text('Post Payment') . qq|">
|;
-
- if (!$form->{revtrans}) {
- if (!$form->{locked}) {
- print qq|
-
-
+ print qq|
+| if ($show_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}>
@@ -726,8 +833,22 @@ print STDERR "ir.pl-form_footer\n";
{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|