View | Details | Raw Unified | Return to bug 5339
Collapse All | Expand All

(-)a/C4/Acquisition.pm (-15 / +359 lines)
Lines 61-66 BEGIN { Link Here
61
        &GetParcels &GetParcel
61
        &GetParcels &GetParcel
62
        &GetContracts &GetContract
62
        &GetContracts &GetContract
63
63
64
        &GetInvoices
65
        &GetInvoice
66
        &GetInvoiceDetails
67
        &AddInvoice
68
        &ModInvoice
69
        &CloseInvoice
70
        &ReopenInvoice
71
64
        &GetItemnumbersFromOrder
72
        &GetItemnumbersFromOrder
65
73
66
        &AddClaim
74
        &AddClaim
Lines 1103-1109 C<$ordernumber>. Link Here
1103
sub ModReceiveOrder {
1111
sub ModReceiveOrder {
1104
    my (
1112
    my (
1105
        $biblionumber,    $ordernumber,  $quantrec, $user, $cost,
1113
        $biblionumber,    $ordernumber,  $quantrec, $user, $cost,
1106
        $invoiceno, $freight, $rrp, $budget_id, $datereceived
1114
        $invoiceid, $rrp, $budget_id, $datereceived
1107
    )
1115
    )
1108
    = @_;
1116
    = @_;
1109
    my $dbh = C4::Context->dbh;
1117
    my $dbh = C4::Context->dbh;
Lines 1129-1142 sub ModReceiveOrder { Link Here
1129
            UPDATE aqorders
1137
            UPDATE aqorders
1130
            SET quantityreceived=?
1138
            SET quantityreceived=?
1131
                , datereceived=?
1139
                , datereceived=?
1132
                , booksellerinvoicenumber=?
1140
                , invoiceid=?
1133
                , unitprice=?
1141
                , unitprice=?
1134
                , freight=?
1135
                , rrp=?
1142
                , rrp=?
1136
                , quantity=?
1143
                , quantity=?
1137
            WHERE biblionumber=? AND ordernumber=?");
1144
            WHERE biblionumber=? AND ordernumber=?");
1138
1145
1139
        $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$quantrec,$biblionumber,$ordernumber);
1146
        $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$quantrec,$biblionumber,$ordernumber);
1140
        $sth->finish;
1147
        $sth->finish;
1141
1148
1142
        # create a new order for the remaining items, and set its bookfund.
1149
        # create a new order for the remaining items, and set its bookfund.
Lines 1148-1157 sub ModReceiveOrder { Link Here
1148
        my $newOrder = NewOrder($order);
1155
        my $newOrder = NewOrder($order);
1149
} else {
1156
} else {
1150
        $sth=$dbh->prepare("update aqorders
1157
        $sth=$dbh->prepare("update aqorders
1151
                            set quantityreceived=?,datereceived=?,booksellerinvoicenumber=?,
1158
                            set quantityreceived=?,datereceived=?,invoiceid=?,
1152
                                unitprice=?,freight=?,rrp=?
1159
                                unitprice=?,rrp=?
1153
                            where biblionumber=? and ordernumber=?");
1160
                            where biblionumber=? and ordernumber=?");
1154
        $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$biblionumber,$ordernumber);
1161
        $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$biblionumber,$ordernumber);
1155
        $sth->finish;
1162
        $sth->finish;
1156
    }
1163
    }
1157
    return $datereceived;
1164
    return $datereceived;
Lines 1306-1314 sub GetParcel { Link Here
1306
        LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
1313
        LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
1307
        LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber
1314
        LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber
1308
        LEFT JOIN biblio ON aqorders.biblionumber=biblio.biblionumber
1315
        LEFT JOIN biblio ON aqorders.biblionumber=biblio.biblionumber
1316
        LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid
1309
        WHERE
1317
        WHERE
1310
            aqbasket.booksellerid = ?
1318
            aqbasket.booksellerid = ?
1311
            AND aqorders.booksellerinvoicenumber LIKE ?
1319
            AND aqinvoices.invoicenumber LIKE ?
1312
            AND aqorders.datereceived = ? ";
1320
            AND aqorders.datereceived = ? ";
1313
1321
1314
    my @query_params = ( $supplierid, $code, $datereceived );
1322
    my @query_params = ( $supplierid, $code, $datereceived );
Lines 1381-1398 sub GetParcels { Link Here
1381
    my $dbh    = C4::Context->dbh;
1389
    my $dbh    = C4::Context->dbh;
1382
    my @query_params = ();
1390
    my @query_params = ();
1383
    my $strsth ="
1391
    my $strsth ="
1384
        SELECT  aqorders.booksellerinvoicenumber,
1392
        SELECT  aqinvoices.invoicenumber,
1385
                datereceived,purchaseordernumber,
1393
                datereceived,purchaseordernumber,
1386
                count(DISTINCT biblionumber) AS biblio,
1394
                count(DISTINCT biblionumber) AS biblio,
1387
                sum(quantity) AS itemsexpected,
1395
                sum(quantity) AS itemsexpected,
1388
                sum(quantityreceived) AS itemsreceived
1396
                sum(quantityreceived) AS itemsreceived
1389
        FROM   aqorders LEFT JOIN aqbasket ON aqbasket.basketno = aqorders.basketno
1397
        FROM   aqorders LEFT JOIN aqbasket ON aqbasket.basketno = aqorders.basketno
1398
        LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid
1390
        WHERE aqbasket.booksellerid = ? and datereceived IS NOT NULL
1399
        WHERE aqbasket.booksellerid = ? and datereceived IS NOT NULL
1391
    ";
1400
    ";
1392
    push @query_params, $bookseller;
1401
    push @query_params, $bookseller;
1393
1402
1394
    if ( defined $code ) {
1403
    if ( defined $code ) {
1395
        $strsth .= ' and aqorders.booksellerinvoicenumber like ? ';
1404
        $strsth .= ' and aqinvoices.invoicenumber like ? ';
1396
        # add a % to the end of the code to allow stemming.
1405
        # add a % to the end of the code to allow stemming.
1397
        push @query_params, "$code%";
1406
        push @query_params, "$code%";
1398
    }
1407
    }
Lines 1407-1413 sub GetParcels { Link Here
1407
        push @query_params, $dateto;
1416
        push @query_params, $dateto;
1408
    }
1417
    }
1409
1418
1410
    $strsth .= "group by aqorders.booksellerinvoicenumber,datereceived ";
1419
    $strsth .= "group by aqinvoices.invoicenumber,datereceived ";
1411
1420
1412
    # can't use a placeholder to place this column name.
1421
    # can't use a placeholder to place this column name.
1413
    # but, we could probably be checking to make sure it is a column that will be fetched.
1422
    # but, we could probably be checking to make sure it is a column that will be fetched.
Lines 1600-1606 sub GetHistory { Link Here
1600
            aqorders.quantityreceived,
1609
            aqorders.quantityreceived,
1601
            aqorders.ecost,
1610
            aqorders.ecost,
1602
            aqorders.ordernumber,
1611
            aqorders.ordernumber,
1603
            aqorders.booksellerinvoicenumber as invoicenumber,
1612
            aqinvoices.invoicenumber,
1604
            aqbooksellers.id as id,
1613
            aqbooksellers.id as id,
1605
            aqorders.biblionumber
1614
            aqorders.biblionumber
1606
        FROM aqorders
1615
        FROM aqorders
Lines 1608-1614 sub GetHistory { Link Here
1608
    LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
1617
    LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
1609
        LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
1618
        LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
1610
	LEFT JOIN biblioitems ON biblioitems.biblionumber=aqorders.biblionumber
1619
	LEFT JOIN biblioitems ON biblioitems.biblionumber=aqorders.biblionumber
1611
        LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber";
1620
        LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber
1621
    LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid";
1612
1622
1613
    $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber"
1623
    $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber"
1614
    if ( C4::Context->preference("IndependantBranches") );
1624
    if ( C4::Context->preference("IndependantBranches") );
Lines 1659-1666 sub GetHistory { Link Here
1659
    }
1669
    }
1660
1670
1661
    if ($booksellerinvoicenumber) {
1671
    if ($booksellerinvoicenumber) {
1662
        $query .= " AND (aqorders.booksellerinvoicenumber LIKE ? OR aqbasket.booksellerinvoicenumber LIKE ?)";
1672
        $query .= " AND aqinvoices.invoicenumber LIKE ? ";
1663
        push @query_params, "%$booksellerinvoicenumber%", "%$booksellerinvoicenumber%";
1673
        push @query_params, "%$booksellerinvoicenumber%";
1664
    }
1674
    }
1665
1675
1666
    if ( C4::Context->preference("IndependantBranches") ) {
1676
    if ( C4::Context->preference("IndependantBranches") ) {
Lines 1801-1807 sub AddClaim { Link Here
1801
        ";
1811
        ";
1802
    my $sth = $dbh->prepare($query);
1812
    my $sth = $dbh->prepare($query);
1803
    $sth->execute($ordernumber);
1813
    $sth->execute($ordernumber);
1814
}
1815
1816
=head3 GetInvoices
1817
1818
    my @invoices = GetInvoices(
1819
        invoicenumber => $invoicenumber,
1820
        suppliername => $suppliername,
1821
        shipmentdatefrom => $shipmentdatefrom, # ISO format
1822
        shipmentdateto => $shipmentdateto, # ISO format
1823
        billingdatefrom => $billingdatefrom, # ISO format
1824
        billingdateto => $billingdateto, # ISO format
1825
        isbneanissn => $isbn_or_ean_or_issn,
1826
        title => $title,
1827
        author => $author,
1828
        publisher => $publisher,
1829
        publicationyear => $publicationyear,
1830
        branchcode => $branchcode,
1831
        order_by => $order_by
1832
    );
1833
1834
Return a list of invoices that match all given criteria.
1835
1836
$order_by is "column_name (asc|desc)", where column_name is any of
1837
'invoicenumber', 'booksellerid', 'shipmentdate', 'billingdate', 'closedate',
1838
'shipmentcost', 'shipmentcost_budgetid'.
1839
1840
asc is the default if omitted
1841
1842
=cut
1843
1844
sub GetInvoices {
1845
    my %args = @_;
1846
1847
    my @columns = qw(invoicenumber booksellerid shipmentdate billingdate
1848
        closedate shipmentcost shipmentcost_budgetid);
1849
1850
    my $dbh = C4::Context->dbh;
1851
    my $query = qq{
1852
        SELECT aqinvoices.*, aqbooksellers.name AS suppliername,
1853
          COUNT(
1854
            DISTINCT IF(
1855
              aqorders.datereceived IS NOT NULL,
1856
              aqorders.biblionumber,
1857
              NULL
1858
            )
1859
          ) AS receivedbiblios,
1860
          SUM(aqorders.quantityreceived) AS receiveditems
1861
        FROM aqinvoices
1862
          LEFT JOIN aqbooksellers ON aqbooksellers.id = aqinvoices.booksellerid
1863
          LEFT JOIN aqorders ON aqorders.invoiceid = aqinvoices.invoiceid
1864
          LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber
1865
          LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber
1866
          LEFT JOIN subscription ON biblio.biblionumber = subscription.biblionumber
1867
    };
1868
1869
    my @bind_args;
1870
    my @bind_strs;
1871
    if($args{invoicenumber}) {
1872
        push @bind_strs, " aqinvoices.invoicenumber LIKE ? ";
1873
        push @bind_args, "%$args{invoicenumber}%";
1874
    }
1875
    if($args{suppliername}) {
1876
        push @bind_strs, " aqbooksellers.name LIKE ? ";
1877
        push @bind_args, "%$args{suppliername}%";
1878
    }
1879
    if($args{shipmentdatefrom}) {
1880
        push @bind_strs, " aqinvoices.shipementdate >= ? ";
1881
        push @bind_args, $args{shipementdatefrom};
1882
    }
1883
    if($args{shipmentdateto}) {
1884
        push @bind_strs, " aqinvoices.shipementdate <= ? ";
1885
        push @bind_args, $args{shipementdateto};
1886
    }
1887
    if($args{billingdatefrom}) {
1888
        push @bind_strs, " aqinvoices.billingdate >= ? ";
1889
        push @bind_args, $args{billingdatefrom};
1890
    }
1891
    if($args{billingdateto}) {
1892
        push @bind_strs, " aqinvoices.billingdate <= ? ";
1893
        push @bind_args, $args{billingdateto};
1894
    }
1895
    if($args{isbneanissn}) {
1896
        push @bind_strs, " (biblioitems.isbn LIKE ? OR biblioitems.ean LIKE ? OR biblioitems.issn LIKE ? ) ";
1897
        push @bind_args, $args{isbneanissn}, $args{isbneanissn}, $args{isbneanissn};
1898
    }
1899
    if($args{title}) {
1900
        push @bind_strs, " biblio.title LIKE ? ";
1901
        push @bind_args, $args{title};
1902
    }
1903
    if($args{author}) {
1904
        push @bind_strs, " biblio.author LIKE ? ";
1905
        push @bind_args, $args{author};
1906
    }
1907
    if($args{publisher}) {
1908
        push @bind_strs, " biblioitems.publishercode LIKE ? ";
1909
        push @bind_args, $args{publisher};
1910
    }
1911
    if($args{publicationyear}) {
1912
        push @bind_strs, " biblioitems.publicationyear = ? ";
1913
        push @bind_args, $args{publicationyear};
1914
    }
1915
    if($args{branchcode}) {
1916
        push @bind_strs, " aqorders.branchcode = ? ";
1917
        push @bind_args, $args{branchcode};
1918
    }
1919
1920
    $query .= " WHERE " . join(" AND ", @bind_strs) if @bind_strs;
1921
    $query .= " GROUP BY aqinvoices.invoiceid ";
1922
1923
    if($args{order_by}) {
1924
        my ($column, $direction) = split / /, $args{order_by};
1925
        if(grep /^$column$/, @columns) {
1926
            $direction ||= 'ASC';
1927
            $query .= " ORDER BY $column $direction";
1928
        }
1929
    }
1930
1931
    my $sth = $dbh->prepare($query);
1932
    $sth->execute(@bind_args);
1933
1934
    my $results = $sth->fetchall_arrayref({});
1935
    return @$results;
1936
}
1937
1938
=head3 GetInvoice
1939
1940
    my $invoice = GetInvoice($invoiceid);
1941
1942
Get informations about invoice with given $invoiceid
1943
1944
Return a hash filled with aqinvoices.* fields
1945
1946
=cut
1947
1948
sub GetInvoice {
1949
    my ($invoiceid) = @_;
1950
    my $invoice;
1951
1952
    return unless $invoiceid;
1953
1954
    my $dbh = C4::Context->dbh;
1955
    my $query = qq{
1956
        SELECT *
1957
        FROM aqinvoices
1958
        WHERE invoiceid = ?
1959
    };
1960
    my $sth = $dbh->prepare($query);
1961
    $sth->execute($invoiceid);
1962
1963
    $invoice = $sth->fetchrow_hashref;
1964
    return $invoice;
1965
}
1966
1967
=head3 GetInvoiceDetails
1968
1969
    my $invoice = GetInvoiceDetails($invoiceid)
1970
1971
Return informations about an invoice + the list of related order lines
1972
1973
Orders informations are in $invoice->{orders} (array ref)
1974
1975
=cut
1976
1977
sub GetInvoiceDetails {
1978
    my ($invoiceid) = @_;
1979
    my $invoice;
1980
1981
    return unless $invoiceid;
1982
1983
    my $dbh = C4::Context->dbh;
1984
    my $query = qq{
1985
        SELECT aqinvoices.*, aqbooksellers.name AS suppliername
1986
        FROM aqinvoices
1987
          LEFT JOIN aqbooksellers ON aqinvoices.booksellerid = aqbooksellers.id
1988
        WHERE invoiceid = ?
1989
    };
1990
    my $sth = $dbh->prepare($query);
1991
    $sth->execute($invoiceid);
1804
1992
1993
    $invoice = $sth->fetchrow_hashref;
1994
1995
    $query = qq{
1996
        SELECT aqorders.*, biblio.*
1997
        FROM aqorders
1998
          LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber
1999
        WHERE invoiceid = ?
2000
    };
2001
    $sth = $dbh->prepare($query);
2002
    $sth->execute($invoiceid);
2003
    $invoice->{orders} = $sth->fetchall_arrayref({});
2004
    $invoice->{orders} ||= []; # force an empty arrayref if fetchall_arrayref fails
2005
2006
    return $invoice;
2007
}
2008
2009
=head3 AddInvoice
2010
2011
    my $invoiceid = AddInvoice(
2012
        invoicenumber => $invoicenumber,
2013
        booksellerid => $booksellerid,
2014
        shipmentdate => $shipmentdate,
2015
        billingdate => $billingdate,
2016
        closedate => $closedate,
2017
        shipmentcost => $shipmentcost,
2018
        shipmentcost_budgetid => $shipmentcost_budgetid
2019
    );
2020
2021
Create a new invoice and return its id or undef if it fails.
2022
2023
=cut
2024
2025
sub AddInvoice {
2026
    my %invoice = @_;
2027
2028
    return unless(%invoice and $invoice{invoicenumber});
2029
2030
    my @columns = qw(invoicenumber booksellerid shipmentdate billingdate
2031
        closedate shipmentcost shipmentcost_budgetid);
2032
2033
    my @set_strs;
2034
    my @set_args;
2035
    foreach my $key (keys %invoice) {
2036
        if(0 < grep(/^$key$/, @columns)) {
2037
            push @set_strs, "$key = ?";
2038
            push @set_args, ($invoice{$key} || undef);
2039
        }
2040
    }
2041
2042
    my $rv;
2043
    if(@set_args > 0) {
2044
        my $dbh = C4::Context->dbh;
2045
        my $query = "INSERT INTO aqinvoices SET ";
2046
        $query .= join (",", @set_strs);
2047
        my $sth = $dbh->prepare($query);
2048
        $rv = $sth->execute(@set_args);
2049
        if($rv) {
2050
            $rv = $dbh->last_insert_id(undef, undef, 'aqinvoices', undef);
2051
        }
2052
    }
2053
    return $rv;
2054
}
2055
2056
=head3 ModInvoice
2057
2058
    ModInvoice(
2059
        invoiceid => $invoiceid,    # Mandatory
2060
        invoicenumber => $invoicenumber,
2061
        booksellerid => $booksellerid,
2062
        shipmentdate => $shipmentdate,
2063
        billingdate => $billingdate,
2064
        closedate => $closedate,
2065
        shipmentcost => $shipmentcost,
2066
        shipmentcost_budgetid => $shipmentcost_budgetid
2067
    );
2068
2069
Modify an invoice, invoiceid is mandatory.
2070
2071
Return undef if it fails.
2072
2073
=cut
2074
2075
sub ModInvoice {
2076
    my %invoice = @_;
2077
2078
    return unless(%invoice and $invoice{invoiceid});
2079
2080
    my @columns = qw(invoicenumber booksellerid shipmentdate billingdate
2081
        closedate shipmentcost shipmentcost_budgetid);
2082
2083
    my @set_strs;
2084
    my @set_args;
2085
    foreach my $key (keys %invoice) {
2086
        if(0 < grep(/^$key$/, @columns)) {
2087
            push @set_strs, "$key = ?";
2088
            push @set_args, ($invoice{$key} || undef);
2089
        }
2090
    }
2091
2092
    my $dbh = C4::Context->dbh;
2093
    my $query = "UPDATE aqinvoices SET ";
2094
    $query .= join(",", @set_strs);
2095
    $query .= " WHERE invoiceid = ?";
2096
2097
    my $sth = $dbh->prepare($query);
2098
    $sth->execute(@set_args, $invoice{invoiceid});
2099
}
2100
2101
=head3 CloseInvoice
2102
2103
    CloseInvoice($invoiceid);
2104
2105
Close an invoice.
2106
2107
Equivalent to ModInvoice(invoiceid => $invoiceid, closedate => undef);
2108
2109
=cut
2110
2111
sub CloseInvoice {
2112
    my ($invoiceid) = @_;
2113
2114
    return unless $invoiceid;
2115
2116
    my $dbh = C4::Context->dbh;
2117
    my $query = qq{
2118
        UPDATE aqinvoices
2119
        SET closedate = CAST(NOW() AS DATE)
2120
        WHERE invoiceid = ?
2121
    };
2122
    my $sth = $dbh->prepare($query);
2123
    $sth->execute($invoiceid);
2124
}
2125
2126
=head3 ReopenInvoice
2127
2128
    ReopenInvoice($invoiceid);
2129
2130
Reopen an invoice
2131
2132
Equivalent to ModInvoice(invoiceid => $invoiceid, closedate => C4::Dates->new()->output('iso'))
2133
2134
=cut
2135
2136
sub ReopenInvoice {
2137
    my ($invoiceid) = @_;
2138
2139
    return unless $invoiceid;
2140
2141
    my $dbh = C4::Context->dbh;
2142
    my $query = qq{
2143
        UPDATE aqinvoices
2144
        SET closedate = NULL
2145
        WHERE invoiceid = ?
2146
    };
2147
    my $sth = $dbh->prepare($query);
2148
    $sth->execute($invoiceid);
1805
}
2149
}
1806
2150
1807
1;
2151
1;
(-)a/C4/Budgets.pm (-2 / +22 lines)
Lines 309-317 sub GetBudgetSpent { Link Here
309
            quantityreceived > 0 AND
309
            quantityreceived > 0 AND
310
            datecancellationprinted IS NULL
310
            datecancellationprinted IS NULL
311
    |);
311
    |);
312
313
	$sth->execute($budget_id);
312
	$sth->execute($budget_id);
314
	my $sum =  $sth->fetchrow_array;
313
	my $sum =  $sth->fetchrow_array;
314
315
    $sth = $dbh->prepare(qq|
316
        SELECT SUM(shipmentcost) AS sum
317
        FROM aqinvoices
318
        WHERE shipmentcost_budgetid = ?
319
          AND closedate IS NOT NULL
320
    |);
321
    $sth->execute($budget_id);
322
    my ($shipmentcost_sum) = $sth->fetchrow_array;
323
    $sum += $shipmentcost_sum;
324
315
	return $sum;
325
	return $sum;
316
}
326
}
317
327
Lines 325-333 sub GetBudgetOrdered { Link Here
325
            quantityreceived = 0 AND
335
            quantityreceived = 0 AND
326
            datecancellationprinted IS NULL
336
            datecancellationprinted IS NULL
327
    |);
337
    |);
