function consumption($year,$month,$goodid)
{
include("../adodb5/adodb.inc.php");
include("../config_DB.php");
$conditionDate=date("F Y");
$conditionDate1=strtotime("$conditionDate");
if ($month==1){$Mth=strtotime("january $year");}
if ($month==2){$Mth=strtotime("february $year");}
if ($month==3){$Mth=strtotime("march $year");}
if ($month==4){$Mth=strtotime("april $year");}
if ($month==5){$Mth=strtotime("may $year");}
if ($month==6){$Mth=strtotime("june $year");}
if ($month==7){$Mth=strtotime("july $year");}
if ($month==8){$Mth=strtotime("august $year");}
if ($month==9){$Mth=strtotime("september $year");}
if ($month==10){$Mth=strtotime("october $year");}
if ($month==11){$Mth=strtotime("november $year");}
if ($month==12){$Mth=strtotime("december $year");}
$strConn = new COM("ADODB.Connection") or die("Cannot start ADO");
$strConn->Open("PROVIDER=".$myDriver.";SERVER=".$myServer.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB1);
$strSQL = "select sum(goodqty2) as goodqty22
from soinvhd left outer join soinvdt on soinvhd.soinvid = soinvdt.soinvid
where soinvhd.docutype=107 and soinvdt.goodid='$goodid' and NOT soinvhd.docustatus='C'
and MONTH(docudate) = $month AND YEAR(docudate) = $year ";
$objRec = new COM("ADODB.Recordset");
$objRec->Open($strSQL, $strConn, 1,4);
While (!$objRec->EOF)
{
$monthA = $objRec->Fields["goodqty22"]->Value;
$objRec->MoveNext();
}
$sumMonth=$monthA;
if($conditionDate1 >= $Mth)
{
if(empty($sumMonth) or $sumMonth==0){$sumMonth="<img src='../icon/don.gif' align='middle'>";}
else{$sumMonth="<Div align='center'>". number_format($sumMonth)."</DIV>";}
echo "$sumMonth";
}
else{echo"<img src='../icon/no1.png' align='middle'>";}
$sumMonth=0;
$objRec=0;
$strConn=0;
$objRec=null;
$$strConn=null;
}
?>
$strSQL = "select sum(goodqty2) as goodqty22
from soinvhd left outer join soinvdt on soinvhd.soinvid = soinvdt.soinvid
where soinvhd.docutype='107' and soinvdt.goodid='$goodid' and soinvhd.docustatus <> 'C'
and MONTH(docudate) = '$month' AND YEAR(docudate) = '$year' ";