本文整理汇总了PHP中DB_escape_string函数的典型用法代码示例。如果您正苦于以下问题:PHP DB_escape_string函数的具体用法?PHP DB_escape_string怎么用?PHP DB_escape_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DB_escape_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InsertGLAccountSection
function InsertGLAccountSection($AccountSectionDetails, $user, $password)
{
$Errors = array();
$db = db($user, $password);
if (gettype($db) == 'integer') {
$Errors[0] = NoAuthorisation;
return $Errors;
}
foreach ($AccountSectionDetails as $key => $value) {
$AccountSectionDetails[$key] = DB_escape_string($value);
}
$Errors = VerifyAccountSection($AccountSectionDetails['sectionname'], sizeof($Errors), $Errors, $db);
if (isset($AccountSectionDetails['accountname'])) {
$Errors = VerifySectionName($AccountSectionDetails['sectionname'], sizeof($Errors), $Errors);
}
$FieldNames = '';
$FieldValues = '';
foreach ($AccountSectionDetails as $key => $value) {
$FieldNames .= $key . ', ';
$FieldValues .= '"' . $value . '", ';
}
if (sizeof($Errors) == 0) {
$sql = "INSERT INTO accountsection ('" . mb_substr($FieldNames, 0, -2) . "')\n\t\t\t\t\tVALUES ('" . mb_substr($FieldValues, 0, -2) . "')";
$result = DB_Query($sql, $db);
if (DB_error_no($db) != 0) {
$Errors[0] = DatabaseUpdateFailed;
} else {
$Errors[0] = 0;
}
}
return $Errors;
}
示例2: InsertGLAccount
function InsertGLAccount($AccountDetails, $user, $password)
{
$Errors = array();
$db = db($user, $password);
if (gettype($db) == 'integer') {
$Errors[0] = NoAuthorisation;
return $Errors;
}
foreach ($AccountDetails as $key => $value) {
$AccountDetails[$key] = DB_escape_string($value);
}
$Errors = VerifyAccountCode($AccountDetails['accountcode'], sizeof($Errors), $Errors, $db);
if (isset($AccountDetails['accountname'])) {
$Errors = VerifyAccountName($AccountDetails['accountname'], sizeof($Errors), $Errors);
}
$Errors = VerifyAccountGroupExists($AccountDetails['group_'], sizeof($Errors), $Errors, $db);
$FieldNames = '';
$FieldValues = '';
foreach ($AccountDetails as $key => $value) {
$FieldNames .= $key . ', ';
$FieldValues .= '"' . $value . '", ';
}
if (sizeof($Errors) == 0) {
$sql = "INSERT INTO chartmaster (" . mb_substr($FieldNames, 0, -2) . ") " . "VALUES ('" . mb_substr($FieldValues, 0, -2) . "') ";
$result = DB_Query($sql, $db);
$sql = "INSERT INTO chartdetails (accountcode,\n\t\t\t\t\t\t\tperiod)\n\t\t\t\tSELECT " . $AccountDetails['accountcode'] . ",\n\t\t\t\t\tperiodno\n\t\t\t\tFROM periods";
$result = DB_query($sql, $db, '', '', '', false);
if (DB_error_no($db) != 0) {
$Errors[0] = DatabaseUpdateFailed;
} else {
$Errors[0] = 0;
}
}
return $Errors;
}
示例3: db
function db($user, $password)
{
$_SESSION['UserID'] = $user;
$sql = "SELECT userid,\n\t\t\t\t\t\taccesslevel\n\t\t\t\tFROM www_users\n\t\t\t\tWHERE userid='" . DB_escape_string($user) . "'\n\t\t\t\tAND (password='" . CryptPass(DB_escape_string($password)) . "'\n\t\t\t\tOR password='" . DB_escape_string($password) . "')";
$Auth_Result = DB_query($sql, $_SESSION['db']);
$myrow = DB_fetch_row($Auth_Result);
if (DB_num_rows($Auth_Result) > 0) {
$sql = 'SELECT tokenid FROM securitygroups
WHERE secroleid = ' . $_SESSION['AccessLevel'];
$Sec_Result = DB_query($sql, $db);
$_SESSION['AllowedPageSecurityTokens'] = array();
if (DB_num_rows($Sec_Result) == 0) {
return NoAuthorisation;
} else {
$i = 0;
while ($myrow = DB_fetch_row($Sec_Result)) {
$_SESSION['AllowedPageSecurityTokens'][$i] = $myrow[0];
$i++;
}
}
return $_SESSION['db'];
} else {
return NoAuthorisation;
}
}
示例4: InsertGLAccountGroup
function InsertGLAccountGroup($AccountGroupDetails, $user, $password)
{
$Errors = array();
$db = db($user, $password);
if (gettype($db) == 'integer') {
$Errors[0] = NoAuthorisation;
return $Errors;
}
foreach ($AccountGroupDetails as $key => $value) {
$AccountGroupDetails[$key] = DB_escape_string($value);
}
$Errors = VerifyAccountGroup($AccountGroupDetails['groupname'], sizeof($Errors), $Errors, $db);
$Errors = VerifyAccountSectionExists($AccountGroupDetails['sectioninaccounts'], sizeof($Errors), $Errors, $db);
if (isset($AccountGroupDetails['pandl'])) {
$Errors = VerifyPandL($AccountGroupDetails['pandl'], sizeof($Errors), $Errors);
}
$Errors = VerifyParentGroupExists($AccountGroupDetails['parentgroupname'], sizeof($Errors), $Errors, $db);
$FieldNames = '';
$FieldValues = '';
foreach ($AccountGroupDetails as $key => $value) {
$FieldNames .= $key . ', ';
$FieldValues .= '"' . $value . '", ';
}
if (sizeof($Errors) == 0) {
$sql = 'INSERT INTO accountgroups (' . substr($FieldNames, 0, -2) . ') ' . 'VALUES (' . substr($FieldValues, 0, -2) . ') ';
$result = DB_Query($sql, $db);
if (DB_error_no($db) != 0) {
$Errors[0] = DatabaseUpdateFailed;
} else {
$Errors[0] = 0;
}
}
return $Errors;
}
示例5: db
function db($user, $password)
{
$_SESSION['UserID'] = $user;
$sql = "SELECT userid\n\t\t\tFROM www_users\n\t\t\tWHERE userid='" . DB_escape_string($user) . "'\n\t\t\tAND (password='" . CryptPass(DB_escape_string($password)) . "'\n\t\t\tOR password='" . DB_escape_string($password) . "')";
$Auth_Result = DB_query($sql, $_SESSION['db']);
$myrow = DB_fetch_row($Auth_Result);
if (DB_num_rows($Auth_Result) > 0) {
return $_SESSION['db'];
} else {
return NoAuthorisation;
}
}
示例6: ModifyStockCategory
function ModifyStockCategory($CategoryDetails, $user, $password)
{
$Errors = array();
$db = db($user, $password);
if (gettype($db) == 'integer') {
$Errors[0] = NoAuthorisation;
return $Errors;
}
foreach ($CategoryDetails as $key => $value) {
$CategoryDetails[$key] = DB_escape_string($value);
}
$Errors = VerifyStockCategoryExists($CategoryDetails['categoryid'], sizeof($Errors), $Errors, $db);
$Errors = VerifyCategoryID($CategoryDetails['categoryid'], sizeof($Errors), $Errors);
$Errors = VerifyCategoryDescription($CategoryDetails['categorydescription'], sizeof($Errors), $Errors);
$Errors = VerifyStockType($CategoryDetails['stocktype'], sizeof($Errors), $Errors);
$Errors = VerifyAccountCodeExists($CategoryDetails['stockact'], sizeof($Errors), $Errors, $db);
$Errors = VerifyAccountCodeExists($CategoryDetails['adjglact'], sizeof($Errors), $Errors, $db);
$Errors = VerifyAccountCodeExists($CategoryDetails['purchpricevaract'], sizeof($Errors), $Errors, $db);
$Errors = VerifyAccountCodeExists($CategoryDetails['materialuseagevarac'], sizeof($Errors), $Errors, $db);
$Errors = VerifyAccountCodeExists($CategoryDetails['wipact'], sizeof($Errors), $Errors, $db);
$FieldNames = '';
$FieldValues = '';
foreach ($CategoryDetails as $key => $value) {
$FieldNames .= $key . ', ';
$FieldValues .= '"' . $value . '", ';
}
$sql = "UPDATE stockcategory SET ";
foreach ($CategoryDetails as $key => $value) {
$sql .= $key . "='" . $value . "', ";
}
$sql = mb_substr($sql, 0, -2) . " WHERE categoryid='" . $CategoryDetails['categoryid'] . "'";
if (sizeof($Errors) == 0) {
$result = DB_Query($sql, $db);
echo DB_error_no($db);
if (DB_error_no($db) != 0) {
$Errors[0] = DatabaseUpdateFailed;
} else {
$Errors[0] = 0;
}
}
return $Errors;
}
示例7: ModifyBranch
function ModifyBranch($BranchDetails, $user, $password)
{
$Errors = array();
$db = db($user, $password);
if (gettype($db) == 'integer') {
$Errors[0] = NoAuthorisation;
return $Errors;
}
foreach ($BranchDetails as $key => $value) {
$BranchDetails[$key] = DB_escape_string($value);
}
$Errors = VerifyBranchNoExists($BranchDetails['debtorno'], $BranchDetails['branchcode'], sizeof($Errors), $Errors, $db);
$Errors = VerifyBranchName($BranchDetails['brname'], sizeof($Errors), $Errors, $db);
if (isset($BranchDetails['address1'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['address1'], 40, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['address2'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['address2'], 40, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['address3'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['address3'], 40, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['address4'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['address4'], 50, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['address5'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['address5'], 20, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['address6'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['address6'], 15, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['lat'])) {
$Errors = VerifyLatitude($BranchDetails['lat'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['lng'])) {
$Errors = VerifyLongitude($BranchDetails['lng'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['estdeliverydays'])) {
$Errors = VerifyEstDeliveryDays($BranchDetails['estdeliverydays'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['area'])) {
$Errors = VerifyAreaCode($BranchDetails['area'], sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['salesman'])) {
$Errors = VerifySalesmanCode($BranchDetails['salesman'], sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['fwddate'])) {
$Errors = VerifyFwdDate($BranchDetails['fwddate'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['phoneno'])) {
$Errors = VerifyPhoneNumber($BranchDetails['phoneno'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['faxno'])) {
$Errors = VerifyFaxNumber($BranchDetails['faxno'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['contactname'])) {
$Errors = VerifyContactName($BranchDetails['contactname'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['email'])) {
$Errors = VerifyEmailAddress($BranchDetails['email'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['defaultlocation'])) {
$Errors = VerifyDefaultLocation($BranchDetails['defaultlocation'], sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['taxgroupid'])) {
$Errors = VerifyTaxGroupId($BranchDetails['taxgroupid'], sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['defaultshipvia'])) {
$Errors = VerifyDefaultShipVia($BranchDetails['defaultshipvia'], sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['deliverblind'])) {
$Errors = VerifyDeliverBlind($BranchDetails['deliverblind'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['disabletrans'])) {
$Errors = VerifyDisableTrans($BranchDetails['disabletrans'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['brpostaddr1'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr1'], 40, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['brpostaddr2'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr2'], 40, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['brpostaddr3'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr3'], 30, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['brpostaddr4'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr4'], 20, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['brpostaddr5'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr5'], 20, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['brpostaddr6'])) {
$Errors = VerifyBranchAddressLine($BranchDetails['brpostaddr6'], 15, sizeof($Errors), $Errors, $db);
}
if (isset($BranchDetails['specialinstructions'])) {
$Errors = VerifySpecialInstructions($BranchDetails['specialinstructions'], sizeof($Errors), $Errors);
}
if (isset($BranchDetails['custbranchcode'])) {
$Errors = VerifyCustBranchCode($BranchDetails['custbranchcode'], sizeof($Errors), $Errors);
}
//.........这里部分代码省略.........
示例8: InsertSalesCredit
function InsertSalesCredit($CreditDetails, $user, $password)
{
$Errors = array();
$db = db($user, $password);
if (gettype($db) == 'integer') {
$Errors[0] = NoAuthorisation;
return $Errors;
}
foreach ($CreditDetails as $key => $value) {
$CreditDetails[$key] = DB_escape_string($value);
}
$PartCode = $CreditDetails['partcode'];
$Errors = VerifyStockCodeExists($PartCode, sizeof($Errors), $Errors, $db);
unset($CreditDetails['partcode']);
$SalesArea = $CreditDetails['salesarea'];
unset($CreditDetails['salesarea']);
$CreditDetails['transno'] = GetNextTransactionNo(11, $db);
$CreditDetails['type'] = 10;
$Errors = VerifyDebtorExists($CreditDetails['debtorno'], sizeof($Errors), $Errors, $db);
$Errors = VerifyBranchNoExists($CreditDetails['debtorno'], $CreditDetails['branchcode'], sizeof($Errors), $Errors, $db);
$Errors = VerifyTransNO($CreditDetails['transno'], 10, sizeof($Errors), $Errors, $db);
$Errors = VerifyTransactionDate($CreditDetails['trandate'], sizeof($Errors), $Errors, $db);
if (isset($CreditDetails['settled'])) {
$Errors = VerifySettled($CreditDetails['settled'], sizeof($Errors), $Errors);
}
if (isset($CreditDetails['reference'])) {
$Errors = VerifyReference($CreditDetails['reference'], sizeof($Errors), $Errors);
}
if (isset($CreditDetails['tpe'])) {
$Errors = VerifyTpe($CreditDetails['tpe'], sizeof($Errors), $Errors);
}
if (isset($CreditDetails['order_'])) {
$Errors = VerifyOrderNumber($CreditDetails['order_'], sizeof($Errors), $Errors);
}
if (isset($CreditDetails['rate'])) {
$Errors = VerifyExchangeRate($CreditDetails['rate'], sizeof($Errors), $Errors);
}
if (isset($CreditDetails['ovamount'])) {
$Errors = VerifyOVAmount($CreditDetails['ovamount'], sizeof($Errors), $Errors);
}
if (isset($CreditDetails['ovgst'])) {
$Errors = VerifyOVGst($CreditDetails['ovgst'], sizeof($Errors), $Errors);
}
if (isset($CreditDetails['ovfreight'])) {
$Errors = VerifyOVFreight($CreditDetails['ovfreight'], sizeof($Errors), $Errors);
}
if (isset($CreditDetails['ovdiscount'])) {
$Errors = VerifyOVDiscount($CreditDetails['ovdiscount'], sizeof($Errors), $Errors);
}
if (isset($CreditDetails['diffonexch'])) {
$Errors = VerifyDiffOnExchange($CreditDetails['diffonexch'], sizeof($Errors), $Errors);
}
if (isset($CreditDetails['alloc'])) {
$Errors = VerifyAllocated($CreditDetails['alloc'], sizeof($Errors), $Errors);
}
if (isset($CreditDetails['invtext'])) {
$Errors = VerifyInvoiceText($CreditDetails['invtext'], sizeof($Errors), $Errors);
}
if (isset($CreditDetails['shipvia'])) {
$Errors = VerifyShipVia($CreditDetails['shipvia'], sizeof($Errors), $Errors);
}
if (isset($CreditDetails['edisent'])) {
$Errors = VerifyEdiSent($CreditDetails['edisent'], sizeof($Errors), $Errors);
}
if (isset($CreditDetails['consignment'])) {
$Errors = VerifyConsignment($CreditDetails['consignment'], sizeof($Errors), $Errors);
}
$FieldNames = '';
$FieldValues = '';
$CreditDetails['trandate'] = ConvertToSQLDate($CreditDetails['trandate']);
$CreditDetails['prd'] = GetPeriodFromTransactionDate($CreditDetails['trandate'], sizeof($Errors), $Errors, $db);
foreach ($CreditDetails as $key => $value) {
$FieldNames .= $key . ', ';
$FieldValues .= '"' . $value . '", ';
}
if (sizeof($Errors) == 0) {
$result = DB_Txn_Begin($db);
$sql = "INSERT INTO debtortrans (" . mb_substr($FieldNames, 0, -2) . ")\n\t\t\t\t\t\tVALUES ('" . mb_substr($FieldValues, 0, -2) . "') ";
$result = DB_Query($sql, $db);
$sql = "UPDATE systypes SET typeno='" . GetNextTransactionNo(11, $db) . "' WHERE typeid=10";
$result = DB_Query($sql, $db);
$SalesGLCode = GetSalesGLCode($SalesArea, $PartCode, $db);
$DebtorsGLCode = GetDebtorsGLCode($db);
$sql = "INSERT INTO gltrans VALUES(null,\n\t\t\t\t\t\t\t\t\t\t\t10,\n\t\t\t\t\t\t\t\t\t\t\t'" . GetNextTransactionNo(11, $db) . "',\n\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t\t'" . $CreditDetails['trandate'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $CreditDetails['prd'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $DebtorsGLCode . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . _('Invoice for') . ' - ' . $CreditDetails['debtorno'] . ' ' . -'Total' . ' - ' . $CreditDetails['ovamount'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $CreditDetails['ovamount'] . "',\n\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t\t'" . $CreditDetails['jobref'] . "')";
$result = DB_Query($sql, $db);
$sql = "INSERT INTO gltrans VALUES(null,\n\t\t\t\t\t\t\t\t\t\t\t10,\n\t\t\t\t\t\t\t\t\t\t\t'" . GetNextTransactionNo(11, $db) . "',\n\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t\t'" . $CreditDetails['trandate'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $CreditDetails['prd'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $SalesGLCode . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . _('Invoice for') . ' - ' . $CreditDetails['debtorno'] . ' ' . _('Total') . ' - ' . $CreditDetails['ovamount'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . -intval($CreditDetails['ovamount']) . "',\n\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t\t'" . $CreditDetails['jobref'] . "')";
$result = DB_Query($sql, $db);
$result = DB_Txn_Commit($db);
if (DB_error_no($db) != 0) {
$Errors[0] = DatabaseUpdateFailed;
} else {
$Errors[0] = 0;
}
return $Errors;
} else {
return $Errors;
}
}
示例9: ModifyCustomer
function ModifyCustomer($CustomerDetails, $user, $password)
{
$Errors = array();
$db = db($user, $password);
if (gettype($db) == 'integer') {
$Errors[0] = NoAuthorisation;
return $Errors;
}
foreach ($CustomerDetails as $key => $value) {
$CustomerDetails[$key] = DB_escape_string($value);
}
if (!isset($CustomerDetails['debtorno'])) {
$Errors[sizeof($Errors)] = NoDebtorNumber;
return $Errors;
}
$Errors = VerifyDebtorExists($CustomerDetails['debtorno'], sizeof($Errors), $Errors, $db);
if (in_array(DebtorDoesntExist, $Errors)) {
return $Errors;
}
if (isset($CustomerDetails['name'])) {
$Errors = VerifyDebtorName($CustomerDetails['name'], sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['address1'])) {
$Errors = VerifyAddressLine($CustomerDetails['address1'], 40, sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['address2'])) {
$Errors = VerifyAddressLine($CustomerDetails['address2'], 40, sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['address3'])) {
$Errors = VerifyAddressLine($CustomerDetails['address3'], 40, sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['address4'])) {
$Errors = VerifyAddressLine($CustomerDetails['address4'], 50, sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['address5'])) {
$Errors = VerifyAddressLine($CustomerDetails['address5'], 20, sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['address6'])) {
$Errors = VerifyAddressLine($CustomerDetails['address6'], 15, sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['currcode'])) {
$Errors = VerifyCurrencyCode($CustomerDetails['currcode'], sizeof($Errors), $Errors, $db);
}
if (isset($CustomerDetails['salestype'])) {
$Errors = VerifySalesType($CustomerDetails['salestype'], sizeof($Errors), $Errors, $db);
}
if (isset($CustomerDetails['clientsince'])) {
$Errors = VerifyClientSince($CustomerDetails['clientsince'], sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['holdreason'])) {
$Errors = VerifyHoldReason($CustomerDetails['holdreason'], sizeof($Errors), $Errors, $db);
}
if (isset($CustomerDetails['paymentterms'])) {
$Errors = VerifyPaymentTerms($CustomerDetails['paymentterms'], sizeof($Errors), $Errors, $db);
}
if (isset($CustomerDetails['discount'])) {
$Errors = VerifyDiscount($CustomerDetails['discount'], sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['pymtdiscount'])) {
$Errors = VerifyPymtDiscount($CustomerDetails['pymtdiscount'], sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['lastpaid'])) {
$Errors = VerifyLastPaid($CustomerDetails['lastpaid'], sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['lastpaiddate'])) {
$Errors = VerifyLastPaidDate($CustomerDetails['lastpaiddate'], sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['creditlimit'])) {
$Errors = VerifyCreditLimit($CustomerDetails['creditlimit'], sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['invaddrbranch'])) {
$Errors = VerifyInvAddrBranch($CustomerDetails['invaddrbranch'], sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['discountcode'])) {
$Errors = VerifyDiscountCode($CustomerDetails['discountcode'], sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['ediinvoices'])) {
$Errors = VerifyEDIInvoices($CustomerDetails['ediinvoices'], sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['ediorders'])) {
$Errors = VerifyEDIOrders($CustomerDetails['ediorders'], sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['edireference'])) {
$Errors = VerifyEDIReference($CustomerDetails['edireference'], sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['editransport'])) {
$Errors = VerifyEDITransport($CustomerDetails['editransport'], sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['ediserveruser'])) {
$Errors = VerifyEDIServerUser($CustomerDetails['ediserveruser'], sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['ediserverpwd'])) {
$Errors = VerifyEDIServerPassword($CustomerDetails['ediserverpwd'], sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['taxref'])) {
$Errors = VerifyTaxRef($CustomerDetails['taxref'], sizeof($Errors), $Errors);
}
if (isset($CustomerDetails['customerpoline'])) {
$Errors = VerifyCustomerPOLine($CustomerDetails['customerpoline'], sizeof($Errors), $Errors);
}
//.........这里部分代码省略.........
示例10: DB_escape_string
$SQL[] = "UPDATE config SET confvalue = '" . DB_escape_string($_POST['X_ShopManagerEmail']) . "' WHERE confname = 'ShopManagerEmail'";
}
if ($_SESSION['ShopPrivacyStatement'] != $_POST['X_ShopPrivacyStatement']) {
$SQL[] = "UPDATE config SET confvalue = '" . DB_escape_string($_POST['X_ShopPrivacyStatement']) . "' WHERE confname = 'ShopPrivacyStatement'";
}
if ($_SESSION['ShopFreightPolicy'] != $_POST['X_ShopFreightPolicy']) {
$SQL[] = "UPDATE config SET confvalue = '" . DB_escape_string($_POST['X_ShopFreightPolicy']) . "' WHERE confname = 'ShopFreightPolicy'";
}
if ($_SESSION['ShopTermsConditions'] != $_POST['X_ShopTermsConditions']) {
$SQL[] = "UPDATE config SET confvalue = '" . DB_escape_string($_POST['X_ShopTermsConditions']) . "' WHERE confname = 'ShopTermsConditions'";
}
if ($_SESSION['ShopAboutUs'] != $_POST['X_ShopAboutUs']) {
$SQL[] = "UPDATE config SET confvalue = '" . DB_escape_string($_POST['X_ShopAboutUs']) . "' WHERE confname = 'ShopAboutUs'";
}
if ($_SESSION['ShopContactUs'] != $_POST['X_ShopContactUs']) {
$SQL[] = "UPDATE config SET confvalue = '" . DB_escape_string($_POST['X_ShopContactUs']) . "' WHERE confname = 'ShopContactUs'";
}
if ($_SESSION['ShopDebtorNo'] != $_POST['X_ShopDebtorNo']) {
$SQL[] = "UPDATE config SET confvalue = '" . $_POST['X_ShopDebtorNo'] . "' WHERE confname = 'ShopDebtorNo'";
}
if ($_SESSION['ShopBranchCode'] != $_POST['X_ShopBranchCode']) {
$SQL[] = "UPDATE config SET confvalue = '" . $_POST['X_ShopBranchCode'] . "' WHERE confname = 'ShopBranchCode'";
}
if ($_SESSION['ShopShowOnlyAvailableItems'] != $_POST['X_ShopShowOnlyAvailableItems']) {
$SQL[] = "UPDATE config SET confvalue = '" . $_POST['X_ShopShowOnlyAvailableItems'] . "' WHERE confname = 'ShopShowOnlyAvailableItems'";
}
if ($_SESSION['ShopShowQOHColumn'] != $_POST['X_ShopShowQOHColumn']) {
$SQL[] = "UPDATE config SET confvalue = '" . $_POST['X_ShopShowQOHColumn'] . "' WHERE confname = 'ShopShowQOHColumn'";
}
if (isset($_POST['X_ShopStockLocations'])) {
$ShopStockLocations = '';
示例11: _
$MailText = _('This email has been automatically generated by the webERP installation at') . ' ' . $_SESSION['CompanyRecord']['coyname'] . "\n";
$MailText .= _('The following offers you made have been accepted') . "\n";
$MailText .= _('An official order will be sent to you in due course') . "\n\n";
$sql = "SELECT rate FROM currencies where currabrev='" . $CurrCode . "'";
$result = DB_query($sql);
$myrow = DB_fetch_array($result);
$Rate = $myrow['rate'];
$OrderNo = GetNextTransNo(18, $db);
$sql = "INSERT INTO purchorders (\n\t\t\t\t\torderno,\n\t\t\t\t\tsupplierno,\n\t\t\t\t\torddate,\n\t\t\t\t\trate,\n\t\t\t\t\tinitiator,\n\t\t\t\t\tintostocklocation,\n\t\t\t\t\tdeliverydate,\n\t\t\t\t\tstatus,\n\t\t\t\t\tstat_comment,\n\t\t\t\t\tpaymentterms)\n\t\t\t\tVALUES (\n\t\t\t\t\t'" . $OrderNo . "',\n\t\t\t\t\t'" . $_POST['supplierid'] . "',\n\t\t\t\t\t'" . date('Y-m-d') . "',\n\t\t\t\t\t'" . $Rate . "',\n\t\t\t\t\t'" . $_SESSION['UserID'] . "',\n\t\t\t\t\t'" . $_SESSION['DefaultFactoryLocation'] . "',\n\t\t\t\t\t'" . date('Y-m-d') . "',\n\t\t\t\t\t'" . _('Pending') . "',\n\t\t\t\t\t'" . _('Automatically generated from tendering system') . "',\n\t\t\t\t\t'" . $PaymentTerms . "')";
DB_query($sql);
foreach ($Accepts as $AcceptID) {
$sql = "SELECT offers.quantity,\n\t\t\t\t\t\t\toffers.price,\n\t\t\t\t\t\t\toffers.uom,\n\t\t\t\t\t\t\tstockmaster.description,\n\t\t\t\t\t\t\tstockmaster.stockid\n\t\t\t\t\t\tFROM offers\n\t\t\t\t\t\tLEFT JOIN stockmaster\n\t\t\t\t\t\t\tON offers.stockid=stockmaster.stockid\n\t\t\t\t\t\tWHERE offerid='" . $AcceptID . "'";
$result = DB_query($sql);
$myrow = DB_fetch_array($result);
$MailText .= $myrow['description'] . "\t" . _('Quantity') . ' ' . $myrow['quantity'] . "\t" . _('Price') . ' ' . locale_number_format($myrow['price']) . "\n";
$sql = "INSERT INTO purchorderdetails (orderno,\n\t\t\t\t\t\t\t\t\t\t\t\titemcode,\n\t\t\t\t\t\t\t\t\t\t\t\tdeliverydate,\n\t\t\t\t\t\t\t\t\t\t\t\titemdescription,\n\t\t\t\t\t\t\t\t\t\t\t\tunitprice,\n\t\t\t\t\t\t\t\t\t\t\t\tactprice,\n\t\t\t\t\t\t\t\t\t\t\t\tquantityord,\n\t\t\t\t\t\t\t\t\t\t\t\tsuppliersunit)\n\t\t\t\t\t\t\t\t\tVALUES ('" . $OrderNo . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $myrow['stockid'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . date('Y-m-d') . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . DB_escape_string($myrow['description']) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $myrow['price'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $myrow['price'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $myrow['quantity'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $myrow['uom'] . "')";
$result = DB_query($sql);
$sql = "DELETE FROM offers WHERE offerid='" . $AcceptID . "'";
$result = DB_query($sql);
}
$mail = new htmlMimeMail();
$mail->setSubject(_('Your offer to') . ' ' . $_SESSION['CompanyRecord']['coyname'] . ' ' . _('has been accepted'));
$mail->setText($MailText);
$Recipients = GetMailList('OffersReceivedResultRecipients');
if (sizeOf($Recipients) == 0) {
prnMsg(_('There are no members of the Offers Received Result Recipients email group'), 'warn');
include 'includes/footer.inc';
exit;
}
array_push($Recipients, $Email);
if ($_SESSION['SmtpSetting'] == 0) {
示例12: number_format
if ($InvOrCredit == 'Invoice') {
$DisplaySubTot = number_format($myrow['ovamount'], 2);
$DisplayFreight = number_format($myrow['ovfreight'], 2);
$DisplayTax = number_format($myrow['ovgst'], 2);
$DisplayTotal = number_format($myrow['ovfreight'] + $myrow['ovgst'] + $myrow['ovamount'], 2);
} else {
$DisplaySubTot = number_format(-$myrow['ovamount'], 2);
$DisplayFreight = number_format(-$myrow['ovfreight'], 2);
$DisplayTax = number_format(-$myrow['ovgst'], 2);
$DisplayTotal = number_format(-$myrow['ovfreight'] - $myrow['ovgst'] - $myrow['ovamount'], 2);
}
/* Print out the payment terms */
$pdf->addTextWrap($FormDesign->PaymentTerms->x, $Page_Height - $FormDesign->PaymentTerms->y, $FormDesign->PaymentTerms->Length, $FormDesign->PaymentTerms->FontSize, _('Payment Terms') . ': ' . $myrow['terms']);
// $pdf->addText($Page_Width-$Right_Margin-392, $YPos - ($line_height*3)+22,$FontSize, _('Bank Code:***** Bank Account:*****'));
// $FontSize=10;
$LeftOvers = explode('\\r\\n', DB_escape_string($myrow['invtext']));
for ($i = 0; $i < sizeOf($LeftOvers); $i++) {
$pdf->addText($FormDesign->InvoiceText->x, $Page_Height - $FormDesign->InvoiceText->y - $i * 10, $FormDesign->InvoiceText->FontSize, $LeftOvers[$i]);
}
$pdf->addText($FormDesign->SubTotalCaption->x, $Page_Height - $FormDesign->SubTotalCaption->y, $FormDesign->SubTotalCaption->FontSize, _('Sub Total'));
$LeftOvers = $pdf->addTextWrap($FormDesign->SubTotal->x, $Page_Height - $FormDesign->SubTotal->y, $FormDesign->SubTotal->Length, $FormDesign->SubTotal->FontSize, $DisplaySubTot, 'right');
$pdf->addText($FormDesign->FreightCaption->x, $Page_Height - $FormDesign->FreightCaption->y, $FormDesign->FreightCaption->FontSize, _('Freight'));
$LeftOvers = $pdf->addTextWrap($FormDesign->Freight->x, $Page_Height - $FormDesign->Freight->y, $FormDesign->Freight->Length, $FormDesign->Freight->FontSize, $DisplayFreight, 'right');
$pdf->addText($FormDesign->TaxCaption->x, $Page_Height - $FormDesign->TaxCaption->y, $FormDesign->TaxCaption->FontSize, _('Tax'));
$LeftOvers = $pdf->addTextWrap($FormDesign->Tax->x, $Page_Height - $FormDesign->Tax->y, $FormDesign->Tax->Length, $FormDesign->Tax->FontSize, $DisplayTax, 'right');
/*rule off for total */
$pdf->line($FormDesign->TotalLine->startx, $Page_Height - $FormDesign->TotalLine->starty, $FormDesign->TotalLine->endx, $Page_Height - $FormDesign->TotalLine->endy);
/*vertical to separate totals from comments and ROMALPA */
$pdf->line($FormDesign->RomalpaLine->startx, $Page_Height - $FormDesign->RomalpaLine->starty, $FormDesign->RomalpaLine->endx, $Page_Height - $FormDesign->RomalpaLine->endy);
if ($InvOrCredit == 'Invoice') {
$pdf->addText($FormDesign->TotalCaption->x, $Page_Height - $FormDesign->TotalCaption->y, $FormDesign->TotalCaption->FontSize, _('TOTAL INVOICE'));
示例13: ModifyPurchData
function ModifyPurchData($PurchDataDetails, $user, $password)
{
$Errors = array();
$db = db($user, $password);
if (gettype($db) == 'integer') {
$Errors[0] = NoAuthorisation;
return $Errors;
}
foreach ($PurchDataDetails as $key => $value) {
$PurchDataDetails[$key] = DB_escape_string($value);
}
$Errors = VerifyPurchDataLineExists($PurchDataDetails['supplierno'], $PurchDataDetails['stockid'], sizeof($Errors), $Errors, $db);
$Errors = VerifyStockCodeExists($PurchDataDetails['stockid'], sizeof($Errors), $Errors, $db);
$Errors = VerifySupplierNoExists($PurchDataDetails['supplierno'], sizeof($Errors), $Errors, $db);
if (isset($StockItemDetails['price'])) {
$Errors = VerifyUnitPrice($PurchDataDetails['price'], sizeof($Errors), $Errors);
}
if (isset($StockItemDetails['suppliersuom'])) {
$Errors = VerifySuppliersUOM($PurchDataDetails['suppliersuom'], sizeof($Errors), $Errors);
}
if (isset($StockItemDetails['conversionfactor'])) {
$Errors = VerifyConversionFactor($PurchDataDetails['conversionfactor'], sizeof($Errors), $Errors);
}
if (isset($StockItemDetails['supplierdescription'])) {
$Errors = VerifySupplierDescription($PurchDataDetails['supplierdescription'], sizeof($Errors), $Errors);
}
if (isset($StockItemDetails['leadtime'])) {
$Errors = VerifyLeadTime($PurchDataDetails['leadtime'], sizeof($Errors), $Errors);
}
if (isset($StockItemDetails['preferred'])) {
$Errors = VerifyPreferredFlag($PurchDataDetails['preferred'], sizeof($Errors), $Errors);
}
$sql = "UPDATE purchdata SET ";
foreach ($PurchDataDetails as $key => $value) {
$sql .= $key . "='" . $value . "', ";
}
$sql = mb_substr($sql, 0, -2) . " WHERE stockid='" . $PurchDataDetails['stockid'] . "'\n\t\t\t\t\t\t\t\tAND supplierno='" . $PurchDataDetails['supplierno'] . "'";
if (sizeof($Errors) == 0) {
$result = DB_Query($sql, $db);
echo DB_error_no($db);
if (DB_error_no($db) != 0) {
$Errors[0] = DatabaseUpdateFailed;
} else {
$Errors[0] = 0;
}
}
return $Errors;
}
示例14: _
$msg[] = _('You must select at least one test');
}
if ($InputError == 1) {
foreach ($msg as $message) {
prnMsg($message, 'info');
$_POST['ChangeItem'] = 'Yes';
$Patient[0] = $_POST['PatientNo'];
$Patient[1] = $_POST['BranchNo'];
}
} else {
DB_Txn_Begin($db);
/*First off create the sales order
* entries in the database
*/
$OrderNo = GetNextTransNo(30, $db);
$HeaderSQL = "INSERT INTO salesorders (\torderno,\n\t\t\t\t\t\t\t\t\t\t\tdebtorno,\n\t\t\t\t\t\t\t\t\t\t\tbranchcode,\n\t\t\t\t\t\t\t\t\t\t\tcomments,\n\t\t\t\t\t\t\t\t\t\t\torddate,\n\t\t\t\t\t\t\t\t\t\t\tshipvia,\n\t\t\t\t\t\t\t\t\t\t\tdeliverto,\n\t\t\t\t\t\t\t\t\t\t\tfromstkloc,\n\t\t\t\t\t\t\t\t\t\t\tdeliverydate,\n\t\t\t\t\t\t\t\t\t\t\tconfirmeddate,\n\t\t\t\t\t\t\t\t\t\t\tdeliverblind)\n\t\t\t\t\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t\t\t\t\t'" . $OrderNo . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $_POST['PatientNo'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $_POST['BranchNo'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . DB_escape_string($_POST['Comments']) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($_POST['AdmissionDate']) . "',\n\t\t\t\t\t\t\t\t\t\t\t'1',\n\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['UserStockLocation'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['UserStockLocation'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($_POST['AdmissionDate']) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($_POST['AdmissionDate']) . "',\n\t\t\t\t\t\t\t\t\t\t\t0\n\t\t\t\t\t\t\t\t\t\t)";
$ErrMsg = _('The order cannot be added because');
$InsertQryResult = DB_query($HeaderSQL, $db, $ErrMsg);
for ($i = 0; $i < $_SESSION['Items']['Lines']; $i++) {
if (isset($_SESSION['Items'][$i]['StockID'])) {
$LineItemSQL = "INSERT INTO salesorderdetails (orderlineno,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\torderno,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstkcode,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tunitprice,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tquantity,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdiscountpercent,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\titemdue,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tactualdispatchdate,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tqtyinvoiced,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcompleted)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $i . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $OrderNo . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items'][$i]['StockID'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Items'][$i]['Price'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'1',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'0',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . _('Sales order for radiology transaction') . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($_POST['AdmissionDate']) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($_POST['AdmissionDate']) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'1',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)";
$DbgMsg = _('Trouble inserting a line of a sales order. The SQL that failed was');
$Ins_LineItemResult = DB_query($LineItemSQL, $db, $ErrMsg, $DbgMsg, true);
if ($_SESSION['Care2xDatabase'] != 'None') {
$SQL = "UPDATE " . $_SESSION['Care2xDatabase'] . ".care_encounter_prescription SET bill_number='" . $OrderNo . "'\n\t\t\t\t\t\t\t\tWHERE nr='" . $_SESSION['Items'][$i]['Care2x'] . "'";
$DbgMsg = _('Trouble inserting a line of a sales order. The SQL that failed was');
$UpdateCare2xResult = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
}
}
}
if (isset($_POST['Doctor'])) {
示例15: locstock
$sql = "INSERT INTO locstock (loccode,\n\t\t\t\t\t\t\t\t\t\t\t\t\tstockid)\n\t\t\t\t\t\t\t\t\t\tSELECT locations.loccode,\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['StockID'] . "'\n\t\t\t\t\t\t\t\t\t\tFROM locations";
$ErrMsg = _('The locations for the item') . ' ' . $_POST['StockID'] . ' ' . _('could not be added because');
$DbgMsg = _('NB Locations records can be added by opening the utility page') . ' <i>Z_MakeStockLocns.php</i> ' . _('The SQL that was used to add the location records that failed was');
$InsResult = DB_query($sql, $db, $ErrMsg, $DbgMsg);
DB_Txn_Commit($db);
//check for any purchase data
$sql = "SELECT purchdata.supplierno,\n suppliers.suppname,\n purchdata.price,\n suppliers.currcode,\n purchdata.effectivefrom,\n purchdata.suppliersuom,\n purchdata.supplierdescription,\n purchdata.leadtime,\n purchdata.suppliers_partno,\n purchdata.minorderqty,\n purchdata.preferred,\n purchdata.conversionfactor,\n currencies.decimalplaces AS currdecimalplaces\n FROM purchdata INNER JOIN suppliers\n ON purchdata.supplierno=suppliers.supplierid\n INNER JOIN currencies\n ON suppliers.currcode=currencies.currabrev\n WHERE purchdata.stockid = '" . $_POST['OldStockID'] . "'\n ORDER BY purchdata.effectivefrom DESC";
$ErrMsg = _('The supplier purchasing details for the selected part could not be retrieved because');
$PurchDataResult = DB_query($sql, $db, $ErrMsg);
if (DB_num_rows($PurchDataResult) == 0 and $_POST['OldStockID'] != '') {
//prnMsg(_('There is no purchasing data set up for the part selected'), 'info');
$NoPurchasingData = 1;
} else {
while ($myrow = DB_fetch_array($PurchDataResult)) {
//clone the purchase data
$sql = "INSERT INTO purchdata (supplierno,\n\t\t\t\t\t\t\t\t\t\tstockid,\n\t\t\t\t\t\t\t\t\t\tprice,\n\t\t\t\t\t\t\t\t\t\teffectivefrom,\n\t\t\t\t\t\t\t\t\t\tsuppliersuom,\n\t\t\t\t\t\t\t\t\t\tconversionfactor,\n\t\t\t\t\t\t\t\t\t\tsupplierdescription,\n\t\t\t\t\t\t\t\t\t\tsuppliers_partno,\n\t\t\t\t\t\t\t\t\t\tleadtime,\n\t\t\t\t\t\t\t\t\t\tminorderqty,\n\t\t\t\t\t\t\t\t\t\tpreferred)\n VALUES ('" . $myrow['supplierno'] . "',\n '" . $_POST['StockID'] . "',\n '" . $myrow['price'] . "',\n '" . $myrow['effectivefrom'] . "',\n '" . $myrow['suppliersuom'] . "',\n '" . $myrow['conversionfactor'] . "',\n '" . DB_escape_string($myrow['supplierdescription']) . "',\n '" . $myrow['suppliers_partno'] . "',\n '" . $myrow['leadtime'] . "',\n '" . $myrow['minorderqty'] . "',\n '" . $myrow['preferred'] . "')";
$ErrMsg = _('The cloned supplier purchasing details could not be added to the database because');
$DbgMsg = _('The SQL that failed was');
$AddResult = DB_query($sql, $db, $ErrMsg, $DbgMsg);
}
}
//For both the following - assume the data taken from the tables has already been validated.
//check for price data
$sql = "SELECT currencies.currency,\n salestypes.sales_type,\n prices.price,\n prices.stockid,\n prices.typeabbrev,\n prices.currabrev,\n prices.startdate,\n prices.enddate,\n prices.debtorno,\n currencies.decimalplaces AS currdecimalplaces\n FROM prices\n INNER JOIN salestypes\n ON prices.typeabbrev = salestypes.typeabbrev\n INNER JOIN currencies\n ON prices.currabrev=currencies.currabrev\n WHERE prices.stockid='" . $_POST['OldStockID'] . "'\n\n ORDER BY prices.currabrev,\n prices.typeabbrev,\n prices.startdate";
$PricingDataResult = DB_query($sql, $db);
//AND prices.debtorno=''
if (DB_num_rows($PricingDataResult) == 0 and $_POST['OldStockID'] != '') {
prnMsg(_('There is no purchasing data set up for the part selected'), 'info');
$NoPricingData = 1;
} else {
while ($myrow = DB_fetch_array($PricingDataResult)) {