328
329
	$sth->execute($budget_id);
338
	$sth->execute($budget_id);
330
	my $sum =  $sth->fetchrow_array;
339
	my $sum =  $sth->fetchrow_array;
340
341
    $sth = $dbh->prepare(qq|
342
        SELECT SUM(shipmentcost) AS sum
343
        FROM aqinvoices
344
        WHERE shipmentcost_budgetid = ?
345
          AND closedate IS NULL
346
    |);
347
    $sth->execute($budget_id);
348
    my ($shipmentcost_sum) = $sth->fetchrow_array;
349
    $sum += $shipmentcost_sum;
350
331
	return $sum;
351
	return $sum;
332
}
352
}
333
353
(-)a/acqui/addorderiso2709.pl (-2 lines)
Lines 191-203 if ($op eq ""){ Link Here
191
        # 3rd add order
191
        # 3rd add order
192
        my $patron = C4::Members->GetMember( borrowernumber => $loggedinuser );
192
        my $patron = C4::Members->GetMember( borrowernumber => $loggedinuser );
193
        my $branch = C4::Branch->GetBranchDetail( $patron->{branchcode} );
193
        my $branch = C4::Branch->GetBranchDetail( $patron->{branchcode} );
194
        my ($invoice);
195
        # get quantity in the MARC record (1 if none)
194
        # get quantity in the MARC record (1 if none)
196
        my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1;
195
        my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1;
197
        my %orderinfo = (
196
        my %orderinfo = (
198
            "biblionumber", $biblionumber, "basketno", $cgiparams->{'basketno'},
197
            "biblionumber", $biblionumber, "basketno", $cgiparams->{'basketno'},
199
            "quantity", $quantity, "branchcode", $branch, 
198
            "quantity", $quantity, "branchcode", $branch, 
200
            "booksellerinvoicenumber", $invoice, 
201
            "budget_id", $budget_id, "uncertainprice", 1,
199
            "budget_id", $budget_id, "uncertainprice", 1,
202
            "sort1", $cgiparams->{'sort1'},"sort2", $cgiparams->{'sort2'},
200
            "sort1", $cgiparams->{'sort1'},"sort2", $cgiparams->{'sort2'},
203
            "notes", $cgiparams->{'notes'}, "budget_id", $cgiparams->{'budget_id'},
201
            "notes", $cgiparams->{'notes'}, "budget_id", $cgiparams->{'budget_id'},
(-)a/acqui/finishreceive.pl (-6 / +6 lines)
Lines 45-58 my $origquantityrec=$input->param('origquantityrec'); Link Here
45
my $quantityrec=$input->param('quantityrec');
45
my $quantityrec=$input->param('quantityrec');
46
my $quantity=$input->param('quantity');
46
my $quantity=$input->param('quantity');
47
my $unitprice=$input->param('cost');
47
my $unitprice=$input->param('cost');
48
my $invoiceno=$input->param('invoice');
48
my $invoiceid = $input->param('invoiceid');
49
my $datereceived=$input->param('datereceived');
49
my $invoice = GetInvoice($invoiceid);
50
my $invoiceno = $invoice->{invoicenumber};
51
my $datereceived= $invoice->{shipmentdate};
50
my $replacement=$input->param('rrp');
52
my $replacement=$input->param('rrp');
51
my $gst=$input->param('gst');
53
my $gst=$input->param('gst');
52
my $freight=$input->param('freight');
53
my $booksellerid = $input->param('booksellerid');
54
my $booksellerid = $input->param('booksellerid');
54
my $cnt=0;
55
my $cnt=0;
55
my $error_url_str;
56
my $ecost = $input->param('ecost');
56
my $ecost = $input->param('ecost');
57
my $note = $input->param("note");
57
my $note = $input->param("note");
58
58
Lines 96-107 if ($quantityrec > $origquantityrec ) { Link Here
96
    }
96
    }
97
    
97
    
98
    # save the quantity received.
98
    # save the quantity received.
99
    $datereceived = ModReceiveOrder($biblionumber,$ordernumber, $quantityrec ,$user,$unitprice,$invoiceno,$freight,$replacement,undef,$datereceived);
99
    $datereceived = ModReceiveOrder($biblionumber,$ordernumber, $quantityrec ,$user,$unitprice,$invoice->{invoiceid},$replacement,undef,$datereceived);
100
}
100
}
101
101
102
update_item( $_ ) foreach GetItemnumbersFromOrder( $ordernumber );
102
update_item( $_ ) foreach GetItemnumbersFromOrder( $ordernumber );
103
103
104
print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoice=$invoiceno&booksellerid=$booksellerid&freight=$freight&gst=$gst&datereceived=$datereceived$error_url_str");
104
print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid");
105
105
106
################################ End of script ################################
106
################################ End of script ################################
107
107
(-)a/acqui/invoice.pl (+211 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2011 BibLibre SARL
4
# This file is part of Koha.
5
#
6
# Koha is free software; you can redistribute it and/or modify it under the
7
# terms of the GNU General Public License as published by the Free Software
8
# Foundation; either version 2 of the License, or (at your option) any later
9
# version.
10
#
11
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
12
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License along
16
# with Koha; if not, write to the Free Software Foundation, Inc.,
17
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
19
=head1 NAME
20
21
invoice.pl
22
23
=head1 DESCRIPTION
24
25
Invoice details
26
27
=cut
28
29
use strict;
30
use warnings;
31
32
use CGI;
33
use C4::Auth;
34
use C4::Output;
35
use C4::Acquisition;
36
use C4::Bookseller qw/GetBookSellerFromId/;
37
use C4::Budgets;
38
39
my $input = new CGI;
40
my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( {
41
    template_name   => 'acqui/invoice.tmpl',
42
    query           => $input,
43
    type            => 'intranet',
44
    authnotrequired => 0,
45
    flagsrequired   => { 'acquisition' => '*' },
46
    debug           => 1,
47
} );
48
49
my $invoiceid = $input->param('invoiceid');
50
my $op = $input->param('op');
51
52
if($op && $op eq 'close') {
53
    CloseInvoice($invoiceid);
54
    my $referer = $input->param('referer');
55
    if($referer) {
56
        print $input->redirect($referer);
57
        exit 0;
58
    }
59
}elsif($op && $op eq 'reopen') {
60
    ReopenInvoice($invoiceid);
61
    my $referer = $input->param('referer');
62
    if($referer) {
63
        print $input->redirect($referer);
64
        exit 0;
65
    }
66
}elsif($op && $op eq 'mod') {
67
    my $shipmentdate = $input->param('shipmentdate');
68
    my $billingdate = $input->param('billingdate');
69
    my $shipmentcost = $input->param('shipmentcost');
70
    my $shipment_budget_id = $input->param('shipment_budget_id');
71
    ModInvoice(
72
        invoiceid => $invoiceid,
73
        shipmentdate   => C4::Dates->new($shipmentdate)->output("iso"),
74
        billingdate   => C4::Dates->new($billingdate)->output("iso"),
75
        shipmentcost  => $shipmentcost,
76
        shipmentcost_budgetid => $shipment_budget_id
77
    );
78
    $template->param(modified => 1);
79
}
80
81
my $details = GetInvoiceDetails($invoiceid);
82
my $bookseller = GetBookSellerFromId($details->{booksellerid});
83
my @orders_loop = ();
84
my $orders = $details->{'orders'};
85
my $qty_total;
86
my @books_loop;
87
my @book_foot_loop;
88
my %foot;
89
my $total_quantity = 0;
90
my $total_rrp = 0;
91
my $total_est = 0;
92
foreach my $order (@$orders) {
93
    my $line = get_infos( $order, $bookseller);
94
95
    $total_quantity += $$line{quantity};
96
    $total_rrp += $order->{quantity} * $order->{rrp};
97
    $total_est += $order->{quantity} * $order->{'ecost'};
98
99
    my %row = (%$order, %$line);
100
    push @orders_loop, \%row;
101
}
102
103
my $gist = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
104
my $discount = $bookseller->{'discount'} ? ($bookseller->{discount} / 100) : 0;
105
my $total_est_gste;
106
my $total_est_gsti;
107
my $total_rrp_gsti; # RRP Total, GST included
108
my $total_rrp_gste; # RRP Total, GST excluded
109
my $gist_est;
110
my $gist_rrp;
111
if ($gist){
112
    # if we have GST
113
    if ( $bookseller->{'listincgst'} ) {
114
        # if prices already includes GST
115
116
        # we know $total_rrp_gsti
117
        $total_rrp_gsti = $total_rrp;
118
        # and can reverse compute other values
119
        $total_rrp_gste = $total_rrp_gsti / ( $gist + 1 );
120
121
        $gist_rrp       = $total_rrp_gsti - $total_rrp_gste;
122
        $total_est_gste = $total_rrp_gste - ( $total_rrp_gste * $discount );
123
        $total_est_gsti = $total_est;
124
    } else {
125
        # if prices does not include GST
126
127
        # then we use the common way to compute other values
128
        $total_rrp_gste = $total_rrp;
129
        $gist_rrp       = $total_rrp_gste * $gist;
130
        $total_rrp_gsti = $total_rrp_gste + $gist_rrp;
131
        $total_est_gste = $total_est;
132
        $total_est_gsti = $total_rrp_gsti - ( $total_rrp_gsti * $discount );
133
   }
134
   $gist_est = $gist_rrp - ( $gist_rrp * $discount );
135
} else {
136
    $total_rrp_gsti = $total_rrp;
137
    $total_est_gsti = $total_est;
138
}
139
my $total_gsti_shipment = $total_est_gsti + $details->{shipmentcost};
140
141
my $format = "%.2f";
142
$template->param(
143
    total_rrp_gste => sprintf($format, $total_rrp_gste),
144
    total_rrp_gsti => sprintf($format, $total_rrp_gsti),
145
    total_est_gste => sprintf($format, $total_est_gste),
146
    total_est_gsti => sprintf($format, $total_est_gsti),
147
    gist_rrp => sprintf($format, $gist_rrp),
148
    gist_est => sprintf($format, $gist_est),
149
    total_gsti_shipment => sprintf($format, $total_gsti_shipment),
150
    gist => sprintf($format, $gist * 100),
151
);
152
153
my $budgets = GetBudgets();
154
my @budgets_loop;
155
my $shipmentcost_budgetid = $details->{shipmentcost_budgetid};
156
foreach (@$budgets) {
157
    my %line = %{ $_ };
158
    if($shipmentcost_budgetid and $_->{'budget_id'} == $shipmentcost_budgetid) {
159
        $line{'selected'} = 1;
160
    }
161
    push @budgets_loop, \%line;
162
}
163
164
$template->param(
165
    invoiceid        => $details->{'invoiceid'},
166
    invoicenumber    => $details->{'invoicenumber'},
167
    suppliername     => $details->{'suppliername'},
168
    supplierid       => $details->{'booksellerid'},
169
    datereceived     => $details->{'datereceived'},
170
    shipmentdate     => $details->{'shipmentdate'},
171
    billingdate      => $details->{'billingdate'},
172
    invoiceclosedate => $details->{'closedate'},
173
    shipmentcost     => sprintf($format, $details->{'shipmentcost'} || 0),
174
    orders_loop      => \@orders_loop,
175
    total_quantity   => $total_quantity,
176
    invoiceincgst    => $bookseller->{invoiceincgst},
177
    currency         => $bookseller->{listprice},
178
    DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
179
    budgets_loop     => \@budgets_loop,
180
);
181
182
sub get_infos {
183
    my $order = shift;
184
    my $bookseller = shift;
185
    my $qty = $order->{'quantity'} || 0;
186
    if ( !defined $order->{quantityreceived} ) {
187
        $order->{quantityreceived} = 0;
188
    }
189
    my $budget = GetBudget( $order->{'budget_id'} );
190
191
    my %line = %{ $order };
192
    $line{order_received} = ( $qty == $order->{'quantityreceived'} );
193
    $line{budget_name}    = $budget->{budget_name};
194
    $line{total} = $qty * $order->{ecost};
195
196
    if ( $line{uncertainprice} ) {
197
        $line{rrp} .= ' (Uncertain)';
198
    }
199
    if ( $line{'title'} ) {
200
        my $volume      = $order->{'volume'};
201
        my $seriestitle = $order->{'seriestitle'};
202
        $line{'title'} .= " / $seriestitle" if $seriestitle;
203
        $line{'title'} .= " / $volume"      if $volume;
204
    } else {
205
        $line{'title'} = "Deleted bibliographic notice, can't find title.";
206
    }
207
208
    return \%line;
209
}
210
211
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/acqui/invoices.pl (+150 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2011 BibLibre SARL
4
# This file is part of Koha.
5
#
6
# Koha is free software; you can redistribute it and/or modify it under the
7
# terms of the GNU General Public License as published by the Free Software
8
# Foundation; either version 2 of the License, or (at your option) any later
9
# version.
10
#
11
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
12
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License along
16
# with Koha; if not, write to the Free Software Foundation, Inc.,
17
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
19
=head1 NAME
20
21
invoices.pl
22
23
=head1 DESCRIPTION
24
25
Search for invoices
26
27
=cut
28
29
use strict;
30
use warnings;
31
32
use CGI;
33
use C4::Auth;
34
use C4::Output;
35
36
use C4::Acquisition;
37
use C4::Bookseller qw/GetBookSeller/;
38
use C4::Branch;
39
40
my $input = new CGI;
41
my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( {
42
    template_name   => 'acqui/invoices.tmpl',
43
    query           => $input,
44
    type            => 'intranet',
45
    authnotrequired => 0,
46
    flagsrequired   => { 'acquisition' => '*' },
47
    debug           => 1,
48
} );
49
50
my $invoicenumber   = $input->param('invoicenumber');
51
my $supplier        = $input->param('supplier');
52
my $billingdatefrom = $input->param('billingdatefrom');
53
my $billingdateto   = $input->param('billingdateto');
54
my $isbneanissn     = $input->param('isbneanissn');
55
my $title           = $input->param('title');
56
my $author          = $input->param('author');
57
my $publisher       = $input->param('publisher');
58
my $publicationyear = $input->param('publicationyear');
59
my $branch          = $input->param('branch');
60
my $op              = $input->param('op');
61
62
my @results_loop = ();
63
if($op and $op eq "do_search") {
64
    my $billingdatefrom_iso = C4::Dates->new($billingdatefrom)->output("iso");
65
    my $billingdateto_iso = C4::Dates->new($billingdateto)->output("iso");
66
    my @invoices = GetInvoices(
67
        invoicenumber => $invoicenumber,
68
        suppliername => $supplier,
69
        billingdatefrom => $billingdatefrom_iso,
70
        billingdateto => $billingdateto_iso,
71
        isbneanissn => $isbneanissn,
72
        title => $title,
73
        author => $author,
74
        publisher => $publisher,
75
        publicationyear => $publicationyear,
76
        branchcode => $branch
77
    );
78
    foreach (@invoices) {
79
        my %row = (
80
            invoiceid       => $_->{invoiceid},
81
            billingdate     => $_->{billingdate},
82
            invoicenumber   => $_->{invoicenumber},
83
            suppliername    => $_->{suppliername},
84
            receivedbiblios => $_->{receivedbiblios},
85
            receiveditems   => $_->{receiveditems},
86
            subscriptionid  => $_->{subscriptionid},
87
            closedate => $_->{closedate},
88
        );
89
        push @results_loop, \%row;
90
    }
91
}
92
93
94
# Build suppliers list
95
my @suppliers = GetBookSeller(undef);
96
my @suppliers_loop = ();
97
my $suppliername;
98
foreach (@suppliers) {
99
    my $selected = 0;
100
    if ($supplier && $supplier == $_->{'id'}) {
101
        $selected = 1;
102
        $suppliername = $_->{'name'};
103
    }
104
    my %row = (
105
        suppliername => $_->{'name'},
106
        supplierid   => $_->{'id'},
107
        selected     => $selected,
108
    );
109
    push @suppliers_loop, \%row;
110
}
111
112
# Build branches list
113
my $branches = GetBranches();
114
my @branches_loop = ();
115
my $branchname;
116
foreach (sort keys %$branches) {
117
    my $selected = 0;
118
    if ($branch && $branch eq $_) {
119
        $selected = 1;
120
        $branchname = $branches->{$_}->{'branchname'};
121
    }
122
    my %row = (
123
        branchcode => $_,
124
        branchname => $branches->{$_}->{'branchname'},
125
        selected   => $selected,
126
    );
127
    push @branches_loop, \%row;
128
}
129
130
$template->param(
131
    do_search       => ($op and $op eq "do_search") ? 1 : 0,
132
    results_loop    => \@results_loop,
133
    invoicenumber   => $invoicenumber,
134
    supplier        => $supplier,
135
    suppliername    => $suppliername,
136
    billingdatefrom => $billingdatefrom,
137
    billingdateto   => $billingdateto,
138
    isbneanissn     => $isbneanissn,
139
    title           => $title,
140
    author          => $author,
141
    publisher       => $publisher,
142
    publicationyear => $publicationyear,
143
    branch          => $branch,
144
    branchname      => $branchname,
145
    suppliers_loop  => \@suppliers_loop,
146
    branches_loop   => \@branches_loop,
147
    DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
148
);
149
150
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/acqui/orderreceive.pl (-17 / +17 lines)
Lines 40-48 to know on what supplier this script has to display receive order. Link Here
40
40
41
=item receive
41
=item receive
42
42
43
=item invoice
43
=item invoiceid
44
44
45
the number of this invoice.
45
the id of this invoice.
46
46
47
=item freight
47
=item freight
48
48
Lines 61-67 The biblionumber of this order. Link Here
61
=cut
61
=cut
62
62
63
use strict;
63
use strict;
64
#use warnings; FIXME - Bug 2505
64
use warnings;
65
65
use CGI;
66
use CGI;
66
use C4::Context;
67
use C4::Context;
67
use C4::Koha;   # GetKohaAuthorisedValues GetItemTypes
68
use C4::Koha;   # GetKohaAuthorisedValues GetItemTypes
Lines 81-106 use C4::Suggestions; Link Here
81
my $input      = new CGI;
82
my $input      = new CGI;
82
83
83
my $dbh          = C4::Context->dbh;
84
my $dbh          = C4::Context->dbh;
84
my $booksellerid   = $input->param('booksellerid');
85
my $invoiceid    = $input->param('invoiceid');
85
my $ordernumber       = $input->param('ordernumber');
86
my $invoice      = GetInvoice($invoiceid);
87
my $booksellerid   = $invoice->{booksellerid};
88
my $freight      = $invoice->{shipmentcost};
89
my $datereceived = $invoice->{shipmentdate};
90
my $ordernumber  = $input->param('ordernumber');
86
my $search       = $input->param('receive');
91
my $search       = $input->param('receive');
87
my $invoice      = $input->param('invoice');
88
my $freight      = $input->param('freight');
89
my $datereceived = $input->param('datereceived');
90
91
92
92
$datereceived = $datereceived ? C4::Dates->new($datereceived, 'iso') : C4::Dates->new();
93
$datereceived = $datereceived ? C4::Dates->new($datereceived, 'iso') : C4::Dates->new();
93
94
94
my $bookseller = GetBookSellerFromId($booksellerid);
95
my $bookseller = GetBookSellerFromId($booksellerid);
95
my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst'));
96
my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
96
my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
97
my $results = SearchOrder($ordernumber,$search);
97
my $results = SearchOrder($ordernumber,$search);
98
98
99
100
my $count   = scalar @$results;
99
my $count   = scalar @$results;
101
my $order 	= GetOrder($ordernumber);
100
my $order 	= GetOrder($ordernumber);
102
101
103
104
my $date = @$results[0]->{'entrydate'};
102
my $date = @$results[0]->{'entrydate'};
105
103
106
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
104
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 167-173 if ( $count == 1 ) { Link Here
167
        unitprice             => @$results[0]->{'unitprice'},
165
        unitprice             => @$results[0]->{'unitprice'},
168
        memberfirstname       => $member->{firstname} || "",
166
        memberfirstname       => $member->{firstname} || "",
169
        membersurname         => $member->{surname} || "",
167
        membersurname         => $member->{surname} || "",
170
        invoice               => $invoice,
168
        invoiceid             => $invoice->{invoiceid},
169
        invoice               => $invoice->{invoicenumber},
171
        datereceived          => $datereceived->output(),
170
        datereceived          => $datereceived->output(),
172
        datereceived_iso      => $datereceived->output('iso'),
171
        datereceived_iso      => $datereceived->output('iso'),
173
        notes                 => $order->{notes},
172
        notes                 => $order->{notes},
Lines 181-187 else { Link Here
181
    for ( my $i = 0 ; $i < $count ; $i++ ) {
180
    for ( my $i = 0 ; $i < $count ; $i++ ) {
182
        my %line = %{ @$results[$i] };
181
        my %line = %{ @$results[$i] };
183
182
184
        $line{invoice}      = $invoice;
183
        $line{invoice}      = $invoice->{invoicenumber};
185
        $line{datereceived} = $datereceived->output();
184
        $line{datereceived} = $datereceived->output();
186
        $line{freight}      = $freight;
185
        $line{freight}      = $freight;
187
        $line{gst}          = $gst;
186
        $line{gst}          = $gst;
Lines 193-203 else { Link Here
193
192
194
    $template->param(
193
    $template->param(
195
        loop         => \@loop,
194
        loop         => \@loop,
196
        booksellerid   => $booksellerid,
195
        booksellerid => $booksellerid,
196
        invoiceid    => $invoice->{invoiceid},
197
    );
197
    );
198
}
198
}
199
my $op = $input->param('op');
199
my $op = $input->param('op');
200
if ($op eq 'edit'){
200
if ($op and $op eq 'edit'){
201
    $template->param(edit   =>   1);
201
    $template->param(edit   =>   1);
202
}
202
}
203
output_html_with_http_headers $input, $cookie, $template->output;
203
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/acqui/parcel.pl (-136 / +123 lines)
Lines 42-49 To know the supplier this script has to show orders. Link Here
42
42
43
is the bookseller invoice number.
43
is the bookseller invoice number.
44
44
45
=item freight
46
47
45
48
=item gst
46
=item gst
49
47
Lines 57-63 To filter the results list on this given date. Link Here
57
=cut
55
=cut
58
56
59
use strict;
57
use strict;
60
#use warnings; FIXME - Bug 2505
58
use warnings;
59
61
use C4::Auth;
60
use C4::Auth;
62
use C4::Acquisition;
61
use C4::Acquisition;
63
use C4::Budgets;
62
use C4::Budgets;
Lines 71-86 use C4::Suggestions; Link Here
71
use JSON;
70
use JSON;
72
71
73
my $input=new CGI;
72
my $input=new CGI;
74
my $booksellerid=$input->param('booksellerid');
73
75
my $bookseller=GetBookSellerFromId($booksellerid);
74
my $invoiceid = $input->param('invoiceid');
76
75
my $invoice = GetInvoiceDetails($invoiceid);
77
my $invoice=$input->param('invoice') || '';
76
my $booksellerid = $invoice->{booksellerid};
78
my $freight=$input->param('freight');
77
my $bookseller = GetBookSellerFromId($booksellerid);
79
my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst'));
78
my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
80
my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
79
my $datereceived = C4::Dates->new();
81
my $datereceived =  ($input->param('op') eq 'new') ? C4::Dates->new($input->param('datereceived')) 
82
					:  C4::Dates->new($input->param('datereceived'), 'iso')   ;
83
$datereceived = C4::Dates->new() unless $datereceived;
84
my $code            = $input->param('code');
80
my $code            = $input->param('code');
85
my @rcv_err         = $input->param('error');
81
my @rcv_err         = $input->param('error');
86
my @rcv_err_barcode = $input->param('error_bc');
82
my @rcv_err_barcode = $input->param('error_bc');
Lines 90-105 my $resultsperpage = $input->param('resultsperpage'); Link Here
90
$resultsperpage = 20 unless ($resultsperpage);
86
$resultsperpage = 20 unless ($resultsperpage);
91
$startfrom=0 unless ($startfrom);
87
$startfrom=0 unless ($startfrom);
92
88
93
if($input->param('format') eq "json"){
89
my $format = $input->param('format') || '';
90
if($format eq "json"){
94
    my ($template, $loggedinuser, $cookie)
91
    my ($template, $loggedinuser, $cookie)
95
        = get_template_and_user({template_name => "acqui/ajax.tmpl",
92
        = get_template_and_user({template_name => "acqui/ajax.tmpl",
96
                 query => $input,
93
                 query => $input,
97
				 type => "intranet",
94
                 type => "intranet",
98
                 authnotrequired => 0,
95
                 authnotrequired => 0,
99
                 flagsrequired => {acquisition => 'order_receive'},
96
                 flagsrequired => {acquisition => 'order_receive'},
100
                 debug => 1,
97
                 debug => 1,
101
    });
98
    });
102
       
99
103
    my @datas;
100
    my @datas;
104
    my $search   = $input->param('search') || '';
101
    my $search   = $input->param('search') || '';
105
    my $supplier = $input->param('booksellerid') || '';
102
    my $supplier = $input->param('booksellerid') || '';
Lines 110-116 if($input->param('format') eq "json"){ Link Here
110
    foreach my $order (@$orders){
107
    foreach my $order (@$orders){
111
        if($order->{quantityreceived} < $order->{quantity}){
108
        if($order->{quantityreceived} < $order->{quantity}){
112
            my $data = {};
109
            my $data = {};
113
            
110
114
            $data->{basketno} = $order->{basketno};
111
            $data->{basketno} = $order->{basketno};
115
            $data->{ordernumber} = $order->{ordernumber};
112
            $data->{ordernumber} = $order->{ordernumber};
116
            $data->{title} = $order->{title};
113
            $data->{title} = $order->{title};
Lines 118-131 if($input->param('format') eq "json"){ Link Here
118
            $data->{isbn} = $order->{isbn};
115
            $data->{isbn} = $order->{isbn};
119
            $data->{booksellerid} = $order->{booksellerid};
116
            $data->{booksellerid} = $order->{booksellerid};
120
            $data->{biblionumber} = $order->{biblionumber};
117
            $data->{biblionumber} = $order->{biblionumber};
121
            $data->{freight} = $order->{freight};
122
            $data->{quantity} = $order->{quantity};
118
            $data->{quantity} = $order->{quantity};
123
            $data->{ecost} = $order->{ecost};
119
            $data->{ecost} = $order->{ecost};
124
            $data->{ordertotal} = sprintf("%.2f",$order->{ecost}*$order->{quantity});
120
            $data->{ordertotal} = sprintf("%.2f",$order->{ecost}*$order->{quantity});
125
            push @datas, $data;
121
            push @datas, $data;
126
        }
122
        }
127
    }
123
    }
128
    
124
129
    my $json_text = to_json(\@datas);
125
    my $json_text = to_json(\@datas);
130
    $template->param(return => $json_text);
126
    $template->param(return => $json_text);
131
    output_html_with_http_headers $input, $cookie, $template->output;
127
    output_html_with_http_headers $input, $cookie, $template->output;
Lines 135-141 if($input->param('format') eq "json"){ Link Here
135
my ($template, $loggedinuser, $cookie)
131
my ($template, $loggedinuser, $cookie)
136
    = get_template_and_user({template_name => "acqui/parcel.tmpl",
132
    = get_template_and_user({template_name => "acqui/parcel.tmpl",
137
                 query => $input,
133
                 query => $input,
138
				 type => "intranet",
134
                 type => "intranet",
139
                 authnotrequired => 0,
135
                 authnotrequired => 0,
140
                 flagsrequired => {acquisition => 'order_receive'},
136
                 flagsrequired => {acquisition => 'order_receive'},
141
                 debug => 1,
137
                 debug => 1,
Lines 155-164 if( scalar(@rcv_err) ) { Link Here
155
}
151
}
156
152
157
my $cfstr         = "%.2f";                                                           # currency format string -- could get this from currency table.
153
my $cfstr         = "%.2f";                                                           # currency format string -- could get this from currency table.
158
my @parcelitems   = GetParcel($booksellerid, $invoice, $datereceived->output('iso'));
154
my @parcelitems   = @{ $invoice->{orders} };
159
my $countlines    = scalar @parcelitems;
155
my $countlines    = scalar @parcelitems;
160
my $totalprice    = 0;
156
my $totalprice    = 0;
161
my $totalfreight  = 0;
162
my $totalquantity = 0;
157
my $totalquantity = 0;
163
my $total;
158
my $total;
164
my $tototal;
159
my $tototal;
Lines 166-180 my @loop_received = (); Link Here
166
161
167
for (my $i = 0 ; $i < $countlines ; $i++) {
162
for (my $i = 0 ; $i < $countlines ; $i++) {
168
163
169
    #$total=($parcelitems[$i]->{'unitprice'} + $parcelitems[$i]->{'freight'}) * $parcelitems[$i]->{'quantityreceived'};   #weird, are the freight fees counted by book? (pierre)
164
    $total = ($parcelitems[$i]->{'unitprice'}) * $parcelitems[$i]->{'quantityreceived'};
170
    $total = ($parcelitems[$i]->{'unitprice'}) * $parcelitems[$i]->{'quantityreceived'};    #weird, are the freight fees counted by book? (pierre)
171
    $parcelitems[$i]->{'unitprice'} += 0;
165
    $parcelitems[$i]->{'unitprice'} += 0;
172
    my %line;
166
    my %line;
173
    %line          = %{ $parcelitems[$i] };
167
    %line          = %{ $parcelitems[$i] };
174
    $line{invoice} = $invoice;
168
    $line{invoice} = $invoice->{invoicenumber};
175
    $line{gst}     = $gst;
169
    $line{gst}     = $gst;
176
    $line{total} = sprintf($cfstr, $total);
170
    $line{total} = sprintf($cfstr, $total);
177
    $line{booksellerid} = $booksellerid;
171
    $line{booksellerid} = $invoice->{booksellerid};
178
    push @loop_received, \%line;
172
    push @loop_received, \%line;
179
    $totalprice += $parcelitems[$i]->{'unitprice'};
173
    $totalprice += $parcelitems[$i]->{'unitprice'};
180
    $line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'});
174
    $line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'});
Lines 184-327 for (my $i = 0 ; $i < $countlines ; $i++) { Link Here
184
    $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
178
    $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
185
    $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
179
    $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
186
180
187
    #double FIXME - totalfreight is redefined later.
188
189
# FIXME - each order in a  parcel holds the freight for the whole parcel. This means if you receive a parcel with items from multiple budgets, you'll see the freight charge in each budget..
190
    if ($i > 0 && $totalfreight != $parcelitems[$i]->{'freight'}) {
191
        warn "FREIGHT CHARGE MISMATCH!!";
192
    }
193
    $totalfreight = $parcelitems[$i]->{'freight'};
194
    $totalquantity += $parcelitems[$i]->{'quantityreceived'};
181
    $totalquantity += $parcelitems[$i]->{'quantityreceived'};
195
    $tototal       += $total;
182
    $tototal       += $total;
196
}
183
}
197
184
198
my $pendingorders = GetPendingOrders($booksellerid);
185
if(!defined $invoice->{closedate}) {
199
my $countpendings = scalar @$pendingorders;
186
    my $pendingorders = GetPendingOrders($booksellerid);
200
187
    my $countpendings = scalar @$pendingorders;
201
# pending orders totals
188
202
my ($totalPunitprice, $totalPquantity, $totalPecost, $totalPqtyrcvd);
189
    # pending orders totals
203
my $ordergrandtotal;
190
    my ($totalPunitprice, $totalPquantity, $totalPecost, $totalPqtyrcvd);
204
my @loop_orders = ();
191
    my $ordergrandtotal;
205
for (my $i = 0 ; $i < $countpendings ; $i++) {
192
    my @loop_orders = ();
206
    my %line;
193
    for (my $i = 0 ; $i < $countpendings ; $i++) {
207
    %line = %{$pendingorders->[$i]};
194
        my %line;
208
   
195
        %line = %{$pendingorders->[$i]};
209
    $line{quantity}+=0;
196
210
    $line{quantityreceived}+=0;
197
        $line{quantity}+=0;
211
    $line{unitprice}+=0;
198
        $line{quantityreceived}+=0;
212
    $totalPunitprice += $line{unitprice};
199
        $line{unitprice}+=0;
213
    $totalPquantity +=$line{quantity};
200
        $totalPunitprice += $line{unitprice};
214
    $totalPqtyrcvd +=$line{quantityreceived};
201
        $totalPquantity +=$line{quantity};
215
    $totalPecost += $line{ecost};
202
        $totalPqtyrcvd +=$line{quantityreceived};
216
    $line{ecost} = sprintf("%.2f",$line{ecost});
203
        $totalPecost += $line{ecost};
217
    $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity});
204
        $line{ecost} = sprintf("%.2f",$line{ecost});
218
    $line{unitprice} = sprintf("%.2f",$line{unitprice});
205
        $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity});
219
    $line{invoice} = $invoice;
206
        $line{unitprice} = sprintf("%.2f",$line{unitprice});
220
    $line{gst} = $gst;
207
        $line{invoice} = $invoice;
221
    $line{total} = $total;
208
        $line{gst} = $gst;
222
    $line{booksellerid} = $booksellerid;
209
        $line{total} = $total;
223
    $ordergrandtotal += $line{ecost} * $line{quantity};
210
        $line{booksellerid} = $booksellerid;
224
    
211
        $ordergrandtotal += $line{ecost} * $line{quantity};
225
    my $biblionumber = $line{'biblionumber'};
212
226
    my $countbiblio = CountBiblioInOrders($biblionumber);
213
        my $biblionumber = $line{'biblionumber'};
227
    my $ordernumber = $line{'ordernumber'};
214
        my $countbiblio = CountBiblioInOrders($biblionumber);
228
    my @subscriptions = GetSubscriptionsId ($biblionumber);
215
        my $ordernumber = $line{'ordernumber'};
229
    my $itemcount = GetItemsCount($biblionumber);
216
        my @subscriptions = GetSubscriptionsId ($biblionumber);
230
    my $holds  = GetHolds ($biblionumber);
217
        my $itemcount = GetItemsCount($biblionumber);
231
    my @items = GetItemnumbersFromOrder( $ordernumber );
218
        my $holds  = GetHolds ($biblionumber);
232
    my $itemholds;
219
        my @items = GetItemnumbersFromOrder( $ordernumber );
233
    foreach my $item (@items){
220
        my $itemholds;
234
        my $nb = GetItemHolds($biblionumber, $item);
221
        foreach my $item (@items){
235
        if ($nb){
222
            my $nb = GetItemHolds($biblionumber, $item);
236
            $itemholds += $nb;
223
            if ($nb){
224
                $itemholds += $nb;
225
            }
237
        }
226
        }
238
    }
239
227
240
    my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
228
        my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
241
    $line{suggestionid}         = $suggestion->{suggestionid};
229
        $line{suggestionid}         = $suggestion->{suggestionid};
242
    $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
230
        $line{surnamesuggestedby}   = $suggestion->{surnamesuggestedby};
243
    $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
231
        $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby};
232
233
        # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680
234
        $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds);
235
        $line{items}                = ($itemcount) - (scalar @items);
236
        $line{left_item}            = 1 if $line{items} >= 1;
237
        $line{left_biblio}          = 1 if $countbiblio > 1;
238
        $line{biblios}              = $countbiblio - 1;
239
        $line{left_subscription}    = 1 if scalar @subscriptions >= 1;
240
        $line{subscriptions}        = scalar @subscriptions;
241
        $line{left_holds}           = ($holds >= 1) ? 1 : 0;
242
        $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
243
        $line{holds}                = $holds;
244
        $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
245
        
246
        
247
        push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage);
248
    }
244
249
245
    # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680
250
    my $count = $countpendings;
246
    $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds);
247
    $line{items}                = ($itemcount) - (scalar @items);
248
    $line{left_item}            = 1 if $line{items} >= 1;
249
    $line{left_biblio}          = 1 if $countbiblio > 1;
250
    $line{biblios}              = $countbiblio - 1;
251
    $line{left_subscription}    = 1 if scalar @subscriptions >= 1;
252
    $line{subscriptions}        = scalar @subscriptions;
253
    $line{left_holds}           = 1 if $holds >= 1;
254
    $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
255
    $line{holds}                = $holds;
256
    $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
257
    
258
    
259
    push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage);
260
}
261
$freight = $totalfreight unless $freight;
262
251
263
my $count = $countpendings;
252
    if ($count>$resultsperpage){
253
        my $displaynext=0;
254
        my $displayprev=$startfrom;
255
        if(($count - ($startfrom+$resultsperpage)) > 0 ) {
256
            $displaynext = 1;
257
        }
264
258
265
if ($count>$resultsperpage){
259
        my @numbers = ();
266
    my $displaynext=0;
260
        for (my $i=1; $i<$count/$resultsperpage+1; $i++) {
267
    my $displayprev=$startfrom;
261
                my $highlight=0;
268
    if(($count - ($startfrom+$resultsperpage)) > 0 ) {
262
                ($startfrom/$resultsperpage==($i-1)) && ($highlight=1);
269
        $displaynext = 1;
263
                push @numbers, { number => $i,
270
    }
264
                    highlight => $highlight ,
265
                    startfrom => ($i-1)*$resultsperpage};
266
        }
271
267
272
    my @numbers = ();
268
        my $from = $startfrom*$resultsperpage+1;
273
    for (my $i=1; $i<$count/$resultsperpage+1; $i++) {
269
        my $to;
274
            my $highlight=0;
270
        if($count < (($startfrom+1)*$resultsperpage)){
275
            ($startfrom/$resultsperpage==($i-1)) && ($highlight=1);
271
            $to = $count;
276
            push @numbers, { number => $i,
272
        } else {
277
                highlight => $highlight ,
273
            $to = (($startfrom+1)*$resultsperpage);
278
                startfrom => ($i-1)*$resultsperpage};
274
        }
275
        $template->param(numbers=>\@numbers,
276
                         displaynext=>$displaynext,
277
                         displayprev=>$displayprev,
278
                         nextstartfrom=>(($startfrom+$resultsperpage<$count)?$startfrom+$resultsperpage:$count),
279
                         prevstartfrom=>(($startfrom-$resultsperpage>0)?$startfrom-$resultsperpage:0)
280
                        );
279
    }
281
    }
280
282
281
    my $from = $startfrom*$resultsperpage+1;
283
    $template->param(
282
    my $to;
284
        countpending => $countpendings,
283
    if($count < (($startfrom+1)*$resultsperpage)){
285
        loop_orders  => \@loop_orders,
284
        $to = $count;
286
        ordergrandtotal => sprintf($cfstr, $ordergrandtotal),
285
    } else {
287
        totalPunitprice => sprintf("%.2f", $totalPunitprice),
286
        $to = (($startfrom+1)*$resultsperpage);
288
        totalPquantity  => $totalPquantity,
287
    }
289
        totalPqtyrcvd   => $totalPqtyrcvd,
288
    $template->param(numbers=>\@numbers,
290
        totalPecost     => sprintf("%.2f", $totalPecost),
289
                     displaynext=>$displaynext,
291
    );
290
                     displayprev=>$displayprev,
291
                     nextstartfrom=>(($startfrom+$resultsperpage<$count)?$startfrom+$resultsperpage:$count),
292
                     prevstartfrom=>(($startfrom-$resultsperpage>0)?$startfrom-$resultsperpage:0)
293
                    );
294
}
292
}
295
293
296
#$totalfreight=$freight;
297
$tototal = $tototal + $freight;
298
294
299
$template->param(
295
$template->param(
300
    invoice               => $invoice,
296
    invoiceid             => $invoice->{invoiceid},
297
    invoice               => $invoice->{invoicenumber},
298
    invoiceclosedate      => $invoice->{closedate},
301
    datereceived          => $datereceived->output('iso'),
299
    datereceived          => $datereceived->output('iso'),
302
    invoicedatereceived   => $datereceived->output('iso'),
300
    invoicedatereceived   => $datereceived->output('iso'),
303
    formatteddatereceived => $datereceived->output(),
301
    formatteddatereceived => $datereceived->output(),
304
    name                  => $bookseller->{'name'},
302
    name                  => $bookseller->{'name'},
305
    booksellerid            => $booksellerid,
303
    booksellerid          => $bookseller->{id},
306
    gst                   => $gst,
304
    gst                   => $gst,
307
    freight               => $freight,
308
    invoice               => $invoice,
309
    countreceived         => $countlines,
305
    countreceived         => $countlines,
310
    loop_received         => \@loop_received,
306
    loop_received         => \@loop_received,
311
    countpending          => $countpendings,
312
    loop_orders           => \@loop_orders,
313
    totalprice            => sprintf($cfstr, $totalprice),
307
    totalprice            => sprintf($cfstr, $totalprice),
314
    totalfreight          => $totalfreight,
315
    totalquantity         => $totalquantity,
308
    totalquantity         => $totalquantity,
316
    tototal               => sprintf($cfstr, $tototal),
309
    tototal               => sprintf($cfstr, $tototal),
317
    ordergrandtotal       => sprintf($cfstr, $ordergrandtotal),
318
    gst                   => $gst,
310
    gst                   => $gst,
319
    grandtot              => sprintf($cfstr, $tototal + $gst),
311
    grandtot              => sprintf($cfstr, $tototal + $gst),
320
    totalPunitprice       => sprintf("%.2f", $totalPunitprice),
321
    totalPquantity        => $totalPquantity,
322
    totalPqtyrcvd         => $totalPqtyrcvd,
323
    totalPecost           => sprintf("%.2f", $totalPecost),
324
    resultsperpage        => $resultsperpage,
312
    resultsperpage        => $resultsperpage,
325
);
313
);
326
output_html_with_http_headers $input, $cookie, $template->output;
314
output_html_with_http_headers $input, $cookie, $template->output;
327
 
(-)a/acqui/parcels.pl (-12 / +40 lines)
Lines 44-52 To know the supplier this script has to show orders. Link Here
44
sort list of order by 'orderby'.
44
sort list of order by 'orderby'.
45
Orderby can be equals to
45
Orderby can be equals to
46
    * datereceived desc (default value)
46
    * datereceived desc (default value)
47
    * aqorders.booksellerinvoicenumber
47
    * invoicenumber
48
    * datereceived
48
    * datereceived
49
    * aqorders.booksellerinvoicenumber desc
49
    * invoicenumber desc
50
50
51
=item filter
51
=item filter
52
52
Lines 84-89 my $code = $input->param('filter'); Link Here
84
my $datefrom       = $input->param('datefrom');
84
my $datefrom       = $input->param('datefrom');
85
my $dateto         = $input->param('dateto');
85
my $dateto         = $input->param('dateto');
86
my $resultsperpage = $input->param('resultsperpage');
86
my $resultsperpage = $input->param('resultsperpage');
87
my $op             = $input->param('op');
87
$resultsperpage ||= 20;
88
$resultsperpage ||= 20;
88
89
89
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
90
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 96-103 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
96
    }
97
    }
97
);
98
);
98
99
100
if($op and $op eq 'new') {
101
    my $invoicenumber = $input->param('invoice');
102
    my $shipmentdate = $input->param('shipmentdate');
103
    if($shipmentdate) {
104
        $shipmentdate = C4::Dates->new($shipmentdate)->output('iso');
105
    }
106
    my $invoiceid = AddInvoice(
107
        invoicenumber => $invoicenumber,
108
        booksellerid => $booksellerid,
109
        shipmentdate => $shipmentdate,
110
    );
111
    if(defined $invoiceid) {
112
        # Successful 'Add'
113
        print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid");
114
        exit 0;
115
    } else {
116
        $template->param(error_failed_to_create_invoice => 1);
117
    }
118
}
119
99
my $bookseller = GetBookSellerFromId($booksellerid);
120
my $bookseller = GetBookSellerFromId($booksellerid);
100
my @parcels = GetParcels( $booksellerid, $order, $code, $datefrom, $dateto );
121
my @parcels = GetInvoices(
122
    supplierid => $booksellerid,
123
    invoicenumber => $code,
124
    shipmentdatefrom => $datefrom,
125
    shipmentdateto => $dateto,
126
    order_by => $order
127
);
101
my $count_parcels = @parcels;
128
my $count_parcels = @parcels;
102
129
103
# multi page display gestion
130
# multi page display gestion
Lines 114-127 for my $i ( $startfrom .. $last_row) { Link Here
114
141
115
    push @{$loopres},
142
    push @{$loopres},
116
      { number           => $i + 1,
143
      { number           => $i + 1,
117
        code             => $p->{booksellerinvoicenumber},
144
        invoiceid        => $p->{invoiceid},
118
        nullcode         => $p->{booksellerinvoicenumber} eq 'NULL',
145
        code             => $p->{invoicenumber},
119
        emptycode        => $p->{booksellerinvoicenumber} eq q{},
146
        nullcode         => $p->{invoicenumber} eq 'NULL',
120
        raw_datereceived => $p->{datereceived},
147
        emptycode        => $p->{invoicenumber} eq q{},
121
        datereceived     => format_date( $p->{datereceived} ),
148
        raw_datereceived => $p->{shipmentdate},
122
        bibcount         => $p->{biblio},
149
        datereceived     => format_date( $p->{shipmentdate} ),
123
        reccount         => $p->{itemsreceived},
150
        bibcount         => $p->{receivedbiblios} || 0,
124
        itemcount        => $p->{itemsexpected},
151
        reccount         => $p->{receiveditems} || 0,
152
        itemcount        => $p->{itemsexpected} || 0,
125
      };
153
      };
126
}
154
}
127
if ($count_parcels) {
155
if ($count_parcels) {
Lines 135-141 $template->param( Link Here
135
    resultsperpage           => $resultsperpage,
163
    resultsperpage           => $resultsperpage,
136
    name                     => $bookseller->{'name'},
164
    name                     => $bookseller->{'name'},
137
    DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
165
    DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
138
    datereceived_today       => C4::Dates->new()->output(),
166
    shipmentdate_today       => C4::Dates->new()->output(),
139
    booksellerid             => $booksellerid,
167
    booksellerid             => $booksellerid,
140
    GST                      => C4::Context->preference('gist'),
168
    GST                      => C4::Context->preference('gist'),
141
);
169
);
(-)a/acqui/spent.pl (-12 / +35 lines)
Lines 61-70 SELECT Link Here
61
    aqbasket.booksellerid,
61
    aqbasket.booksellerid,
62
    itype,
62
    itype,
63
    title,
63
    title,
64
    aqorders.booksellerinvoicenumber,
64
    aqorders.invoiceid,
65
    aqinvoices.invoicenumber,
65
    quantityreceived,
66
    quantityreceived,
66
    unitprice,
67
    unitprice,
67
    freight,
68
    datereceived,
68
    datereceived,
69
    aqorders.biblionumber
69
    aqorders.biblionumber
70
FROM (aqorders, aqbasket)
70
FROM (aqorders, aqbasket)
Lines 74-79 LEFT JOIN biblio ON Link Here
74
    biblio.biblionumber=aqorders.biblionumber
74
    biblio.biblionumber=aqorders.biblionumber
75
LEFT JOIN aqorders_items ON
75
LEFT JOIN aqorders_items ON
76
    aqorders.ordernumber=aqorders_items.ordernumber
76
    aqorders.ordernumber=aqorders_items.ordernumber
77
LEFT JOIN aqinvoices ON
78
    aqorders.invoiceid = aqinvoices.invoiceid
77
WHERE
79
WHERE
78
    aqorders.basketno=aqbasket.basketno AND
80
    aqorders.basketno=aqbasket.basketno AND
79
    budget_id=? AND
81
    budget_id=? AND
Lines 86-112 $sth->execute($bookfund); Link Here
86
if ( $sth->err ) {
88
if ( $sth->err ) {
87
    die "An error occurred fetching records: " . $sth->errstr;
89
    die "An error occurred fetching records: " . $sth->errstr;
88
}
90
}
89
my $total = 0;
91
my $subtotal = 0;
90
my $toggle;
92
my $toggle;
91
my @spent;
93
my @spent;
92
while ( my $data = $sth->fetchrow_hashref ) {
94
while ( my $data = $sth->fetchrow_hashref ) {
93
    my $recv = $data->{'quantityreceived'};
95
    my $recv = $data->{'quantityreceived'};
94
    if ( $recv > 0 ) {
96
    if ( $recv > 0 ) {
95
        my $subtotal = $recv * ( $data->{'unitprice'} + $data->{'freight'} );
97
        my $rowtotal = $recv * $data->{'unitprice'};
96
        $data->{'subtotal'}  = sprintf( "%.2f", $subtotal );
98
        $data->{'rowtotal'}  = sprintf( "%.2f", $rowtotal );
97
        $data->{'freight'}   = sprintf( "%.2f", $data->{'freight'} );
98
        $data->{'unitprice'} = sprintf( "%.2f", $data->{'unitprice'} );
99
        $data->{'unitprice'} = sprintf( "%.2f", $data->{'unitprice'} );
99
        $total += $subtotal;
100
        $subtotal += $rowtotal;
100
        push @spent, $data;
101
        push @spent, $data;
101
    }
102
    }
102
103
103
}
104
}
104
$total = sprintf( "%.2f", $total );
105
105
106
$template->{VARS}->{'fund'}  = $bookfund;
106
my $total = $subtotal;
107
$template->{VARS}->{'spent'} = \@spent;
107
$query = qq{
108
$template->{VARS}->{'total'} = $total;
108
    SELECT invoicenumber, shipmentcost
109
$template->{VARS}->{'fund_code'} = $fund_code;
109
    FROM aqinvoices
110
    WHERE shipmentcost_budgetid = ?
111
};
112
$sth = $dbh->prepare($query);
113
$sth->execute($bookfund);
114
my @shipmentcosts;
115
while (my $data = $sth->fetchrow_hashref) {
116
    push @shipmentcosts, {
117
        shipmentcost => sprintf("%.2f", $data->{shipmentcost}),
118
        invoicenumber => $data->{invoicenumber}
119
    };
120
    $total += $data->{shipmentcost};
121
}
110
$sth->finish;
122
$sth->finish;
111
123
124
$total = sprintf( "%.2f", $total );
125
126
$template->param(
127
    fund => $bookfund,
128
    spent => \@spent,
129
    subtotal => $subtotal,
130
    shipmentcosts => \@shipmentcosts,
131
    total => $total,
132
    fund_code => $fund_code
133
);
134
112
output_html_with_http_headers $input, $cookie, $template->output;
135
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/catalogue/moredetail.pl (-1 / +1 lines)
Lines 146-152 foreach my $item (@items){ Link Here
146
    $item->{'booksellerid'}            = $basket->{'booksellerid'};
146
    $item->{'booksellerid'}            = $basket->{'booksellerid'};
147
    $item->{'ordernumber'}             = $order->{'ordernumber'};
147
    $item->{'ordernumber'}             = $order->{'ordernumber'};
148
    $item->{'basketno'}                = $order->{'basketno'};
148
    $item->{'basketno'}                = $order->{'basketno'};
149
    $item->{'booksellerinvoicenumber'} = $order->{'booksellerinvoicenumber'};
149
    $item->{'invoiceid'}               = $order->{'invoiceid'};
150
    $item->{'datereceived'}            = $order->{'datereceived'};
150
    $item->{'datereceived'}            = $order->{'datereceived'};
151
151
152
    if ($item->{notforloantext} or $item->{itemlost} or $item->{damaged} or $item->{wthdrawn}) {
152
    if ($item->{notforloantext} or $item->{itemlost} or $item->{damaged} or $item->{wthdrawn}) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc (+1 lines)
Lines 1-6 Link Here
1
<ul>
1
<ul>
2
	<li><a href="/cgi-bin/koha/acqui/lateorders.pl">Late orders</a></li>
2
	<li><a href="/cgi-bin/koha/acqui/lateorders.pl">Late orders</a></li>
3
	[% IF ( suggestion ) %]<li><a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a></li>[% ELSE %][% END %]
3
	[% IF ( suggestion ) %]<li><a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a></li>[% ELSE %][% END %]
4
    <li><a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a></li>
4
    [% IF ( CAN_user_acquisition_budget_manage ) %]
5
    [% IF ( CAN_user_acquisition_budget_manage ) %]
5
	<li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets &amp; Funds</a></li>
6
	<li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets &amp; Funds</a></li>
6
    [% END %]
7
    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt (-1 / +5 lines)
Lines 89-95 Link Here
89
                        <br />[% suggestions_loo.author %] <br /> [% suggestions_loo.isbn %]</td>
89
                        <br />[% suggestions_loo.author %] <br /> [% suggestions_loo.isbn %]</td>
90
					<td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% suggestions_loo.id %]">[% suggestions_loo.name %]</a></td>
90
					<td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% suggestions_loo.id %]">[% suggestions_loo.name %]</a></td>
91
					<td>[% suggestions_loo.creationdate | $KohaDates %]</td>
91
					<td>[% suggestions_loo.creationdate | $KohaDates %]</td>
92
					<td>[% suggestions_loo.datereceived | $KohaDates %]</td>
92
                    <td>
93
                        [% IF suggestions_loo.datereceived %]
94
                            [% suggestions_loo.datereceived | $KohaDates %]
95
                        [% END %]
96
                    </td>
93
					<td>[% suggestions_loo.quantity %]</td>
97
					<td>[% suggestions_loo.quantity %]</td>
94
					<td>[% suggestions_loo.ecost %]</td>
98
					<td>[% suggestions_loo.ecost %]</td>
95
				</tr>
99
				</tr>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt (+192 lines)
Line 0 Link Here
1
[% USE KohaDates %]
2
3
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Acquisitions &rsaquo; Invoice</title>
5
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
6
[% INCLUDE 'doc-head-close.inc' %]
7
[% INCLUDE 'calendar.inc' %]
8
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
9
[% INCLUDE 'datatables-strings.inc' %]
10
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
11
<script type="text/javascript">
12
//<![CDATA[
13
    $(document).ready(function() {
14
        $("#orderst").dataTable($.extend(true, {}, dataTablesDefaults, {
15
            bInfo: false,
16
            bPaginate: false,
17
            bFilter: false,
18
        }));
19
        Calendar.setup({
20
            inputField: "shipmentdate",
21
            ifFormat: "[% DHTMLcalendar_dateformat %]",
22
            button: "shipmentdateCalendar"
23
        });
24
        Calendar.setup({
25
            inputField: "billingdate",
26
            ifFormat: "[% DHTMLcalendar_dateformat %]",
27
            button: "billingdateCalendar"
28
        });
29
    });
30
//]]>
31
</script>
32
</head>
33
34
<body>
35
[% INCLUDE 'header.inc' %]
36
[% INCLUDE 'acquisitions-search.inc' %]
37
38
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a> &rsaquo; <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid %]">[% invoicenumber %]</a></div>
39
40
<div id="doc3" class="yui-t2">
41
42
<div id="bd">
43
  <div id="yui-main">
