-
Notifications
You must be signed in to change notification settings - Fork 1
/
FixedAssetTransfer.php
executable file
·166 lines (138 loc) · 6.19 KB
/
FixedAssetTransfer.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?php
include('includes/session.inc');
$title = _('Change Asset Location');
include('includes/header.inc');
foreach ($_POST as $AssetToMove => $Value) { //Value is not used?
if (mb_substr($AssetToMove,0,4)=='Move') { // the form variable is of the format MoveAssetID so need to strip the move bit off
$AssetID=mb_substr($AssetToMove,4);
$sql="UPDATE fixedassets
SET assetlocation='".$_POST['Location'.$AssetID] ."'
WHERE assetid='". $AssetID . "'";
$result=DB_query($sql, $db);
}
}
if (isset($_GET['AssetID'])) {
$AssetID=$_GET['AssetID'];
} else if (isset($_POST['AssetID'])) {
$AssetID=$_POST['AssetID'];
} else {
$sql="SELECT categoryid, categorydescription FROM fixedassetcategories";
$result=DB_query($sql, $db);
echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . '</p>';
echo '<table class="selection">
<tr>
<td>'. _('In Asset Category') . ':
<select name="AssetCat">';
if (!isset($_POST['AssetCat'])) {
$_POST['AssetCat'] = '';
}
while ($myrow = DB_fetch_array($result)) {
if ($myrow['categoryid'] == $_POST['AssetCat']) {
echo '<option selected="True" value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>';
} else {
echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>';
}
}
echo '</select>';
echo '<td>'. _('Enter partial') . '<b> ' . _('Description') . '</b>:</td>';
if (isset($_POST['Keywords'])) {
echo '<td><input type="text" name="Keywords" value="' . trim($_POST['Keywords'],'%') . '" size="20" maxlength="25" /></td></tr>';
} else {
echo '<td><input type="text" name="Keywords" size="20" maxlength="25" /></td></tr>';
}
echo '<tr><td></td>';
echo '<td><font size="3"><b>' . _('OR').' ' . '</b></font>' . _('Enter partial') .' <b>'. _('Asset Code') . '</b>:</td>';
echo '<td>';
if (isset($_POST['AssetID'])) {
echo '<input type="text" name="AssetID" value="'. trim($_POST['AssetID'],'%') . '" size="15" maxlength="18" />';
} else {
echo '<input type="text" name="AssetID" size="15" maxlength="18" />';
}
echo '</td></tr>';
echo '<tr><td></td>';
echo '<td><font size="3"><b>' . _('OR').' ' . '</b></font>' . _('Enter partial') .' <b>'. _('Serial Number') . '</b>:</td>';
echo '<td>';
if (isset($_POST['AssetID'])) {
echo '<input type="text" name="SerialNumber" value="'. trim($_POST['SerialNumber'],'%') . '" size="15" maxlength="18" />';
} else {
echo '<input type="text" name="SerialNumber" size="15" maxlength="18" />';
}
echo '</td></tr>';
echo '</table><br />';
echo '<div class="centre"><button type="submit" name="Search">'. _('Search Now') . '</button></div></form><br />';
}
if (isset($_POST['Search'])) {
if ($_POST['AssetCat']=='All') {
$_POST['AssetCat']='%';
}
if (isset($_POST['Keywords'])) {
$_POST['Keywords']='%'.$_POST['Keywords'].'%';
} else {
$_POST['Keywords']='%';
}
if (isset($_POST['AssetID'])) {
$_POST['AssetID']='%'.$_POST['AssetID'].'%';
} else {
$_POST['AssetID']='%';
}
$sql= "SELECT fixedassets.assetid,
fixedassets.cost,
fixedassets.accumdepn,
fixedassets.description,
fixedassets.depntype,
fixedassets.serialno,
fixedassets.barcode,
fixedassets.assetlocation,
fixedassetlocations.locationdescription
FROM fixedassets
INNER JOIN fixedassetlocations
ON fixedassets.assetlocation=fixedassetlocations.locationid
WHERE fixedassets.assetcategoryid " . LIKE . "'".$_POST['AssetCat']."'
AND fixedassets.description " . LIKE . "'".$_POST['Keywords']."'
AND fixedassets.assetid " . LIKE . "'".$_POST['AssetID']."'
AND fixedassets.serialno " . LIKE . "'".$_POST['SerialNumber']."'";
$Result=DB_query($sql, $db);
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . '</p>';
echo '<form action="'. htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post"><table class="selection">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<tr><th>'._('Asset ID') . '</th>
<th>' . _('Description') . '</th>
<th>' . _('Serial number') . '</th>
<th>' . _('Purchase Cost') . '</th>
<th>' . _('Total Depreciation') . '</th>
<th>' . _('Current Location') . '</th>
<th>' . _('Move To :') . '</th>
</tr>';
$locationsql="SELECT locationid, locationdescription from fixedassetlocations";
$LocationResult=DB_query($locationsql, $db);
while ($myrow=DB_fetch_array($Result)) {
echo '<tr><td>'.$myrow['assetid'].'</td>
<td>'.$myrow['description'].'</td>
<td>'.$myrow['serialno'].'</td>
<td class="number">'.locale_money_format($myrow['cost'],$_SESSION['CompanyRecord']['currencydefault']).'</td>
<td class="number">'.locale_money_format($myrow['accumdepn'],$_SESSION['CompanyRecord']['currencydefault']).'</td>
<td>'.$myrow['locationdescription'].'</td>';
echo '<td><select name="Location'.$myrow['assetid'].'" onChange="ReloadForm(Move'.$myrow['assetid'].')">';
echo '<option value=""></option>';
while ($LocationRow=DB_fetch_array($LocationResult)) {
if ($LocationRow['locationid']==$myrow['location']) {
echo '<option selected="True" value="'.$LocationRow['locationid'].'">'.$LocationRow['locationdescription'] . '</option>';
} else {
echo '<option value="'.$LocationRow['locationid'].'">'.$LocationRow['locationdescription'].'</option>';
}
}
DB_data_seek($LocationResult,0);
echo '</select></td>';
echo '<input type="hidden" name="AssetCat" value="' . $_POST['AssetCat'].'" />';
echo '<input type="hidden" name="Keywords" value="' . $_POST['Keywords'].'" />';
echo '<input type="hidden" name="AssetID" value="' . $_POST['AssetID'].'" />';
echo '<input type="hidden" name="Search" value="' . $_POST['Search'].'" />';
echo '<td><button type="submit" name="Move'.$myrow['assetid'].'">' . _('Move') . '</button></td>';
echo '</tr>';
}
echo '</table></form>';
}
include('includes/footer.inc');
?>