$_SESSION['Items' . $identifier]->DelAdd5 = $myrow['braddress5']; $_SESSION['Items' . $identifier]->DelAdd6 = $myrow['braddress6']; $_SESSION['Items' . $identifier]->PhoneNo = $myrow['phoneno']; $_SESSION['Items' . $identifier]->Email = $myrow['email']; $_SESSION['Items' . $identifier]->Location = $myrow['defaultlocation']; $_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]->LocationName = $myrow['locationname']; if ($_SESSION['Items' . $identifier]->SpecialInstructions) { prnMsg($_SESSION['Items' . $identifier]->SpecialInstructions, 'warn'); } if ($_SESSION['CheckCreditLimits'] > 0) { /*Check credit limits is 1 for warn and 2 for prohibit sales */ $_SESSION['Items' . $identifier]->CreditAvailable = GetCreditAvailable($_POST['Select'], $db); if ($_SESSION['CheckCreditLimits'] == 1 and $_SESSION['Items' . $identifier]->CreditAvailable <= 0) { prnMsg(_('The') . ' ' . $myrow[0] . ' ' . _('account is currently at or over their credit limit'), 'warn'); } elseif ($_SESSION['CheckCreditLimits'] == 2 and $_SESSION['Items' . $identifier]->CreditAvailable <= 0) { prnMsg(_('No more orders can be placed by') . ' ' . $myrow[0] . ' ' . _(' their account is currently at or over their credit limit'), 'warn'); include 'includes/footer.inc'; exit; } } } else { prnMsg(_('The') . ' ' . $myrow[0] . ' ' . _('account is currently on hold please contact the credit control personnel to discuss'), 'warn'); } } elseif (!$_SESSION['Items' . $identifier]->DefaultSalesType or $_SESSION['Items' . $identifier]->DefaultSalesType == '') { #Possible that the check to ensure this account is not on hold has not been done #if the customer is placing own order, if this is the case then #DefaultSalesType will not have been set as above
$result = DB_query($sql, $ErrMsg, $DbgMsg); $myrow = DB_fetch_array($result); if (DB_num_rows($result) == 0) { prnMsg(_('The customer details were unable to be retrieved'), 'error'); if ($debug == 1) { prnMsg(_('The SQL used that failed to get the customer details was:') . '<br />' . $sql, 'error'); } } else { $_SESSION['Contract' . $identifier]->BranchName = $myrow['brname']; $_SESSION['RequireCustomerSelection'] = 0; $_SESSION['Contract' . $identifier]->CustomerName = $myrow['name']; $_SESSION['Contract' . $identifier]->CurrCode = $myrow['currcode']; $_SESSION['Contract' . $identifier]->ExRate = $myrow['rate']; if ($_SESSION['CheckCreditLimits'] > 0) { /*Check credit limits is 1 for warn and 2 for prohibit contracts */ $CreditAvailable = GetCreditAvailable($_SESSION['Contract' . $identifier]->DebtorNo, $db); if ($_SESSION['CheckCreditLimits'] == 1 and $CreditAvailable <= 0) { prnMsg(_('The') . ' ' . $_SESSION['Contract' . $identifier]->CustomerName . ' ' . _('account is currently at or over their credit limit'), 'warn'); } elseif ($_SESSION['CheckCreditLimits'] == 2 and $CreditAvailable <= 0) { prnMsg(_('No more orders can be placed by') . ' ' . $myrow[0] . ' ' . _(' their account is currently at or over their credit limit'), 'warn'); include 'includes/footer.inc'; exit; } } } //a customer was retrieved ok } //end if a customer has just been selected if (!isset($_SESSION['Contract' . $identifier]->DebtorNo) or $_SESSION['Contract' . $identifier]->DebtorNo == '') { echo '<p class="page_title_text"><img src="' . $RootPath . '/css/' . $Theme . '/images/contract.png" title="' . _('Contract') . '" alt="" />' . ' ' . _('Contract: Select Customer') . '</p>'; echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?identifier=' . $identifier . '" name="CustomerSelection" method="post">';
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]->SalesPerson = $myrow['salesman']; if ($_SESSION['Items' . $identifier]->SpecialInstructions) { prnMsg($_SESSION['Items' . $identifier]->SpecialInstructions, 'warn'); } if ($_SESSION['CheckCreditLimits'] > 0 and $AlreadyWarnedAboutCredit == false) { /*Check credit limits is 1 for warn and 2 for prohibit sales */ $_SESSION['Items' . $identifier]->CreditAvailable = GetCreditAvailable($_SESSION['Items' . $identifier]->DebtorNo, $db); if ($_SESSION['CheckCreditLimits'] == 1 and $_SESSION['Items' . $identifier]->CreditAvailable <= 0) { prnMsg(_('The') . ' ' . $myrow['brname'] . ' ' . _('account is currently at or over their credit limit'), 'warn'); $AlreadyWarnedAboutCredit = true; } elseif ($_SESSION['CheckCreditLimits'] == 2 and $_SESSION['Items' . $identifier]->CreditAvailable <= 0) { prnMsg(_('No more orders can be placed by') . ' ' . $myrow[0] . ' ' . _(' their account is currently at or over their credit limit'), 'warn'); $AlreadyWarnedAboutCredit = true; include 'includes/footer.inc'; exit; } } } else { prnMsg($myrow['brname'] . ' ' . _('Although the account is defined as the cash sale account for the location the account is currently on hold. Please contact the credit control personnel to discuss'), 'warn'); } } }
$_SESSION['Items']->DelAdd5 = $myrow[5]; $_SESSION['Items']->DelAdd6 = $myrow[6]; $_SESSION['Items']->PhoneNo = $myrow[7]; $_SESSION['Items']->Email = $myrow[8]; $_SESSION['Items']->Location = $myrow[9]; $_SESSION['Items']->ShipVia = $myrow[10]; $_SESSION['Items']->DeliverBlind = $myrow[11]; $_SESSION['Items']->SpecialInstructions = $myrow[12]; $_SESSION['Items']->DeliveryDays = $myrow[13]; $_SESSION['Items']->LocationName = $myrow[14]; if ($_SESSION['Items']->SpecialInstructions) { prnMsg($_SESSION['Items']->SpecialInstructions, 'warn'); } if ($_SESSION['CheckCreditLimits'] > 0) { /*Check credit limits is 1 for warn and 2 for prohibit sales */ $_SESSION['Items']->CreditAvailable = GetCreditAvailable($_POST['Select'], $db); if ($_SESSION['CheckCreditLimits'] == 1 and $_SESSION['Items']->CreditAvailable <= 0) { prnMsg(_('The') . ' ' . $myrow[0] . ' ' . _('account is currently at or over their credit limit'), 'warn'); } elseif ($_SESSION['CheckCreditLimits'] == 2 and $_SESSION['Items']->CreditAvailable <= 0) { prnMsg(_('No more orders can be placed by') . ' ' . $myrow[0] . ' ' . _(' their account is currently at or over their credit limit'), 'warn'); include 'includes/footer.inc'; exit; } } } else { prnMsg(_('The') . ' ' . $myrow[0] . ' ' . _('account is currently on hold please contact the credit control personnel to discuss'), 'warn'); } } elseif (!$_SESSION['Items']->DefaultSalesType or $_SESSION['Items']->DefaultSalesType == '') { #Possible that the check to ensure this account is not on hold has not been done #if the customer is placing own order, if this is the case then #DefaultSalesType will not have been set as above