44
    <div class="yui-b">
45
      [% IF ( modified ) %]
46
        <div class="dialog">
47
          <p>Invoice has been modified</p>
48
        </div>
49
      [% END %]
50
      <h1>Invoice: [% invoicenumber %]</h1>
51
52
      <p>Supplier: [% suppliername %]</p>
53
      <form action="" method="post">
54
        <label for="shipmentdate">Shipment date:</label>
55
        [% IF (shipmentdate) %]
56
            <input type="text" size="10" id="shipmentdate" name="shipmentdate" value="[% shipmentdate | $KohaDates %]" readonly="readonly" />
57
        [% ELSE %]
58
            <input type="text" size="10" id="shipmentdate" name="shipmentdate" readonly="readonly" />
59
        [% END %]
60
        <img id="shipmentdateCalendar" alt="Show Calendar" style="cursor:pointer" src="[% themelang %]/lib/calendar/cal.gif" />
61
        <p></p>
62
        <label for="billingdate">Billing date:</label>
63
        [% IF (billingdate) %]
64
            <input type="text" size="10" id="billingdate" name="billingdate" value="[% billingdate | $KohaDates %]" readonly="readonly" />
65
        [% ELSE %]
66
            <input type="text" size="10" id="billingdate" name="billingdate" value="[% billingdate | $KohaDates %]" readonly="readonly" />
