Example #1
0
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();
}
Example #2
0
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();
}
Example #3
0
TxSummary::TxSummary(MainWindow* main)
    : QuasarWindow(main, "TxSummary")
{
    _helpSource = "tx_summary.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());

    QLabel* rangeLabel = new QLabel(tr("Date Range:"), select);
    _range = new DateRange(select);

    QLabel* fromLabel = new QLabel(tr("From Date:"), select);
    _from = new DatePopup(select);
    _range->setFromPopup(_from);
    fromLabel->setBuddy(_from);

    QLabel* toLabel = new QLabel(tr("To Date:"), select);
    _to = new DatePopup(select);
    _range->setToPopup(_to);
    toLabel->setBuddy(_to);

    QLabel* storeLabel = new QLabel(tr("Store:"), select);
    _store = new LookupEdit(new StoreLookup(main, this), select);
    _store->setLength(30);
    storeLabel->setBuddy(_store);

    QLabel* stationLabel = new QLabel(tr("Station:"), select);
    _station = new LookupEdit(new StationLookup(main, this), select);
    _station->setLength(30);
    stationLabel->setBuddy(_station);

    QLabel* employeeLabel = new QLabel(tr("Employee:"), select);
    _employee = new LookupEdit(new EmployeeLookup(main, this), select);
    _employee->setLength(30);
    employeeLabel->setBuddy(_employee);

    grid1->setColStretch(2, 1);
    grid1->addColSpacing(2, 20);
    grid1->addWidget(rangeLabel, 1, 0);
    grid1->addWidget(_range, 1, 1, AlignLeft | AlignVCenter);
    grid1->addWidget(fromLabel, 2, 0);
    grid1->addWidget(_from, 2, 1, AlignLeft | AlignVCenter);
    grid1->addWidget(toLabel, 3, 0);
    grid1->addWidget(_to, 3, 1, AlignLeft | AlignVCenter);
    grid1->addWidget(storeLabel, 1, 3);
    grid1->addWidget(_store, 1, 4, AlignLeft | AlignVCenter);
    grid1->addWidget(stationLabel, 2, 3);
    grid1->addWidget(_station, 2, 4, AlignLeft | AlignVCenter);
    grid1->addWidget(employeeLabel, 3, 3);
    grid1->addWidget(_employee, 3, 4, AlignLeft | AlignVCenter);

    _tabs = new QTabWidget(frame);

    QFrame* buttons = new QFrame(frame);
    QPushButton* refresh = new QPushButton(tr("&Refresh"), buttons);
    connect(refresh, SIGNAL(clicked()), SLOT(slotRefresh()));
    refresh->setMinimumSize(refresh->sizeHint());

    QPushButton* print = new QPushButton(tr("&Print"), buttons);
    connect(print, SIGNAL(clicked()), SLOT(slotPrint()));
    print->setMinimumSize(refresh->sizeHint());

    QPushButton* ok = new QPushButton(tr("&Close"), buttons);
    connect(ok, SIGNAL(clicked()), SLOT(close()));
    ok->setMinimumSize(refresh->sizeHint());

    QGridLayout* buttonGrid = new QGridLayout(buttons);
    buttonGrid->setSpacing(6);
    buttonGrid->setMargin(3);
    buttonGrid->setColStretch(2, 1);
    buttonGrid->addWidget(refresh, 0, 0, AlignLeft | AlignVCenter);
    buttonGrid->addWidget(print, 0, 1, AlignLeft | AlignVCenter);
    buttonGrid->addWidget(ok, 0, 2, AlignRight | AlignVCenter);

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(6);
    grid->setMargin(3);
    grid->setRowStretch(1, 1);
    grid->setColStretch(0, 1);
    grid->addWidget(select, 0, 0);
    grid->addWidget(_tabs, 1, 0);
    grid->addWidget(buttons, 2, 0);

    _range->setFocus();
    _range->setCurrentItem(DateRange::Today);
    _tabs->hide();

    TenderSelect conditions;
    _quasar->db()->select(_tenders, conditions);
    for (unsigned int i = 0; i < _tenders.size(); ++i)
	_tenderCnts.push_back(0);

    setCentralWidget(frame);
    setCaption(tr("Daily Summary"));
    finalize();
}
Example #4
0
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();
}
Example #5
0
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();
}
Example #6
0
SubdeptMaster::SubdeptMaster(MainWindow* main, Id subdept_id)
    : DataWindow(main, "SubdeptMaster", subdept_id)
{
    _helpSource = "subdept_master.html";

    // Create widgets
    QLabel* nameLabel = new QLabel(tr("&Name:"), _frame);
    _name = new LineEdit(30, _frame);
    nameLabel->setBuddy(_name);

    QLabel* numberLabel = new QLabel(tr("Number:"), _frame);
    _number = new LineEdit(5, _frame);
    numberLabel->setBuddy(_number);

    QLabel* deptLabel = new QLabel(tr("&Department:"), _frame);
    _dept = new LookupEdit(new DeptLookup(main, this), _frame);
    _dept->setLength(30);
    deptLabel->setBuddy(_dept);

    QGroupBox* flags = new QGroupBox(tr("Type"), _frame);
    QGridLayout* f_grid = new QGridLayout(flags, 2, 2,
					  flags->frameWidth() * 2);
    f_grid->addRowSpacing(0, flags->fontMetrics().height());

    _purchased = new QCheckBox(tr("Purchased?"), flags);
    _sold = new QCheckBox(tr("Sold?"), flags);
    _inventoried = new QCheckBox(tr("Inventoried?"), flags);

    _expenseLabel = new QLabel(tr("COGS Account:"), flags);
    _expenseLookup = new AccountLookup(main, this, Account::COGS);
    _expense_acct = new LookupEdit(_expenseLookup, flags);
    _expense_acct->setLength(30);
    _expenseLabel->setBuddy(_expense_acct);

    QLabel* incomeLabel = new QLabel(tr("Income Account:"), flags);
    AccountLookup* il = new AccountLookup(main, this, Account::Income);
    _income_acct = new LookupEdit(il, flags);
    _income_acct->setLength(30);
    incomeLabel->setBuddy(_income_acct);

    QLabel* assetLabel = new QLabel(tr("Asset Account:"), flags);
    AccountLookup* al = new AccountLookup(main, this, Account::Inventory);
    _asset_acct = new LookupEdit(al, flags);
    _asset_acct->setLength(30);
    assetLabel->setBuddy(_asset_acct);

    connect(_purchased, SIGNAL(toggled(bool)), SLOT(flagsChanged()));
    connect(_sold, SIGNAL(toggled(bool)), SLOT(flagsChanged()));
    connect(_inventoried, SIGNAL(toggled(bool)), SLOT(flagsChanged()));

    f_grid->setColStretch(1, 1);
    f_grid->addWidget(_purchased, 1, 0, AlignLeft | AlignVCenter);
    f_grid->addWidget(_sold, 2, 0, AlignLeft | AlignVCenter);
    f_grid->addWidget(_inventoried, 3, 0, AlignLeft | AlignVCenter);
    f_grid->addWidget(_expenseLabel, 1, 1, AlignRight | AlignVCenter);
    f_grid->addWidget(_expense_acct, 1, 2, AlignLeft | AlignVCenter);
    f_grid->addWidget(incomeLabel, 2, 1, AlignRight | AlignVCenter);
    f_grid->addWidget(_income_acct, 2, 2, AlignLeft | AlignVCenter);
    f_grid->addWidget(assetLabel, 3, 1, AlignRight | AlignVCenter);
    f_grid->addWidget(_asset_acct, 3, 2, AlignLeft | AlignVCenter);

    QHBox* box = new QHBox(_frame);
    box->setSpacing(3);

    QGroupBox* purchase = new QGroupBox(tr("Purchase Information"), box);
    QGridLayout* p_grid = new QGridLayout(purchase, 2, 2,
					  purchase->frameWidth() * 2);
    p_grid->addRowSpacing(0, purchase->fontMetrics().height());

    QLabel* purchLabel = new QLabel(tr("Purchase Tax:"), purchase);
    _purch_tax = new LookupEdit(new TaxLookup(main, this), purchase);
    _purch_tax->setLength(6);
    purchLabel->setBuddy(_purch_tax);

    p_grid->setColStretch(1, 1);
    p_grid->setRowStretch(3, 1);
    p_grid->addWidget(purchLabel, 1, 0, AlignLeft | AlignVCenter);
    p_grid->addWidget(_purch_tax, 1, 1, AlignLeft | AlignVCenter);

    QGroupBox* sales = new QGroupBox(tr("Sales Information"), box);
    QGridLayout* s_grid = new QGridLayout(sales, 2, 2,
					  sales->frameWidth() * 2);
    s_grid->addRowSpacing(0, sales->fontMetrics().height());

    QLabel* targetLabel = new QLabel(tr("Target GM:"), sales);
    _target_gm = new PercentEdit(sales);
    _target_gm->setLength(10);
    targetLabel->setBuddy(_target_gm);

    QLabel* allowLabel = new QLabel(tr("Variance:"), sales);
    _allowed_var = new PercentEdit(sales);
    _allowed_var->setLength(10);
    allowLabel->setBuddy(_allowed_var);

    QLabel* sellLabel = new QLabel(tr("Selling Tax:"), sales);
    _sell_tax = new LookupEdit(new TaxLookup(main, this), sales);
    _sell_tax->setLength(6);
    sellLabel->setBuddy(_sell_tax);

    _discountable = new QCheckBox(tr("Discountable?"), sales);

    s_grid->setRowStretch(3, 1);
    s_grid->setColStretch(1, 1);
    s_grid->addWidget(targetLabel, 1, 0, AlignLeft | AlignVCenter);
    s_grid->addWidget(_target_gm, 1, 1, AlignLeft | AlignVCenter);
    s_grid->addWidget(allowLabel, 1, 2, AlignLeft | AlignVCenter);
    s_grid->addWidget(_allowed_var, 1, 3, AlignLeft | AlignVCenter);
    s_grid->addWidget(sellLabel, 2, 0, AlignLeft | AlignVCenter);
    s_grid->addWidget(_sell_tax, 2, 1, AlignLeft | AlignVCenter);
    s_grid->addMultiCellWidget(_discountable, 2, 2, 2, 3,
			       AlignLeft | AlignVCenter);

    QGridLayout* grid = new QGridLayout(_frame);
    grid->setMargin(3);
    grid->setSpacing(3);
    grid->setColStretch(2, 1);
    grid->addWidget(nameLabel, 0, 0);
    grid->addWidget(_name, 0, 1, AlignLeft | AlignVCenter);
    grid->addWidget(numberLabel, 0, 3);
    grid->addWidget(_number, 0, 4, AlignLeft | AlignVCenter);
    grid->addWidget(deptLabel, 1, 0);
    grid->addWidget(_dept, 1, 1, AlignLeft | AlignVCenter);
    grid->addMultiCellWidget(flags, 2, 2, 0, 4);
    grid->addMultiCellWidget(box, 3, 3, 0, 4);

    setCaption(tr("Subdepartment Master"));
    finalize();
}
Example #7
0
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();
}
Example #8
0
AccountMaster::AccountMaster(MainWindow* main, Id account_id)
    : DataWindow(main, "AccountMaster", account_id)
{
    _helpSource = "account_master.html";

    // Create widgets
    QLabel* nameLabel = new QLabel(tr("&Name:"), _frame);
    _name = new LineEdit(_frame);
    _name->setLength(30);
    nameLabel->setBuddy(_name);

    QLabel* numberLabel = new QLabel(tr("N&umber:"), _frame);
    _number = new LineEdit(_frame);
    _number->setLength(12);
    numberLabel->setBuddy(_number);

    QLabel* typeLabel = new QLabel(tr("&Type:"), _frame);
    _type = new QComboBox(false, _frame);
    typeLabel->setBuddy(_type);
    connect(_type, SIGNAL(activated(int)), SLOT(typeChanged(int)));

    for (int type = Account::Bank; type <= Account::OtherExpense; ++type) {
	_type->insertItem(Account::typeName(Account::Type(type)));
    }
    _type->setMinimumSize(_type->sizeHint());
    _type->setMaximumSize(_type->sizeHint());

    QLabel* parentLabel = new QLabel(tr("&Parent:"), _frame);
    _parentLookup = new AccountLookup(main, this, -1, true, false);
    _parent = new LookupEdit(_parentLookup, _frame);
    parentLabel->setBuddy(_parent);

    QFrame* boxes = new QFrame(_frame);

    _header = new QCheckBox(tr("Header Account?"), boxes);

    QLabel* nextNumLabel = new QLabel(tr("Next Cheque #:"), boxes);
    _nextNum = new IntegerEdit(boxes);
    _nextNum->setLength(6);

    QLabel* lastReconLabel = new QLabel(tr("Last Reconciled:"), boxes);
    _lastRecon = new DateEdit(boxes);
    _lastRecon->setEnabled(false);

    QGroupBox* groups = new QGroupBox(tr("Groups"), boxes);
    QGridLayout* g_grid = new QGridLayout(groups, 2, 1,groups->frameWidth()*2);
    g_grid->addRowSpacing(0, groups->fontMetrics().height());

    _groups = new Table(groups);
    _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::ACCOUNT);
    new LookupColumn(_groups, tr("Group Name"), 15, groupLookup);
    new LookupEditor(_groups, 0, new LookupEdit(groupLookup, _groups));

    g_grid->addWidget(_groups, 1, 0);

    QGridLayout* grid1 = new QGridLayout(boxes);
    grid1->setSpacing(3);
    grid1->setMargin(3);
    grid1->setRowStretch(2, 1);
    grid1->setColStretch(1, 1);
    grid1->addWidget(_header, 0, 0);
    grid1->addWidget(nextNumLabel, 1, 0, AlignLeft | AlignVCenter);
    grid1->addWidget(_nextNum, 1, 1, AlignLeft | AlignVCenter);
    grid1->addWidget(lastReconLabel, 3, 0, AlignLeft | AlignVCenter);
    grid1->addWidget(_lastRecon, 3, 1, AlignLeft | AlignVCenter);
    grid1->addMultiCellWidget(groups, 0, 3, 2, 2);

    QGridLayout *grid = new QGridLayout(_frame);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->addWidget(nameLabel, 0, 0);
    grid->addWidget(_name, 0, 1);
    grid->addWidget(numberLabel, 0, 2);
    grid->addWidget(_number, 0, 3, AlignLeft | AlignVCenter);
    grid->addWidget(typeLabel, 1, 0);
    grid->addWidget(_type, 1, 1, AlignLeft | AlignVCenter);
    grid->addWidget(parentLabel, 1, 2);
    grid->addWidget(_parent, 1, 3);
    grid->addMultiCellWidget(boxes, 2, 2, 0, 3);

    setCaption(tr("Account Master"));
    finalize();
}