From: Joe Hunt Date: Mon, 4 Jun 2018 08:32:53 +0000 (+0200) Subject: Changed Report Workorder Listing to include an option for listing GL rows. X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=98bf5bfc72317d45e356e3909a8cd1fdf5181176 Changed Report Workorder Listing to include an option for listing GL rows. --- diff --git a/reporting/rep402.php b/reporting/rep402.php index a18089e6..00f486d6 100644 --- a/reporting/rep402.php +++ b/reporting/rep402.php @@ -64,6 +64,35 @@ function getTransactions($items, $open_only, $location) } +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() @@ -73,9 +102,10 @@ 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 @@ -97,24 +127,41 @@ function print_work_order_listing() $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); @@ -132,6 +179,23 @@ function print_work_order_listing() $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); diff --git a/reporting/reports_main.php b/reporting/reports_main.php index 6e766691..84bfb44f 100644 --- a/reporting/reports_main.php +++ b/reporting/reports_main.php @@ -303,6 +303,7 @@ if (get_company_pref('use_manufacturing')) array( _('Items') => 'ITEMS_ALL', _('Location') => 'LOCATIONS', _('Outstanding Only') => 'YES_NO', + _('Show GL Rows') => 'YES_NO', _('Comments') => 'TEXTBOX', _('Orientation') => 'ORIENTATION', _('Destination') => 'DESTINATION'));