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