This is a mod to the PDF Price List and selection screen.


Adds a selection dialog to PDFPriceList.php to choose to display "In Stock Items Only".

Now you can choose to display a price list for either all stock items, or just items that are in stock currently.

diff PDFPriceList.php.orig PDFPriceList.php
53c53,54
<                       custbranch.brname
---
>                       custbranch.brname,
>                       locstock.quantity
55a57
>                               locstock,
64a67,68
>                       AND locstock.stockid=stockmaster.stockid
>                       AND locstock.quantity > 0
69c73,105
<       } else { /* the sales type list only */
---
>       } else  /*  this is for Items in Stock only*/
>
>       if ($_POST['InStock']==_('In Stock Only')){
>
>                       $SQL = "SELECT sales_type FROM salestypes WHERE typeabbrev='" . $_POST['SalesType'] . "'";
>               $SalesTypeResult = DB_query($SQL,$db);
>               $SalesTypeRow = DB_fetch_row($SalesTypeResult);
>               $SalesTypeName = $SalesTypeRow[0];
>
>               $SQL = "SELECT prices.typeabbrev,
>                               prices.stockid,
>                               stockmaster.description,
>                               prices.currabrev,
>                               prices.price,
>                               stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost as standardcost,
>                               stockmaster.categoryid,
>                               stockcategory.categorydescription,
>                               locstock.quantity
>                       FROM prices,
>                               stockmaster,
>                               stockcategory,
>                               locstock
>                       WHERE stockmaster.stockid=prices.stockid
>                       AND stockmaster.categoryid=stockcategory.categoryid
>                       AND stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "'
>                       AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "'
>                       AND prices.typeabbrev='" . $_POST['SalesType'] . "'
>                       AND prices.debtorno=''
>                       AND locstock.stockid=stockmaster.stockid
>                       AND locstock.quantity > 0
>                       ORDER BY prices.currabrev,
>                               stockmaster.categoryid,
>                               stockmaster.stockid";
70a107
> } else { /* the sales type list only */
121c158,160
<                       $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,300-$Left_Margin,$FontSize, $PriceList['currabrev'] . ' ' . _('Prices'));
---
>                       $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,450-$Left_Margin,$FontSize, $PriceList['currabrev'] . ' ' . _('Prices, All prices are ex-warehouse only.  Limited stock at-hand, call to confirm.'));
>                       $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos-10,450-$Left_Margin,$FontSize, _('Prices subject to change without notice.'));
>                       $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos-20,450-$Left_Margin,$FontSize, _('Prices valid for 30 days, or until sold out.  Call for custom work pricing.'));
140c179
<               $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,$PriceList['stockid']);                                  $LeftOvers = $pdf->addTextWrap(120,$YPos,260,$FontSize,$PriceList['description']);
---
>               $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,100,$FontSize,$PriceList['stockid']);                                 $LeftOvers = $pdf->addTextWrap(170,$YPos,260,$FontSize,$PriceList['description']);
152c191
<               $DisplayUnitPrice = number_format($PriceList['price'],2);
---
>               $DisplayUnitPrice = "$" . number_format($PriceList['price'],2) . " ex tax";
158a198
>               $LeftOvers = $pdf->addTextWrap(480,$YPos,60,$FontSize,$DisplayUnitPrice, 'right');
160,161c200,204
<
<               $LeftOvers = $pdf->addTextWrap(440,$YPos,60,$FontSize,$DisplayUnitPrice, 'right');
---
> if ($_POST['InStock']=='In Stock Only'){
>               //print stock status
>               $InStock = number_format($PriceList['quantity'],2) . " m2";
>               $LeftOvers = $pdf->addTextWrap(350,$YPos,60,$FontSize,$InStock, 'right');
>               }
244a288,291
>               echo '<TR><TD>' . _('In Stock Items Only'). ':</TD><TD><SELECT name="InStock">';
>               echo '<OPTION  Value="In Stock Only">'. _('In Stock Only');
>               echo '<OPTION SELECTED Value="All Stock Items">'. _('All Stock Items');
>               echo '</SELECT></TD></TR>';
250c297
< ?>
\ No newline at end of file
---
> ?>
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki