|
Lines 276-281
sub filter_by_obsolete {
Link Here
|
| 276 |
return $rs; |
276 |
return $rs; |
| 277 |
} |
277 |
} |
| 278 |
|
278 |
|
|
|
279 |
=head3 unreceived_totals |
| 280 |
|
| 281 |
my $unreceived_totals = $orders->unreceived_totals(); |
| 282 |
|
| 283 |
Returns a hashref with the total unreceived items, and their total price, for the |
| 284 |
given I<Koha::Acquisition::Orders> resultset. |
| 285 |
|
| 286 |
Example returned value: |
| 287 |
|
| 288 |
{ |
| 289 |
items_count => 36, |
| 290 |
total_replacement_price => 87.5 |
| 291 |
} |
| 292 |
|
| 293 |
=cut |
| 294 |
|
| 295 |
sub unreceived_totals { |
| 296 |
my ($self) = @_; |
| 297 |
|
| 298 |
my $me = $self->_resultset()->current_source_alias; |
| 299 |
my $result = $self->search( |
| 300 |
{}, |
| 301 |
{ |
| 302 |
select => [ |
| 303 |
\"SUM($me.quantity - $me.quantityreceived)", |
| 304 |
\"SUM(($me.quantity - $me.quantityreceived) * $me.rrp)" |
| 305 |
], |
| 306 |
as => [ 'total_count', 'total_rrp' ], |
| 307 |
} |
| 308 |
)->next; |
| 309 |
|
| 310 |
return { |
| 311 |
items_count => $result->get_column('total_count') // 0, |
| 312 |
total_replacement_price => $result->get_column('total_rrp') // 0, |
| 313 |
}; |
| 314 |
} |
| 315 |
|
| 279 |
=head3 cancel |
316 |
=head3 cancel |
| 280 |
|
317 |
|
| 281 |
$orders_rs->cancel( { delete_biblio => 0|1 } ); |
318 |
$orders_rs->cancel( { delete_biblio => 0|1 } ); |
| 282 |
- |
|
|