void TxSummary::processGltx(const Gltx& gltx) { Employee employee; findEmployee(gltx.employeeId(), employee); EmployeeInfo& info = findEmployeeInfo(employee); // Voided transactions just get counted if (!gltx.isActive()) { info.voidTxCnt++; return; } // Further processing based on type switch (gltx.dataType()) { case DataObject::INVOICE: processInvoice(info, gltx); break; case DataObject::RETURN: processReturn(info, gltx); break; case DataObject::PAYOUT: processPayout(info, gltx); break; case DataObject::RECEIPT: processPayment(info, gltx); break; case DataObject::WITHDRAW: processWithdraw(info, gltx); break; case DataObject::NOSALE: processNosale(info, gltx); break; case DataObject::TEND_ADJUST: processTenderAdjust(info, gltx); break; default: processOther(info, gltx); } }
//Draw the Find Employee window. FindEmployee::FindEmployee(QDialog * parent) : QDialog(parent) { QLabel *employeeNameLabel = new QLabel(tr("Employee Name")); employeeName = new QLineEdit; employeeName->setMinimumWidth(300); findEmployeeButton = new QPushButton(tr("Find Employee")); connect(findEmployeeButton, SIGNAL(clicked()), this, SLOT(accept())); connect(findEmployeeButton, SIGNAL(clicked()), this, SLOT(findEmployee())); cancelButton = new QPushButton(tr("Cancel")); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(hide())); QHBoxLayout *mainLayout = new QHBoxLayout; mainLayout->addWidget(employeeNameLabel); mainLayout->addWidget(employeeName); mainLayout->addWidget(findEmployeeButton); mainLayout->addWidget(cancelButton); setLayout(mainLayout); setWindowTitle(tr("Find Employee")); }
bool ObjectCache::findEmployee(Id employee_id, Employee& employee) { Employee* object = findEmployee(employee_id); if (object == NULL) return false; employee = *object; return true; }
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; }