67
        [% END %]
68
        <img id="billingdateCalendar" alt="Show Calendar" style="cursor:pointer" src="[% themelang %]/lib/calendar/cal.gif" />
69
        <p></p>
70
        <label for="shipmentcost">Shipment cost:</label>
71
        <input type="text" size="10" id="shipmentcost" name="shipmentcost" value="[% shipmentcost %]" />
72
        <label for="shipment_budget_id">Budget:</label>
73
        <select id="shipment_budget_id" name="shipment_budget_id">
74
            <option value="">No budget</option>
75
          [% FOREACH budget IN budgets_loop %]
76
            [% IF ( budget.selected ) %]
77
              <option selected="selected" value="[% budget.budget_id %]">
78
            [% ELSE %]
79
              <option value="[% budget.budget_id %]">
80
            [% END %]
81
              [% budget.budget_name %]
82
            </option>
83
          [% END %]
84
        </select>
85
        <input type="hidden" name="op" value="mod" />
86
        <input type="hidden" name="invoiceid" value="[% invoiceid %]" />
87
        <fieldset class="action">
88
            <input type="submit" value="Save">
89
        </fieldset>
90
      </form>
91
      <p>Status:
92
        [% IF ( invoiceclosedate ) %]
93
          Closed on [% invoiceclosedate | $KohaDates %].
