本文整理汇总了C++中Customer::accountId方法的典型用法代码示例。如果您正苦于以下问题:C++ Customer::accountId方法的具体用法?C++ Customer::accountId怎么用?C++ Customer::accountId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customer
的用法示例。
在下文中一共展示了Customer::accountId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
// Set the data object from the widgets.
void
CardTransfer::widgetToData()
{
_gltxFrame->getData(_curr);
_curr.setMemo(_memo->text());
_curr.setCardId(_from->getId());
_quasar->db()->setActive(_curr, !_inactive->isChecked());
_gltxFrame->getData(_link);
_link.setNumber(_toNumber->text());
_link.setShiftId(_toShift->getId());
_link.setMemo(_memo->text());
_link.setCardId(_to->getId());
_quasar->db()->setActive(_link, !_inactive->isChecked());
fixed amount = _amount->getFixed();
Id transferAcct = _account->getId();
Card card;
Id fromAcct;
_quasar->db()->lookup(_curr.cardId(), card);
DataObject::DataType fromType = card.dataType();
if (card.dataType() == DataObject::CUSTOMER) {
Customer customer;
_quasar->db()->lookup(card.id(), customer);
fromAcct = customer.accountId();
} else if (card.dataType() == DataObject::VENDOR) {
Vendor vendor;
_quasar->db()->lookup(card.id(), vendor);
fromAcct = vendor.accountId();
}
Id toAcct;
_quasar->db()->lookup(_link.cardId(), card);
DataObject::DataType toType = card.dataType();
if (card.dataType() == DataObject::CUSTOMER) {
Customer customer;
_quasar->db()->lookup(card.id(), customer);
toAcct = customer.accountId();
} else if (card.dataType() == DataObject::VENDOR) {
Vendor vendor;
_quasar->db()->lookup(card.id(), vendor);
toAcct = vendor.accountId();
}
// Process fromAcct and transfer acct on first card
_curr.cards().clear();
_curr.cards().push_back(CardLine(_curr.cardId(), -amount));
_curr.accounts().clear();
if (fromType == DataObject::CUSTOMER) {
_curr.accounts().push_back(AccountLine(fromAcct, -amount));
_curr.accounts().push_back(AccountLine(transferAcct, amount));
} else if (fromType == DataObject::VENDOR) {
_curr.accounts().push_back(AccountLine(fromAcct, amount));
_curr.accounts().push_back(AccountLine(transferAcct, -amount));
}
// Process toAcct and transfer acct on second card
_link.cards().clear();
if (fromType == toType) {
_link.cards().push_back(CardLine(_link.cardId(), amount));
_link.accounts().clear();
if (toType == DataObject::CUSTOMER) {
_link.accounts().push_back(AccountLine(toAcct, amount));
_link.accounts().push_back(AccountLine(transferAcct, -amount));
} else if (toType == DataObject::VENDOR) {
_link.accounts().push_back(AccountLine(toAcct, -amount));
_link.accounts().push_back(AccountLine(transferAcct, amount));
}
} else {
_link.cards().push_back(CardLine(_link.cardId(), -amount));
_link.accounts().clear();
if (toType == DataObject::CUSTOMER) {
_link.accounts().push_back(AccountLine(toAcct, -amount));
_link.accounts().push_back(AccountLine(transferAcct, amount));
} else if (toType == DataObject::VENDOR) {
_link.accounts().push_back(AccountLine(toAcct, amount));
_link.accounts().push_back(AccountLine(transferAcct, -amount));
}
}
}
示例2: it
void
ServiceCharges::slotPost()
{
QDate end = _end->getDate();
Id store_id = _store->getId();
Id account_id = _account->getId();
// Validate data
if (store_id == INVALID_ID) {
QString message = tr("A store must be entered");
QMessageBox::critical(this, tr("Error"), message);
_store->setFocus();
return;
}
if (account_id == INVALID_ID) {
QString message = tr("An account must be entered");
QMessageBox::critical(this, tr("Error"), message);
_account->setFocus();
return;
}
QString message = tr("Are you sure you want to post the charges?");
int ch = QMessageBox::warning(this, tr("Continue?"), message,
QMessageBox::No, QMessageBox::Yes);
if (ch != QMessageBox::Yes) return;
QApplication::setOverrideCursor(waitCursor);
qApp->processEvents();
QListViewItemIterator it(_charges);
for (; it.current(); ++it) {
ListViewItem* item = (ListViewItem*)it.current();
Id customer_id = item->id;
fixed amount = item->value(1).toFixed();
if (customer_id == INVALID_ID) continue;
Customer customer;
_quasar->db()->lookup(customer_id, customer);
// Generate service charge transaction
CardAdjust adjustment;
adjustment.setPostDate(end);
adjustment.setPostTime(QTime(0, 0, 0));
adjustment.setMemo(tr("Service Charges"));
adjustment.setCardId(customer_id);
adjustment.setStoreId(store_id);
CardLine cardLine(customer_id, amount);
adjustment.cards().push_back(cardLine);
// Add account lines
Id receivables_id = customer.accountId();
adjustment.accounts().push_back(AccountLine(receivables_id, amount));
adjustment.accounts().push_back(AccountLine(account_id, -amount));
// Post adjustment
_quasar->db()->create(adjustment);
}
Company orig, company;
_quasar->db()->lookup(orig);
company = orig;
company.setLastServiceCharge(end);
company.setChargeAccount(account_id);
_quasar->db()->update(orig, company);
QApplication::restoreOverrideCursor();
message = tr("The service charges have been posted");
QMessageBox::information(this, tr("Posted"), message);
close();
}
示例3: tr
void
OpenBalances::slotPost()
{
Id store_id = _store->getId();
Id station_id = _station->getId();
Id employee_id = _employee->getId();
Id history_id = _account->getId();
if (store_id == INVALID_ID) {
QString message = tr("A store is required");
QMessageBox::critical(this, tr("Error"), message);
_store->setFocus();
return;
}
if (history_id == INVALID_ID) {
QString message = tr("An account is required");
QMessageBox::critical(this, tr("Error"), message);
_account->setFocus();
return;
}
QApplication::setOverrideCursor(waitCursor);
qApp->processEvents();
for (int row = 0; row < _customers->rows(); ++row) {
Id customer_id = _customers->cellValue(row, 0).toId();
QDate date = _customers->cellValue(row, 1).toDate();
fixed amount = _customers->cellValue(row, 2).toFixed();
if (customer_id == INVALID_ID || amount == 0.0) continue;
Customer customer;
_quasar->db()->lookup(customer_id, customer);
Id customer_acct = customer.accountId();
CardAdjust adjustment;
adjustment.setPostDate(date);
adjustment.setPostTime(QTime(0, 0, 0));
adjustment.setMemo(tr("Open Balance"));
adjustment.setStationId(station_id);
adjustment.setEmployeeId(employee_id);
adjustment.setCardId(customer_id);
adjustment.setStoreId(store_id);
adjustment.accounts().push_back(AccountLine(customer_acct, amount));
adjustment.accounts().push_back(AccountLine(history_id, -amount));
adjustment.cards().push_back(CardLine(customer_id, amount));
if (!_quasar->db()->create(adjustment)) {
QString message = tr("Customer '%1' open balance failed")
.arg(customer.name());
QMessageBox::critical(this, tr("Error"), message);
}
}
for (int row = 0; row < _vendors->rows(); ++row) {
Id vendor_id = _vendors->cellValue(row, 0).toId();
QDate date = _vendors->cellValue(row, 1).toDate();
fixed amount = _vendors->cellValue(row, 2).toFixed();
if (vendor_id == INVALID_ID || amount == 0.0) continue;
Vendor vendor;
_quasar->db()->lookup(vendor_id, vendor);
Id vendor_acct = vendor.accountId();
CardAdjust adjustment;
adjustment.setPostDate(date);
adjustment.setPostTime(QTime(0, 0, 0));
adjustment.setMemo(tr("Open Balance"));
adjustment.setStationId(station_id);
adjustment.setEmployeeId(employee_id);
adjustment.setCardId(vendor_id);
adjustment.setStoreId(store_id);
adjustment.accounts().push_back(AccountLine(vendor_acct, -amount));
adjustment.accounts().push_back(AccountLine(history_id, amount));
adjustment.cards().push_back(CardLine(vendor_id, amount));
if (!_quasar->db()->create(adjustment)) {
QString message = tr("Vendor '%1' open balance failed")
.arg(vendor.name());
QMessageBox::critical(this, tr("Error"), message);
}
}
for (int row = 0; row < _items->rows(); ++row) {
Id item_id = _items->cellValue(row, 0).toId();
QString number = _items->cellValue(row, 0).toPlu().number();
QString size = _items->cellValue(row, 2).toString();
fixed qty = _items->cellValue(row, 3).toFixed();
fixed cost = _items->cellValue(row, 4).toFixed();
if (item_id == INVALID_ID || (qty == 0.0 && cost == 0.0)) continue;
Item item;
_quasar->db()->lookup(item_id, item);
Id item_acct = item.assetAccount();
ItemAdjust adjustment;
adjustment.setPostDate(QDate::currentDate());
adjustment.setPostTime(QTime::currentTime());
//.........这里部分代码省略.........