X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fis.pl;h=b5479473ccdf23912772a2accc070c6e2802532e;hb=f2c923a10719d3a9e26448b7d83f38051466bf2c;hp=31d017eefc919a2edde0031a09812a1fc6310da9;hpb=195883fdfd3b10f329036767f027baa6e7c402b9;p=kivitendo-erp.git
diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl
index 31d017eef..b5479473c 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 @@ print STDERR "is.pl-edit\n";
sub invoice_links {
$lxdebug->enter_sub();
-print STDERR "is.pl-invoice_links\n";
+
$form->{vc} = 'customer';
# create links
@@ -184,10 +188,9 @@ print STDERR "is.pl-invoice_links\n";
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}) {
@@ -195,8 +198,8 @@ print STDERR "is.pl-prepare_invoice\n";
map { $form->{$_} =~ s/\"/"/g }
qw(invnumber ordnumber quonumber shippingpoint shipvia notes intnotes);
-# # get pricegroups for parts
-# IS->get_pricegroups_for_parts(\%myconfig, \%$form);
+ # # get pricegroups for parts
+ # IS->get_pricegroups_for_parts(\%myconfig, \%$form);
foreach $ref (@{ $form->{invoice_details} }) {
$i++;
@@ -210,15 +213,17 @@ print STDERR "is.pl-prepare_invoice\n";
$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);
$form->{rowcount} = $i;
-# # build up html code for prices_$i
-# print STDERR "set_pricegroup aus is.pl-prepare_invoice\n";
-# set_pricegroup();
}
}
$lxdebug->leave_sub();
@@ -226,7 +231,7 @@ print STDERR "is.pl-prepare_invoice\n";
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)) {
$form->{"select$item"} =~ s/ selected//;
@@ -329,11 +334,20 @@ print STDERR "is.pl-form_header\n";
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
@@ -342,8 +356,11 @@ print STDERR "is.pl-form_header\n";
$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()";
}
@@ -463,6 +480,10 @@ print STDERR "is.pl-form_header\n";
| . $locale->text('Due Date') . qq| |
$button2
+
+ | . $locale->text('Delivery Date') . qq| |
+ $button3
+
| . $locale->text('Order Number') . qq| |
|
@@ -522,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) {
@@ -761,8 +782,6 @@ print STDERR "is.pl-form_footer\n";
{oldinvtotal}>
-{print_and_post}>
-{second_run}>
@@ -860,10 +879,12 @@ print STDERR "is.pl-form_footer\n";
sub update {
$lxdebug->enter_sub();
-print STDERR "is.pl-update\n";
+
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
qw(exchangerate creditlimit creditremaining);
-
+ if ($form->{second_run}) {
+ $form->{print_and_post} = 0;
+ }
&check_name(customer);
&check_project;
@@ -924,7 +945,7 @@ print STDERR "is.pl-update\n";
} else {
$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]{$_} }
@@ -982,10 +1003,10 @@ print STDERR "is.pl-update\n";
}
# get pricegroups for parts
- IS->get_pricegroups_for_parts(\%myconfig, \%$form, "new");
+ IS->get_pricegroups_for_parts(\%myconfig, \%$form);
# build up html code for prices_$i
- set_pricegroup();
+ &set_pricegroup($i);
}
&display_form;
@@ -1016,7 +1037,6 @@ print STDERR "is.pl-update\n";
sub post {
$lxdebug->enter_sub();
-print STDERR "is.pl-post\n";
$form->isblank("invdate", $locale->text('Invoice Date missing!'));
$form->isblank("customer", $locale->text('Customer missing!'));
@@ -1025,6 +1045,9 @@ print STDERR "is.pl-post\n";
&update;
exit;
}
+ if ($form->{second_run}) {
+ $form->{print_and_post} = 0;
+ }
&validate_items;
@@ -1038,7 +1061,7 @@ print STDERR "is.pl-post\n";
if ($form->{currency} ne $form->{defaultcurrency});
for $i (1 .. $form->{paidaccounts}) {
- if ($form->{"paid_$i"}) {
+ if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
$datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
$form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
@@ -1062,8 +1085,10 @@ print STDERR "is.pl-post\n";
$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!'));
@@ -1085,7 +1110,8 @@ sub print_and_post {
$print_post = 1;
$form->{print_and_post} = 1;
&post();
- &display_form();
+
+ &edit();
$lxdebug->leave_sub();
}
@@ -1105,7 +1131,9 @@ sub preview {
sub delete {
$lxdebug->enter_sub();
-
+ if ($form->{second_run}) {
+ $form->{print_and_post} = 0;
+ }
$form->header;
print qq|