And then called them against the right table

This commit is contained in:
Tom Bloor 2019-07-15 05:34:11 +01:00
parent 7dc7acb1a1
commit 5accf45cde
No known key found for this signature in database
GPG key ID: 4657C7EBE42CC5CC

View file

@ -255,7 +255,7 @@ sub post_supplier_history {
my $third = $last->clone->subtract(months => 3); my $third = $last->clone->subtract(months => 3);
my $dtf = $c->schema->storage->datetime_parser; my $dtf = $c->schema->storage->datetime_parser;
my $year_rs = $c->schema->resultset('Transaction')->search( my $year_rs = $c->schema->resultset('Entity')->search(
{ {
'sales.purchase_time' => { 'sales.purchase_time' => {
-between => [ -between => [
@ -279,7 +279,7 @@ sub post_supplier_history {
order_by => { '-asc' => 'organisation.name' }, order_by => { '-asc' => 'organisation.name' },
} }
); );
my $half_year_rs = $c->schema->resultset('Transaction')->search( my $half_year_rs = $c->schema->resultset('Entity')->search(
{ {
'sales.purchase_time' => { 'sales.purchase_time' => {
-between => [ -between => [
@ -338,7 +338,7 @@ sub post_supplier_history {
half_count => 0, half_count => 0,
half_total => 0, half_total => 0,
year_count => $row->get_column('count'), year_count => $row->get_column('count'),
year_total => $row->get_column('total_spend'), year_total => $row->get_column('total_spend') / 100000,
}; };
} }
@ -349,7 +349,7 @@ sub post_supplier_history {
quarter_count => 0, quarter_count => 0,
quarter_total => 0, quarter_total => 0,
half_count => $row->get_column('count'), half_count => $row->get_column('count'),
half_total => $row->get_column('total_spend'), half_total => $row->get_column('total_spend') / 100000,
year_count => 0, year_count => 0,
year_total => 0, year_total => 0,
%{$data{$row->get_column('id')}}, %{$data{$row->get_column('id')}},
@ -361,7 +361,7 @@ sub post_supplier_history {
id => $row->get_column('id'), id => $row->get_column('id'),
name => $row->get_column('name'), name => $row->get_column('name'),
quarter_count => $row->get_column('count'), quarter_count => $row->get_column('count'),
quarter_total => $row->get_column('total_spend'), quarter_total => $row->get_column('total_spend') / 100000,
half_count => 0, half_count => 0,
half_total => 0, half_total => 0,
year_count => 0, year_count => 0,