Skip to content

Commit

Permalink
Redo changes lost in the last commit
Browse files Browse the repository at this point in the history
Files changed in commit:
StockQuantityByDate.php
On branch master
  • Loading branch information
timschofield committed Apr 11, 2018
1 parent 74592f0 commit 3548fa1
Showing 1 changed file with 44 additions and 36 deletions.
80 changes: 44 additions & 36 deletions StockQuantityByDate.php
Expand Up @@ -67,9 +67,22 @@
}

echo '<td>' . _('On-Hand On Date') . ':</td>
<td><input type="text" class="date" name="OnHandDate" size="12" required="required" maxlength="10" value="' . $_POST['OnHandDate'] . '" /></td></tr>';
<td><input type="text" class="date" name="OnHandDate" size="12" required="required" maxlength="10" value="' . $_POST['OnHandDate'] . '" /></td>';

if (isset($_POST['ShowZeroStocks'])) {
$Checked = 'checked="checked"';
} else {
$Checked = '';
}

echo '<td>
<td>', ('Include zero stocks'), '</td>
<td><input type="checkbox" name="ShowZeroStocks" value="" ', $Checked, ' /></td>
</td>
</tr>';

echo '<tr>
<td colspan="6">
<td colspan="8">
<div class="centre">
<input type="submit" name="ShowStatus" value="' . _('Show Stock Status') . '" />
</div></td>
Expand Down Expand Up @@ -107,19 +120,29 @@
<th>' . _('Item Code') . '</th>
<th>' . _('Description') . '</th>
<th>' . _('Quantity On Hand') . '</th>
<th>' . _('Cost per Unit') . '</th>
<th>' . _('Total Value') . '</th>
<th>' . _('Controlled') . '</th>
</tr>';

while ($MyRows = DB_fetch_array($StockResult)) {
while ($MyRow = DB_fetch_array($StockResult)) {

$SQL = "SELECT stockid,
newqoh
FROM stockmoves
WHERE stockmoves.trandate <= '" . $SQLOnHandDate . "'
AND stockid = '" . $MyRows['stockid'] . "'
AND loccode = '" . $_POST['StockLocation'] . "'
ORDER BY stkmoveno DESC LIMIT 1";
if (isset($_POST['ShowZeroStocks'])) {
$SQL = "SELECT stockid,
newqoh
FROM stockmoves
WHERE stockmoves.trandate <= '" . $SQLOnHandDate . "'
AND stockid = '" . $MyRow['stockid'] . "'
AND loccode = '" . $_POST['StockLocation'] . "'
ORDER BY stkmoveno DESC LIMIT 1";
} else {
$SQL = "SELECT stockid,
newqoh
FROM stockmoves
WHERE stockmoves.trandate <= '" . $SQLOnHandDate . "'
AND stockid = '" . $MyRow['stockid'] . "'
AND loccode = '" . $_POST['StockLocation'] . "'
AND newqoh > 0
ORDER BY stkmoveno DESC LIMIT 1";
}

$ErrMsg = _('The stock held as at') . ' ' . $_POST['OnHandDate'] . ' ' . _('could not be retrieved because');

Expand All @@ -129,38 +152,23 @@

while ($LocQtyRow = DB_fetch_array($LocStockResult)) {

$CostSQL = "SELECT stockcosts.materialcost+stockcosts.labourcost+stockcosts.overheadcost AS cost
FROM stockcosts
WHERE stockcosts.costfrom<='" . $SQLOnHandDate . "'
AND stockid = '" . $MyRows['stockid'] . "'
ORDER BY costfrom DESC
LIMIT 1";
$CostResult = DB_query($CostSQL);
if (DB_num_rows($CostResult) == 0) {
$CostSQL = "SELECT stockcosts.materialcost+stockcosts.labourcost+stockcosts.overheadcost AS cost
FROM stockcosts
WHERE stockid = '" . $MyRows['stockid'] . "'
ORDER BY costfrom DESC
LIMIT 1";
$CostResult = DB_query($CostSQL);
$CostRow = DB_fetch_array($CostResult);
if ($MyRows['controlled'] == 1) {
$Controlled = _('Yes');
} else {
$CostRow = DB_fetch_array($CostResult);
$Controlled = _('No');
}

if ($NumRows == 0) {
printf('<tr class="striped_row">
<td><a target="_blank" href="' . $RootPath . '/StockStatus.php?%s">%s</a></td>
<td>%s</td>
<td class="number">%s</td>
<td class="number">%s</td>
<td class="number">%s</td></tr>', 'StockID=' . mb_strtoupper($MyRows['stockid']), mb_strtoupper($MyRows['stockid']), $MyRows['description'], 0, locale_number_format($CostRow['cost'], $_SESSION['CompanyRecord']['decimalplaces']), 0);
<td class="number">%s</td></tr>', 'StockID=' . mb_strtoupper($MyRow['stockid']), mb_strtoupper($MyRow['stockid']), $MyRow['description'], 0);
} else {
printf('<tr class="striped_row">
<td><a target="_blank" href="' . $RootPath . '/StockStatus.php?%s">%s</a></td>
<td>%s</td>
<td class="number">%s</td>
<td class="number">%s</td>
<td class="number">%s</td></tr>', 'StockID=' . mb_strtoupper($MyRows['stockid']), mb_strtoupper($MyRows['stockid']), $MyRows['description'], locale_number_format($LocQtyRow['newqoh'], $MyRows['decimalplaces']), locale_number_format($CostRow['cost'], $_SESSION['CompanyRecord']['decimalplaces']), locale_number_format(($CostRow['cost'] * $LocQtyRow['newqoh']), $_SESSION['CompanyRecord']['decimalplaces']));
<td><a target="_blank" href="' . $RootPath . '/StockStatus.php?%s">%s</a></td>
<td>%s</td>
<td class="number">%s</td>
<td class="number">%s</td></tr>', 'StockID=' . mb_strtoupper($MyRow['stockid']), mb_strtoupper($MyRow['stockid']), $MyRow['description'], locale_number_format($LocQtyRow['newqoh'], $MyRow['decimalplaces']), $Controlled);

$TotalQuantity+= $LocQtyRow['newqoh'];
}
Expand Down

0 comments on commit 3548fa1

Please sign in to comment.