94
          <a href="/cgi-bin/koha/acqui/invoice.pl?op=reopen&invoiceid=[% invoiceid %]">
95
            Reopen
96
          </a>
97
        [% ELSE %]
98
          Open.
99
          <a href="/cgi-bin/koha/acqui/invoice.pl?op=close&invoiceid=[% invoiceid %]">
100
            Close
101
          </a>
102
        [% END %]
103
      </p>
104
      <p>
105
          <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]">Go to receipt page</a>
106
      </p>
107
      <h2>Invoice details</h2>
108
      [% IF orders_loop.size %]
109
          <table id="orderst">
110
            <thead>
111
              <tr>
112
                <th>Summary</th>
113
                <th>Publisher</th>
114
                <th>Branch</th>
115
                <th>RRP</th>
116
                <th>Est.</th>
117
                <th>Qty.</th>
118
                <th>Total</th>
119
                <th>Fund</th>
120
              </tr>
121
            </thead>
122
            <tbody>
123
              [% FOREACH order IN orders_loop %]
124
                <tr>
125
                  <td><p>[% order.title %]
126
                    [% IF ( order.author ) %]
127
                      <br /><em>by</em> [% order.author %]
128
                    [% END %]
129
                  </p></td>
130
                  <td>
131
                    [% IF ( order.publishercode ) %]
