|
From: <dai...@us...> - 2011-10-14 06:11:21
|
Revision: 4720
http://web-erp.svn.sourceforge.net/web-erp/?rev=4720&view=rev
Author: daintree
Date: 2011-10-14 06:11:13 +0000 (Fri, 14 Oct 2011)
Log Message:
-----------
number_formats
Modified Paths:
--------------
trunk/SelectRecurringSalesOrder.php
trunk/SelectSupplier.php
trunk/ShipmentCosting.php
trunk/SpecialOrder.php
trunk/StockAdjustments.php
trunk/StockCategories.php
trunk/StockCheck.php
trunk/includes/DefineSpecialOrderClass.php
Modified: trunk/SelectRecurringSalesOrder.php
===================================================================
--- trunk/SelectRecurringSalesOrder.php 2011-10-14 06:08:10 UTC (rev 4719)
+++ trunk/SelectRecurringSalesOrder.php 2011-10-14 06:11:13 UTC (rev 4720)
@@ -10,8 +10,10 @@
echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/customer.png" title="' .
_('Inventory Items') . '" alt="" />' . ' ' . $title . '</p>';
-echo '<table class="selection"><tr><td>';
-echo _('Select recurring order templates for delivery from:') . ' </td><td>' . '<select name="StockLocation">';
+echo '<table class="selection">
+ <tr>
+ <td>' . _('Select recurring order templates for delivery from:') . ' </td>
+ <td>' . '<select name="StockLocation">';
$sql = "SELECT loccode, locationname FROM locations";
@@ -31,9 +33,11 @@
}
}
-echo '</select></td></tr></table>';
+echo '</select></td>
+ </tr>
+ </table>';
-echo '<br /><div class=centre><input type="submit" name="SearchRecurringOrders" value="' . _('Search Recurring Orders') . '"></div>';
+echo '<br /><div class=centre><input type="submit" name="SearchRecurringOrders" value="' . _('Search Recurring Orders') . '" /></div>';
if (isset($_POST['SearchRecurringOrders'])){
@@ -78,15 +82,15 @@
<table cellpadding="2" colspan="7" width="90%" class="selection">';
$tableheader = '<tr>
- <th>' . _('Modify') . '</th>
- <th>' . _('Customer') . '</th>
- <th>' . _('Branch') . '</th>
- <th>' . _('Cust Order') . ' #</th>
- <th>' . _('Last Recurrence') . '</th>
- <th>' . _('End Date') . '</th>
- <th>' . _('Times p.a.') . '</th>
- <th>' . _('Order Total') . '</th>
- </tr>';
+ <th>' . _('Modify') . '</th>
+ <th>' . _('Customer') . '</th>
+ <th>' . _('Branch') . '</th>
+ <th>' . _('Cust Order') . ' #</th>
+ <th>' . _('Last Recurrence') . '</th>
+ <th>' . _('End Date') . '</th>
+ <th>' . _('Times p.a.') . '</th>
+ <th>' . _('Order Total') . '</th>
+ </tr>';
echo $tableheader;
@@ -109,23 +113,23 @@
$FormatedOrderValue = locale_number_format($myrow['ordervalue'],$myrow['currdecimalplaces']);
printf('<td><a href="%s">%s</a></td>
- <td>%s</td>
- <td>%s</td>
- <td>%s</td>
- <td>%s</td>
- <td>%s</td>
- <td>%s</td>
- <td class=number>%s</td>
- </tr>',
- $ModifyPage,
- $myrow['recurrorderno'],
- $myrow['name'],
- $myrow['brname'],
- $myrow['customerref'],
- $FormatedLastRecurrence,
- $FormatedStopDate,
- $myrow['frequency'],
- $FormatedOrderValue);
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td class="number">%s</td>
+ </tr>',
+ $ModifyPage,
+ $myrow['recurrorderno'],
+ $myrow['name'],
+ $myrow['brname'],
+ $myrow['customerref'],
+ $FormatedLastRecurrence,
+ $FormatedStopDate,
+ $myrow['frequency'],
+ $FormatedOrderValue);
$j++;
If ($j == 12){
Modified: trunk/SelectSupplier.php
===================================================================
--- trunk/SelectSupplier.php 2011-10-14 06:08:10 UTC (rev 4719)
+++ trunk/SelectSupplier.php 2011-10-14 06:11:13 UTC (rev 4720)
@@ -145,11 +145,11 @@
echo '<br />
<table width=90% colspan=2 cellpadding=4>
<tr>
- <th width=33%>' . _('Supplier Inquiries') . '</th>
- <th width=33%>' . _('Supplier Transactions') . '</th>
- <th width=33%>' . _('Supplier Maintenance') . '</th>
+ <th width="33%">' . _('Supplier Inquiries') . '</th>
+ <th width="33%">' . _('Supplier Transactions') . '</th>
+ <th width="33%">' . _('Supplier Maintenance') . '</th>
</tr>';
- echo '<tr><td valign=top class="select">'; /* Inquiry Options */
+ echo '<tr><td valign="top" class="select">'; /* Inquiry Options */
echo '<a href="' . $rootpath . '/SupplierInquiry.php?SupplierID=' . $_SESSION['SupplierID'] . '">' . _('Supplier Account Inquiry') . '</a>
<br />
<br />';
@@ -180,14 +180,14 @@
echo '<br />';
echo '<table width=90% colspan=2 cellpadding=4>
<tr>
- <th width=33%>' . _('Supplier Inquiries') . '</th>
- <th width=33%>' . _('Supplier Transactions') . '</th>
- <th width=33%>' . _('Supplier Maintenance') . '</th>
+ <th width="33%">' . _('Supplier Inquiries') . '</th>
+ <th width="33%">' . _('Supplier Transactions') . '</th>
+ <th width="33%">' . _('Supplier Maintenance') . '</th>
</tr>';
echo '<tr>
- <td valign=top class="select"></td>
- <td valign=top class="select"></td>
- <td valign=top class="select">'; /* Supplier Maintenance */
+ <td valign="top" class="select"></td>
+ <td valign="top" class="select"></td>
+ <td valign="top" class="select">'; /* Supplier Maintenance */
echo '<a href="' . $rootpath . '/Suppliers.php">' . _('Add a New Supplier') . '</a><br />';
echo '</td>
</tr>
Modified: trunk/ShipmentCosting.php
===================================================================
--- trunk/ShipmentCosting.php 2011-10-14 06:08:10 UTC (rev 4719)
+++ trunk/ShipmentCosting.php 2011-10-14 06:11:13 UTC (rev 4720)
@@ -11,7 +11,7 @@
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') .
'" alt="" />' . ' ' . $title . '</p>';
-if (isset($_GET['NewShipment']) and $_GET['NewShipment']=='Yes'){
+if (isset($_GET['NewShipment']) AND $_GET['NewShipment']=='Yes'){
unset($_SESSION['Shipment']->LineItems);
unset($_SESSION['Shipment']);
}
@@ -47,7 +47,7 @@
$HeaderData = DB_fetch_array($GetShiptHdrResult);
echo '<br />';
echo '<table class="selection">';
-echo '<tr><th colspan=4><font size=3 color=navy>'._('Shipment Details').'</font></th></tr>';
+echo '<tr><th colspan="4"><font size="3" color="navy">'._('Shipment Details').'</font></th></tr>';
echo '<tr>
<td><b>'. _('Shipment') .': </td>
<td><b>' . $_GET['SelectedShipment'] . '</b></td>
@@ -260,8 +260,7 @@
/*So we need to write off some of the variance to variances and
only the balance of the quantity in stock to go to stock value */
- $WriteOffToVariances = ($myrow['totqtyinvoiced'] - $TotalQuantityOnHand)
- * ($ItemShipmentCost - $StdCostUnit);
+ $WriteOffToVariances = ($myrow['totqtyinvoiced'] - $TotalQuantityOnHand) * ($ItemShipmentCost - $StdCostUnit);
}
@@ -286,7 +285,7 @@
'" . $PeriodNo . "',
'" . $StockGLCodes['purchpricevaract'] . "',
'" . $myrow['itemcode'] . ' ' . _('shipment cost') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['deicmalplaces']) . _('shipment quantity > stock held - variance write off') . "',
- " . filter_number_format($WriteOffToVariances) . ")";
+ " . $WriteOffToVariances . ")";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL entry for the shipment variance posting for'). ' ' . $myrow['itemcode'] . ' '. _('could not be inserted into the database because');
$result = DB_query($sql,$db, $ErrMsg,'',TRUE);
@@ -306,7 +305,7 @@
'" . $PeriodNo . "',
'" . $StockGLCodes['stockact'] . "',
'" . $myrow['itemcode'] . ' ' . _('shipment avg cost adjt') . "',
- '" . filter_number_format($myrow['totqtyinvoiced'] *($ItemShipmentCost - $StdCostUnit)- $WriteOffToVariances) . "')";
+ '" . ($myrow['totqtyinvoiced'] *($ItemShipmentCost - $StdCostUnit)- $WriteOffToVariances) . "')";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL entry for the shipment average cost adjustment for'). ' ' . $myrow['itemcode'] . ' '. _('could not be inserted into the database because');
$result = DB_query($sql,$db, $ErrMsg,'',TRUE);
@@ -329,14 +328,23 @@
$CostIncrement = ($myrow['totqtyinvoiced'] *($ItemShipmentCost - $StdCostUnit) - $WriteOffToVariances) / $TotalQuantityOnHand;
- $sql = "UPDATE stockmaster SET lastcost=materialcost+overheadcost+labourcost,
- materialcost=materialcost+" . filter_number_format($CostIncrement) . "
- WHERE stockid='" . $myrow['itemcode'] . "'";
+ $sql = "UPDATE stockmaster
+ SET lastcost=materialcost+overheadcost+labourcost,
+ materialcost=materialcost+" . $CostIncrement . ",
+ lastcostupdate='" . Date('Y-m-d') . "'
+ WHERE stockid='" . $myrow['itemcode'] . "'";
+
$Result = DB_query($sql, $db, $ErrMsg, $DbgMsg,'',TRUE);
+
} else {
- $sql = "UPDATE stockmaster SET lastcost=materialcost+overheadcost+labourcost,
- materialcost='" . filter_number_format($ItemShipmentCost) . "' WHERE stockid='" . $myrow['itemcode'] . "'";
+ $sql = "UPDATE stockmaster
+ SET lastcost=materialcost+overheadcost+labourcost,
+ materialcost='" . $ItemShipmentCost . "',
+ lastcostupdate='" . Date('Y-m-d') . "'
+ WHERE stockid='" . $myrow['itemcode'] . "'";
+
$Result = DB_query($sql, $db, $ErrMsg, $DbgMsg,'',TRUE);
+
}
/* End of Weighted Average Costing Code */
@@ -356,7 +364,9 @@
'" . Date('Y-m-d') . "',
'" . $PeriodNo . "',
'" . $StockGLCodes['purchpricevaract'] . "',
- '" . $myrow['itemcode'] . ' ' . _('shipment cost') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' x ' . _('Qty recd') .' ' . $myrow['totqtyrecd'] . "', " . filter_number_format(-$Variance * $myrow['totqtyrecd']) . ")";
+ '" . $myrow['itemcode'] . ' ' . _('shipment cost') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' x ' . _('Qty recd') .' ' . $myrow['totqtyrecd'] . "',
+ " . -$Variance * $myrow['totqtyrecd'] . ")";
+
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The Positive GL entry for the shipment variance posting for'). ' ' . $myrow['itemcode'] . ' '. _('could not be inserted into the database because');
$result = DB_query($sql,$db, $ErrMsg,'',TRUE);
}
@@ -378,7 +388,7 @@
'" . $PeriodNo . "',
'" . $_SESSION['CompanyRecord']['grnact'] . "',
'" . $myrow['itemcode'] . ' ' ._('shipment cost') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' x ' . _('Qty invoiced') . ' ' . $myrow['totqtyinvoiced'] . "',
- " . filter_number_format($Variance * $myrow['totqtyinvoiced']) . ")";
+ " . ($Variance * $myrow['totqtyinvoiced']) . ")";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The credit GL entry for the shipment variance posting for') . ' ' . $myrow['itemcode'] . ' ' . _('could not be inserted because');
@@ -388,7 +398,9 @@
if ( $_POST['UpdateCost'] == 'Yes' ){ /*Only ever a standard costing option
Weighted average costing implies cost updates taking place automatically */
- $QOHResult = DB_query("SELECT SUM(quantity) FROM locstock WHERE stockid ='" . $myrow['itemcode'] . "'",$db);
+ $QOHResult = DB_query("SELECT SUM(quantity)
+ FROM locstock
+ WHERE stockid ='" . $myrow['itemcode'] . "'",$db);
$QOHRow = DB_fetch_row($QOHResult);
$QOH=$QOHRow[0];
@@ -411,7 +423,7 @@
'" . $PeriodNo . "',
'" . $StockGLCodes['adjglact'] . "',
'" . _('Shipment of') . ' ' . $myrow['itemcode'] . " " . _('cost was') . ' ' . $StdCostUnit . ' ' . _('changed to') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' x ' . _('QOH of') . ' ' . $QOH . "',
- " . filter_number_format(-$ValueOfChange) . ")";
+ " . -$ValueOfChange . ")";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL credit for the shipment stock cost adjustment posting could not be inserted because'). ' ' . DB_error_msg($db);
@@ -430,7 +442,8 @@
'" . $PeriodNo . "',
'" . $StockGLCodes['stockact'] . "',
'" . _('Shipment of') . ' ' . $myrow['itemcode'] . ' ' . _('cost was') . ' ' . $StdCostUnit . ' ' . _('changed to') . ' ' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' x ' . _('QOH of') . ' ' . $QOH . "',
- " . filter_number_format($ValueOfChange) . ")";
+ " . $ValueOfChange . ")";
+
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL debit for stock cost adjustment posting could not be inserted because') .' '. DB_error_msg($db);
$Result = DB_query($SQL,$db, $ErrMsg,'',TRUE);
@@ -438,10 +451,11 @@
} /*end of GL entries for a standard cost update */
/* Only the material cost is important for imported items */
- $sql = "UPDATE stockmaster SET materialcost=" . filter_number_format($ItemShipmentCost) . ",
+ $sql = "UPDATE stockmaster SET materialcost=" . $ItemShipmentCost . ",
labourcost=0,
overheadcost=0,
- lastcost='" . filter_number_format($StdCostUnit) . "'
+ lastcost='" . $StdCostUnit . "',
+ lastcostupdate='" . Date('Y-m-d') . "'
WHERE stockid='" . $myrow['itemcode'] . "'";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The shipment cost details for the stock item could not be updated because'). ': ' . DB_error_msg($db);
@@ -455,8 +469,8 @@
/* Item / Qty Inv/ FX price/ Local Val/ Portion of chgs/ Shipt Cost/ Std Cost/ Variance/ Var % */
echo '<td>' . $myrow['itemcode'] . ' - ' . $myrow['itemdescription'] . '</td>
- <td class="number">' . locale_number_format($myrow['totqtyinvoiced'],2) . '</td>
- <td class="number">' . locale_number_format($myrow['totqtyrecd'],2) . '</td>
+ <td class="number">' . locale_number_format($myrow['totqtyinvoiced'],'Variable') . '</td>
+ <td class="number">' . locale_number_format($myrow['totqtyrecd'],'Variable') . '</td>
<td class="number">' . locale_number_format($ItemCharges,$_SESSION['CompanyRecord']['decimalplaces']) . '</td>
<td class="number">' . locale_number_format($PortionOfCharges,$_SESSION['CompanyRecord']['decimalplaces']) . '</td>
<td class="number">' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td>
@@ -465,20 +479,24 @@
<td class="number">' . $VariancePercentage . '%</td></tr>';
}
}
-echo '<tr><td colspan=3 class="number"><font color=BLUE><b>'. _('Total Shipment Charges'). '</b></font></td>
- <td class="number">' . locale_number_format($TotalInvoiceValueOfShipment,$_SESSION['CompanyRecord']['decimalplaces']) . '</td>
- <td class="number">' . locale_number_format($TotalCostsToApportion,$_SESSION['CompanyRecord']['decimalplaces']) .'</td></tr>';
+echo '<tr>
+ <td colspan=3 class="number"><font color=BLUE><b>'. _('Total Shipment Charges'). '</b></font></td>
+ <td class="number">' . locale_number_format($TotalInvoiceValueOfShipment,$_SESSION['CompanyRecord']['decimalplaces']) . '</td>
+ <td class="number">' . locale_number_format($TotalCostsToApportion,$_SESSION['CompanyRecord']['decimalplaces']) .'</td>
+ </tr>';
-echo '<tr><td colspan=6 class="number">' . _('Total Value of all variances on this shipment') . '</td>
- <td class="number">' . locale_number_format($TotalShiptVariance,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>';
+echo '<tr>
+ <td colspan="6" class="number">' . _('Total Value of all variances on this shipment') . '</td>
+ <td class="number">' . locale_number_format($TotalShiptVariance,$_SESSION['CompanyRecord']['decimalplaces']) . '</td>
+ </tr>';
echo '</table>';
echo '<br />
- <table colspan=2 width=95%>
+ <table colspan="2" width="95%">
<tr>
- <td valign=top>'; // put this shipment charges side by side in a table (major table 2 cols)
+ <td valign="top">'; // put this shipment charges side by side in a table (major table 2 cols)
$sql = "SELECT suppliers.suppname,
supptrans.suppreference,
@@ -505,7 +523,9 @@
$ChargesResult = DB_query($sql,$db);
echo '<table cellpadding="2" colspan="6" class="selection">';
-echo '<tr><th colspan=6><font color="navy" size="3">' . _('Shipment Charges Against Products'). '</font></th></tr>';
+echo '<tr>
+ <th colspan="6"><font color="navy" size="3">' . _('Shipment Charges Against Products'). '</font></th>
+ </tr>';
$TableHeader = '<tr>
<th>'. _('Supplier'). '</th>
@@ -540,13 +560,16 @@
<td>' . $myrow['suppreference'] . '</td>
<td>' . ConvertSQLDate($myrow['trandate']) . '</td>
<td>' . $myrow['stockid'] . '</td>
- <td class="number">' . locale_number_format($myrow['value'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>';
+ <td class="number">' . locale_number_format($myrow['value'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td>
+ </tr>';
$TotalItemShipmentChgs += $myrow['value'];
}
-echo '<tr><td colspan=5 class="number"><font color=BLUE><b>'. _('Total Charges Against Shipment Items'). ':</b></font></td>
- <td class="number">' . locale_number_format($TotalItemShipmentChgs,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>';
+echo '<tr>
+ <td colspan="5" class="number"><font color="blue"><b>'. _('Total Charges Against Shipment Items'). ':</b></font></td>
+ <td class="number">' . locale_number_format($TotalItemShipmentChgs,$_SESSION['CompanyRecord']['decimalplaces']) . '</td>
+ </tr>';
echo '</table>';
@@ -577,7 +600,9 @@
$ChargesResult = DB_query($sql,$db);
echo '<table cellpadding="2" colspan="5" class="selection">';
-echo '<tr><th colspan="6"><font color="navy" size="3">'._('General Shipment Charges').'</font></th></tr>';
+echo '<tr>
+ <th colspan="6"><font color="navy" size="3">'._('General Shipment Charges').'</font></th>
+ </tr>';
$TableHeader = '<tr>
<th>'. _('Supplier'). '</th>
@@ -621,13 +646,15 @@
echo '</table>';
-echo '</td></tr></table>'; //major table close
+echo '</td>
+ </tr>
+ </table>'; //major table close
if ( isset($_GET['Close'])) { /* Only an opportunity to confirm user wishes to close */
// if the page was called with Close=Yes then show options to confirm OK to c
echo '<div class="centre">
- <form method="POST" action="' . $_SERVER['PHP_SELF'] .'?SelectedShipment=' . $_GET['SelectedShipment'] . '">';
+ <form method="post" action="' . $_SERVER['PHP_SELF'] .'?SelectedShipment=' . $_GET['SelectedShipment'] . '">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
if ($_SESSION['WeightedAverageCosting']==0){
@@ -637,8 +664,11 @@
<option value="No">'. _('No') . '</option>
</select>';
}
- echo '<br /><br /><input type=submit name="Close" value="'. _('Confirm OK to Close'). '" />';
- echo '</form></div>';
+ echo '<br />
+ <br />
+ <input type=submit name="Close" value="'. _('Confirm OK to Close'). '" />
+ </form>
+ </div>';
}
if ( isset($_POST['Close']) ){ /* OK do the shipment close journals */
Modified: trunk/SpecialOrder.php
===================================================================
--- trunk/SpecialOrder.php 2011-10-14 06:08:10 UTC (rev 4719)
+++ trunk/SpecialOrder.php 2011-10-14 06:11:13 UTC (rev 4720)
@@ -28,7 +28,10 @@
}
if (!isset($_SESSION['CustomerID']) OR $_SESSION['CustomerID']==""){
- echo '<br /><br />' . _('To set up a special') . ', ' . _('the customer must first be selected from the Select Customer page') . '<br /><a href="' . $rootpath . '/SelectCustomer.php">' . _('Select the customer now') . '</a>';
+ echo '<br />
+ <br />' . _('To set up a special') . ', ' . _('the customer must first be selected from the Select Customer page') . '
+ <br />
+ <a href="' . $rootpath . '/SelectCustomer.php">' . _('Select the customer now') . '</a>';
include('includes/footer.inc');
exit;
}
@@ -109,11 +112,13 @@
}
echo '<div class="centre">';
if (!isset($_SESSION['SPL']->BranchCode)){
- echo '<br /><font size="4" color="blue">' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ')';
+ echo '<br />
+ <font size="4" color="blue">' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ')';
} else {
- echo '<br /><font size="4" color="blue">' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ') - ' . _('delivered to') . ' ' . $_SESSION['SPL']->BranchName . ' ' . _('branch');
+ echo '<br />
+ <font size="4" color="blue">' . _('Purchase from') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('in') . ' ' . $_SESSION['SPL']->SuppCurrCode . ' ' . _('for') . ' ' . $_SESSION['SPL']->CustomerName . ' (' . $_SESSION['SPL']->CustCurrCode . ') - ' . _('delivered to') . ' ' . $_SESSION['SPL']->BranchName . ' ' . _('branch');
}
-echo '</div></font>';
+echo '</font></div>';
/*if the branch details and delivery details have not been entered then select them from the list */
if (!isset($_SESSION['SPL']->BranchCode)){
@@ -129,12 +134,15 @@
echo '<br />
<br />' . _('Select the customer branch to deliver the special to from the list below');
- echo '</div><br /><table class="selection">';
+ echo '</div>
+ <br />
+ <table class="selection">';
- $tableheader = '<tr><th>' ._('Code') . '</th>
+ $TableHeader = '<tr>
+ <th>' ._('Code') . '</th>
<th>' . _('Branch Name') . '</th>
</tr>';
- echo $tableheader;
+ echo $TableHeader;
$j = 1;
$k = 0; //row counter to determine background colour
@@ -240,13 +248,22 @@
}
}
-if (isset($_POST['StkLocation'])) {$_SESSION['SPL']->StkLocation = $_POST['StkLocation'];}
-if (isset($_POST['Initiator'])) {$_SESSION['SPL']->Initiator = $_POST['Initiator'];}
-if (isset($_POST['QuotationRef'])) {$_SESSION['SPL']->QuotationRef = $_POST['QuotationRef'];}
-if (isset($_POST['Comments'])) {$_SESSION['SPL']->Comments = $_POST['Comments'];}
-if (isset($_POST['CustRef'])) {$_SESSION['SPL']->CustRef = $_POST['CustRef'];}
+if (isset($_POST['StkLocation'])) {
+ $_SESSION['SPL']->StkLocation = $_POST['StkLocation'];
+}
+if (isset($_POST['Initiator'])) {
+ $_SESSION['SPL']->Initiator = $_POST['Initiator'];
+}
+if (isset($_POST['QuotationRef'])) {
+ $_SESSION['SPL']->QuotationRef = $_POST['QuotationRef'];
+}
+if (isset($_POST['Comments'])) {
+ $_SESSION['SPL']->Comments = $_POST['Comments'];
+}
+if (isset($_POST['CustRef'])) {
+ $_SESSION['SPL']->CustRef = $_POST['CustRef'];
+}
-
if (isset($_POST['Commit'])){ /*User wishes to commit the order to the database */
/*First do some validation
@@ -267,7 +284,6 @@
prnMsg( _('The person entering this order must be specified in the initiator field') . ' - ' . _('a blank initiator is not allowed'),'error');
}
-
if ($InputError!=1){
if (IsEmailAddress($_SESSION['UserEmail'])){
@@ -287,7 +303,7 @@
$AuthRow=DB_fetch_array($AuthResult);
if (DB_num_rows($AuthResult) > 0 AND $AuthRow['authlevel'] > $_SESSION['SPL']->Order_Value()) { //user has authority to authrorise as well as create the order
- $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created and Authorised by') . $UserDetails . '<br />'.$_SESSION['SPL']->StatusComments.'<br />';
+ $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created and Authorised by') . $UserDetails . '<br />';
$_SESSION['SPL']->AllowPrintPO=1;
$_SESSION['SPL']->Status = 'Authorised';
} else { // no authority to authorise this order
@@ -297,11 +313,7 @@
$AuthMessage = _('You can only authorise up to').' '.$_SESSION['SPL']->SuppCurrCode.' '.$AuthRow['authlevel'] .'.<br />';
}
- prnMsg( _('You do not have permission to authorise this purchase order').'.<br />'. _('This order is for').' '.
- $_SESSION['SPL']->SuppCurrCode . ' '. $_SESSION['SPL']->Order_Value() .'. '.
- $AuthMessage .
- _('If you think this is a mistake please contact the systems administrator') . '<br />'.
- _('The order will be created with a status of pending and will require authorisation'), 'warn');
+ prnMsg( _('You do not have permission to authorise this purchase order').'.<br />'. _('This order is for').' '. $_SESSION['SPL']->SuppCurrCode . ' '. $_SESSION['SPL']->Order_Value() .'. '. $AuthMessage . _('If you think this is a mistake please contact the systems administrator') . '<br />'. _('The order will be created with a status of pending and will require authorisation'), 'warn');
$StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . $UserDetails;
$_SESSION['SPL']->Status = 'Pending';
@@ -373,7 +385,6 @@
$_SESSION['SPL']->PurchOrderNo = GetNextTransNo(18, $db);
-
/*Insert the purchase order detail records */
foreach ($_SESSION['SPL']->LineItems as $SPLLine) {
@@ -448,8 +459,8 @@
'" . $OrderDate . "',
'" . DB_escape_string($SPLLine->ItemDescription) . "',
'" . $GLCode . "',
- '" . filter_number_format($SPLLine->Cost) . "',
- '" . filter_number_format($SPLLine->Quantity) . "')";
+ '" . $SPLLine->Cost . "',
+ '" . $SPLLine->Quantity . "')";
$ErrMsg = _('One of the purchase order detail records could not be inserted into the database because');
$DbgMsg = _('The SQL statement used to insert the purchase order detail record and failed was');
@@ -538,14 +549,13 @@
$LineItemsSQL = $StartOf_LineItemsSQL . ",
'" . DB_escape_string($StockItem->PartCode) . "',
- '". filter_number_format($StockItem->Price) . "',
- '" . filter_number_format($StockItem->Quantity) . "',
+ '". $StockItem->Price . "',
+ '" . $StockItem->Quantity . "',
'" . $StockItem->LineNo . "')";
$Ins_LineItemResult = DB_query($LineItemsSQL,$db,$ErrMsg);
} /* inserted line items into sales order details */
- unset ($_SESSION['SPL']);
prnMsg(_('Purchase Order') . ' ' . $_SESSION['SPL']->PurchOrderNo . ' ' . _('on') . ' ' . $_SESSION['SPL']->SupplierName . ' ' . _('has been created') .'<br/>' . _('Sales Order Number') . ' ' . $OrderNo . ' ' . _('has been entered') . '. <br/>' . _('Orders created on a cash sales account may need the delivery details for the order to be modified') . '<br />' . _('A freight charge may also be applicable'),'success');
if (count($_SESSION['AllowedPageSecurityTokens'])>1){
@@ -557,10 +567,9 @@
}
$Result = DB_Txn_Commit($db);
-
- unset($_SESSION['SPL']); /*Clear the PO data to allow a newy to be input*/
- echo '<br /><br /><a href="' . $rootpath . '/SpecialOrder.php">' . _('Enter A New Special Order') . '</a>';
- exit;
+ unset ($_SESSION['SPL']);
+ echo '<br /><br /><a href="' . $rootpath . '/SpecialOrder.php">' . _('Enter A New Special Order') . '</a>';
+ exit;
} /*end if there were no input errors trapped */
} /* end of the code to do transfer the SPL object to the database - user hit the place Order*/
@@ -586,8 +595,11 @@
echo '<td>' . _('Initiated By') . ': <input type="text" name="Initiator" size="11" maxlength="10" value="' . $_SESSION['SPL']->Initiator . '" /></td>
<td>' . _('Special Ref') . ': <input type="text" name="QuotationRef" size="16" maxlength="15" value="' . $_SESSION['SPL']->QuotationRef . '" /></td>
- <td>' . _('Customer Ref') . ': <input type="text" name="CustRef" size="11" maxlength="10" value="' . $_SESSION['SPL']->CustRef . '" /></td></tr>
- <tr><td valign="top" colspan="2">' . _('Comments') . ': <textarea name="Comments" cols="70" rows="2">' . $_SESSION['SPL']->Comments . '</textarea></td></tr>
+ <td>' . _('Customer Ref') . ': <input type="text" name="CustRef" size="11" maxlength="10" value="' . $_SESSION['SPL']->CustRef . '" /></td>
+ </tr>
+ <tr>
+ <td valign="top" colspan="2">' . _('Comments') . ': <textarea name="Comments" cols="70" rows="2">' . $_SESSION['SPL']->Comments . '</textarea></td>
+ </tr>
</table>
<hr>'; /* Rule off the header */
@@ -622,7 +634,7 @@
$DisplayLineCostTotalCurr = locale_number_format($LineCostTotal/$_SESSION['SPL']->SuppCurrExRate,$_SESSION['CompanyRecord']['decimalplaces']);
$DisplayCost = locale_number_format($SPLLine->Cost,$_SESSION['SPL']->SuppCurrDecimalPlaces);
$DisplayPrice = locale_number_format($SPLLine->Price,$_SESSION['SPL']->CustCurrDecimalPlaces);
- $DisplayQuantity = locale_number_format($SPLLine->Quantity,2);
+ $DisplayQuantity = locale_number_format($SPLLine->Quantity,'Variable');
if ($k==1){
echo '<tr class="EvenTableRows">';
@@ -647,7 +659,7 @@
$DisplayTotal = locale_number_format($_SESSION['SPL']->total,$_SESSION['SPL']->CustCurrDecimalPlaces);
echo '<tr>
- <td colspan=8 class="number">' . _('TOTAL Excl Tax') . '</td>
+ <td colspan="8" class="number">' . _('TOTAL Excl Tax') . '</td>
<td class="number"><b>' . $DisplayTotal . '</b></td>
</tr>
</table>';
@@ -663,11 +675,14 @@
if (!isset($_POST['ItemDescription'])) {
$_POST['ItemDescription']='';
}
-echo '<tr><td>' . _('Ordered item Description') . ':</td>
- <td><input type="text" name="ItemDescription" size="40" maxlength="40" value="' . $_POST['ItemDescription'] . '" /></td></tr>';
+echo '<tr>
+ <td>' . _('Ordered item Description') . ':</td>
+ <td><input type="text" name="ItemDescription" size="40" maxlength="40" value="' . $_POST['ItemDescription'] . '" /></td>
+ </tr>';
-echo '<tr><td>' . _('Category') . ':</td>
+echo '<tr>
+ <td>' . _('Category') . ':</td>
<td><select name="StkCat">';
$sql = "SELECT categoryid, categorydescription FROM stockcategory";
@@ -682,23 +697,33 @@
echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>';
}
}
-echo '</select></td></tr>';
+echo '</select></td>
+ </tr>';
/*default the order quantity to 1 unit */
$_POST['Qty'] = 1;
-echo '<tr><td>' . _('Order Quantity') . ':</td>
- <td><input type="text" class="number" size="7" maxlength="6" name="Qty" value="' . $_POST['Qty'] . '" /></td>
+echo '<tr>
+ <td>' . _('Order Quantity') . ':</td>
+ <td><input type="text" class="number" size="7" maxlength="6" name="Qty" value="' . locale_number_format($_POST['Qty'],'Variable') . '" /></td>
</tr>';
-if (!isset($_POST['Cost'])) {$_POST['Cost']='';}
-echo '<tr><td>' . _('Unit Cost') . ':</td>
- <td><input type="text" class="number" size="15" maxlength="14" name="Cost" value="' . $_POST['Cost'] . '" /></td></tr>';
+if (!isset($_POST['Cost'])) {
+ $_POST['Cost']=0;
+}
+echo '<tr>
+ <td>' . _('Unit Cost') . ':</td>
+ <td><input type="text" class="number" size="15" maxlength="14" name="Cost" value="' . locale_number_format($_POST['Cost'],$_SESSION['SPL']->SuppCurrDecimalPlaces) . '" /></td>
+ </tr>';
-if (!isset($_POST['Price'])) { $_POST['Price']='';}
-echo '<tr><td>' . _('Unit Price') . ':</td>
- <td><input type="text" class="number" size=15 maxlength=14 name="Price" value="' . $_POST['Price'] . '" /></td></tr>';
+if (!isset($_POST['Price'])) {
+ $_POST['Price']=0;
+}
+echo '<tr>
+ <td>' . _('Unit Price') . ':</td>
+ <td><input type="text" class="number" size="15" maxlength="14" name="Price" value="' . locale_number_format($_POST['Price'],$_SESSION['SPL']->CustCurrDecimalPlaces) . '" /></td>
+ </tr>';
/*Default the required delivery date to tomorrow as a starting point */
$_POST['ReqDelDate'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m'),Date('d')+1,Date('y')));
@@ -710,11 +735,16 @@
echo '</table>'; /* end of main table */
-echo '<div class="centre"><input type="submit" name="EnterLine" value="' . _('Add Item to Order') . '" />';
+echo '<div class="centre">
+ <input type="submit" name="EnterLine" value="' . _('Add Item to Order') . '" />
+ <br />
+ <br />
+ <input type="submit" name="Cancel" value="' . _('Start Again') . '">
+ <br />
+ <br />
+ <input type="submit" name="Commit" value="' . _('Process This Order') . '">
+ </div>
+ </form>';
-echo '<br /><br /><input type="submit" name="Cancel" value="' . _('Start Again') . '">';
-echo '<br /><br /><input type="submit" name="Commit" value="' . _('Process This Order') . '">';
-
-echo '</div></form>';
include('includes/footer.inc');
?>
\ No newline at end of file
Modified: trunk/StockAdjustments.php
===================================================================
--- trunk/StockAdjustments.php 2011-10-14 06:08:10 UTC (rev 4719)
+++ trunk/StockAdjustments.php 2011-10-14 06:11:13 UTC (rev 4720)
@@ -41,7 +41,9 @@
}
$NewAdjustment = true;
} elseif (isset($_POST['StockID'])){
- if(isset($_POST['StockID']) AND $_POST['StockID'] != $_SESSION['Adjustment']->StockID){
+ if(isset($_POST['StockID'])
+ AND $_POST['StockID'] != $_SESSION['Adjustment']->StockID){
+
$NewAdjustment = true;
$_SESSION['Adjustment']->StockID = trim(mb_strtoupper($_POST['StockID']));
$StockID = trim(mb_strtoupper($_POST['StockID']));
@@ -49,7 +51,7 @@
$_SESSION['Adjustment']->tag = $_POST['tag'];
$_SESSION['Adjustment']->Narrative = $_POST['Narrative'];
$_SESSION['Adjustment']->StockLocation = $_POST['StockLocation'];
- if ($_POST['Quantity']=='' or !is_numeric(filter_number_format($_POST['Quantity']))){
+ if ($_POST['Quantity']=='' OR !is_numeric(filter_number_format($_POST['Quantity']))){
$_POST['Quantity']=0;
}
$_SESSION['Adjustment']->Quantity = filter_number_format($_POST['Quantity']);
@@ -165,7 +167,7 @@
'" . $_SESSION['Adjustment']->StockLocation . "',
'" . $SQLAdjustmentDate . "',
'" . $PeriodNo . "',
- '" . $_SESSION['Adjustment']->Narrative ."',
+ '" . DB_escape_string($_SESSION['Adjustment']->Narrative) ."',
'" . $_SESSION['Adjustment']->Quantity . "',
'" . ($QtyOnHandPrior + $_SESSION['Adjustment']->Quantity) . "'
)";
@@ -332,7 +334,15 @@
$StockID = $_SESSION['Adjustment']->StockID;
$Controlled = $_SESSION['Adjustment']->Controlled;
$Quantity = $_SESSION['Adjustment']->Quantity;
- $sql="SELECT materialcost, labourcost, overheadcost, units, decimalplaces FROM stockmaster WHERE stockid='".$StockID."'";
+
+ $sql="SELECT materialcost,
+ labourcost,
+ overheadcost,
+ units,
+ decimalplaces
+ FROM stockmaster
+ WHERE stockid='".$StockID."'";
+
$result=DB_query($sql, $db);
$myrow=DB_fetch_array($result);
$_SESSION['Adjustment']->PartUnit=$myrow['units'];
@@ -350,18 +360,22 @@
} else {
echo '<input type="text" name="StockID" size=21 value="" maxlength=20></td></tr>';
}
-echo '<tr><td>'. _('Partial Description'). ':</td><td><input type="text" name="StockText" size=21 value="' .
- $_GET['Description'] .'"> '._('Partial Stock Code'). ':</td><td>';
+echo '<tr>
+ <td>'. _('Partial Description'). ':</td>
+ <td><input type="text" name="StockText" size="21" value="' . $_GET['Description'] .'" /> '._('Partial Stock Code'). ':</td>
+ <td>';
if (isset($StockID)) {
- echo '<input type="text" name="StockCode" size=21 value="' . $StockID .'" maxlength=20>';
+ echo '<input type="text" name="StockCode" size=21 value="' . $StockID .'" maxlength="20" />';
} else {
- echo '<input type="text" name="StockCode" size=21 value="" maxlength=20>';
+ echo '<input type="text" name="StockCode" size=21 value="" maxlength="20" />';
}
-echo '</td><td><input type=submit name="CheckCode" VALUE="'._('Check Part').'"></td></tr>';
+echo '</td>
+ <td><input type="submit" name="CheckCode" value="'._('Check Part').'"></td>
+ </tr>';
if (isset($_SESSION['Adjustment']) AND mb_strlen($_SESSION['Adjustment']->ItemDescription)>1){
- echo '<tr><td colspan=3><font color=BLUE size=3>' . $_SESSION['Adjustment']->ItemDescription . ' ('._('In Units of').' ' .
- $_SESSION['Adjustment']->PartUnit . ' ) - ' . _('Unit Cost').' = ' .
- locale_number_format($_SESSION['Adjustment']->StandardCost,4) . '</font></td></tr>';
+ echo '<tr>
+ <td colspan="3"><font color="blue" size="3">' . $_SESSION['Adjustment']->ItemDescription . ' ('._('In Units of').' ' . $_SESSION['Adjustment']->PartUnit . ' ) - ' . _('Unit Cost').' = ' . locale_number_format($_SESSION['Adjustment']->StandardCost,4) . '</font></td>
+ </tr>';
}
echo '<tr><td>'. _('Adjustment to Stock At Location').':</td>
@@ -372,15 +386,15 @@
while ($myrow=DB_fetch_array($resultStkLocs)){
if (isset($_SESSION['Adjustment']->StockLocation)){
if ($myrow['loccode'] == $_SESSION['Adjustment']->StockLocation){
- echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'];
+ echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
} else {
- echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'];
+ echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
}
} elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){
- echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'];
+ echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
$_POST['StockLocation']=$myrow['loccode'];
} else {
- echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'];
+ echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
}
}
@@ -392,8 +406,10 @@
$Narrative ='';
}
-echo '<tr><td>'. _('Comments On Why').':</td>
- <td><input type="text" name="Narrative" size=32 maxlength=30 value="' . $Narrative . '"></td></tr>';
+echo '<tr>
+ <td>'. _('Comments On Why').':</td>
+ <td><input type="text" name="Narrative" size="32" maxlength="30" value="' . $Narrative . '" /></td>
+ </tr>';
echo '<tr><td>'._('Adjustment Quantity').':</td>';
@@ -402,16 +418,18 @@
if ($_SESSION['Adjustment']->StockLocation == ''){
$_SESSION['Adjustment']->StockLocation = $_SESSION['UserStockLocation'];
}
- echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment']->Quantity . '">
+ echo '<input type="hidden" name="Quantity" value="' . $_SESSION['Adjustment']->Quantity . '" />
'.locale_number_format($_SESSION['Adjustment']->Quantity,$DecimalPlaces) .'
[<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=REMOVE">'._('Remove').'</a>]
[<a href="'.$rootpath.'/StockAdjustmentsControlled.php?AdjType=ADD">'._('Add').'</a>]';
} else {
- echo '<input type="text" class="number" name="Quantity" size="12" maxlength="12" value="' . locale_number_format($Quantity,$DecimalPlaces) . '">';
+ echo '<input type="text" class="number" name="Quantity" size="12" maxlength="12" value="' . locale_number_format($Quantity,$DecimalPlaces) . '" />';
}
echo '</td></tr>';
//Select the tag
-echo '<tr><td>'._('Select Tag').'</td><td><select name="tag">';
+echo '<tr>
+ <td>'._('Select Tag').'</td>
+ <td><select name="tag">';
$SQL = "SELECT tagref,
tagdescription
@@ -430,17 +448,26 @@
echo '</select></td>';
// End select tag
-echo '</table><div class="centre"><br /><input type="submit" name="EnterAdjustment" value="'. _('Enter Stock Adjustment'). '"><br />';
+echo '</table>
+ <div class="centre">
+ <br />
+ <input type="submit" name="EnterAdjustment" value="'. _('Enter Stock Adjustment'). '">
+ <br />';
if (!isset($_POST['StockLocation'])) {
$_POST['StockLocation']='';
}
-echo '<br /><a href="'. $rootpath. '/StockStatus.php?StockID='. $StockID . '">'._('Show Stock Status').'</a>';
-echo '<br /><a href="'.$rootpath.'/StockMovements.php?StockID=' . $StockID . '">'._('Show Movements').'</a>';
-echo '<br /><a href="'.$rootpath.'/StockUsage.php?StockID=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">'._('Show Stock Usage').'</a>';
-echo '<br /><a href="'.$rootpath.'/SelectSalesOrder.php?SelectedStockItem='. $StockID .'&StockLocation=' . $_POST['StockLocation'] . '">'. _('Search Outstanding Sales Orders').'</a>';
-echo '<br /><a href="'.$rootpath.'/SelectCompletedOrder.php?SelectedStockItem=' . $StockID .'">'._('Search Completed Sales Orders').'</a>';
+echo '<br />
+ <a href="'. $rootpath. '/StockStatus.php?StockID='. $StockID . '">'._('Show Stock Status').'</a>';
+echo '<br />
+ <a href="'.$rootpath.'/StockMovements.php?StockID=' . $StockID . '">'._('Show Movements').'</a>';
+echo '<br />
+ <a href="'.$rootpath.'/StockUsage.php?StockID=' . $StockID . '&StockLocation=' . $_POST['StockLocation'] . '">'._('Show Stock Usage').'</a>';
+echo '<br />
+ <a href="'.$rootpath.'/SelectSalesOrder.php?SelectedStockItem='. $StockID .'&StockLocation=' . $_POST['StockLocation'] . '">'. _('Search Outstanding Sales Orders').'</a>';
+echo '<br />
+ <a href="'.$rootpath.'/SelectCompletedOrder.php?SelectedStockItem=' . $StockID .'">'._('Search Completed Sales Orders').'</a>';
echo '</div></form>';
include('includes/footer.inc');
Modified: trunk/StockCategories.php
===================================================================
--- trunk/StockCategories.php 2011-10-14 06:08:10 UTC (rev 4719)
+++ trunk/StockCategories.php 2011-10-14 06:11:13 UTC (rev 4720)
@@ -7,8 +7,10 @@
include('includes/header.inc');
-echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' .
- _('Inventory Adjustment') . '" alt="" />' . ' ' . $title . '</p>';
+echo '<p class="page_title_text">
+ <img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' .
+ _('Inventory Adjustment') . '" alt="" />' . ' ' . $title . '
+ </p>';
if (isset($_GET['SelectedCategory'])){
$SelectedCategory = mb_strtoupper($_GET['SelectedCategory']);
@@ -229,29 +231,29 @@
echo '<tr class="OddTableRows">';
$k=1;
}
- printf("<td>%s</td>
- <td>%s</td>
- <td>%s</td>
- <td class=number>%s</td>
- <td class=number>%s</td>
- <td class=number>%s</td>
- <td class=number>%s</td>
- <td class=number>%s</td>
- <td><a href=\"%sSelectedCategory=%s\">" . _('Edit') . "</td>
- <td><a href=\"%sSelectedCategory=%s&delete=yes\" onclick=\"return confirm('" . _('Are you sure you wish to delete this stock category? Additional checks will be performed before actual deletion to ensure data integrity is not compromised.') . "');\">" . _('Delete') . "</td>
- </tr>",
- $myrow[0],
- $myrow[1],
- $myrow[2],
- $myrow[3],
- $myrow[4],
- $myrow[5],
- $myrow[6],
- $myrow[7],
- $_SERVER['PHP_SELF'] . '?',
- $myrow[0],
- $_SERVER['PHP_SELF'] . '?',
- $myrow[0]);
+ printf('<td>%s</td>
+ <td>%s</td>
+ <td>%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ <td><a href="%sSelectedCategory=%s">' . _('Edit') . '</td>
+ <td><a href="%sSelectedCategory=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this stock category? Additional checks will be performed before actual deletion to ensure data integrity is not compromised.') . '\');">' . _('Delete') . '</a></td>
+ </tr>',
+ $myrow[0],
+ $myrow[1],
+ $myrow[2],
+ $myrow[3],
+ $myrow[4],
+ $myrow[5],
+ $myrow[6],
+ $myrow[7],
+ $_SERVER['PHP_SELF'] . '?',
+ $myrow[0],
+ $_SERVER['PHP_SELF'] . '?',
+ $myrow[0]);
}
//END WHILE LIST LOOP
echo '</table>';
@@ -302,16 +304,23 @@
$_POST['MaterialUseageVarAc'] = $myrow['materialuseagevarac'];
$_POST['WIPAct'] = $myrow['wipact'];
}
- echo '<input type=hidden name="SelectedCategory" value="' . $SelectedCategory . '">';
- echo '<input type=hidden name="CategoryID" value="' . $_POST['CategoryID'] . '">';
- echo '<table class=selection><tr><td>' . _('Category Code') . ':</td><td>' . $_POST['CategoryID'] . '</td></tr>';
+ echo '<input type=hidden name="SelectedCategory" value="' . $SelectedCategory . '" />';
+ echo '<input type=hidden name="CategoryID" value="' . $_POST['CategoryID'] . '" />';
+ echo '<table class="selection">
+ <tr>
+ <td>' . _('Category Code') . ':</td>
+ <td>' . $_POST['CategoryID'] . '</td>
+ </tr>';
} else { //end of if $SelectedCategory only do the else when a new record is being entered
if (!isset($_POST['CategoryID'])) {
$_POST['CategoryID'] = '';
}
- echo '<table class=selection><tr><td>' . _('Category Code') . ':</td>
- <td><input type="Text" name="CategoryID" size=7 maxlength=6 value="' . $_POST['CategoryID'] . '"></td></tr>';
+ echo '<table class="selection">
+ <tr>
+ <td>' . _('Category Code') . ':</td>
+ <td><input type="text" name="CategoryID" size="7" maxlength="6" value="' . $_POST['CategoryID'] . '" /></td>
+ </tr>';
}
//SQL to poulate account selection boxes
@@ -339,11 +348,13 @@
$_POST['CategoryDescription'] = '';
}
- echo '<tr><td>' . _('Category Description') . ':</td>
- <td><input type="Text" name="CategoryDescription" size=22 maxlength=20 value="' . $_POST['CategoryDescription'] . '"></td></tr>';
+ echo '<tr>
+ <td>' . _('Category Description') . ':</td>
+ <td><input type="text" name="CategoryDescription" size=22 maxlength=20 value="' . $_POST['CategoryDescription'] . '" /></td></tr>';
- echo '<tr><td>' . _('Stock Type') . ':</td>
+ echo '<tr>
+ <td>' . _('Stock Type') . ':</td>
<td><select name="StockType" onChange="ReloadForm(CategoryForm.UpdateTypes)" >';
if (isset($_POST['StockType']) and $_POST['StockType']=='F') {
echo '<option selected value="F">' . _('Finished Goods') . '</option>';
@@ -366,7 +377,8 @@
echo '<option value="L">' . _('Labour') . '</option>';
}
- echo '</select></td></tr>';
+ echo '</select></td>
+ </tr>';
echo '<input type="submit" name="UpdateTypes" style="visibility:hidden;width:1px" value="Not Seen">';
if (isset($_POST['StockType']) and $_POST['StockType']=='L') {
@@ -406,7 +418,8 @@
echo '</select></td></tr>';
DB_data_seek($BSAccountsResult,0);
- echo '<tr><td>' . _('Stock Adjustments GL Code') . ':</td>
+ echo '<tr>
+ <td>' . _('Stock Adjustments GL Code') . ':</td>
<td><select name="AdjGLAct">';
while ($myrow = DB_fetch_array($PnLAccountsResult)) {
@@ -435,26 +448,32 @@
} //end while loop
DB_data_seek($PnLAccountsResult,0);
- echo '</select></td></tr><tr><td>';
+ echo '</select></td>
+ </tr>
+ <tr>
+ <td>';
if (isset($_POST['StockType']) and $_POST['StockType']=='L') {
echo _('Labour Efficiency Variance GL Code');
} else {
echo _('Usage Variance GL Code');
}
- echo ':</td><td><select name="MaterialUseageVarAc"></option>';
+ echo ':</td>
+ <td><select name="MaterialUseageVarAc">';
while ($myrow = DB_fetch_array($PnLAccountsResult)) {
if (isset($_POST['MaterialUseageVarAc']) and $myrow['accountcode']==$_POST['MaterialUseageVarAc']) {
- echo '<option selected value=';
+ echo '<option selected value="';
} else {
- echo '<option value=';
+ echo '<option value="';
}
- echo $myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')</option>';
+ echo $myrow['accountcode'] . '">' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')</option>';
} //end while loop
DB_free_result($PnLAccountsResult);
- echo '</select></td></tr>
- </table>';
+ echo '</select></td>
+ </tr>
+ </table>';
+
if (!isset($SelectedCategory)) {
$SelectedCategory='';
}
@@ -476,14 +495,15 @@
'<br />The SQL was:<br />' . $sql;
*/
echo '<br /><table class=selection>';
- $TableHeader = '<tr><th>' . _('Property Label') . '</th>
- <th>' . _('Control Type') . '</th>
- <th>' . _('Default Value') . '</th>
- <th>' . _('Numeric Value') . '</th>
- <th>' . _('Minimum Value') . '</th>
- <th>' . _('Maximum Value') . '</th>
- <th>' . _('Require in SO') . '</th>
- </tr>';
+ $TableHeader = '<tr>
+ <th>' . _('Property Label') . '</th>
+ <th>' . _('Control Type') . '</th>
+ <th>' . _('Default Value') . '</th>
+ <th>' . _('Numeric Value') . '</th>
+ <th>' . _('Minimum Value') . '</th>
+ <th>' . _('Maximum Value') . '</th>
+ <th>' . _('Require in SO') . '</th>
+ </tr>';
echo $TableHeader;
$PropertyCounter =0;
$HeadingCounter =0;
@@ -494,25 +514,24 @@
} else {
$HeadingCounter++;
}
- echo '<input type="hidden" name="PropID' . $PropertyCounter .'" value=' . $myrow['stkcatpropid'] . '>';
- echo '<tr><td><input type="textbox" name="PropLabel' . $PropertyCounter . '" size="50" maxlength="100" value="' . $myrow['label'] . '"></td>
+ echo '<input type="hidden" name="PropID' . $PropertyCounter .'" value="' . $myrow['stkcatpropid'] . '" />';
+ echo '<tr><td><input type="textbox" name="PropLabel' . $PropertyCounter . '" size="50" maxlength="100" value="' . $myrow['label'] . '" /></td>
<td><select name="PropControlType' . $PropertyCounter . '">';
if ($myrow['controltype']==0){
- echo '<option selected value=0>' . _('Text Box') . '</option>';
+ echo '<option selected value="0">' . _('Text Box') . '</option>';
} else {
- echo '<option value=0>' . _('Text Box') . '</option>';
+ echo '<option value="0">' . _('Text Box') . '</option>';
}
if ($myrow['controltype']==1){
- echo '<option selected value=1>' . _('Select Box') . '</option>';
+ echo '<option selected value="1">' . _('Select Box') . '</option>';
} else {
- echo '<option value=1>' . _('Select Box') . '</option>';
+ echo '<option value="1">' . _('Select Box') . '</option>';
}
if ($myrow['controltype']==2){
- echo '<option selected value=2>' . _('Check Box') . '</option>';
+ echo '<option selected value="2">' . _('Check Box') . '</option>';
} else {
- echo '<option value=2>' . _('Check Box') . '</option>';
+ echo '<option value="2">' . _('Check Box') . '</option>';
}
-
echo '</select></td>
<td><input type="textbox" name="PropDefault' . $PropertyCounter . '" value="' . $myrow['defaultvalue'] . '"></td>
<td><input type="checkbox" name="PropNumeric' . $PropertyCounter . '"';
@@ -532,33 +551,37 @@
}
echo '></td>
- <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&DeleteProperty=' . $myrow['stkcatpropid'] .'&SelectedCategory=' . $SelectedCategory . '" onclick=\'return confirm("' . _('Are you sure you wish to delete this property? All properties of this type set up for stock items will also be deleted.') . '");\'>' . _('Delete') . '</td></tr>';
+ <td><a href="' . $_SERVER['PHP_SELF'] . '?DeleteProperty=' . $myrow['stkcatpropid'] .'&SelectedCategory=' . $SelectedCategory . '" onclick=\'return confirm("' . _('Are you sure you wish to delete this property? All properties of this type set up for stock items will also be deleted.') . '");\'>' . _('Delete') . '</td>
+ </tr>';
$PropertyCounter++;
} //end loop around defined properties for this category
- echo '<input type="hidden" name="PropID' . $PropertyCounter .'" value="NewProperty">';
- echo '<tr><td><input type="textbox" name="PropLabel' . $PropertyCounter . '" size="50" maxlength="100"></td>
- <td><select name="PropControlType' . $PropertyCounter . '">';
- echo '<option selected value=0>' . _('Text Box') . '</option>';
- echo '<option value=1>' . _('Select Box') . '</option>';
- echo '<option value=2>' . _('Check Box') . '</option>';
- echo '</select></td>
- <td><input type="textbox" name="PropDefault' . $PropertyCounter . '"></td>
- <td><input type="checkbox" name="PropNumeric' . $PropertyCounter . '"></td>
- <td><input type="textbox" "name="PropMinimum' . $PropertyCounter . '"></td>
- <td><input type="textbox" name="PropMaximum' . $PropertyCounter . '"></td>
- <td align="center"><input type="checkbox" name="PropReqSO' . $PropertyCounter .'"></td></tr>';
+ echo '<input type="hidden" name="PropID' . $PropertyCounter .'" value="NewProperty" />';
+ echo '<tr>
+ <td><input type="textbox" name="PropLabel' . $PropertyCounter . '" size="50" maxlength="100" /></td>
+ <td><select name="PropControlType' . $PropertyCounter . '">
+ <option selected value=0>' . _('Text Box') . '</option>
+ <option value=1>' . _('Select Box') . '</option>
+ <option value=2>' . _('Check Box') . '</option>
+ </select></td>
+ <td><input type="textbox" name="PropDefault' . $PropertyCounter . '" /></td>
+ <td><input type="checkbox" name="PropNumeric' . $PropertyCounter . '" /></td>
+ <td><input type="textbox" "name="PropMinimum' . $PropertyCounter . '" /></td>
+ <td><input type="textbox" name="PropMaximum' . $PropertyCounter . '" /></td>
+ <td align="center"><input type="checkbox" name="PropReqSO' . $PropertyCounter .'" /></td>
+ </tr>';
echo '</table>';
- echo '<input type=hidden name="PropertyCounter" value=' . $PropertyCounter . '>';
+ echo '<input type="hidden" name="PropertyCounter" value="' . $PropertyCounter . '" />';
} /* end if there is a category selected */
- echo '<br /><div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div>';
+ echo '<br />
+ <div class="centre">
+ <input type="submit" name="submit" value="' . _('Enter Information') . '">
+ </div>
+ </form>';
-
- echo '</form>';
-
} //end if record deleted no point displaying form to add record
Modified: trunk/StockCheck.php
===================================================================
--- trunk/StockCheck.php 2011-10-14 06:08:10 UTC (rev 4719)
+++ trunk/StockCheck.php 2011-10-14 06:11:13 UTC (rev 4720)
@@ -54,11 +54,12 @@
}
if ($_POST['MakeStkChkData']=='AddUpdate'){
- $sql = "DELETE stockcheckfreeze FROM stockcheckfreeze
- INNER JOIN stockmaster ON stockcheckfreeze.stockid=stockmaster.stockid
- WHERE stockmaster.categoryid >='" . $_POST['FromCriteria'] . "' AND
- stockmaster.categoryid<='" . $_POST['ToCriteria'] . "' AND
- stockcheckfreeze.loccode='" . $_POST['Location'] . "'";
+ $sql = "DELETE stockcheckfreeze
+ FROM stockcheckfreeze
+ INNER JOIN stockmaster ON stockcheckfreeze.stockid=stockmaster.stockid
+ WHERE stockmaster.categoryid >='" . $_POST['FromCriteria'] . "'
+ AND stockmaster.categoryid<='" . $_POST['ToCriteria'] . "'
+ AND stockcheckfreeze.loccode='" . $_POST['Location'] . "'";
$result = DB_query($sql,$db,'','',false,false);
if (DB_error_no($db) !=0) {
@@ -83,12 +84,13 @@
'" . Date('Y-m-d') . "'
FROM locstock INNER JOIN stockmaster
ON locstock.stockid=stockmaster.stockid
- WHERE locstock.loccode='" . $_POST['Location'] . "' AND
- stockmaster.categoryid>='" . $_POST['FromCriteria'] . "' AND
- stockmaster.categoryid<='" . $_POST['ToCriteria'] . "' AND
- stockmaster.mbflag!='A' AND
- stockmaster.mbflag!='K' AND
- stockmaster.mbflag!='D'";
+ WHERE locstock.loccode='" . $_POST['Location'] . "'
+ AND stockmaster.categoryid>='" . $_POST['FromCriteria'] . "'
+ AND stockmaster.categoryid<='" . $_POST['ToCriteria'] . "'
+ AND stockmaster.mbflag!='A'
+ AND stockmaster.mbflag!='K'
+ AND stockmaster.mbflag!='G'
+ AND stockmaster.mbflag!='D'";
$result = DB_query($sql, $db,'','',false,false);
if (DB_error_no($db) !=0) {
@@ -112,26 +114,25 @@
}
- $SQL = "SELECT stockmaster.categoryid,
- stockcheckfreeze.stockid,
- stockmaster.description,
- stockmaster.decimalplaces,
- stockcategory.categorydescription,
- stockcheckfreeze.qoh
- FROM stockcheckfreeze,
- stockmaster,
- stockcategory
- WHERE stockcheckfreeze.stockid=stockmaster.stockid AND
- stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "' AND
- stockmaster.categoryid=stockcategory.categoryid AND
- stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "' AND
- (stockmaster.mbflag='B' OR mbflag='M') AND
- stockcheckfreeze.loccode = '" . $_POST['Location'] . "'";
- if (isset($_POST['NonZerosOnly']) and $_POST['NonZerosOnly']==true){
- $SQL .= ' AND stockcheckfreeze.qoh<>0';
- }
+ $SQL = "SELECT stockmaster.categoryid,
+ stockcheckfreeze.stockid,
+ stockmaster.description,
+ stockmaster.decimalplaces,
+ stockcategory.categorydescription,
+ stockcheckfreeze.qoh
+ FROM stockcheckfreeze INNER JOIN stockmaster
+ ON stockcheckfreeze.stockid=stockmaster.stockid
+ INNER JOIN stockcategory
+ ON stockmaster.categoryid=stockcategory.categoryid
+ WHERE stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "'
+ AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "'
+ AND (stockmaster.mbflag='B' OR mbflag='M')
+ AND stockcheckfreeze.loccode = '" . $_POST['Location'] . "'";
+ if (isset($_POST['NonZerosOnly']) and $_POST['NonZerosOnly']==true){
+ $SQL .= " AND stockcheckfreeze.qoh<>0";
+ }
- $SQL .= ' ORDER BY stockmaster.categoryid, stockmaster.stockid';
+ $SQL .= " ORDER BY stockmaster.categoryid, stockmaster.stockid";
$InventoryResult = DB_query($SQL,$db,'','',false,false);
@@ -159,9 +160,9 @@
$Category = '';
- While ($InventoryPlan = DB_fetch_array($InventoryResult,$db)){
+ While ($InventoryCheckRow = DB_fetch_array($InventoryResult,$db)){
- if ($Category!=$InventoryPlan['categoryid']){
+ if ($Category!=$InventoryCheckRow['categoryid']){
$FontSize=12;
if ($Category!=''){ /*Then it's NOT the first time round */
/*draw a line under the CATEGORY TOTAL*/
@@ -169,8 +170,8 @@
$YPos -=(2*$line_height);
}
- $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,260-$Left_Margin,$FontSize,$InventoryPlan['categoryid'] . ' - ' . $InventoryPlan['categorydescription'], 'left');
- $Category = $InventoryPlan['categoryid'];
+ $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,260-$Left_Margin,$FontSize,$InventoryCheckRow['categoryid'] . ' - ' . $InventoryCheckRow['categorydescription'], 'left');
+ $Category = $InventoryCheckRow['categoryid'];
}
$FontSize=10;
@@ -179,12 +180,11 @@
if (isset($_POST['ShowInfo']) and $_POST['ShowInfo']==true){
$SQL = "SELECT SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qtydemand
- FROM salesorderdetails,
- salesorders
- WHERE salesorderdetails.orderno=salesorders.orderno AND
- salesorders.fromstkloc ='" . $_POST['Location'] . "' AND
- salesorderdetails.stkcode = '" . $InventoryPlan['stockid'] . "' AND
- salesorderdetails.completed = 0";
+ FROM salesorderdetails INNER JOIN salesorders
+ ON salesorderdetails.orderno=salesorders.orderno
+ WHERE salesorders.fromstkloc ='" . $_POST['Location'] . "'
+ AND salesorderdetails.stkcode = '" . $InventoryCheckRow['stockid'] . "'
+ AND salesorderdetails.completed = 0";
$DemandResult = DB_query($SQL,$db,'','',false, false);
@@ -204,19 +204,17 @@
$DemandQty = $DemandRow['qtydemand'];
//Also need to add in the demand for components of assembly items
- $sql = "SELECT SUM((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity)
- AS dem
- FROM salesorderdetails,
- salesorders,
- bom,
- stockmaster
- WHERE salesorderdetails.stkcode=bom.parent AND
- salesorders.orderno = salesorderdetails.orderno AND
- salesorders.fromstkloc='" . $_POST['Location'] . "' AND
- salesorderdetails.quantity-salesorderdetails.qtyinvoiced > 0 AND
- bom.component='" . $InventoryPlan['stockid'] . "' AND
- stockmaster.stockid=bom.parent AND
- stockmaster.mbflag='A'";
+ $sql = "SELECT SUM((salesorderdetails.quantity-salesorderdetails....
[truncated message content] |