2 require_once 'Pman/Xtuple/Reports/Base.php';
4 class Pman_Xtuple_Reports_StockAtLocation extends Pman_Xtuple_Reports_Base
12 //if (preg_match('/sg.php$/', $this->baseURL)) {
16 $sy = strtotime(date('Y') . $sdate) > time() ? date('Y') : (date('Y')+1);
18 $q = DB_DataObject::factory('location');
20 //DB_DataObject::DebugLevel(1);
24 $q->selectAdd('location_name, location_descrip');
25 $cols = array('location_name', 'location_descrip');
27 for ($y = 2008; $y < $sy + 1; $y++) {
31 invdetail_location_atdate('$dt'::date + INTERVAL '1 DAY', location_id, 1)
32 as qty_on_hand_eofy_$y,
33 invdetail_location_atdate('$dt'::date + INTERVAL '1 DAY', location_id , -1)
34 as qty_negative_eofy_$y
37 $cols[] = "qty_negative_eofy_$y";
38 $cols[] = "qty_on_hand_eofy_$y";
41 $q->orderBy('location_name ASC');
42 //$date_from = date('Y-m-d', strtotime($_REQUEST['date_from']));
43 //$date_to = date('Y-m-d', strtotime($_REQUEST['date_to']));
44 //DB_DataObject::debugLevel(1);
49 $this->toCsv($q, $cols);