132
                      <p>[% order.publishercode %]
133
                        [% IF ( order.publicationyear ) %]
134
                          - [% order.publicationyear %]
135
                        [% END %]
136
                      </p>
137
                    [% END %]
138
                  </td>
139
                  <td><p>[% order.branchcode %]</p></td>
140
                  <td>[% order.rrp %]</td>
141
                  <td>[% order.ecost %]</td>
142
                  <td class="number">[% order.quantity %]</td>
143
                  <td>[% order.total %]</td>
144
                  <td>[% order.budget_name %]</td>
145
                </tr>
146
              [% END %]
147
            </tbody>
148
            <tfoot>
149
                <tr>
150
                    <th colspan="3">Total Tax Exc.</th>
151
                    <th>[% total_rrp_gste %]</th>
152
                    <th>&nbsp;</th>
153
                    <th>[% total_quantity %]</th>
154
                    <th>[% total_est_gste %]</th>
155
                    <th>&nbsp;</th>
156
                </tr>
157
                <tr>
158
                    <th colspan='3'>Tax ([% gist %]%)</th>
159
                    <th>[% gist_rrp %]</th>
160
                    <th>&nbsp;</th>
161
                    <th>&nbsp;</th>
162
                    <th>[% gist_est %]</th>
163
                    <th>&nbsp;</th>
164
                </tr>
165
                <tr>
166
                    <th colspan='3'>Total Tax Inc. ([% currency %])</th>
167
                    <th>[% total_rrp_gsti %]</th>
168
                    <th>&nbsp;</th>
169
                    <th>[% total_quantity %]</th>
170
                    <th>[% total_est_gsti %]</th>
171
                    <th>&nbsp;</th>
172
                </tr>
173
                <tr>
174
                    <th colspan="3">Total + Shipment cost ([% currency %])</th>
175
                    <th>&nbsp;</th>
176
                    <th>&nbsp;</th>
177
                    <th>[% total_quantity %]</th>
178
                    <th>[% total_gsti_shipment %]</th>
179
                    <th>&nbsp;</th>
180
                </tr>
181
            </tfoot>
182
          </table>
183
        [% ELSE %]
184
            <p>No orders yet</p>
185
        [% END %]
186
    </div>
187
  </div>
188
  <div class="yui-b">
189
    [% INCLUDE 'acquisitions-menu.inc' %]
190
  </div>
191
</div>
192
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt (+228 lines)
Line 0 Link Here
1
[% USE KohaDates %]
2
3
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Acquisitions &rsaquo; Invoices</title>
5
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
6
[% INCLUDE 'doc-head-close.inc' %]
7
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
8
[% INCLUDE 'datatables-strings.inc' %]
9
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
10
[% INCLUDE 'calendar.inc' %]
11
<script type="text/javascript">
12
//<![CDATA[
13
$(document).ready(function() {
14
    Calendar.setup({
15
        inputField: "billingdatefrom",
16
        ifFormat: "[% DHTMLcalendar_dateformat %]",
17
        button: "billingdatefromCalendar"
18
    });
19
    Calendar.setup({
20
        inputField: "billingdateto",
21
        ifFormat: "[% DHTMLcalendar_dateformat %]",
22
        button: "billingdatetoCalendar"
23
    });
24
    $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
25
        bInfo: false,
26
        bPaginate: false,
27
        bFilter: false,
28
        aoColumnDefs: [
29
            { "bSortable": false, "aTargets": [6] }
30
        ]
31
    }));
32
});
33
//]]>
34
</script>
35
</head>
36
37
<body>
38
[% INCLUDE 'header.inc' %]
39
[% INCLUDE 'acquisitions-search.inc' %]
40
41
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; Invoices</div>
42
43
<div id="doc3" class="yui-t2">
44
45
<div id="bd">
46
  <div id="yui-main">
47
    <div class="yui-b">
48
      <h1>Invoices</h1>
49
      [% IF ( do_search ) %]
50
        [% IF ( results_loop ) %]
51
          <table id="resultst">
52
            <thead>
53
              <tr>
54
                <th>Invoice no.</th>
55
                <th>Vendor</th>
56
                <th>Billing date</th>
57
                <th>Received biblios</th>
58
                <th>Received items</th>
59
                <th>Status</th>
60
                <th>&nbsp;</th>
61
              </tr>
62
            </thead>
63
            <tbody>
64
              [% FOREACH result IN results_loop %]
65
                <tr>
66
                  <td>[% result.invoicenumber %]</td>
67
                  <td>[% result.suppliername %]</td>
68
                  <td>
69
                    [% IF (result.billingdate) %]
70
                      [% result.billingdate | $KohaDates %]
71
                    [% END %]
72
                  </td>
73
                  <td>[% result.receivedbiblios %]</td>
74
                  <td>[% result.receiveditems %]</td>
75
                  <td>
76
                    [% IF ( result.closedate ) %]
77
                      Closed on [% result.closedate | $KohaDates %]
78
                    [% ELSE %]
79
                      Open
80
                    [% END %]
81
                  </td>
82
                  <td>
83
                    <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% result.invoiceid %]">Details</a> /
84
                    [% IF ( result.closedate ) %]
85
                      <a href="invoice.pl?op=reopen&invoiceid=[% result.invoiceid %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% supplier %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]">Reopen</a>
86
                    [% ELSE %]
87
                      <a href="invoice.pl?op=close&invoiceid=[% result.invoiceid %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% supplier %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]">Close</a>
88
                    [% END %]
89
                  </td>
90
                </tr>
91
              [% END %]
92
            </tbody>
93
          </table>
94
        [% ELSE %]
95
          <p>Sorry, but there is no results for your search.</p>
96
          <p>Search was:
97
            <ul>
98
              [% IF ( invoicenumber ) %]
99
                <li>Invoice no.: [% invoicenumber %]</li>
100
              [% END %]
101
              [% IF ( supplier ) %]
102
                <li>Vendor: [% suppliername %]</li>
103
              [% END %]
104
              [% IF ( billingdatefrom ) %]
105
                <li>Billing date:
106
                [% IF ( billingdateto ) %]
107
                  From [% billingdatefrom %]
108
                  To [% billingdateto %]
109
                [% ELSE %]
110
                  All since [% billingdatefrom %]
111
                [% END %]
112
                </li>
113
              [% ELSE %]
114
                [% IF ( billingdateto ) %]
115
                  <li>Billing date:
116
                    All until [% billingdateto %]
117
                  </li>
118
                [% END %]
119
              [% END %]
120
              [% IF ( isbneanissn ) %]
121
                <li>ISBN/EAN/ISSN: [% isbneanissn %]</li>
122
              [% END %]
123
              [% IF ( title ) %]
124
                <li>Title: [% title %]</li>
125
              [% END %]
126
              [% IF ( author ) %]
127
                <li>Author: [% author %]</li>
128
              [% END %]
129
              [% IF ( publisher ) %]
130
                <li>Publisher: [% publisher %]</li>
131
              [% END %]
132
              [% IF ( publicationyear ) %]
133
                <li>Publication year: [% publicationyear %]</li>
134
              [% END %]
135
              [% IF ( branch ) %]
136
                <li>Branch: [% branchname %]</li>
137
              [% END %]
138
            </ul>
139
          </p>
140
        [% END %]<!-- results_loop -->
141
      [% ELSE %]
142
        <p>Please fill in the form to the left to make a search.</p>
143
      [% END %]<!-- do_search -->
144
    </div>
145
  </div>
146
  <div class="yui-b">
147
    <form action="" method="get">
148
      <fieldset class="brief">
149
        <h3>Search filters</h3>
150
        <ol>
151
          <li>
152
            <label for="invoicenumber">Invoice no:</label>
153
            <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber %]" />
154
          </li>
155
          <li>
156
            <label for="supplier">Supplier:</label>
157
            <select id="supplier" name="supplier">
158
              <option value="">All</option>
159
              [% FOREACH supplier IN suppliers_loop %]
160
                [% IF ( supplier.selected ) %]
161
                  <option selected="selected" value="[% supplier.supplierid %]">[% supplier.suppliername %]</option>
162
                [% ELSE %]
163
                  <option value="[% supplier.supplierid %]">[% supplier.suppliername %]</option>
164
                [% END %]
165
              [% END %]
166
            </select>
167
          </li>
168
          <li>
169
            <fieldset class="brief">
170
              <legend>Billing date</legend>
171
              <ol>
172
                <li>
173
                  <label for="billingdatefrom">From:</label>
174
                  <input type="text" id="billingdatefrom" name="billingdatefrom" size="10" value="[% billingdatefrom %]" />
175
                  <img id="billingdatefromCalendar" alt="Show Calendar" style="cursor:pointer;" src="[% themelang %]/lib/calendar/cal.gif" />
176
                </li>
177
                <li>
178
                  <label for="billingdateto">To:</label>
179
                  <input type="text" id="billingdateto" name="billingdateto" size="10" value="[% billingdateto %]" />
180
                  <img id="billingdatetoCalendar" alt="Show Calendar" style="cursor:pointer;" src="[% themelang %]/lib/calendar/cal.gif" />
181
                </li>
182
              </ol>
183
            </fieldset>
184
          </li>
185
          <li>
186
            <label for="isbneanissn">ISBN / EAN / ISSN:</label>
187
            <input type="text" id="isbneanissn" name="isbneanissn" value="[% isbneanissn %]" />
188
          </li>
189
          <li>
190
            <label for="title">Title:</label>
191
            <input type="text" id="title" name="title" value="[% title %]" />
192
          </li>
193
          <li>
194
            <label for="author">Author:</label>
195
            <input type="text" id="author" name="author" value="[% author %]" />
196
          </li>
197
          <li>
198
            <label for="publisher">Publisher:</label>
199
            <input type="text" id="publisher" name="publisher" value="[% publisher %]" />
200
          </li>
201
          <li>
202
            <label for="publicationyear">Publication year:</label>
203
            <input type="text" id="publicationyear" name="publicationyear" value="[% publicationyear %]" />
204
          </li>
205
          <li>
206
            <label for="branch">Branch:</label>
207
            <select id="branch" name="branch">
208
              <option value="">All</option>
209
              [% FOREACH branch IN branches_loop %]
