|
Lines 72-79
BEGIN {
Link Here
|
| 72 |
TransferOrder |
72 |
TransferOrder |
| 73 |
ModItemOrder |
73 |
ModItemOrder |
| 74 |
|
74 |
|
| 75 |
GetParcels |
|
|
| 76 |
|
| 77 |
GetInvoices |
75 |
GetInvoices |
| 78 |
GetInvoice |
76 |
GetInvoice |
| 79 |
GetInvoiceDetails |
77 |
GetInvoiceDetails |
|
Lines 1965-2061
sub get_rounded_price {
Link Here
|
| 1965 |
return $price; |
1963 |
return $price; |
| 1966 |
} |
1964 |
} |
| 1967 |
|
1965 |
|
| 1968 |
|
|
|
| 1969 |
=head2 FUNCTIONS ABOUT PARCELS |
| 1970 |
|
| 1971 |
=head3 GetParcels |
| 1972 |
|
| 1973 |
$results = &GetParcels($bookseller, $order, $code, $datefrom, $dateto); |
| 1974 |
|
| 1975 |
get a lists of parcels. |
| 1976 |
|
| 1977 |
* Input arg : |
| 1978 |
|
| 1979 |
=over |
| 1980 |
|
| 1981 |
=item $bookseller |
| 1982 |
is the bookseller this function has to get parcels. |
| 1983 |
|
| 1984 |
=item $order |
| 1985 |
To know on what criteria the results list has to be ordered. |
| 1986 |
|
| 1987 |
=item $code |
| 1988 |
is the booksellerinvoicenumber. |
| 1989 |
|
| 1990 |
=item $datefrom & $dateto |
| 1991 |
to know on what date this function has to filter its search. |
| 1992 |
|
| 1993 |
=back |
| 1994 |
|
| 1995 |
* return: |
| 1996 |
a pointer on a hash list containing parcel informations as such : |
| 1997 |
|
| 1998 |
=over |
| 1999 |
|
| 2000 |
=item Creation date |
| 2001 |
|
| 2002 |
=item Last operation |
| 2003 |
|
| 2004 |
=item Number of biblio |
| 2005 |
|
| 2006 |
=item Number of items |
| 2007 |
|
| 2008 |
=back |
| 2009 |
|
| 2010 |
=cut |
| 2011 |
|
| 2012 |
sub GetParcels { |
| 2013 |
my ($bookseller,$order, $code, $datefrom, $dateto) = @_; |
| 2014 |
my $dbh = C4::Context->dbh; |
| 2015 |
my @query_params = (); |
| 2016 |
my $strsth =" |
| 2017 |
SELECT aqinvoices.invoicenumber, |
| 2018 |
datereceived,purchaseordernumber, |
| 2019 |
count(DISTINCT biblionumber) AS biblio, |
| 2020 |
sum(quantity) AS itemsexpected, |
| 2021 |
sum(quantityreceived) AS itemsreceived |
| 2022 |
FROM aqorders LEFT JOIN aqbasket ON aqbasket.basketno = aqorders.basketno |
| 2023 |
LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid |
| 2024 |
WHERE aqbasket.booksellerid = ? and datereceived IS NOT NULL |
| 2025 |
"; |
| 2026 |
push @query_params, $bookseller; |
| 2027 |
|
| 2028 |
if ( defined $code ) { |
| 2029 |
$strsth .= ' and aqinvoices.invoicenumber like ? '; |
| 2030 |
# add a % to the end of the code to allow stemming. |
| 2031 |
push @query_params, "$code%"; |
| 2032 |
} |
| 2033 |
|
| 2034 |
if ( defined $datefrom ) { |
| 2035 |
$strsth .= ' and datereceived >= ? '; |
| 2036 |
push @query_params, $datefrom; |
| 2037 |
} |
| 2038 |
|
| 2039 |
if ( defined $dateto ) { |
| 2040 |
$strsth .= 'and datereceived <= ? '; |
| 2041 |
push @query_params, $dateto; |
| 2042 |
} |
| 2043 |
|
| 2044 |
$strsth .= "group by aqinvoices.invoicenumber,datereceived "; |
| 2045 |
|
| 2046 |
# can't use a placeholder to place this column name. |
| 2047 |
# but, we could probably be checking to make sure it is a column that will be fetched. |
| 2048 |
$strsth .= "order by $order " if ($order); |
| 2049 |
|
| 2050 |
my $sth = $dbh->prepare($strsth); |
| 2051 |
|
| 2052 |
$sth->execute( @query_params ); |
| 2053 |
my $results = $sth->fetchall_arrayref({}); |
| 2054 |
return @{$results}; |
| 2055 |
} |
| 2056 |
|
| 2057 |
#------------------------------------------------------------# |
| 2058 |
|
| 2059 |
=head3 GetHistory |
1966 |
=head3 GetHistory |
| 2060 |
|
1967 |
|
| 2061 |
\@order_loop = GetHistory( %params ); |
1968 |
\@order_loop = GetHistory( %params ); |
| 2062 |
- |
|
|