本文整理汇总了C++中CreditCardProcessor::credit方法的典型用法代码示例。如果您正苦于以下问题:C++ CreditCardProcessor::credit方法的具体用法?C++ CreditCardProcessor::credit怎么用?C++ CreditCardProcessor::credit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreditCardProcessor
的用法示例。
在下文中一共展示了CreditCardProcessor::credit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sCCRefundCM
void arWorkBench::sCCRefundCM()
{
if (_aropenCM->altId() < 0)
{
QMessageBox::warning(this, tr("Cannot Refund by Credit Card"),
tr("<p>The application cannot refund this "
"transaction using a credit card."));
return;
}
int ccardid = -1;
double total = 0.0;
double tax = 0.0;
double freight = 0.0;
double duty = 0.0;
int currid = -1;
bool taxexempt = false;
QString docnum;
QString refnum;
int ccpayid = -1;
q.prepare("SELECT cmhead_id "
"FROM cmhead "
"WHERE (cmhead_number=:cmheadnumber);");
q.bindValue(":cmheadnumber", _aropenCM->currentItem()->text(1));
q.exec();
if (q.first())
{
ParameterList ccp;
ccp.append("cmhead_id", q.value("cmhead_id"));
MetaSQLQuery ccm = mqlLoad(":/so/creditMemoCreditCard.mql");
XSqlQuery ccq = ccm.toQuery(ccp);
if (ccq.first())
{
ccardid = ccq.value("ccard_id").toInt();
total = ccq.value("total").toDouble();
tax = ccq.value("tax_in_cmcurr").toDouble();
taxexempt = ccq.value("cmhead_tax_id").isNull();
freight = ccq.value("cmhead_freight").toDouble();
currid = ccq.value("cmhead_curr_id").toInt();
docnum = ccq.value("cmhead_number").toString();
refnum = ccq.value("cohead_number").toString();
ccpayid = ccq.value("ccpay_id").toInt();
}
else if (ccq.lastError().type() != QSqlError::None)
{
systemError(this, ccq.lastError().databaseText(), __FILE__, __LINE__);
return;
}
else
{
QMessageBox::critical(this, tr("Credit Card Processing Error"),
tr("Could not find a Credit Card to use for "
"this Credit transaction."));
return;
}
}
else if (q.lastError().type() != QSqlError::None)
{
systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
return;
}
else // cmhead not found - maybe it's just an open item
{
q.prepare("SELECT ccard_id, aropen_amount - aropen_paid AS balance,"
" aropen_curr_id, aropen_docnumber "
"FROM aropen, ccard "
"WHERE ((aropen_cust_id=ccard_cust_id)"
" AND (ccard_active)"
" AND (aropen_open)"
" AND (aropen_id=:aropenid));");
q.bindValue(":aropenid", _aropenCM->id());
q.exec();
if (q.first())
{
ccardid = q.value("ccard_id").toInt();
total = q.value("balance").toDouble();
currid = q.value("aropen_curr_id").toInt();
docnum = q.value("aropen_docnumber").toString();
}
else if (q.lastError().type() != QSqlError::None)
{
systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
return;
}
else
{
QMessageBox::critical(this, tr("Credit Card Processing Error"),
tr("Could not find a Credit Card to use for "
"this Credit transaction."));
return;
}
}
CreditCardProcessor *cardproc = CreditCardProcessor::getProcessor();
if (! cardproc)
QMessageBox::critical(this, tr("Credit Card Processing Error"),
CreditCardProcessor::errorMsg());
else
//.........这里部分代码省略.........
示例2: sDelete
void openSalesOrders::sDelete()
{
if ( QMessageBox::warning(this, tr("Delete Sales Order?"),
tr("<p>Are you sure that you want to completely "
"delete the selected Sales Order?"),
QMessageBox::Yes,
QMessageBox::No | QMessageBox::Default) == QMessageBox::Yes)
{
q.prepare("SELECT deleteSo(:sohead_id) AS result;");
q.bindValue(":sohead_id", _so->id());
q.exec();
if (q.first())
{
bool closeInstead = false;
int result = q.value("result").toInt();
if (result == -4 && _privleges->check("ProcessCreditCards"))
{
if ( QMessageBox::question(this, tr("Cannot Delete Sales Order"),
storedProcErrorLookup("deleteSo", result) +
"<br>Would you like to refund the amount "
"charged and close the Sales Order instead?",
QMessageBox::Yes | QMessageBox::Default,
QMessageBox::No) == QMessageBox::Yes)
{
CreditCardProcessor *cardproc = CreditCardProcessor::getProcessor();
if (! cardproc)
QMessageBox::critical(this, tr("Credit Card Processing Error"),
CreditCardProcessor::errorMsg());
else
{
XSqlQuery ccq;
ccq.prepare("SELECT ccpay_ccard_id, ccpay_curr_id,"
" SUM(ccpay_amount * sense) AS amount,"
" SUM(ccpay_r_tax * sense) AS tax,"
" SUM(ccpay_r_shipping * sense) AS freight "
"FROM (SELECT ccpay_ccard_id, ccpay_curr_id, "
" CASE WHEN ccpay_status = 'C' THEN 1"
" WHEN ccpay_status = 'R' THEN -1"
" END AS sense,"
" ccpay_amount,"
" COALESCE(ccpay_r_tax::NUMERIC, 0) AS ccpay_r_tax,"
" COALESCE(ccpay_r_shipping::NUMERIC, 0) AS ccpay_r_shipping "
" FROM ccpay, payco "
" WHERE ((ccpay_id=payco_ccpay_id)"
" AND (ccpay_status IN ('C', 'R'))"
" AND (payco_cohead_id=:coheadid)) "
" ) AS dummy "
"GROUP BY ccpay_ccard_id, ccpay_curr_id;");
ccq.bindValue(":coheadid", _so->id());
ccq.exec();
if (ccq.first())
do
{
QString docnum = _so->currentItem()->text(0);
QString refnum = docnum;
int ccpayid = -1;
int coheadid = _so->id();
int returnVal = cardproc->credit(ccq.value("ccpay_ccard_id").toInt(),
-2,
ccq.value("amount").toDouble(),
ccq.value("tax").toDouble(),
true,
ccq.value("freight").toDouble(),
0,
ccq.value("ccpay_curr_id").toInt(),
docnum, refnum, ccpayid,
"cohead", coheadid);
if (returnVal < 0)
{
QMessageBox::critical(this, tr("Credit Card Processing Error"),
cardproc->errorMsg());
return;
}
else if (returnVal > 0)
{
QMessageBox::warning(this, tr("Credit Card Processing Warning"),
cardproc->errorMsg());
closeInstead = true;
}
else if (! cardproc->errorMsg().isEmpty())
{
QMessageBox::information(this, tr("Credit Card Processing Note"),
cardproc->errorMsg());
closeInstead = true;
}
} while (ccq.next());
else if (ccq.lastError().type() != QSqlError::None)
{
systemError(this, ccq.lastError().databaseText(),
__FILE__, __LINE__);
return;
}
else
{
systemError(this, tr("Could not find the ccpay records!"),
__FILE__, __LINE__);
return;
}
}
//.........这里部分代码省略.........
示例3: sProcess
void returnAuthorizationWorkbench::sProcess()
{
if (!checkSitePrivs(_radue->id()))
return;
bool _post = ((_radue->altId() > 1) ||
(_radue->altId() == 1 && _postmemos->isChecked())) ;
q.prepare("SELECT createRaCreditMemo(:rahead_id,:post) AS result;");
q.bindValue(":rahead_id",_radue->id());
q.bindValue(":post",QVariant(_post));
q.exec();
if (q.first())
{
int cmheadid = q.value("result").toInt();
if (cmheadid < 0)
{
systemError(this, storedProcErrorLookup("createRaCreditMemo", cmheadid), __FILE__, __LINE__);
return;
}
q.prepare( "SELECT cmhead_number "
"FROM cmhead "
"WHERE (cmhead_id=:cmhead_id);" );
q.bindValue(":cmhead_id", cmheadid);
q.exec();
if (q.first())
{
QMessageBox::information( this, tr("New Credit Memo Created"),
tr("<p>A new CreditMemo has been created and "
"assigned #%1")
.arg(q.value("cmhead_number").toString()));
if (_printmemo->isChecked())
{
ParameterList params;
params.append("cmhead_id", cmheadid);
if (_post)
params.append("posted");
printCreditMemo newdlg(this, "", TRUE);
newdlg.set(params);
newdlg.exec();
}
if (_radue->altId() == 2)
{
ParameterList params;
params.append("cmhead_id", cmheadid);
returnAuthCheck newdlg(this, "", TRUE);
newdlg.set(params);
if (newdlg.exec() != XDialog::Rejected)
sFillListDue();
}
else if (_radue->altId() == 3)
{
ParameterList ccp;
ccp.append("cmhead_id", cmheadid);
MetaSQLQuery ccm = mqlLoad("creditMemoCreditCards", "detail");
XSqlQuery ccq = ccm.toQuery(ccp);
if (ccq.first())
{
int ccpayid = ccq.value("ccpay_id").toInt();
CreditCardProcessor *cardproc = CreditCardProcessor::getProcessor();
if (! cardproc)
QMessageBox::critical(this, tr("Credit Card Processing Error"),
CreditCardProcessor::errorMsg());
else if (! cardproc->errorMsg().isEmpty())
QMessageBox::critical(this, tr("Credit Card Processing Warning"),
cardproc->errorMsg());
else
{
QString docnum = q.value("cmhead_number").toString();
QString refnum = ccq.value("cohead_number").toString();
int refid = -1;
int returnValue = cardproc->credit(ccq.value("ccard_id").toInt(),
-2,
ccq.value("total").toDouble(),
ccq.value("tax_in_cmcurr").toDouble(),
ccq.value("cmhead_tax_id").isNull(),
ccq.value("cmhead_freight").toDouble(),
0,
ccq.value("cmhead_curr_id").toInt(),
docnum, refnum, ccpayid,
QString(), refid);
if (returnValue < 0)
QMessageBox::critical(this, tr("Credit Card Processing Error"),
cardproc->errorMsg());
else if (returnValue > 0)
QMessageBox::warning(this, tr("Credit Card Processing Warning"),
cardproc->errorMsg());
else if (! cardproc->errorMsg().isEmpty())
QMessageBox::information(this, tr("Credit Card Processing Note"),
cardproc->errorMsg());
}
// requery regardless 'cause the new credit memo means nothing's "due"
sFillListDue();
}
else if (ccq.lastError().type() != QSqlError::NoError)
{
systemError(this, ccq.lastError().databaseText(), __FILE__, __LINE__);
return;
//.........这里部分代码省略.........