<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Lucida Sans Unicode";
        panose-1:2 11 6 2 3 5 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal>I’m working on pulling over all of our order history
into Koha, and I have a question about the Spent amount in the acquisitions home
page. It’s calculating it incorrectly, because in Bookfund.pm the select
statement is joining on bookfundid and not the budgetid so it’s getting
the amount spent in the entire fund and not the specific budget in that fund.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Shouldn’t the where clause have budgetdate less than
or equal to AND startdate less than or equal to, not or?<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Thanks.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Here’s the select statement from Bookfund.pm:<o:p></o:p></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>SELECT
quantity,datereceived,freight,unitprice,listprice,ecost,<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> quantityreceived,subscription<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> FROM aqorders<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> LEFT JOIN aqorderbreakdown ON
aqorders.ordernumber=aqorderbreakdown.ordernumber<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> LEFT JOIN aqbookfund ON
(aqorderbreakdown.bookfundid=aqbookfund.bookfundid and
aqorderbreakdown.branchcode=aqbookfund.branchcode)<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> LEFT JOIN aqbudget ON
(aqbudget.bookfundid=aqbookfund.bookfundid and
aqbudget.branchcode=aqbookfund.branchcode)<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> WHERE aqorderbreakdown.bookfundid=?<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> AND (datecancellationprinted IS NULL OR
datecancellationprinted='0000-00-00')<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>
AND ((budgetdate >= ? and budgetdate < ?) OR (startdate>=? and
enddate<=?))<o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><b><span style='font-size:10.0pt'>James Winter<o:p></o:p></span></b></p>
<p class=MsoNormal><b><i><span style='font-size:10.0pt;color:#C00000'><a
href="http://www.arcadia.edu/"><span style='color:#C00000;text-decoration:none'>Arcadia
University</span></a><o:p></o:p></span></i></b></p>
<p class=MsoNormal><span style='font-size:10.0pt'>Systems Manager<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt'>215.517.2588<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:9.0pt'><a
href="mailto:winterj@arcadia.edu" title="Send James an email"><span
style='color:windowtext;text-decoration:none'>winterj@arcadia.edu</span></a><o:p></o:p></span></p>
<p class=MsoNormal><span style='font-family:"Lucida Sans Unicode","sans-serif"'> </span><o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>