} else {
$arap = "ar";
my $invoice = "a.invoice";
+ my $quonumber = "a.quonumber";
if ($form->{type} =~ /_(order|quotation)$/) {
$invnumber = "ordnumber";
$invoice = '0';
}
+ if ($form->{type} eq 'packing_list') {
+ $invnumber = "donumber";
+ $arap = "delivery_orders";
+ $invoice = '0';
+ $quonumber = '0';
+ }
+
$query =
- qq|SELECT a.id, a.$invnumber AS invnumber, a.ordnumber, a.quonumber, | .
+ qq|SELECT a.id, a.$invnumber AS invnumber, a.ordnumber, $quonumber, | .
qq| a.transdate, $invoice AS invoice, '$arap' AS module, vc.name, | .
qq| s.spoolfile | .
qq|FROM $arap a, ${vc} vc, status s | .
qq|WHERE s.trans_id = a.id | .
qq| AND s.spoolfile IS NOT NULL | .
- qq| AND s.formname = ? | .
+ ($form->{type} eq 'packing_list'
+ ? qq| AND s.formname IN (?, ?) |
+ : qq| AND s.formname = ? |) .
qq| AND a.${vc}_id = vc.id|;
@values = ($form->{type});
+
+ if ($form->{type} eq 'packing_list') {
+ @values = qw(sales_delivery_order purchase_delivery_order);
+ }
}
if ($form->{"${vc}_id"}) {
$query .= " AND vc.name ILIKE ?";
push(@values, $form->like($form->{ $vc }));
}
- foreach my $column (qw(invnumber ordnumber quonumber)) {
+ foreach my $column (qw(invnumber ordnumber quonumber donumber)) {
if ($form->{$column}) {
$query .= " AND a.$column ILIKE ?";
push(@values, $form->like($form->{$column}));
}
}
- if ($form->{type} =~ /(invoice|sales_order|sales_quotation|puchase_order|request_quotation)$/) {
+ if ($form->{type} =~ /(invoice|sales_order|sales_quotation|puchase_order|request_quotation|packing_list)$/) {
if ($form->{transdatefrom}) {
$query .= " AND a.transdate >= ?";
push(@values, $form->{transdatefrom});
my $sortorder = join ', ', $form->sort_columns(@a);
if (grep({ $_ eq $form->{sort} }
- qw(transdate invnumber ordnumber quonumber name))) {
+ qw(transdate invnumber ordnumber quonumber donumber name))) {
$sortorder = $form->{sort};
}
'sales_order' => 'sales_order_edit',
'sales_quotation' => 'sales_quotation_edit',
'purchase_order' => 'purchase_order_edit',
+ 'packing_list' => 'sales_delivery_order_edit|purchase_delivery_order_edit',
'request_quotation' => 'request_quotation_edit',
'check' => 'cash',
'receipt' => 'cash',
purchase_order => { title => $::locale->text('Purchase Orders'), ordnumber => 1, },
sales_quotation => { title => $::locale->text('Quotations'), quonumber => 1, },
request_quotation => { title => $::locale->text('RFQs'), quonumber => 1, },
+ packing_list => { title => $::locale->text('Delivery Orders'), donumber => 1, ordnumber => 1 },
check => { title => $::locale->text('Checks'), chknumber => 1, },
receipt => { title => $::locale->text('Receipts'), rctnumber => 1, },
);
invnumber => sub { $::locale->text('Invoice Number') . " : $::form->{invnumber}" },
ordnumber => sub { $::locale->text('Order Number') . " : $::form->{ordnumber}" },
quonumber => sub { $::locale->text('Quotation Number') . " : $::form->{quonumber}" },
+ donumber => sub { $::locale->text('Delivery Order Number') . " : $::form->{donumber}" },
transdatefrom => sub { $::locale->text('From') . " " . $::locale->date(\%::myconfig, $::form->{transdatefrom}, 1) },
transdateto => sub { $::locale->text('To') . " " . $::locale->date(\%::myconfig, $::form->{transdateto}, 1) },
);
my @options;
- for my $key ($::form->{vc}, qw(account invnumber ordnumber quonumber transdatefrom transdateto)) {
+ for my $key ($::form->{vc}, qw(account invnumber ordnumber quonumber donumber transdatefrom transdateto)) {
next unless $::form->{$key};
push @href_options, $key;
push @options, $option_texts{$key} ? $option_texts{$key}->() : '';