$acc = new Accounts(); $orimonth = right(left(getDateSession(), 7), 2); $oriyear = left(getDateSession(), 4); //$period1=$period->getPeriodID($year,$month); for ($i = 5; $i >= 0; $i--) { $year = $oriyear; $month = $orimonth - $i; if ($month <= 0) { $month = $month + 12; $year = $year - 1; } //$period1=$period->getPeriodID($year,$month); eval("\$period" . (5 - $i) . "=" . $period->getPeriodID($year, $month) . ";"); eval("\$periodname" . (5 - $i) . "=\$year.'-'.\$month;"); } $pl0 = $acc->getProfitAndLostInPeriod($period0); $pl1 = $acc->getProfitAndLostInPeriod($period1); $pl2 = $acc->getProfitAndLostInPeriod($period2); $pl3 = $acc->getProfitAndLostInPeriod($period3); $pl4 = $acc->getProfitAndLostInPeriod($period4); $pl5 = $acc->getProfitAndLostInPeriod($period5); /*echo <<< EOF $period0,$periodname0,$sales0,$expenses0<br/> $period1,$periodname1,$sales1,$expenses1<br/> $period2,$periodname2,$sales2,$expenses2<br/> $period3,$periodname3,$sales3,$expenses3<br/> $period4,$periodname4,$sales4,$expenses4<br/> $period5,$periodname5,$sales5,$expenses5<br/> EOF; */ $DataSet = new pData();