From: <vv...@us...> - 2015-01-22 20:15:49
|
Revision: 7093 http://sourceforge.net/p/web-erp/reponame/7093 Author: vvs2012 Date: 2015-01-22 20:15:40 +0000 (Thu, 22 Jan 2015) Log Message: ----------- effectiveafter <= '" . date('Y-m-d') . "' AND effectiveto > '" . date('Y-m-d') . "' Modified Paths: -------------- trunk/BOMExtendedQty.php trunk/BOMIndented.php trunk/BOMIndentedReverse.php trunk/BOMInquiry.php trunk/ConfirmDispatch_Invoice.php trunk/CounterReturns.php trunk/CounterSales.php trunk/Credit_Invoice.php trunk/MRP.php trunk/PrintCustOrder_generic.php trunk/PrintWOItemSlip.php trunk/SelectCreditItems.php trunk/SelectOrderItems.php trunk/SelectProduct.php trunk/WOCanBeProducedNow.php trunk/WhereUsedInquiry.php trunk/api/api_debtortransactions.php trunk/api/api_salesorders.php trunk/includes/SQL_CommonFunctions.inc Modified: trunk/BOMExtendedQty.php =================================================================== --- trunk/BOMExtendedQty.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/BOMExtendedQty.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -53,8 +53,8 @@ CONCAT(bom.parent,bom.component) AS sortpart FROM bom WHERE bom.parent ='" . $_POST['Part'] . "' - AND bom.effectiveto >= '" . date('Y-m-d') . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $result = DB_query($sql); $LevelCounter = 2; @@ -80,8 +80,8 @@ (" . filter_number_format($_POST['Quantity']) . " * bom.quantity) as extendedqpa FROM bom WHERE bom.parent ='" . $_POST['Part'] . "' - AND bom.effectiveto >= '" . date('Y-m-d') . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $result = DB_query($sql); //echo "<br />sql is $sql<br />"; // This while routine finds the other levels as long as $ComponentCounter - the @@ -112,8 +112,8 @@ (bom.quantity * passbom.extendedqpa) FROM bom,passbom WHERE bom.parent = passbom.part - AND bom.effectiveto >= '" . date('Y-m-d') . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $result = DB_query($sql); $result = DB_query("DROP TABLE IF EXISTS passbom2"); @@ -134,8 +134,8 @@ FROM bom INNER JOIN passbom2 ON bom.parent = passbom2.part - WHERE bom.effectiveto >= '" . date('Y-m-d') . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "'"; + WHERE bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $result = DB_query($sql); $sql = "SELECT COUNT(bom.parent) AS components Modified: trunk/BOMIndented.php =================================================================== --- trunk/BOMIndented.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/BOMIndented.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -49,8 +49,8 @@ CONCAT(bom.parent,bom.component) AS sortpart FROM bom WHERE bom.parent ='" . $_POST['Part'] . "' - AND bom.effectiveto >= '" . date('Y-m-d') . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $result = DB_query($sql); $LevelCounter = 2; @@ -77,8 +77,8 @@ FROM bom INNER JOIN locationusers ON locationusers.loccode=bom.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1 WHERE bom.parent ='" . $_POST['Part'] . "' - AND bom.effectiveto >= '" . date('Y-m-d') . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $result = DB_query($sql); //echo "<br />sql is $sql<br />"; // This while routine finds the other levels as long as $ComponentCounter - the @@ -111,7 +111,8 @@ FROM bom, passbom INNER JOIN locationusers ON locationusers.loccode=loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1 WHERE bom.parent = passbom.part - AND bom.effectiveto >= '" . date('Y-m-d') . "' AND bom.effectiveafter <= '" . date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $result = DB_query($sql); $sql = "DROP TABLE IF EXISTS passbom2"; @@ -134,8 +135,8 @@ CONCAT(passbom2.sortpart,bom.component) AS sortpart FROM bom,passbom2 WHERE bom.parent = passbom2.part - AND bom.effectiveto >= '" . date('Y-m-d') . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $result = DB_query($sql); Modified: trunk/BOMIndentedReverse.php =================================================================== --- trunk/BOMIndentedReverse.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/BOMIndentedReverse.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -48,8 +48,8 @@ CONCAT(bom.component,bom.parent) AS sortpart FROM bom WHERE bom.component ='" . $_POST['Part'] . "' - AND bom.effectiveto >= '" . date('Y-m-d') . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $result = DB_query($sql); $LevelCounter = 2; @@ -75,8 +75,8 @@ bom.quantity FROM bom WHERE bom.component ='" . $_POST['Part'] . "' - AND bom.effectiveto >= '" . date('Y-m-d') . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $result = DB_query($sql); // This while routine finds the other levels as long as $ComponentCounter - the @@ -106,8 +106,8 @@ bom.quantity FROM bom,passbom WHERE bom.component = passbom.part - AND bom.effectiveto >= '" . date('Y-m-d') . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $result = DB_query($sql); $result = DB_query("DROP TABLE IF EXISTS passbom2"); @@ -126,8 +126,8 @@ CONCAT(passbom2.sortpart,bom.parent) AS sortpart FROM bom,passbom2 WHERE bom.component = passbom2.part - AND bom.effectiveto >= '" . date('Y-m-d') . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $result = DB_query($sql); $result = DB_query("SELECT COUNT(*) FROM bom,passbom WHERE bom.component = passbom.part"); Modified: trunk/BOMInquiry.php =================================================================== --- trunk/BOMInquiry.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/BOMInquiry.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -172,9 +172,8 @@ FROM bom INNER JOIN stockmaster ON bom.component = stockmaster.stockid WHERE bom.parent = '" . $StockID . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "' - AND (bom.effectiveto > '" . Date('Y-m-d') . "' - OR bom.effectiveto='0000-00-00')"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('The bill of material could not be retrieved because'); $BOMResult = DB_query ($sql,$ErrMsg); Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/ConfirmDispatch_Invoice.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -632,8 +632,8 @@ ON stockmaster.stockid=bom.component WHERE bom.parent='" . $OrderLine->StockID . "' AND locstock.loccode='" . $_SESSION['Items'.$identifier]->Location . "' - AND effectiveafter <'" . Date('Y-m-d') . "' - AND effectiveto >='" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve the component quantity left at the location once the assembly item on this order is invoiced (for the purposes of checking that stock will not go negative because)'); $Result = DB_query($SQL,$ErrMsg); @@ -994,8 +994,8 @@ FROM bom INNER JOIN stockmaster ON bom.component=stockmaster.stockid WHERE bom.parent='" . $OrderLine->StockID . "' - AND bom.effectiveto >= '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not retrieve assembly components from the database for'). ' '. $OrderLine->StockID . _('because').' '; $DbgMsg = _('The SQL that failed was'); Modified: trunk/CounterReturns.php =================================================================== --- trunk/CounterReturns.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/CounterReturns.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -413,8 +413,8 @@ bom.quantity FROM bom WHERE bom.parent='" . $NewItem . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve kitset components from the database because') . ' '; $KitResult = DB_query($sql,$ErrMsg,$DbgMsg); @@ -526,8 +526,8 @@ bom.quantity FROM bom WHERE bom.parent='" . $ReturnItemLine->StockID. "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve kitset components from the database because'); $KitResult = DB_query($sql,$ErrMsg); @@ -575,8 +575,8 @@ bom.quantity FROM bom WHERE bom.parent='" . $NewItem . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve kitset components from the database because'); $KitResult = DB_query($sql,$ErrMsg); @@ -626,8 +626,8 @@ bom.quantity FROM bom WHERE bom.parent='" . $NewItem . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve kitset components from the database because'); $KitResult = DB_query($sql,$ErrMsg); @@ -1017,8 +1017,8 @@ stockmaster WHERE bom.component=stockmaster.stockid AND bom.parent='" . $ReturnItemLine->StockID . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not retrieve assembly components from the database for'). ' '. $ReturnItemLine->StockID . _('because').' '; $DbgMsg = _('The SQL that failed was'); Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/CounterSales.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -456,8 +456,8 @@ bom.quantity FROM bom WHERE bom.parent='" . $NewItem . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve kitset components from the database because') . ' '; $KitResult = DB_query($sql,$ErrMsg,$DbgMsg); @@ -567,8 +567,8 @@ bom.quantity FROM bom WHERE bom.parent='" . $OrderLine->StockID. "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve kitset components from the database because'); $KitResult = DB_query($sql,$ErrMsg); @@ -617,8 +617,8 @@ bom.quantity FROM bom WHERE bom.parent='" . $NewItem . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve kitset components from the database because'); $KitResult = DB_query($sql,$ErrMsg); @@ -669,8 +669,8 @@ bom.quantity FROM bom WHERE bom.parent='" . $NewItem . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve kitset components from the database because'); $KitResult = DB_query($sql,$ErrMsg); @@ -1017,8 +1017,8 @@ ON stockmaster.stockid=bom.component WHERE bom.parent='" . $OrderLine->StockID . "' AND locstock.loccode='" . $_SESSION['Items'.$identifier]->Location . "' - AND effectiveafter <'" . Date('Y-m-d') . "' - AND effectiveto >='" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve the component quantity left at the location once the assembly item on this order is invoiced (for the purposes of checking that stock will not go negative because)'); $Result = DB_query($SQL,$ErrMsg); @@ -1418,8 +1418,8 @@ stockmaster WHERE bom.component=stockmaster.stockid AND bom.parent='" . $OrderLine->StockID . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not retrieve assembly components from the database for'). ' '. $OrderLine->StockID . _('because').' '; $DbgMsg = _('The SQL that failed was'); Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/Credit_Invoice.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -748,8 +748,8 @@ stockmaster WHERE bom.component=stockmaster.stockid AND bom.parent='" . $CreditLine->StockID . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve assembly components from the database for') . ' ' . $CreditLine->StockID . ' ' . _('because'); $DbgMsg = _('The SQL that failed was'); Modified: trunk/MRP.php =================================================================== --- trunk/MRP.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/MRP.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -897,8 +897,8 @@ LEFT JOIN levels ON bom.component = levels.part WHERE bom.parent = '".$TopPart."' - AND effectiveafter <= '" . date('Y-m-d') . "' - AND effectiveto >= '" . date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ResultBOM = DB_query($sql); while ($myrow=DB_fetch_array($ResultBOM)) { // Calculate required date by subtracting leadtime from top part's required date Modified: trunk/PrintCustOrder_generic.php =================================================================== --- trunk/PrintCustOrder_generic.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/PrintCustOrder_generic.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -215,7 +215,9 @@ stockmaster.decimalplaces FROM bom INNER JOIN stockmaster ON bom.component=stockmaster.stockid - WHERE bom.parent='" . $myrow2['stkcode'] . "'"; + WHERE bom.parent='" . $myrow2['stkcode'] . "' + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve the components of the ordered assembly item'); $AssemblyResult = DB_query($sql,$ErrMsg); $LeftOvers = $pdf->addTextWrap($XPos,$YPos,150,$FontSize, _('Assembly Components:-')); Modified: trunk/PrintWOItemSlip.php =================================================================== --- trunk/PrintWOItemSlip.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/PrintWOItemSlip.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -72,9 +72,8 @@ AND bom.component = locstock.stockid AND locstock.loccode = '". $Location ."' AND bom.parent = '" . $StockId . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "' - AND (bom.effectiveto > '" . Date('Y-m-d') . "' - OR bom.effectiveto='0000-00-00')"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('The bill of material could not be retrieved because'); $BOMResult = DB_query ($sqlBOM,$ErrMsg); Modified: trunk/SelectCreditItems.php =================================================================== --- trunk/SelectCreditItems.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/SelectCreditItems.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -1440,8 +1440,8 @@ FROM bom INNER JOIN stockmaster ON bom.component=stockmaster.stockid WHERE bom.parent='" . $CreditLine->StockID . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve assembly components from the database for') . ' ' . $CreditLine->StockID . ' ' . _('because'); $DbgMsg = _('The SQL that failed was'); Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/SelectOrderItems.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -881,8 +881,8 @@ bom.quantity FROM bom WHERE bom.parent='" . $NewItem . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve kitset components from the database because') . ' '; $KitResult = DB_query($sql,$ErrMsg,$DbgMsg); @@ -1166,8 +1166,8 @@ bom.quantity FROM bom WHERE bom.parent='" . $NewItem . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve kitset components from the database because'); $KitResult = DB_query($sql,$ErrMsg); @@ -1215,8 +1215,8 @@ bom.quantity FROM bom WHERE bom.parent='" . $NewItem . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve kitset components from the database because'); $KitResult = DB_query($sql,$ErrMsg); Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/SelectProduct.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -153,8 +153,8 @@ FROM bom INNER JOIN stockmaster ON bom.component=stockmaster.stockid WHERE bom.parent='" . $StockID . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"); + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $CostRow = DB_fetch_row($CostResult); $Cost = $CostRow[0]; } else { @@ -184,9 +184,8 @@ stockmaster ON bom.component=stockmaster.stockid WHERE bom.parent = '" . $StockID . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "' - AND (bom.effectiveto > '" . Date('Y-m-d') . "' - OR bom.effectiveto='0000-00-00')"); + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $CostRow = DB_fetch_row($CostResult); $Cost = $CostRow[0]; } else { Modified: trunk/WOCanBeProducedNow.php =================================================================== --- trunk/WOCanBeProducedNow.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/WOCanBeProducedNow.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -105,9 +105,8 @@ AND bom.component = locstock.stockid AND locstock.loccode = '". $Location ."' AND bom.parent = '" . $myItem['stockid'] . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "' - AND (bom.effectiveto > '" . Date('Y-m-d') . "' - OR bom.effectiveto='0000-00-00')"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('The bill of material could not be retrieved because'); $BOMResult = DB_query ($sqlBOM,$ErrMsg); Modified: trunk/WhereUsedInquiry.php =================================================================== --- trunk/WhereUsedInquiry.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/WhereUsedInquiry.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -56,8 +56,8 @@ ON bom.parent = stockmaster.stockid INNER JOIN locationusers ON locationusers.loccode=bom.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1 WHERE component='" . $StockID . "' - AND bom.effectiveafter<='" . Date('Y-m-d') . "' - AND bom.effectiveto >='" . Date('Y-m-d') . "' + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "' ORDER BY stockmaster.discontinued, bom.parent"; $ErrMsg = _('The parents for the selected part could not be retrieved because');; Modified: trunk/api/api_debtortransactions.php =================================================================== --- trunk/api/api_debtortransactions.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/api/api_debtortransactions.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -703,8 +703,8 @@ FROM bom INNER JOIN stockmaster ON bom.component=stockmaster.stockid WHERE bom.parent='" . $CN_Line['stockid'] . "' - AND bom.effectiveto >= '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $AssResult = api_DB_query($SQL); Modified: trunk/api/api_salesorders.php =================================================================== --- trunk/api/api_salesorders.php 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/api/api_salesorders.php 2015-01-22 20:15:40 UTC (rev 7093) @@ -870,8 +870,8 @@ FROM bom INNER JOIN stockmaster ON bom.component=stockmaster.stockid WHERE bom.parent='" . $OrderLineRow['stkcode'] . "' - AND bom.effectiveto >= '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $AssResult = api_DB_query($SQL); Modified: trunk/includes/SQL_CommonFunctions.inc =================================================================== --- trunk/includes/SQL_CommonFunctions.inc 2015-01-22 14:17:10 UTC (rev 7092) +++ trunk/includes/SQL_CommonFunctions.inc 2015-01-22 20:15:40 UTC (rev 7093) @@ -221,8 +221,8 @@ FROM bom LEFT JOIN stockmaster ON bom.component = stockmaster.stockid WHERE bom.parent='". $Parent . "' - AND bom.effectiveafter<='" . Date('Y-m-d') . "' - AND bom.effectiveto>='" . Date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $result = DB_query($SQL); $MyRow = DB_fetch_row($result); $MaterialCost = $MyRow[0]; @@ -276,8 +276,8 @@ ON bom.component=stockmaster.stockid WHERE bom.parent='" . $StockID . "' AND bom.loccode ='" . $LocCode . "' - AND bom.effectiveafter<='" . Date('Y-m-d') . "' - AND bom.effectiveto>='" . Date('Y-m-d') . "' + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "' AND stockmaster.mbflag<>'G' AND bom.component NOT IN ( SELECT stockid @@ -304,8 +304,8 @@ ON bom.component=stockmaster.stockid WHERE bom.parent='" . $StockID . "' AND bom.loccode ='" . $LocCode . "' - AND bom.effectiveafter<='" . Date('Y-m-d') . "' - AND bom.effectiveto>='" . Date('Y-m-d') . "' + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "' AND stockmaster.mbflag<>'G' AND bom.component IN ( SELECT stockid @@ -328,8 +328,8 @@ ON bom.component=stockmaster.stockid WHERE parent='" . $StockID . "' AND loccode ='" . $LocCode . "' - AND bom.effectiveafter<='" . Date('Y-m-d') . "' - AND bom.effectiveto>='" . Date('Y-m-d') . "' + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "' AND stockmaster.mbflag='G'"; $result = DB_query($sql); while ($MyRow=DB_fetch_array($result)) { |