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

(-)a/C4/Acquisition.pm (-1 / +3 lines)
Lines 712-718 sub GetPendingOrders { Link Here
712
    my $strsth = "
712
    my $strsth = "
713
        SELECT    ".($grouped?"count(*),":"")."aqbasket.basketno,
713
        SELECT    ".($grouped?"count(*),":"")."aqbasket.basketno,
714
                    surname,firstname,aqorders.*,biblio.*,biblioitems.isbn,
714
                    surname,firstname,aqorders.*,biblio.*,biblioitems.isbn,
715
                    aqbasket.closedate, aqbasket.creationdate, aqbasket.basketname
715
                    aqbasket.closedate, aqbasket.creationdate, aqbasket.basketname,
716
                    (SELECT count(*) FROM aqorders_items WHERE aqorders_items.ordernumber=aqorders.ordernumber) AS items
716
        FROM      aqorders
717
        FROM      aqorders
717
        LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
718
        LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
718
        LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber
719
        LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber
Lines 1269-1274 sub GetParcel { Link Here
1269
                aqorders.listprice,
1270
                aqorders.listprice,
1270
                aqorders.rrp,
1271
                aqorders.rrp,
1271
                aqorders.ecost,
1272
                aqorders.ecost,
1273
                aqorders.freight,
1272
                biblio.title
1274
                biblio.title
1273
        FROM aqorders
1275
        FROM aqorders
1274
        LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
1276
        LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
(-)a/acqui/addorder.pl (+3 lines)
Lines 103-108 budget_id used to pay this order. Link Here
103
103
104
=item C<cost>
104
=item C<cost>
105
105
106
=item C<freight>
107
106
=item C<sub>
108
=item C<sub>
107
109
108
=item C<invoice>
110
=item C<invoice>
Lines 174-179 $orderinfo->{'uncertainprice'} ||= 0; Link Here
174
#my $gst           = $input->param('GST');
176
#my $gst           = $input->param('GST');
175
#my $budget        = $input->param('budget');
177
#my $budget        = $input->param('budget');
176
#my $cost          = $input->param('cost');
178
#my $cost          = $input->param('cost');
179
#my $freight       = $input->param('freight');
177
#my $sub           = $input->param('sub');
180
#my $sub           = $input->param('sub');
178
#my $purchaseorder = $input->param('purchaseordernumber');
181
#my $purchaseorder = $input->param('purchaseordernumber');
179
#my $invoice       = $input->param('invoice');
182
#my $invoice       = $input->param('invoice');
(-)a/acqui/neworderempty.pl (+1 lines)
Lines 384-389 $template->param( Link Here
384
    quantityrec      => $data->{'quantity'},
384
    quantityrec      => $data->{'quantity'},
385
    rrp              => $data->{'rrp'},
385
    rrp              => $data->{'rrp'},
386
    listprice        => sprintf("%.2f", $data->{'listprice'}||$data->{'price'}||$listprice),
386
    listprice        => sprintf("%.2f", $data->{'listprice'}||$data->{'price'}||$listprice),
387
    freight          => sprintf("%.2f", $data->{'freight'}||0),
387
    total            => sprintf("%.2f", ($data->{'ecost'}||0)*($data->{'quantity'}||0) ),
388
    total            => sprintf("%.2f", ($data->{'ecost'}||0)*($data->{'quantity'}||0) ),
388
    ecost            => $data->{'ecost'},
389
    ecost            => $data->{'ecost'},
389
    unitprice        => sprintf("%.2f", $data->{'unitprice'}),
390
    unitprice        => sprintf("%.2f", $data->{'unitprice'}),
(-)a/acqui/parcel.pl (-24 / +20 lines)
Lines 178-204 for (my $i = 0 ; $i < $countlines ; $i++) { Link Here
178
    $totalprice += $parcelitems[$i]->{'unitprice'};
178
    $totalprice += $parcelitems[$i]->{'unitprice'};
179
    $line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'});
179
    $line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'});
180
180
181
    #double FIXME - totalfreight is redefined later.
181
    $totalfreight  += $parcelitems[$i]->{'freight'};
182
183
# 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..
184
    if ($i > 0 && $totalfreight != $parcelitems[$i]->{'freight'}) {
185
        warn "FREIGHT CHARGE MISMATCH!!";
186
    }
187
    $totalfreight = $parcelitems[$i]->{'freight'};
188
    $totalquantity += $parcelitems[$i]->{'quantityreceived'};
182
    $totalquantity += $parcelitems[$i]->{'quantityreceived'};
189
    $tototal       += $total;
183
    $tototal       += $total;
190
}
184
}
191
185
192
my $pendingorders = GetPendingOrders($supplierid);
186
my $pendingorders = GetPendingOrders($supplierid);
193
my $countpendings = scalar @$pendingorders;
187
my $countpendingitems = 0;
188
if ($pendingorders) {
189
    $countpendingitems += $_->{items} || 1 foreach @$pendingorders;
190
}
191
my $freight_per_item = $freight && $countpendingitems ? $freight/$countpendingitems : 0;
194
192
195
# pending orders totals
193
# pending orders totals
196
my ($totalPunitprice, $totalPquantity, $totalPecost, $totalPqtyrcvd);
194
my ($totalPunitprice, $totalPquantity, $totalPecost, $totalPqtyrcvd);
197
my $ordergrandtotal;
195
my $ordergrandtotal;
198
my @loop_orders = ();
196
my @loop_orders = ();
199
for (my $i = 0 ; $i < $countpendings ; $i++) {
197
for (my $i = $startfrom; $i < $startfrom + $resultsperpage; $i++) {
200
    my %line;
198
    last unless $pendingorders->[$i];
201
    %line = %{$pendingorders->[$i]};
199
    my %line = %{$pendingorders->[$i]};
202
   
200
   
203
    $line{quantity}+=0;
201
    $line{quantity}+=0;
204
    $line{quantityreceived}+=0;
202
    $line{quantityreceived}+=0;
Lines 210-215 for (my $i = 0 ; $i < $countpendings ; $i++) { Link Here
210
    $line{ecost} = sprintf("%.2f",$line{ecost});
208
    $line{ecost} = sprintf("%.2f",$line{ecost});
211
    $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity});
209
    $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity});
212
    $line{unitprice} = sprintf("%.2f",$line{unitprice});
210
    $line{unitprice} = sprintf("%.2f",$line{unitprice});
211
    $line{freight} = sprintf("%.2f",$freight_per_item * ($line{items} || 1));
213
    $line{invoice} = $invoice;
212
    $line{invoice} = $invoice;
214
    $line{gst} = $gst;
213
    $line{gst} = $gst;
215
    $line{total} = $total;
214
    $line{total} = $total;
Lines 244-265 for (my $i = 0 ; $i < $countpendings ; $i++) { Link Here
244
    $line{holds}                = $holds;
243
    $line{holds}                = $holds;
245
    $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
244
    $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
246
    
245
    
247
    
246
    push @loop_orders, \%line;
248
    push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage);
249
}
247
}
250
$freight = $totalfreight unless $freight;
251
248
252
my $count = $countpendings;
249
my $countpendings = $pendingorders ? scalar (@$pendingorders) : 0;
253
250
254
if ($count>$resultsperpage){
251
if ($countpendings>$resultsperpage){
255
    my $displaynext=0;
252
    my $displaynext=0;
256
    my $displayprev=$startfrom;
253
    my $displayprev=$startfrom;
257
    if(($count - ($startfrom+$resultsperpage)) > 0 ) {
254
    if(($countpendings - ($startfrom+$resultsperpage)) > 0 ) {
258
        $displaynext = 1;
255
        $displaynext = 1;
259
    }
256
    }
260
257
261
    my @numbers = ();
258
    my @numbers = ();
262
    for (my $i=1; $i<$count/$resultsperpage+1; $i++) {
259
    for (my $i=1; $i<$countpendings/$resultsperpage+1; $i++) {
263
            my $highlight=0;
260
            my $highlight=0;
264
            ($startfrom/$resultsperpage==($i-1)) && ($highlight=1);
261
            ($startfrom/$resultsperpage==($i-1)) && ($highlight=1);
265
            push @numbers, { number => $i,
262
            push @numbers, { number => $i,
Lines 269-289 if ($count>$resultsperpage){ Link Here
269
266
270
    my $from = $startfrom*$resultsperpage+1;
267
    my $from = $startfrom*$resultsperpage+1;
271
    my $to;
268
    my $to;
272
    if($count < (($startfrom+1)*$resultsperpage)){
269
    if($countpendings < (($startfrom+1)*$resultsperpage)){
273
        $to = $count;
270
        $to = $countpendings;
274
    } else {
271
    } else {
275
        $to = (($startfrom+1)*$resultsperpage);
272
        $to = (($startfrom+1)*$resultsperpage);
276
    }
273
    }
277
    $template->param(numbers=>\@numbers,
274
    $template->param(numbers=>\@numbers,
278
                     displaynext=>$displaynext,
275
                     displaynext=>$displaynext,
279
                     displayprev=>$displayprev,
276
                     displayprev=>$displayprev,
280
                     nextstartfrom=>(($startfrom+$resultsperpage<$count)?$startfrom+$resultsperpage:$count),
277
                     nextstartfrom=>(($startfrom+$resultsperpage<$countpendings)?$startfrom+$resultsperpage:$countpendings),
281
                     prevstartfrom=>(($startfrom-$resultsperpage>0)?$startfrom-$resultsperpage:0)
278
                     prevstartfrom=>(($startfrom-$resultsperpage>0)?$startfrom-$resultsperpage:0)
282
                    );
279
                    );
283
}
280
}
284
281
285
#$totalfreight=$freight;
282
$tototal = $tototal + $totalfreight;
286
$tototal = $tototal + $freight;
287
283
288
$template->param(
284
$template->param(
289
    invoice               => $invoice,
285
    invoice               => $invoice,
Lines 300-306 $template->param( Link Here
300
    countpending          => $countpendings,
296
    countpending          => $countpendings,
301
    loop_orders           => \@loop_orders,
297
    loop_orders           => \@loop_orders,
302
    totalprice            => sprintf($cfstr, $totalprice),
298
    totalprice            => sprintf($cfstr, $totalprice),
303
    totalfreight          => $totalfreight,
299
    totalfreight          => sprintf($cfstr, $totalfreight),
304
    totalquantity         => $totalquantity,
300
    totalquantity         => $totalquantity,
305
    tototal               => sprintf($cfstr, $tototal),
301
    tototal               => sprintf($cfstr, $tototal),
306
    ordergrandtotal       => sprintf($cfstr, $ordergrandtotal),
302
    ordergrandtotal       => sprintf($cfstr, $ordergrandtotal),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (+6 lines)
Lines 464-469 $(document).ready(function() Link Here
464
                <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" />
464
                <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" />
465
                [% END %]
465
                [% END %]
466
            </li>
466
            </li>
467
            [% IF ( quantityrec ) %]
468
            <li>
469
                <label for="freight">Freight: </label>
470
                <input type="text" id="freight" size="20" name="freight" value="[% freight %]" [% IF close %] readonly="readonly" [% END %]/>
471
            </li>
472
            [% END %]
467
            <li>
473
            <li>
468
                <label for="notes">Notes: </label>
474
                <label for="notes">Notes: </label>
469
                <textarea id="notes" cols="30" rows="3" name="notes" >[% notes %]</textarea>
475
                <textarea id="notes" cols="30" rows="3" name="notes" >[% notes %]</textarea>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-1 / +1 lines)
Lines 82-88 Link Here
82
    <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
82
    <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
83
    <input type="hidden" name="supplierid" value="[% supplierid %]" />
83
    <input type="hidden" name="supplierid" value="[% supplierid %]" />
84
    <input type="hidden" name="datereceived" value="[% datereceived_iso %]" />
84
    <input type="hidden" name="datereceived" value="[% datereceived_iso %]" />
85
    <input type="hidden" name="freight" value="[% freight %]" />
86
    <input type="hidden" name="gst" value="[% gst %]" />
85
    <input type="hidden" name="gst" value="[% gst %]" />
87
	</div>
86
	</div>
88
	<div class="yui-u">
87
	<div class="yui-u">
Lines 127-132 Link Here
127
        [% ELSE %]
126
        [% ELSE %]
128
            <input type="text" size="20" name="cost" id="cost" value="[% ecost %]" />
127
            <input type="text" size="20" name="cost" id="cost" value="[% ecost %]" />
129
        [% END %]</li></ol>
128
        [% END %]</li></ol>
129
        <li><label for="freight">Freight: </label><input type="text" size="20" name="freight" id="freight" value="[% freight %]" /></li>
130
        <label for="note">Notes: </label><textarea name="note" width="40" rows="8" >[% notes %]</textarea>
130
        <label for="note">Notes: </label><textarea name="note" width="40" rows="8" >[% notes %]</textarea>
131
        <input type="hidden" name="invoice" value="[% invoice %]" />
131
        <input type="hidden" name="invoice" value="[% invoice %]" />
132
    </fieldset>
132
    </fieldset>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-1 / +1 lines)
Lines 325-331 Link Here
325
		    <tr>
325
		    <tr>
326
			<td colspan="6">&nbsp;
326
			<td colspan="6">&nbsp;
327
		</td>
327
		</td>
328
			    <td>Shipping</td>
328
			    <td>Shipping cost</td>
329
		<td>[% totalfreight %]</td>
329
		<td>[% totalfreight %]</td>
330
	    	</tr> 
330
	    	</tr> 
331
	    [% END %]
331
	    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt (-4 / +2 lines)
Lines 96-106 Link Here
96
            <input type="text" size="20" id="gst" name="gst" />
96
            <input type="text" size="20" id="gst" name="gst" />
97
        </li>
97
        </li>
98
		[% END %]
98
		[% END %]
99
      <!--  // Removing freight input until shipping can be proplerly handled .
100
	  <li>
99
	  <li>
101
            <label for="freight">Shipping:</label>
100
            <label for="freight">Shipping cost:</label>
102
            <input type="text" size="20" id="freight" name="freight" />
101
            <input type="text" size="20" id="freight" name="freight" />
103
        </li> -->
102
        </li>
104
         <li><label for="datereceived">Shipment date: </label>
103
         <li><label for="datereceived">Shipment date: </label>
105
            <input type="text" id="datereceived" name="datereceived"  maxlength="10" size="10"  value="[% datereceived_today %]" />
104
            <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" />
105
            <img src="[% themelang %]/lib/calendar/cal.gif" id="datereceived_button" alt="Show Calendar" />
107
- 

Return to bug 6504