|
From: <dai...@us...> - 2011-02-27 09:18:49
|
Revision: 4500
http://web-erp.svn.sourceforge.net/web-erp/?rev=4500&view=rev
Author: daintree
Date: 2011-02-27 09:18:42 +0000 (Sun, 27 Feb 2011)
Log Message:
-----------
various
Modified Paths:
--------------
trunk/GoodsReceived.php
trunk/MRPShortages.php
trunk/PDFQuotation.php
trunk/StockUsage.php
trunk/WorkOrderEntry.php
trunk/doc/Change.log.html
Modified: trunk/GoodsReceived.php
===================================================================
--- trunk/GoodsReceived.php 2011-02-27 04:53:34 UTC (rev 4499)
+++ trunk/GoodsReceived.php 2011-02-27 09:18:42 UTC (rev 4500)
@@ -4,8 +4,6 @@
/* $Revision: 1.44 $ */
-//$PageSecurity = 11; now stored in the database
-
/* Session started in header.inc for password checking and authorisation level check */
include('includes/DefinePOClass.php');
include('includes/DefineSerialItems.php');
@@ -72,6 +70,7 @@
if (!isset($_POST['ProcessGoodsReceived'])) {
if (!isset($_POST['DefaultReceivedDate'])){
+ /* This is meant to be the date the goods are received - it does not make sense to set this to the date that we requested delivery in the purchase order - I have not applied your change here Tim for this reason - let me know if I have it wrong - Phil */
$_POST['DefaultReceivedDate'] = Date($_SESSION['DefaultDateFormat']);
}
Modified: trunk/MRPShortages.php
===================================================================
--- trunk/MRPShortages.php 2011-02-27 04:53:34 UTC (rev 4499)
+++ trunk/MRPShortages.php 2011-02-27 09:18:42 UTC (rev 4500)
@@ -1,20 +1,20 @@
<?php
/*$Id$ */
-
-/* $Revision: 1.7 $ */
// MRPShortages.php - Report of parts with demand greater than supply as determined by MRP
-//$PageSecurity = 2;
+
include('includes/session.inc');
+//ANSI SQL???
$sql='show tables where Tables_in_'.$_SESSION['DatabaseName'].'="mrprequirements"';
+
$result=DB_query($sql,$db);
if (DB_num_rows($result)==0) {
- $title='MRP error';
+ $title=_('MRP error');
include('includes/header.inc');
echo '<br>';
- prnMsg( _('The MRP calculation must be run before you can run this report').'<br>'.
- _('To run the MRP calculation click').' '.'<a href='.$rootpath .'/MRP.php?' . SID .'>'._('here').'</a>', 'error');
+ prnMsg( _('The MRP calculation must be run before you can run this report').'<br />'.
+ _('To run the MRP calculation click').' '.'<a href="'.$rootpath .'/MRP.php">'._('here').'</a>', 'error');
include('includes/footer.inc');
exit;
}
@@ -103,7 +103,14 @@
extcost
HAVING demand > supply
ORDER BY '" . $_POST['Sort']."'";
- $sql = "SELECT stockmaster.stockid,
+
+ if ($_POST['CategoryID'] == 'All'){
+ $SQLCategory = ' ';
+ }else{
+ $SQLCategory = "WHERE stockmaster.categoryid = '" . $_POST['CategoryID'] . "'";
+ }
+
+ $sql = "SELECT stockmaster.stockid,
stockmaster.description,
stockmaster.mbflag,
stockmaster.actualcost,
@@ -117,8 +124,9 @@
stockmaster.overheadcost ) as extcost
FROM stockmaster
LEFT JOIN demandtotal ON stockmaster.stockid = demandtotal.part
- LEFT JOIN supplytotal ON stockmaster.stockid = supplytotal.part
- GROUP BY stockmaster.stockid,
+ LEFT JOIN supplytotal ON stockmaster.stockid = supplytotal.part "
+ . $SQLCategory .
+ "GROUP BY stockmaster.stockid,
stockmaster.description,
stockmaster.mbflag,
stockmaster.actualcost,
@@ -137,9 +145,9 @@
$title = _('MRP Shortages') . ' - ' . _('Problem Report');
include('includes/header.inc');
prnMsg( _('The MRP shortages could not be retrieved by the SQL because') . ' ' . DB_error_msg($db),'error');
- echo "</br><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>';
+ echo '<br/><a href="' .$rootpath .'/index.php">' . _('Back to the menu') . '</a>';
if ($debug==1){
- echo "</br>$sql";
+ echo '<br/>' . $sql;
}
include('includes/footer.inc');
exit;
@@ -149,9 +157,9 @@
$title = _('MRP Shortages') . ' - ' . _('Problem Report');
include('includes/header.inc');
prnMsg( _('No MRP shortages retrieved'), 'warn');
- echo "</br><a href='" .$rootpath .'/index.php?' . SID . "'>" . _('Back to the menu') . '</a>';
+ echo '<br /><a href="' .$rootpath .'/index.php">' . _('Back to the menu') . '</a>';
if ($debug==1){
- echo "</br>$sql";
+ echo "<br />$sql";
}
include('includes/footer.inc');
exit;
@@ -216,28 +224,7 @@
$pdf->addTextWrap(300,$YPos,180,$FontSize,_('Total Extended Shortage:'), 'right');
$DisplayTotalVal = number_format($Total_Shortage,2);
$pdf->addTextWrap(510,$YPos,60,$FontSize,$DisplayTotalVal, 'right');
-/* UldisN
- $pdfcode = $pdf->output();
- $len = strlen($pdfcode);
- if ($len<=20){
- $title = _('Print MRP Shortages Error');
- include('includes/header.inc');
- prnMsg(_('There were no items with demand greater than supply'),'error');
- echo "</br><a href='$rootpath/index.php?" . SID . "'>" . _('Back to the menu') . '</a>';
- include('includes/footer.inc');
- exit;
- } else {
- header('Content-type: application/pdf');
- header("Content-Length: " . $len);
- header('Content-Disposition: inline; filename=MRPShortages.pdf');
- header('Expires: 0');
- header('Cache-Control: private, post-check=0, pre-check=0');
- header('Pragma: public');
-
- $pdf->Output('MRPShortages.pdf', 'I');
- }
-*/
$pdf->OutputD($_SESSION['DatabaseName'] . '_MRPShortages_' . date('Y-m-d').'.pdf');//UldisN
$pdf->__destruct(); //UldisN
} else { /*The option to print PDF was not hit so display form */
@@ -250,14 +237,24 @@
echo '<form action=' . $_SERVER['PHP_SELF'] . " method='post'>";
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
- echo "<table class=selection>";
+ echo '<table class=selection>';
+ echo '</select></td></tr>';
+ echo '<tr><td>' . _('Inventory Category') . ':</td><td><select name="CategoryID">';
+ echo '<option selected value="All">' . _('All Stock Categories');
+ $sql = 'SELECT categoryid,
+ categorydescription
+ FROM stockcategory';
+ $result = DB_query($sql,$db);
+ while ($myrow = DB_fetch_array($result)) {
+ echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' .$myrow['categorydescription'] . '</option>';
+ } //end while loop
echo '<tr><td>' . _('Sort') . ":</td><td><select name='Sort'>";
- echo "<option selected value='extcost'>" . _('Extended Shortage Dollars')."</option>";
- echo "<option value='stockid'>" . _('Part Number')."</option>";
+ echo "<option selected value='extcost'>" . _('Extended Shortage Dollars').'</option>';
+ echo "<option value='stockid'>" . _('Part Number').'</option>';
echo '</select></td></tr>';
echo '<tr><td>' . _('Print Option') . ":</td><td><select name='Fill'>";
- echo "<option selected value='yes'>" . _('Print With Alternating Highlighted Lines')."</option>";
- echo "<option value='no'>" . _('Plain Print')."</option>";
+ echo "<option selected value='yes'>" . _('Print With Alternating Highlighted Lines').'</option>';
+ echo "<option value='no'>" . _('Plain Print').'</option>';
echo '</select></td></tr>';
echo "</table><br><div class='centre'><input type=submit name='PrintPDF' value='" . _('Print PDF') . "'></div>";
Modified: trunk/PDFQuotation.php
===================================================================
--- trunk/PDFQuotation.php 2011-02-27 04:53:34 UTC (rev 4499)
+++ trunk/PDFQuotation.php 2011-02-27 09:18:42 UTC (rev 4500)
@@ -1,10 +1,7 @@
<?php
/* $Id$*/
-/* $Revision: 1.11 $ */
-//$PageSecurity = 2;
-
include('includes/session.inc');
include('includes/SQL_CommonFunctions.inc');
Modified: trunk/StockUsage.php
===================================================================
--- trunk/StockUsage.php 2011-02-27 04:53:34 UTC (rev 4499)
+++ trunk/StockUsage.php 2011-02-27 09:18:42 UTC (rev 4500)
@@ -2,7 +2,6 @@
/* $Id$*/
-//$PageSecurity = 2;
include('includes/session.inc');
@@ -93,32 +92,38 @@
/*HideMovt ==1 if the movement was only created for the purpose of a transaction but is not a physical movement eg. A price credit will create a movement record for the purposes of display on a credit note
but there is no physical stock movement - it makes sense honest ??? */
+
+$CurrentPeriod = GetPeriod(Date($_SESSION['DefaultDateFormat']),$db);
+
if (isset($_POST['ShowUsage'])){
if($_POST['StockLocation']=='All'){
$sql = "SELECT periods.periodno,
periods.lastdate_in_period,
- SUM(-stockmoves.qty) AS qtyused
- FROM stockmoves INNER JOIN periods
- ON stockmoves.prd=periods.periodno
- WHERE (stockmoves.type=10 OR stockmoves.type=11 OR stockmoves.type=28)
- AND stockmoves.hidemovt=0
- AND stockmoves.stockid = '" . $StockID . "'
+ SUM(CASE WHEN (stockmoves.type=10 Or stockmoves.type=11 OR stockmoves.type=28)
+ AND stockmoves.hidemovt=0
+ AND stockmoves.stockid = '" . $StockID . "'
+ THEN -stockmoves.qty ELSE 0 END) AS qtyused
+ FROM periods LEFT JOIN stockmoves
+ ON periods.periodno=stockmoves.prd
+ WHERE periods.periodno <='" . $CurrentPeriod . "'
GROUP BY periods.periodno,
periods.lastdate_in_period
ORDER BY periodno DESC LIMIT " . $_SESSION['NumberOfPeriodsOfStockUsage'];
} else {
$sql = "SELECT periods.periodno,
periods.lastdate_in_period,
- SUM(-stockmoves.qty) AS qtyused
- FROM stockmoves INNER JOIN periods
- ON stockmoves.prd=periods.periodno
- WHERE (stockmoves.type=10 Or stockmoves.type=11 OR stockmoves.type=28)
- AND stockmoves.hidemovt=0
- AND stockmoves.loccode='" . $_POST['StockLocation'] . "'
- AND stockmoves.stockid = '" . $StockID . "'
+ SUM(CASE WHEN (stockmoves.type=10 Or stockmoves.type=11 OR stockmoves.type=28)
+ AND stockmoves.hidemovt=0
+ AND stockmoves.stockid = '" . $StockID . "'
+ AND stockmoves.loccode='" . $_POST['StockLocation'] . "'
+ THEN -stockmoves.qty ELSE 0 END) AS qtyused
+ FROM periods LEFT JOIN stockmoves
+ ON periods.periodno=stockmoves.prd
+ WHERE periods.periodno <='" . $CurrentPeriod . "'
GROUP BY periods.periodno,
periods.lastdate_in_period
ORDER BY periodno DESC LIMIT " . $_SESSION['NumberOfPeriodsOfStockUsage'];
+
}
$MovtsResult = DB_query($sql, $db);
if (DB_error_no($db) !=0) {
Modified: trunk/WorkOrderEntry.php
===================================================================
--- trunk/WorkOrderEntry.php 2011-02-27 04:53:34 UTC (rev 4499)
+++ trunk/WorkOrderEntry.php 2011-02-27 09:18:42 UTC (rev 4500)
@@ -2,8 +2,6 @@
/* $Id$*/
-//$PageSecurity = 10;
-
include('includes/session.inc');
$title = _('Work Order Entry');
include('includes/header.inc');
@@ -252,9 +250,9 @@
if (isset($_POST['submit'])) { //The update button has been clicked
- echo '<div class=centre><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Enter a new work order') . '</a>';
- echo '<br><a href="' . $rootpath . '/SelectWorkOrder.php?' . SID . '">' . _('Select an existing work order') . '</a>';
- echo '<br><a href="'. $rootpath . '/WorkOrderCosting.php?' . SID . '&WO=' . $_REQUEST['WO'] . '">' . _('Go to Costing'). '</a></div>';
+ echo '<div class=centre><a href="' . $_SERVER['PHP_SELF'] .'">' . _('Enter a new work order') . '</a>';
+ echo '<br><a href="' . $rootpath . '/SelectWorkOrder.php">' . _('Select an existing work order') . '</a>';
+ echo '<br><a href="'. $rootpath . '/WorkOrderCosting.php&WO=' . $_REQUEST['WO'] . '">' . _('Go to Costing'). '</a></div>';
$Input_Error = false; //hope for the best
for ($i=1;$i<=$_POST['NumberOfOutputs'];$i++){
@@ -659,9 +657,6 @@
echo "<script>defaultControl(document.forms[0].OutputQty".$_GET['Line'].");</script>";
}
-
echo '</form>';
-
include('includes/footer.inc');
-
?>
\ No newline at end of file
Modified: trunk/doc/Change.log.html
===================================================================
--- trunk/doc/Change.log.html 2011-02-27 04:53:34 UTC (rev 4499)
+++ trunk/doc/Change.log.html 2011-02-27 09:18:42 UTC (rev 4500)
@@ -1,5 +1,6 @@
<p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p>
<p>
+<p>27/2/11: Phil/Tim/Peter launchpad added category option for MRPShortages.php </p>
<p>27/2/11: Phil fix units deletion issue reported by Exson in UnitsOfMeasure.php script - checked for none existant units field in contracts table - removed the check</p>
<p>22/2/11: Phil fix PDFTopItems.php for changed variable names - now using CamelCase tried to rework to conform</p>
<p>22/2/11: Phil remove options for PDFLanguage that are not unique in WWW_Users.php - make it default to the users settings in the SESSION for UserSettings.php</p>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|