Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
StockMovements.php: wrong results when customer has several branches
02-09-2019, 05:15 AM
Post: #1
StockMovements.php: wrong results when customer has several branches
a stock movement report for an item sold to one branch of a customer with multiple branches shows repeating rows for all branches

Line 73: changed from:
Code:
$sql = "SELECT stockmoves.stockid,
                systypes.typename,
                stockmoves.type,
                stockmoves.transno,
                stockmoves.trandate,
                stockmoves.userid,
                stockmoves.debtorno,
                stockmoves.branchcode,
                custbranch.brname,
                stockmoves.qty,
                stockmoves.reference,
                stockmoves.price,
                stockmoves.discountpercent,
                stockmoves.newqoh,
                stockmaster.decimalplaces
        FROM stockmoves
        INNER JOIN systypes ON stockmoves.type=systypes.typeid
        INNER JOIN stockmaster ON stockmoves.stockid=stockmaster.stockid
        INNER JOIN custbranch ON stockmoves.debtorno=custbranch.debtorno
        WHERE  stockmoves.loccode='" . $_POST['StockLocation'] . "'
        AND stockmoves.trandate >= '". $SQLAfterDate . "'
        AND stockmoves.stockid = '" . $StockID . "'
        AND stockmoves.trandate <= '" . $SQLBeforeDate . "'
        AND hidemovt=0
        ORDER BY stkmoveno DESC";

to:

Code:
$sql = "SELECT stockmoves.stockid,
                systypes.typename,
                stockmoves.type,
                stockmoves.transno,
                stockmoves.trandate,
                stockmoves.userid,
                stockmoves.debtorno,
                stockmoves.branchcode,
                custbranch.brname,
                stockmoves.qty,
                stockmoves.reference,
                stockmoves.price,
                stockmoves.discountpercent,
                stockmoves.newqoh,
                stockmaster.decimalplaces
        FROM stockmoves
        INNER JOIN systypes ON stockmoves.type=systypes.typeid
        INNER JOIN stockmaster ON stockmoves.stockid=stockmaster.stockid
        INNER JOIN custbranch ON stockmoves.debtorno=custbranch.debtorno
        WHERE  stockmoves.loccode='" . $_POST['StockLocation'] . "'
        AND stockmoves.trandate >= '". $SQLAfterDate . "'
        AND stockmoves.stockid = '" . $StockID . "'
        AND stockmoves.trandate <= '" . $SQLBeforeDate . "'
        AND stockmoves.branchcode = custbranch.branchcode
        AND hidemovt=0
        ORDER BY stkmoveno DESC";

attached before and after


Attached File(s) Thumbnail(s)
       
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
StockMovements.php: wrong results when customer has several branches - HDeriauFF - 02-09-2019 05:15 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)