'reference' => [ qw(lower_reference id) ],
'description' => [ qw(lower_description id) ],
'accno' => [ qw(accno transdate id) ],
+ 'department' => [ qw(department transdate id) ],
);
my %lowered_columns = (
'reference' => { 'gl' => 'g.reference', 'arap' => 'a.invnumber', },
ac.acc_trans_id, g.id, 'gl' AS type, FALSE AS invoice, g.reference, ac.taxkey, c.link,
g.description, ac.transdate, ac.gldate, ac.source, ac.trans_id,
ac.amount, c.accno, g.notes, t.chart_id,
+ d.description AS department,
CASE WHEN (COALESCE(e.name, '') = '') THEN e.login ELSE e.name END AS employee
$project_columns
$columns_for_sorting{gl}
FROM gl g
- LEFT JOIN employee e ON (g.employee_id = e.id),
+ LEFT JOIN employee e ON (g.employee_id = e.id)
+ LEFT JOIN department d ON (g.department_id = d.id),
acc_trans ac $project_join, chart c
LEFT JOIN tax t ON (t.chart_id = c.id)
WHERE $glwhere
SELECT ac.acc_trans_id, a.id, 'ar' AS type, a.invoice, a.invnumber, ac.taxkey, c.link,
ct.name, ac.transdate, ac.gldate, ac.source, ac.trans_id,
ac.amount, c.accno, a.notes, t.chart_id,
+ d.description AS department,
CASE WHEN (COALESCE(e.name, '') = '') THEN e.login ELSE e.name END AS employee
$project_columns
$columns_for_sorting{arap}
FROM ar a
- LEFT JOIN employee e ON (a.employee_id = e.id),
+ LEFT JOIN employee e ON (a.employee_id = e.id)
+ LEFT JOIN department d ON (a.department_id = d.id),
acc_trans ac $project_join, customer ct, chart c
LEFT JOIN tax t ON (t.chart_id=c.id)
WHERE $arwhere
SELECT ac.acc_trans_id, a.id, 'ap' AS type, a.invoice, a.invnumber, ac.taxkey, c.link,
ct.name, ac.transdate, ac.gldate, ac.source, ac.trans_id,
ac.amount, c.accno, a.notes, t.chart_id,
+ d.description AS department,
CASE WHEN (COALESCE(e.name, '') = '') THEN e.login ELSE e.name END AS employee
$project_columns
$columns_for_sorting{arap}
FROM ap a
- LEFT JOIN employee e ON (a.employee_id = e.id),
+ LEFT JOIN employee e ON (a.employee_id = e.id)
+ LEFT JOIN department d ON (a.department_id = d.id),
acc_trans ac $project_join, vendor ct, chart c
LEFT JOIN tax t ON (t.chart_id=c.id)
WHERE $apwhere
transdate gldate id reference description
notes source doccnt debit debit_accno
credit credit_accno debit_tax debit_tax_accno
- credit_tax credit_tax_accno balance projectnumbers employee
+ credit_tax credit_tax_accno balance projectnumbers
+ department employee
);
# add employee here, so that variable is still known and passed in url when choosing a different sort order in resulting table
'credit_tax_accno' => { 'text' => $locale->text('Credit Tax Account'), },
'balance' => { 'text' => $locale->text('Balance'), },
'projectnumbers' => { 'text' => $locale->text('Project Numbers'), },
+ 'department' => { 'text' => $locale->text('Department'), },
'employee' => { 'text' => $locale->text('Employee'), },
);
- foreach my $name (qw(id transdate gldate reference description debit_accno credit_accno debit_tax_accno credit_tax_accno)) {
+ foreach my $name (qw(id transdate gldate reference description debit_accno credit_accno debit_tax_accno credit_tax_accno department)) {
my $sortname = $name =~ m/accno/ ? 'accno' : $name;
my $sortdir = $sortname eq $form->{sort} ? 1 - $form->{sortdir} : $form->{sortdir};
$column_defs{$name}->{link} = $callback . "&sort=$sortname&sortdir=$sortdir";
$row->{balance}->{data} = $data;
$row->{projectnumbers}->{data} = join ", ", sort { lc($a) cmp lc($b) } keys %{ $ref->{projectnumbers} };
- map { $row->{$_}->{data} = $ref->{$_} } qw(id reference description notes gldate employee);
+ map { $row->{$_}->{data} = $ref->{$_} } qw(id reference description notes gldate employee department);
map { $row->{$_}->{data} = \@{ $rows{$_} }; } qw(transdate debit credit debit_accno credit_accno debit_tax_accno credit_tax_accno source);