Esempio n. 1
0
Gltx*
ObjectCache::findGltx(Id gltx_id)
{
    DataObject* object = find(gltx_id);
    if (object == NULL) return NULL;

    switch (object->dataType()) {
    case DataObject::CARD_ADJUST:
    case DataObject::CHEQUE:
    case DataObject::CLAIM:
    case DataObject::GENERAL:
    case DataObject::INVOICE:
    case DataObject::ITEM_ADJUST:
    case DataObject::NOSALE:
    case DataObject::PAYOUT:
    case DataObject::RECEIPT:
    case DataObject::RECEIVE:
    case DataObject::RETURN:
    case DataObject::SHIFT:
    case DataObject::TEND_ADJUST:
    case DataObject::WITHDRAW:
	return (Gltx*)object;
    default:
	break;
    }

    qWarning("Invalid gltx type: " + object->dataTypeName());
    return NULL;
}
Esempio n. 2
0
DataObject*
ObjectCache::find(Id object_id, bool cacheOnly)
{
    if (object_id == INVALID_ID)
	return NULL;

    if (_objects.find(object_id) != _objects.end())
	return _objects[object_id];

    if (cacheOnly)
	return NULL;

    DataObject object;
    if (!_db->lookup(object_id, object))
	return NULL;

    switch (object.dataType()) {
    case DataObject::ACCOUNT:		return findAccount(object_id);
    case DataObject::ADJUST_REASON:	return findAdjustReason(object_id);
    case DataObject::CARD_ADJUST:	return findCardAdjust(object_id);
    case DataObject::CHARGE:		return findCharge(object_id);
    case DataObject::CHEQUE:		return findCheque(object_id);
    case DataObject::CLAIM:		return findReceive(object_id);
    case DataObject::COMPANY:		return findCompany(object_id);
    case DataObject::COUNT:		return findCount(object_id);
    case DataObject::CUSTOMER:		return findCustomer(object_id);
    case DataObject::CUST_TYPE:		return findCustomerType(object_id);
    case DataObject::DEPT:		return findDept(object_id);
    case DataObject::DISCOUNT:		return findDiscount(object_id);
    case DataObject::EMPLOYEE:		return findEmployee(object_id);
    case DataObject::EXPENSE:		return findExpense(object_id);
    case DataObject::EXTRA:		return findExtra(object_id);
    case DataObject::GENERAL:		return findGeneral(object_id);
    case DataObject::GROUP:		return findGroup(object_id);
    case DataObject::INVOICE:		return findInvoice(object_id);
    case DataObject::ITEM:		return findItem(object_id);
    case DataObject::ITEM_ADJUST:	return findItemAdjust(object_id);
    case DataObject::ITEM_PRICE:	return findItemPrice(object_id);
    case DataObject::LABEL_BATCH:	return findLabelBatch(object_id);
    case DataObject::LOCATION:		return findLocation(object_id);
    case DataObject::NOSALE:		return findNosale(object_id);
    case DataObject::ORDER:		return findOrder(object_id);
    case DataObject::PO_TEMPLATE:	return findOrderTemplate(object_id);
    case DataObject::PAT_GROUP:		return findPatGroup(object_id);
    case DataObject::PAT_WS:		return findPatWorksheet(object_id);
    case DataObject::PAYOUT:		return findPayout(object_id);
    case DataObject::PERSONAL:		return findPersonal(object_id);
    case DataObject::PLU:		assert("Invalid data type: PLU");
    case DataObject::PRICE_BATCH:	return findPriceBatch(object_id);
    case DataObject::PROMO_BATCH:	return findPromoBatch(object_id);
    case DataObject::QUOTE:		return findQuote(object_id);
    case DataObject::RECEIPT:		return findReceipt(object_id);
    case DataObject::RECEIVE:		return findReceive(object_id);
    case DataObject::RECONCILE:		return findReconcile(object_id);
    case DataObject::RECURRING:		return findRecurring(object_id);
    case DataObject::REPORT:		assert("Invalid data type: REPORT");
    case DataObject::RETURN:		return findInvoice(object_id);
    case DataObject::SECURITY_TYPE:	return findSecurityType(object_id);
    case DataObject::SHIFT:		return findShift(object_id);
    case DataObject::SLIP:		return findSlip(object_id);
    case DataObject::STATION:		return findStation(object_id);
    case DataObject::STORE:		return findStore(object_id);
    case DataObject::SUBDEPT:		return findSubdept(object_id);
    case DataObject::TAX:		return findTax(object_id);
    case DataObject::TENDER:		return findTender(object_id);
    case DataObject::TEND_COUNT:	return findTenderCount(object_id);
    case DataObject::TEND_ADJUST:	return findTenderAdjust(object_id);
    case DataObject::TERM:		return findTerm(object_id);
    case DataObject::TODO:		return findTodo(object_id);
    case DataObject::USER:		return findUser(object_id);
    case DataObject::VENDOR:		return findVendor(object_id);
    case DataObject::WITHDRAW:		return findWithdraw(object_id);
    }

    qWarning("Unknown object type: " + object.dataTypeName());
    return NULL;
}
Esempio n. 3
0
QString Exporter::formatFilter(const DataObject & data)
{
    return formatFilters().value(data.dataTypeName());
}
Esempio n. 4
0
bool Exporter::isExportSupported(const DataObject & data)
{
    return formatFilters().contains(data.dataTypeName());
}