Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Order Price Drop Down
05-24-2016, 11:04 AM, (This post was last modified: 05-24-2016, 11:11 AM by TurboPT.)
#11
RE: Order Price Drop Down
You could try this:

PHP Code:
$items count($last3);

// format each entry first:
for ( $x 0$x $items$x++ ) {
   
$last3[$x] = locale_number_format($last3[$x], $OrderLine->DecimalPlaces);
}

// ...and THEN use the implode:
<td class="number">' . implode ("<br>", $last3) . '</td
Reply
05-24-2016, 11:58 AM,
#12
RE: Order Price Drop Down
(05-24-2016, 11:04 AM)TurboPT Wrote: You could try this:

PHP Code:
$items count($last3);

// format each entry first:
for ( $x 0$x $items$x++ ) {
   
$last3[$x] = locale_number_format($last3[$x], $OrderLine->DecimalPlaces);
}

// ...and THEN use the implode:
<td class="number">' . implode ("<br>", $last3) . '</td
Thanks for the help I tried and it removes all the formatting here is what i have
------------------------------------------------------------------------------


$last3sql = "SELECT unitprice

FROM salesorderdetails

INNER JOIN salesorders ON salesorders.orderno=salesorderdetails.orderno
WHERE salesorderdetails.stkcode= '" . $OrderLine->StockID . "'
AND salesorders.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'
ORDER by salesorders.orddate DESC LIMIT 3";

$ErrMsg = _('The details for the last 3 prices cannot be retrieved');
$DbgMsg = _('SQL used to retrieve the details was') . ':<br />' . $last3sql;
$last3result =DB_query($last3sql,$db,$ErrMsg,$DbgMsg);
$last3=array();
while ($mylast3=DB_fetch_array($last3result)) {
$last3[]=$mylast3['unitprice'];
}
$prices = count($last3);

for ( $x = 0; $x < $prices; $x++ ) {
$last3[$x] = locale_number_format($last3[$x], $OrderLine->DecimalPlaces);
}
echo $RowStarter;
echo '<td>';
/* if($_SESSION['Items'.$identifier]->DefaultPOLine ==1){ //show the input field only if required*/
if($ShowPOLine) {// Show the input field only if required.
echo '<input maxlength="20" name="POLine_' . $OrderLine->LineNumber . '" size="20" title="' . _('Enter the customer\'s purchase order reference if required by the customer') . '" type="text" value="' . $OrderLine->POLine . '" /></td><td>';
} else {
echo '<input name="POLine_' . $OrderLine->LineNumber . '" type="hidden" value="" />';
}

echo '<a href="' . $RootPath . '/StockStatus.php?identifier='.$identifier . '&amp;StockID=' . $OrderLine->StockID . '&amp;DebtorNo=' . $_SESSION['Items'.$identifier]->DebtorNo . '" target="_blank">' . $OrderLine->StockID . '</a></td>
<td title="' . $OrderLine->LongDescription . '">' . $OrderLine->ItemDescription . '</td>';

echo '<td><input class="number" maxlength="8" name="Quantity_' . $OrderLine->LineNumber . '" required="required" size="6" title="' . _('Enter the quantity of this item ordered by the customer') . '" type="text" value="' . locale_number_format($OrderLine->Quantity,$OrderLine->DecimalPlaces) . '" />';
if ($QtyRemain != $QtyOrdered){
echo '<br />' . locale_number_format($OrderLine->QtyInv,$OrderLine->DecimalPlaces) .' ' . _('of') . ' ' . locale_number_format($OrderLine->Quantity,$OrderLine->DecimalPlaces).' ' . _('invoiced');
}
echo '</td>
<td class="number">' . locale_number_format($OrderLine->QOHatLoc,$OrderLine->DecimalPlaces) . '</td>
<td>' . $OrderLine->Units . '</td>';

/*OK to display with discount if it is an internal user with appropriate permissions */
/* if (in_array($_SESSION['PageSecurityArray']['OrderEntryDiscountPricing'], $_SESSION['AllowedPageSecurityTokens'])){*/
if ($ShowDiscountGP){
echo '<td><input class="number" maxlength="16" name="Price_' . $OrderLine->LineNumber . '" required="required" size="16" title="' . _('Enter the price to charge the customer for this item') . '" type="text" value="' . locale_number_format($OrderLine->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '" /></td>
<td class="number">' . implode ("<br>", $last3) . '</td>
------------------------------------------------------------------------------
Reply
05-24-2016, 04:35 PM,
#13
RE: Order Price Drop Down
(05-24-2016, 05:22 AM)daveparrish Wrote:
(05-24-2016, 12:23 AM)falkoner Wrote: Hi Dave, look for the locale_number_format() function in includes/MiscFunctions.php which should format the number for you.

Tim

Ok here is what I did
<td class="number">' . implode ("<br>",$last3), locale_number_format($OrderLine->DecimalPlaces).'</td>

The first of the three shows the Decimal Places but not the next two.

locale_number_format() should take two parameters, the first being the number to be formatted, the second is the number of decimal places.

Tim
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)