4 // ----------------------------------------------------------------
8 // Title: Bill Of Material
9 // ----------------------------------------------------------------
12 include_once($path_to_root . "includes/session.inc");
13 include_once($path_to_root . "includes/date_functions.inc");
14 include_once($path_to_root . "includes/data_checks.inc");
15 include_once($path_to_root . "gl/includes/gl_db.inc");
17 //----------------------------------------------------------------------------------------------------
19 // trial_inquiry_controls();
20 print_dimension_summary();
22 function getTransactions($from, $to)
27 WHERE reference >= '$from'
28 AND reference <= '$to'
32 return db_query($sql,"No transactions were returned");
38 $date = begin_fiscalyear($date);
41 $sql = "SELECT SUM(amount) AS Balance
44 WHERE (dimension_id = '$dim' OR dimension2_id = '$dim')
45 AND tran_date >= '$date'";
47 $TransResult = db_query($sql,"No transactions were returned");
48 if (db_num_rows($TransResult) == 1)
50 $DemandRow = db_fetch_row($TransResult);
51 $balance = $DemandRow[0];
59 //----------------------------------------------------------------------------------------------------
61 function print_dimension_summary()
65 include_once($path_to_root . "reporting/includes/pdf_report.inc");
67 $fromdim = $_POST['PARAM_0'];
68 $todim = $_POST['PARAM_1'];
69 $showbal = $_POST['PARAM_2'];
70 $comments = $_POST['PARAM_3'];
73 $cols = array(0, 50, 210, 250, 320, 395, 465, 515);
75 $headers = array(_('Reference'), _('Name'), _('Type'), _('Date'), _('Due Date'), _('Closed'), _('YTD'));
77 $aligns = array('left', 'left', 'left', 'left', 'left', 'left', 'right');
79 $params = array( 0 => $comments,
80 1 => array('text' => _('Dimension'), 'from' => $fromdim, 'to' => $todim));
82 $rep = new FrontReport(_('Dimension Summary'), "DimensionSummary.pdf", user_pagesize());
85 $rep->Info($params, $cols, $headers, $aligns);
88 $res = getTransactions($fromdim, $todim);
89 while ($trans=db_fetch($res))
91 $rep->TextCol(0, 1, $trans['reference']);
92 $rep->TextCol(1, 2, $trans['name']);
93 $rep->TextCol(2, 3, $trans['type_']);
94 $rep->TextCol(3, 4, $trans['date_']);
95 $rep->TextCol(4, 5, $trans['due_date']);
100 $rep->TextCol(5, 6, $str);
103 $balance = getYTD($trans['id']);
104 $rep->TextCol(6, 7, number_format2($balance, 0));
108 $rep->Line($rep->row);