Popup::Popup(QWidget* text, QButton* button, QWidget* parent, const char* name) : QWidget(parent, name) { _text = text; _button = button; _popup = NULL; text->reparent(this, 0, QPoint()); if (text->inherits("LineEdit")) connect(text, SIGNAL(validData()), SIGNAL(validData())); button->reparent(this, 0, QPoint()); connect(button, SIGNAL(clicked()), SLOT(openPopup())); if (topLevelWidget()) topLevelWidget()->installEventFilter(this); text->installEventFilter(this); setFocusProxy(text); setFocusPolicy(StrongFocus); QGridLayout* grid = new QGridLayout(this); grid->setColStretch(0, 1); grid->addWidget(text, 0, 0); grid->addWidget(button, 0, 1, AlignLeft | AlignVCenter); setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); }
TimeEdit::TimeEdit(QWidget* parent, const char* name) : ValconEdit(_timeValcon, parent, name) { QString text = _timeValcon.format(QTime(20, 33, 33)); _sizeChar = '9'; _sizeLength = text.length(); setMinimumWidth(calcMinimumWidth()); connect(this, SIGNAL(validData()), SLOT(validData())); }
bool LookupEdit::popup(QKeySequence key) { bool result = true; if (key == QKeySequence(Key_F9)) { _lookup->clearLines(); _lookup->setText(text()); if (!text().isEmpty()) _lookup->refresh(); result = _lookup->exec(); if (result) { setId(_lookup->getId()); emit validData(); } } else if (key == QKeySequence(Key_F10)) { if (_id != INVALID_ID && _lookup->allowEdit()) _lookup->slotEdit(_id); } else if (key == QKeySequence(Key_F11)) { if (_lookup->allowNew()) { QWidget* screen = _lookup->slotNew(); if (screen != NULL) connect(screen, SIGNAL(created(Id)), SLOT(created(Id))); } } else { qDebug("Unknown popup key: " + QString(key)); } return result; }
float IRTemp::getTemperature( TempUnit scale, byte dataType) { long timeout = millis() + IRTEMP_TIMEOUT; sensorEnable(true); while(1) { uint8_t data[IRTEMP_DATA_SIZE] = { 0 }; for(uint8_t data_byte = 0; data_byte < IRTEMP_DATA_SIZE; data_byte++) { for(int8_t data_bit = 7; data_bit >= 0; data_bit--) { // Clock idles high, data changes on falling edge, sample on rising edge while(digitalRead(_pinClock) == HIGH && millis() < timeout) { } // Wait for falling edge while(digitalRead(_pinClock) == LOW && millis() < timeout) { } // Wait for rising edge to sample if(digitalRead(_pinData)) data[data_byte] |= 1<<data_bit; } } if(millis() >= timeout) { sensorEnable(false); return NAN; } if (data[0] == dataType && validData(data)) { sensorEnable(false); float temperature = decodeTemperature(data); if (scale == FAHRENHEIT) temperature = convertFahrenheit(temperature); return temperature; } } }
void doResizeWithoutInit( T& target, std::vector<bool>& valid, std::size_t newSize) { auto oldSize = target.size(); auto before = validData(target, valid); folly::resizeWithoutInitialization(target, newSize); valid.resize(newSize); auto after = validData(target, valid); if (oldSize <= newSize) { EXPECT_EQ(before, after); } else { EXPECT_GE(before.size(), after.size()); EXPECT_TRUE(std::equal(after.begin(), after.end(), before.begin())); } }
static int hdrPutTag(Header h, rpmTagVal tag, PyObject *value) { rpmTagType type = rpmTagGetTagType(tag); rpmTagReturnType retype = rpmTagGetReturnType(tag); int rc = 0; /* XXX this isn't really right (i18n strings etc) but for now ... */ if (headerIsEntry(h, tag)) { PyErr_SetString(PyExc_TypeError, "tag already exists"); return rc; } /* validate all data before trying to insert */ if (!validData(tag, type, retype, value)) { PyErr_SetString(PyExc_TypeError, "invalid type for tag"); return 0; } if (retype == RPM_SCALAR_RETURN_TYPE) { rc = hdrAppendItem(h, tag, type, value); } else if (retype == RPM_ARRAY_RETURN_TYPE && PyList_Check(value)) { Py_ssize_t len = PyList_Size(value); for (Py_ssize_t i = 0; i < len; i++) { PyObject *item = PyList_GetItem(value, i); rc = hdrAppendItem(h, tag, type, item); } } else { PyErr_SetString(PyExc_RuntimeError, "cant happen, right?"); } return rc; }
void UT_CDTMFPayloadFormatRead::UT_CDTMFPayloadFormatRead_SetPayloadFormatL() { TDTMFPayloadFormat nullData( EDTMFPayloadFormatNotDefined ); EUNIT_ASSERT_EQUALS( iRead->SetPayloadFormat( nullData ), KErrNotSupported ); TDTMFPayloadFormat validData( EDTMFPayloadFormatTone ); EUNIT_ASSERT_EQUALS( iRead->SetPayloadFormat( validData ), KErrNone ); }
void doResize(T& target, std::vector<bool>& valid, std::size_t newSize) { auto oldSize = target.size(); auto before = validData(target, valid); target.resize(newSize); valid.resize(newSize); for (auto i = oldSize; i < newSize; ++i) { valid[i] = true; } auto after = validData(target, valid); if (oldSize == newSize) { EXPECT_EQ(before, after); } else if (oldSize < newSize) { EXPECT_LT(before.size(), after.size()); EXPECT_TRUE(std::equal(before.begin(), before.end(), after.begin())); } else { EXPECT_GE(before.size(), after.size()); EXPECT_TRUE(std::equal(after.begin(), after.end(), before.begin())); } }
void JalousieEinstellungen::updateJalEinstellungen() { dictionary *hsconf; QByteArray hsconfByteArray = hsconfFile->fileName().toLatin1(); hsconf = iniparser_load(hsconfByteArray.data()); ui->spinBox_Auf_Offset->setValue(0); ui->spinBox_Zu_Offset->setValue(0); ui->timeEdit_Auf->setTime(QTime::fromString("00:00")); ui->timeEdit_Zu->setTime(QTime::fromString("00:00")); for(int i = 0; i < 8; i++) { if(confWidgetsJal[i].isBool) { QAbstractButton *foo = (QAbstractButton*)confWidgetsJal[i].object; confWidgetsJal[i].boolValue = iniparser_getboolean(hsconf, QString(confWidgetsJal[i].section + ":" + confWidgetsJal[i].key).toLatin1(), false); foo->setChecked(confWidgetsJal[i].boolValue); }else if(confWidgetsJal[i].isTime) { QSpinBox *spinBox_Offset = confWidgetsJal[i].object->findChild<QSpinBox *>(); QTimeEdit *timeEdit_Uhrzeit = confWidgetsJal[i].object->findChild<QTimeEdit *>(); QList<QRadioButton *> listRadioButton = confWidgetsJal[i].object->findChildren<QRadioButton *>(); confWidgetsJal[i].strValue = QString(iniparser_getstring(hsconf, QString(confWidgetsJal[i].section + ":" + confWidgetsJal[i].key).toLatin1(), NULL)); if(confWidgetsJal[i].strValue.contains(":")) //Uhrzeit { timeEdit_Uhrzeit->setTime(QTime::fromString(confWidgetsJal[i].strValue, "h:m")); for(int k = 0; k < 3; k++) { listRadioButton[k]->setChecked(listRadioButton[k]->objectName().contains("Uhrzeit")); } } else { if(confWidgetsJal[i].strValue.contains("SA")) { for(int k = 0; k < 3; k++) { listRadioButton[k]->setChecked(listRadioButton[k]->objectName().contains("SA")); } } else if(confWidgetsJal[i].strValue.contains("SU")) { for(int k = 0; k < 3; k++) { listRadioButton[k]->setChecked(listRadioButton[k]->objectName().contains("SU")); } } spinBox_Offset->setValue(confWidgetsJal[i].strValue.right(confWidgetsJal[i].strValue.size() - 2).toInt()); } } } iniparser_freedict(hsconf); validData(true); }
void QtChatRoomInviteDlg::startConference() { if ( validData() ) { _chatSession.getGroupChatInfo().setAlias( _chatRoomName ); //VOXOX - JRT - 2009.06.13 - Caller can access the Participant list and handle invites. // // _chatSession // QList<QListWidgetItem *>selectList = _inviteListWidget->findItems("*",Qt::MatchWildcard); // QList<QListWidgetItem *>::iterator it; // // for (it = selectList.begin(); it!= selectList.end(); it++) // { // QtChatRoomListWidgetItem * item = dynamic_cast<QtChatRoomListWidgetItem *> (*it); //// _chatSession.addIMContact(*(item->getContact().getFirstAvailableIMContact(_chatSession))); //// _selectedContact.append((item->getContact())); // } accept(); } }
int getData(char *buffer, char *data) { size_t len = 0; startSignal(8); readData(8, buffer); dispData(buffer, BUFFER_SIZE); len = rawToBinary(buffer, data, THRESHOLD); dispData(data, DATA_SIZE); printf("len: %d\n", len); while (!(len == DATA_SIZE && validData(data))) { delay(2000); // wait 2 sec before next iteration. startSignal(8); readData(8, buffer); dispData(buffer, BUFFER_SIZE); len = rawToBinary(buffer, data, THRESHOLD); dispData(data, DATA_SIZE); printf("len: %d\n", len); } return len; }
SalesHistory::SalesHistory(MainWindow* main) : QuasarWindow(main, "SalesHistory"), _grid(NULL) { _helpSource = "sales_history.html"; QFrame* frame = new QFrame(this); QGroupBox* select = new QGroupBox(tr("Data Selection"), frame); QGridLayout* grid1 = new QGridLayout(select, 2, 1, select->frameWidth()*2); grid1->addRowSpacing(0, select->fontMetrics().height()); _lookup = new ItemLookup(_main, this); _lookup->soldOnly = true; _lookup->store_id = _quasar->defaultStore(); QLabel* itemLabel = new QLabel(tr("Item Number:"), select); _item = new ItemEdit(_lookup, select); _item->setLength(18, '9'); itemLabel->setBuddy(_item); QLabel* descLabel = new QLabel(tr("Description:"), select); _desc = new LineEdit(select); _desc->setLength(30); _desc->setFocusPolicy(NoFocus); QLabel* storeLabel = new QLabel(tr("Store:"), select); _store = new LookupEdit(new StoreLookup(_main, this), select); _store->setLength(30); storeLabel->setBuddy(_store); QLabel* sizeLabel = new QLabel(tr("Size:"), select); _size = new ComboBox(false, select); sizeLabel->setBuddy(_size); _size->insertItem(tr("All Sizes")); QLabel* dateLabel = new QLabel(tr("Date:"), select); _date = new DatePopup(select); dateLabel->setBuddy(_date); grid1->setColStretch(2, 1); grid1->addWidget(itemLabel, 1, 0); grid1->addWidget(_item, 1, 1, AlignLeft | AlignVCenter); grid1->addWidget(descLabel, 2, 0); grid1->addWidget(_desc, 2, 1, AlignLeft | AlignVCenter); grid1->addWidget(storeLabel, 3, 0); grid1->addWidget(_store, 3, 1, AlignLeft | AlignVCenter); grid1->addWidget(sizeLabel, 1, 2, AlignRight | AlignVCenter); grid1->addWidget(_size, 1, 3, AlignLeft | AlignVCenter); grid1->addWidget(dateLabel, 2, 2, AlignRight | AlignVCenter); grid1->addWidget(_date, 2, 3, AlignLeft | AlignVCenter); QGroupBox* format = new QGroupBox(tr("Data Format"), frame); QGridLayout* grid2 = new QGridLayout(format, 2, 1, format->frameWidth()*2); grid2->addRowSpacing(0, format->fontMetrics().height()); QLabel* qtySizeLabel = new QLabel(tr("Quantity Size:"), format); _qtySize = new ComboBox(false, format); qtySizeLabel->setBuddy(_qtySize); _qtySize->insertItem("EACH"); QLabel* periodLabel = new QLabel(tr("Period:"), format); _period = new ComboBox(false, format); periodLabel->setBuddy(_period); _period->insertItem(tr("Month")); _period->insertItem(tr("Week")); _period->insertItem(tr("Day")); QLabel* countLabel = new QLabel(tr("Count:"), format); _count = new IntegerEdit(format); _count->setLength(4); countLabel->setBuddy(_count); grid2->setColStretch(2, 1); grid2->addWidget(qtySizeLabel, 1, 0); grid2->addWidget(_qtySize, 1, 1, AlignLeft | AlignVCenter); grid2->addWidget(periodLabel, 1, 2, AlignRight | AlignVCenter); grid2->addWidget(_period, 1, 3, AlignLeft | AlignVCenter); grid2->addWidget(countLabel, 2, 2, AlignRight | AlignVCenter); grid2->addWidget(_count, 2, 3, AlignLeft | AlignVCenter); _list = new ListView(frame); _list->addTextColumn(tr("Period"), 10); _list->addDateColumn(tr("Start Date")); _list->addNumberColumn(tr("Quantity")); _list->addMoneyColumn(tr("Total Cost")); _list->addMoneyColumn(tr("Total Price")); _list->addMoneyColumn(tr("Profit")); _list->addPercentColumn(tr("Margin")); _list->setSorting(1, false); _list->setShowSortIndicator(true); QFrame* info = new QFrame(frame); QLabel* minLabel = new QLabel(tr("Min:"), info); _minQty = new DoubleEdit(info); _minQty->setFocusPolicy(NoFocus); QLabel* maxLabel = new QLabel(tr("Max:"), info); _maxQty = new DoubleEdit(info); _maxQty->setFocusPolicy(NoFocus); QLabel* onHandLabel = new QLabel(tr("On Hand:"), info); _onHand = new DoubleEdit(info); _onHand->setFocusPolicy(NoFocus); QLabel* onOrderLabel = new QLabel(tr("On Order:"), info); _onOrder = new DoubleEdit(info); _onOrder->setFocusPolicy(NoFocus); QGridLayout* infoGrid = new QGridLayout(info); infoGrid->setSpacing(6); infoGrid->setMargin(6); infoGrid->setColStretch(2, 1); infoGrid->addWidget(minLabel, 0, 0); infoGrid->addWidget(_minQty, 0, 1, AlignLeft | AlignVCenter); infoGrid->addWidget(onHandLabel, 0, 3); infoGrid->addWidget(_onHand, 0, 4, AlignLeft | AlignVCenter); infoGrid->addWidget(maxLabel, 1, 0); infoGrid->addWidget(_maxQty, 1, 1, AlignLeft | AlignVCenter); infoGrid->addWidget(onOrderLabel, 1, 3); infoGrid->addWidget(_onOrder, 1, 4, AlignLeft | AlignVCenter); QFrame* box = new QFrame(frame); QPushButton* refresh = new QPushButton(tr("&Refresh"), box); refresh->setMinimumSize(refresh->sizeHint()); connect(refresh, SIGNAL(clicked()), SLOT(slotRefresh())); QPushButton* print = new QPushButton(tr("&Print"), box); print->setMinimumSize(refresh->sizeHint()); connect(print, SIGNAL(clicked()), SLOT(slotPrint())); QPushButton* close = new QPushButton(tr("Cl&ose"), box); close->setMinimumSize(refresh->sizeHint()); connect(close, SIGNAL(clicked()), SLOT(close())); QGridLayout* boxGrid = new QGridLayout(box); boxGrid->setSpacing(6); boxGrid->setMargin(6); boxGrid->setColStretch(2, 1); boxGrid->addWidget(refresh, 0, 0, AlignLeft | AlignVCenter); boxGrid->addWidget(print, 0, 1, AlignLeft | AlignVCenter); boxGrid->addWidget(close, 0, 2, AlignRight | AlignVCenter); QGridLayout* grid = new QGridLayout(frame); grid->setSpacing(6); grid->setMargin(6); grid->setRowStretch(2, 1); grid->addWidget(select, 0, 0); grid->addWidget(format, 1, 0); grid->addWidget(_list, 2, 0); grid->addWidget(info, 3, 0); grid->addWidget(box, 4, 0); connect(_item, SIGNAL(validData()), SLOT(slotItemChanged())); connect(_store, SIGNAL(validData()), SLOT(slotStoreChanged())); connect(_size, SIGNAL(activated(int)), SLOT(slotRefresh())); connect(_date, SIGNAL(validData()), SLOT(slotRefresh())); connect(_qtySize, SIGNAL(activated(int)), SLOT(slotRefresh())); connect(_period, SIGNAL(activated(int)), SLOT(slotRefresh())); connect(_count, SIGNAL(validData()), SLOT(slotRefresh())); _store->setId(_quasar->defaultStore()); _date->setDate(QDate::currentDate()); _count->setInt(12); _item->setFocus(); setCentralWidget(frame); setCaption(tr("Sales History")); finalize(); }
Inquiry::Inquiry(MainWindow* main) : QuasarWindow(main, "Inquiry"), _loading(false) { _helpSource = "inquiry.html"; QFrame* frame = new QFrame(this); QLabel* dateLabel = new QLabel(tr("Dates:"), frame); _dateRange = new DateRange(frame); dateLabel->setBuddy(_dateRange); QLabel* fromLabel = new QLabel(tr("From:"), frame); _from = new DatePopup(frame); fromLabel->setBuddy(_from); QLabel* toLabel = new QLabel(tr("To:"), frame); _to = new DatePopup(frame); toLabel->setBuddy(_to); QLabel* storeLabel = new QLabel(tr("&Store:"), frame); _store = new LookupEdit(new StoreLookup(_main, this), frame); _store->setLength(30); storeLabel->setBuddy(_store); connect(_store, SIGNAL(validData()), SLOT(slotStoreChange())); _tabs = new QTabWidget(frame); _account = new AccountInquiry(main, _tabs); _card = new CardInquiry(main, _tabs); _item = new ItemInquiry(main, _tabs); _tabs->addTab(_account, tr("&Account")); _tabs->addTab(_card, tr("Car&d")); _tabs->addTab(_item, tr("&Item")); QFrame* box = new QFrame(frame); QPushButton* refresh = new QPushButton(tr("&Refresh"), box); refresh->setMinimumSize(refresh->sizeHint()); connect(refresh, SIGNAL(clicked()), SLOT(slotRefresh())); QPushButton* print = new QPushButton(tr("&Print"), box); print->setMinimumSize(refresh->sizeHint()); connect(print, SIGNAL(clicked()), SLOT(slotPrint())); QPushButton* close = new QPushButton(tr("Cl&ose"), box); close->setMinimumSize(refresh->sizeHint()); connect(close, SIGNAL(clicked()), SLOT(close())); QGridLayout* boxGrid = new QGridLayout(box); boxGrid->setSpacing(6); boxGrid->setMargin(6); boxGrid->setColStretch(2, 1); boxGrid->addWidget(refresh, 0, 0, AlignLeft | AlignVCenter); boxGrid->addWidget(print, 0, 1, AlignLeft | AlignVCenter); boxGrid->addWidget(close, 0, 2, AlignRight | AlignVCenter); QGridLayout* grid = new QGridLayout(frame); grid->setSpacing(6); grid->setMargin(6); grid->setRowStretch(2, 1); grid->setColStretch(6, 1); grid->addWidget(dateLabel, 0, 0); grid->addWidget(_dateRange, 0, 1); grid->addWidget(fromLabel, 0, 2); grid->addWidget(_from, 0, 3, AlignLeft | AlignVCenter); grid->addWidget(toLabel, 0, 4); grid->addWidget(_to, 0, 5, AlignLeft | AlignVCenter); grid->addWidget(storeLabel, 1, 0); grid->addMultiCellWidget(_store, 1, 1, 1, 5, AlignLeft | AlignVCenter); grid->addMultiCellWidget(_tabs, 2, 2, 0, 6); grid->addMultiCellWidget(box, 3, 3, 0, 6); connect(_tabs, SIGNAL(selected(const QString&)), SLOT(slotTabChange())); connect(_account->search, SIGNAL(validData()), SLOT(slotAccountChange())); connect(_account->list, SIGNAL(doubleClicked(QListViewItem*)), SLOT(slotEdit())); connect(_account->list, SIGNAL(returnPressed(QListViewItem*)), SLOT(slotEdit())); connect(_card->search, SIGNAL(validData()), SLOT(slotCardChange())); connect(_card->list, SIGNAL(doubleClicked(QListViewItem*)), SLOT(slotEdit())); connect(_card->list, SIGNAL(returnPressed(QListViewItem*)), SLOT(slotEdit())); connect(_item->search, SIGNAL(validData()), SLOT(slotItemChange())); connect(_item->list, SIGNAL(doubleClicked(QListViewItem*)), SLOT(slotEdit())); connect(_item->list, SIGNAL(returnPressed(QListViewItem*)), SLOT(slotEdit())); _dateRange->setFromPopup(_from); _dateRange->setToPopup(_to); _dateRange->setCurrentItem(DateRange::Today); _dateRange->setFocus(); _store->setId(_quasar->defaultStore()); if (_quasar->storeCount() == 1) { storeLabel->hide(); _store->hide(); } setCaption(tr("Inquiry")); setCentralWidget(frame); finalize(); }
ItemTransfer::ItemTransfer(MainWindow* main, Id transfer_id) : DataWindow(main, "ItemTransfer", transfer_id) { _helpSource = "item_transfer.html"; // Search button QPushButton* search = new QPushButton(tr("Search"), _buttons); connect(search, SIGNAL(clicked()), SLOT(slotSearch())); // Get the company for deposit info _quasar->db()->lookup(_company); // Create widgets _gltxFrame = new GltxFrame(main, tr("Adjustment No."), _frame); _gltxFrame->setTitle(tr("From")); connect(_gltxFrame->store, SIGNAL(validData()), SLOT(slotStoreChanged())); _items = new Table(_frame); _items->setVScrollBarMode(QScrollView::AlwaysOn); _items->setLeftMargin(fontMetrics().width("99999")); _items->setDisplayRows(6); connect(_items, SIGNAL(cellMoved(int,int)), SLOT(cellMoved(int,int))); connect(_items, SIGNAL(cellChanged(int,int,Variant)), SLOT(cellChanged(int,int,Variant))); connect(_items, SIGNAL(focusNext(bool&,int&,int&,int)), SLOT(focusNext(bool&,int&,int&,int))); connect(_items, SIGNAL(rowInserted(int)), SLOT(rowInserted(int))); connect(_items, SIGNAL(rowDeleted(int)), SLOT(rowDeleted(int))); // Lookups _lookup = new ItemLookup(_main, this); _lookup->inventoriedOnly = true; // Add columns new LookupColumn(_items, tr("Item Number"), 18, _lookup); new TextColumn(_items, tr("Description"), 20); new TextColumn(_items, tr("Size"), 10); new NumberColumn(_items, tr("On Hand"), 6); new NumberColumn(_items, tr("Quantity"), 6); new MoneyColumn(_items, tr("Amount")); if (_company.depositAccount() != INVALID_ID) new MoneyColumn(_items, tr("Deposit"), 4); // Add editors _size = new QComboBox(_items); new LookupEditor(_items, 0, new ItemEdit(_lookup, _items)); new ComboEditor(_items, 2, _size); new NumberEditor(_items, 4, new DoubleEdit(_items)); new NumberEditor(_items, 5, new MoneyEdit(_items)); if (_company.depositAccount() != INVALID_ID) new NumberEditor(_items, 6, new MoneyEdit(_items)); QGroupBox* to = new QGroupBox(tr("To"), _frame); QLabel* toNumberLabel = new QLabel(tr("Adjustment No."), to); _toNumber = new LineEdit(9, to); toNumberLabel->setBuddy(_toNumber); QLabel* toShiftLabel = new QLabel(tr("Shift:"), to); _toShift = new LookupEdit(new GltxLookup(_main, this, DataObject::SHIFT), to); _toShift->setLength(10); _toShift->setFocusPolicy(ClickFocus); toShiftLabel->setBuddy(_toShift); QLabel* toStoreLabel = new QLabel(tr("Store:"), to); _toStore = new LookupEdit(new StoreLookup(_main, this), to); _toStore->setLength(30); toStoreLabel->setBuddy(_toStore); QGridLayout* toGrid = new QGridLayout(to, 1, 1, to->frameWidth() * 2); toGrid->setSpacing(3); toGrid->setMargin(6); toGrid->setColStretch(2, 1); toGrid->addColSpacing(2, 10); toGrid->setColStretch(5, 1); toGrid->addColSpacing(5, 10); toGrid->addRowSpacing(0, to->fontMetrics().height()); toGrid->addWidget(toNumberLabel, 1, 0); toGrid->addWidget(_toNumber, 1, 1, AlignLeft | AlignVCenter); toGrid->addWidget(toShiftLabel, 1, 3); toGrid->addWidget(_toShift, 1, 4, AlignLeft | AlignVCenter); toGrid->addWidget(toStoreLabel, 1, 6); toGrid->addWidget(_toStore, 1, 7, AlignLeft | AlignVCenter); QLabel* accountLabel = new QLabel(tr("Transfer Account:"), _frame); AccountLookup* lookup = new AccountLookup(main, this, Account::OtherCurLiability); _account = new LookupEdit(lookup, _frame); _account->setLength(30); accountLabel->setBuddy(_account); QLabel* totalLabel = new QLabel(tr("Transfer Amount:"), _frame); _total = new MoneyEdit(_frame); _total->setLength(14); _total->setFocusPolicy(NoFocus); totalLabel->setBuddy(_total); _inactive->setText(tr("Voided?")); QGridLayout* grid = new QGridLayout(_frame); grid->setSpacing(3); grid->setMargin(3); grid->setColStretch(2, 1); grid->setRowStretch(1, 1); grid->addMultiCellWidget(_gltxFrame, 0, 0, 0, 4); grid->addMultiCellWidget(_items, 1, 1, 0, 4); grid->addMultiCellWidget(to, 2, 2, 0, 4); grid->addWidget(accountLabel, 3, 0); grid->addWidget(_account, 3, 1, AlignLeft | AlignVCenter); grid->addWidget(totalLabel, 3, 3); grid->addWidget(_total, 3, 4, AlignLeft | AlignVCenter); setCaption(tr("Item Transfer")); finalize(); }
void LookupEdit::created(Id id) { setId(id); emit validData(); }
CountMaster::CountMaster(MainWindow* main, Id count_id) : DataWindow(main, "CountMaster", count_id) { _helpSource = "count_master.html"; QFrame* top = new QFrame(_frame); top->setFrameStyle(QFrame::Raised | QFrame::Panel); QLabel* numberLabel = new QLabel(tr("Count No.:"), top); _number = new LineEdit(top); _number->setLength(14, '9'); numberLabel->setBuddy(_number); QLabel* descLabel = new QLabel(tr("Description:"), top); _description = new LineEdit(top); _description->setLength(40); descLabel->setBuddy(_description); QLabel* dateLabel = new QLabel(tr("Date:"), top); _date = new DatePopup(top); dateLabel->setBuddy(_date); QLabel* locationLabel = new QLabel(tr("Location:"), top); _locLookup = new LocationLookup(_main, this); _location = new LookupEdit(_locLookup, top); _location->setLength(30); locationLabel->setBuddy(_location); QLabel* employeeLabel = new QLabel(tr("Employee:"), top); _employee = new LookupEdit(new EmployeeLookup(_main, this), top); _employee->setLength(30); employeeLabel->setBuddy(_employee); QLabel* storeLabel = new QLabel(tr("Store:"), top); _store = new LookupEdit(new StoreLookup(_main, this), top); _store->setFocusPolicy(ClickFocus); _store->setLength(30); storeLabel->setBuddy(_store); connect(_store, SIGNAL(validData()), SLOT(slotStoreChanged())); QGridLayout* topGrid = new QGridLayout(top); topGrid->setSpacing(3); topGrid->setMargin(3); topGrid->setColStretch(2, 1); topGrid->addColSpacing(2, 20); topGrid->addWidget(numberLabel, 0, 0); topGrid->addWidget(_number, 0, 1, AlignLeft | AlignVCenter); topGrid->addWidget(descLabel, 1, 0); topGrid->addWidget(_description, 1, 1, AlignLeft | AlignVCenter); topGrid->addWidget(dateLabel, 2, 0); topGrid->addWidget(_date, 2, 1, AlignLeft | AlignVCenter); topGrid->addWidget(locationLabel, 3, 0); topGrid->addWidget(_location, 3, 1, AlignLeft | AlignVCenter); topGrid->addWidget(employeeLabel, 4, 0); topGrid->addWidget(_employee, 4, 1, AlignLeft | AlignVCenter); topGrid->addWidget(storeLabel, 5, 0); topGrid->addWidget(_store, 5, 1, AlignLeft | AlignVCenter); QFrame* mid = new QFrame(_frame); mid->setFrameStyle(QFrame::Raised | QFrame::Panel); _items = new Table(mid); _items->setVScrollBarMode(QScrollView::AlwaysOn); _items->setLeftMargin(fontMetrics().width("99999")); _items->setDisplayRows(5); connect(_items, SIGNAL(cellMoved(int,int)), SLOT(cellMoved(int,int))); connect(_items, SIGNAL(cellChanged(int,int,Variant)), SLOT(cellChanged(int,int,Variant))); connect(_items, SIGNAL(focusNext(bool&,int&,int&,int)), SLOT(focusNext(bool&,int&,int&,int))); // Lookups _itemLookup = new ItemLookup(_main, this); _itemLookup->inventoriedOnly = true; // Add columns new LookupColumn(_items, tr("Item Number"), 18, _itemLookup); new TextColumn(_items, tr("Description"), 30); new TextColumn(_items, tr("Size"), 10); new NumberColumn(_items, tr("On Hand")); new NumberColumn(_items, tr("Counted")); LineEdit* descEdit = new LineEdit(_items); NumberEdit* qtyEdit = new DoubleEdit(_items); descEdit->setMaxLength(40); qtyEdit->setMaxLength(8); // Add editors _size = new QComboBox(false, _items); new LookupEditor(_items, 0, new ItemEdit(_itemLookup, _items)); new LineEditor(_items, 1, descEdit); new ComboEditor(_items, 2, _size); new NumberEditor(_items, 4, qtyEdit); QGridLayout* midGrid = new QGridLayout(mid); midGrid->setSpacing(3); midGrid->setMargin(3); midGrid->setColStretch(0, 1); midGrid->addWidget(_items, 0, 0); QGridLayout* grid = new QGridLayout(_frame); grid->setSpacing(3); grid->setMargin(3); grid->setRowStretch(1, 1); grid->addWidget(top, 0, 0); grid->addWidget(mid, 1, 0); if (_quasar->storeCount() == 1) { storeLabel->hide(); _store->hide(); } setCaption(tr("Count Items")); finalize(); }
PromoBatchMaster::PromoBatchMaster(MainWindow* main, Id batch_id) : DataWindow(main, "PromoBatchMaster", batch_id) { _helpSource = "promo_batch_master.html"; QPushButton* print = new QPushButton(tr("Print"), _buttons); connect(print, SIGNAL(clicked()), SLOT(slotPrint())); QPushButton* labels = new QPushButton(tr("Labels"), _buttons); connect(labels, SIGNAL(clicked()), SLOT(slotLabels())); QPushButton* execute = new QPushButton(tr("Execute"), _buttons); connect(execute, SIGNAL(clicked()), SLOT(slotExecute())); QFrame* top = new QFrame(_frame); top->setFrameStyle(QFrame::Raised | QFrame::Panel); QLabel* numberLabel = new QLabel(tr("Batch No.:"), top); _number = new LineEdit(top); _number->setLength(10, '9'); numberLabel->setBuddy(_number); QLabel* descLabel = new QLabel(tr("Description:"), top); _description = new LineEdit(top); _description->setLength(40); descLabel->setBuddy(_description); QLabel* storeLabel = new QLabel(tr("Store:"), top); _store = new LookupEdit(new StoreLookup(_main, this), top); _store->setLength(30); storeLabel->setBuddy(_store); connect(_store, SIGNAL(validData()), SLOT(slotStoreChanged())); QLabel* fromDateLabel = new QLabel(tr("From:"), top); _fromDate = new DatePopup(top); fromDateLabel->setBuddy(_fromDate); QLabel* toDateLabel = new QLabel(tr("To:"), top); _toDate = new DatePopup(top); toDateLabel->setBuddy(_toDate); QLabel* execDateLabel = new QLabel(tr("Executed On:"), top); _execDate = new DateEdit(top); _execDate->setFocusPolicy(NoFocus); QGridLayout* topGrid = new QGridLayout(top); topGrid->setSpacing(3); topGrid->setMargin(3); topGrid->setColStretch(2, 1); topGrid->addColSpacing(2, 20); topGrid->addWidget(numberLabel, 0, 0); topGrid->addWidget(_number, 0, 1, AlignLeft | AlignVCenter); topGrid->addWidget(descLabel, 1, 0); topGrid->addWidget(_description, 1, 1, AlignLeft | AlignVCenter); topGrid->addWidget(storeLabel, 2, 0); topGrid->addWidget(_store, 2, 1, AlignLeft | AlignVCenter); topGrid->addWidget(fromDateLabel, 0, 3); topGrid->addWidget(_fromDate, 0, 4, AlignLeft | AlignVCenter); topGrid->addWidget(toDateLabel, 1, 3); topGrid->addWidget(_toDate, 1, 4, AlignLeft | AlignVCenter); topGrid->addWidget(execDateLabel, 2, 3); topGrid->addWidget(_execDate, 2, 4, AlignLeft | AlignVCenter); QFrame* mid = new QFrame(_frame); mid->setFrameStyle(QFrame::Raised | QFrame::Panel); _items = new Table(mid); _items->setVScrollBarMode(QScrollView::AlwaysOn); _items->setLeftMargin(fontMetrics().width("99999")); _items->setDisplayRows(10); connect(_items, SIGNAL(cellMoved(int,int)), SLOT(cellMoved(int,int))); connect(_items, SIGNAL(cellChanged(int,int,Variant)), SLOT(cellChanged(int,int,Variant))); connect(_items, SIGNAL(focusNext(bool&,int&,int&,int)), SLOT(focusNext(bool&,int&,int&,int))); // Lookups _itemLookup = new ItemLookup(_main, this); _itemLookup->soldOnly = true; // Add columns new LookupColumn(_items, tr("Item Number"), 18, _itemLookup); new TextColumn(_items, tr("Description"), 20); new TextColumn(_items, tr("Size"), 8); new PriceColumn(_items, tr("Price")); new PriceColumn(_items, tr("Promo")); new NumberColumn(_items, tr("Ordered")); // Add editors _size = new QComboBox(false, _items); new LookupEditor(_items, 0, new ItemEdit(_itemLookup, _items)); new ComboEditor(_items, 2, _size); new PriceEditor(_items, 4, new PriceEdit(_items)); new NumberEditor(_items, 5, new DoubleEdit(_items)); QGridLayout* midGrid = new QGridLayout(mid); midGrid->setSpacing(3); midGrid->setMargin(3); midGrid->setColStretch(0, 1); midGrid->addWidget(_items, 0, 0); QGridLayout* grid = new QGridLayout(_frame); grid->setSpacing(3); grid->setMargin(3); grid->setRowStretch(1, 1); grid->addWidget(top, 0, 0); grid->addWidget(mid, 1, 0); if (_quasar->storeCount() == 1) { storeLabel->hide(); _store->hide(); } setCaption(tr("Promotion Batch")); finalize(); }
CashReconcile::CashReconcile(MainWindow* main) : QuasarWindow(main, "CashReconcile") { _helpSource = "cash_reconcile.html"; Company company; _quasar->db()->lookup(_company); QFrame* frame = new QFrame(this); QLabel* dateLabel = new QLabel(tr("Date:"), frame); _date = new DatePopup(frame); dateLabel->setBuddy(_date); connect(_date, SIGNAL(validData()), SLOT(slotRefresh())); QLabel* storeLabel = new QLabel(tr("Store:"), frame); _store = new LookupEdit(new StoreLookup(main, this), frame); _store->setLength(30); storeLabel->setBuddy(_store); connect(_store, SIGNAL(validData()), SLOT(slotRefresh())); _lines = new ListView(frame); _lines->addTextColumn(tr("Number"), 10, AlignRight); if (_company.shiftMethod() == Company::BY_STATION) _lines->addTextColumn(tr("Station"), 20); else _lines->addTextColumn(tr("Employee"), 20); _lines->addNumberColumn(tr("Not Rungoff")); _lines->addNumberColumn(tr("Shifts")); _lines->addNumberColumn(tr("Counts")); _lines->setAllColumnsShowFocus(true); _lines->setShowSortIndicator(true); connect(_lines, SIGNAL(selectionChanged()), this, SLOT(slotLineChanged())); connect(_lines, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(slotLineSelected())); QFrame* mid = new QFrame(frame); _tabs = new QTabWidget(mid); _info = new QFrame(_tabs); _setup = new QFrame(_tabs); _tabs->addTab(_info, tr("Shifts && Counts")); _tabs->addTab(_setup, tr("Setup")); _shiftList = new ListView(_info); _shiftList->addTextColumn(tr("Shift #"), 10, AlignRight); _shiftList->addDateColumn(tr("Date")); _shiftList->setAllColumnsShowFocus(true); _shiftList->setShowSortIndicator(true); _shiftList->setResizeMode(QListView::AllColumns); connect(_shiftList, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(slotShiftSelected())); _countList = new ListView(_info); _countList->addTextColumn(tr("Count #"), 10, AlignRight); _countList->addDateColumn(tr("Date")); _countList->setAllColumnsShowFocus(true); _countList->setShowSortIndicator(true); _countList->setResizeMode(QListView::AllColumns); connect(_countList, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(slotCountSelected())); QGridLayout* infoGrid = new QGridLayout(_info); infoGrid->setSpacing(3); infoGrid->setMargin(3); infoGrid->setRowStretch(0, 1); infoGrid->setColStretch(0, 1); infoGrid->setColStretch(1, 1); infoGrid->addWidget(_shiftList, 0, 0); infoGrid->addWidget(_countList, 0, 1); QLabel* safeStoreLabel = new QLabel(tr("Safe Store:"), _setup); _safeStore = new LookupEdit(new StoreLookup(main, this), _setup); _safeStore->setLength(30); safeStoreLabel->setBuddy(_safeStore); QLabel* safeIdLabel; if (_company.shiftMethod() == Company::BY_STATION) { safeIdLabel = new QLabel(tr("Safe Station:"), _setup); _safeId = new LookupEdit(new StationLookup(main, this), _setup); } else { safeIdLabel = new QLabel(tr("Safe Employee:"), _setup); _safeId = new LookupEdit(new EmployeeLookup(main, this), _setup); } _safeId->setLength(30); safeIdLabel->setBuddy(_safeId); QLabel* adjustLabel = new QLabel(tr("Over/Short Account:"), _setup); _adjust = new LookupEdit(new AccountLookup(main, this), _setup); _adjust->setLength(30); adjustLabel->setBuddy(_adjust); QLabel* transferLabel = new QLabel(tr("Transfer Account:"), _setup); _transfer = new LookupEdit(new AccountLookup(main, this), _setup); _transfer->setLength(30); transferLabel->setBuddy(_transfer); QGridLayout* setupGrid = new QGridLayout(_setup); setupGrid->setSpacing(3); setupGrid->setMargin(3); setupGrid->setRowStretch(4, 1); setupGrid->setColStretch(2, 1); setupGrid->addWidget(safeStoreLabel, 0, 0); setupGrid->addWidget(_safeStore, 0, 1); setupGrid->addWidget(safeIdLabel, 1, 0); setupGrid->addWidget(_safeId, 1, 1); setupGrid->addWidget(adjustLabel, 2, 0); setupGrid->addWidget(_adjust, 2, 1); setupGrid->addWidget(transferLabel, 3, 0); setupGrid->addWidget(_transfer, 3, 1); QFrame* txb = new QFrame(mid); _shiftClose = new QPushButton(tr("Ringoff"), txb); _countCreate = new QPushButton(tr("Create Count"), txb); _bankDeposit = new QPushButton(tr("Bank Deposit"), txb); QPushButton* adjust = new QPushButton(tr("Adjustment"), txb); QPushButton* transfer = new QPushButton(tr("Transfer"), txb); connect(_shiftClose, SIGNAL(clicked()), SLOT(slotShiftClose())); connect(_countCreate, SIGNAL(clicked()), SLOT(slotCreateCount())); connect(_bankDeposit, SIGNAL(clicked()), SLOT(slotBankDeposit())); connect(adjust, SIGNAL(clicked()), SLOT(slotTenderAdjust())); connect(transfer, SIGNAL(clicked()), SLOT(slotTenderTransfer())); QGridLayout* txbGrid = new QGridLayout(txb); txbGrid->setSpacing(3); txbGrid->setMargin(3); txbGrid->setRowStretch(0, 1); txbGrid->addRowSpacing(4, 12); txbGrid->addWidget(_shiftClose, 1, 0); txbGrid->addWidget(_countCreate, 2, 0); txbGrid->addWidget(_bankDeposit, 3, 0); txbGrid->addWidget(adjust, 5, 0); txbGrid->addWidget(transfer, 6, 0); QGridLayout* midGrid = new QGridLayout(mid); midGrid->setSpacing(3); midGrid->setMargin(3); midGrid->setColStretch(0, 1); midGrid->addColSpacing(1, 10); midGrid->addWidget(_tabs, 0, 0); midGrid->addWidget(txb, 0, 2); QFrame* buttons = new QFrame(frame); QPushButton* refresh = new QPushButton(tr("Refresh"), buttons); QPushButton* summary = new QPushButton(tr("Summary"), buttons); _reconcile = new QPushButton(tr("Reconcile"), buttons); QPushButton* cancel = new QPushButton(tr("Cancel"), buttons); connect(refresh, SIGNAL(clicked()), SLOT(slotRefresh())); connect(summary, SIGNAL(clicked()), SLOT(slotSummary())); connect(_reconcile, SIGNAL(clicked()), SLOT(slotReconcile())); connect(cancel, SIGNAL(clicked()), SLOT(close())); QGridLayout* buttonGrid = new QGridLayout(buttons); buttonGrid->setSpacing(6); buttonGrid->setMargin(3); buttonGrid->setColStretch(2, 1); buttonGrid->addWidget(refresh, 0, 0); buttonGrid->addWidget(summary, 0, 1); buttonGrid->addWidget(_reconcile, 0, 3); buttonGrid->addWidget(cancel, 0, 4); QGridLayout* grid = new QGridLayout(frame); grid->setSpacing(6); grid->setMargin(3); grid->setRowStretch(2, 1); grid->setColStretch(2, 1); grid->addWidget(dateLabel, 0, 0); grid->addWidget(_date, 0, 1, AlignLeft | AlignVCenter); grid->addWidget(storeLabel, 1, 0); grid->addWidget(_store, 1, 1, AlignLeft | AlignVCenter); grid->addMultiCellWidget(_lines, 2, 2, 0, 2); grid->addMultiCellWidget(mid, 3, 3, 0, 2); grid->addMultiCellWidget(buttons, 4, 4, 0, 2); _date->setDate(QDate::currentDate()); _store->setId(_quasar->defaultStore()); _safeStore->setId(_company.safeStore()); if (_company.shiftMethod() == Company::BY_STATION) _safeId->setId(_company.safeStation()); else _safeId->setId(_company.safeEmployee()); _adjust->setId(_company.overShortAccount()); _transfer->setId(_company.transferAccount()); _lines->setFocus(); slotRefresh(); setCentralWidget(frame); setCaption(tr("Cash Reconcile")); finalize(); }
CustomerMaster::CustomerMaster(MainWindow* main, Id customer_id) : DataWindow(main, "CustomerMaster", customer_id) { _helpSource = "customer_master.html"; QPushButton* email = new QPushButton(tr("Email"), _buttons); connect(email, SIGNAL(clicked()), SLOT(slotEmail())); // Create widgets _company = new QCheckBox(tr("&Company?"), _frame); connect(_company, SIGNAL(toggled(bool)), SLOT(companyChanged(bool))); _label1 = new QLabel(_frame); _entry1 = new LineEdit(30, _frame); _label1->setBuddy(_entry1); _label2 = new QLabel(_frame); _entry2 = new LineEdit(30, _frame); _label2->setBuddy(_entry2); QLabel* numberLabel = new QLabel(tr("Number:"), _frame); _number = new LineEdit(12, _frame); numberLabel->setBuddy(_number); QLabel* typeLabel = new QLabel(tr("Type:"), _frame); _type = new LookupEdit(new CustomerTypeLookup(_main, this), _frame); _type->setSizeInfo(12, 'x'); _type->setMinCharWidth(12); _type->setMaxLength(20); typeLabel->setBuddy(_type); connect(_type, SIGNAL(validData()), this, SLOT(typeChanged())); QGroupBox* addr = new QGroupBox(tr("Address"), _frame); QGridLayout* grid1 = new QGridLayout(addr, 7, 4, addr->frameWidth() * 2); grid1->addRowSpacing(0, addr->fontMetrics().height()); grid1->setColStretch(2, 1); QLabel* streetLabel = new QLabel(tr("Street:"), addr); _street = new LineEdit(addr); _street->setLength(60); streetLabel->setBuddy(_street); _street2 = new LineEdit(addr); _street2->setLength(60); QLabel* cityLabel = new QLabel(tr("City:"), addr); _city = new LineEdit(20, addr); cityLabel->setBuddy(_city); QLabel* provLabel = new QLabel(tr("Prov/State:"), addr); _province = new LineEdit(20, addr); provLabel->setBuddy(_province); QLabel* postalLabel = new QLabel(tr("Postal/Zip:"), addr); _postal = new LineEdit(20, addr); postalLabel->setBuddy(_postal); QLabel* countryLabel = new QLabel(tr("Country:"), addr); _country = new LineEdit(20, addr); countryLabel->setBuddy(_country); QLabel* phoneLabel = new QLabel(tr("Phone #:"), addr); _phone_num = new LineEdit(20, addr); phoneLabel->setBuddy(_phone_num); QLabel* phone2Label = new QLabel(tr("Phone2 #:"), addr); _phone2_num = new LineEdit(20, addr); phone2Label->setBuddy(_phone2_num); QLabel* faxLabel = new QLabel(tr("Fax #:"), addr); _fax_num = new LineEdit(20, addr); faxLabel->setBuddy(_fax_num); QLabel* emailLabel = new QLabel(tr("Email:"), addr); _email = new LineEdit(60, addr); emailLabel->setBuddy(_email); QLabel* webLabel = new QLabel(tr("Web Page:"), addr); _web_page = new LineEdit(60,addr); webLabel->setBuddy(_web_page); grid1->addWidget(streetLabel, 1, 0); grid1->addMultiCellWidget(_street, 1, 1, 1, 4, AlignLeft | AlignVCenter); grid1->addMultiCellWidget(_street2, 2, 2, 1, 4, AlignLeft | AlignVCenter); grid1->addWidget(cityLabel, 3, 0); grid1->addWidget(_city, 3, 1, AlignLeft | AlignVCenter); grid1->addWidget(provLabel, 3, 3); grid1->addWidget(_province, 3, 4, AlignLeft | AlignVCenter); grid1->addWidget(postalLabel, 4, 0); grid1->addWidget(_postal, 4, 1, AlignLeft | AlignVCenter); grid1->addWidget(countryLabel, 4, 3); grid1->addWidget(_country, 4, 4, AlignLeft | AlignVCenter); grid1->addWidget(phoneLabel, 5, 0); grid1->addWidget(_phone_num, 5, 1, AlignLeft | AlignVCenter); grid1->addWidget(phone2Label, 5, 3); grid1->addWidget(_phone2_num, 5, 4, AlignLeft | AlignVCenter); grid1->addWidget(faxLabel, 6, 0); grid1->addWidget(_fax_num, 6, 1, AlignLeft | AlignVCenter); grid1->addWidget(emailLabel, 7, 0); grid1->addMultiCellWidget(_email, 7, 7, 1, 4, AlignLeft | AlignVCenter); grid1->addWidget(webLabel, 8, 0); grid1->addMultiCellWidget(_web_page, 8, 8, 1, 4, AlignLeft | AlignVCenter); QTabWidget* tabs = new QTabWidget(_frame); QFrame* control = new QFrame(tabs); QFrame* groupTab = new QFrame(tabs); QFrame* trans = new QFrame(tabs); QFrame* refsTab = new QFrame(tabs); QFrame* extraTab = new QFrame(tabs); tabs->addTab(control, tr("Control")); tabs->addTab(groupTab, tr("Groups")); tabs->addTab(trans, tr("Transactions")); tabs->addTab(refsTab, tr("References")); tabs->addTab(extraTab, tr("Extra Info")); QLabel* patgroupLabel = new QLabel(tr("Patronage Group:"), control); _patgroup_id = new LookupEdit(new PatGroupLookup(main, this), control); _patgroup_id->setLength(20); _patgroup_id->setFocusPolicy(NoFocus); patgroupLabel->setBuddy(_patgroup_id); QLabel* accountLabel = new QLabel(tr("AR Account:"), control); _account_id = new LookupEdit(new AccountLookup(main, this, Account::AR), control); _account_id->setLength(30); accountLabel->setBuddy(_account_id); QLabel* termLabel = new QLabel(tr("Terms:"), control); _term_id = new LookupEdit(new TermLookup(main, this), control); _term_id->setLength(30); termLabel->setBuddy(_term_id); QLabel* exemptLabel = new QLabel(tr("Tax Exempt:"), control); _exempt_id = new LookupEdit(new TaxLookup(main, this), control); _exempt_id->setLength(30); exemptLabel->setBuddy(_exempt_id); QLabel* creditLabel = new QLabel(tr("Credit Limit:"), control); _credit_limit = new MoneyEdit(control); _credit_limit->setLength(14); creditLabel->setBuddy(_credit_limit); _credit_hold = new QCheckBox(tr("Credit Hold?"), control); QLabel* scLabel = new QLabel(tr("Service Charge:"), control); _sc_rate = new PercentEdit(control); _sc_rate->setLength(8); scLabel->setBuddy(_sc_rate); _print_stmts = new QCheckBox(tr("Statements?"), control); QGridLayout* conGrid = new QGridLayout(control); conGrid->setSpacing(3); conGrid->setMargin(3); conGrid->setColStretch(3, 1); conGrid->addWidget(patgroupLabel, 0, 0); conGrid->addMultiCellWidget(_patgroup_id, 0,0,1,2,AlignLeft|AlignVCenter); conGrid->addWidget(accountLabel, 1, 0); conGrid->addMultiCellWidget(_account_id, 1,1,1,2,AlignLeft|AlignVCenter); conGrid->addWidget(termLabel, 2, 0); conGrid->addMultiCellWidget(_term_id, 2, 2, 1, 2, AlignLeft|AlignVCenter); conGrid->addWidget(exemptLabel, 3, 0); conGrid->addMultiCellWidget(_exempt_id, 3, 3, 1, 2,AlignLeft|AlignVCenter); conGrid->addWidget(creditLabel, 4, 0); conGrid->addWidget(_credit_limit, 4, 1, AlignLeft | AlignVCenter); conGrid->addWidget(_credit_hold, 4, 2, AlignLeft | AlignVCenter); conGrid->addWidget(scLabel, 5, 0); conGrid->addWidget(_sc_rate, 5, 1, AlignLeft | AlignVCenter); conGrid->addWidget(_print_stmts, 5, 2, AlignLeft | AlignVCenter); _groups = new Table(groupTab); _groups->setVScrollBarMode(QScrollView::AlwaysOn); _groups->setDisplayRows(2); _groups->setLeftMargin(fontMetrics().width("999")); connect(_groups, SIGNAL(cellChanged(int,int,Variant)), SLOT(groupCellChanged(int,int,Variant))); GroupLookup* groupLookup = new GroupLookup(_main, this, Group::CUSTOMER); new LookupColumn(_groups, tr("Group Name"), 20, groupLookup); new LookupEditor(_groups, 0, new LookupEdit(groupLookup, _groups)); QGridLayout* groupGrid = new QGridLayout(groupTab); groupGrid->setSpacing(6); groupGrid->setMargin(3); groupGrid->setRowStretch(0, 1); groupGrid->setColStretch(0, 1); groupGrid->addWidget(_groups, 0, 0); _charge = new QCheckBox(tr("Can Charge?"), trans); _withdraw = new QCheckBox(tr("Can Withdraw?"), trans); _payment = new QCheckBox(tr("Can Make Payment?"), trans); _check_bal = new QCheckBox(tr("Check Withdraw Balance?"), trans); _second_rcpt = new QCheckBox(tr("Second Receipt?"), trans); _discs = new Table(trans); _discs->setVScrollBarMode(QScrollView::AlwaysOn); _discs->setDisplayRows(2); _discs->setLeftMargin(fontMetrics().width("999")); connect(_discs, SIGNAL(cellChanged(int,int,Variant)), SLOT(discountCellChanged(int,int,Variant))); DiscountLookup* discLookup = new DiscountLookup(_main, this); discLookup->txOnly = true; new LookupColumn(_discs, tr("Discount"), 20, discLookup); new LookupEditor(_discs, 0, new LookupEdit(discLookup, _discs)); QGridLayout* transGrid = new QGridLayout(trans); transGrid->setSpacing(6); transGrid->setMargin(3); transGrid->setRowStretch(5, 1); transGrid->setColStretch(1, 1); transGrid->addWidget(_charge, 0, 0, AlignLeft | AlignVCenter); transGrid->addWidget(_withdraw, 1, 0, AlignLeft | AlignVCenter); transGrid->addWidget(_payment, 2, 0, AlignLeft | AlignVCenter); transGrid->addWidget(_check_bal, 3, 0, AlignLeft | AlignVCenter); transGrid->addWidget(_second_rcpt, 4, 0, AlignLeft | AlignVCenter); transGrid->addMultiCellWidget(_discs, 0, 5, 2, 2); _refs = new Table(refsTab); _refs->setVScrollBarMode(QScrollView::AlwaysOn); _refs->setDisplayRows(2); _refs->setLeftMargin(fontMetrics().width("999")); connect(_refs, SIGNAL(cellChanged(int,int,Variant)), SLOT(refCellChanged(int,int,Variant))); new TextColumn(_refs, tr("Reference"), 16); LineEdit* refEdit = new LineEdit(_refs); refEdit->setMaxLength(16); new LineEditor(_refs, 0, refEdit); QGridLayout* refGrid = new QGridLayout(refsTab); refGrid->setSpacing(6); refGrid->setMargin(3); refGrid->setRowStretch(0, 1); refGrid->setColStretch(0, 1); refGrid->addWidget(_refs, 0, 0); _extra = new Table(extraTab); _extra->setVScrollBarMode(QScrollView::AlwaysOn); _extra->setDisplayRows(2); _extra->setLeftMargin(fontMetrics().width("999")); connect(_extra, SIGNAL(focusNext(bool&,int&,int&,int)), SLOT(extraFocusNext(bool&,int&,int&,int))); ExtraLookup* extraLookup = new ExtraLookup(_main, this, "Customer"); new LookupColumn(_extra, tr("Data Name"), 30, extraLookup); new TextColumn(_extra, tr("Value"), 30); new LineEditor(_extra, 1, new LineEdit(_extra)); QPushButton* createData = new QPushButton(tr("Create Data"), extraTab); QPushButton* deleteData = new QPushButton(tr("Delete Data"), extraTab); QPushButton* renameData = new QPushButton(tr("Rename Data"), extraTab); connect(createData, SIGNAL(clicked()), SLOT(slotCreateData())); connect(deleteData, SIGNAL(clicked()), SLOT(slotDeleteData())); connect(renameData, SIGNAL(clicked()), SLOT(slotRenameData())); QGridLayout* extraGrid = new QGridLayout(extraTab); extraGrid->setSpacing(6); extraGrid->setMargin(3); extraGrid->setRowStretch(0, 1); extraGrid->setColStretch(0, 1); extraGrid->addMultiCellWidget(_extra, 0, 0, 0, 3); extraGrid->addWidget(createData, 1, 1); extraGrid->addWidget(deleteData, 1, 2); extraGrid->addWidget(renameData, 1, 3); _open_bal = new QGroupBox(tr("Opening Balance"), _frame); QGridLayout* i_grid = new QGridLayout(_open_bal, 2, 2, _open_bal->frameWidth() * 2); i_grid->addRowSpacing(0, _open_bal->fontMetrics().height()); QLabel* asOfLabel = new QLabel(tr("As of"), _open_bal); _as_of = new DatePopup(_open_bal); asOfLabel->setBuddy(_as_of); QLabel* openBalLabel = new QLabel(tr("Balance:"), _open_bal); _open_balance = new MoneyEdit(_open_bal); _open_balance->setLength(20); openBalLabel->setBuddy(_open_balance); i_grid->setColStretch(2, 1); i_grid->addWidget(asOfLabel, 1, 0, AlignLeft); i_grid->addWidget(_as_of, 2, 0, AlignLeft | AlignVCenter); i_grid->addWidget(openBalLabel, 1, 1, AlignLeft); i_grid->addWidget(_open_balance, 2, 1, AlignLeft | AlignVCenter); Company company; _quasar->db()->lookup(company); if (_id != INVALID_ID || company.historicalBalancing() == INVALID_ID) _open_bal->hide(); QGridLayout* grid = new QGridLayout(_frame); grid->setSpacing(3); grid->setMargin(3); grid->setRowStretch(4, 1); grid->setColStretch(2, 1); grid->addColSpacing(2, 10); grid->addWidget(_company, 0, 0); grid->addWidget(_label1, 1, 0, AlignLeft | AlignVCenter); grid->addWidget(_entry1, 1, 1, AlignLeft | AlignVCenter); grid->addWidget(_label2, 2, 0, AlignLeft | AlignVCenter); grid->addWidget(_entry2, 2, 1, AlignLeft | AlignVCenter); grid->addWidget(numberLabel, 1, 3, AlignLeft | AlignVCenter); grid->addWidget(_number, 1, 4, AlignLeft | AlignVCenter); grid->addWidget(typeLabel, 2, 3, AlignLeft | AlignVCenter); grid->addWidget(_type, 2, 4, AlignLeft | AlignVCenter); grid->addMultiCellWidget(addr, 3, 3, 0, 4); grid->addMultiCellWidget(tabs, 4, 4, 0, 4); grid->addMultiCellWidget(_open_bal, 5, 5, 0, 4); setCaption(tr("Customer Master")); finalize(); }
CardTransfer::CardTransfer(MainWindow* main, Id transfer_id) : DataWindow(main, "CardTransfer", transfer_id) { _helpSource = "card_transfer.html"; // Create widgets _gltxFrame = new GltxFrame(main, tr("Transfer No."), _frame); _gltxFrame->setTitle(tr("From")); _gltxFrame->hideMemo(); QFrame* mid = new QFrame(_frame); mid->setFrameStyle(QFrame::Raised | QFrame::Panel); QLabel* fromLabel = new QLabel(tr("From:"), mid); CardLookup* fromLookup = new CardLookup(main, this); fromLookup->type->setCurrentItem(tr("Customer and Vendor")); fromLookup->type->setEnabled(false); _from = new LookupEdit(fromLookup, mid); _from->setLength(30); fromLabel->setBuddy(_from); connect(_from, SIGNAL(validData()), SLOT(slotFromChanged())); QLabel* fromBalanceLabel = new QLabel(tr("Balance:"), mid); _fromBalance = new MoneyEdit(mid); _fromBalance->setFocusPolicy(NoFocus); QLabel* toLabel = new QLabel(tr("To:"), mid); CardLookup* toLookup = new CardLookup(main, this); toLookup->type->setCurrentItem(tr("Customer and Vendor")); toLookup->type->setEnabled(false); _to = new LookupEdit(toLookup, mid); _to->setLength(30); toLabel->setBuddy(_to); connect(_to, SIGNAL(validData()), SLOT(slotToChanged())); QLabel* toBalanceLabel = new QLabel(tr("Balance:"), mid); _toBalance = new MoneyEdit(mid); _toBalance->setFocusPolicy(NoFocus); QLabel* amountLabel = new QLabel(tr("Amount:"), mid); _amount = new MoneyEdit(mid); amountLabel->setBuddy(_amount); QLabel* memoLabel = new QLabel(tr("&Memo:"), mid); _memo = new LineEdit(mid); _memo->setMaxLength(40); _memo->setMinimumWidth(_memo->fontMetrics().width('x') * 40); memoLabel->setBuddy(_memo); QGridLayout* midGrid = new QGridLayout(mid); midGrid->setSpacing(3); midGrid->setMargin(3); midGrid->setColStretch(2, 1); midGrid->addWidget(fromLabel, 0, 0); midGrid->addWidget(_from, 0, 1, AlignLeft | AlignVCenter); midGrid->addWidget(fromBalanceLabel, 0, 2, AlignRight | AlignVCenter); midGrid->addWidget(_fromBalance, 0, 3, AlignLeft | AlignVCenter); midGrid->addWidget(toLabel, 1, 0); midGrid->addWidget(_to, 1, 1, AlignLeft | AlignVCenter); midGrid->addWidget(toBalanceLabel, 1, 2, AlignRight | AlignVCenter); midGrid->addWidget(_toBalance, 1, 3, AlignLeft | AlignVCenter); midGrid->addWidget(amountLabel, 2, 0); midGrid->addWidget(_amount, 2, 1, AlignLeft | AlignVCenter); midGrid->addWidget(memoLabel, 3, 0); midGrid->addMultiCellWidget(_memo, 3, 3, 1, 3); QGroupBox* to = new QGroupBox(tr("To"), _frame); QLabel* toNumberLabel = new QLabel(tr("Transfer No."), to); _toNumber = new LineEdit(9, to); toNumberLabel->setBuddy(_toNumber); QLabel* toShiftLabel = new QLabel(tr("Shift:"), to); _toShift = new LookupEdit(new GltxLookup(_main, this, DataObject::SHIFT), to); _toShift->setLength(10); _toShift->setFocusPolicy(ClickFocus); toShiftLabel->setBuddy(_toShift); QGridLayout* toGrid = new QGridLayout(to, 1, 1, to->frameWidth() * 2); toGrid->setSpacing(3); toGrid->setMargin(6); toGrid->setColStretch(2, 1); toGrid->addColSpacing(2, 10); toGrid->addRowSpacing(0, to->fontMetrics().height()); toGrid->addWidget(toNumberLabel, 1, 0); toGrid->addWidget(_toNumber, 1, 1, AlignLeft | AlignVCenter); toGrid->addWidget(toShiftLabel, 1, 3); toGrid->addWidget(_toShift, 1, 4, AlignLeft | AlignVCenter); QLabel* accountLabel = new QLabel(tr("Transfer Account:"), _frame); AccountLookup* lookup = new AccountLookup(main, this, Account::Expense); _account = new LookupEdit(lookup, _frame); _account->setLength(30); accountLabel->setBuddy(_account); _inactive->setText(tr("Voided?")); QGridLayout* grid = new QGridLayout(_frame); grid->setSpacing(3); grid->setMargin(3); grid->setColStretch(2, 1); grid->setRowStretch(1, 1); grid->addMultiCellWidget(_gltxFrame, 0, 0, 0, 4); grid->addMultiCellWidget(mid, 1, 1, 0, 4); grid->addMultiCellWidget(to, 2, 2, 0, 4); grid->addWidget(accountLabel, 3, 0); grid->addWidget(_account, 3, 1, AlignLeft | AlignVCenter); setCaption(tr("Card Transfer")); finalize(); }
OpenBalances::OpenBalances(MainWindow* main) : QuasarWindow(main, "OpenBalances") { _helpSource = "open_balances.html"; QFrame* frame = new QFrame(this); QFrame* top = new QFrame(frame); QLabel* storeLabel = new QLabel(tr("Store:"), top); _store = new LookupEdit(new StoreLookup(main, this), top); _store->setLength(30); storeLabel->setBuddy(_store); connect(_store, SIGNAL(validData()), SLOT(slotStoreChanged())); QLabel* stationLabel = new QLabel(tr("Station:"), top); _station = new LookupEdit(new StationLookup(main, this), top); _station->setLength(30); stationLabel->setBuddy(_station); QLabel* employeeLabel = new QLabel(tr("Employee:"), top); _employee = new LookupEdit(new EmployeeLookup(main, this), top); _employee->setLength(30); employeeLabel->setBuddy(_employee); QGridLayout* topGrid = new QGridLayout(top); topGrid->setSpacing(6); topGrid->setMargin(3); topGrid->setColStretch(2, 1); topGrid->addWidget(storeLabel, 0, 0); topGrid->addWidget(_store, 0, 1, AlignLeft | AlignVCenter); topGrid->addWidget(stationLabel, 1, 0); topGrid->addWidget(_station, 1, 1, AlignLeft | AlignVCenter); topGrid->addWidget(employeeLabel, 2, 0); topGrid->addWidget(_employee, 2, 1, AlignLeft | AlignVCenter); QTabWidget* tabs = new QTabWidget(frame); QFrame* customers = new QFrame(tabs); QFrame* vendors = new QFrame(tabs); QFrame* items = new QFrame(tabs); QFrame* accounts = new QFrame(tabs); tabs->addTab(customers, tr("Customers")); tabs->addTab(vendors, tr("Vendors")); tabs->addTab(items, tr("Items")); tabs->addTab(accounts, tr("Accounts")); _customers = new Table(customers); _customers->setVScrollBarMode(QScrollView::AlwaysOn); _customers->setDisplayRows(10); _customers->setLeftMargin(fontMetrics().width("99999")); connect(_customers, SIGNAL(cellChanged(int,int,Variant)), SLOT(customerCellChanged(int,int,Variant))); connect(_customers, SIGNAL(focusNext(bool&,int&,int&,int)), SLOT(customerFocusNext(bool&,int&,int&,int))); CustomerLookup* custLookup = new CustomerLookup(_main, this); new LookupColumn(_customers, tr("Customer"), 30, custLookup); new DateColumn(_customers, tr("Date")); new MoneyColumn(_customers, tr("Amount"), 10); new LookupEditor(_customers, 0, new LookupEdit(custLookup, _customers)); new LineEditor(_customers, 1, new DateEdit(_customers)); new NumberEditor(_customers, 2, new MoneyEdit(_customers)); QGridLayout* customerGrid = new QGridLayout(customers); customerGrid->setSpacing(6); customerGrid->setMargin(3); customerGrid->setColStretch(0, 1); customerGrid->addWidget(_customers, 0, 0); _vendors = new Table(vendors); _vendors->setVScrollBarMode(QScrollView::AlwaysOn); _vendors->setDisplayRows(10); _vendors->setLeftMargin(fontMetrics().width("99999")); connect(_vendors, SIGNAL(cellChanged(int,int,Variant)), SLOT(vendorCellChanged(int,int,Variant))); connect(_vendors, SIGNAL(focusNext(bool&,int&,int&,int)), SLOT(vendorFocusNext(bool&,int&,int&,int))); VendorLookup* vendLookup = new VendorLookup(_main, this); new LookupColumn(_vendors, tr("Vendor"), 30, vendLookup); new DateColumn(_vendors, tr("Date")); new MoneyColumn(_vendors, tr("Amount"), 10); new LookupEditor(_vendors, 0, new LookupEdit(vendLookup, _vendors)); new LineEditor(_vendors, 1, new DateEdit(_vendors)); new NumberEditor(_vendors, 2, new MoneyEdit(_vendors)); QGridLayout* vendorGrid = new QGridLayout(vendors); vendorGrid->setSpacing(6); vendorGrid->setMargin(3); vendorGrid->setColStretch(0, 1); vendorGrid->addWidget(_vendors, 0, 0); _items = new Table(items); _items->setVScrollBarMode(QScrollView::AlwaysOn); _items->setDisplayRows(10); _items->setLeftMargin(fontMetrics().width("99999")); connect(_items, SIGNAL(cellMoved(int,int)), SLOT(itemCellMoved(int,int))); connect(_items, SIGNAL(cellChanged(int,int,Variant)), SLOT(itemCellChanged(int,int,Variant))); connect(_items, SIGNAL(focusNext(bool&,int&,int&,int)), SLOT(itemFocusNext(bool&,int&,int&,int))); _itemLookup = new ItemLookup(_main, this); _itemLookup->inventoriedOnly = true; new LookupColumn(_items, tr("Item"), 12, _itemLookup); new TextColumn(_items, tr("Description"), 20); new TextColumn(_items, tr("Size"), 8); new NumberColumn(_items, tr("Quantity"), 6); new MoneyColumn(_items, tr("Total Cost"), 8); _size = new QComboBox(_items); new LookupEditor(_items, 0, new ItemEdit(_itemLookup, _items)); new ComboEditor(_items, 2, _size); new NumberEditor(_items, 3, new DoubleEdit(_items)); new NumberEditor(_items, 4, new MoneyEdit(_items)); QGridLayout* itemGrid = new QGridLayout(items); itemGrid->setSpacing(6); itemGrid->setMargin(3); itemGrid->setColStretch(0, 1); itemGrid->addWidget(_items, 0, 0); _accounts = new Table(accounts); _accounts->setVScrollBarMode(QScrollView::AlwaysOn); _accounts->setDisplayRows(10); _accounts->setLeftMargin(fontMetrics().width("99999")); connect(_accounts, SIGNAL(cellChanged(int,int,Variant)), SLOT(accountCellChanged(int,int,Variant))); connect(_accounts, SIGNAL(focusNext(bool&,int&,int&,int)), SLOT(accountFocusNext(bool&,int&,int&,int))); AccountLookup* acctLookup = new AccountLookup(_main, this); new LookupColumn(_accounts, tr("Account"), 30, acctLookup); new MoneyColumn(_accounts, tr("Debit"), 10); new MoneyColumn(_accounts, tr("Credit"), 10); new LookupEditor(_accounts, 0, new LookupEdit(acctLookup, _accounts)); new NumberEditor(_accounts, 1, new MoneyEdit(_accounts)); new NumberEditor(_accounts, 2, new MoneyEdit(_accounts)); QGridLayout* accountGrid = new QGridLayout(accounts); accountGrid->setSpacing(6); accountGrid->setMargin(3); accountGrid->setColStretch(0, 1); accountGrid->addWidget(_accounts, 0, 0); QFrame* bot = new QFrame(frame); QLabel* accountLabel = new QLabel(tr("Account:"), bot); _account = new LookupEdit(new AccountLookup(_main, this), bot); _account->setLength(30); accountLabel->setBuddy(_account); QLabel* totalLabel = new QLabel(tr("Total:"), bot); _total = new MoneyEdit(bot); _total->setFocusPolicy(NoFocus); totalLabel->setBuddy(_total); QGridLayout* botGrid = new QGridLayout(bot); botGrid->setSpacing(6); botGrid->setMargin(3); botGrid->setColStretch(2, 1); botGrid->addWidget(accountLabel, 0, 0); botGrid->addWidget(_account, 0, 1, AlignLeft | AlignVCenter); botGrid->addWidget(totalLabel, 0, 3); botGrid->addWidget(_total, 0, 4, AlignLeft | AlignVCenter); QFrame* buttons = new QFrame(frame); QPushButton* import = new QPushButton(tr("Import"), buttons); QPushButton* post = new QPushButton(tr("Post"), buttons); QPushButton* cancel = new QPushButton(tr("Cancel"), buttons); connect(import, SIGNAL(clicked()), SLOT(slotImport())); connect(post, SIGNAL(clicked()), SLOT(slotPost())); connect(cancel, SIGNAL(clicked()), SLOT(close())); QGridLayout* buttonGrid = new QGridLayout(buttons); buttonGrid->setSpacing(6); buttonGrid->setMargin(3); buttonGrid->setColStretch(1, 1); buttonGrid->addWidget(import, 0, 0); buttonGrid->addWidget(post, 0, 2); buttonGrid->addWidget(cancel, 0, 3); QGridLayout* grid = new QGridLayout(frame); grid->setSpacing(6); grid->setMargin(3); grid->addWidget(top, 0, 0); grid->addWidget(tabs, 1, 0); grid->addWidget(bot, 2, 0); grid->addWidget(buttons, 3, 0); Company company; _quasar->db()->lookup(company); _store->setId(_quasar->defaultStore(true)); _station->setId(_quasar->defaultStation()); _employee->setId(_quasar->defaultEmployee()); _account->setId(company.historicalBalancing()); _customers->appendRow(new VectorRow(_customers->columns())); _vendors->appendRow(new VectorRow(_vendors->columns())); _items->appendRow(new VectorRow(_items->columns())); _accounts->appendRow(new VectorRow(_accounts->columns())); #if 0 ItemSelect conditions; vector<Item> v_items; _quasar->db()->select(v_items, conditions); for (unsigned int i = 0; i < v_items.size(); ++i) { Item& item = v_items[i]; for (unsigned int j = 0; j < item.vendors().size(); ++j) { ItemVendor& vendor = item.vendors()[j]; bool found = false; for (unsigned int k = 0; k < item.numbers().size(); ++k) { if (item.numbers()[k].number == vendor.number) { found = true; break; } } if (found) continue; ItemPlu info; info.number = vendor.number; Item orig = item; item.numbers().push_back(info); _quasar->db()->update(orig, item); } } #endif setCentralWidget(frame); setCaption(tr("Open Balances")); finalize(); }
ItemMargin::ItemMargin(MainWindow* main) : QuasarWindow(main, "ItemMargin") { _helpSource = "item_margin.html"; QFrame* frame = new QFrame(this); QFrame* top = new QFrame(frame); _lookup = new ItemLookup(_main, this); _lookup->soldOnly = true; _lookup->store_id = _quasar->defaultStore(); QLabel* itemLabel = new QLabel(tr("Item Number:"), top); _item = new ItemEdit(_lookup, top); _item->setLength(18, '9'); itemLabel->setBuddy(_item); QLabel* descLabel = new QLabel(tr("Description:"), top); _desc = new LineEdit(top); _desc->setLength(30); _desc->setFocusPolicy(NoFocus); QLabel* storeLabel = new QLabel(tr("Store:"), top); _store = new LookupEdit(new StoreLookup(_main, this), top); _store->setLength(30); storeLabel->setBuddy(_store); QGridLayout* topGrid = new QGridLayout(top); topGrid->setMargin(3); topGrid->setSpacing(3); topGrid->setColStretch(2, 1); topGrid->addWidget(itemLabel, 0, 0); topGrid->addWidget(_item, 0, 1, AlignLeft | AlignVCenter); topGrid->addWidget(descLabel, 1, 0); topGrid->addWidget(_desc, 1, 1, AlignLeft | AlignVCenter); topGrid->addWidget(storeLabel, 2, 0); topGrid->addWidget(_store, 2, 1, AlignLeft | AlignVCenter); QGroupBox* price = new QGroupBox(tr("Price"), frame); QGridLayout* priceGrid = new QGridLayout(price,2,1,price->frameWidth()*2); priceGrid->addRowSpacing(0, price->fontMetrics().height()); QLabel* priceSizeLabel = new QLabel(tr("Size:"), price); _priceSize = new ComboBox(price); priceSizeLabel->setBuddy(_priceSize); QLabel* priceLabel = new QLabel(tr("Price:"), price); _price = new PriceEdit(price); priceLabel->setBuddy(_price); QLabel* priceTaxLabel = new QLabel(tr("Tax:"), price); _priceTax = new MoneyEdit(price); _priceTax->setFocusPolicy(NoFocus); priceTaxLabel->setBuddy(_priceTax); QLabel* priceDepositLabel = new QLabel(tr("Deposit:"), price); _priceDeposit = new MoneyEdit(price); _priceDeposit->setFocusPolicy(NoFocus); priceDepositLabel->setBuddy(_priceDeposit); QLabel* priceBaseLabel = new QLabel(tr("Base:"), price); _priceBase = new MoneyEdit(price); priceBaseLabel->setBuddy(_priceBase); priceGrid->setColStretch(2, 1); priceGrid->addWidget(priceSizeLabel, 1, 0); priceGrid->addWidget(_priceSize, 1, 1, AlignLeft | AlignVCenter); priceGrid->addWidget(priceLabel, 2, 0); priceGrid->addWidget(_price, 2, 1, AlignLeft | AlignVCenter); priceGrid->addWidget(priceTaxLabel, 3, 0); priceGrid->addWidget(_priceTax, 3, 1, AlignLeft | AlignVCenter); priceGrid->addWidget(priceDepositLabel, 4, 0); priceGrid->addWidget(_priceDeposit, 4, 1, AlignLeft | AlignVCenter); priceGrid->addWidget(priceBaseLabel, 5, 0); priceGrid->addWidget(_priceBase, 5, 1, AlignLeft | AlignVCenter); QGroupBox* cost = new QGroupBox(tr("Rep Cost"), frame); QGridLayout* costGrid = new QGridLayout(cost,2,1,cost->frameWidth()*2); costGrid->addRowSpacing(0, cost->fontMetrics().height()); QLabel* costSizeLabel = new QLabel(tr("Size:"), cost); _costSize = new ComboBox(cost); costSizeLabel->setBuddy(_costSize); QLabel* costLabel = new QLabel(tr("Cost:"), cost); _cost = new PriceEdit(cost); costLabel->setBuddy(_cost); QLabel* costTaxLabel = new QLabel(tr("Tax:"), cost); _costTax = new MoneyEdit(cost); _costTax->setFocusPolicy(NoFocus); costTaxLabel->setBuddy(_costTax); QLabel* costDepositLabel = new QLabel(tr("Deposit:"), cost); _costDeposit = new MoneyEdit(cost); _costDeposit->setFocusPolicy(NoFocus); costDepositLabel->setBuddy(_costDeposit); QLabel* costBaseLabel = new QLabel(tr("Base:"), cost); _costBase = new MoneyEdit(cost); costBaseLabel->setBuddy(_costBase); costGrid->setColStretch(2, 1); costGrid->addWidget(costSizeLabel, 1, 0); costGrid->addWidget(_costSize, 1, 1, AlignLeft | AlignVCenter); costGrid->addWidget(costLabel, 2, 0); costGrid->addWidget(_cost, 2, 1, AlignLeft | AlignVCenter); costGrid->addWidget(costTaxLabel, 3, 0); costGrid->addWidget(_costTax, 3, 1, AlignLeft | AlignVCenter); costGrid->addWidget(costDepositLabel, 4, 0); costGrid->addWidget(_costDeposit, 4, 1, AlignLeft | AlignVCenter); costGrid->addWidget(costBaseLabel, 5, 0); costGrid->addWidget(_costBase, 5, 1, AlignLeft | AlignVCenter); QGroupBox* margin = new QGroupBox(tr("Margin"), frame); QGridLayout* marginGrid = new QGridLayout(margin, 2, 1, margin->frameWidth()*2); marginGrid->addRowSpacing(0, margin->fontMetrics().height()); QLabel* marginSizeLabel = new QLabel(tr("Size:"), margin); _marginSize = new ComboBox(margin); marginSizeLabel->setBuddy(_marginSize); QLabel* marginPriceLabel = new QLabel(tr("Price:"), margin); _marginPrice = new MoneyEdit(margin); marginPriceLabel->setBuddy(_marginPrice); QLabel* targetLabel = new QLabel(tr("Target GM:"), margin); _targetGM = new PercentEdit(margin); _targetGM->setFocusPolicy(NoFocus); targetLabel->setBuddy(_targetGM); QLabel* repCostLabel = new QLabel(tr("Rep Cost:"), margin); _repCost = new MoneyEdit(margin); repCostLabel->setBuddy(_repCost); QLabel* repProfitLabel = new QLabel(tr("Rep Profit:"), margin); _repProfit = new MoneyEdit(margin); repProfitLabel->setBuddy(_repProfit); QLabel* repMarginLabel = new QLabel(tr("Rep Margin:"), margin); _repMargin = new PercentEdit(margin); repMarginLabel->setBuddy(_repMargin); QLabel* lastCostLabel = new QLabel(tr("Last Cost:"), margin); _lastCost = new MoneyEdit(margin); _lastCost->setFocusPolicy(NoFocus); lastCostLabel->setBuddy(_lastCost); QLabel* lastProfitLabel = new QLabel(tr("Last Profit:"), margin); _lastProfit = new MoneyEdit(margin); lastProfitLabel->setBuddy(_lastProfit); QLabel* lastMarginLabel = new QLabel(tr("Last Margin:"), margin); _lastMargin = new PercentEdit(margin); lastMarginLabel->setBuddy(_lastMargin); QLabel* avgCostLabel = new QLabel(tr("Avg Cost:"), margin); _avgCost = new MoneyEdit(margin); _avgCost->setFocusPolicy(NoFocus); avgCostLabel->setBuddy(_avgCost); QLabel* avgProfitLabel = new QLabel(tr("Avg Profit:"), margin); _avgProfit = new MoneyEdit(margin); avgProfitLabel->setBuddy(_avgProfit); QLabel* avgMarginLabel = new QLabel(tr("Avg Margin:"), margin); _avgMargin = new PercentEdit(margin); avgMarginLabel->setBuddy(_avgMargin); marginGrid->setColStretch(2, 1); marginGrid->setColStretch(5, 1); marginGrid->addColSpacing(2, 10); marginGrid->addColSpacing(5, 10); marginGrid->addWidget(marginSizeLabel, 1, 0); marginGrid->addWidget(_marginSize, 1, 1, AlignLeft | AlignVCenter); marginGrid->addWidget(marginPriceLabel, 1, 3); marginGrid->addWidget(_marginPrice, 1, 4, AlignLeft | AlignVCenter); marginGrid->addWidget(targetLabel, 1, 6); marginGrid->addWidget(_targetGM, 1, 7, AlignLeft | AlignVCenter); marginGrid->addWidget(repCostLabel, 2, 0); marginGrid->addWidget(_repCost, 2, 1, AlignLeft | AlignVCenter); marginGrid->addWidget(repProfitLabel, 2, 3); marginGrid->addWidget(_repProfit, 2, 4, AlignLeft | AlignVCenter); marginGrid->addWidget(repMarginLabel, 2, 6); marginGrid->addWidget(_repMargin, 2, 7, AlignLeft | AlignVCenter); marginGrid->addWidget(lastCostLabel, 3, 0); marginGrid->addWidget(_lastCost, 3, 1, AlignLeft | AlignVCenter); marginGrid->addWidget(lastProfitLabel, 3, 3); marginGrid->addWidget(_lastProfit, 3, 4, AlignLeft | AlignVCenter); marginGrid->addWidget(lastMarginLabel, 3, 6); marginGrid->addWidget(_lastMargin, 3, 7, AlignLeft | AlignVCenter); marginGrid->addWidget(avgCostLabel, 4, 0); marginGrid->addWidget(_avgCost, 4, 1, AlignLeft | AlignVCenter); marginGrid->addWidget(avgProfitLabel, 4, 3); marginGrid->addWidget(_avgProfit, 4, 4, AlignLeft | AlignVCenter); marginGrid->addWidget(avgMarginLabel, 4, 6); marginGrid->addWidget(_avgMargin, 4, 7, AlignLeft | AlignVCenter); QFrame* box = new QFrame(frame); QPushButton* refresh = new QPushButton(tr("&Refresh"), box); refresh->setMinimumSize(refresh->sizeHint()); connect(refresh, SIGNAL(clicked()), SLOT(slotRefresh())); QPushButton* save = new QPushButton(tr("&Save"), box); save->setMinimumSize(refresh->sizeHint()); connect(save, SIGNAL(clicked()), SLOT(slotSave())); QPushButton* close = new QPushButton(tr("Cl&ose"), box); close->setMinimumSize(refresh->sizeHint()); connect(close, SIGNAL(clicked()), SLOT(slotClose())); QGridLayout* boxGrid = new QGridLayout(box); boxGrid->setSpacing(6); boxGrid->setMargin(6); boxGrid->setColStretch(1, 1); boxGrid->addWidget(refresh, 0, 0, AlignLeft | AlignVCenter); boxGrid->addWidget(save, 0, 1, AlignRight | AlignVCenter); boxGrid->addWidget(close, 0, 2, AlignRight | AlignVCenter); QGridLayout* grid = new QGridLayout(frame); grid->setSpacing(6); grid->setMargin(6); grid->addMultiCellWidget(top, 0, 0, 0, 1); grid->addWidget(price, 1, 0); grid->addWidget(cost, 1, 1); grid->addMultiCellWidget(margin, 2, 2, 0, 1); grid->addMultiCellWidget(box, 3, 3, 0, 1); connect(_item, SIGNAL(validData()), SLOT(slotItemChanged())); connect(_store, SIGNAL(validData()), SLOT(slotStoreChanged())); connect(_priceSize, SIGNAL(activated(int)), SLOT(slotPriceSizeChanged())); connect(_price, SIGNAL(validData()), SLOT(slotPriceChanged())); connect(_priceBase, SIGNAL(validData()), SLOT(slotPriceBaseChanged())); connect(_costSize, SIGNAL(activated(int)), SLOT(slotCostSizeChanged())); connect(_cost, SIGNAL(validData()), SLOT(slotCostChanged())); connect(_costBase, SIGNAL(validData()), SLOT(slotCostBaseChanged())); connect(_marginSize, SIGNAL(activated(int)),SLOT(slotMarginSizeChanged())); connect(_marginPrice, SIGNAL(validData()), SLOT(slotMarginPriceChanged())); connect(_repCost, SIGNAL(validData()), SLOT(slotRepCostChanged())); connect(_repProfit, SIGNAL(validData()), SLOT(slotRepProfitChanged())); connect(_repMargin, SIGNAL(validData()), SLOT(slotRepMarginChanged())); connect(_lastProfit, SIGNAL(validData()), SLOT(slotLastProfitChanged())); connect(_lastMargin, SIGNAL(validData()), SLOT(slotLastMarginChanged())); connect(_avgProfit, SIGNAL(validData()), SLOT(slotAvgProfitChanged())); connect(_avgMargin, SIGNAL(validData()), SLOT(slotAvgMarginChanged())); setStoreId(_quasar->defaultStore()); _item->setFocus(); setCentralWidget(frame); setCaption(tr("Item Margin")); finalize(); }