Changed license type to GPLv3 in top of files
[fa-stable.git] / manufacturing / view / wo_issue_view.php
1 <?php
2 /**********************************************************************
3     Copyright (C) FrontAccounting, LLC.
4         Released under the terms of the GNU General Public License, GPL, 
5         as published by the Free Software Foundation, either version 3 
6         of the License, or (at your option) any later version.
7     This program is distributed in the hope that it will be useful,
8     but WITHOUT ANY WARRANTY; without even the implied warranty of
9     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
10     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 $page_security = 10;
13 $path_to_root="../..";
14 include_once($path_to_root . "/includes/session.inc");
15
16 $js = "";
17 if ($use_popup_windows)
18         $js .= get_js_open_window(900, 500);
19 page(_("View Work Order Issue"), true, false, "", $js);
20
21 include_once($path_to_root . "/includes/date_functions.inc");
22 include_once($path_to_root . "/includes/manufacturing.inc");
23 include_once($path_to_root . "/includes/data_checks.inc");
24
25 include_once($path_to_root . "/manufacturing/includes/manufacturing_db.inc");
26 include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc");
27
28 //-------------------------------------------------------------------------------------------------
29
30 if ($_GET['trans_no'] != "")
31 {
32         $wo_issue_no = $_GET['trans_no'];
33 }
34
35 //-------------------------------------------------------------------------------------------------
36
37 function display_wo_issue($issue_no)
38 {
39         global $table_style;
40
41     $myrow = get_work_order_issue($issue_no);
42
43         br(1);
44     start_table($table_style);
45     $th = array(_("Issue #"), _("Reference"), _("For Work Order #"),
46         _("Item"), _("From Location"), _("To Work Centre"), _("Date of Issue"));
47     table_header($th);
48
49         start_row();
50         label_cell($myrow["issue_no"]);
51         label_cell($myrow["reference"]);
52         label_cell(get_trans_view_str(systypes::work_order(),$myrow["workorder_id"]));
53         label_cell($myrow["stock_id"] . " - " . $myrow["description"]);
54         label_cell($myrow["location_name"]);
55         label_cell($myrow["WorkCentreName"]);
56         label_cell(sql2date($myrow["issue_date"]));
57         end_row();
58
59     comments_display_row(28, $issue_no);
60
61         end_table(1);
62
63         is_voided_display(28, $issue_no, _("This issue has been voided."));
64 }
65
66 //-------------------------------------------------------------------------------------------------
67
68 function display_wo_issue_details($issue_no)
69 {
70         global $table_style;
71
72     $result = get_work_order_issue_details($issue_no);
73
74     if (db_num_rows($result) == 0)
75     {
76         display_note(_("There are no items for this issue."));
77     }
78     else
79     {
80         start_table($table_style);
81         $th = array(_("Component"), _("Quantity"), _("Units"));
82
83         table_header($th);
84
85         $j = 1;
86         $k = 0; //row colour counter
87
88         $total_cost = 0;
89
90         while ($myrow = db_fetch($result))
91         {
92
93                         alt_table_row_color($k);
94
95                 label_cell($myrow["stock_id"]  . " - " . $myrow["description"]);
96             qty_cell($myrow["qty_issued"], false, get_qty_dec($myrow["stock_id"]));
97                         label_cell($myrow["units"]);
98                         end_row();;
99
100                 $j++;
101                 If ($j == 12)
102                 {
103                         $j = 1;
104                         table_header($th);
105                 }//end of page full new headings if
106                 }//end of while
107
108                 end_table();
109     }
110 }
111
112 //-------------------------------------------------------------------------------------------------
113
114 display_heading(systypes::name(28) . " # " . $wo_issue_no);
115
116 display_wo_issue($wo_issue_no);
117
118 display_heading2(_("Items for this Issue"));
119
120 display_wo_issue_details($wo_issue_no);
121
122 //-------------------------------------------------------------------------------------------------
123
124 echo "<br>";
125
126 end_page(true);
127
128 ?>
129