Further updates to acq, merging in dev_week mods.
authorRyan Higgins <rch@liblime.com>
Tue, 1 Jan 2008 20:53:15 +0000 (14:53 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Tue, 1 Jan 2008 21:07:08 +0000 (15:07 -0600)
Splitting orders now on receipt.
Many tmpl updates to pass correct values btwn scripts.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Acquisition.pm
acqui/basket.pl
acqui/finishreceive.pl
acqui/orderreceive.pl
acqui/parcel.pl
koha-tmpl/intranet-tmpl/prog/en/js/additem.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tmpl

index 594bfce..b4b2655 100644 (file)
@@ -374,7 +374,7 @@ sub GetOrder {
   &NewOrder($basket, $biblionumber, $title, $quantity, $listprice,
     $booksellerid, $who, $notes, $bookfund, $biblioitemnumber, $rrp,
     $ecost, $gst, $budget, $unitprice, $subscription,
-    $booksellerinvoicenumber);
+    $booksellerinvoicenumber, $purchaseorder);
 
 Adds a new order to the database. Any argument that isn't described
 below is the new value of the field with the same name in the aqorders
@@ -571,6 +571,9 @@ Updates an order, to reflect the fact that it was received, at least
 in part. All arguments not mentioned below update the fields with the
 same name in the aqorders table of the Koha database.
 
+If a partial order is received, splits the order into two.  The received
+portion must have a booksellerinvoicenumber.  
+
 Updates the order with bibilionumber C<$biblionumber> and ordernumber
 C<$ordernumber>.
 
@@ -584,31 +587,55 @@ Also updates the book fund ID in the aqorderbreakdown table.
 sub ModReceiveOrder {
     my (
         $biblionumber,    $ordnum,  $quantrec, $user, $cost,
-        $invoiceno, $freight, $rrp, $bookfund, $daterecieved
+        $invoiceno, $freight, $rrp, $bookfund, $datereceived
       )
       = @_;
     my $dbh = C4::Context->dbh;
 #     warn "DATE BEFORE : $daterecieved";
-    $daterecieved=POSIX::strftime("%Y-%m-%d",CORE::localtime) unless $daterecieved;
+#    $daterecieved=POSIX::strftime("%Y-%m-%d",CORE::localtime) unless $daterecieved;
 #     warn "DATE REC : $daterecieved";
-    my $query = "
-        UPDATE aqorders
-        SET    quantityreceived=?,datereceived=?,booksellerinvoicenumber=?,
-               unitprice=?,freight=?,rrp=?
-        WHERE biblionumber=? AND ordernumber=?
-    ";
-    my $sth = $dbh->prepare($query);
+       $datereceived = C4::Dates->output('iso') unless $datereceived;
+   
+       my $sth=$dbh->prepare("SELECT * FROM aqorders  LEFT JOIN aqorderbreakdown ON aqorders.ordernumber=aqorderbreakdown.ordernumber
+                                                       WHERE biblionumber=? AND aqorders.ordernumber=?");
+    $sth->execute($biblionumber,$ordnum);
+    my $order = $sth->fetchrow_hashref();
+    $sth->finish();
+       
+       if ( $order->{quantity} > $quantrec ) {
+        $sth=$dbh->prepare("update aqorders 
+                                                       set quantityreceived=?,datereceived=?,booksellerinvoicenumber=?, 
+                                                               unitprice=?,freight=?,rrp=?,quantity=?
+                            where biblionumber=? and ordernumber=?");
+        $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$quantrec,$biblionumber,$ordnum);
+        $sth->finish;
+        # create a new order for the remaining items, and set its bookfund.
+        my $newOrder = NewOrder($order->{'basketno'},$order->{'biblionumber'},$order->{'title'}, $order->{'quantity'} - $quantrec,    
+                    $order->{'listprice'},$order->{'booksellerid'},$order->{'authorisedby'},$order->{'notes'},   
+                    $order->{'bookfundid'},$order->{'biblioitemnumber'},$order->{'rrp'},$order->{'ecost'},$order->{'gst'},
+                    $order->{'budget'},$order->{'unitcost'},$order->{'sub'},'',$order->{'sort1'},$order->{'sort2'},$order->{'purchaseordernumber'});
+    
+        $sth = $dbh->prepare("select branchcode, bookfundid from aqorderbreakdown where ordernumber=?");
+        $sth->execute($ordnum);
+        my ($branch,$bookfund) = $sth->fetchrow_array;
+        $sth->finish;
+        $sth=$dbh->prepare(" insert into aqorderbreakdown (ordernumber, branchcode, bookfundid) values (?,?,?)"); 
+        $sth->execute($newOrder,$branch,$bookfund);
+    } else {
+        $sth=$dbh->prepare("update aqorders 
+                                                       set quantityreceived=?,datereceived=?,booksellerinvoicenumber=?, 
+                                                               unitprice=?,freight=?,rrp=?
+                            where biblionumber=? and ordernumber=?");
+        $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$biblionumber,$ordnum);
+        $sth->finish;
+    }
     my $suggestionid = GetSuggestionFromBiblionumber( $dbh, $biblionumber );
     if ($suggestionid) {
         ModStatus( $suggestionid, 'AVAILABLE', '', $biblionumber );
     }
-    $sth->execute( $quantrec,$daterecieved, $invoiceno, $cost, $freight, $rrp, $biblionumber,
-        $ordnum);
-    $sth->finish;
-
     # Allows libraries to change their bookfund during receiving orders
     # allows them to adjust budgets
-    if ( C4::Context->preferene("LooseBudgets") ) {
+    if ( C4::Context->preference("LooseBudgets") ) {
         my $query = "
             UPDATE aqorderbreakdown
             SET    bookfundid=?
@@ -618,9 +645,8 @@ sub ModReceiveOrder {
         $sth->execute( $bookfund, $ordnum );
         $sth->finish;
     }
-    return $daterecieved;
+    return $datereceived;
 }
-
 #------------------------------------------------------------#
 
 =head3 SearchOrder
index 9aba351..c181f61 100755 (executable)
@@ -128,6 +128,7 @@ my $toggle = 0;
 
 # my $line_total_est; # total of each line
 my $sub_total_est;      # total of line totals
+my $sub_total_rrp;      # total of line totals
 my $gist_est;           # GST
 my $grand_total_est;    # $subttotal + $gist
 
@@ -136,8 +137,7 @@ my @books_loop;
 for ( my $i = 0 ; $i < $count ; $i++ ) {
     my $rrp = $results[$i]->{'listprice'};
     $rrp = ConvertCurrency( $results[$i]->{'currency'}, $rrp );
-
-    $sub_total_est += $results[$i]->{'quantity'} * $results[$i]->{'rrp'};
+    $sub_total_rrp += $results[$i]->{'quantity'} * $results[$i]->{'rrp'};
     $line_total = $results[$i]->{'quantity'} * $results[$i]->{'ecost'};
     $sub_total += $line_total;
     $qty_total += $results[$i]->{'quantity'};
@@ -151,6 +151,7 @@ for ( my $i = 0 ; $i < $count ; $i++ ) {
         $line{color} = 'white';
         $toggle = 0;
     }
+       $line{order_received} = ($results[$i]->{'quantity'} eq $results[$i]->{'quantityreceived'});
        $line{publishercode}    = $results[$i]->{'publishercode'};
        $line{basketno}         = $basketno;
     $line{i}                = $i;
@@ -163,8 +164,8 @@ for ( my $i = 0 ; $i < $count ; $i++ ) {
 my $prefgist = C4::Context->preference("gist");
 $gist            = sprintf( "%.2f", $sub_total * $prefgist );
 $grand_total     = $sub_total + $gist;
-$grand_total_est =
-  $sub_total_est + sprintf( "%.2f", $sub_total_est * $prefgist );
+$grand_total_est =  $sub_total_est + sprintf( "%.2f", $sub_total_est * $prefgist );
+my $grand_total_rrp =  sprintf( "%.2f", $sub_total_rrp );
 $gist_est = sprintf( "%.2f", $sub_total_est * $prefgist );
 $template->param(
     basketno         => $basketno,
@@ -182,12 +183,13 @@ $template->param(
     entrydate        => format_date( $results[0]->{'entrydate'} ),
     books_loop       => \@books_loop,
     count            => $count,
-    sub_total        => $sub_total,
+    sub_total        => sprintf( "%.2f", $sub_total),
     gist             => $gist,
-    grand_total      => $grand_total,
+    grand_total      => sprintf( "%.2f", $grand_total),
     sub_total_est    => $sub_total_est,
     gist_est         => $gist_est,
     grand_total_est  => $grand_total_est,
+    grand_total_rrp  => $grand_total_rrp,
     currency         => $booksellers[0]->{'listprice'},
     qty_total        => $qty_total,
     GST => C4::Context->preference("gist"),
index ad977ca..bba6e51 100755 (executable)
@@ -34,7 +34,8 @@ my $user=$input->remote_user;
 my $biblionumber = $input->param('biblionumber');
 my $biblioitemnumber=$input->param('biblioitemnumber');
 my $ordnum=$input->param('ordnum');
-my $quantrec=$input->param('quantityrec');
+my $origquantityrec=$input->param('origquantityrec');
+my $quantityrec=$input->param('quantityrec');
 my $quantity=$input->param('quantity');
 my $cost=$input->param('cost');
 my $invoiceno=$input->param('invoice');
@@ -43,33 +44,40 @@ my $replacement=$input->param('rrp');
 my $gst=$input->param('gst');
 my $freight=$input->param('freight');
 my $supplierid = $input->param('supplierid');
-my $branch=$input->param('branch');
-
-# if ($quantrec != 0){
-#      $cost /= $quantrec;
+my @branch=$input->param('homebranch');
+my @barcode=$input->param('barcode');
+my @ccode=$input->param('ccode');
+my @itemtype=$input->param('itemtype');
+my @location=$input->param('location');
+my $cnt = 0;
+# if ($quantityrec != 0){
+#      $cost /= $quantityrec;
 # }
 
-if ($quantity != 0) {
+if ($quantityrec > $origquantityrec ) {
     # save the quantity recieved.
-    $datereceived = ModReceiveOrder($biblionumber,$ordnum,$quantrec,$user,$cost,$invoiceno,$datereceived,$freight,$replacement);
+    $datereceived = ModReceiveOrder($biblionumber,$ordnum,$quantityrec,$user,$cost,$invoiceno,$datereceived,$freight,$replacement);
     # create items if the user has entered barcodes
-    my $barcode=$input->param('barcode');
-    my @barcodes=split(/\,| |\|/,$barcode);
+   # my @barcodes=split(/\,| |\|/,$barcode);
     # foreach barcode provided, build the item MARC::Record and create the item
-    foreach my $bc (@barcodes) {
+    foreach my $bc (@barcode) {
         my $itemRecord = TransformKohaToMarc({
                     "items.replacementprice" => $replacement,
                     "items.price"            => $cost,
                     "items.booksellerid"     => $supplierid,
-                    "items.homebranch"       => $branch,
-                    "items.holdingbranch"    => $branch,
-                    "items.barcode"          => $bc,
+                    "items.homebranch"       => $branch[$cnt],
+                    "items.holdingbranch"    => $branch[$cnt],
+                    "items.barcode"          => $barcode[$cnt],
+                    "items.ccode"          => $ccode[$cnt],
+                    "items.itype"          => $itemtype[$cnt],
+                    "items.location"          => $location[$cnt],
                     "items.loan"             => 0, });
-        AddItem($itemRecord,$biblionumber);
+               AddItem($itemRecord,$biblionumber);
     }
-    print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoice=$invoiceno&supplierid=$supplierid&freight=$freight&gst=$gst&datereceived=$datereceived");
-} else {
-    print $input->header;
-    delorder($biblionumber,$ordnum);
-    print $input->redirect("/acquisitions/");
 }
+    print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoice=$invoiceno&supplierid=$supplierid&freight=$freight&gst=$gst&datereceived=$datereceived");
+#} else {
+#    print $input->header;
+#    #delorder($biblionumber,$ordnum);
+#    print $input->redirect("/acquisitions/");
+#}
index bb1de08..546c0f4 100755 (executable)
@@ -36,7 +36,7 @@ It permit to write a new order as 'received'.
 =item supplierid
 to know on what supplier this script has to display receive order.
 
-=item recieve
+=item receive
 
 =item invoice
 the number of this invoice.
@@ -114,7 +114,6 @@ if ( $count == 1 ) {
 
     my $locs = GetKohaAuthorisedValues( 'items.location' );
     foreach my $thisloc (sort keys %$locs) {
-               warn $thisloc;
                my $row = {
                     value => $thisloc,
                     description => $locs->{$thisloc},
@@ -167,8 +166,7 @@ if ( $count == 1 ) {
     if ( $results[0]->{'unitprice'} == 0 ) {
         $results[0]->{'unitprice'} = '';
     }
-    $results[0]->{'copyrightdate'} =
-      format_date( $results[0]->{'copyrightdate'} );
+#    $results[0]->{'copyrightdate'} = format_date( $results[0]->{'copyrightdate'} );  # this usu fails.
     $template->param(
         branchloop            => \@branchloop,
         count                 => 1,
index 4e624ee..e928143 100755 (executable)
@@ -131,7 +131,7 @@ my $countpendings = scalar @$pendingorders;
 
 # pending orders totals
 my ($totalPunitprice,$totalPquantity,$totalPecost, $totalPqtyrcvd);
-
+my $ordergrandtotal;
 my @loop_orders = ();
 for (my $i=0;$i<$countpendings;$i++){
     my %line;
@@ -151,11 +151,13 @@ for (my $i=0;$i<$countpendings;$i++){
     $totalPqtyrcvd +=$line{quantityreceived};
     $totalPecost += $line{ecost};
     $line{ecost} = sprintf("%.2f",$line{ecost});
+    $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity});
     $line{unitprice} = sprintf("%.2f",$line{unitprice});
     $line{invoice} = $invoice;
     $line{gst} = $gst;
     $line{total} = $total;
     $line{supplierid} = $supplierid;
+       $ordergrandtotal += $line{ecost}*$line{quantity};
     push @loop_orders, \%line;
 }
 $freight = $totalfreight unless $freight;
@@ -164,6 +166,7 @@ $tototal=$tototal+$freight;
 
 $template->param(invoice => $invoice,
                 datereceived => $datereceived->output('iso'),
+                invoicedatereceived => $datereceived->output('iso'), 
                 formatteddatereceived => $datereceived->output(),
                 name => $booksellers[0]->{'name'},
                 supplierid => $supplierid,
@@ -178,6 +181,7 @@ $template->param(invoice => $invoice,
                 totalfreight => $totalfreight,
                 totalquantity => $totalquantity,
                 tototal => sprintf($cfstr,$tototal),
+                ordergrandtotal => sprintf($cfstr,$ordergrandtotal),
                 gst => $gst,
                 grandtot => sprintf($cfstr,$tototal+$gst),
                 totalPunitprice => sprintf("%.2f",$totalPunitprice),
diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js b/koha-tmpl/intranet-tmpl/prog/en/js/additem.js
new file mode 100644 (file)
index 0000000..ee93450
--- /dev/null
@@ -0,0 +1,37 @@
+function countItemBlocks() {
+    var outeritemblock = document.getElementById('outeritemblock');
+    var quantityrec = document.getElementById('quantityrec');
+    var origquantityrec = document.getElementById('origquantityrec');
+    var itemblockcount = outeritemblock.getElementsByTagName('div');
+    var num = parseFloat(origquantityrec.value) + itemblockcount.length;
+    quantityrec.setAttribute('value',num);
+}
+function deleteItemBlock(index) {
+    var aDiv = document.getElementById(index);
+    aDiv.parentNode.removeChild(aDiv);
+    countItemBlocks();
+}
+function cloneItemBlock(index) {    
+    var original = document.getElementById(index); //original <div>
+    var clone = original.cloneNode(true);
+    // set the attribute for the new 'div' subfields
+    clone.setAttribute('id',index + index);//set another id.
+    var NumTabIndex;
+    NumTabIndex = parseInt(original.getAttribute('tabindex'));
+    if(isNaN(NumTabIndex)) NumTabIndex = 0;
+    clone.setAttribute('tabindex',NumTabIndex+1);
+    var CloneButtonPlus;
+    var CloneButtonMinus;
+  //  try{
+        CloneButtonPlus = clone.getElementsByTagName('a')[0];
+        CloneButtonPlus.setAttribute('onclick',"cloneItemBlock('" + index + index + "')");
+    CloneButtonMinus = clone.getElementsByTagName('a')[1];
+    CloneButtonMinus.setAttribute('onclick',"deleteItemBlock('" + index + index + "')");
+    CloneButtonMinus.setAttribute('style',"display:inline");
+   // }
+    //catch(e){        // do nothig if ButtonPlus & CloneButtonPlus don't exist.
+    //}
+    // insert this line on the page    
+    original.parentNode.insertBefore(clone,original.nextSibling);
+    countItemBlocks();
+}
index 25c7998..d0e8cac 100644 (file)
@@ -48,8 +48,8 @@
         <table>
             <tr>
                 <th>Order</th>
-                <th><a href="basket.pl?basketno=<!-- TMPL_VAR name="basketno" -->&amp;order=biblioitems.publishercode">Publisher</a></th>
                 <th>Title</th>
+                <th><a href="basket.pl?basketno=<!-- TMPL_VAR name="basketno" -->&amp;order=biblioitems.publishercode">Publisher</a></th>
                 <th>RRP</th>
                 <th>Est.</th>
                 <th>Qty.</th>
                 <!-- /TMPL_IF -->
             </tr>
             <!-- TMPL_LOOP NAME="books_loop" -->
-                <!-- TMPL_IF NAME="highlight" --><tr class="highlight"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF -->
-                    <td><!-- TMPL_VAR NAME="ordernumber" --></td>
-                    <td><!-- TMPL_VAR NAME="publishercode" --></td>
-                    <!-- TMPL_IF name="closedate" -->
-                        <td><p>
-                            <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->"><!-- TMPL_VAR NAME="title" --></a><br />
-                                <!-- TMPL_VAR NAME="author" -->
-                                <!-- TMPL_IF name="isbn"-->- <!-- TMPL_VAR name="isbn" --><!-- /TMPL_IF -->
-                                <!-- TMPL_IF name="notes" --></p><p><!--TMPL_VAR name="notes" --><!-- /TMPL_IF -->
-                            </p>
-                        </td>
-                    <!-- TMPL_ELSE -->
+                 <!-- TMPL_IF NAME="order_received" --><tr class="disabled"><!-- TMPL_ELSE --><!-- TMPL_IF NAME="highlight" --><tr class="highlight"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF --><!-- /TMPL_IF -->
+                    <td><!-- TMPL_VAR NAME="ordernumber" -->
+                                                       <!-- TMPL_IF NAME="order_received" --> (rcvd)<!-- /TMPL_IF --></td>
                         <td>
-                            <p>
+                               <p>
                                 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->"><!-- TMPL_VAR NAME="title" --></a></p>
                                 <p><!-- TMPL_VAR NAME="author" -->
                                 <!-- TMPL_IF name="isbn"-->- <!-- TMPL_VAR name="isbn" --><!-- /TMPL_IF -->
                                 <!-- TMPL_IF name="notes" --></p><p><!--TMPL_VAR name="notes" --><!-- /TMPL_IF -->
                             </p>
                         </td>
-                    <!-- /TMPL_IF -->
+                    <td><!-- TMPL_VAR NAME="publishercode" --></td>
                     <td class="number"><!-- TMPL_VAR NAME="rrp" --></td>
                     <td class="number"><!-- TMPL_VAR NAME="ecost" --></td>
                     <td class="number"><!-- TMPL_VAR NAME="quantity" --></td>
                     <input type="hidden" name="number" value="<!-- TMPL_VAR NAME="count" -->" />
                     <input type="hidden" name="basketno" value="<!-- TMPL_VAR NAME="basketno" -->" />
                 </td>
-                <th>SubTotal</th>
-                <th><!-- TMPL_VAR NAME="sub_total_est" --></th>
-                <th><!-- TMPL_VAR NAME="sub_total" --></th>
+                <th colspan="3">SubTotal</th>
+              <!--  <th><!-- TMPL_VAR NAME="sub_total_est" --></th> -->
                 <th><!-- TMPL_VAR name="qty_total" --></th>
+                <th><!-- TMPL_VAR NAME="sub_total" --></th>
                     <!-- TMPL_IF name="active" -->
                         <!-- TMPL_IF name="closedate" -->
-                          <td colspan="2" rowspan="3">&nbsp;</td>
+                          <td colspan="2">&nbsp;</td>
                         <!-- TMPL_ELSE -->
-                          <td colspan="3" rowspan="3">&nbsp;</td>
+                          <td colspan="3">&nbsp;</td>
                         <!-- /TMPL_IF -->
                     <!-- /TMPL_IF -->
                 
             </tr>
 <!-- TMPL_IF NAME="GST" -->            <tr>
                 <th>GST</th>
+                <th>&nbsp;</th>
                 <th><!-- TMPL_VAR NAME="gist_est" --></th>
                 <th><!-- TMPL_VAR NAME="gist" --></th>
                 <th>&nbsp;</th>
             </tr><!-- /TMPL_IF -->
             <tr>
                 <th>TOTAL  (<!-- TMPL_VAR NAME="currency" -->)</th>
-                <th><!-- TMPL_VAR NAME="grand_total_est" --></th>
-                <th><!-- TMPL_VAR NAME="grand_total" --></th>
+                <th><!-- TMPL_VAR NAME="grand_total_rrp" --></th>
                 <th>&nbsp;</th>
+                <th><!-- TMPL_VAR name="qty_total" --></th>
+                <th><!-- TMPL_VAR NAME="grand_total" --></th>
             </tr>
         </table>
     <!-- TMPL_ELSE -->
index 49aff39..c82dc33 100644 (file)
@@ -1,12 +1,13 @@
 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
 <title>Koha &rsaquo; Acquisitions &rsaquo; Receipt summary for : <!-- TMPL_VAR NAME="name" --> <!-- TMPL_IF NAME="invoice" -->invoice, <!-- TMPL_VAR NAME="invoice" --><!-- /TMPL_IF --></title>
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/additem.js"></script>
 </head>
 <body>
 <!-- TMPL_INCLUDE NAME="header.inc" -->
 <!-- TMPL_INCLUDE NAME="acquisitions-search.inc" -->
 
-<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/supplier.pl?supplierid=<!-- TMPL_VAR NAME="supplierid" -->"><!-- TMPL_VAR NAME="name" --></a> &rsaquo; Receipt order for : <!-- TMPL_VAR NAME="name" --> <!-- TMPL_IF NAME="invoice" -->Parcel <!-- TMPL_VAR NAME="invoice" --><!-- /TMPL_IF --> (order #<!-- TMPL_VAR NAME="ordernumber" -->)</div>
+<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/supplier.pl?supplierid=<!-- TMPL_VAR NAME="supplierid" -->"><!-- TMPL_VAR NAME="name" --></a> &rsaquo; Receive items from : <!-- TMPL_VAR NAME="name" --> <!-- TMPL_IF NAME="invoice" -->[<!-- TMPL_VAR NAME="invoice" -->]<!-- /TMPL_IF --> (order #<!-- TMPL_VAR NAME="ordernumber" -->)</div>
 
 <div id="doc3" class="yui-t2">
    
@@ -14,7 +15,7 @@
        <div id="yui-main">
        <div class="yui-b">
 
-<h1>Receipt order for : <!-- TMPL_VAR NAME="name" --> <!-- TMPL_IF NAME="invoice" -->Parcel <!-- TMPL_VAR NAME="invoice" --><!-- /TMPL_IF --> (order #<!-- TMPL_VAR NAME="ordernumber" -->)</h1>
+<h1>Receive items from : <!-- TMPL_VAR NAME="name" --> <!-- TMPL_IF NAME="invoice" -->[<!-- TMPL_VAR NAME="invoice" -->] <!-- /TMPL_IF --> (order #<!-- TMPL_VAR NAME="ordernumber" -->)</h1>
 
 <!-- TMPL_IF name="count" -->
     <form action="/cgi-bin/koha/acqui/finishreceive.pl" method="post">
@@ -23,7 +24,7 @@
     
     <fieldset class="rows">
     <legend>Catalogue Details</legend>
-    <ol><li><span class="label">Title: </span><!-- TMPL_VAR NAME="title" --></li>
+    <ul><li><span class="label">Title: </span><span class="title"><!-- TMPL_VAR NAME="title" --></span></li>
     <li> <span class="label">Author: </span>
         <!-- TMPL_VAR NAME="author" --></li>
     <li><span class="label">Copyright: </span>
         <!-- TMPL_VAR NAME="isbn" --></li>
     <li> <span class="label">Series: </span>
         <!-- TMPL_VAR NAME="seriestitle" --></li>
-    <li> <label for="volinf">Volume Info (for serials): </label>
+    </ul>
+       </fieldset>
+       <fieldset class="rows">
+       <legend>Item details (n):  (add to catalogue)</legend>
+  <div id="outeritemblock">
+       <div id="itemblock">
+       <ul>
+       <li> <label for="volinf">Volume/Copy (for serials): </label>
         <input type="text" size="20" name="volinf" id="volinf" /></li></ol>
-    <li> <label for="barcode">Item Barcode: </label>
+    <li> <label for="barcode">Item barcode: </label>
         <input type="text" size="20" name="barcode" id="barcode" value="<!-- TMPL_VAR NAME="barcode" -->" /></li>
-    <li> <label for="homebranch">Home Library: </label>
+    <li> <label for="homebranch">Home library: </label>
             <select name="homebranch" id="homebranch">            <!-- TMPL_LOOP name="branchloop" -->
                 <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="description" --></option>
                 <!-- TMPL_ELSE -->
             <!-- /TMPL_LOOP -->
             </select></li>
    <!-- /TMPL_IF -->
-       
+   </ul>
+<a style="cursor: crosshair; color: grey; font-size: 180%;" onclick="cloneItemBlock('itemblock<!-- TMPL_VAR name="itemBlockIndex" -->')">+</a>
+ <a style="display:none; cursor: crosshair; color: grey; font-size: 180%;" onclick="deleteItemBlock('itemblock<!-- TMPL_VAR name="itemBlockIndex" -->')">-</a>
+    </div>
+       </div>
        <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
     <input type="hidden" name="ordnum" value="<!-- TMPL_VAR NAME="ordernumber" -->" />
     <input type="hidden" name="biblioitemnumber" value="<!-- TMPL_VAR NAME="biblioitemnumber" -->" />
        </div>
        <div class="yui-u">
     <fieldset class="rows">
-    <legend>Accounting Details</legend>
-       <ol> <li><label for="quantity">Quantity Ordered: </label><input type="text" size="20" name="quantity" id="quantity" value="<!-- TMPL_VAR NAME="quantity" -->" /></li>
-        <li><label for="quantityrec">Quantity Received: </label><input type="text" size="20" name="quantityrec" id="quantityrec" value="<!-- TMPL_VAR NAME="quantityreceived" -->" /></li>
-        <li><label for="rrp">Replacement Cost: </label><input type="text" size="20" name="rrp" id="rrp" value="<!-- TMPL_VAR NAME="rrp" -->" /></li>
-        <li><label for="ecost">Budgeted Cost: </label><input type="text" size="20" name="ecost" id="ecost" value="<!-- TMPL_VAR NAME="ecost" -->" /></li>
-        <li><label for="cost">Actual Cost</label>
+    <legend>Accounting details</legend>
+       <ul>
+       <li><label for="quantity">Quantity ordered: </label><span class="label"> <!-- TMPL_VAR NAME="quantity" --> </span></li>
+        <li><label for="quantityrec">Quantity received: </label>
+          <input id="quantityrec" READONLY type="text" size="20" name="quantityrec" value="<!-- TMPL_IF NAME="quantityreceived" --><!-- TMPL_VAR NAME="quantityreceivedplus1" --><!-- TMPL_ELSE -->1<!-- /TMPL_IF -->" />
+          <input id="origquantityrec" READONLY type="hidden" name="origquantityrec" value="<!-- TMPL_IF NAME="quantityreceived" --><!-- TMPL_VAR NAME="quantityreceived" --><!-- TMPL_ELSE -->0<!-- /TMPL_IF -->" />
+               <!--    <input type="text" size="20" name="quantityrec" id="quantityrec" value="<!-- TMPL_VAR NAME="quantityreceived" -->" /> --></li>
+        <li><label for="rrp">Replacement cost: </label><input type="text" size="20" name="rrp" id="rrp" value="<!-- TMPL_VAR NAME="rrp" -->" /></li>
+        <li><label for="ecost">Budgeted cost: </label><input type="text" size="20" name="ecost" id="ecost" value="<!-- TMPL_VAR NAME="ecost" -->" /></li>
+        <li><label for="cost">Actual cost:</label>
         <!-- TMPL_IF name="unitprice"-->
          <input type="text" size="20" name="cost" id="cost" value="<!-- TMPL_VAR NAME="unitprice" -->" />
         <!-- TMPL_ELSE -->
index 69885aa..d02be8a 100644 (file)
@@ -1,6 +1,6 @@
 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
 <title>Koha &rsaquo; Acquisitions &rsaquo; <!-- TMPL_IF name="date" -->
-            Receipt Summary for <!-- TMPL_VAR NAME="name" --> <!--TMPL_IF Name="invoice"-->Invoice <!-- TMPL_VAR NAME="invoice" --><!--/TMPL_IF --> on <!-- TMPL_VAR NAME="datereceived" --><!-- TMPL_ELSE -->Receive Orders from <!-- TMPL_VAR NAME="name" --><!-- /TMPL_IF --></title>
+            Receipt Summary for <!-- TMPL_VAR NAME="name" --> <!--TMPL_IF Name="invoice"-->Invoice <!-- TMPL_VAR NAME="invoice" --><!--/TMPL_IF --> on <!-- TMPL_VAR NAME="formatteddatereceived" --><!-- TMPL_ELSE -->Receive Orders from <!-- TMPL_VAR NAME="name" --><!-- /TMPL_IF --></title>
 <!-- TMPL_INCLUDE NAME="greybox.inc" -->
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 </head>
@@ -9,9 +9,9 @@
 <!-- TMPL_INCLUDE NAME="acquisitions-search.inc" -->
 
 <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;  <!-- TMPL_IF name="date" -->
-            Receipt Summary for <i><!-- TMPL_VAR NAME="name" --></i> <!--TMPL_IF Name="invoice"--><i>[ <!-- TMPL_VAR NAME="invoice" --> ]</i><!--/TMPL_IF --> on <i><!-- TMPL_VAR NAME="datereceived" --></i>
+            Receipt Summary for <i><!-- TMPL_VAR NAME="name" --></i> <!--TMPL_IF Name="invoice"--><i>[ <!-- TMPL_VAR NAME="invoice" --> ]</i><!--/TMPL_IF --> on <i><!-- TMPL_VAR NAME="formatteddatereceived" --></i>
         <!-- TMPL_ELSE -->
-            Orders not yet Received from <!-- TMPL_VAR NAME="name" -->
+            Receive orders from <!-- TMPL_VAR NAME="name" -->
         <!-- /TMPL_IF --></div>
 
 <div id="doc3" class="yui-t2">
        
     <h1>
         <!-- TMPL_IF name="datereceived" -->
-            Receipt Summary for <i><!-- TMPL_VAR NAME="name" --></i> <!--TMPL_IF Name="invoice"--> <i> [ <!-- TMPL_VAR NAME="invoice" --> ] </i><!--/TMPL_IF --> on <i><!-- TMPL_VAR NAME="datereceived" --></i>
+            Receipt Summary for <i><!-- TMPL_VAR NAME="name" --></i> <!--TMPL_IF Name="invoice"--> <i> [ <!-- TMPL_VAR NAME="invoice" --> ] </i><!--/TMPL_IF --> on <i><!-- TMPL_VAR NAME="formatteddatereceived" --></i>
         <!-- TMPL_ELSE -->
-            Orders not yet Received from <!-- TMPL_VAR NAME="name" -->
+            Receive orders from <!-- TMPL_VAR NAME="name" -->
         <!-- /TMPL_IF -->
     </h1>
 <div id="acqui_recieve_summary">
-    <p>Parcel: <!-- TMPL_VAR NAME="invoice" --></p>
+    <p>Invoice / Parcel: <!-- TMPL_VAR NAME="invoice" --></p>
     <p>Received by: <!-- TMPL_VAR NAME="loggedinusername" --></p>
-    <p>On: <!-- TMPL_VAR NAME="datereceived" --></p>
+    <p>On: <!-- TMPL_VAR NAME="formatteddatereceived" --></p>
+       <!-- TODO: Add date picker, change rcv date. -->
 </div>
 <div id="acqui_recieve_recievelist">
     <h2>Items in parcel</h2>
@@ -47,7 +48,7 @@
         </tr>
         <!-- TMPL_LOOP NAME="loop_received" -->
             <tr>
-                <td><a href="orderreceive.pl?receive=<!-- TMPL_VAR NAME="ordernumber" -->&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;datereceived=<!-- TMPL_VAR NAME="datereceived" -->&amp;invoice=<!-- TMPL_VAR NAME="invoice" -->&amp;gst=<!-- TMPL_VAR NAME="gst" -->&amp;freight=<!-- TMPL_VAR NAME="freight" -->&amp;supplierid=<!-- TMPL_VAR NAME="supplierid" -->"><!-- TMPL_VAR NAME="quantityreceived" --></a></td>
+                <td><!-- TMPL_VAR NAME="quantityreceived" --></td>
                 <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=<!-- TMPL_VAR NAME="basketno" -->"><!-- TMPL_VAR NAME="basketno" --></a>&nbsp; / &nbsp;<!-- TMPL_VAR NAME="ordernumber" --></td>
                 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->"><!-- TMPL_VAR NAME="title" --></a>
                 <!-- TMPL_IF NAME="isbn" --><br />ISBN: <!-- TMPL_VAR NAME="isbn" --><!--/TMPL_IF-->
             <th>BASKET</th>
             <th>Summary</th>
                        <th>View Record</th>
-            <th>Qty received / ordered</th>
+            <th>Still on order</th>
+            <th>Unit cost</th>
             <th>Order cost</th>
-            <th>Received cost</th>
             <th>&nbsp;</th>
         </tr>
         <!-- TMPL_LOOP NAME="loop_orders" -->
                 <!-- TMPL_IF NAME="publishercode" --><br />Publisher :<!-- TMPL_VAR NAME="publishercode" --><!--/TMPL_IF-->
                 </td>
                 <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=<!-- TMPL_VAR NAME="biblionumber" -->" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=<!-- TMPL_VAR NAME="biblionumber" -->" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
-                <td> <!-- TMPL_VAR NAME="quantityreceived" -->  / <!-- TMPL_VAR NAME="quantity" --></td>
+                <td> <!-- TMPL_VAR NAME="quantity" --></td>
                 <td><!-- TMPL_VAR NAME="ecost" --></td>
-                <td><!-- TMPL_IF EXPR="unitprice ne '0.00'" --><!-- TMPL_VAR NAME="unitprice" --><!-- /TMPL_IF --></td>
-                               <td><a href="orderreceive.pl?receive=<!-- TMPL_VAR NAME="ordernumber" -->&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;datereceived=<!-- TMPL_VAR NAME="datereceived" -->&amp;invoice=<!-- TMPL_VAR NAME="invoice" -->&amp;gst=<!-- TMPL_VAR NAME="gst" -->&amp;freight=<!-- TMPL_VAR NAME="freight" -->&amp;supplierid=<!-- TMPL_VAR NAME="supplierid" -->">Receive</a></td>
+                <td><!-- TMPL_VAR NAME="ordertotal" --></td>
+                               <td><a href="orderreceive.pl?receive=<!-- TMPL_VAR NAME="ordernumber" -->&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;datereceived=<!-- TMPL_VAR NAME="invoicedatereceived" -->&amp;invoice=<!-- TMPL_VAR NAME="invoice" -->&amp;gst=<!-- TMPL_VAR NAME="gst" -->&amp;freight=<!-- TMPL_VAR NAME="freight" -->&amp;supplierid=<!-- TMPL_VAR NAME="supplierid" -->">Receive</a></td>
             </tr>
         <!-- /TMPL_LOOP -->
             <tr><td colspan="2">&nbsp;</td>
                 <th>TOTAL</th>
-                <th><!-- TMPL_VAR NAME="totalPqtyrcvd" --> / <!-- TMPL_VAR NAME="totalPquantity" --> </th>
-                <th><!-- TMPL_VAR NAME="totalPecost" --></th>
-                <th><!-- TMPL_VAR NAME="totalPunitprice" --></th>
+                <th> <!-- TMPL_VAR NAME="totalPquantity" --> </th>
+                               <td>&nbsp;</td>
+                <th><!-- TMPL_VAR NAME="ordergrandtotal" --></th>
                                <td>&nbsp;</td>
             </tr>
      </table>