210
                [% IF ( branch.selected ) %]
211
                  <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
212
                [% ELSE %]
213
                  <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
214
                [% END %]
215
              [% END %]
216
            </select>
217
          </li>
218
        </ol>
219
        <fieldset class="action">
220
          <input type="submit" value="Search" />
221
        </fieldset>
222
      </fieldset>
223
      <input type="hidden" name="op" id="op" value="do_search" />
224
    </form>
225
    [% INCLUDE 'acquisitions-menu.inc' %]
226
  </div>
227
</div>
228
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-4 / +3 lines)
Lines 91-101 Link Here
91
    </fieldset>
91
    </fieldset>
92
    [% END %] <!-- items -->
92
    [% END %] <!-- items -->
93
    <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
93
    <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
94
    <input type="hidden" name="invoiceid" value="[% invoiceid %]" />
94
    <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
95
    <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
95
    <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
96
    <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
96
    <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
97
    <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
97
    <input type="hidden" name="datereceived" value="[% datereceived_iso %]" />
98
    <input type="hidden" name="datereceived" value="[% datereceived_iso %]" />
98
    <input type="hidden" name="freight" value="[% freight %]" />
99
    <input type="hidden" name="gst" value="[% gst %]" />
99
    <input type="hidden" name="gst" value="[% gst %]" />
100
	</div>
100
	</div>
101
	<div class="yui-u">
101
	<div class="yui-u">
Lines 143-154 Link Here
143
            <input type="text" size="20" name="cost" id="cost" value="[% ecost %]" />
143
            <input type="text" size="20" name="cost" id="cost" value="[% ecost %]" />
144
        [% END %]</li></ol>
144
        [% END %]</li></ol>
145
        <label for="note">Notes: </label><textarea name="note" width="40" rows="8" >[% notes %]</textarea>
145
        <label for="note">Notes: </label><textarea name="note" width="40" rows="8" >[% notes %]</textarea>
146
        <input type="hidden" name="invoice" value="[% invoice %]" />
147
    </fieldset>
146
    </fieldset>
148
147
149
</div>
148
</div>
150
</div><div class="yui-g"><fieldset class="action">
149
</div><div class="yui-g"><fieldset class="action">
151
        <input type="button"  value="Save" onclick="javascript:if(check_additem()) { this.form.submit(); } else { alert( _('Duplicate barcodes detected.  Please correct the errors and resubmit.') ); return false };" /> <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?booksellerid=[% booksellerid %]&amp;invoice=[% invoice %]&amp;gst=[% gst %]&amp;freight=[% freight %]">Cancel</a>
150
        <input type="button"  value="Save" onclick="javascript:if(check_additem()) { this.form.submit(); } else { alert( _('Duplicate barcodes detected.  Please correct the errors and resubmit.') ); return false };" /> <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]">Cancel</a>
152
</fieldset></div>    </form>
151
</fieldset></div>    </form>
153
[% ELSE %]
152
[% ELSE %]
154
<div id="acqui_acquire_orderlist">
153
<div id="acqui_acquire_orderlist">
Lines 165-171 Link Here
165
        <tr>
164
        <tr>
166
            <td>[% loo.basketno %]</td>
165
            <td>[% loo.basketno %]</td>
167
            <td>[% loo.isbn %]</td>
166
            <td>[% loo.isbn %]</td>
168
         <td><a href="orderreceive.pl?datereceived=[% loo.datereceived %]&amp;receive=[% loo.ordernumber %]&amp;biblio=[% loo.biblionumber %]&amp;invoice=[% loo.invoice %]&amp;freight=[% loo.freight %]&amp;gst=[% loo.gst %]&amp;id=[% loo.id %]">[% loo.title |html %]</a></td>
167
         <td><a href="orderreceive.pl?ordernumber=[% loo.ordernumber %]&amp;invoiceid=[% invoiceid %]">[% loo.title |html %]</a></td>
169
            <td>[% loo.author %]</td>
168
            <td>[% loo.author %]</td>
170
            <td>[% loo.quantity %]</td>
169
            <td>[% loo.quantity %]</td>
171
            <td>[% loo.quantityreceived %]</td>
170
            <td>[% loo.quantityreceived %]</td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-102 / +116 lines)
Lines 157-167 Link Here
157
[% INCLUDE 'header.inc' %]
157
[% INCLUDE 'header.inc' %]
158
[% INCLUDE 'acquisitions-search.inc' %]
158
[% INCLUDE 'acquisitions-search.inc' %]
159
159
160
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;  [% IF ( datereceived ) %]
160
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
161
            Receipt Summary for <i>[% name %]</i> [% IF ( invoice ) %]<i>[ [% invoice %] ]</i>[% END %] on <i>[% formatteddatereceived %]</i>
161
    [% IF ( datereceived ) %]
162
        [% ELSE %]
162
        Receipt Summary for <i>[% name %]</i>
163
            Receive orders from [% name %]
163
        [% IF ( invoice ) %]
164
        [% END %]</div>
164
            <i>[ [% invoice %] ]</i>
165
        [% END %]
166
        on <i>[% formatteddatereceived %]</i>
167
    [% ELSE %]
168
        Receive orders from [% name %]
169
    [% END %]
170
</div>
165
171
166
<div id="doc3" class="yui-t2">
172
<div id="doc3" class="yui-t2">
167
173
Lines 199-305 Link Here
199
205
200
<div id="acqui_receive_summary">
206
<div id="acqui_receive_summary">
201
<p><strong>Invoice number:</strong> [% invoice %] <strong>Received by:</strong> [% loggedinusername %] <strong>On:</strong> [% formatteddatereceived %]</p>
207
<p><strong>Invoice number:</strong> [% invoice %] <strong>Received by:</strong> [% loggedinusername %] <strong>On:</strong> [% formatteddatereceived %]</p>
202
	<!-- TODO: Add date picker, change rcv date. -->
208
<p><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid %]">Go to invoice details</a></p>
203
</div>
209
</div>
204
<div id="acqui_receive_search">
210
[% UNLESS (invoiceclosedate) %]
205
    <h3>Pending Orders</h3>
211
    <div id="acqui_receive_search">
206
212
        <h3>Pending Orders</h3>
207
 [% IF ( loop_orders ) %]<table id="pendingt">
213
208
    <thead>
214
     [% IF ( loop_orders ) %]<table id="pendingt">
209
        <tr>
215
        <thead>
210
            <th>Basket</th>
211
            <th>Order Line</th>
212
            <th>Summary</th>
213
    	    <th>View Record</th>
214
            <th>Quantity</th>
215
            <th>Unit cost</th>
216
            <th>Order cost</th>
217
            <th>&nbsp;</th>
218
            <th>&nbsp;</th>
219
        </tr>
220
    </thead>
221
		<tfoot>
222
            <tr><td colspan="4" class="total">TOTAL</td>
223
                <td> [% totalPquantity %] </td>
224
				<td>&nbsp;</td>
225
                <td>[% ordergrandtotal %]</td>
226
				<td>&nbsp;</td>
227
				<td>&nbsp;</td>
228
            </tr>
229
		</tfoot>
230
    <tbody class="filterclass">
231
        [% FOREACH loop_order IN loop_orders %]
232
	[% UNLESS ( loop.odd ) %]
233
            <tr class="highlight">
234
        [% ELSE %]
235
            <tr>
216
            <tr>
236
        [% END %]
217
                <th>Basket</th>
237
                <td class="basketfilterclass"><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_order.basketno %]">[% loop_order.basketno %]</a></td>
218
                <th>Order Line</th>
238
                <td class="orderfilterclass"><a href="neworderempty.pl?ordernumber=[% loop_order.ordernumber %]&amp;booksellerid=[% loop_order.booksellerid %]">[% loop_order.ordernumber %]</a></td>
219
                <th>Summary</th>
239
                <td class="summaryfilterclass">
220
                <th>View Record</th>
240
                  <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_order.biblionumber %]">[% loop_order.title |html %]</a>
221
                <th>Quantity</th>
241
                [% IF ( loop_order.author ) %] by [% loop_order.author %][% END %]
222
                <th>Unit cost</th>
242
                [% IF ( loop_order.isbn ) %] &ndash; [% loop_order.isbn %][% END %]
223
                <th>Order cost</th>
243
                [% IF ( loop_order.publishercode ) %]<br />Publisher :[% loop_order.publishercode %][% END %]
224
                <th>&nbsp;</th>
244
                [% IF ( loop_order.suggestionid ) %]
225
                <th>&nbsp;</th>
245
                    <br/>
246
                    Suggested by: [% loop_order.surnamesuggestedby %][% IF ( loop_order.firstnamesuggestedby ) %], [% loop_order.firstnamesuggestedby %] [% END %]
247
                    (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_order.suggestionid %]&amp;op=show">suggestion #[% loop_order.suggestionid %]</a>)
248
                [% END %]
249
                </td>
250
                <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
251
                <td>[% loop_order.quantity %]</td>
252
                <td>[% loop_order.ecost %]</td>
253
                <td>[% loop_order.ordertotal %]</td>
254
				<td>
255
				    <a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber %]&amp;datereceived=[% loop_order.invoicedatereceived %]&amp;invoice=[% loop_order.invoice %]&amp;gst=[% loop_order.gst %]&amp;freight=[% loop_order.freight %]&amp;booksellerid=[% loop_order.booksellerid %]">Receive</a>
256
				    
257
				</td>
258
				<td>
259
				    [% IF ( loop_order.left_holds_on_order ) %]
260
                    <span class="button" title="Can't delete order, ([% loop_order.holds_on_order %]) holds are linked with this order cancel holds first">Can't delete order</span><br>
261
                    [% ELSE %]
262
                    <a href="javascript:confirm_delete_item([% loop_order.ordernumber %],[% loop_order.basketno %],[% loop_order.biblionumber %])" class="button">Delete order</a><br>
263
                    [% END %]
264
                    [% IF ( loop_order.can_del_bib ) %]
265
                    <a href="javascript:confirm_delete_biblio([% loop_order.ordernumber %],[% loop_order.basketno %],[% loop_order.biblionumber %])" class="button">Delete order and catalog record</a><br>
266
                    [% ELSE %]
267
                    <span class="button" title="Can't delete catalog record, see constraints below">Can't delete order and catalog record</span><br>
268
                    [% END %]
269
                    [% IF ( loop_order.left_item ) %]
270
                    <b title="Can't delete catalog record, because of [% loop_order.items %] existing item(s)" >[% loop_order.items %] item(s) left</b><br>
271
                    [% END %]
272
                    [% IF ( loop_order.left_biblio ) %]
273
                    <b title="Can't delete catalog record, delete other orders linked to it first">[% loop_order.biblios %] order(s) left</b><br>
274
                    [% END %]
275
                    [% IF ( loop_order.left_subscription ) %]
276
                    <b title="Can't delete catalog record, delete subscriptions first">[% loop_order.subscriptions %] subscription(s) left</b><br>
277
                    [% END %]
278
                    [% IF ( loop_order.left_holds ) %]
279
                    <b title="Can't delete catalog record or order, cancel holds first">[% loop_order.holds %] hold(s) left</b>
280
                    [% END %]
281
				</td>
282
            </tr>
226
            </tr>
227
        </thead>
228
            <tfoot>
229
                <tr><td colspan="4" class="total">TOTAL</td>
230
                    <td> [% totalPquantity %] </td>
231
                    <td>&nbsp;</td>
232
                    <td>[% ordergrandtotal %]</td>
233
                    <td>&nbsp;</td>
234
                    <td>&nbsp;</td>
235
                </tr>
236
            </tfoot>
237
        <tbody class="filterclass">
238
            [% FOREACH loop_order IN loop_orders %]
239
        [% UNLESS ( loop.odd ) %]
240
                <tr class="highlight">
241
            [% ELSE %]
242
                <tr>
243
            [% END %]
244
                    <td class="basketfilterclass"><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_order.basketno %]">[% loop_order.basketno %]</a></td>
245
                    <td class="orderfilterclass"><a href="neworderempty.pl?ordernumber=[% loop_order.ordernumber %]&amp;booksellerid=[% loop_order.booksellerid %]">[% loop_order.ordernumber %]</a></td>
246
                    <td class="summaryfilterclass">
247
                      <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_order.biblionumber %]">[% loop_order.title |html %]</a>
248
                    [% IF ( loop_order.author ) %] by [% loop_order.author %][% END %]
249
                    [% IF ( loop_order.isbn ) %] &ndash; [% loop_order.isbn %][% END %]
250
                    [% IF ( loop_order.publishercode ) %]<br />Publisher :[% loop_order.publishercode %][% END %]
251
                    [% IF ( loop_order.suggestionid ) %]
252
                        <br/>
253
                        Suggested by: [% loop_order.surnamesuggestedby %][% IF ( loop_order.firstnamesuggestedby ) %], [% loop_order.firstnamesuggestedby %] [% END %]
254
                        (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_order.suggestionid %]&amp;op=show">suggestion #[% loop_order.suggestionid %]</a>)
255
                    [% END %]
256
                    </td>
257
                    <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
258
                    <td>[% loop_order.quantity %]</td>
259
                    <td>[% loop_order.ecost %]</td>
260
                    <td>[% loop_order.ordertotal %]</td>
261
                    <td>
262
                        <a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber %]&amp;invoiceid=[% invoiceid %]">Receive</a>
263
264
                    </td>
265
                    <td>
266
                        [% IF ( loop_order.left_holds_on_order ) %]
267
                        <span class="button" title="Can't delete order, ([% loop_order.holds_on_order %]) holds are linked with this order cancel holds first">Can't delete order</span><br>
268
                        [% ELSE %]
269
                        <a href="javascript:confirm_delete_item([% loop_order.ordernumber %],[% loop_order.biblionumber %])" class="button">Delete order</a><br>
270
                        [% END %]
271
                        [% IF ( loop_order.can_del_bib ) %]
272
                        <a href="javascript:confirm_delete_biblio([% loop_order.ordernumber %],[% loop_order.biblionumber %])" class="button">Delete order and catalog record</a><br>
273
                        [% ELSE %]
274
                        <span class="button" title="Can't delete catalog record, see constraints below">Can't delete order and catalog record</span><br>
275
                        [% END %]
276
                        [% IF ( loop_order.left_item ) %]
277
                        <b title="Can't delete catalog record, because of [% loop_order.items %] existing item(s)" >[% loop_order.items %] item(s) left</b><br>
278
                        [% END %]
279
                        [% IF ( loop_order.left_biblio ) %]
280
                        <b title="Can't delete catalog record, delete other orders linked to it first">[% loop_order.biblios %] order(s) left</b><br>
281
                        [% END %]
282
                        [% IF ( loop_order.left_subscription ) %]
283
                        <b title="Can't delete catalog record, delete subscriptions first">[% loop_order.subscriptions %] subscription(s) left</b><br>
284
                        [% END %]
285
                        [% IF ( loop_order.left_holds ) %]
286
                        <b title="Can't delete catalog record or order, cancel holds first">[% loop_order.holds %] hold(s) left</b>
287
                        [% END %]
288
                    </td>
289
                </tr>
290
            [% END %]
291
        </tbody>
292
         </table>[% ELSE %]There are no pending orders.[% END %]
293
       <div id="resultnumber">
294
        <!-- Row of numbers corresponding to search result pages -->
295
        [% IF ( displayprev ) %]
