Changed the Quantity routines to use the Item Units decimals if any. A lot of files.
[fa-stable.git] / manufacturing / view / wo_issue_view.php
1 <?php
2
3 $page_security = 10;
4 $path_to_root="../..";
5 include_once($path_to_root . "/includes/session.inc");
6
7 $js = "";
8 if ($use_popup_windows)
9         $js .= get_js_open_window(900, 500);
10 page(_("View Work Order Issue"), true, false, "", $js);
11
12 include_once($path_to_root . "/includes/date_functions.inc");
13 include_once($path_to_root . "/includes/manufacturing.inc");
14 include_once($path_to_root . "/includes/data_checks.inc");
15
16 include_once($path_to_root . "/manufacturing/includes/manufacturing_db.inc");
17 include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc");
18
19 //-------------------------------------------------------------------------------------------------
20
21 if ($_GET['trans_no'] != "")
22 {
23         $wo_issue_no = $_GET['trans_no'];
24 }
25
26 //-------------------------------------------------------------------------------------------------
27
28 function display_wo_issue($issue_no)
29 {
30         global $table_style;
31
32     $myrow = get_work_order_issue($issue_no);
33
34     start_table($table_style);
35     $th = array(_("Issue #"), _("Reference"), _("For Work Order #"),
36         _("Item"), _("From Location"), _("To Work Centre"), _("Date of Issue"));
37     table_header($th);
38
39         start_row();
40         label_cell($myrow["issue_no"]);
41         label_cell($myrow["reference"]);
42         label_cell(get_trans_view_str(systypes::work_order(),$myrow["workorder_id"]));
43         label_cell($myrow["stock_id"] . " - " . $myrow["description"]);
44         label_cell($myrow["location_name"]);
45         label_cell($myrow["WorkCentreName"]);
46         label_cell(sql2date($myrow["issue_date"]));
47         end_row();
48
49     comments_display_row(28, $issue_no);
50
51         end_table(1);
52
53         is_voided_display(28, $issue_no, _("This issue has been voided."));
54 }
55
56 //-------------------------------------------------------------------------------------------------
57
58 function display_wo_issue_details($issue_no)
59 {
60         global $table_style;
61
62     $result = get_work_order_issue_details($issue_no);
63
64     if (db_num_rows($result) == 0)
65     {
66         display_note(_("There are no items for this issue."));
67     }
68     else
69     {
70         start_table($table_style);
71         $th = array(_("Component"), _("Quantity"), _("Units"));
72
73         table_header($th);
74
75         $j = 1;
76         $k = 0; //row colour counter
77
78         $total_cost = 0;
79
80         while ($myrow = db_fetch($result))
81         {
82
83                         alt_table_row_color($k);
84
85                 label_cell($myrow["stock_id"]  . " - " . $myrow["description"]);
86             qty_cell($myrow["qty_issued"], false, get_qty_dec($myrow["stock_id"]));
87                         label_cell($myrow["units"]);
88                         end_row();;
89
90                 $j++;
91                 If ($j == 12)
92                 {
93                         $j = 1;
94                         table_header($th);
95                 }//end of page full new headings if
96                 }//end of while
97
98                 end_table();
99     }
100 }
101
102 //-------------------------------------------------------------------------------------------------
103
104 display_heading(systypes::name(28) . " # " . $wo_issue_no);
105
106 display_wo_issue($wo_issue_no);
107
108 display_heading2(_("Items for this Issue"));
109
110 display_wo_issue_details($wo_issue_no);
111
112 //-------------------------------------------------------------------------------------------------
113
114 echo "<br>";
115
116 end_page(true);
117
118 ?>
119