qq| ex.$rate AS exchangerate, | .
qq| pr.projectnumber AS globalprojectnumber, | .
qq| e.name AS employee, s.name AS salesman, | .
- qq| ct.country, ct.ustid | .
+ qq| ct.${vc}number AS vcnumber, ct.country, ct.ustid | .
qq|FROM oe o | .
qq|JOIN $vc ct ON (o.${vc}_id = ct.id) | .
qq|LEFT JOIN employee e ON (o.employee_id = e.id) | .
return $value;
}
+##########################
+# Get data for the submitted order id
+# from database
+#
+sub get_order_data_by_ordnumber {
+ $main::lxdebug->enter_sub();
+
+ my $self = shift;
+ my %params = @_;
+
+ Common::check_params(\%params, qw(ordnumber));
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $dbh = $form->get_standard_dbh();
+
+ my @values = ($params{ordnumber});
+
+ # We query the database for the fields we need using the submitted "ordnumber"
+ my $query = <<SQL;
+ SELECT o.payment_id, o.salesman_id, o.transdate AS orddate, o.taxzone_id, o.quonumber
+ FROM oe o
+ WHERE o.ordnumber = ?;
+SQL
+
+ # Do the actual query and return the results for later processing by our "frontend"
+ my $result = selectfirst_hashref_query($form, $dbh, $query, @values);
+
+ $main::lxdebug->leave_sub();
+
+ return $result;
+}
+
1;