|
From: <dai...@us...> - 2012-12-20 08:38:29
|
Revision: 5768
http://sourceforge.net/p/web-erp/reponame/5768
Author: daintree
Date: 2012-12-20 08:38:22 +0000 (Thu, 20 Dec 2012)
Log Message:
-----------
removed trailing whitespace for Tim
Modified Paths:
--------------
trunk/AccountGroups.php
trunk/AuditTrail.php
trunk/BOMIndented.php
trunk/BOMInquiry.php
trunk/BOMListing.php
trunk/BOMs.php
trunk/BackupDatabase.php
trunk/COGSGLPostings.php
trunk/ConfirmDispatch_Invoice.php
trunk/ContractBOM.php
trunk/ContractCosting.php
trunk/ContractOtherReqts.php
trunk/CopyBOM.php
trunk/CounterReturns.php
trunk/CounterSales.php
trunk/Credit_Invoice.php
trunk/Currencies.php
trunk/CustWhereAlloc.php
trunk/CustomerAllocations.php
trunk/CustomerReceipt.php
trunk/CustomerTransInquiry.php
trunk/CustomerTypes.php
trunk/DailyBankTransactions.php
trunk/DailySalesInquiry.php
trunk/DebtorsAtPeriodEnd.php
trunk/DeliveryDetails.php
trunk/Departments.php
trunk/EDISendInvoices.php
trunk/EDISendInvoices_Reece.php
trunk/EmailCustTrans.php
trunk/ExchangeRateTrend.php
trunk/Factors.php
trunk/FixedAssetCategories.php
trunk/FixedAssetDepreciation.php
trunk/FixedAssetItems.php
trunk/FixedAssetTransfer.php
trunk/FreightCosts.php
trunk/GLAccountCSV.php
trunk/GLAccountInquiry.php
trunk/GLAccountReport.php
trunk/GLBalanceSheet.php
trunk/GLBudgets.php
trunk/GLJournal.php
trunk/GLProfit_Loss.php
trunk/GLTagProfit_Loss.php
trunk/GLTags.php
trunk/GLTransInquiry.php
trunk/GLTrialBalance.php
trunk/GLTrialBalance_csv.php
trunk/GeocodeSetup.php
trunk/GetStockImage.php
trunk/GoodsReceived.php
trunk/InternalStockCategoriesByRole.php
trunk/InternalStockRequest.php
trunk/InternalStockRequestAuthorisation.php
trunk/InternalStockRequestFulfill.php
trunk/InventoryQuantities.php
trunk/Locations.php
trunk/MRPDemandTypes.php
trunk/MRPDemands.php
trunk/MRPPlannedPurchaseOrders.php
trunk/MRPReport.php
trunk/MRPReschedules.php
trunk/MRPShortages.php
trunk/NoSalesItems.php
trunk/OffersReceived.php
trunk/OrderDetails.php
trunk/OutstandingGRNs.php
trunk/PDFBankingSummary.php
trunk/PDFCustomerList.php
trunk/PDFDeliveryDifferences.php
trunk/PDFGrn.php
trunk/PDFLowGP.php
trunk/PDFOrdersInvoiced.php
trunk/PDFPeriodStockTransListing.php
trunk/PDFPickingList.php
trunk/PDFRemittanceAdvice.php
trunk/PDFStockCheckComparison.php
trunk/PDFStockNegatives.php
trunk/PDFSuppTransListing.php
trunk/PDFTopItems.php
trunk/POReport.php
trunk/PO_AuthorisationLevels.php
trunk/PO_AuthoriseMyOrders.php
trunk/PO_Chk_ShiptRef_JobRef.php
trunk/PO_Header.php
trunk/PO_Items.php
trunk/PO_OrderDetails.php
trunk/PO_PDFPurchOrder.php
trunk/PO_SelectOSPurchOrder.php
trunk/PO_SelectPurchOrder.php
trunk/PageSecurity.php
trunk/PaymentMethods.php
trunk/PaymentTerms.php
trunk/Payments.php
trunk/PcAssignCashToTab.php
trunk/PcClaimExpensesFromTab.php
trunk/PcExpenses.php
trunk/PcExpensesTypeTab.php
trunk/PcTabs.php
trunk/PcTypeTabs.php
trunk/PeriodsInquiry.php
trunk/PricesByCost.php
trunk/PrintCheque.php
trunk/PrintCustOrder.php
trunk/PrintCustOrder_generic.php
trunk/PrintCustTrans.php
trunk/ReorderLevel.php
trunk/ReorderLevelLocation.php
trunk/ReprintGRN.php
trunk/SalesAnalRepts.php
trunk/SalesCategories.php
trunk/SalesCategoryPeriodInquiry.php
trunk/SalesGraph.php
trunk/SalesPeople.php
trunk/SalesTopItemsInquiry.php
trunk/SecurityTokens.php
trunk/SelectAsset.php
trunk/SelectCompletedOrder.php
trunk/SelectCreditItems.php
trunk/SelectCustomer.php
trunk/SelectOrderItems.php
trunk/SelectProduct.php
trunk/SelectRecurringSalesOrder.php
trunk/SelectSupplier.php
trunk/SelectWorkOrder.php
trunk/ShipmentCosting.php
trunk/Shipments.php
trunk/Shipt_Select.php
trunk/StockCounts.php
trunk/StockLocTransferReceive.php
trunk/StockReorderLevel.php
trunk/StockTransferControlled.php
trunk/StockUsage.php
trunk/SuppContractChgs.php
trunk/SuppCreditGRNs.php
trunk/SuppFixedAssetChgs.php
trunk/SuppInvGRNs.php
trunk/SuppPaymentRun.php
trunk/SuppPriceList.php
trunk/SuppShiptChgs.php
trunk/SuppTransGLAnalysis.php
trunk/SupplierAllocations.php
trunk/SupplierBalsAtPeriodEnd.php
trunk/SupplierCredit.php
trunk/SupplierInquiry.php
trunk/SupplierInvoice.php
trunk/SupplierPriceList.php
trunk/SupplierTenderCreate.php
trunk/SupplierTransInquiry.php
trunk/SupplierTypes.php
trunk/Tax.php
trunk/TaxAuthorityRates.php
trunk/TaxProvinces.php
trunk/TopItems.php
trunk/UnitsOfMeasure.php
trunk/UpgradeDatabase.php
trunk/UserSettings.php
trunk/WWW_Access.php
trunk/WorkCentres.php
trunk/WorkOrderCosting.php
trunk/WorkOrderIssue.php
trunk/WorkOrderReceive.php
trunk/Z_BottomUpCosts.php
trunk/Z_ChangeBranchCode.php
trunk/Z_ChangeCustomerCode.php
trunk/Z_ChangeLocationCode.php
trunk/Z_ChangeStockCategory.php
trunk/Z_ChangeStockCode.php
trunk/Z_CheckAllocationsFrom.php
trunk/Z_CheckAllocs.php
trunk/Z_CheckDebtorsControl.php
trunk/Z_CreateCompanyTemplateFile.php
trunk/Z_CurrencyDebtorsBalances.php
trunk/Z_CurrencySuppliersBalances.php
trunk/Z_DeleteCreditNote.php
trunk/Z_DeleteInvoice.php
trunk/Z_ImportFixedAssets.php
trunk/Z_MakeNewCompany.php
trunk/Z_SalesIntegrityCheck.php
trunk/Z_UpdateChartDetailsBFwd.php
trunk/api/api_branches.php
trunk/api/api_currencies.php
trunk/api/api_errorcodes.php
trunk/api/api_glaccounts.php
trunk/api/api_glgroups.php
trunk/api/api_glsections.php
trunk/api/api_holdreasons.php
trunk/api/api_locations.php
trunk/api/api_paymentterms.php
trunk/api/api_purchdata.php
trunk/api/api_salesareas.php
trunk/api/api_salesorders.php
trunk/api/api_salestypes.php
trunk/api/api_stock.php
trunk/api/api_stockcategories.php
trunk/api/api_workorders.php
trunk/doc/Manual/ManualContents.php
trunk/includes/Add_SerialItems.php
trunk/includes/Add_SerialItemsOut.php
trunk/includes/ConnectDB_mysqli.inc
trunk/includes/ConnectDB_postgres.inc
trunk/includes/ConstructSQLForUserDefinedSalesReport.inc
trunk/includes/Contract_Readin.php
trunk/includes/CountriesArray.php
trunk/includes/DateFunctions.inc
trunk/includes/DefineCartClass.php
trunk/includes/DefineContractClass.php
trunk/includes/DefineCustAllocsClass.php
trunk/includes/DefineJournalClass.php
trunk/includes/DefineLabelClass.php
trunk/includes/DefineOfferClass.php
trunk/includes/DefinePOClass.php
trunk/includes/DefinePaymentClass.php
trunk/includes/DefineShiptClass.php
trunk/includes/DefineSpecialOrderClass.php
trunk/includes/DefineSuppTransClass.php
trunk/includes/DefineTenderClass.php
trunk/includes/EDIconfig.inc
trunk/includes/FreightCalculation.inc
trunk/includes/GetConfig.php
trunk/includes/GetPaymentMethods.php
trunk/includes/GetSalesTransGLCodes.inc
trunk/includes/InputSerialItems.php
trunk/includes/InputSerialItemsExisting.php
trunk/includes/InputSerialItemsKeyed.php
trunk/includes/LanguageSetup.php
trunk/includes/LanguagesArray.php
trunk/includes/MiscFunctions.php
trunk/includes/OutputSerialItems.php
trunk/includes/PDFBalanceSheetPageHeader.inc
trunk/includes/PDFInventoryValnPageHeader.inc
trunk/includes/PDFPaymentRun_PymtFooter.php
trunk/includes/PDFProfitAndLossPageHeader.inc
trunk/includes/PDFSalesAnalysis.inc
trunk/includes/PDFStarter.php
trunk/includes/PDFTabReportHeader.inc
trunk/includes/PDFTopItemsHeader.inc
trunk/includes/PDFTransPageHeaderPortrait.inc
trunk/includes/PDFTrialBalancePageHeader.inc
trunk/includes/PO_ReadInOrder.inc
trunk/includes/RFC822.php
trunk/includes/SelectOrderItems_IntoCart.inc
trunk/includes/Z_POSDataCreation.php
trunk/includes/barcodepack/class.barcode.php
trunk/includes/barcodepack/class.code128.php
trunk/includes/barcodepack/class.ean13.php
trunk/includes/barcodepack/class.i2of5.php
trunk/includes/barcodepack/class.linearBarcode.php
trunk/includes/barcodepack/class.qrCode.php
trunk/includes/barcodepack/class.s2of5.php
trunk/includes/barcodepack/class.upc.php
trunk/includes/class.pdf.php
trunk/includes/header.inc
trunk/includes/phplot/phplot.php
trunk/includes/session.inc
trunk/install/index.php
trunk/install/save.php
trunk/install/timezone.php
trunk/locale/de_DE.utf8/Manual/ManualContents.php
trunk/reportwriter/FormMaker.php
trunk/reportwriter/ReportMaker.php
trunk/reportwriter/admin/ReportCreator.php
trunk/reportwriter/install/ReportListLinks.php
Modified: trunk/AccountGroups.php
===================================================================
--- trunk/AccountGroups.php 2012-12-19 06:59:15 UTC (rev 5767)
+++ trunk/AccountGroups.php 2012-12-20 08:38:22 UTC (rev 5768)
@@ -63,7 +63,7 @@
$i=1;
$sql="SELECT count(groupname)
- FROM accountgroups
+ FROM accountgroups
WHERE groupname='".$_POST['GroupName']."'";
$DbgMsg = _('The SQL that was used to retrieve the information was');
@@ -191,7 +191,7 @@
prnMsg( _('Cannot delete this account group because general ledger accounts have been created using this group'),'warn');
echo '<br />' . _('There are') . ' ' . $myrow['groups'] . ' ' . _('general ledger accounts that refer to this account group');
echo '<br /><form method="post" id="AccountGroups" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">';
-
+
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<table class="selection">';
echo '<input type="hidden" name="OriginalAccountGroup" value="' . $_GET['SelectedAccountGroup'] . '" />';
@@ -358,7 +358,7 @@
</tr>';
} elseif (!isset($_POST['MoveGroup'])) { //end of if $_POST['SelectedAccountGroup'] only do the else when a new record is being entered
-
+
if (!isset($_POST['SelectedAccountGroup'])){
$_POST['SelectedAccountGroup']='';
}
Modified: trunk/AuditTrail.php
===================================================================
--- trunk/AuditTrail.php 2012-12-19 06:59:15 UTC (rev 5767)
+++ trunk/AuditTrail.php 2012-12-20 08:38:22 UTC (rev 5768)
@@ -117,7 +117,7 @@
$SQLString = str_replace('SET','',$SQLString);
$SQLString = str_replace('WHERE',',',$SQLString);
$SQLString = str_replace('AND',',',$SQLString);
- $FieldArray = preg_split("/[[:space:]]*([[:alnum:].]+[[:space:]]*=[[:space:]]*(?:'[^']*'|[[:digit:].]+))[[:space:]]*,/", $SQLString, 0, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
+ $FieldArray = preg_split("/[[:space:]]*([[:alnum:].]+[[:space:]]*=[[:space:]]*(?:'[^']*'|[[:digit:].]+))[[:space:]]*,/", $SQLString, 0, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
for ($i=0; $i<sizeof($FieldArray); $i++) {
$Assigment = explode('=', $FieldArray[$i]);
$_SESSION['SQLString']['fields'][$i] = $Assigment[0];
@@ -138,7 +138,7 @@
$_SESSION['SQLString']['fields'][0] = $Assigment[0];
$_SESSION['SQLString']['values'][0] = $Assigment[1];
}
-
+
if (mb_strlen($ContainingText) > 0) {
$ContainingText = " AND querystring LIKE '%" . $ContainingText . "%' ";
}else{
Modified: trunk/BOMIndented.php
===================================================================
--- trunk/BOMIndented.php 2012-12-19 06:59:15 UTC (rev 5767)
+++ trunk/BOMIndented.php 2012-12-20 08:38:22 UTC (rev 5768)
@@ -49,7 +49,7 @@
CONCAT(bom.parent,bom.component) AS sortpart
FROM bom
WHERE bom.parent ='" . $_POST['Part'] . "'
- AND bom.effectiveto >= NOW()
+ AND bom.effectiveto >= NOW()
AND bom.effectiveafter <= NOW()";
$result = DB_query($sql,$db);
@@ -76,7 +76,7 @@
bom.quantity
FROM bom
WHERE bom.parent ='" . $_POST['Part'] . "'
- AND bom.effectiveto >= NOW()
+ AND bom.effectiveto >= NOW()
AND bom.effectiveafter <= NOW()";
$result = DB_query($sql,$db);
//echo "<br />sql is $sql<br />";
@@ -132,7 +132,7 @@
CONCAT(passbom2.sortpart,bom.component) AS sortpart
FROM bom,passbom2
WHERE bom.parent = passbom2.part
- AND bom.effectiveto >= NOW()
+ AND bom.effectiveto >= NOW()
AND bom.effectiveafter <= NOW()";
$result = DB_query($sql,$db);
@@ -184,7 +184,7 @@
$fill = false;
$pdf->SetFillColor(224,235,255);
- $ListCount = DB_num_rows($result);
+ $ListCount = DB_num_rows($result);
while ($myrow = DB_fetch_array($result,$db)){
@@ -246,7 +246,7 @@
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />';
echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">
- <div>
+ <div>
<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
<table class="selection">';
echo '<tr>
Modified: trunk/BOMInquiry.php
===================================================================
--- trunk/BOMInquiry.php 2012-12-19 06:59:15 UTC (rev 5767)
+++ trunk/BOMInquiry.php 2012-12-20 08:38:22 UTC (rev 5768)
@@ -61,9 +61,9 @@
FROM stockmaster INNER JOIN locstock
ON stockmaster.stockid = locstock.stockid
WHERE stockmaster.description " . LIKE . " '$SearchString'
- AND (stockmaster.mbflag='M'
- OR stockmaster.mbflag='K'
- OR stockmaster.mbflag='A'
+ AND (stockmaster.mbflag='M'
+ OR stockmaster.mbflag='K'
+ OR stockmaster.mbflag='A'
OR stockmaster.mbflag='G')
GROUP BY stockmaster.stockid,
stockmaster.description,
@@ -98,8 +98,8 @@
} //one of keywords or StockCode was more than a zero length string
} //end of if search
-if (isset($_POST['Search'])
- AND isset($result)
+if (isset($_POST['Search'])
+ AND isset($result)
AND !isset($SelectedParent)) {
echo '<br />
@@ -151,18 +151,18 @@
}
if (isset($StockID) and $StockID!=""){
-
- $result = DB_query("SELECT description,
- units,
- labourcost,
- overheadcost
- FROM stockmaster
+
+ $result = DB_query("SELECT description,
+ units,
+ labourcost,
+ overheadcost
+ FROM stockmaster
WHERE stockid='" . $StockID . "'",
$db);
$myrow = DB_fetch_array($result);
$ParentLabourCost = $myrow['labourcost'];
$ParentOverheadCost = $myrow['overheadcost'];
-
+
$sql = "SELECT bom.parent,
bom.component,
stockmaster.description,
@@ -170,7 +170,7 @@
stockmaster.materialcost+ stockmaster.labourcost+stockmaster.overheadcost as standardcost,
bom.quantity,
bom.quantity * (stockmaster.materialcost+ stockmaster.labourcost+ stockmaster.overheadcost) AS componentcost
- FROM bom INNER JOIN stockmaster
+ FROM bom INNER JOIN stockmaster
ON bom.component = stockmaster.stockid
WHERE bom.parent = '" . $StockID . "'
AND bom.effectiveafter < Now()
@@ -237,7 +237,7 @@
$j++;
}
-
+
$TotalCost += $ParentLabourCost;
echo '<tr>
<td colspan="4" class="number"><b>' . _('Labour Cost') . '</b></td>
Modified: trunk/BOMListing.php
===================================================================
--- trunk/BOMListing.php 2012-12-19 06:59:15 UTC (rev 5767)
+++ trunk/BOMListing.php 2012-12-20 08:38:22 UTC (rev 5768)
@@ -98,9 +98,9 @@
$YPos -=$line_height;
$pdf->line($Page_Width-$Right_Margin, $YPos,$Left_Margin, $YPos);
-
+
$pdf->OutputD($_SESSION['DatabaseName'] . '_BOMListing_' . date('Y-m-d').'.pdf');
- $pdf->__destruct();
+ $pdf->__destruct();
} else { /*The option to print PDF was not hit */
Modified: trunk/BOMs.php
===================================================================
--- trunk/BOMs.php 2012-12-19 06:59:15 UTC (rev 5767)
+++ trunk/BOMs.php 2012-12-20 08:38:22 UTC (rev 5768)
@@ -20,7 +20,7 @@
FROM bom WHERE parent='" . $Parent. "'"
,$db);
if (DB_num_rows($c_result) > 0) {
-
+
while ($row = DB_fetch_array($c_result)) {
//echo '<br />Parent: ' . $Parent . ' Level: ' . $Level . ' row[component]: ' . $row['component'] .'<br />';
if ($Parent != $row['component']) {
@@ -85,13 +85,13 @@
locstock.quantity AS qoh,
stockmaster.decimalplaces
FROM bom INNER JOIN stockmaster
- ON bom.component=stockmaster.stockid
- INNER JOIN locations ON
- bom.loccode = locations.loccode
- INNER JOIN workcentres
+ ON bom.component=stockmaster.stockid
+ INNER JOIN locations ON
+ bom.loccode = locations.loccode
+ INNER JOIN workcentres
ON bom.workcentreadded=workcentres.code
- INNER JOIN locstock
- ON bom.loccode=locstock.loccode
+ INNER JOIN locstock
+ ON bom.loccode=locstock.loccode
AND bom.component = locstock.stockid
WHERE bom.component='".$Component."'
AND bom.parent = '".$Parent."'";
@@ -106,10 +106,10 @@
while ($myrow=DB_fetch_array($result)) {
$Level1 = str_repeat('- ',$Level-1).$Level;
- if( $myrow['mbflag']=='B'
- OR $myrow['mbflag']=='K'
+ if( $myrow['mbflag']=='B'
+ OR $myrow['mbflag']=='K'
OR $myrow['mbflag']=='D') {
-
+
$DrillText = '%s%s';
$DrillLink = '<div class="centre">'._('No lower levels').'</div>';
$DrillID='';
@@ -132,12 +132,12 @@
OR $myrow['mbflag']=='K' //kit-set
OR $myrow['mbflag']=='A' // assembly
OR $myrow['mbflag']=='G') /* ghost */ {
-
+
$QuantityOnHand = _('N/A');
} else {
$QuantityOnHand = locale_number_format($myrow['qoh'],$myrow['decimalplaces']);
- }
-
+ }
+
printf('<td>%s</td>
<td>%s</td>
<td>%s</td>
@@ -372,8 +372,8 @@
//the link to delete a selected record was clicked instead of the Submit button
- $sql="DELETE FROM bom
- WHERE parent='".$SelectedParent."'
+ $sql="DELETE FROM bom
+ WHERE parent='".$SelectedParent."'
AND component='".$SelectedComponent."'
AND loccode='".$Location."'
AND workcentreadded='".$WorkCentre."'";
@@ -382,8 +382,8 @@
$DbgMsg = _('The SQL used to delete the BOM was');
$result = DB_query($sql,$db,$ErrMsg,$DbgMsg);
- $ComponentSQL = "SELECT component
- FROM bom
+ $ComponentSQL = "SELECT component
+ FROM bom
WHERE parent='" . $SelectedParent ."'";
$ComponentResult = DB_query($ComponentSQL,$db);
$ComponentArray = DB_fetch_row($ComponentResult);
@@ -464,11 +464,11 @@
echo '</table>';
}
// Display Assembly Parent Items
- $sql = "SELECT bom.parent,
- stockmaster.description,
+ $sql = "SELECT bom.parent,
+ stockmaster.description,
stockmaster.mbflag
FROM bom INNER JOIN stockmaster
- ON bom.parent=stockmaster.stockid
+ ON bom.parent=stockmaster.stockid
WHERE bom.component='".$SelectedParent."'
AND stockmaster.mbflag='A'";
@@ -488,11 +488,11 @@
echo '</table>';
}
// Display Kit Sets
- $sql = "SELECT bom.parent,
- stockmaster.description,
+ $sql = "SELECT bom.parent,
+ stockmaster.description,
stockmaster.mbflag
FROM bom INNER JOIN stockmaster
- ON bom.parent=stockmaster.stockid
+ ON bom.parent=stockmaster.stockid
WHERE bom.component='".$SelectedParent."'
AND stockmaster.mbflag='K'";
@@ -512,11 +512,11 @@
echo '</table>';
}
// Display Phantom/Ghosts
- $sql = "SELECT bom.parent,
- stockmaster.description,
+ $sql = "SELECT bom.parent,
+ stockmaster.description,
stockmaster.mbflag
FROM bom INNER JOIN stockmaster
- ON bom.parent=stockmaster.stockid
+ ON bom.parent=stockmaster.stockid
WHERE bom.component='".$SelectedParent."'
AND stockmaster.mbflag='G'";
@@ -601,7 +601,7 @@
workcentreadded,
quantity,
autoissue
- FROM bom
+ FROM bom
WHERE parent='".$SelectedParent."'
AND component='".$SelectedComponent."'";
@@ -871,10 +871,10 @@
<br /><div class="centre"><input tabindex="3" type="submit" name="Search" value="' . _('Search Now') . '" /></div>';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
- if (isset($_POST['Search'])
- AND isset($result)
+ if (isset($_POST['Search'])
+ AND isset($result)
AND !isset($SelectedParent)) {
-
+
echo '<br />
<table cellpadding="2" class="selection">';
$TableHeader = '<tr>
@@ -883,9 +883,9 @@
<th>' . _('On Hand') . '</th>
<th>' . _('Units') . '</th>
</tr>';
-
+
echo $TableHeader;
-
+
$j = 1;
$k=0; //row colour counter
while ($myrow=DB_fetch_array($result)) {
@@ -911,17 +911,17 @@
$myrow['description'],
$StockOnHand,
$myrow['units']);
-
+
$j++;
//end of page full new headings if
}
//end of while loop
-
+
echo '</table>';
-
+
}
//end if results to show
-
+
if (!isset($SelectedParent) or $SelectedParent=='') {
echo '<script type="text/javascript">defaultControl(document.forms[0].StockCode);</script>';
} else {
@@ -941,7 +941,7 @@
foreach($array as $key => $item) {
// Serialize the current element and create a md5 hash
$hash = md5(serialize($item));
- // If the md5 didn't come up yet, add the element to
+ // If the md5 didn't come up yet, add the element to
// arrayRewrite, otherwise drop it
if (!isset($arrayHashes[$hash])) {
// Save the current element hash
Modified: trunk/BackupDatabase.php
===================================================================
--- trunk/BackupDatabase.php 2012-12-19 06:59:15 UTC (rev 5767)
+++ trunk/BackupDatabase.php 2012-12-20 08:38:22 UTC (rev 5768)
@@ -11,11 +11,11 @@
$BackupFiles = scandir('companies/' . $_SESSION['DatabaseName'], 0);
$DeletedFiles = false;
foreach ($BackupFiles as $BackupFile){
-
+
if (mb_substr($BackupFile,0,6)=='Backup'){
-
+
$DeleteResult = unlink('companies/' . $_SESSION['DatabaseName'] . '/' . $BackupFile);
-
+
if ($DeleteResult==true){
prnMsg(_('Deleted') . ' companies/' . $_SESSION['DatabaseName'] . '/' . $BackupFile,'info');
$DeletedFiles = true;
@@ -30,15 +30,15 @@
prnMsg(_('No backup files on the server were deleted'),'info');
}
} else {
-
+
$BackupFile = $rootpath . '/companies/' . $_SESSION['DatabaseName'] .'/' . _('Backup') . '_' . Date('Y-m-d-H-i-s') . '.sql.gz';
- $Command = 'mysqldump --opt -h' . $host . ' -u' . $dbuser . ' -p' . $dbpassword . ' ' . $_SESSION['DatabaseName'] . '| gzip > ' .
+ $Command = 'mysqldump --opt -h' . $host . ' -u' . $dbuser . ' -p' . $dbpassword . ' ' . $_SESSION['DatabaseName'] . '| gzip > ' .
$_SERVER['DOCUMENT_ROOT'] . $BackupFile;
-
-
+
+
$CommandOutput = array();
exec($Command,$CommandOutput, $ReturnValue);
-
+
if ($ReturnValue ==0) {
prnMsg(_('The backup file has now been created. You must now download this to your computer because in case the web-server has a disk failure the backup would then not on the same machine. Use the link below') . '<br /><br /><a href="' . $BackupFile . '">' . _('Download the backup file to your locale machine') . '</a>','success');
prnMsg(_('Once you have downloaded the database backup file to your local machine you should use the link below to delete it - backup files can consume a lot of space on your hosting account and will accumulate if not deleted - they also contain sensitive information which would otherwise be available for others to download!'),'info');
@@ -50,7 +50,7 @@
}
}
/*
-//this could be a weighty file attachment!!
+//this could be a weighty file attachment!!
include('includes/htmlMimeMail.php');
$mail = new htmlMimeMail();
$attachment = $mail->getFile( $BackupFile);
Modified: trunk/COGSGLPostings.php
===================================================================
--- trunk/COGSGLPostings.php 2012-12-19 06:59:15 UTC (rev 5767)
+++ trunk/COGSGLPostings.php 2012-12-20 08:38:22 UTC (rev 5768)
@@ -138,12 +138,12 @@
$sql = "INSERT INTO accountgroups ( groupname,
sectioninaccounts,
pandl,
- sequenceintb )
+ sequenceintb )
VALUES ('Sales',
'1',
'1',
'10')";
-
+
$result = DB_query($sql,$db);
}
$sql = "SELECT accountcode FROM chartmaster WHERE accountcode ='1'";
@@ -215,7 +215,7 @@
$myrow['id'],
htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?',
$myrow['id']);
-
+
}//END WHILE LIST LOOP
echo '</table>';
}
Modified: trunk/ConfirmDispatch_Invoice.php
===================================================================
--- trunk/ConfirmDispatch_Invoice.php 2012-12-19 06:59:15 UTC (rev 5767)
+++ trunk/ConfirmDispatch_Invoice.php 2012-12-20 08:38:22 UTC (rev 5768)
@@ -116,7 +116,7 @@
$_SESSION['Items'.$identifier]->PhoneNo = $myrow['contactphone'];
$_SESSION['Items'.$identifier]->Email = $myrow['contactemail'];
$_SESSION['Items'.$identifier]->SalesPerson = $myrow['salesperson'];
-
+
$_SESSION['Items'.$identifier]->Location = $myrow['fromstkloc'];
$_SESSION['Items'.$identifier]->FreightCost = $myrow['freightcost'];
$_SESSION['Old_FreightCost'] = $myrow['freightcost'];
Modified: trunk/ContractBOM.php
===================================================================
--- trunk/ContractBOM.php 2012-12-19 06:59:15 UTC (rev 5767)
+++ trunk/ContractBOM.php 2012-12-20 08:38:22 UTC (rev 5768)
@@ -399,7 +399,7 @@
}#end if SearchResults to show
echo '<hr />
- </div>
+ </div>
</form>';
include('includes/footer.inc');
?>
\ No newline at end of file
Modified: trunk/ContractCosting.php
===================================================================
--- trunk/ContractCosting.php 2012-12-19 06:59:15 UTC (rev 5767)
+++ trunk/ContractCosting.php 2012-12-20 08:38:22 UTC (rev 5768)
@@ -51,7 +51,7 @@
$InventoryIssues[$InventoryIssuesRow['stockid']]->Units = $InventoryIssuesRow['units'];
$InventoryIssues[$InventoryIssuesRow['stockid']]->DecimalPlaces = $InventoryIssuesRow['decimalplaces'];
$InventoryIssues[$InventoryIssuesRow['stockid']]->Matched = 0;
-
+
}
echo '<p class="page_title_text">
@@ -89,7 +89,7 @@
<th>' . _('Unit Cost') . '</th>
<th>' . _('Total Cost') . '</th>
</tr>';
-
+
$ContractBOMBudget = 0;
$ContractBOMActual = 0;
foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $Component) {
@@ -100,9 +100,9 @@
<td>' . $Component->UOM . '</td>
<td class="number">' . locale_number_format($Component->ItemCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td>
<td class="number">' . locale_number_format(($Component->ItemCost * $Component->Quantity),$_SESSION['CompanyRecord']['decimalplaces']) . '</td>';
-
+
$ContractBOMBudget += ($Component->ItemCost * $Component->Quantity);
-
+
if (isset($InventoryIssues[$Component->StockID])){
$InventoryIssues[$Component->StockID]->Matched=1;
echo '<td colspan="2" align="center">' . _('Actual usage') . '</td>
@@ -153,7 +153,7 @@
<th>' . _('Unit Cost') . '</th>
<th>' . _('Total Cost') . '</th>
</tr>';
-
+
foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $Requirement) {
echo '<tr><td>' . $Requirement->Requirement . '</td>
<td class="number">' . locale_number_format($Requirement->Quantity,'Variable') . '</td>
@@ -355,7 +355,7 @@
1,
'" . ($OtherReqtsBudget+$ContractBOMBudget) . "',
'" . ($QtyOnHandPrior + 1) . "')";
-
+
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('stock movement records could not be inserted when processing the work order receipt because');
$DbgMsg = _('The following SQL to insert the stock movement records was used');
$Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
Modified: trunk/ContractOtherReqts.php
===================================================================
--- trunk/ContractOtherReqts.php 2012-12-19 06:59:15 UTC (rev 5767)
+++ trunk/ContractOtherReqts.php 2012-12-20 08:38:22 UTC (rev 5768)
@@ -159,15 +159,15 @@
<td>' . _('Cost Per Unit') . ':</td>
<td><input type="text" class="number" name="CostPerUnit" size="10" maxlength="10" value="' . $_POST['CostPerUnit'] . '" /></td>
</tr>
-
+
</table>
-
+
<br />
<div class="centre">
<input type="submit" name="EnterNewRequirement" value="' . _('Enter New Contract Requirement') . '" />
</div>
</div>
</form>';
-
+
include('includes/footer.inc');
?>
Modified: trunk/CopyBOM.php
===================================================================
--- trunk/CopyBOM.php 2012-12-19 06:59:15 UTC (rev 5767)
+++ trunk/CopyBOM.php 2012-12-20 08:38:22 UTC (rev 5768)
@@ -19,7 +19,7 @@
$NewOrExisting = $_POST['NewOrExisting'];
$NewStockID = '';
$InputError = 0; //assume the best
-
+
if($NewOrExisting == 'N') {
$NewStockID = $_POST['ToStockID'];
if (mb_strlen($NewStockID)==0 OR $NewStockID==''){
@@ -104,9 +104,9 @@
FROM stockmaster
WHERE stockid='".$StockID."';";
$result = DB_query($sql, $db);
-
+
$myrow = DB_fetch_row($result);
-
+
$sql = "UPDATE stockmaster set
lastcostupdate = " . $myrow[0] . ",
actualcost = " . $myrow[1] . ",
@@ -118,7 +118,7 @@
WHERE stockid='".$NewStockID."';";
$result = DB_query($sql, $db);
}
-
+
$sql = "INSERT INTO bom
SELECT '".$NewStockID."' AS parent,
component,
@@ -131,7 +131,7 @@
FROM bom
WHERE parent='".$StockID."';";
$result = DB_query($sql, $db);
-
+
if($NewOrExisting == 'N') {
$sql = "INSERT INTO locstock
SELECT loccode,
@@ -140,14 +140,14 @@
reorderlevel
FROM locstock
WHERE stockid='".$StockID."'";
-
+
$result = DB_query($sql, $db);
}
-
+
$result = DB_Txn_Commit($db);
-
+
UpdateCost($db, $NewStockID);
-
+
header('Location: BOMs.php?Select='.$NewStockID);
ob_end_flush();
} //end if there is no input error
Modified: trunk/CounterReturns.php
===================================================================
--- trunk/CounterReturns.php 2012-12-19 06:59:15 UTC (rev 5767)
+++ trunk/CounterReturns.php 2012-12-20 08:38:22 UTC (rev 5768)
@@ -1,1840 +1,1840 @@
-<?php
-/* $Id: CounterReturns.php 4469 2011-01-15 02:28:37Z daintree $*/
-
-include('includes/DefineCartClass.php');
-
-/* Session started in session.inc for password checking and authorisation level check
-config.php is in turn included in session.inc $PageSecurity now comes from session.inc (and gets read in by GetConfig.php*/
-
-/* style="color:red" */
-
-
-include('includes/session.inc');
-
-$title = _('Counter Returns');
-
-include('includes/header.inc');
-include('includes/GetPrice.inc');
-include('includes/SQL_CommonFunctions.inc');
-include('includes/GetSalesTransGLCodes.inc');
-
-if (empty($_GET['identifier'])) {
- $identifier=date('U');
-} else {
- $identifier=$_GET['identifier'];
-}
-if (isset($_SESSION['Items'.$identifier]) AND isset($_POST['CustRef'])){
- //update the Items object variable with the data posted from the form
- $_SESSION['Items'.$identifier]->CustRef = $_POST['CustRef'];
- $_SESSION['Items'.$identifier]->Comments = $_POST['Comments'];
- $_SESSION['Items'.$identifier]->DeliverTo = $_POST['DeliverTo'];
- $_SESSION['Items'.$identifier]->PhoneNo = $_POST['PhoneNo'];
- $_SESSION['Items'.$identifier]->Email = $_POST['Email'];
- $_SESSION['Items'.$identifier]->SalesPerson = $_POST['SalesPerson'];
-}
-
-if (isset($_POST['QuickEntry'])){
- unset($_POST['PartSearch']);
-}
-
-if (isset($_POST['SelectingReturnItems'])){
- foreach ($_POST as $FormVariable => $Quantity) {
- if (mb_strpos($FormVariable,'ReturnQty')!==false) {
- $NewItemArray[$_POST['StockID' . mb_substr($FormVariable,9)]] = filter_number_format($Quantity);
- }
- }
-}
-
-if (isset($_GET['NewItem'])){
- $NewItem = trim($_GET['NewItem']);
-}
-
-if (isset($_GET['NewReturn'])){
- /*New return entry - clear any existing return details from the ReturnItems object and initiate a newy*/
- if (isset($_SESSION['Items'.$identifier])){
- unset ($_SESSION['Items'.$identifier]->LineItems);
- $_SESSION['Items'.$identifier]->ItemsOrdered=0;
- unset ($_SESSION['Items'.$identifier]);
- }
-}
-
-$AlreadyWarnedAboutCredit = true; //no point testing credit limits for a return!!
-
-if (!isset($_SESSION['Items'.$identifier])){
- /* It must be a new return being created $_SESSION['Items'.$identifier] would be set up from the
- modification code above if a modification to an existing retur. Also $ExistingOrder would be
- set to 1. */
-
- $_SESSION['ExistingOrder'. $identifier] = 0;
- $_SESSION['Items'.$identifier] = new cart;
-
- /*Get the default customer-branch combo from the user's default location record */
- $sql = "SELECT cashsalecustomer,
- cashsalebranch,
- locationname,
- taxprovinceid
- FROM locations
- WHERE loccode='" . $_SESSION['UserStockLocation'] ."'";
- $result = DB_query($sql,$db);
- if (DB_num_rows($result)==0) {
- prnMsg(_('Your user account does not have a valid default inventory location set up. Please see the system administrator to modify your user account.'),'error');
- include('includes/footer.inc');
- exit;
- } else {
- $myrow = DB_fetch_array($result); //get the only row returned
-
- if ($myrow['cashsalecustomer']=='' OR $myrow['cashsalebranch']==''){
- prnMsg(_('To use this script it is first necessary to define a cash sales customer for the location that is your default location. The default cash sale customer is defined under set up ->Inventory Locations Maintenance. The customer should be entered using the customer code and a valid branch code of the customer entered.'),'error');
- include('includes/footer.inc');
- exit;
- }
- if (isset($_GET['DebtorNo'])) {
- $_SESSION['Items'.$identifier]->DebtorNo = $_GET['DebtorNo'];
- $_SESSION['Items'.$identifier]->Branch = $_GET['BranchNo'];
- } else {
- $_SESSION['Items'.$identifier]->DebtorNo = $myrow['cashsalecustomer'];
- $_SESSION['Items'.$identifier]->Branch = $myrow['cashsalebranch'];
- }
-
- $_SESSION['Items'.$identifier]->LocationName = $myrow['locationname'];
- $_SESSION['Items'.$identifier]->Location = $_SESSION['UserStockLocation'];
- $_SESSION['Items'.$identifier]->DispatchTaxProvince = $myrow['taxprovinceid'];
-
- // Now check to ensure this account exists and set defaults */
- $sql = "SELECT debtorsmaster.name,
- holdreasons.dissallowinvoices,
- debtorsmaster.salestype,
- salestypes.sales_type,
- debtorsmaster.currcode,
- debtorsmaster.customerpoline,
- paymentterms.terms,
- currencies.decimalplaces
- FROM debtorsmaster INNER JOIN holdreasons
- ON debtorsmaster.holdreason=holdreasons.reasoncode
- INNER JOIN salestypes
- ON debtorsmaster.salestype=salestypes.typeabbrev
- INNER JOIN paymentterms
- ON debtorsmaster.paymentterms=paymentterms.termsindicator
- INNER JOIN currencies
- ON debtorsmaster.currcode=currencies.currabrev
- WHERE debtorsmaster.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'";
-
- $ErrMsg = _('The details of the customer selected') . ': ' . $_SESSION['Items'.$identifier]->DebtorNo . ' ' . _('cannot be retrieved because');
- $DbgMsg = _('The SQL used to retrieve the customer details and failed was') . ':';
- // echo $sql;
- $result =DB_query($sql,$db,$ErrMsg,$DbgMsg);
-
- $myrow = DB_fetch_array($result);
- $_SESSION['RequireCustomerSelection']=0;
- $_SESSION['Items'.$identifier]->CustomerName = $myrow['name'];
- // the sales type is the price list to be used for this sale
- $_SESSION['Items'.$identifier]->DefaultSalesType = $myrow['salestype'];
- $_SESSION['Items'.$identifier]->SalesTypeName = $myrow['sales_type'];
- $_SESSION['Items'.$identifier]->DefaultCurrency = $myrow['currcode'];
- $_SESSION['Items'.$identifier]->DefaultPOLine = $myrow['customerpoline'];
- $_SESSION['Items'.$identifier]->PaymentTerms = $myrow['terms'];
- $_SESSION['Items'.$identifier]->CurrDecimalPlaces = $myrow['decimalplaces'];
- /* now get the branch defaults from the customer branches table CustBranch. */
-
- $sql = "SELECT custbranch.brname,
- custbranch.braddress1,
- custbranch.defaultshipvia,
- custbranch.deliverblind,
- custbranch.specialinstructions,
- custbranch.estdeliverydays,
- custbranch.salesman,
- custbranch.taxgroupid,
- custbranch.defaultshipvia
- FROM custbranch
- WHERE custbranch.branchcode='" . $_SESSION['Items'.$identifier]->Branch . "'
- AND custbranch.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'";
- $ErrMsg = _('The customer branch record of the customer selected') . ': ' . $_SESSION['Items'.$identifier]->Branch . ' ' . _('cannot be retrieved because');
- $DbgMsg = _('SQL used to retrieve the branch details was') . ':';
- $result =DB_query($sql,$db,$ErrMsg,$DbgMsg);
-
- if (DB_num_rows($result)==0){
-
- prnMsg(_('The branch details for branch code') . ': ' . $_SESSION['Items'.$identifier]->Branch . ' ' . _('against customer code') . ': ' . $_SESSION['Items'.$identifier]->DebtorNo . ' ' . _('could not be retrieved') . '. ' . _('Check the set up of the customer and branch'),'error');
-
- if ($debug==1){
- echo '<br />' . _('The SQL that failed to get the branch details was') . ':<br />' . $sql;
- }
- include('includes/footer.inc');
- exit;
- }
- // add echo
- echo '<br />';
- $myrow = DB_fetch_array($result);
-
- $_SESSION['Items'.$identifier]->DeliverTo = '';
- $_SESSION['Items'.$identifier]->DelAdd1 = $myrow['braddress1'];
- $_SESSION['Items'.$identifier]->ShipVia = $myrow['defaultshipvia'];
- $_SESSION['Items'.$identifier]->DeliverBlind = $myrow['deliverblind'];
- $_SESSION['Items'.$identifier]->SpecialInstructions = $myrow['specialinstructions'];
- $_SESSION['Items'.$identifier]->DeliveryDays = $myrow['estdeliverydays'];
- $_SESSION['Items'.$identifier]->TaxGroup = $myrow['taxgroupid'];
- $_SESSION['Items'.$identifier]->TaxGroup = $myrow['taxgroupid'];
- $_SESSION['Items'.$identifier]->SalesPerson = $myrow['salesman'];
- if ($_SESSION['Items'.$identifier]->SpecialInstructions) {
- prnMsg($_SESSION['Items'.$identifier]->SpecialInstructions,'warn');
- }
- } // user does not have valid inventory location
-} // end if its a new return to be set up
-
-if (isset($_POST['CancelReturn'])) {
-
- unset($_SESSION['Items'.$identifier]->LineItems);
- $_SESSION['Items'.$identifier]->ItemsOrdered = 0;
- unset($_SESSION['Items'.$identifier]);
- $_SESSION['Items'.$identifier] = new cart;
-
- echo '<br /><br />';
- prnMsg(_('This return has been cancelled as requested'),'success');
- echo '<br /><br /><a href="' .htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">' . _('Start a new Counter Return') . '</a>';
- include('includes/footer.inc');
- exit;
-
-} else { /*Not cancelling the return */
-
- echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Counter Return') . '" alt="" />' . ' ';
- echo '<font color="red" size="5">' . $_SESSION['Items'.$identifier]->CustomerName . '<br /> ' . _('Counter Return') . ' ' . _('to') . ' ' . $_SESSION['Items'.$identifier]->LocationName . ' ' . _('inventory') . ' (' . _('all amounts in') . ' ' . $_SESSION['Items'.$identifier]->DefaultCurrency . ')';
- echo '</font></p>';
-}
-
-if (isset($_POST['Search']) OR isset($_POST['Next']) OR isset($_POST['Prev'])){
-
- if ($_POST['Keywords']!='' AND $_POST['StockCode']=='') {
- $msg='<div class="page_help_text">' . _('Item description has been used in search') . '.</div>';
- } else if ($_POST['StockCode']!='' AND $_POST['Keywords']=='') {
- $msg='<div class="page_help_text">' . _('Item Code has been used in search') . '.</div>';
- } else if ($_POST['Keywords']=='' AND $_POST['StockCode']=='') {
- $msg='<div class="page_help_text">' . _('Stock Category has been used in search') . '.</div>';
- }
- if (isset($_POST['Keywords']) AND mb_strlen($_POST['Keywords'])>0) {
- //insert wildcard characters in spaces
- $_POST['Keywords'] = mb_strtoupper($_POST['Keywords']);
- $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%';
-
- if ($_POST['StockCat']=='All'){
- $SQL = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.longdescription,
- stockmaster.units,
- stockmaster.decmimalplaces
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
- AND stockmaster.mbflag <>'G'
- AND stockmaster.controlled <> 1
- AND stockmaster.description " . LIKE . " '" . $SearchString . "'
- AND stockmaster.discontinued=0
- ORDER BY stockmaster.stockid";
- } else {
- $SQL = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.longdescription,
- stockmaster.units,
- stockmaster.decimalplaces
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
- AND stockmaster.mbflag <>'G'
- AND stockmaster.controlled <> 1
- AND stockmaster.discontinued=0
- AND stockmaster.description " . LIKE . " '" . $SearchString . "'
- AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
- ORDER BY stockmaster.stockid";
- }
-
- } else if (mb_strlen($_POST['StockCode'])>0){
-
- $_POST['StockCode'] = mb_strtoupper($_POST['StockCode']);
- $SearchString = '%' . $_POST['StockCode'] . '%';
-
- if ($_POST['StockCat']=='All'){
- $SQL = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.longdescription,
- stockmaster.units,
- stockmaster.decimalplaces
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
- AND stockmaster.stockid " . LIKE . " '" . $SearchString . "'
- AND stockmaster.mbflag <>'G'
- AND stockmaster.controlled <> 1
- AND stockmaster.discontinued=0
- ORDER BY stockmaster.stockid";
- } else {
- $SQL = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.longdescription,
- stockmaster.units,
- stockmaster.decimalplaces
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
- AND stockmaster.stockid " . LIKE . " '" . $SearchString . "'
- AND stockmaster.mbflag <>'G'
- AND stockmaster.controlled <> 1
- AND stockmaster.discontinued=0
- AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
- ORDER BY stockmaster.stockid";
- }
-
- } else {
- if ($_POST['StockCat']=='All'){
- $SQL = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.longdescription,
- stockmaster.units,
- stockmaster.decimalplaces
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
- AND stockmaster.mbflag <>'G'
- AND stockmaster.controlled <> 1
- AND stockmaster.discontinued=0
- ORDER BY stockmaster.stockid";
- } else {
- $SQL = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.longdescription,
- stockmaster.units,
- stockmaster.decimalplaces
- FROM stockmaster INNER JOIN stockcategory
- ON stockmaster.categoryid=stockcategory.categoryid
- WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
- AND stockmaster.mbflag <>'G'
- AND stockmaster.controlled <> 1
- AND stockmaster.discontinued=0
- AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
- ORDER BY stockmaster.stockid";
- }
- }
-
- if (isset($_POST['Next'])) {
- $Offset = $_POST['NextList'];
- }
- if (isset($_POST['Prev'])) {
- $Offset = $_POST['previous'];
- }
- if (!isset($Offset) or $Offset<0) {
- $Offset=0;
- }
- $SQL = $SQL . ' LIMIT ' . $_SESSION['DefaultDisplayRecordsMax'].' OFFSET '.strval($_SESSION['DefaultDisplayRecordsMax']*$Offset);
-
- $ErrMsg = _('There is a problem selecting the part records to display because');
- $DbgMsg = _('The SQL used to get the part selection was');
- $SearchResult = DB_query($SQL,$db,$ErrMsg, $DbgMsg);
-
- if (DB_num_rows($SearchResult)==0 ){
- prnMsg (_('There are no products available meeting the criteria specified'),'info');
- }
- if (DB_num_rows($SearchResult)==1){
- $myrow=DB_fetch_array($SearchResult);
- $NewItem = $myrow['stockid'];
- DB_data_seek($SearchResult,0);
- }
- if (DB_num_rows($SearchResult)< $_SESSION['DisplayRecordsMax']){
- $Offset=0;
- }
-
-} //end of if search
-
-
-/* Always do the stuff below */
-
-echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?identifier='.$identifier . '" name="SelectParts" method="post">';
-echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
-
-//Get The exchange rate used for GPPercent calculations on adding or amending items
-if ($_SESSION['Items'.$identifier]->DefaultCurrency != $_SESSION['CompanyRecord']['currencydefault']){
- $ExRateResult = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['Items'.$identifier]->DefaultCurrency . "'",$db);
- if (DB_num_rows($ExRateResult)>0){
- $ExRateRow = DB_fetch_row($ExRateResult);
- $ExRate = $ExRateRow[0];
- } else {
- $ExRate =1;
- }
-} else {
- $ExRate = 1;
-}
-
-/*Process Quick Entry */
-/* If enter is pressed on the quick entry screen, the default button may be Recalculate */
- if (isset($_POST['SelectingReturnItems'])
- OR isset($_POST['QuickEntry'])
- OR isset($_POST['Recalculate'])){
-
- /* get the item details from the database and hold them in the cart object */
-
- /*Discount can only be set later on -- after quick entry -- so default discount to 0 in the first place */
- $Discount = 0;
- $i=1;
- while ($i<=$_SESSION['QuickEntries']
- AND isset($_POST['part_' . $i])
- AND $_POST['part_' . $i]!='') {
-
- $QuickEntryCode = 'part_' . $i;
- $QuickEntryQty = 'qty_' . $i;
-
- $i++;
-
- if (isset($_POST[$QuickEntryCode])) {
- $NewItem = mb_strtoupper($_POST[$QuickEntryCode]);
- }
- if (isset($_POST[$QuickEntryQty])) {
- $NewItemQty = filter_number_format($_POST[$QuickEntryQty]);
- }
- $NewItemDue = Date($_SESSION['DefaultDateFormat']);
- $NewPOLine = 0;
-
-
- if (!isset($NewItem)){
- unset($NewItem);
- break; /* break out of the loop if nothing in the quick entry fields*/
- }
-
-
- /*Now figure out if the item is a kit set - the field MBFlag='K'*/
- $sql = "SELECT stockmaster.mbflag,
- stockmaster.controlled
- FROM stockmaster
- WHERE stockmaster.stockid='". $NewItem ."'";
-
- $ErrMsg = _('Could not determine if the part being ordered was a kitset or not because');
- $DbgMsg = _('The sql that was used to determine if the part being ordered was a kitset or not was ');
- $KitResult = DB_query($sql, $db,$ErrMsg,$DbgMsg);
-
-
- if (DB_num_rows($KitResult)==0){
- prnMsg( _('The item code') . ' ' . $NewItem . ' ' . _('could not be retrieved from the database and has not been added to the return'),'warn');
- } elseif ($myrow=DB_fetch_array($KitResult)){
- if ($myrow['mbflag']=='K'){ /*It is a kit set item */
- $sql = "SELECT bom.component,
- bom.quantity
- FROM bom
- WHERE bom.parent='" . $NewItem . "'
- AND bom.effectiveto > '" . Date('Y-m-d') . "'
- AND bom.effectiveafter < '" . Date('Y-m-d') . "'";
-
- $ErrMsg = _('Could not retrieve kitset components from the database because') . ' ';
- $KitResult = DB_query($sql,$db,$ErrMsg,$DbgMsg);
-
- $ParentQty = $NewItemQty;
- while ($KitParts = DB_fetch_array($KitResult,$db)) {
- $NewItem = $KitParts['component'];
- $NewItemQty = $KitParts['quantity'] * $ParentQty;
- $NewPOLine = 0;
- include('includes/SelectOrderItems_IntoCart.inc');
- $_SESSION['Items'.$identifier]->GetTaxes(($_SESSION['Items'.$identifier]->LineCounter - 1));
- }
-
- } else if ($myrow['mbflag']=='G'){
- prnMsg(_('Phantom assemblies cannot be returned, these items exist only as bills of materials used in other manufactured items. The following item has not been added to the return:') . ' ' . $NewItem, 'warn');
- } else if ($myrow['controlled']==1){
- prnMsg(_('The system does not currently cater for counter returns of lot controlled or serialised items'),'warn');
- } else if ($NewItemQty<=0) {
- prnMsg(_('Only items entered with a positive quantity can be added to the return'),'warn');
- } else { /*Its not a kit set item*/
- include('includes/SelectOrderItems_IntoCart.inc');
- $_SESSION['Items'.$identifier]->GetTaxes(($_SESSION['Items'.$identifier]->LineCounter - 1));
- }
- }
- }
- unset($NewItem);
- } /* end of if quick entry */
-
- /*Now do non-quick entry delete/edits/adds */
-
-if ((isset($_SESSION['Items'.$identifier])) OR isset($NewItem)) {
-
- if (isset($_GET['Delete'])){
- $_SESSION['Items'.$identifier]->remove_from_cart($_GET['Delete']); /*Don't do any DB updates*/
- }
-
- foreach ($_SESSION['Items'.$identifier]->LineItems as $ReturnItemLine) {
-
- if (isset($_POST['Quantity_' . $ReturnItemLine->LineNumber])){
-
- $Quantity = round(filter_number_format($_POST['Quantity_' . $ReturnItemLine->LineNumber]),$ReturnItemLine->DecimalPlaces);
-
- if (ABS($ReturnItemLine->Price - filter_number_format($_POST['Price_' . $ReturnItemLine->LineNumber]))>0.01){
- /*There is a new price being input for the line item */
-
- $Price = filter_number_format($_POST['Price_' . $ReturnItemLine->LineNumber]);
- $_POST['GPPercent_' . $ReturnItemLine->LineNumber] = (($Price*(1-(filter_number_format($_POST['Discount_' . $ReturnItemLine->LineNumber])/100))) - $ReturnItemLine->StandardCost*$ExRate)/($Price *(1-filter_number_format($_POST['Discount_' . $ReturnItemLine->LineNumber]))/100);
-
- } elseif (ABS($ReturnItemLine->GPPercent - filter_number_format($_POST['GPPercent_' . $ReturnItemLine->LineNumber]))>=0.01) {
- /* A GP % has been input so need to do a recalculation of the price at this new GP Percentage */
-
-
- prnMsg(_('Recalculated the price from the GP % entered - the GP % was') . ' ' . $ReturnItemLine->GPPercent . ' the new GP % is ' . filter_number_format($_POST['GPPercent_' . $ReturnItemLine->LineNumber]),'info');
-
-
- $Price = ($ReturnItemLine->StandardCost*$ExRate)/(1 -((filter_number_format($_POST['GPPercent_' . $ReturnItemLine->LineNumber]) + filter_number_format($_POST['Discount_' . $ReturnItemLine->LineNumber]))/100));
- } else {
- $Price = filter_number_format($_POST['Price_' . $ReturnItemLine->LineNumber]);
- }
- $DiscountPercentage = filter_number_format($_POST['Discount_' . $ReturnItemLine->LineNumber]);
- if ($_SESSION['AllowOrderLineItemNarrative'] == 1) {
- $Narrative = $_POST['Narrative_' . $ReturnItemLine->LineNumber];
- } else {
- $Narrative = '';
- }
-
- if (!isset($ReturnItemLine->DiscountPercent)) {
- $ReturnItemLine->DiscountPercent = 0;
- }
-
- if ($Quantity<0 or $Price <0 or $DiscountPercentage >100 or $DiscountPercentage <0){
- prnMsg(_('The item could not be updated because you are attempting to set the quantity returned to less than 0 or the price less than 0 or the discount more than 100% or less than 0%'),'warn');
- } else if ($ReturnItemLine->Quantity !=$Quantity
- OR $ReturnItemLine->Price != $Price
- OR abs($ReturnItemLine->DiscountPercent -$DiscountPercentage/100) >0.001
- OR $ReturnItemLine->Narrative != $Narrative
- OR $ReturnItemLine->ItemDue != $_POST['ItemDue_' . $ReturnItemLine->LineNumber]
- OR $ReturnItemLine->POLine != $_POST['POLine_' . $ReturnItemLine->LineNumber]) {
-
- $_SESSION['Items'.$identifier]->update_cart_item($ReturnItemLine->LineNumber,
- $Quantity,
- $Price,
- $DiscountPercentage/100,
- $Narrative,
- 'Yes', /*Update DB */
- $_POST['ItemDue_' . $ReturnItemLine->LineNumber],
- $_POST['POLine_' . $ReturnItemLine->LineNumber],
- filter_number_format($_POST['GPPercent_' . $ReturnItemLine->LineNumber]),
- $identifier);
- }
- } //page not called from itself - POST variables not set
- }
-}
-
-if (isset($_POST['Recalculate'])) {
- foreach ($_SESSION['Items'.$identifier]->LineItems as $ReturnItemLine) {
- $NewItem=$ReturnItemLine->StockID;
- $sql = "SELECT stockmaster.mbflag,
- stockmaster.controlled
- FROM stockmaster
- WHERE stockmaster.stockid='". $ReturnItemLine->StockID."'";
-
- $ErrMsg = _('Could not determine if the part being ordered was a kitset or not because');
- $DbgMsg = _('The sql that was used to determine if the part being ordered was a kitset or not was ');
- $KitResult = DB_query($sql, $db,$ErrMsg,$DbgMsg);
- if ($myrow=DB_fetch_array($KitResult)){
- if ($myrow['mbflag']=='K'){ /*It is a kit set item */
- $sql = "SELECT bom.component,
- bom.quantity
- FROM bom
- WHERE bom.parent='" . $ReturnItemLine->StockID. "'
- AND bom.effectiveto > '" . Date('Y-m-d') . "'
- AND bom.effectiveafter < '" . Date('Y-m-d') . "'";
-
- $ErrMsg = _('Could not retrieve kitset components from the database because');
- $KitResult = DB_query($sql,$db,$ErrMsg);
-
- $ParentQty = $NewItemQty;
- while ($KitParts = DB_fetch_array($KitResult,$db)){
- $NewItem = $KitParts['component'];
- $NewItemQty = $KitParts['quantity'] * $ParentQty;
- $NewPOLine = 0;
- $NewItemDue = date($_SESSION['DefaultDateFormat']);
- $_SESSION['Items'.$identifier]->GetTaxes($ReturnItemLine->LineNumber);
- }
-
- } else { /*Its not a kit set item*/
- $NewItemDue = date($_SESSION['DefaultDateFormat']);
- $NewPOLine = 0;
- $_SESSION['Items'.$identifier]->GetTaxes($ReturnItemLine->LineNumber);
- }
- }
- unset($NewItem);
- } /* end of if its a new item */
-}
-
-if (isset($NewItem)){
-/* get the item details from the database and hold them in the cart object make the quantity 1 by default then add it to the cart
-Now figure out if the item is a kit set - the field MBFlag='K'
-* controlled items and ghost/phantom items cannot be selected because the SQL to show items to select doesn't show 'em
-* */
-
- $sql = "SELECT stockmaster.mbflag,
- stockmaster.taxcatid
- FROM stockmaster
- WHERE stockmaster.stockid='". $NewItem ."'";
-
- $ErrMsg = _('Could not determine if the part being ordered was a kitset or not because');
-
- $KitResult = DB_query($sql, $db,$ErrMsg);
-
- $NewItemQty = 1; /*By Default */
- $Discount = 0; /*By default - can change later or discount category override */
-
- if ($myrow=DB_fetch_array($KitResult)){
- if ($myrow['mbflag']=='K'){ /*It is a kit set item */
- $sql = "SELECT bom.component,
- bom.quantity
- FROM bom
- WHERE bom.parent='" . $NewItem . "'
- AND bom.effectiveto > '" . Date('Y-m-d') . "'
- AND bom.effectiveafter < '" . Date('Y-m-d') . "'";
-
- $ErrMsg = _('Could not retrieve kitset components from the database because');
- $KitResult = DB_query($sql,$db,$ErrMsg);
-
- $ParentQty = $NewItemQty;
- while ($KitParts = DB_fetch_array($KitResult,$db)){
- $NewItem = $KitParts['component'];
- $NewItemQty = $KitParts['quantity'] * $ParentQty;
- $NewPOLine = 0;
- $NewItemDue = date($_SESSION['DefaultDateFormat']);
- include('includes/SelectOrderItems_IntoCart.inc');
- $_SESSION['Items'.$identifier]->GetTaxes(($_SESSION['Items'.$identifier]->LineCounter - 1));
- }
-
- } else { /*Its not a kit set item*/
- $NewItemDue = date($_SESSION['DefaultDateFormat']);
- $NewPOLine = 0;
-
- include('includes/SelectOrderItems_IntoCart.inc');
- $_SESSION['Items'.$identifier]->GetTaxes(($_SESSION['Items'.$identifier]->LineCounter - 1));
- }
-
- } /* end of if its a new item */
-
-} /*end of if its a new item */
-
-if (isset($NewItemArray) AND isset($_POST['SelectingReturnItems'])){
-/* get the item details from the database and hold them in the cart object make the quantity 1 by default then add it to the cart */
-/*Now figure out if the item is a kit set - the field MBFlag='K'*/
-
- foreach($NewItemArray as $NewItem => $NewItemQty) {
- if($NewItemQty > 0) {
- $sql = "SELECT stockmaster.mbflag
- FROM stockmaster
- WHERE stockmaster.stockid='". $NewItem ."'";
-
- $ErrMsg = _('Could not determine if the part being returned was a kitset or not because');
-
- $KitResult = DB_query($sql, $db,$ErrMsg);
-
- //$NewItemQty = 1; /*By Default */
- $Discount = 0; /*By default - can change later or discount category override */
-
- if ($myrow=DB_fetch_array($KitResult)){
- if ($myrow['mbflag']=='K'){ /*It is a kit set item */
- $sql = "SELECT bom.component,
- bom.quantity
- FROM bom
- WHERE bom.parent='" . $NewItem . "'
- AND bom.effectiveto > '" . Date('Y-m-d') . "'
- AND bom.effectiveafter < '" . Date('Y-m-d') . "'";
-
- $ErrMsg = _('Could not retrieve kitset components from the database because');
- $KitResult = DB_query($sql,$db,$ErrMsg);
-
- $ParentQty = $NewItemQty;
- while ($KitParts = DB_fetch_array($KitResult,$db)){
- $NewItem = $KitParts['component'];
- $NewItemQty = $KitParts['quantity'] * $ParentQty;
- $NewItemDue = date($_SESSION['DefaultDateFormat']);
- $NewPOLine = 0;
- include('includes/SelectOrderItems_IntoCart.inc');
- $_SESSION['Items'.$identifier]->GetTaxes(($_SESSION['Items'.$identifier]->LineCounter - 1));
- }
-
- } else { /*Its not a kit set item*/
- $NewItemDue = date($_SESSION['DefaultDateFormat']);
- $NewPOLine = 0;
- include('includes/SelectOrderItems_IntoCart.inc');
- $_SESSION['Items'.$identifier]->GetTaxes(($_SESSION['Items'.$identifier]->LineCounter - 1));
- }
- } /* end of if its a new item */
- } /*end of if its a new item */
- }
-}
-
-
-if (count($_SESSION['Items'.$identifier]->LineItems)>0){ /*only show return lines if there are any */
-/*
-// *************************************************************************
-// T H I S W H E R E T H E R E T U R N I S D I S P L A Y E D
-// *************************************************************************
-*/
-
- echo '<br />
- <table width="90%" cellpadding="2" colspan="7">
- <tr bgcolor="#800000">';
- echo '<th>' . _('Item Code') . '</th>
- <th>' . _('Item Description') . '</th>
- <th>' . _('Quantity') . '</th>
- <th>' . _('Unit') . '</th>
- <th>' . _('Price') . '</th>
- <th>' . _('Discount') . '</th>
- <th>' . _('GP %') . '</th>
- <th>' . _('Net') . '</th>
- <th>' . _('Tax') . '</th>
- <th>' . _('Total') . '<br />' . _('Incl Tax') . '</th>
- </tr>';
-
- $_SESSION['Items'.$identifier]->total = 0;
- $_SESSION['Items'.$identifier]->totalVolume = 0;
- $_SESSION['Items'.$identifier]->totalWeight = 0;
- $TaxTotals = array();
- $TaxGLCodes = array();
- $TaxTotal =0;
- $k =0; //row colour counter
- foreach ($_SESSION['Items'.$identifier]->LineItems as $ReturnItemLine) {
-
- $SubTotal = $ReturnItemLine->Quantity * $ReturnItemLine->Price * (1 - $ReturnItemLine->DiscountPercent);
- $DisplayDiscount = locale_number_format(($ReturnItemLine->DiscountPercent * 100),2);
- $QtyReturned = $ReturnItemLine->Quantity;
-
- if ($k==1){
- $RowStarter = '<tr class="OddTableRows">';
- $k=0;
- } else {
- $RowStarter = '<tr class="EvenTableRows">';
- $k=1;
- }
-
- echo $RowStarter;
- echo '<input type="hidden" name="POLine_' . $ReturnItemLine->LineNumber . '" value="" />';
- echo '<input type="hidden" name="ItemDue_' . $ReturnItemLine->LineNumber . '" value="'.$ReturnItemLine->ItemDue.'" />';
-
- echo '<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?identifier='.$identifier . '&StockID=' . $ReturnItemLine->StockID . '&DebtorNo=' . $_SESSION['Items'.$identifier]->DebtorNo . '">' . $ReturnItemLine->StockID . '</a></td>
- <td title="' . $ReturnItemLine->LongDescription . '">' . $ReturnItemLine->ItemDescription . '</td>';
-
- echo '<td><input class="number" tabindex="2" type="text" name="Qu...
[truncated message content] |