|
From: <dai...@us...> - 2011-08-23 06:27:51
|
Revision: 4666
http://web-erp.svn.sourceforge.net/web-erp/?rev=4666&view=rev
Author: daintree
Date: 2011-08-23 06:27:45 +0000 (Tue, 23 Aug 2011)
Log Message:
-----------
23/8/11 Ricard: PDFPrintLabel Does Not display discontinued items and now allows printing of future price labels
Modified Paths:
--------------
trunk/PDFPrintLabel.php
trunk/doc/Change.log
Modified: trunk/PDFPrintLabel.php
===================================================================
--- trunk/PDFPrintLabel.php 2011-08-21 07:13:02 UTC (rev 4665)
+++ trunk/PDFPrintLabel.php 2011-08-23 06:27:45 UTC (rev 4666)
@@ -57,7 +57,9 @@
intval($_POST['QtyByItem']),
$_POST['Currency'],
$_POST['SalesType'],
- $_POST['StockID']);
+ $_POST['StockID'],
+ FormatDateForSQL($_POST['EffectiveDate'])
+ );
if ($ok)
exit(); // the print was success
@@ -90,8 +92,11 @@
_('Label Sticker Printing'),
_('Select label type'),
_('Number of labels per item'),
- _('Price list'), _('Currency'),
- _('Category'), _('Update values')
+ _('Price list'),
+ _('Currency'),
+ _('Category'),
+ _('Effective Date'),
+ _('Update values')
);
if (!isset($_POST['LabelID']))
$_POST['LabelID']=(string)$AllLabels->label[0]->id;
@@ -114,6 +119,9 @@
$TableItems = tableItems($_POST['Category'], $okItems);
+ if (!isset($_POST['EffectiveDate'])){
+ $_POST['EffectiveDate']=Date($_SESSION['DefaultDateFormat']);
+ }
$SendButton = '<br /><div class=centre><input type="submit" name="PrintPDF" value="'. _('Print labels') .'">
<input type="submit" name="PDFTest" value="'. _('Print labels with borders') .'"></div>';
$iTxt=0;
@@ -161,6 +169,8 @@
'.$OptionsCategory.'
</select> </td>
</tr>';
+ echo '<tr><td class="number">'.$txt[$iTxt++].':</td>
+ <td><input type="text" class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="EffectiveDate" size="11" maxlength="10" value=' . $_POST['EffectiveDate'] . '></td></tr>';
echo '<tr>
<th colspan="2">
<input type="submit" name="refresh" value="Refresh options">
@@ -170,7 +180,6 @@
'.$TableItems.'
</td>
</tr>';
-
echo '</tbody>
</table>
'.$SendButton.'
@@ -228,7 +237,7 @@
$ok=false;
return noneButton( _('Select a Category') );
}
- $result = getStockItems($CategoryID, $_POST['Currency'], $_POST['SalesType']);
+ $result = getStockItems($CategoryID, $_POST['Currency'], $_POST['SalesType'], FormatDateForSQL($_POST['EffectiveDate']));
if (!DB_num_rows($result)) {
$ok=false;
return noneButton( _('This category has no items to show') );
@@ -290,13 +299,16 @@
* The routine works in two contexts: when only the category is given
* it looks for all the items
*/
-function getStockItems($CategoryID, $CurrCode, $SalesType, $StockID=false) {
+function getStockItems($CategoryID, $CurrCode, $SalesType, $EffectiveDate, $StockID=false) {
global $db, $Today;
+
if ($StockID!==false) {
$WhereClause = "stockmaster.stockid='$StockID' LIMIT 1";
} else {
$WhereClause = "stockmaster.categoryid='$CategoryID' ORDER BY stockmaster.stockid";
}
+
+ $WhereClause = " stockmaster.discontinued!=1 AND " . $WhereClause;
$sql="SELECT stockmaster.stockid,
stockmaster.description,
@@ -307,20 +319,16 @@
ON stockmaster.stockid=prices.stockid
AND prices.currabrev = '" . $CurrCode . "'
AND prices.typeabbrev= '" . $SalesType . "'
- AND prices.startdate <= '" . Date('Y-m-d') . "'
- AND (prices.enddate >= '" . Date('Y-m-d') . "' OR prices.enddate='0000-00-00')
+ AND prices.startdate <= '" . $EffectiveDate . "'
+ AND (prices.enddate >= '" . $EffectiveDate . "' OR prices.enddate='0000-00-00')
AND prices.debtorno=''
WHERE " . $WhereClause;
-
-// if current prices are those with enddate = 0000-00-00 the following line was wrong
-// "AND ('$Today' BETWEEN pr.startdate AND prices.enddate) " .
-
-
+
return DB_query($sql, $db);
}
-function getStockData($StockID, $Currency, $salesType) {
- $result = getStockItems(null, $Currency, $salesType, $StockID);
+function getStockData($StockID, $Currency, $salesType, $EffectiveDate) {
+ $result = getStockItems(null, $Currency, $salesType, $EffectiveDate, $StockID);
return DB_fetch_array($result);
}
@@ -389,14 +397,14 @@
);
}
-function printLabels($dimensions, $lines, $qtyByItem, $Currency, $salesType, $StockIDList) {
+function printLabels($dimensions, $lines, $qtyByItem, $Currency, $salesType, $StockIDList, $EffectiveDate) {
global $pdf, $DecimalPlaces, $Version;
$row = $col = 0;
$DecimalPlaces=getDecimalPlaces($Currency);
foreach ($StockIDList as $StockID=>$on) { // At least there is one item
- $itemData = getStockData($StockID, $Currency, $salesType);
+ $itemData = getStockData($StockID, $Currency, $salesType, $EffectiveDate);
$num=$qtyByItem;
while ($num-- > 0) { // Print $num labels per item
printStockid($itemData, $dimensions, $lines, $Currency, $row, $col);
Modified: trunk/doc/Change.log
===================================================================
--- trunk/doc/Change.log 2011-08-21 07:13:02 UTC (rev 4665)
+++ trunk/doc/Change.log 2011-08-23 06:27:45 UTC (rev 4666)
@@ -1,5 +1,6 @@
webERP Change Log
+23/8/11 Ricard: PDFPrintLabel Does Not display discontinued items and now allows printing of future price labels
21/8/11 Phil: Fixed bug that duplicated purchase order items when more than one item was added to an existing purchase order
21/8/11 Phil: BackupDatabase.php Delete link now deletes any backup files in the company directory in case any were left there before - as this is a serious security issue if files are left on the web-server
19/8/11 Phil: Fixed bug in Stocks.php should have used Date($_SESSION['DefaultDateFormat']) instead of Date('Y-m-d') inside GetPeriod function as pointed out by Ricard
@@ -16,7 +17,7 @@
10/8/11 Phil: POReport.php added link to detail purchase order inquiry
10/8/11 Phil: PO_SelectPurchOrder.php and outstanding purchase order searches now show the delivery date (from the purchase order header) line items may have different delivery dates.
10/8/11 Phil: Stocks.php changing the stock category to one with a different stock account now creates a journal (if stock is linked to GL) to move the cost of the stock from the old GL account to the new GL account
-7/8/11 Phil: SelectProduct.php now disables transactions on items flagged as obsolete (discontinued). Also obsolete items are shown as such in the selection list - suggested by Klaus (opto)
+7/8/11 Phil: SelectProduct.php now disables transactions on items flagged as obsolete (discontinued). /Also obsolete items are shown as such in the selection list - suggested by Klaus (opto)
7/8/11 Ricard: Corrected INNER JOIN ON clause in sql used in InventoryQuantities.php script
7/8/11 Klaus: Added docuwiki links to WikiLinks function in MiscFunctions.php and allow Docuwiki option in SystemParameters.php
6/8/11 Ricard: SalesInquiry.php fix wording of labels to be more consistent with the rest of webERP
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|