webERP Forum
Select Customer add branch address heaing - Printable Version

+- webERP Forum (http://www.weberp.org/forum)
+-- Forum: webERP Discussion (http://www.weberp.org/forum/forumdisplay.php?fid=1)
+--- Forum: Development Discussion & Specification (http://www.weberp.org/forum/forumdisplay.php?fid=10)
+--- Thread: Select Customer add branch address heaing (/showthread.php?tid=2607)



Select Customer add branch address heaing - daveparrish - 11-12-2015

Hi All
I am trying to add the Customer branch braddress1 the heading when a customer is selected I can get this to work in place of the phone number but I would like them both.
The issue is with the sql select statement see below

if ($_SESSION['CustomerID'] != '' AND !isset($_POST['Search']) AND !isset($_POST['CSV'])) {
if (!isset($_SESSION['BranchCode'])) {
$SQL = "SELECT debtorsmaster.name,
custbranch.braddress1
custbranch.phoneno
FROM debtorsmaster INNER JOIN custbranch
ON debtorsmaster.debtorno=custbranch.debtorno
WHERE custbranch.debtorno='" . $_SESSION['CustomerID'] . "'";

} //!isset($_SESSION['BranchCode'])
else {
$SQL = "SELECT debtorsmaster.name,
custbranch.braddress1
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, $ErrMsg);
if ($myrow = DB_fetch_array($result)) {
$CustomerName = htmlspecialchars($myrow['name'], ENT_QUOTES, 'UTF-8', false);
$PhoneNo = $myrow['phoneno'];
$BrAddress1 = $myrow['braddress1'];


Any help would be appreciated
Thanks For All The Great Work
Dave


RE: Select Customer add branch address heaing - falkoner - 11-12-2015

I think there should be a , (comma) after the custbranch.braddress1 field,

Thanks
tim


RE: Select Customer add branch address heaing - daveparrish - 11-13-2015

I got it forgot the comma between custbranch.braddress1, custbranch.phoneno
Thanks

if ($_SESSION['CustomerID'] != '' AND !isset($_POST['Search']) AND !isset($_POST['CSV'])) {
if (!isset($_SESSION['BranchCode'])) {
$SQL = "SELECT debtorsmaster.name,
custbranch.braddress1
custbranch.phoneno
FROM debtorsmaster INNER JOIN custbranch
ON debtorsmaster.debtorno=custbranch.debtorno
WHERE custbranch.debtorno='" . $_SESSION['CustomerID'] . "'";

} //!isset($_SESSION['BranchCode'])
else {
$SQL = "SELECT debtorsmaster.name,
custbranch.braddress1, 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, $ErrMsg);
if ($myrow = DB_fetch_array($result)) {
$CustomerName = htmlspecialchars($myrow['name'], ENT_QUOTES, 'UTF-8', false);
$PhoneNo = $myrow['phoneno'];
$BrAddress1 = $myrow['braddress1'];