-
-
-
-
-
-
- $customers
-
-
-
-
- |
- . $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| |
- |
+ |
$taxzone
@@ -746,7 +718,7 @@ print qq|
#
print qq|
|
-
+ |
$employees
$salesman
@@ -784,8 +756,8 @@ print qq|
| . $locale->text('Order Date') . qq| |
- |
- |
+
+ |
| . $locale->text('Quotation Number') . qq| |
@@ -793,8 +765,8 @@ print qq|
| . $locale->text('Quotation Date') . qq| |
- |
- |
+
+ |
| . $locale->text('Customer Order Number') . qq| |
@@ -814,20 +786,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();
@@ -849,7 +821,7 @@ sub form_footer {
qq||;
$intnotes =
qq||;
-
+
$form->{taxincluded} = ($form->{taxincluded} ? "checked" : "");
$taxincluded = "";
@@ -1037,7 +1009,8 @@ if ($form->{type} eq "credit_note") {
";
- my @triggers = ();
+ my @triggers = ();
+ my $totalpaid = 0;
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
for $i (1 .. $form->{paidaccounts}) {
@@ -1058,6 +1031,9 @@ if ($form->{type} eq "credit_note") {
$form->{"exchangerate_$i"} =
$form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
+ if ($form->{"exchangerate_$i"} == 0) {
+ $form->{"exchangerate_$i"} = "";
+ }
$exchangerate = qq| |;
if ($form->{currency} ne $form->{defaultcurrency}) {
if ($form->{"forex_$i"}) {
@@ -1088,7 +1064,24 @@ 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));
+ my $paid_missing = $form->{oldinvtotal} - $totalpaid;
+
+ print qq|
+
+ |
+ |
+ | . $locale->text('Total') . qq| |
+ | . H($form->format_amount(\%myconfig, $totalpaid, 2)) . qq| |
+
+
+ |
+ |
+ | . $locale->text('Missing amount') . qq| |
+ | . H($form->format_amount(\%myconfig, $paid_missing, 2)) . qq| |
+
+|;
+
+ map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } qw(paidaccounts selectAR_paid oldinvtotal));
print qq|
|
@@ -1178,17 +1171,22 @@ if ($form->{type} eq "credit_note") {
. Q($form->{id})
. qq|);" name="history" id="history" value="|
. $locale->text('history')
- . qq|">|;
+ . qq|"> |;
}
# /button for saving history
-
-
+
+ # mark_as_paid button
+ if($form->{id} ne "") {
+ print qq||;
+ }
+ # /mark_as_paid button
print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
qq|
| .
-$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(login password));
@@ -1203,6 +1201,12 @@ print qq|
$lxdebug->leave_sub();
}
+sub mark_as_paid {
+ $lxdebug->enter_sub();
+ &mark_as_paid_common(\%myconfig,"ar");
+ $lxdebug->leave_sub();
+}
+
sub update {
$lxdebug->enter_sub();
@@ -1212,7 +1216,7 @@ sub update {
$form->{print_and_post} = 0;
}
-
+
if($form->{taxincluded}) {
$taxincluded = "checked";
}
@@ -1378,6 +1382,8 @@ sub update {
sub post_payment {
$lxdebug->enter_sub();
+
+ $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
for $i (1 .. $form->{paidaccounts}) {
if ($form->{"paid_$i"}) {
$datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
@@ -1399,7 +1405,7 @@ sub post_payment {
($form->{AR}) = split /--/, $form->{AR};
($form->{AR_paid}) = split /--/, $form->{AR_paid};
relink_accounts();
- $form->redirect($locale->text(' Payment posted!'))
+ $form->redirect($locale->text('Payment posted!'))
if (IS->post_payment(\%myconfig, \%$form));
$form->error($locale->text('Cannot post payment!'));
@@ -1409,6 +1415,8 @@ sub post_payment {
sub post {
$lxdebug->enter_sub();
+
+ $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
$form->isblank("invdate", $locale->text('Invoice Date missing!'));
$form->isblank("customer", $locale->text('Customer missing!'));
@@ -1455,6 +1463,7 @@ sub post {
($form->{AR}) = split /--/, $form->{AR};
($form->{AR_paid}) = split /--/, $form->{AR_paid};
+ $form->{storno} = 0;
$form->{label} = $locale->text('Invoice');
@@ -1481,7 +1490,7 @@ sub post {
"POSTED";
$form->save_history($form->dbconnect(\%myconfig));
}
-
+
$form->redirect( $form->{label} . " $form->{invnumber} " . $locale->text('posted!'))
unless $print_post;
@@ -1552,7 +1561,6 @@ sub preview {
$form->{preview} = 1;
$old_form = new Form;
for (keys %$form) { $old_form->{$_} = $form->{$_} }
- $old_form->{rowcount}++;
&print_form($old_form);
$lxdebug->leave_sub();
@@ -1613,7 +1621,7 @@ sub credit_note {
$form->{script} = 'is.pl';
$script = "is";
$buysell = 'buy';
-
+
# bo creates the id, reset it
map { delete $form->{$_} }
@@ -1656,12 +1664,12 @@ sub yes {
if (IS->delete_invoice(\%myconfig, \%$form, $spool)) {
# saving the history
if(!exists $form->{addition}) {
- $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $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!'));
| |