@@ -, +, @@ --- C4/Acquisition.pm | 17 +++++++++++++---- acqui/lateorders-export.pl | 16 ++++++++-------- 2 files changed, 21 insertions(+), 12 deletions(-) --- a/C4/Acquisition.pm +++ a/C4/Acquisition.pm @@ -991,10 +991,19 @@ C<$order> are fields from the biblio, biblioitems, aqorders tables of the Koha d sub GetOrder { my ($ordernumber) = @_; my $dbh = C4::Context->dbh; - my $query = qq{SELECT biblio.*,biblioitems.*, + my $query = qq{SELECT aqorders.*, - aqbudgets.*, - aqbasket.*, + biblio.title, + biblio.author, + aqbasket.basketname, + borrowers.branchcode, + biblioitems.publicationyear, + biblio.copyrightdate, + biblioitems.editionstatement, + biblioitems.isbn, + biblioitems.ean, + biblio.seriestitle, + biblioitems.publishercode aqorders.rrp AS unitpricesupplier, aqorders.ecost AS unitpricelib, aqorders.claims_count AS claims_count, @@ -1005,7 +1014,7 @@ sub GetOrder { biblioitems.publishercode AS publisher, ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) AS estimateddeliverydate, DATE(aqbasket.closedate) AS orderdate, - aqorders.quantity - COALESCE(aqorders.quantityreceived,0) AS quantity, + aqorders.quantity - COALESCE(aqorders.quantityreceived,0) AS quantity_to_receive, (aqorders.quantity - COALESCE(aqorders.quantityreceived,0)) * aqorders.rrp AS subtotal, DATEDIFF(CURDATE( ),closedate) AS latesince FROM aqorders LEFT JOIN biblio ON biblio.biblionumber = aqorders.biblionumber --- a/acqui/lateorders-export.pl +++ a/acqui/lateorders-export.pl @@ -48,14 +48,14 @@ print "ORDER DATE,ESTIMATED DELIVERY DATE,VENDOR,INFORMATION,TOTAL COST,BASKET,C for my $ordernumber ( @ordernumbers ) { my $order = GetOrder $ordernumber; $csv->combine( - "(" . $$order{supplierid} . ") " . $$order{orderdate} . " (" . $$order{latesince} . " days)", - $$order{estimateddeliverydate}, - $$order{supplier}, - $$order{title} . ( $$order{author} ? " Author: $$order{author}" : "" ) . ( $$order{publisher} ? " Published by: $$order{publisher}" : "" ), - $$order{unitpricesupplier} . "x" . $$order{quantity} . " = " . $$order{subtotal} . " (" . $$order{budget} . ")", - $$order{basketname} . " (" . $$order{basketno} . ")", - $$order{claims_count}, - $$order{claimed_date} + "(" . $order->{supplierid} . ") " . $order->{orderdate} . " (" . $order->{latesince} . " days)", + $order->{estimateddeliverydate}, + $order->{supplier}, + $order->{title} . ( $order->{author} ? " Author: $order->{author}" : "" ) . ( $order->{publisher} ? " Published by: $order->{publisher}" : "" ), + $order->{unitpricesupplier} . "x" . $order->{quantity_to_receive} . " = " . $order->{subtotal} . " (" . $order->{budget} . ")", + $order->{basketname} . " (" . $order->{basketno} . ")", + $order->{claims_count}, + $order->{claimed_date} ); my $string = $csv->string; print $string, "\n"; --