|
From: <dai...@us...> - 2012-08-12 08:09:24
|
Revision: 5594
http://web-erp.svn.sourceforge.net/web-erp/?rev=5594&view=rev
Author: daintree
Date: 2012-08-12 08:09:16 +0000 (Sun, 12 Aug 2012)
Log Message:
-----------
fix update salesorderdetails orderlineno may be different in credit note
Modified Paths:
--------------
trunk/Credit_Invoice.php
trunk/SelectCustomer.php
trunk/SystemParameters.php
trunk/index.php
trunk/sql/mysql/upgrade4.08-4.09.sql
Modified: trunk/Credit_Invoice.php
===================================================================
--- trunk/Credit_Invoice.php 2012-08-11 05:56:14 UTC (rev 5593)
+++ trunk/Credit_Invoice.php 2012-08-12 08:09:16 UTC (rev 5594)
@@ -251,7 +251,6 @@
}
}
-
/* Always display credit quantities
NB QtyDispatched in the LineItems array is used for the quantity to credit */
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/credit.gif" title="' . _('Search') . '" alt="" />' . $title.'</p>';
@@ -307,14 +306,6 @@
$_SESSION['CreditItems']->totalWeight += ($LnItm->QtyDispatched * $LnItm->Weight);
}
-
-
-
-
-
-
-
-
$LineTotal = $LnItm->QtyDispatched * $LnItm->Price * (1 - $LnItm->DiscountPercent);
if (!isset($_POST['ProcessCredit'])) {
$_SESSION['CreditItems']->total += $LineTotal;
@@ -672,14 +663,19 @@
if ($_POST['CreditType']=='Return'){
- /* some want this some do not */
+ /* some want this some do not
+ * We cannot use the orderlineno to update with as it could be different when added to the credit note than it was when the order was created
+ * Also there could potentially be the same item on the order multiple times with different delivery dates
+ * So all up the SQL below is a bit hit and miss !!
+ * Probably right 99% of time with the item on the order only once */
$SQL = "UPDATE salesorderdetails
SET qtyinvoiced = qtyinvoiced - " . $CreditLine->QtyDispatched . ",
completed=0
WHERE orderno = '" . $_SESSION['CreditItems']->OrderNo . "'
AND stkcode = '" . $CreditLine->StockID . "'
- AND orderlineno='" . $CreditLine->LineNumber."'";
+ AND quantity >=" . $CreditLine->QtyDispatched;
+
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales order detail record could not be updated for the reduced quantity invoiced because');
$DbgMsg = _('The following SQL to update the sales order detail record was used');
Modified: trunk/SelectCustomer.php
===================================================================
--- trunk/SelectCustomer.php 2012-08-11 05:56:14 UTC (rev 5593)
+++ trunk/SelectCustomer.php 2012-08-12 08:09:16 UTC (rev 5594)
@@ -10,7 +10,7 @@
$_SESSION['CustomerID'] = $_GET['Select'];
}
if (!isset($_SESSION['CustomerID'])) { //initialise if not already done
- $_SESSION['CustomerID'] = "";
+ $_SESSION['CustomerID'] = '';
}
if (isset($_GET['Area'])) {
$_POST['Area']=$_GET['Area'];
@@ -44,15 +44,15 @@
$ErrMsg = _('An error occurred in retrieving the information');
$result2 = DB_query($sql, $db, $ErrMsg);
$myrow2 = DB_fetch_array($result2);
- $lat = $myrow2['lat'];
- $lng = $myrow2['lng'];
- $api_key = $myrow['geocode_key'];
+ $Lattitude = $myrow2['lat'];
+ $Longitude = $myrow2['lng'];
+ $API_Key = $myrow['geocode_key'];
$center_long = $myrow['center_long'];
$center_lat = $myrow['center_lat'];
$map_height = $myrow['map_height'];
$map_width = $myrow['map_width'];
$map_host = $myrow['map_host'];
- echo '<script src="http://maps.google.com/maps?file=api&v=2&key=' . $api_key . '"';
+ echo '<script src="http://maps.google.com/maps?file=api&v=2&key=' . $API_Key . '"';
echo ' type="text/javascript"></script>';
echo ' <script type="text/javascript">';
echo 'function load() {
@@ -60,8 +60,8 @@
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());';
- echo 'map.setCenter(new GLatLng(' . $lat . ', ' . $lng . '), 11);';
- echo 'var marker = new GMarker(new GLatLng(' . $lat . ', ' . $lng . '));';
+ echo 'map.setCenter(new GLatLng(' . $Lattitude . ', ' . $Longitude . '), 11);';
+ echo 'var marker = new GMarker(new GLatLng(' . $Lattitude . ', ' . $Longitude . '));';
echo 'map.addOverlay(marker);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(WINDOW_HTML);
@@ -194,13 +194,22 @@
}
if ($_SESSION['CustomerID'] != '' AND !isset($_POST['Search']) AND !isset($_POST['CSV'])) {
- $SQL = "SELECT debtorsmaster.name,
+ if (!isset($_SESSION['BranchCode'])){
+
+ $SQL = "SELECT debtorsmaster.name,
custbranch.phoneno
FROM debtorsmaster INNER JOIN custbranch
ON debtorsmaster.debtorno=custbranch.debtorno
+ WHERE custbranch.debtorno='" . $_SESSION['CustomerID'] . "'";
+
+ } else {
+ $SQL = "SELECT debtorsmaster.name,
+ custbranch.phoneno
+ FROM debtorsmaster INNER JOIN custbranch
+ ON debtorsmaster.debtorno=custbranch.debtorno
WHERE custbranch.debtorno='" . $_SESSION['CustomerID'] . "'
AND custbranch.branchcode='" . $_SESSION['BranchCode'] . "'";
-
+ }
$ErrMsg = _('The customer name requested cannot be retrieved because');
$result = DB_query($SQL, $db, $ErrMsg);
if ($myrow = DB_fetch_array($result)) {
@@ -228,7 +237,9 @@
echo '</td><td valign="top" class="select">';
echo '<a href="' . $rootpath . '/SelectSalesOrder.php?SelectedCustomer=' . $_SESSION['CustomerID'] . '">' . _('Modify Outstanding Sales Orders') . '</a><br />';
echo '<a href="' . $rootpath . '/CustomerAllocations.php?DebtorNo=' . $_SESSION['CustomerID'] . '">' . _('Allocate Receipts or Credit Notes') . '</a><br />';
- echo '<a href="' . $rootpath . '/CounterSales.php?DebtorNo=' . $_SESSION['CustomerID'] . '&BranchNo=' . $_SESSION['BranchCode'] . '">' . _('Create a Counter Sale for this Customer') . '</a><br />';
+ if (isset($_SESSION['CustomerID']) AND isset($_SESSION['BranchCode'])){
+ echo '<a href="' . $rootpath . '/CounterSales.php?DebtorNo=' . $_SESSION['CustomerID'] . '&BranchNo=' . $_SESSION['BranchCode'] . '">' . _('Create a Counter Sale for this Customer') . '</a><br />';
+ }
echo '</td><td valign="top" class="select">';
echo '<a href="' . $rootpath . '/Customers.php?">' . _('Add a New Customer') . '</a><br />';
echo '<a href="' . $rootpath . '/Customers.php?DebtorNo=' . $_SESSION['CustomerID'] . '">' . _('Modify Customer Details') . '</a><br />';
@@ -500,7 +511,7 @@
if (isset($_SESSION['CustomerID']) and $_SESSION['CustomerID'] != '') {
if ($_SESSION['geocode_integration'] == 1) {
echo '<br />';
- if ($lat == 0) {
+ if ($Lattitude == 0) {
echo '<div class="centre">' . _('Mapping is enabled, but no Mapping data to display for this Customer.') . '</div>';
} else {
echo '<tr>
Modified: trunk/SystemParameters.php
===================================================================
--- trunk/SystemParameters.php 2012-08-11 05:56:14 UTC (rev 5593)
+++ trunk/SystemParameters.php 2012-08-12 08:09:16 UTC (rev 5594)
@@ -125,9 +125,11 @@
if ($_SESSION['QuickEntries'] != $_POST['X_QuickEntries'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_QuickEntries']."' WHERE confname = 'QuickEntries'";
}
+
if ($_SESSION['WorkingDaysWeek'] != $_POST['X_WorkingDaysWeek'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_WorkingDaysWeek']."' WHERE confname = 'WorkingDaysWeek'";
}
+
if ($_SESSION['DispatchCutOffTime'] != $_POST['X_DispatchCutOffTime'] ) {
$sql[] = "UPDATE config SET confvalue = '".$_POST['X_DispatchCutOffTime']."' WHERE confname = 'DispatchCutOffTime'";
}
@@ -480,16 +482,18 @@
<td>' . _('Customer branches can be set by default not to print packing slips with the company logo and address. This is useful for companies that ship to customers customers and to show the source of the shipment would be inappropriate. There is an option on the setup of customer branches to ship blind, this setting is the default applied to all new customer branches') . '</td>
</tr>';
-// Working days on a week
-echo '<tr style="outline: 1px solid"><td>' . _('Working Days on a Week') . ':</td>
- <td><select name="X_WorkingDaysWeek">
- <option '.($_SESSION['WorkingDaysWeek']=='7'?'selected="selected" ':'').'value="7">7 '._('working days').'</option>
- <option '.($_SESSION['WorkingDaysWeek']=='6'?'selected="selected" ':'').'value="6">6 '._('working days').'</option>
- <option '.($_SESSION['WorkingDaysWeek']=='5'?'selected="selected" ':'').'value="5">5 '._('working days').'</option>
- </select></td>
- <td>' . _('Number of working days on a week') . '</td>
- </tr>';
+ // Working days on a week
+ echo '<tr style="outline: 1px solid">
+ <td>' . _('Working Days on a Week') . ':</td>
+ <td><select name="X_WorkingDaysWeek">
+ <option '.($_SESSION['WorkingDaysWeek']=='7'?'selected="selected" ':'').'value="7">7 '._('working days').'</option>
+ <option '.($_SESSION['WorkingDaysWeek']=='6'?'selected="selected" ':'').'value="6">6 '._('working days').'</option>
+ <option '.($_SESSION['WorkingDaysWeek']=='5'?'selected="selected" ':'').'value="5">5 '._('working days').'</option>
+ </select></td>
+ <td>' . _('Number of working days on a week') . '</td>
+ </tr>';
+
// DispatchCutOffTime
echo '<tr style="outline: 1px solid"><td>' . _('Dispatch Cut-Off Time') . ':</td>
<td><select name="X_DispatchCutOffTime">';
Modified: trunk/index.php
===================================================================
--- trunk/index.php 2012-08-11 05:56:14 UTC (rev 5593)
+++ trunk/index.php 2012-08-12 08:09:16 UTC (rev 5594)
@@ -59,7 +59,7 @@
//=== MainMenuDiv =======================================================================
echo '<div id="MainMenuDiv"><ul>'; //===HJ===
$i=0;
-while ($i < count($ModuleLink)){
+while ($i < count($ModuleLink)-1){
// This determines if the user has display access to the module see config.php and header.inc
// for the authorisation and security code
if ($_SESSION['ModulesEnabled'][$i]==1) {
Modified: trunk/sql/mysql/upgrade4.08-4.09.sql
===================================================================
--- trunk/sql/mysql/upgrade4.08-4.09.sql 2012-08-11 05:56:14 UTC (rev 5593)
+++ trunk/sql/mysql/upgrade4.08-4.09.sql 2012-08-12 08:09:16 UTC (rev 5594)
@@ -18,5 +18,6 @@
INSERT INTO scripts VALUES ('PDFGLJournal.php','15','General Ledger Journal Print');
ALTER TABLE `www_users` ADD `department` INT( 11 ) NOT NULL DEFAULT '0';
+INSERT INTO config VALUES('WorkingDaysWeek','5');
UPDATE config SET confvalue='4.08.2' WHERE confname='VersionNumber';
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|