|
From: <dai...@us...> - 2012-02-12 03:51:32
|
Revision: 4889
http://web-erp.svn.sourceforge.net/web-erp/?rev=4889&view=rev
Author: daintree
Date: 2012-02-12 03:51:25 +0000 (Sun, 12 Feb 2012)
Log Message:
-----------
remove debug line
Modified Paths:
--------------
trunk/Prices.php
trunk/api/api_debtortransactions.php
Modified: trunk/Prices.php
===================================================================
--- trunk/Prices.php 2012-02-11 04:32:41 UTC (rev 4888)
+++ trunk/Prices.php 2012-02-12 03:51:25 UTC (rev 4889)
@@ -157,7 +157,6 @@
'" . filter_number_format($_POST['Price']) . "')";
$ErrMsg = _('The new price could not be added');
$result = DB_query($sql,$db,$ErrMsg);
- echo "Used the following SQL to insert the price:<br />$sql";
ReSequenceEffectiveDates ($Item, $_POST['TypeAbbrev'], $_POST['CurrAbrev'], $db) ;
prnMsg(_('The new price has been inserted'),'success');
Modified: trunk/api/api_debtortransactions.php
===================================================================
--- trunk/api/api_debtortransactions.php 2012-02-11 04:32:41 UTC (rev 4888)
+++ trunk/api/api_debtortransactions.php 2012-02-12 03:51:25 UTC (rev 4889)
@@ -439,6 +439,7 @@
reference,
rate,
ovamount,
+ ovdiscount,
invtext)
VALUES ('" . $ReceiptNo . "',
12,
@@ -448,7 +449,8 @@
'" . $PeriodNo . "',
'" . $Receipt['reference'] . "',
'" . ($ReceiptExRate/$FunctionalExRate) . "',
- '" . (-$Receipt['amountfx']-$Receipt['discountfx']) . "',
+ '" . -$Receipt['amountfx'] . "',
+ '" . -$Receipt['discountfx'] . "',
'" . $Receipt['paymentmethod'] . "')";
$result = api_DB_query($SQL,$db,'','',true);
@@ -1308,9 +1310,7 @@
* AllocDetails['transno']
* AllocDetails['customerref']
*/
-
- $fp = fopen('/root/Web-Server/DebugInfo.txt','w');
-
+
$Errors = array();
$db = db($User, $Password);
if (gettype($db)=='integer') {
@@ -1325,7 +1325,7 @@
}
$SQL = "SELECT id,
rate,
- ovamount+ovgst-alloc AS lefttoalloc
+ ovamount+ovgst+ovidscount-alloc AS lefttoalloc
FROM debtortrans
WHERE debtorno='" . $AllocDetails['debtorno'] . "'
AND type='" . $AllocDetails['type'] . "'
@@ -1336,27 +1336,29 @@
$Errors[] = NoTransactionToAllocate;
}
- if ($LeftToAllocRow['lefttoalloc'] >= 0){
+ if ($LeftToAllocRow['lefttoalloc'] <= 0){ /* negative if there is owt to allocate */
/*Now look for invoices with the same customerref to allocate to */
$SQL = "SELECT id,
rate,
- -ovamount-ovgst-alloc AS outstanding
+ ovamount+ovgst+ovdiscount-alloc AS outstanding
FROM debtortrans
WHERE debtorno='" . $AllocDetails['debtorno'] . "'
AND type=10
- AND customerref='" . $AllocDetails['customerref'] . "'";
+ AND reference='" . $AllocDetails['customerref'] . "'";
$Result = api_DB_query($SQL,$db);
$OSInvRow = DB_fetch_array($Result);
+
if ($OSInvRow['rate']==$LeftToAllocRow['rate']
AND $OSInvRow['outstanding']>0){
-
- if ($OSInvRow['outstanding']>=$LeftToAllocRow['lefttoalloc']){
+
+ if ($OSInvRow['outstanding']+$LeftToAllocRow['lefttoalloc']>=0){
/*We can allocate the whole amount of the credit/receipt */
- $AllocateAmount = $LeftToAllocRow['lefttoalloc'];
+ $AllocateAmount = -$LeftToAllocRow['lefttoalloc'];
} else {
/*We can only allocate the rest of the invoice outstanding */
$AllocateAmount = $OSInvRow['outstanding'];
}
+
DB_Txn_Begin($db);
/*Now insert the allocation records */
$SQL = "INSERT INTO custallocs (amt,
@@ -1393,7 +1395,7 @@
* delivering it. All values should be sent as negatives.
- * NB: Stock is not updated and the method cannot deal with assembly items
+ * NB: Stock is not updated, taxes are ignored, the method cannot deal with assembly items
* the sales analysis is not updated either
****************** USE WITH CAUTION!! **********************
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|