# take all the requested ones from the first hash and overwrite them from the out/in hashes if present.
for my $i ('trans', 'out', 'in') {
$select{$i} = join ', ', map { +/^l_/; ($select_tokens{$i}{"$'"} || $select_tokens{'trans'}{"$'"}) . " AS r_$'" }
- ( grep( { !/qty$/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_qty l_partunit l_shippingdate) );
+ ( grep( { !/qty$/ and !/^l_cvar/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_qty l_partunit l_shippingdate) );
}
my $group_clause = join ", ", map { +/^l_/; "r_$'" }
- ( grep( { !/qty$/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_partunit l_shippingdate l_itime) );
+ ( grep( { !/qty$/ and !/^l_cvar/ and /^l_/ and $form->{$_} eq 'Y' } keys %$form), qw(l_parts_id l_partunit l_shippingdate l_itime) );
$where_clause = defined($where_clause) ? $where_clause : '';
show_no_warehouses_error() if (!scalar @{ $form->{WAREHOUSES} });
+ my $cvar_configs = CVar->get_configs('module' => 'IC');
+ (undef,
+ $form->{CUSTOM_VARIABLES_INCLUSION_CODE}) = CVar->render_search_options('variables' => $cvar_configs,
+ 'include_prefix' => 'l_',
+ 'include_value' => 'Y');
+
setup_wh_journal_action_bar();
$form->header();
my $report = SL::ReportGenerator->new(\%myconfig, $form);
+ my $cvar_configs = CVar->get_configs('module' => 'IC');
+ my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs };
+ push @columns, map { "cvar_$_->{name}" } @includeable_custom_variables;
+
my @hidden_variables = map { "l_${_}" } @columns;
push @hidden_variables, qw(warehouse_id bin_id partnumber description chargenumber bestbefore qty_op qty qty_unit unit partunit fromdate todate transtype_ids comment projectnumber);
push @hidden_variables, qw(classification_id);
'oe_id' => { 'text' => $locale->text('Document'), },
);
+ my %column_defs_cvars = map { +"cvar_$_->{name}" => { 'text' => $_->{description} } } @includeable_custom_variables;
+ %column_defs = (%column_defs, %column_defs_cvars);
+
if ($form->{transtype_ids} && 'ARRAY' eq ref $form->{transtype_ids}) {
for (my $i = 0; $i < scalar(@{ $form->{transtype_ids} }); $i++) {
delete $form->{transtype_ids}[$i] if $form->{transtype_ids}[$i] eq '';
my $href = build_std_url('action=generate_journal', grep { $form->{$_} } @hidden_variables);
$href .= "&maxrows=".$form->{maxrows};
- map { $column_defs{$_}->{link} = $href ."&page=".$page. "&sort=${_}&order=" . Q($_ eq $form->{sort} ? 1 - $form->{order} : $form->{order}) } @columns;
+ map { $column_defs{$_}->{link} = $href ."&page=".$page. "&sort=${_}&order=" . Q($_ eq $form->{sort} ? 1 - $form->{order} : $form->{order}) } grep {!/^cvar/} @columns;
my %column_alignment = map { $_ => 'right' } qw(qty);
my $all_units = AM->retrieve_units(\%myconfig, $form);
+ CVar->add_custom_variables_to_report('module' => 'IC',
+ 'trans_id_field' => 'parts_id',
+ 'configs' => $cvar_configs,
+ 'column_defs' => \%column_defs,
+ 'data' => \@contents);
+
+
my %doc_types = ( 'sales_quotation' => { script => 'oe', title => $locale->text('Sales quotation') },
'sales_order' => { script => 'oe', title => $locale->text('Sales Order') },
'request_quotation' => { script => 'oe', title => $locale->text('Request quotation') },