296
            <a href="parcel.pl?type=intra&amp;booksellerid=[% booksellerid %]&amp;startfrom=[% prevstartfrom %][% IF ( datereceived ) %]&amp;datereceived=[% datereceived %][% END %][% IF ( invoice ) %]&amp;invoice=[% invoice %][% END %][% IF ( resultsperpage ) %]&amp;resultsperpage=[% resultsperpage %][% END %]#resultnumber">&lt;&lt; Previous</a>
283
        [% END %]
297
        [% END %]
284
    </tbody>
298
        [% FOREACH number IN numbers %]
285
     </table>[% ELSE %]There are no pending orders.[% END %]
299
            [% IF ( number.highlight ) %]
286
   <div id="resultnumber">
300
            <span class="current">[% number.number %]</span>
287
	<!-- Row of numbers corresponding to search result pages -->
301
            [% ELSE %]
288
	[% IF ( displayprev ) %]
302
            <a href="parcel.pl?type=intra&amp;booksellerid=[% booksellerid %]&amp;startfrom=[% number.startfrom %][% IF ( number.datereceived ) %]&amp;datereceived=[% number.datereceived %][% END %][% IF ( number.invoice ) %]&amp;invoice=[% number.invoice %][% END %][% IF ( number.resultsperpage ) %]&amp;resultsperpage=[% number.resultsperpage %][% END %]#resultnumber">[% number.number %]</a>
289
		<a href="parcel.pl?type=intra&amp;booksellerid=[% booksellerid %]&amp;startfrom=[% prevstartfrom %][% IF ( datereceived ) %]&amp;datereceived=[% datereceived %][% END %][% IF ( invoice ) %]&amp;invoice=[% invoice %][% END %][% IF ( resultsperpage ) %]&amp;resultsperpage=[% resultsperpage %][% END %]#resultnumber">&lt;&lt; Previous</a>
303
            [% END %]
290
	[% END %]
304
        [% END %]
291
	[% FOREACH number IN numbers %]
305
        [% IF ( displaynext ) %]
292
		[% IF ( number.highlight ) %]
306
            <a href="parcel.pl?type=intra&amp;booksellerid=[% booksellerid %]&amp;startfrom=[% nextstartfrom %][% IF ( datereceived ) %]&amp;datereceived=[% datereceived %][% END %][% IF ( invoice ) %]&amp;invoice=[% invoice %][% END %][% IF ( resultsperpage ) %]&amp;resultsperpage=[% resultsperpage %][% END %]#resultnumber">Next &gt;&gt;</a>
293
		<span class="current">[% number.number %]</span>
307
        [% END %]
294
		[% ELSE %]
308
        </div>
295
		<a href="parcel.pl?type=intra&amp;booksellerid=[% booksellerid %]&amp;startfrom=[% number.startfrom %][% IF ( number.datereceived ) %]&amp;datereceived=[% number.datereceived %][% END %][% IF ( number.invoice ) %]&amp;invoice=[% number.invoice %][% END %][% IF ( number.resultsperpage ) %]&amp;resultsperpage=[% number.resultsperpage %][% END %]#resultnumber">[% number.number %]</a>
309
    </div>
296
		[% END %]
310
[% ELSE %]
297
	[% END %]
311
    <p>
298
	[% IF ( displaynext ) %]
312
        Invoice is close, so you can't receive orders.
299
		<a href="parcel.pl?type=intra&amp;booksellerid=[% booksellerid %]&amp;startfrom=[% nextstartfrom %][% IF ( datereceived ) %]&amp;datereceived=[% datereceived %][% END %][% IF ( invoice ) %]&amp;invoice=[% invoice %][% END %][% IF ( resultsperpage ) %]&amp;resultsperpage=[% resultsperpage %][% END %]#resultnumber">Next &gt;&gt;</a>
313
        <a href="/cgi-bin/koha/acqui/invoice.pl?op=reopen&invoiceid=[% invoiceid %]&referer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid %]">Reopen it</a>.
300
	[% END %]
314
    </p>
301
	</div>
315
[% END %]
302
</div>
316
303
<div id="acqui_receive_receivelist">
317
<div id="acqui_receive_receivelist">
304
    <h3>Already Received</h3>
318
    <h3>Already Received</h3>
305
319
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt (-25 / +25 lines)
Lines 14-20 Link Here
14
   <div id="bd">
14
   <div id="bd">
15
	<div id="yui-main">
15
	<div id="yui-main">
16
	<div class="yui-b">
16
	<div class="yui-b">
17
	
17
18
[% IF ( error_failed_to_create_invoice ) %]
19
    <div id="error" class="dialog error">
20
        <p>An error has occured. Invoice cannot be created.</p>
21
    </div>
22
[% END %]
18
<h1>Receive shipment from vendor <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% name %]</a></h1>
23
<h1>Receive shipment from vendor <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% name %]</a></h1>
19
24
20
[% IF ( count ) %]
25
[% IF ( count ) %]
Lines 42-52 Link Here
42
            [% searchresult.number %]
47
            [% searchresult.number %]
43
        </td>
48
        </td>
44
        <td>
49
        <td>
45
            <a href="/cgi-bin/koha/acqui/parcel.pl?type=intra&amp;booksellerid=[% booksellerid |url %]&amp;datereceived=[% searchresult.raw_datereceived |url %][% IF ( searchresult.code ) %]&amp;invoice=[% searchresult.code |url %][% END %]">
50
            [% searchresult.datereceived %]
46
                [% searchresult.datereceived %]</a>
47
        </td>
51
        </td>
48
        <td>
52
        <td>
49
            [% IF ( searchresult.code ) %][% searchresult.code %][% ELSE %]<acronym title="not available">n/a</acronym>[% END %]
53
            [% IF ( searchresult.code ) %]
54
                <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% searchresult.invoiceid %]">
55
                    [% searchresult.code %]
56
            </a>
57
            [% ELSE %]
58
                <acronym title="not available">n/a</acronym>
59
            [% END %]
50
        </td>
60
        </td>
51
        <td>
61
        <td>
52
            [% searchresult.reccount %] 
62
            [% searchresult.reccount %] 
Lines 81-87 Link Here
81
[% END %]
91
[% END %]
82
92
83
    <div id="parcels_new_parcel">
93
    <div id="parcels_new_parcel">
84
        <form method="get" action="parcel.pl">
94
        <form method="get" action="parcels.pl">
85
    <fieldset class="rows">
95
    <fieldset class="rows">
86
    <legend>Receive a new shipment</legend>
96
    <legend>Receive a new shipment</legend>
87
       <ol> <li>
97
       <ol> <li>
Lines 90-115 Link Here
90
            <input type="hidden" name="op" value="new" />
100
            <input type="hidden" name="op" value="new" />
91
			<input type="text" size="20" id="invoice" name="invoice" />
101
			<input type="text" size="20" id="invoice" name="invoice" />
92
        </li>
102
        </li>
93
		[% IF ( gst ) %]
103
         <li><label for="shipmentdate">Shipment date: </label>
94
        <li>
104
            <input type="text" id="shipmentdate" name="shipmentdate" maxlength="10" size="10" value="[% shipmentdate_today %]" />
95
            <label for="gst">GST:</label>
105
            <img src="[% themelang %]/lib/calendar/cal.gif" id="shipmentdate_button" alt="Show Calendar" />
96
            <input type="text" size="20" id="gst" name="gst" />
97
        </li>
98
		[% END %]
99
      <!--  // Removing freight input until shipping can be proplerly handled .
100
	  <li>
101
            <label for="freight">Shipping:</label>
102
            <input type="text" size="20" id="freight" name="freight" />
103
        </li> -->
104
         <li><label for="datereceived">Shipment date: </label>
105
            <input type="text" id="datereceived" name="datereceived"  maxlength="10" size="10"  value="[% datereceived_today %]" />
106
            <img src="[% themelang %]/lib/calendar/cal.gif" id="datereceived_button" alt="Show Calendar" />
107
      <script language="JavaScript" type="text/javascript">
106
      <script language="JavaScript" type="text/javascript">
108
        Calendar.setup(
107
        Calendar.setup(
109
          {
108
          {
110
            inputField : "datereceived",
109
            inputField : "shipmentdate",
111
            ifFormat : "[% DHTMLcalendar_dateformat %]",
110
            ifFormat : "[% DHTMLcalendar_dateformat %]",
112
            button : "datereceived_button"          }
111
            button : "shipmentdate_button"
112
          }
113
        );
113
        );
114
      </script>
114
      </script>
115
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>	</li>
115
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>	</li>
Lines 130-139 Link Here
130
            <li><label for="datefrom">From:</label><input type="text" size="9" id="datefrom" name="datefrom" value="[% datefrom %]" /><br /> 
130
            <li><label for="datefrom">From:</label><input type="text" size="9" id="datefrom" name="datefrom" value="[% datefrom %]" /><br /> 
131
                <label for="dateto">To:</label><input type="text" size="9" id="dateto" name="dateto" value="[% dateto %]" /></li>
131
                <label for="dateto">To:</label><input type="text" size="9" id="dateto" name="dateto" value="[% dateto %]" /></li>
132
            <li><label for="orderby">Sort by :</label><select name="orderby" id="orderby">
132
            <li><label for="orderby">Sort by :</label><select name="orderby" id="orderby">
133
                <option value="aqorders.booksellerinvoicenumber">Invoice number</option>
133
                <option value="invoicenumber">Invoice number</option>
134
                <option value="datereceived"> Date Received</option>
134
                <option value="shipmentdate">Shipment date</option>
135
                <option value="datereceived desc"> Date Received reverse</option>
135
                <option value="datereceived desc">Shipment date reverse</option>
136
                <option value="aqorders.booksellerinvoicenumber desc"> Invoice number reverse</option>
136
                <option value="invoicenumber desc">Invoice number reverse</option>
137
                </select><br />
137
                </select><br />
138
                <label for="resultsperpage">Results per page :</label><select name="resultsperpage" id="resultsperpage">
138
                <label for="resultsperpage">Results per page :</label><select name="resultsperpage" id="resultsperpage">
139
                <option value="20">20</option>
139
                <option value="20">20</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt (-22 / +19 lines)
Lines 29-35 Link Here
29
	<th> Itemtype </th>
29
	<th> Itemtype </th>
30
	<th> Received </th>
30
	<th> Received </th>
31
	<th> Unit Price </th>
31
	<th> Unit Price </th>
32
	<th> Freight per Item </th>
33
	<th> Date Ordered </th>
32
	<th> Date Ordered </th>
34
	<th> Date Received </th>
33
	<th> Date Received </th>
35
	<th> Subtotal </th>
34
	<th> Subtotal </th>
Lines 47-59 Link Here
47
	    [% order.title %]
46
	    [% order.title %]
48
	</td>
47
	</td>
49
	<td class="cell">
48
	<td class="cell">
50
            <a href="/cgi-bin/koha/acqui/orderreceive.pl?ordernumber=[% order.ordernumber %]&amp;biblio=[% order.biblionumber %]&amp;invoice=[% order.booksellerinvoicenumber %]&amp;booksellerid=[% order.booksellerid %]&amp;catview=yes">[% order.ordernumber %]</a>
49
            <a href="/cgi-bin/koha/acqui/orderreceive.pl?ordernumber=[% order.ordernumber %]&amp;biblio=[% order.biblionumber %]&amp;invoiceid=[% order.invoiceid %]">[% order.ordernumber %]</a>
51
	</td>
50
	</td>
52
	<td class="cell">
51
	<td class="cell">
53
	    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.booksellerid %]">[% order.booksellerid %]</a>
52
	    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.booksellerid %]">[% order.booksellerid %]</a>
54
	</td>
53
	</td>
55
	<td class="cell">
54
	<td class="cell">
56
	    <a href="/cgi-bin/koha/acqui/parcel.pl?invoice=[% order.booksellerinvoicenumber %]&amp;booksellerid=[% order.booksellerid %]&amp;datereceived=[% order.datereceived %]">[% order.booksellerinvoicenumber %]</a>
55
	    <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% order.invoiceid %]">[% order.invoicenumber %]</a>
57
	</td>
56
	</td>
58
	<td class="cell">
57
	<td class="cell">
59
	    [% order.itype %]
58
	    [% order.itype %]
Lines 65-101 Link Here
65
	    [% order.unitprice %]
64
	    [% order.unitprice %]
66
	</td>
65
	</td>
67
	<td class="cell" align="right">
66
	<td class="cell" align="right">
68
	    [% order.freight %]
69
	</td>
70
	<td class="cell" align="right">
71
	    [% order.entrydate | $KohaDates %]
67
	    [% order.entrydate | $KohaDates %]
72
	</td>
68
	</td>
73
	<td class="cell" align="right">
69
	<td class="cell" align="right">
74
	    [% order.datereceived | $KohaDates %]
70
	    [% order.datereceived | $KohaDates %]
75
	</td>
71
	</td>
76
	<td class="cell" align="right">
72
	<td class="cell" align="right">
77
	    [% order.subtotal %]
73
	    [% order.rowtotal %]
78
	</td>
74
	</td>
79
    </tr>
75
    </tr>
80
[% END %]
76
[% END %]
81
    <tfoot>
77
    <tfoot>
82
        <tr valign="top">
78
        [% IF shipmentcosts.size %]
83
        <td> Total </td>
79
            <tr valign="top">
84
        <td> </td>
80
                <td colspan="9"> Sub total </td>
85
        <td> </td>
81
                <td align="right"> [% subtotal %] </td>
86
        <td> </td>
82
            </tr>
87
        <td> </td>
83
            [% FOREACH shipmentcost IN shipmentcosts %]
88
        <td> </td>
84
                <tr>
89
        <td> </td>
85
                    <td></td>
90
        <td> </td>
86
                    <td colspan="8">Shipment cost for invoice [% shipmentcost.invoicenumber %]</td>
91
	<td> </td>
87
                    <td class="total">[% shipmentcost.shipmentcost %]</td>
92
	<td> </td>
88
                </tr>
93
        <td align="right">
89
            [% END %]
94
		[% total %]
90
        [% END %]
95
	</td>
91
        <tr>
92
            <td colspan="9">TOTAL</td>
93
            <td class="total">[% total %]</td>
96
        </tr>
94
        </tr>
97
    </tfoot>
95
    </tfoot>
98
99
</table>
96
</table>
100
97
101
</div>
98
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt (-2 / +1 lines)
Lines 158-164 Link Here
158
158
159
                    Accession Date:</span>
159
                    Accession Date:</span>
160
                    [% IF ( ITEM_DAT.basketno ) %]
160
                    [% IF ( ITEM_DAT.basketno ) %]
161
                    <a href="/cgi-bin/koha/acqui/parcel.pl?booksellerid=[% ITEM_DAT.booksellerid %]&amp;invoice=[% ITEM_DAT.booksellerinvoicenumber %]&amp;datereceived=[% ITEM_DAT.datereceived %]">[% ITEM_DAT.dateaccessioned %]</a>
161
                    <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% ITEM_DAT.invoiceid %]">[% ITEM_DAT.dateaccessioned %]</a>
162
                    [% ELSE %]
162
                    [% ELSE %]
163
                    [% ITEM_DAT.dateaccessioned %]
163
                    [% ITEM_DAT.dateaccessioned %]
164
                    [% END %]
164
                    [% END %]
165
- 

Return to bug 5339