From: <tu...@us...> - 2018-02-12 21:53:31
|
Revision: 7957 http://sourceforge.net/p/web-erp/reponame/7957 Author: turbopt Date: 2018-02-12 21:53:28 +0000 (Mon, 12 Feb 2018) Log Message: ----------- Tim (PaulT commit): StockMovements.php, StockLocMovements.php: Correct stock movements that have more than one serial number as part of it, then the item will appear multiple times in the movements script with the total quantity in each line. For example, if I enter a quantity adjustment for a controlled item, and assign 3 serial numbers to this movement and then run the inquiries, there will be 3 separate lines with a quantity of 3 against each one. Modified Paths: -------------- trunk/StockLocMovements.php trunk/StockMovements.php trunk/doc/Change.log Modified: trunk/StockLocMovements.php =================================================================== --- trunk/StockLocMovements.php 2018-02-11 19:21:52 UTC (rev 7956) +++ trunk/StockLocMovements.php 2018-02-12 21:53:28 UTC (rev 7957) @@ -7,146 +7,153 @@ include('includes/header.php'); -echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; -echo '<div>'; -echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<p class="page_title_text"> + <img src="', $RootPath, '/css/', $_SESSION['Theme'], '/images/magnifier.png" title="', _('Search'), '" alt="" />', ' ', $Title, ' + </p>'; -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"> + <input type="hidden" name="FormID" value="', $_SESSION['FormID'], '" /> + <table> + <tr> + <td>', _('From Stock Location'), ':<select required="required" name="StockLocation">'; -echo '<table class="selection"> - <tr> - <td> ' . _('From Stock Location') . ':<select name="StockLocation"> '; +$SQL = "SELECT locationname, + locations.loccode + FROM locations + INNER JOIN locationusers + ON locationusers.loccode=locations.loccode + AND locationusers.userid='" . $_SESSION['UserID'] . "' + AND locationusers.canview=1 + ORDER BY locationname"; -$sql = "SELECT locations.loccode, locationname FROM locations - INNER JOIN locationusers ON locationusers.loccode=locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1"; -$resultStkLocs = DB_query($sql); -while ($myrow=DB_fetch_array($resultStkLocs)){ - if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ - if ($myrow['loccode'] == $_POST['StockLocation']){ - echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; +echo '<option selected="selected" value="All">', _('All Locations'), '</option>'; + +if (!isset($_POST['StockLocation'])) { + $_POST['StockLocation'] = 'All'; +} + +$ResultStkLocs = DB_query($SQL); + +while ($MyRow = DB_fetch_array($ResultStkLocs)) { + if (isset($_POST['StockLocation']) and $_POST['StockLocation'] != 'All') { + if ($MyRow['loccode'] == $_POST['StockLocation']) { + echo '<option selected="selected" value="', $MyRow['loccode'], '">', $MyRow['locationname'], '</option>'; } else { - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="', $MyRow['loccode'], '">', $MyRow['locationname'], '</option>'; } - } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - $_POST['StockLocation']=$myrow['loccode']; + } elseif ($MyRow['loccode'] == $_SESSION['UserStockLocation']) { + echo '<option selected="selected" value="' . $MyRow['loccode'] . '">' . $MyRow['locationname'] . '</option>'; + $_POST['StockLocation']=$MyRow['loccode']; } else { - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="', $MyRow['loccode'], '">', $MyRow['locationname'], '</option>'; } } echo '</select>'; -if (!isset($_POST['BeforeDate']) OR !Is_Date($_POST['BeforeDate'])){ - $_POST['BeforeDate'] = Date($_SESSION['DefaultDateFormat']); +if (!isset($_POST['BeforeDate']) or !Is_date($_POST['BeforeDate'])) { + $_POST['BeforeDate'] = Date($_SESSION['DefaultDateFormat']); } -if (!isset($_POST['AfterDate']) OR !Is_Date($_POST['AfterDate'])){ - $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,Date('d'),Date('y'))); +if (!isset($_POST['AfterDate']) or !Is_date($_POST['AfterDate'])) { + $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m') - 1, Date('d'), Date('y'))); } -echo ' ' . _('Show Movements before') . ': <input type="text" name="BeforeDate" size="12" maxlength="12" value="' . $_POST['BeforeDate'] . '" />'; -echo ' ' . _('But after') . ': <input type="text" name="AfterDate" size="12" maxlength="12" value="' . $_POST['AfterDate'] . '" />'; -echo '</td> - </tr> - </table> - <br />'; -echo '<div class="centre"> - <input type="submit" name="ShowMoves" value="' . _('Show Stock Movements') . '" /> - </div> - <br />'; +echo ' ', _('Show Movements before'), ': <input type="text" class="date" alt="', $_SESSION['DefaultDateFormat'], '" name="BeforeDate" size="12" required="required" maxlength="12" value="', $_POST['BeforeDate'], '" />', + ' ', _('But after'), ': <input type="text" class="date" alt="', $_SESSION['DefaultDateFormat'], '" name="AfterDate" size="12" required="required" maxlength="12" value="', $_POST['AfterDate'], '" />', + '</td> + </tr> + </table> + <div class="centre"> + <input type="submit" name="ShowMoves" value="', _('Show Stock Movements'), '" /> + </div> + <br />'; +if ($_POST['StockLocation'] == 'All') { + $_POST['StockLocation'] = '%%'; +} $SQLBeforeDate = FormatDateForSQL($_POST['BeforeDate']); $SQLAfterDate = FormatDateForSQL($_POST['AfterDate']); -$sql = "SELECT stockmoves.stockid, - systypes.typename, - stockmoves.type, - stockmoves.transno, - stockmoves.trandate, - stockmoves.debtorno, - stockmoves.branchcode, - stockmoves.qty, - stockmoves.reference, - stockmoves.price, - stockmoves.discountpercent, - stockmoves.newqoh, - stockmaster.decimalplaces, - stockserialmoves.serialno - FROM stockmoves - INNER JOIN systypes ON stockmoves.type=systypes.typeid - INNER JOIN stockmaster ON stockmoves.stockid=stockmaster.stockid - LEFT JOIN stockserialmoves ON stockmoves.stkmoveno=stockserialmoves.stockmoveno - WHERE stockmoves.loccode='" . $_POST['StockLocation'] . "' - AND stockmoves.trandate >= '". $SQLAfterDate . "' - AND stockmoves.trandate <= '" . $SQLBeforeDate . "' - AND hidemovt=0 - ORDER BY stkmoveno DESC"; - +$SQL = "SELECT stockmoves.stockid, + stockmoves.stkmoveno, + systypes.typename, + stockmoves.type, + stockmoves.transno, + stockmoves.trandate, + stockmoves.debtorno, + stockmoves.branchcode, + stockmoves.qty, + stockmoves.reference, + stockmoves.price, + stockmoves.discountpercent, + stockmoves.newqoh, + stockmaster.controlled, + stockmaster.serialised, + stockmaster.decimalplaces + FROM stockmoves + INNER JOIN systypes + ON stockmoves.type=systypes.typeid + INNER JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + WHERE stockmoves.loccode " . LIKE . " '" . $_POST['StockLocation'] . "' + AND stockmoves.trandate >= '" . $SQLAfterDate . "' + AND stockmoves.trandate <= '" . $SQLBeforeDate . "' + AND hidemovt=0 + ORDER BY stkmoveno DESC"; $ErrMsg = _('The stock movements for the selected criteria could not be retrieved because'); -$MovtsResult = DB_query($sql,$ErrMsg); +$MovtsResult = DB_query($SQL, $ErrMsg); -echo '<table cellpadding="5" cellspacing="4 "class="selection">'; -$tableheader = '<tr> - <th>' . _('Item Code') . '</th> - <th>' . _('Type') . '</th> - <th>' . _('Trans No') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Reference') . '</th> - <th>' . _('Price') . '</th> - <th>' . _('Discount') . '</th> - <th>' . _('Quantity on Hand') . '</th> - <th>' . _('Serial No.') . '</th> - </tr>'; -echo $tableheader; +if (DB_num_rows($MovtsResult) > 0) { + echo '<table cellpadding="5" cellspacing="4" class="selection"> + <tr> + <th>', _('Item Code'), '</th> + <th>', _('Type'), '</th> + <th>', _('Trans No'), '</th> + <th>', _('Date'), '</th> + <th>', _('Customer'), '</th> + <th>', _('Quantity'), '</th> + <th>', _('Reference'), '</th> + <th>', _('Price'), '</th> + <th>', _('Discount'), '</th> + <th>', _('Quantity on Hand'), '</th> + <th>', _('Serial No.'), '</th> + </tr>'; -$j = 1; + while ($MyRow = DB_fetch_array($MovtsResult)) { -while ($myrow=DB_fetch_array($MovtsResult)) { + $DisplayTranDate = ConvertSQLDate($MyRow['trandate']); - $DisplayTranDate = ConvertSQLDate($myrow['trandate']); + $SerialSQL = "SELECT serialno, moveqty FROM stockserialmoves WHERE stockmoveno='" . $MyRow['stkmoveno'] . "'"; + $SerialResult = DB_query($SerialSQL); - printf('<tr class="striped_row"> - <td><a target="_blank" href="' . $RootPath . '/StockStatus.php?StockID=%s">%s</a></td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class="number">%s</td> - <td>%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - <td class="number">%s</td> - </tr>', - mb_strtoupper($myrow['stockid']), - mb_strtoupper($myrow['stockid']), - $myrow['typename'], - $myrow['transno'], - $DisplayTranDate, - $myrow['debtorno'], - locale_number_format($myrow['qty'], - $myrow['decimalplaces']), - $myrow['reference'], - locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($myrow['discountpercent']*100,2), - locale_number_format($myrow['newqoh'],$myrow['decimalplaces']), - $myrow['serialno']); - $j++; - If ($j == 16){ - $j=1; - echo $tableheader; + $SerialText = ''; + while ($SerialRow = DB_fetch_array($SerialResult)) { + if ($MyRow['serialised'] == 1) { + $SerialText .= $SerialRow['serialno'] . '<br />'; + } else { + $SerialText .= $SerialRow['serialno'] . ' Qty- ' . $SerialRow['moveqty'] . '<br />'; + } + } + + echo '<tr class="striped_row"> + <td><a target="_blank" href="', $RootPath, '/StockStatus.php?StockID=', mb_strtoupper(urlencode($MyRow['stockid'])), '">', mb_strtoupper($MyRow['stockid']), '</a></td> + <td>', $MyRow['typename'], '</td> + <td>', $MyRow['transno'], '</td> + <td>', $DisplayTranDate, '</td> + <td>', $MyRow['debtorno'], '</td> + <td class="number">', locale_number_format($MyRow['qty'], $MyRow['decimalplaces']), '</td> + <td>', $MyRow['reference'], '</td> + <td class="number">', locale_number_format($MyRow['price'], $_SESSION['CompanyRecord']['decimalplaces']), '</td> + <td class="number">', locale_number_format($MyRow['discountpercent'] * 100, 2), '%</td> + <td class="number">', locale_number_format($MyRow['newqoh'], $MyRow['decimalplaces']), '</td> + <td>', $SerialText, '</td> + </tr>'; } -//end of page full new headings if + //end of while loop + echo '</table>'; } -//end of while loop +echo '</form>'; -echo '</table>'; -echo '</div> - </form>'; +include ('includes/footer.php'); -include('includes/footer.php'); - ?> \ No newline at end of file Modified: trunk/StockMovements.php =================================================================== --- trunk/StockMovements.php 2018-02-11 19:21:52 UTC (rev 7956) +++ trunk/StockMovements.php 2018-02-12 21:53:28 UTC (rev 7957) @@ -5,8 +5,8 @@ include('includes/session.php'); $Title = _('Stock Movements'); /* webERP manual links before header.php */ -$ViewTopic= "Inventory"; -$BookMark = "InventoryMovement"; +$ViewTopic= 'Inventory'; +$BookMark = 'InventoryMovement'; include('includes/header.php'); if (isset($_GET['StockID'])){ @@ -17,47 +17,60 @@ $StockID = ''; } -$result = DB_query("SELECT description, units FROM stockmaster WHERE stockid='".$StockID."'"); -$myrow = DB_fetch_row($result); -echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/inventory.png" title="' . _('Inventory') . '" alt="" /><b>' . ' ' . $StockID . ' - ' . $myrow['0'] . ' : ' . _('in units of') . ' : ' . $myrow[1] . '</b></p>'; +$StockInfo = ''; +if ('' != $StockID) { + $result = DB_query("SELECT description, units FROM stockmaster WHERE stockid='" . $StockID . "'"); + $myrow = DB_fetch_row($result); -echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; -echo '<div>'; -echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + $StockInfo = '<br /><b>' . $StockID . ' - ' . $myrow['0'] . ' : ' . _('in units of') . ' : ' . $myrow[1] . '</b>'; +} -if (!isset($_POST['BeforeDate']) OR !Is_Date($_POST['BeforeDate'])){ +echo '<p class="page_title_text"> + <img src="', $RootPath, '/css/', $_SESSION['Theme'], '/images/inventory.png" title="', _('Inventory'), '" alt="" /> ', $Title, + $StockInfo, + '</p>'; + +echo '<form action="', htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8'), '" method="post"> + <div> + <input type="hidden" name="FormID" value="', $_SESSION['FormID'], '" />'; + +if (!isset($_POST['BeforeDate']) OR !Is_date($_POST['BeforeDate'])){ $_POST['BeforeDate'] = Date($_SESSION['DefaultDateFormat']); } -if (!isset($_POST['AfterDate']) OR !Is_Date($_POST['AfterDate'])){ +if (!isset($_POST['AfterDate']) OR !Is_date($_POST['AfterDate'])){ $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-3,Date('d'),Date('y'))); } + echo '<br /> - <table class="selection">'; -echo '<tr><th colspan="12">' . _('Stock Code') . ':<input type="text" name="StockID" size="21" value="' . $StockID . '" maxlength="20" />'; + <table class="selection"> + <tr> + <th colspan="12">', _('Stock Code'), ':<input type="text" name="StockID" size="21" value="', $StockID, '" required="required" maxlength="20" />'; -echo ' ' . _('From Stock Location') . ':<select name="StockLocation"> '; +echo ' ', _('From Stock Location'), ':<select required="required" name="StockLocation"> '; -$sql = "SELECT locations.loccode, locationname FROM locations +$SQL = "SELECT locations.loccode, + locationname + FROM locations INNER JOIN locationusers ON locationusers.loccode=locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1 - ORDER BY locationname - "; -$resultStkLocs = DB_query($sql); + ORDER BY locationname"; +$resultStkLocs = DB_query($SQL); + while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ if ($myrow['loccode'] == $_POST['StockLocation']){ - echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ - echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; - $_POST['StockLocation']=$myrow['loccode']; + echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + $_POST['StockLocation']=$myrow['loccode']; } else { - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } @@ -64,14 +77,19 @@ echo '</select></th> </tr>'; echo '<tr> - <th colspan="12">' . _('Show Movements between') . ': <input type="text" name="AfterDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" value="' . $_POST['AfterDate'] . '" /> ' . _('and') . ': <input type="text" name="BeforeDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" value="' . $_POST['BeforeDate'] . '" /><input type="submit" name="ShowMoves" value="' . _('Show Stock Movements') . '" /></th> + <th colspan="12">', _('Show Movements between'), ': + <input type="text" name="AfterDate" class="date" alt="', $_SESSION['DefaultDateFormat'], '" size="12" required="required" maxlength="12" value="', $_POST['AfterDate'], '" /> ' . _('and') . ': + <input type="text" name="BeforeDate" class="date" alt="', $_SESSION['DefaultDateFormat'], '" size="12" required="required" maxlength="12" value="', $_POST['BeforeDate'], '" /> + <input type="submit" name="ShowMoves" value="', _('Show Stock Movements'), '" /> + </th> </tr>'; $SQLBeforeDate = FormatDateForSQL($_POST['BeforeDate']); $SQLAfterDate = FormatDateForSQL($_POST['AfterDate']); -$sql = "SELECT stockmoves.stockid, +$SQL = "SELECT stockmoves.stockid, systypes.typename, + stockmoves.stkmoveno, stockmoves.type, stockmoves.transno, stockmoves.trandate, @@ -84,150 +102,137 @@ stockmoves.discountpercent, stockmoves.newqoh, stockmaster.decimalplaces, - stockserialmoves.serialno + stockmaster.controlled, + stockmaster.serialised FROM stockmoves - INNER JOIN systypes ON stockmoves.type=systypes.typeid - INNER JOIN stockmaster ON stockmoves.stockid=stockmaster.stockid - LEFT JOIN stockserialmoves ON stockmoves.stkmoveno=stockserialmoves.stockmoveno + INNER JOIN systypes + ON stockmoves.type=systypes.typeid + INNER JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid WHERE stockmoves.loccode='" . $_POST['StockLocation'] . "' - AND stockmoves.trandate >= '". $SQLAfterDate . "' - AND stockmoves.stockid = '" . $StockID . "' - AND stockmoves.trandate <= '" . $SQLBeforeDate . "' - AND hidemovt=0 + AND stockmoves.trandate >= '" . $SQLAfterDate . "' + AND stockmoves.stockid = '" . $StockID . "' + AND stockmoves.trandate <= '" . $SQLBeforeDate . "' + AND hidemovt=0 ORDER BY stkmoveno DESC"; $ErrMsg = _('The stock movements for the selected criteria could not be retrieved because') . ' - '; $DbgMsg = _('The SQL that failed was') . ' '; -$MovtsResult = DB_query($sql, $ErrMsg, $DbgMsg); +$MovtsResult = DB_query($SQL, $ErrMsg, $DbgMsg); -$tableheader = '<tr> - <th>' . _('Type') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('User ID') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Branch') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Reference') . '</th> - <th>' . _('Price') . '</th> - <th>' . _('Discount') . '</th> - <th>' . _('New Qty') . '</th> - <th>' . _('Serial No.') . '</th> - </tr>'; +if (DB_num_rows($MovtsResult) > 0) { + $myrow = DB_fetch_array($MovtsResult); -echo $tableheader; + echo '<tr> + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('User ID') . '</th> + <th>' . _('Customer') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + <th>' . _('New Qty') . '</th>'; + if ($myrow['controlled'] == 1) { + echo '<th>', _('Serial No.'), '</th>'; + } + echo '</tr>'; -$j = 1; + DB_data_seek($MovtsResult, 0); -while ($myrow=DB_fetch_array($MovtsResult)) { + while ($myrow = DB_fetch_array($MovtsResult)) { - $DisplayTranDate = ConvertSQLDate($myrow['trandate']); + $DisplayTranDate = ConvertSQLDate($myrow['trandate']); - if ($myrow['type']==10){ /*its a sales invoice allow link to show invoice it was sold on*/ + $SerialSQL = "SELECT serialno, moveqty FROM stockserialmoves WHERE stockmoveno='" . $myrow['stkmoveno'] . "'"; + $SerialResult = DB_query($SerialSQL); - printf('<tr class="striped_row"> - <td><a target="_blank" href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">%s</a></td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class="number">%s</td> - <td>%s</td> - <td class="number">%s</td> - <td class="number">%s%%</td> - <td class="number">%s</td> - <td class="number">%s</td> - </tr>', - $RootPath, - $myrow['transno'], - $myrow['typename'], - $myrow['transno'], - $DisplayTranDate, - $myrow['userid'], - $myrow['debtorno'], - $myrow['branchcode'], - locale_number_format($myrow['qty'],$myrow['decimalplaces']), - $myrow['reference'], - locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($myrow['discountpercent']*100,2), - locale_number_format($myrow['newqoh'],$myrow['decimalplaces']), - $myrow['serialno']); + $SerialText = ''; + while ($SerialRow = DB_fetch_array($SerialResult)) { + if ($myrow['serialised'] == 1) { + $SerialText .= $SerialRow['serialno'] . '<br />'; + } else { + $SerialText .= $SerialRow['serialno'] . ' Qty- ' . $SerialRow['moveqty'] . '<br />'; + } + } - } elseif ($myrow['type']==11){ + if ($myrow['type']==10){ + /*its a sales invoice allow link to show invoice it was sold on*/ - printf('<tr class="striped_row"> - <td><a target="_blank" href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">%s</a></td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class="number">%s</td> - <td>%s</td> - <td class="number">%s</td> - <td class="number">%s%%</td> - <td class="number">%s</td> - <td class="number">%s</td> - </tr>', - $RootPath, - $myrow['transno'], - $myrow['typename'], - $myrow['transno'], - $DisplayTranDate, - $myrow['userid'], - $myrow['debtorno'], - $myrow['branchcode'], - locale_number_format($myrow['qty'],$myrow['decimalplaces']), - $myrow['reference'], - locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($myrow['discountpercent']*100,2), - locale_number_format($myrow['newqoh'],$myrow['decimalplaces']), - $myrow['serialno']); - } else { + echo '<tr class="striped_row"> + <td><a target="_blank" href="', $RootPath, '/PrintCustTrans.php?FromTransNo=', urlencode($myrow['transno']), '&InvOrCredit=Invoice">', $myrow['typename'], '</a></td> + <td>', $myrow['transno'], '</td> + <td>', $DisplayTranDate, '</td> + <td>', $myrow['userid'], '</td> + <td>', $myrow['debtorno'], '</td> + <td>', $myrow['branchcode'], '</td> + <td class="number">', locale_number_format($myrow['qty'], $myrow['decimalplaces']), '</td> + <td>', $myrow['reference'], '</td> + <td class="number">', locale_number_format($myrow['price'], $_SESSION['CompanyRecord']['decimalplaces']), '</td> + <td class="number">', locale_number_format($myrow['discountpercent'] * 100, 2), '%%</td> + <td class="number">', locale_number_format($myrow['newqoh'], $myrow['decimalplaces']), '</td>'; + if ($myrow['controlled'] == 1) { + echo '<td>', $SerialText, '</td>'; + } + echo '</tr>'; - printf('<tr class="striped_row"> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class="number">%s</td> - <td>%s</td> - <td class="number">%s</td> - <td class="number">%s%%</td> - <td class="number">%s</td> - <td class="number">%s</td> - </tr>', - $myrow['typename'], - $myrow['transno'], - $DisplayTranDate, - $myrow['userid'], - $myrow['debtorno'], - $myrow['branchcode'], - locale_number_format($myrow['qty'],$myrow['decimalplaces']), - $myrow['reference'], - locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($myrow['discountpercent']*100,2), - locale_number_format($myrow['newqoh'],$myrow['decimalplaces']), - $myrow['serialno']); + } elseif ($myrow['type']==11){ + + echo '<tr class="striped_row"> + <td><a target="_blank" href="', $RootPath, '/PrintCustTrans.php?FromTransNo=', urlencode($myrow['transno']), '&InvOrCredit=Credit">', $myrow['typename'], '</a></td> + <td>', $myrow['transno'], '</td> + <td>', $DisplayTranDate, '</td> + <td>', $myrow['userid'], '</td> + <td>', $myrow['debtorno'], '</td> + <td>', $myrow['branchcode'], '</td> + <td class="number">', locale_number_format($myrow['qty'], $myrow['decimalplaces']), '</td> + <td>', $myrow['reference'], '</td> + <td class="number">', locale_number_format($myrow['price'], $_SESSION['CompanyRecord']['decimalplaces']), '</td> + <td class="number">', locale_number_format($myrow['discountpercent'] * 100, 2), '%%</td> + <td class="number">', locale_number_format($myrow['newqoh'], $myrow['decimalplaces']), '</td>'; + if ($myrow['controlled'] == 1) { + echo '<td>', $SerialText, '</td>'; + } + echo '</tr>'; + + } else { + + echo '<tr class="striped_row"> + <td>', $myrow['typename'], '</td> + <td>', $myrow['transno'], '</td> + <td>', $DisplayTranDate, '</td> + <td>', $myrow['userid'], '</td> + <td>', $myrow['debtorno'], '</td> + <td>', $myrow['branchcode'], '</td> + <td class="number">', locale_number_format($myrow['qty'], $myrow['decimalplaces']), '</td> + <td>', $myrow['reference'], '</td> + <td class="number">', locale_number_format($myrow['price'], $_SESSION['CompanyRecord']['decimalplaces']), '</td> + <td class="number">', locale_number_format($myrow['discountpercent'] * 100, 2), '%</td> + <td class="number">', locale_number_format($myrow['newqoh'], $myrow['decimalplaces']), '</td>'; + if ($myrow['controlled'] == 1) { + echo '<td>', $SerialText, '</td>'; + } + echo '</tr>'; + + } + //end of page full new headings if } -//end of page full new headings if + //end of while loop } -//end of while loop -echo '</table>'; -echo '<div class="centre"><br /><a href="' . $RootPath . '/StockStatus.php?StockID=' . $StockID . '">' . _('Show Stock Status') . '</a>'; -echo '<br /><a href="' . $RootPath . '/StockUsage.php?StockID=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">' . _('Show Stock Usage') . '</a>'; -echo '<br /><a href="' . $RootPath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">' . _('Search Outstanding Sales Orders') . '</a>'; -echo '<br /><a href="' . $RootPath . '/SelectCompletedOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a>'; +echo '</table> + <div class="centre"> + <br /><a href="', $RootPath, '/StockStatus.php?StockID=', urlencode($StockID), '">', _('Show Stock Status'), '</a> + <br /><a href="', $RootPath, '/StockUsage.php?StockID=', urlencode($StockID), '&StockLocation=', urlencode($_POST['StockLocation']), '">', _('Show Stock Usage'), '</a> + <br /><a href="', $RootPath, '/SelectSalesOrder.php?SelectedStockItem=', urlencode($StockID), '&StockLocation=', urlencode($_POST['StockLocation']), '">', _('Search Outstanding Sales Orders'), '</a> + <br /><a href="', $RootPath, '/SelectCompletedOrder.php?SelectedStockItem=', urlencode($StockID), '">', _('Search Completed Sales Orders'), '</a> + </div> + </div> + </form>'; -echo '</div> - </div> - </form>'; - include('includes/footer.php'); ?> \ No newline at end of file Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-11 19:21:52 UTC (rev 7956) +++ trunk/doc/Change.log 2018-02-12 21:53:28 UTC (rev 7957) @@ -1,5 +1,6 @@ webERP Change Log +12/2/18 Tim (PaulT commit): StockMovements.php, StockLocMovements.php: Correct stock movements that have more than one serial number as part of it, then the item will appear multiple times in the movements script with the total quantity in each line. For example, if I enter a quantity adjustment for a controlled item, and assign 3 serial numbers to this movement and then run the inquiries, there will be 3 separate lines with a quantity of 3 against each one. 11/2/18 PaulT: SellThroughSupport.php: Remove (another) redundant hidden FormID input. (there were two, overlooked the 2nd one earlier) 11/2/18 PaulT: SellThroughSupport.php: Remove redundant hidden FormID input. 11/2/18 PaulT: Contracts.php: Move closing form tag outside of condition. Fixes view page source message "Saw a form start tag, but there was already an active form element. Nested forms are not allowed. Ignoring the tag." reported in Firefox. |