forked from timschofield/webERP-svn
/
StockAdjustmentsControlled.php
78 lines (65 loc) · 2.93 KB
/
StockAdjustmentsControlled.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
include('includes/DefineSerialItems.php');
include('includes/DefineStockAdjustment.php');
include('includes/session.php');
$Title = _('Adjusting Controlled Items');
/* Session started in header.php for password checking and authorisation level check */
include('includes/header.php');
if (empty($_GET['identifier'])) {
/*unique session identifier to ensure that there is no conflict with other stock adjustment sessions on the same machine */
$identifier=date('U');
} else {
$identifier=$_GET['identifier'];
}
if (!isset($_SESSION['Adjustment'.$identifier])) {
/* This page can only be called when a stock adjustment is pending */
echo '<div class="centre"><a href="' . $RootPath . '/StockAdjustments.php?NewAdjustment=Yes">' . _('Enter A Stock Adjustment'). '</a><br />';
prnMsg( _('This page can only be opened if a stock adjustment for a controlled item has been entered') . '<br />','error');
echo '</div>';
include('includes/footer.php');
exit;
}
if (isset($_SESSION['Adjustment'.$identifier])){
if (isset($_GET['AdjType']) and $_GET['AdjType']!=''){
$_SESSION['Adjustment'.$identifier]->AdjustmentType = $_GET['AdjType'];
}
}
/*Save some typing by referring to the line item class object in short form */
$LineItem = $_SESSION['Adjustment'.$identifier];
//Make sure this item is really controlled
if ( $LineItem->Controlled != 1 ){
echo '<a href="' . $RootPath . '/StockAdjustments.php?NewAdjustment=Yes">' . _('Enter A Stock Adjustment') . '</a>';
prnMsg('<br />' . _('Notice') . ' - ' . _('The adjusted item must be defined as controlled to require input of the batch numbers or serial numbers being adjusted'),'error');
include('includes/footer.php');
exit;
}
/***** get the page going now... *****/
echo '<div class="centre">';
echo '<br /><a href="'.$RootPath.'/StockAdjustments.php?identifier='.$identifier.'">' . _('Back to Adjustment Screen') . '</a>';
echo '<br /><b>' . _('Adjustment of controlled item').' ' . $LineItem->StockID . ' - ' . $LineItem->ItemDescription ;
/** vars needed by InputSerialItem : **/
$LocationOut = $_SESSION['Adjustment'.$identifier]->StockLocation;
$StockID = $LineItem->StockID;
if ($LineItem->AdjustmentType == 'ADD'){
echo '<br />' . _('Adding Items').'...';
$ItemMustExist = false;
$InOutModifier = 1;
$ShowExisting = false;
} elseif ($LineItem->AdjustmentType == 'REMOVE'){
echo '<br />' . _('Removing Items').'...';
$ItemMustExist = true;
$InOutModifier = -1;
$ShowExisting = true;
} else {
prnMsg( _('The Adjustment Type needs to be set') . '. ' . _('Please try again'). '.' );
include('includes/footer.php');
exit;
}
echo '</b></div>';
include ('includes/InputSerialItems.php');
/*TotalQuantity set inside this include file from the sum of the bundles
of the item selected for adjusting */
$_SESSION['Adjustment'.$identifier]->Quantity = $TotalQuantity;
/*Also a multi select box for adding bundles to the adjustment without keying, showing only when keying */
include('includes/footer.php');
?>