Changes in hotkeys system for tas support.
[fa-stable.git] / reporting / rep409.php
index 016580c1eb7d6e88136dc3e7148d8261ff067ee5..24d2cd82deb3f191c46e194677dbe268e85a4a5b 100644 (file)
@@ -9,12 +9,13 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
-$page_security = 2;
+$page_security = $_POST['PARAM_0'] == $_POST['PARAM_1'] ?
+       'SA_MANUFTRANSVIEW' : 'SA_MANUFBULKREP';
 // ----------------------------------------------------------------
 // $ Revision: 2.0 $
-// Creator:    Janusz Dobrwolski
+// Creator:    Janusz Dobrowolski
 // date_:      2008-01-14
-// Title:      Print Delivery Notes
+// Title:      Print Workorders
 // draft version!
 // ----------------------------------------------------------------
 $path_to_root="..";
@@ -32,7 +33,7 @@ print_workorders();
 
 function print_workorders()
 {
-       global $path_to_root;
+       global $path_to_root, $SysPrefs;
 
        include_once($path_to_root . "/reporting/includes/pdf_report.inc");
 
@@ -62,6 +63,7 @@ function print_workorders()
        if ($email == 0)
        {
                $rep = new FrontReport(_('WORK ORDER'), "WorkOrderBulk", user_pagesize());
+               $rep->SetHeaderType('Header2');
                $rep->currency = $cur;
                $rep->Font();
                $rep->Info($params, $cols, null, $aligns);
@@ -76,6 +78,7 @@ function print_workorders()
                if ($email == 1)
                {
                        $rep = new FrontReport("", "", user_pagesize());
+                       $rep->SetHeaderType('Header2');
                        $rep->currency = $cur;
                        $rep->Font();
                                $rep->title = _('WORK ORDER');
@@ -84,7 +87,8 @@ function print_workorders()
                }
                else
                        $rep->title = _('WORK ORDER');
-               $rep->Header2($myrow, null, null, '', 26);
+               $rep->SetCommonData($myrow, null, null, '', 26);
+               $rep->NewPage();
 
                $result = get_wo_requirements($i);
                $rep->TextCol(0, 5,_("Work Order Requirements"), -2);
@@ -102,7 +106,7 @@ function print_workorders()
                                $qoh = get_qoh_on_date($myrow2["stock_id"], $myrow2["loc_code"], $date_);
 
                        if ($show_qoh && ($myrow2["units_req"] * $myrow["units_issued"] > $qoh) &&
-                               !sys_prefs::allow_negative_stock())
+                               !$SysPrefs->allow_negative_stock())
                        {
                                // oops, we don't have enough of one of the component items
                                $has_marked = true;
@@ -125,12 +129,12 @@ function print_workorders()
                        $rep->AmountCol(6, 7,   $myrow2['units_issued'], $dec, -2);
                        $rep->NewLine(1);
                        if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
-                               $rep->Header2($myrow, null, null,'',26);
+                               $rep->NewPage();
                }
                $rep->NewLine(1);
                $rep->TextCol(0, 5," *** = "._("Insufficient stock"), -2);
 
-               $comments = get_comments(26, $i);
+               $comments = get_comments(ST_WORKORDER, $i);
                if ($comments && db_num_rows($comments))
                {
                        $rep->NewLine();