Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Order Price Drop Down
05-19-2016, 12:45 PM,
#7
RE: Order Price Drop Down
(05-19-2016, 03:12 AM)agaluski Wrote: Not fully tested but this is a poor man's version - to display the last 3 prices for this customer/item under the price input field. No price override, nothing fancy with selecting but it might get you started.
I am using a modified version of 4.11 so your lines numbers and details might be slightly different.

Around line 1500 inside the "foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) {" loop and before the next 'echo' add this code:
PHP Code:
$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'];
            } 
Then change this line:
PHP Code:
echo '<td><input class="number" type="text" required="required" name="Price_' $OrderLine->LineNumber '" size="16" maxlength="16" value="' locale_number_format($OrderLine->Price,$_SESSION['StandardCostDecimalPlaces'])  . '" title="' _('Enter the price to charge the customer for this item') . '" /></td>
                    <td><input class="number" type="text" required="required" name="Discount_' 
$OrderLine->LineNumber '" size="5" maxlength="6" value="' locale_number_format(($OrderLine->DiscountPercent 100),2) . '" title="' _('Enter the discount percentage to apply to the price for this item') . '" /></td>
                    <td><input class="number" type="text" required="required" name="GPPercent_' 
$OrderLine->LineNumber '" size="4" maxlength="40" value="' locale_number_format($OrderLine->GPPercent,2) . '" title="' _('Enter a gross profit percentage to use as the basis to calculate the price to charge the customer for this line item') . '" /></td>'
To this:
PHP Code:
echo '<td><input class="number" type="text" required="required" name="Price_' $OrderLine->LineNumber '" size="16" maxlength="16" value="' locale_number_format($OrderLine->Price,$_SESSION['StandardCostDecimalPlaces'])  . '" title="' _('Enter the price to charge the customer for this item') . '" />
                    <br>' 
                    
implode("<br>",$last3) . 
                    
'</td>
                    <td><input class="number" type="text" required="required" name="Discount_' 
$OrderLine->LineNumber '" size="5" maxlength="6" value="' locale_number_format(($OrderLine->DiscountPercent 100),2) . '" title="' _('Enter the discount percentage to apply to the price for this item') . '" /></td>
                    <td><input class="number" type="text" required="required" name="GPPercent_' 
$OrderLine->LineNumber '" size="4" maxlength="40" value="' locale_number_format($OrderLine->GPPercent,2) . '" title="' _('Enter a gross profit percentage to use as the basis to calculate the price to charge the customer for this line item') . '" /></td>'
Thanks for the help just what I needed.
Reply


Messages In This Thread
Order Price Drop Down - by daveparrish - 05-17-2016, 10:52 AM
RE: Order Price Drop Down - by agaluski - 05-17-2016, 10:38 PM
RE: Order Price Drop Down - by daveparrish - 05-17-2016, 11:06 PM
RE: Order Price Drop Down - by agaluski - 05-18-2016, 11:26 PM
RE: Order Price Drop Down - by daveparrish - 05-18-2016, 11:46 PM
RE: Order Price Drop Down - by agaluski - 05-19-2016, 03:12 AM
RE: Order Price Drop Down - by daveparrish - 05-19-2016, 12:45 PM
RE: Order Price Drop Down - by daveparrish - 05-23-2016, 01:18 AM
RE: Order Price Drop Down - by TimSchofield - 05-24-2016, 12:23 AM
RE: Order Price Drop Down - by daveparrish - 05-24-2016, 05:22 AM
RE: Order Price Drop Down - by TimSchofield - 05-24-2016, 04:35 PM
RE: Order Price Drop Down - by TurboPT - 05-24-2016, 11:04 AM
RE: Order Price Drop Down - by daveparrish - 05-24-2016, 11:58 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)