X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fis.pl;h=7bbcc12a7c91d8fd73b8f9de016b449c4b6ce8ba;hb=72539cb39a3d19f930a8e0e41e46bf41afe9a8f1;hp=ae8c7748fcebfa89f0659f3dc22d844d35eaa850;hpb=ef73414c443962e695214abdf5f4387ff62cfcd3;p=kivitendo-erp.git
diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl
index ae8c7748f..7bbcc12a7 100644
--- a/bin/mozilla/is.pl
+++ b/bin/mozilla/is.pl
@@ -57,9 +57,10 @@ sub add {
{
$form->error("Access Denied");
}
-
&invoice_links;
&prepare_invoice;
+ $form->{format} = "pdf";
+
&display_form;
$lxdebug->leave_sub();
@@ -67,14 +68,17 @@ sub add {
sub edit {
$lxdebug->enter_sub();
- print STDERR "is.pl-edit\n";
+
$form->{title} = $locale->text('Edit Sales Invoice');
if ($myconfig{acs} =~ "AR--Add Sales Invoice" || $myconfig{acs} =~ "AR--AR")
{
$form->error("Access Denied");
}
-
+ if ($form->{print_and_post}) {
+ $form->{action} = "print";
+ $form->{resubmit} = 1;
+ }
&invoice_links;
&prepare_invoice;
&display_form;
@@ -84,7 +88,7 @@ sub edit {
sub invoice_links {
$lxdebug->enter_sub();
- print STDERR "is.pl-invoice_links\n";
+
$form->{vc} = 'customer';
# create links
@@ -184,10 +188,9 @@ sub invoice_links {
sub prepare_invoice {
$lxdebug->enter_sub();
- print STDERR "is.pl-prepare_invoice\n";
+
$form->{type} = "invoice";
$form->{formname} = "invoice";
- $form->{format} = "html";
$form->{media} = "screen";
if ($form->{id}) {
@@ -210,7 +213,12 @@ sub prepare_invoice {
$form->{"sellprice_$i"} =
$form->format_amount(\%myconfig, $form->{"sellprice_$i"},
$decimalplaces);
- $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
+
+ (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
+ $dec_qty = length $dec_qty;
+
+ $form->{"qty_$i"} =
+ $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
map { $form->{"${_}_$i"} =~ s/\"/"/g }
qw(partnumber description unit partnotes);
@@ -223,7 +231,6 @@ sub prepare_invoice {
sub form_header {
$lxdebug->enter_sub();
- print STDERR "is.pl-form_header\n";
# set option selected
foreach $item (qw(AR customer currency department employee contact)) {
@@ -327,11 +334,20 @@ sub form_header {
text('button') . qq|> |
|;
+ $button3 = qq|
+ {deliverydate}> |
+ text('button') . qq|> |
+ |;
#write Trigger
$jsscript =
- Form->write_trigger(\%myconfig, "2", "invdate", "BL", "trigger1",
- "duedate", "BL", "trigger2");
+ Form->write_trigger(\%myconfig, "3",
+ "invdate", "BL",
+ "trigger1", "duedate",
+ "BL", "trigger2",
+ "deliverydate", "BL",
+ "trigger3");
} else {
# without JavaScript Calendar
@@ -340,8 +356,11 @@ sub form_header {
$button2 =
qq|{duedate}> | |;
}
- if ($form->{resubmit}) {
- $onload = "document.invoice.submit()";
+ if ($form->{resubmit} && ($form->{format} eq "html")) {
+ $onload =
+ qq|window.open('about:blank','Beleg'); document.invoice.target = 'Beleg';document.invoice.submit()|;
+ } elsif ($form->{resubmit}) {
+ $onload = qq|document.invoice.submit()|;
} else {
$onload = "fokus()";
}
@@ -461,6 +480,10 @@ sub form_header {
| . $locale->text('Due Date') . qq| |
$button2
+
+ | . $locale->text('Delivery Date') . qq| |
+ $button3
+
| . $locale->text('Order Number') . qq| |
|
@@ -520,7 +543,7 @@ $jsscript
sub form_footer {
$lxdebug->enter_sub();
- print STDERR "is.pl-form_footer\n";
+
$form->{invtotal} = $form->{invsubtotal};
if (($rows = $form->numtextrows($form->{notes}, 26, 8)) < 2) {
@@ -759,8 +782,6 @@ sub form_footer {
{oldinvtotal}>
-{print_and_post}>
-{second_run}>
@@ -925,7 +946,6 @@ sub update {
$sellprice = $form->format_amount(\%myconfig, $form->{"sellprice_$i"});
- #print STDERR " SELLPRICE-111- $sellprice\n";
map { $form->{item_list}[$i]{$_} =~ s/\"/"/g }
qw(partnumber description unit);
map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} }
@@ -1065,8 +1085,10 @@ sub post {
$form->{id} = 0 if $form->{postasnew};
- $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber")
- unless $form->{invnumber};
+ # get new invnumber in sequence if no invnumber is given or if posasnew was requested
+ if (!$form->{invnumber} || $form->{postasnew}) {
+ $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber");
+ }
if ($print_post) {
if (!(IS->post_invoice(\%myconfig, \%$form))) {
$form->error($locale->text('Cannot post invoice!'));
@@ -1089,7 +1111,7 @@ sub print_and_post {
$form->{print_and_post} = 1;
&post();
- &display_form();
+ &edit();
$lxdebug->leave_sub();
}