[Koha-cvs] koha acqui/histsearch.pl C4/Acquisition.pm koha... [rel_2_2]

Henri-Damien LAURENT laurenthdl at alinto.com
Wed Dec 14 20:55:33 CET 2005


CVSROOT:	/cvsroot/koha
Module name:	koha
Branch: 	rel_2_2
Changes by:	Henri-Damien LAURENT <hdl at savannah.gnu.org>	05/12/14 19:55:33

Modified files:
	acqui          : histsearch.pl 
	C4             : Acquisition.pm 
	koha-tmpl/intranet-tmpl/default/en/acqui: histsearch.tmpl 

Log message:
	Adding quantityreceived to histsearch.tmpl
	Bug Fixing lateorders.pl

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/acqui/histsearch.pl.diff?only_with_tag=rel_2_2&tr1=1.1.2.3&tr2=1.1.2.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/koha/koha/C4/Acquisition.pm.diff?only_with_tag=rel_2_2&tr1=1.9.2.11&tr2=1.9.2.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/koha/koha/koha-tmpl/intranet-tmpl/default/en/acqui/histsearch.tmpl.diff?only_with_tag=rel_2_2&tr1=1.1.2.5&tr2=1.1.2.6&r1=text&r2=text

Patches:
Index: koha/C4/Acquisition.pm
diff -u koha/C4/Acquisition.pm:1.9.2.11 koha/C4/Acquisition.pm:1.9.2.12
--- koha/C4/Acquisition.pm:1.9.2.11	Wed Dec 14 13:09:42 2005
+++ koha/C4/Acquisition.pm	Wed Dec 14 19:55:33 2005
@@ -580,10 +580,10 @@
 #	warn " $dbdriver";
 	if ($dbdriver eq "mysql"){
 		$strsth ="SELECT aqbasket.basketno,
-					DATE(aqbasket.closedate) as orderdate, aqorders.quantity, aqorders.rrp as unitpricesupplier,aqorders.ecost as unitpricelib,
-					aqorders.quantity * aqorders.rrp as subtotal, aqbookfund.bookfundname as budget, borrowers.branchcode as branch,
+					DATE(aqbasket.closedate) as orderdate, aqorders.quantity - IFNULL(aqorders.quantityreceived,0) as quantity, aqorders.rrp as unitpricesupplier,aqorders.ecost as unitpricelib,
+					(aqorders.quantity - IFNULL(aqorders.quantityreceived,0)) * aqorders.rrp as subtotal, aqbookfund.bookfundname as budget, borrowers.branchcode as branch,
 					aqbooksellers.name as supplier,
-					biblio.title, biblio.author, biblioitems.publishercode as publisher, biblioitems.publicationyear,
+					aqorders.title, biblio.author, biblioitems.publishercode as publisher, biblioitems.publicationyear,
 					DATEDIFF(CURDATE( ),closedate) AS latesince
 					FROM 
 						((	(
@@ -596,7 +596,7 @@
 		$strsth .= " AND aqbasket.booksellerid = $supplierid " if ($supplierid);
 		$strsth .= " AND borrowers.branchcode like \'".$branch."\'" if ($branch);
 		$strsth .= " AND borrowers.branchcode like \'".C4::Context->userenv->{branch}."\'" if (C4::Context->preference("IndependantBranches") && C4::Context->userenv && C4::Context->userenv->{flags}!=1);
-		$strsth .= " ORDER BY latesince,basketno,borrowers.branchcode, supplier";
+		$strsth .= " HAVING quantity<>0 AND unitpricesupplier<>0 AND unitpricelib<>0 ORDER BY latesince,basketno,borrowers.branchcode, supplier ";
 	} else {
 		$strsth ="SELECT aqbasket.basketno,
 					DATE(aqbasket.closedate) as orderdate, 
@@ -618,7 +618,7 @@
 		$strsth .= " AND borrowers.branchcode like \'".C4::Context->userenv->{branch}."\'" if (C4::Context->preference("IndependantBranches") && C4::Context->userenv->{flags}!=1);
 		$strsth .= " ORDER BY latesince,basketno,borrowers.branchcode, supplier";
 	}
-#	warn "C4::Acquisition : getlateorders SQL:".$strsth;
+	warn "C4::Acquisition : getlateorders SQL:".$strsth;
 	my $sth = $dbh->prepare($strsth);
 	$sth->execute;
 	my @results;
@@ -736,12 +736,12 @@
 	my ($title,$author,$name,$from_placed_on,$to_placed_on)=@_;
 	my @order_loop;
 	my $total_qty=0;
+	my $total_qtyreceived=0;
 	my $total_price=0;
 	# don't run the query if there are no parameters (list would be too long for sure !
 	if ($title || $author || $name || $from_placed_on || $to_placed_on) {
 		my $dbh= C4::Context->dbh;
-		my $query = "select biblio.title,biblio.author,aqorders.basketno,name,aqbasket.creationdate,aqorders.datereceived, aqorders.quantity, aqorders.ecost from aqorders,aqbasket,aqbooksellers,biblio";
-		
+		my $query = "select biblio.title,biblio.author,aqorders.basketno,name,aqbasket.creationdate,aqorders.datereceived, aqorders.quantity, aqorders.quantityreceived, aqorders.ecost from aqorders,aqbasket,aqbooksellers,biblio";
 		$query .= ",borrowers " if (C4::Context->preference("IndependantBranches")); 
 		$query .=" where aqorders.basketno=aqbasket.basketno and aqbasket.booksellerid=aqbooksellers.id and biblio.biblionumber=aqorders.biblionumber ";
 		$query .= " and aqbasket.authorisedby=borrowers.borrowernumber" if (C4::Context->preference("IndependantBranches"));
@@ -757,6 +757,7 @@
 			}
 		}
 		$query .=" order by booksellerid";
+		warn "query histearch: ".$query;
 		my $sth = $dbh->prepare($query);
 		$sth->execute;
 		my $cnt=1;
@@ -767,10 +768,11 @@
 			$line->{creationdate} = format_date($line->{creationdate});
 			$line->{datereceived} = format_date($line->{datereceived});
 			$total_qty += $line->{'quantity'};
+			$total_qtyreceived += $line->{'quantityreceived'};
 			$total_price += $line->{'quantity'}*$line->{'ecost'};
 		}
 	}
