-
- | . $locale->text('Customer') . qq| |
- $customer |
-
-
-
- |
- . $locale->text('Contact Person') . qq| |
- $contact |
-
-
- |
-
-
-
- | . $locale->text('Credit Limit') . qq| |
- $form->{creditlimit} |
- |
- | . $locale->text('Remaining') . qq| |
- $form->{creditremaining} |
-
-
- |
- $shipto
-
- $business
- $dunning
+
+
+
+ $customers
+
+
+
+
+
+ $contact
+ $shipto
+
+ | . $locale->text('Credit Limit') . qq| |
+ $form->{creditlimit}; | . $locale->text('Remaining') . qq| $form->{creditremaining} |
+
+ $dunning
+ $business
| . $locale->text('Record in') . qq| |
|
@@ -666,10 +681,7 @@ print qq|
$taxzone
$department
- | . $locale->text('Currency') . qq| |
- |
-
-
+ $currencies
$exchangerate
@@ -682,7 +694,11 @@ print qq|
| . $locale->text('Ship via') . qq| |
|
- |;
+
+
+ | . $locale->text('Transaction description') . qq| |
+ | . $cgi->textfield("-name" => "transaction_description", "-size" => 35, "-value" => $form->{transaction_description}) . qq| |
+ |;
#
#
#
@@ -705,14 +721,9 @@ print qq|
#
print qq|
|
-
+ |
-
- | . $locale->text('Employee') . qq| |
- |
-
- |
-
+ $employees
$salesman
|;
if ($form->{type} eq "credit_note") {
@@ -748,8 +759,8 @@ print qq|
| . $locale->text('Order Date') . qq| |
- |
- |
+
+ |
| . $locale->text('Quotation Number') . qq| |
@@ -757,8 +768,8 @@ print qq|
| . $locale->text('Quotation Date') . qq| |
- |
- |
+
+ |
| . $locale->text('Customer Order Number') . qq| |
@@ -778,20 +789,20 @@ print qq|
|
-| .
+| .
$jsscript
. qq|
| ;
-map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); }
+map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); }
qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptoemail shiptodepartment_1 shiptodepartment_2));
print qq| |;
-map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); }
+map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); }
qw(message email subject cc bcc taxaccounts));
print qq||;
foreach $item (split(/ /, $form->{taxaccounts})) {
- map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); }
+ map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); }
("${item}_rate", "${item}_description", "${item}_taxnumber"));
}
$lxdebug->leave_sub();
@@ -814,12 +825,12 @@ sub form_footer {
$intnotes =
qq||;
- $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
+ $form->{taxincluded} = ($form->{taxincluded} ? "checked" : "");
$taxincluded = "";
if ($form->{taxaccounts}) {
$taxincluded = qq|
- {taxincluded}> |
+ {taxincluded}> |
. $locale->text('Tax Included') . qq|
|;
}
@@ -1034,12 +1045,12 @@ if ($form->{type} eq "credit_note") {
$exchangerate .= qq||;
$column_data{"paid_$i"} =
- qq| | |;
+ qq| | |;
$column_data{"exchangerate_$i"} = qq|$exchangerate | |;
$column_data{"AR_paid_$i"} =
qq| | |;
$column_data{"datepaid_$i"} =
- qq|{"datepaid_$i"}>
+ qq| |
| |;
$column_data{"source_$i"} =
qq| | |;
@@ -1052,7 +1063,7 @@ if ($form->{type} eq "credit_note") {
push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
}
- map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } qw(paidaccounts selectAR_paid oldinvtotal));
+ map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } qw(paidaccounts selectAR_paid oldinvtotal));
print qq|
|
@@ -1064,7 +1075,7 @@ if ($form->{type} eq "credit_note") {
|;
- &print_options;
+ print_options();
print qq|
|
@@ -1152,10 +1163,10 @@ if ($form->{type} eq "credit_note") {
| .
-$cgi->hidden("-name" => "callback", "-value" => $form->{callback})
+$cgi->hidden("-name" => "callback", "-value" => $form->{callback})
. $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}])
. $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}]);
-map({ print $cgi->hidden("-name" => $_ , "-value" => $form->{$_});} qw(path login password));
+map({ print $cgi->hidden("-name" => $_ , "-value" => $form->{$_});} qw(login password));
print qq|
@@ -1176,10 +1187,19 @@ sub update {
$form->{print_and_post} = 0;
}
+
+ if($form->{taxincluded}) {
+ $taxincluded = "checked";
+ }
$form->{update} = 1;
&check_name(customer);
+ if(!$form->{taxincluded}) {
+ $form->{taxincluded} = $taxincluded;
+ }
+
+
$form->{exchangerate} = $exchangerate
if (
$form->{forex} = (
@@ -1367,6 +1387,9 @@ sub post {
$form->isblank("invdate", $locale->text('Invoice Date missing!'));
$form->isblank("customer", $locale->text('Customer missing!'));
+ $form->{invnumber} =~ s/^\s*//g;
+ $form->{invnumber} =~ s/\s*$//g;
+
# if oldcustomer ne customer redo form
if (&check_name(customer)) {
&update;
@@ -1427,12 +1450,13 @@ sub post {
remove_draft() if $form->{remove_draft};
if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
$form->{addition} = $print_post ? "PRINTED AND POSTED" :
$form->{storno} ? "STORNO" :
"POSTED";
$form->save_history($form->dbconnect(\%myconfig));
}
-
+
$form->redirect( $form->{label} . " $form->{invnumber} " . $locale->text('posted!'))
unless $print_post;
@@ -1476,21 +1500,25 @@ sub storno {
}
map({ my $key = $_; delete($form->{$key})
- unless (grep({ $key eq $_ } qw(path login password id type))); }
+ unless (grep({ $key eq $_ } qw(login password id stylesheet type))); }
keys(%{ $form }));
- &invoice_links;
- &prepare_invoice;
+ invoice_links();
+ prepare_invoice();
relink_accounts();
+ # Payments must not be recorded for the new storno invoice.
+ $form->{paidaccounts} = 0;
+ map { my $key = $_; delete $form->{$key} if grep { $key =~ /^$_/ } qw(datepaid_ source_ memo_ paid_ exchangerate_ AR_paid_) } keys %{ $form };
+
$form->{storno_id} = $form->{id};
$form->{storno} = 1;
$form->{id} = "";
$form->{invnumber} = "Storno zu " . $form->{invnumber};
+ $form->{rowcount}++;
- &post();
+ post();
$lxdebug->leave_sub();
-
}
sub preview {
@@ -1560,7 +1588,7 @@ sub credit_note {
$form->{script} = 'is.pl';
$script = "is";
$buysell = 'buy';
-
+
# bo creates the id, reset it
map { delete $form->{$_} }
@@ -1603,11 +1631,12 @@ sub yes {
if (IS->delete_invoice(\%myconfig, \%$form, $spool)) {
# saving the history
if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
$form->{addition} = "DELETED";
$form->save_history($form->dbconnect(\%myconfig));
}
- # /saving the history
- $form->redirect($locale->text('Invoice deleted!'));
+ # /saving the history
+ $form->redirect($locale->text('Invoice deleted!'));
}
$form->error($locale->text('Cannot delete invoice!'));
@@ -1617,11 +1646,20 @@ sub yes {
sub e_mail {
$lxdebug->enter_sub();
- $print_post = 1;
+ if (!$form->{id}) {
+ $print_post = 1;
- &post;
+ my $saved_form = save_form();
+
+ post();
+
+ my %saved_vars;
+ map({ $saved_vars{$_} = $form->{$_}; } qw(id invnumber));
+ restore_form($saved_form);
+ map({ $form->{$_} = $saved_vars{$_}; } qw(id invnumber));
+ }
- &edit_e_mail;
+ edit_e_mail();
$lxdebug->leave_sub();
}
|