当前位置: 首页>>代码示例>>C++>>正文


C++ Customer::name方法代码示例

本文整理汇总了C++中Customer::name方法的典型用法代码示例。如果您正苦于以下问题:C++ Customer::name方法的具体用法?C++ Customer::name怎么用?C++ Customer::name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Customer的用法示例。


在下文中一共展示了Customer::name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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());
//.........这里部分代码省略.........
开发者ID:cwarden,项目名称:quasar,代码行数:101,代码来源:open_balances.cpp


注:本文中的Customer::name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。