- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / weberp / StockLocTransferReceive.php
blobdd46a569f97345453c6bd974e4c94a7e906f8ccb
1 <?php
3 include('includes/DefineSerialItems.php');
4 include('includes/DefineStockTransfers.php');
6 $PageSecurity = 11;
8 include('includes/session.inc');
9 $title = _('Inventory Transfer') . ' - ' . _('Receiving');
10 include('includes/header.inc');
11 include('includes/SQL_CommonFunctions.inc');
13 if (isset($_GET['NewTransfer'])){
14 unset($_SESSION['Transfer']);
16 if ( $_SESSION['Transfer']->TrfID == ''){
17 unset($_SESSION['Transfer']);
21 if(isset($_POST['ProcessTransfer'])){
22 /*Ok Time To Post transactions to Inventory Transfers, and Update Posted variable & received Qty's to LocTransfers */
24 $PeriodNo = GetPeriod ($_SESSION['Transfer']->TranDate, $db);
25 $SQLTransferDate = FormatDateForSQL($_SESSION['Transfer']->TranDate);
27 $InputError = False; /*Start off hoping for the best */
28 $i=0;
29 $TotalQuantity = 0;
30 foreach ($_SESSION['Transfer']->TransferItem AS $TrfLine) {
31 if (is_numeric($_POST['Qty' . $i])){
32 /*Update the quantity received from the inputs */
33 $_SESSION['Transfer']->TransferItem[$i]->Quantity= $_POST['Qty' . $i];
34 } else {
35 prnMsg(_('The quantity entered for'). ' ' . $TrfLine->StockID . ' '. _('is not numeric') . '. ' . _('All quantities must be numeric'),'error');
36 $InputError = True;
38 if ($_POST['Qty' . $i]<0){
39 prnMsg(_('The quantity entered for'). ' ' . $TrfLine->StockID . ' '. _('is negative') . '. ' . _('All quantities must be for positive numbers greater than zero'),'error');
40 $InputError = True;
42 if ($TrfLine->PrevRecvQty + $TrfLine->Quantity > $TrfLine->ShipQty){
43 prnMsg( _('The Quantity entered plus the Quantity Previously Received can not be greater than the Total Quantity shipped for').' '. $TrfLine->StockID , 'error');
44 $InputError = True;
46 if ($_POST['CancelBalance' . $i]==1){
47 $_SESSION['Transfer']->TransferItem[$i]->CancelBalance=1;
48 } else {
49 $_SESSION['Transfer']->TransferItem[$i]->CancelBalance=0;
51 $TotalQuantity += $TrfLine->Quantity;
52 $i++;
53 } /*end loop to validate and update the SESSION['Transfer'] data */
54 if ($TotalQuantity <= 0){
55 prnMsg( _('All quantities entered are less than or equal to zero') . '. ' . _('Please correct that and try again'), 'error' );
56 $InputError = True;
58 //exit;
59 if (!$InputError){
60 /*All inputs must be sensible so make the stock movement records and update the locations stocks */
62 foreach ($_SESSION['Transfer']->TransferItem AS $TrfLine) {
63 if ($TrfLine->Quantity >0){
64 $Result = DB_query('BEGIN',$db, _('Could not initiate a transaction') . ' - ' . _('perhaps the database does not support transactions') );
66 /* Need to get the current location quantity will need it later for the stock movement */
67 $SQL="SELECT locstock.quantity
68 FROM locstock
69 WHERE locstock.stockid='" . $TrfLine->StockID . "'
70 AND loccode= '" . $_SESSION['Transfer']->StockLocationFrom . "'";
72 $Result = DB_query($SQL, $db, _('Could not retrieve the stock quantity at the dispatch stock location prior to this transfer being processed') );
73 if (DB_num_rows($Result)==1){
74 $LocQtyRow = DB_fetch_row($Result);
75 $QtyOnHandPrior = $LocQtyRow[0];
76 } else {
77 /* There must actually be some error this should never happen */
78 $QtyOnHandPrior = 0;
81 /* Insert the stock movement for the stock going out of the from location */
82 $SQL = "INSERT INTO stockmoves (
83 stockid,
84 type,
85 transno,
86 loccode,
87 trandate,
88 prd,
89 reference,
90 qty,
91 newqoh)
92 VALUES (
93 '" . $TrfLine->StockID . "',
94 16,
95 " . $_SESSION['Transfer']->TrfID . ",
96 '" . $_SESSION['Transfer']->StockLocationFrom . "',
97 '" . $SQLTransferDate . "',
98 " . $PeriodNo . ",
99 '" . _('To') . ' ' . $_SESSION['Transfer']->StockLocationToName . "',
100 " . -$TrfLine->Quantity . ",
101 " . ($QtyOnHandPrior - $TrfLine->Quantity) . "
104 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record cannot be inserted because');
105 $DbgMsg = _('The following SQL to insert the stock movement record was used');
106 $Result = DB_query($SQL,$db,$ErrMsg, $DbgMsg, true);
108 /*Get the ID of the StockMove... */
109 $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno');
111 /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/
113 if ($TrfLine->Controlled ==1){
114 foreach($TrfLine->SerialItems as $Item){
115 /*We need to add or update the StockSerialItem record and
116 The StockSerialMoves as well */
118 /*First need to check if the serial items already exists or not in the location from */
119 $SQL = "SELECT COUNT(*)
120 FROM stockserialitems
121 WHERE
122 stockid='" . $TrfLine->StockID . "'
123 AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "'
124 AND serialno='" . $Item->BundleRef . "'";
126 $Result = DB_query($SQL,$db,'<BR>' . _('Could not determine if the serial item exists') );
127 $SerialItemExistsRow = DB_fetch_row($Result);
129 if ($SerialItemExistsRow[0]==1){
131 $SQL = "UPDATE stockserialitems SET
132 quantity= quantity - " . $Item->BundleQty . "
133 WHERE
134 stockid='" . $TrfLine->StockID . "'
135 AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "'
136 AND serialno='" . $Item->BundleRef . "'";
138 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be updated because');
139 $DbgMsg = _('The following SQL to update the serial stock item record was used');
140 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
141 } else {
142 /*Need to insert a new serial item record */
143 $SQL = "INSERT INTO stockserialitems (stockid,
144 loccode,
145 serialno,
146 quantity)
147 VALUES ('" . $TrfLine->StockID . "',
148 '" . $_SESSION['Transfer']->StockLocationFrom . "',
149 '" . $Item->BundleRef . "',
150 " . -$Item->BundleQty . ")";
152 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item for the stock being transferred out of the existing location could not be inserted because');
153 $DbgMsg = _('The following SQL to update the serial stock item record was used');
154 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
158 /* now insert the serial stock movement */
160 $SQL = "INSERT INTO stockserialmoves (
161 stockmoveno,
162 stockid,
163 serialno,
164 moveqty
165 ) VALUES (
166 " . $StkMoveNo . ",
167 '" . $TrfLine->StockID . "',
168 '" . $Item->BundleRef . "',
169 " . -$Item->BundleQty . "
171 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because');
172 $DbgMsg = _('The following SQL to insert the serial stock movement records was used');
173 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
175 }/* foreach controlled item in the serialitems array */
176 } /*end if the transferred item is a controlled item */
179 /* Need to get the current location quantity will need it later for the stock movement */
180 $SQL="SELECT locstock.quantity
181 FROM locstock
182 WHERE locstock.stockid='" . $TrfLine->StockID . "'
183 AND loccode= '" . $_SESSION['Transfer']->StockLocationTo . "'";
185 $Result = DB_query($SQL, $db, _('Could not retrieve the quantity on hand at the location being transferred to') );
186 if (DB_num_rows($Result)==1){
187 $LocQtyRow = DB_fetch_row($Result);
188 $QtyOnHandPrior = $LocQtyRow[0];
189 } else {
190 // There must actually be some error this should never happen
191 $QtyOnHandPrior = 0;
194 // Insert the stock movement for the stock coming into the to location
195 $SQL = "INSERT INTO stockmoves (
196 stockid,
197 type,
198 transno,
199 loccode,
200 trandate,
201 prd,
202 reference,
203 qty,
204 newqoh)
205 VALUES (
206 '" . $TrfLine->StockID . "',
208 " . $_SESSION['Transfer']->TrfID . ",
209 '" . $_SESSION['Transfer']->StockLocationTo . "',
210 '" . $SQLTransferDate . "'," . $PeriodNo . ",
211 '" . _('From') . ' ' . $_SESSION['Transfer']->StockLocationFromName ."',
212 " . $TrfLine->Quantity . ", " . ($QtyOnHandPrior + $TrfLine->Quantity) . "
215 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record for the incoming stock cannot be added because');
216 $DbgMsg = _('The following SQL to insert the stock movement record was used');
217 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
220 /*Get the ID of the StockMove... */
221 $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno');
223 /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/
225 if ($TrfLine->Controlled ==1){
226 foreach($TrfLine->SerialItems as $Item){
227 /*We need to add or update the StockSerialItem record and
228 The StockSerialMoves as well */
230 /*First need to check if the serial items already exists or not in the location from */
231 $SQL = "SELECT COUNT(*)
232 FROM stockserialitems
233 WHERE
234 stockid='" . $TrfLine->StockID . "'
235 AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "'
236 AND serialno='" . $Item->BundleRef . "'";
238 $Result = DB_query($SQL,$db,'<BR>'. _('Could not determine if the serial item exists') );
239 $SerialItemExistsRow = DB_fetch_row($Result);
242 if ($SerialItemExistsRow[0]==1){
244 $SQL = "UPDATE stockserialitems SET
245 quantity= quantity + " . $Item->BundleQty . "
246 WHERE
247 stockid='" . $TrfLine->StockID . "'
248 AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "'
249 AND serialno='" . $Item->BundleRef . "'";
251 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be updated for the quantity coming in because');
252 $DbgMsg = _('The following SQL to update the serial stock item record was used');
253 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
254 } else {
255 /*Need to insert a new serial item record */
256 $SQL = "INSERT INTO stockserialitems (stockid,
257 loccode,
258 serialno,
259 quantity)
260 VALUES ('" . $TrfLine->StockID . "',
261 '" . $_SESSION['Transfer']->StockLocationTo . "',
262 '" . $Item->BundleRef . "',
263 " . $Item->BundleQty . ")";
265 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record for the stock coming in could not be added because');
266 $DbgMsg = _('The following SQL to update the serial stock item record was used');
267 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
271 /* now insert the serial stock movement */
273 $SQL = "INSERT INTO stockserialmoves (stockmoveno,
274 stockid,
275 serialno,
276 moveqty)
277 VALUES (" . $StkMoveNo . ",
278 '" . $TrfLine->StockID . "',
279 '" . $Item->BundleRef . "',
280 " . $Item->BundleQty . ")";
281 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because');
282 $DbgMsg = _('The following SQL to insert the serial stock movement records was used');
283 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
285 }/* foreach controlled item in the serialitems array */
286 } /*end if the transfer item is a controlled item */
288 $SQL = "UPDATE locstock
289 SET quantity = quantity - " . $TrfLine->Quantity . "
290 WHERE stockid='" . $TrfLine->StockID . "'
291 AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "'";
293 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The location stock record could not be updated because');
294 $DbgMsg = _('The following SQL to update the stock record was used');
295 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
297 $SQL = "UPDATE locstock
298 SET quantity = quantity + " . $TrfLine->Quantity . "
299 WHERE stockid='" . $TrfLine->StockID . "'
300 AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "'";
302 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The location stock record could not be updated because');
303 $DbgMsg = _('The following SQL to update the stock record was used');
304 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
306 prnMsg(_('A stock transfer for item code'). ' - ' . $TrfLine->StockID . ' ' . $TrfLine->ItemDescription . ' '. _('has been created from').' ' . $_SESSION['Transfer']->StockLocationFromName . ' '. _('to'). ' ' . $_SESSION['Transfer']->StockLocationToName . ' ' . _('for a quantity of'). ' '. $TrfLine->Quantity,'success');
308 if ($TrfLine->CancelBalance==1){
309 $sql = "UPDATE loctransfers SET recqty = recqty + ". $TrfLine->Quantity . ",
310 shipqty = recqty + ". $TrfLine->Quantity . ",
311 recdate = '".date('Y-m-d H:i:s'). "'
312 WHERE reference = '". $_SESSION['Transfer']->TrfID . "'
313 AND stockid = '". $TrfLine->StockID."'";
314 } else {
315 $sql = "UPDATE loctransfers SET recqty = recqty + ". $TrfLine->Quantity . ",
316 recdate = '".date('Y-m-d H:i:s'). "'
317 WHERE reference = '". $_SESSION['Transfer']->TrfID . "'
318 AND stockid = '". $TrfLine->StockID."'";
320 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('Unable to update the Location Transfer Record');
321 $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg, true);
322 unset ($_SESSION['Transfer']->LineItem[$i]);
323 unset ($_POST['Qty' . $i]);
324 } /*end if Quantity > 0 */
325 if ($TrfLine->CancelBalance==1){
326 $sql = "UPDATE loctransfers SET shipqty = recqty
327 WHERE reference = '". $_SESSION['Transfer']->TrfID . "'
328 AND stockid = '". $TrfLine->StockID."'";
329 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('Unable to set the quantity received to the quantity shipped to cancel the balance on this transfer line');
330 $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg, true);
332 $i++;
333 } /*end of foreach TransferItem */
335 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Unable to COMMIT the Stock Transfer transaction');
336 DB_query('COMMIT', $db, $ErrMsg);
338 unset($_SESSION['Transfer']->LineItem);
339 unset($_SESSION['Transfer']);
340 } /* end of if no input errors */
342 } /*end of PRocess Transfer */
344 if(isset($_GET['Trf_ID'])){
346 unset($_SESSION['Transfer']);
348 $sql = "SELECT loctransfers.stockid,
349 stockmaster.description,
350 stockmaster.units,
351 stockmaster.controlled,
352 stockmaster.serialised,
353 stockmaster.decimalplaces,
354 loctransfers.shipqty,
355 loctransfers.recqty,
356 locations.locationname as shiplocationname,
357 reclocations.locationname as reclocationname,
358 loctransfers.shiploc,
359 loctransfers.recloc
360 FROM loctransfers INNER JOIN locations
361 ON loctransfers.shiploc=locations.loccode
362 INNER JOIN locations as reclocations
363 ON loctransfers.recloc = reclocations.loccode
364 INNER JOIN stockmaster
365 ON loctransfers.stockid=stockmaster.stockid
366 WHERE reference =" . $_GET['Trf_ID'] . " ORDER BY loctransfers.stockid";
369 $ErrMsg = _('The details of transfer number') . ' ' . $Trf_ID . ' ' . _('could not be retrieved because') .' ';
370 $DbgMsg = _('The SQL to retrieve the transfer was');
371 $result = DB_query($sql,$db,$ErrMsg,$DbgMsg);
373 if(DB_num_rows($result) == 0){
374 echo '</table></form><H3>' . _('Transfer') . ' #' . $Trf_ID . ' '. _('Does Not Exist') . '</H3><HR>';
375 include('includes/footer.inc');
376 exit;
379 $myrow=DB_fetch_array($result);
381 $_SESSION['Transfer']= new StockTransfer($_GET['Trf_ID'],
382 $myrow['shiploc'],
383 $myrow['shiplocationname'],
384 $myrow['recloc'],
385 $myrow['reclocationname'],
386 Date($_SESSION['DefaultDateFormat'])
388 /*Populate the StockTransfer TransferItem s array with the lines to be transferred */
389 $i = 0;
390 do {
391 $_SESSION['Transfer']->TransferItem[$i]= new LineItem ($myrow['stockid'],
392 $myrow['description'],
393 $myrow['shipqty'],
394 $myrow['units'],
395 $myrow['controlled'],
396 $myrow['serialised'],
397 $myrow['decimalplaces']
399 $_SESSION['Transfer']->TransferItem[$i]->PrevRecvQty = $myrow['recqty'];
400 $_SESSION['Transfer']->TransferItem[$i]->Quantity = $myrow['shipqty']-$myrow['recqty'];
402 $i++; /*numerical index for the TransferItem[] array of LineItem s */
404 } while ($myrow=DB_fetch_array($result));
406 } /* $_GET['Trf_ID'] is set */
408 if (isset($_SESSION['Transfer'])){
409 //Begin Form for receiving shipment
410 echo '<HR><FORM ACTION="' . $_SERVER['PHP_SELF'] . '?'. SID . '" METHOD=POST>';
411 echo '<a href="'.$_SERVER['PHP_SELF']. '?' . SID . '&NewTransfer=true">'. _('Select A Different Transfer').'</a>';
412 echo '<H2>' . _('Location Transfer Reference'). ' #' . $_SESSION['Transfer']->TrfID . ' '. _('from').' ' . $_SESSION['Transfer']->StockLocationFromName . ' '. _('to'). ' ' . $_SESSION['Transfer']->StockLocationToName . '</H2>';
414 prnMsg(_('Please Verify Shipment Quantities Receivied'),'info');
416 $i = 0; //Line Item Array pointer
418 echo "<CENTER><TABLE BORDER=1>";
420 $tableheader = '<TR>
421 <TD class="tableheader">'. _('Item Code') . '</TD>
422 <TD class="tableheader">'. _('Item Description'). '</TD>
423 <TD class="tableheader">'. _('Quantity Dispatched'). '</TD>
424 <TD class="tableheader">'. _('Quantity Received'). '</TD>
425 <TD class="tableheader">'. _('Quantity To Receive'). '</TD>
426 <TD class="tableheader">'. _('Units'). '</TD>
427 <TD class="tableheader">'. _('Cancel Balance') . '</TD>
428 </TR>';
430 echo $tableheader;
432 foreach ($_SESSION['Transfer']->TransferItem AS $TrfLine) {
434 echo '<TR>
435 <td>' . $TrfLine->StockID . '</td>
436 <td>' . $TrfLine->ItemDescription . '</td>';
438 echo '<td ALIGN=RIGHT>' . number_format($TrfLine->ShipQty, $TrfLine->DecimalPlaces) . '</TD>';
439 if (is_numeric($_POST['Qty' . $i])){
440 $_SESSION['Transfer']->TransferItem[$i]->Quantity= $_POST['Qty' . $i];
441 $Qty = $_POST['Qty' . $i];
442 } else {
443 $Qty = $TrfLine->Quantity;
445 echo '<td ALIGN=RIGHT>' . number_format($TrfLine->PrevRecvQty, $TrfLine->DecimalPlaces) . '</TD>';
447 if ($TrfLine->Controlled==1){
448 echo '<TD ALIGN=RIGHT><INPUT TYPE=HIDDEN NAME="Qty' . $i . '" VALUE="' . $Qty . '"><A HREF="' . $rootpath .'/StockTransferControlled.php?' . SID . '&TransferItem=' . $i . '">' . $Qty . '</A></td>';
449 } else {
450 echo '<TD ALIGN=RIGHT><INPUT TYPE=TEXT NAME="Qty' . $i . '" MAXLENGTH=10 SIZE=10 VALUE="' . $Qty . '"></td>';
453 echo '<td>' . $TrfLine->PartUnit . '</TD>';
454 if ($TrfLine->CancelBalance==1){
455 echo '<td><input type="checkbox" checked name="CancelBalance' . $i . '" value=1></td>';
456 } else {
457 echo '<td><input type="checkbox" name="CancelBalance' . $i . '" value=0></td>';
460 if ($TrfLine->Controlled==1){
461 if ($TrfLine->Serialised==1){
462 echo '<TD><A HREF="' . $rootpath .'/StockTransferControlled.php?' . SID . '&TransferItem=' . $i . '">' . _('Enter Serial Numbers') . '</A></td>';
463 } else {
464 echo '<TD><A HREF="' . $rootpath .'/StockTransferControlled.php?' . SID . '&TransferItem=' . $i . '">' . _('Enter Batch Refs') . '</A></td>';
468 echo '</TR>';
470 $i++; /* the array of TransferItem s is indexed numerically and i matches the index no */
471 } /*end of foreach TransferItem */
473 echo '</table><br />
474 <INPUT TYPE=SUBMIT NAME="ProcessTransfer" VALUE="'. _('Process Inventory Transfer'). '"><BR />
475 </form>
476 </CENTER>';
478 } else { /*Not $_SESSION['Transfer'] set */
480 echo '<HR><FORM ACTION="' . $_SERVER['PHP_SELF'] . '?'. SID . '" METHOD=POST>';
482 $LocResult = DB_query("SELECT locationname, loccode FROM locations",$db);
484 echo '<TABLE BORDER=0>';
485 echo '<TR><TD>'. _('Select Location Receiving Into'). ':</TD><TD><SELECT NAME = "RecLocation">';
486 if (!isset($_POST['RecLocation'])){
487 $_POST['RecLocation'] = $_SESSION['UserStockLocation'];
489 while ($myrow=DB_fetch_array($LocResult)){
490 if ($myrow['loccode'] == $_POST['RecLocation']){
491 echo '<OPTION SELECTED Value="' . $myrow['loccode'] . '">' . $myrow['locationname'];
492 } else {
493 echo '<OPTION Value="' . $myrow['loccode'] . '">' . $myrow['locationname'];
496 echo '</SELECT><INPUT TYPE=SUBMIT NAME="RefreshTransferList" VALUE="' . _('Refresh Transfer List') . '"></TD></TR></TABLE><P>';
498 $sql = "SELECT DISTINCT reference,
499 locations.locationname as trffromloc,
500 shipdate
501 FROM loctransfers INNER JOIN locations
502 ON loctransfers.shiploc=locations.loccode
503 WHERE recloc='" . $_POST['RecLocation'] . "'
504 AND recqty < shipqty";
506 $TrfResult = DB_query($sql,$db);
507 if (DB_num_rows($TrfResult)>0){
509 echo '<CENTER><TABLE BORDER=0>';
511 echo '<TR>
512 <TD class="tableheader">'. _('Transfer Ref'). '</TD>
513 <TD class="tableheader">'. _('Transfer From'). '</TD>
514 <TD class="tableheader">'. _('Dispatch Date'). '</TD></TR>';
516 while ($myrow=DB_fetch_array($TrfResult)){
518 echo '<TR><TD ALIGN=RIGHT>' . $myrow['reference'] . '</TD>
519 <TD>' . $myrow['trffromloc'] . '</TD>
520 <TD>' . ConvertSQLDate($myrow['shipdate']) . '</TD>
521 <TD><A HREF="' . $_SERVER['PHP_SELF'] . '?' . SID . '&Trf_ID=' . $myrow['reference'] . '">'. _('Receive'). '</A></TD></TR>';
525 echo '</table></CENTER>';
527 echo '</FORM>';
529 include('includes/footer.inc');