}
+function print_gl_rows(&$rep, $result, $title)
+{
+ global $systypes_array;
+
+ $dec = user_price_dec();
+
+ if (db_num_rows($result))
+ {
+ $rep->Line($rep->row - 2);
+ $rep->NewLine();
+ $rep->Font('italic');
+ $rep->TextCol(3, 11, $title);
+ $rep->Font();
+ $rep->Line($rep->row - 2);
+ while($myrow = db_fetch($result)) {
+ $rep->NewLine();
+ $rep->TextCol(0, 2, $systypes_array[$myrow['type']] . ' ' . $myrow['type_no'], -2);
+ $rep->TextCol(2, 3, sql2date($myrow["tran_date"]), -2);
+ $rep->TextCol(3, 4, $myrow['account'], -2);
+ $rep->TextCol(4, 5, $myrow['account_name'], -2);
+ if ($myrow['amount'] > 0.0)
+ $rep->AmountCol(5, 6, $myrow['amount'], $dec);
+ else
+ $rep->AmountCol(6, 7, $myrow['amount'] * -1, $dec, -1);
+ $rep->TextCol(8, 11, $myrow['memo_']);
+ }
+ }
+}
+
//----------------------------------------------------------------------------------------------------
function print_work_order_listing()
$item = $_POST['PARAM_0'];
$location = $_POST['PARAM_1'];
$open_only = $_POST['PARAM_2'];
- $comments = $_POST['PARAM_3'];
- $orientation = $_POST['PARAM_4'];
- $destination = $_POST['PARAM_5'];
+ $show_gl = $_POST['PARAM_3'];
+ $comments = $_POST['PARAM_4'];
+ $orientation = $_POST['PARAM_5'];
+ $destination = $_POST['PARAM_6'];
if ($destination)
include_once($path_to_root . "/reporting/includes/excel_report.inc");
else
$loc = get_location_name($location);
$open = $open_only == 1 ? _('Yes') : _('No');
+ $show = $show_gl == 1 ? _('Yes') : _('No');
$cols = array(0, 100, 120, 165, 210, 275, 315, 375, 385, 440, 495, 555);
$headers = array(_('Type'), '#', ('Reference'), _('Location'), _('Item'), _('Required'), _('Manufactured'), ' ', _('Date'), _('Required By'), _('Closed'));
+ if ($show_gl)
+ {
+ $cols2 = $cols;
+ $headers2 = array(_("Transaction"), ' ', _("Date"), _("Account Code"),' ' . _("Account Name"), _("Debit"), _("Credit"), ' ', _("Memo"));
+ }
+ else
+ {
+ $cols2 = null;
+ $headers2 = null;
+ }
+
$aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right', 'left', 'left', 'left', 'left');
$params = array( 0 => $comments,
1 => array('text' => _('Items'), 'from' => $items, 'to' => ''),
2 => array('text' => _('Location'), 'from' => $loc, 'to' => ''),
- 3 => array('text' => _('Open Only'), 'from' => $open, 'to' => ''));
+ 3 => array('text' => _('Open Only'), 'from' => $open, 'to' => ''),
+ 4 => array('text' => _('Show GL Rows'), 'from' => $show, 'to' => ''),
+ );
$rep = new FrontReport(_('Work Order Listing'), "WorkOrderListing", user_pagesize(), 9, $orientation);
if ($orientation == 'L')
recalculate_cols($cols);
$rep->Font();
- $rep->Info($params, $cols, $headers, $aligns);
+ if ($show_gl)
+ $rep->Info($params, $cols2, $headers2, $aligns, $cols, $headers);
+ else
+ $rep->Info($params, $cols, $headers, $aligns);
$rep->NewPage();
$res = getTransactions($item, $open_only, $location);
$rep->TextCol(8, 9, sql2date($trans['date_']), -1);
$rep->TextCol(9, 10, sql2date($trans['required_by']), -1);
$rep->TextCol(10, 11, $trans['closed'] ? ' ' : _('No'), -1);
+ if ($show_gl)
+ {
+ $rep->NewLine();
+ $productions = get_gl_wo_productions($trans['id'], true);
+ print_gl_rows($rep, $productions, _("Finished Product Requirements"));
+
+ $issues = get_gl_wo_issue_trans($trans['id'], -1, true);
+ print_gl_rows($rep, $issues, _("Additional Material Issues"));
+
+ $costs = get_gl_wo_cost_trans($trans['id'], -1, true);
+ print_gl_rows($rep, $costs, _("Additional Costs"));
+
+ $wo = get_gl_trans(ST_WORKORDER, $trans['id']);
+ print_gl_rows($rep, $wo, _("Finished Product Receival"));
+ $rep->Line($rep->row - 2);
+ $rep->NewLine();
+ }
$rep->NewLine();
}
$rep->Line($rep->row);