-	return \@order_loop,$total_qty,$total_price;;
+	return \@order_loop,$total_qty,$total_price,$total_qtyreceived;
 }
 
 #
Index: koha/acqui/histsearch.pl
diff -u koha/acqui/histsearch.pl:1.1.2.3 koha/acqui/histsearch.pl:1.1.2.4
--- koha/acqui/histsearch.pl:1.1.2.3	Fri Sep 23 08:55:57 2005
+++ koha/acqui/histsearch.pl	Wed Dec 14 19:55:33 2005
@@ -24,9 +24,10 @@
 			     flagsrequired => {acquisition => 1},
 			     debug => 1,
 			     });
-my ($order_loop,$total_qty,$total_price)= &histsearch($title,$author,$name,$from_placed_on,$to_placed_on);
+my ($order_loop,$total_qty,$total_price,$total_qtyreceived)= &histsearch($title,$author,$name,$from_placed_on,$to_placed_on);
 $template->param(suggestions_loop => $order_loop,
 				total_qty => $total_qty,
+				total_qtyreceived => $total_qtyreceived,
 				total_price => sprintf  ("%.2f",$total_price),
 				numresults => scalar(@$order_loop),
 				title => $title,
Index: koha/koha-tmpl/intranet-tmpl/default/en/acqui/histsearch.tmpl
diff -u koha/koha-tmpl/intranet-tmpl/default/en/acqui/histsearch.tmpl:1.1.2.5 koha/koha-tmpl/intranet-tmpl/default/en/acqui/histsearch.tmpl:1.1.2.6
--- koha/koha-tmpl/intranet-tmpl/default/en/acqui/histsearch.tmpl:1.1.2.5	Fri Sep 23 08:55:57 2005
+++ koha/koha-tmpl/intranet-tmpl/default/en/acqui/histsearch.tmpl	Wed Dec 14 19:55:33 2005
@@ -11,6 +11,7 @@
 			<th class="acquisition">Placed on</th>
 			<th class="acquisition">Recieved on</th>
 			<th class="acquisition">Quantity ordered</th>
+			<th class="acquisition">Quantity received</th>
 			<th class="acquisition">Unit cost</th>
 			<th class="acquisition">&nbsp;</th>
 		</tr>
@@ -96,6 +97,9 @@
 					&nbsp;
 				</th>
 				<th class="acquisition">
+					&nbsp;
+				</th>
+				<th class="acquisition">
 					<input type="submit" class="button acquisition" value="Set Filter">
 				</th>
 			</form>
@@ -150,6 +154,13 @@
 				<!-- TMPL_ELSE -->
 					<td class="number">
 				<!-- /TMPL_IF -->
+					<!-- TMPL_VAR name="quantityreceived" -->
+				</td>
+				<!-- TMPL_IF name="toggle" -->
+					<td class="hilighted number">
+				<!-- TMPL_ELSE -->
+					<td class="number">
+				<!-- /TMPL_IF -->
 					<!-- TMPL_VAR name="ecost" -->
 				</td>
 				<!-- TMPL_IF name="toggle" -->
@@ -168,8 +179,8 @@
 			<th class="acquisition">&nbsp;</th>
 			<th class="acquisition">&nbsp;</th>
 			<th class="acquisition">&nbsp;</th>
-			<th class="acquisition">&nbsp;</th>
 			<th class="acquisition"><!-- TMPL_VAR name="total_qty" --></th>
+			<th class="acquisition"><!-- TMPL_VAR name="total_qtyreceived" --></th>
 			<th class="acquisition"><!-- TMPL_VAR name="total_price" --></th>
 			<th class="acquisition">&nbsp;</th>
 		</tr>





More information about the Koha-cvs mailing list