Пример #1
0
dspCustomerInformation::dspCustomerInformation(QWidget* parent, Qt::WFlags fl)
    : QWidget(parent, fl)
{
  setupUi(this);

  connect(_arhist, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*)), this, SLOT(sPopulateMenuArhist(QMenu*)));
  connect(_close, SIGNAL(clicked()), this, SLOT(close()));
  connect(_creditMemo, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*)), this, SLOT(sPopulateMenuCreditMemo(QMenu*)));
  connect(_cust, SIGNAL(newId(int)), this, SLOT(sPopulate(int)));
  connect(_custList, SIGNAL(clicked()), _cust, SLOT(sEllipses()));
  connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_editCreditMemo, SIGNAL(clicked()), this, SLOT(sEditCreditMemo()));
  connect(_editInvoice, SIGNAL(clicked()), this, SLOT(sEditInvoice()));
  connect(_editOrder, SIGNAL(clicked()), this, SLOT(sEditOrder()));
  connect(_editQuote, SIGNAL(clicked()), this, SLOT(sEditQuote()));
  connect(_invoice, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*)), this, SLOT(sPopulateMenuInvoice(QMenu*)));
  connect(_newCreditMemo, SIGNAL(clicked()), this, SLOT(sNewCreditMemo()));
  connect(_newInvoice, SIGNAL(clicked()), this, SLOT(sNewInvoice()));
  connect(_newOrder, SIGNAL(clicked()), this, SLOT(sNewOrder()));
  connect(_newQuote, SIGNAL(clicked()), this, SLOT(sNewQuote()));
  connect(_order, SIGNAL(valid(bool)), _viewOrder, SLOT(setEnabled(bool)));
  connect(_order, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*)), this, SLOT(sPopulateMenuSalesOrder(QMenu*)));
  connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
  connect(_quote, SIGNAL(valid(bool)), _viewQuote, SLOT(setEnabled(bool)));
  connect(_quote, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*)), this, SLOT(sPopulateMenuQuote(QMenu*)));
  connect(_viewCreditMemo, SIGNAL(clicked()), this, SLOT(sViewCreditMemo()));
  connect(_viewInvoice, SIGNAL(clicked()), this, SLOT(sViewInvoice()));
  connect(_viewOrder, SIGNAL(clicked()), this, SLOT(sViewOrder()));
  connect(_viewQuote, SIGNAL(clicked()), this, SLOT(sViewQuote()));
  connect(_convertQuote, SIGNAL(clicked()), this, SLOT(sConvertQuote()));

#ifndef Q_WS_MAC
  _custList->setMaximumWidth(25);
#endif

  // setup arhist list
  _arhist->addColumn(tr("Open"),      _orderColumn, Qt::AlignCenter );
  _arhist->addColumn(tr("Doc. Type"), _dateColumn,  Qt::AlignCenter );
  _arhist->addColumn(tr("Doc. #"),    _orderColumn, Qt::AlignRight  );
  _arhist->addColumn(tr("Doc. Date"), _dateColumn,  Qt::AlignCenter );
  _arhist->addColumn(tr("Due. Date"), _dateColumn,  Qt::AlignCenter );
  _arhist->addColumn(tr("Amount"),    _moneyColumn, Qt::AlignRight  );
  _arhist->addColumn(tr("Balance"),   _moneyColumn, Qt::AlignRight  );
  _arhist->addColumn(tr("Currency"),  _currencyColumn, Qt::AlignLeft);

  // setup Quote list
  _quote->addColumn(tr("Quote #"),    _orderColumn, Qt::AlignRight  );
  _quote->addColumn(tr("P/O Number"), _itemColumn,  Qt::AlignLeft   );
  _quote->addColumn(tr("Quote Date"), _dateColumn,  Qt::AlignCenter );
  if(_privleges->check("MaintainQuotes"))
  {
    connect(_quote, SIGNAL(valid(bool)), _editQuote, SLOT(setEnabled(bool)));
    connect(_quote, SIGNAL(itemSelected(int)), _editQuote, SLOT(animateClick()));
  }
  else
  {
    _newQuote->setEnabled(false);
    connect(_quote, SIGNAL(itemSelected(int)), _viewQuote, SLOT(animateClick()));
  }
  if (_privleges->check("ConvertQuotes"))
    connect(_quote, SIGNAL(valid(bool)), _convertQuote, SLOT(setEnabled(bool)));
  connect(omfgThis, SIGNAL(quotesUpdated(int, bool)), this, SLOT(sFillQuoteList()));

  // setup Order list
  _order->addColumn(tr("S/O #"),            _orderColumn, Qt::AlignLeft   );
  _order->addColumn(tr("Cust. P/O Number"), _itemColumn,  Qt::AlignLeft   );
  _order->addColumn(tr("Ordered"),          _dateColumn,  Qt::AlignCenter );
  _order->addColumn(tr("Scheduled"),        _dateColumn,  Qt::AlignCenter );
  if(_privleges->check("MaintainSalesOrders"))
  {
    connect(_order, SIGNAL(valid(bool)), _editOrder, SLOT(setEnabled(bool)));
    connect(_order, SIGNAL(itemSelected(int)), _editOrder, SLOT(animateClick()));
  }
  else
  {
    _newOrder->setEnabled(false);
    connect(_order, SIGNAL(itemSelected(int)), _viewOrder, SLOT(animateClick()));
  }
  connect(omfgThis, SIGNAL(salesOrdersUpdated(int, bool)), this, SLOT(sFillOrderList()));

  // setup Invoice list
  _invoice->addColumn(tr("Posted"),     _ynColumn,    Qt::AlignCenter );
  _invoice->addColumn(tr("Open"),       _ynColumn,    Qt::AlignCenter );
  _invoice->addColumn(tr("Invoice #"),  _orderColumn, Qt::AlignLeft   );
  _invoice->addColumn(tr("S/O #"),      _orderColumn, Qt::AlignLeft   );
  _invoice->addColumn(tr("Invc. Date"), _dateColumn,  Qt::AlignCenter );
  _invoice->addColumn(tr("Amount"),     _moneyColumn, Qt::AlignRight  );
  _invoice->addColumn(tr("Balance"),    _moneyColumn, Qt::AlignRight  );
  _invoice->addColumn(tr("Currency"),   _currencyColumn, Qt::AlignLeft);
  if(_privleges->check("MaintainMiscInvoices"))
  {
    connect(_invoice, SIGNAL(valid(bool)), _editInvoice, SLOT(setEnabled(bool)));
    connect(_invoice, SIGNAL(itemSelected(int)), _editInvoice, SLOT(animateClick()));
  }
  else
  {
    _newInvoice->setEnabled(false);
    connect(_invoice, SIGNAL(itemSelected(int)), _viewInvoice, SLOT(animateClick()));
  }
  if(_privleges->check("MaintainMiscInvoices") || _privleges->check("ViewMiscInvoices"))
    connect(_invoice, SIGNAL(valid(bool)), _viewInvoice, SLOT(setEnabled(bool)));
  connect(omfgThis, SIGNAL(invoicesUpdated(int, bool)), this, SLOT(sFillInvoiceList()));

  // setup CreditMemo list
  _creditMemo->addColumn(tr("Posted"),    _ynColumn,    Qt::AlignCenter );
  _creditMemo->addColumn(tr("Open"),      _ynColumn,    Qt::AlignCenter );
  _creditMemo->addColumn(tr("Type"),      _ynColumn,    Qt::AlignCenter );
  _creditMemo->addColumn(tr("C/M #"),     _orderColumn, Qt::AlignLeft   );
  _creditMemo->addColumn(tr("Doc. Date"), _dateColumn,  Qt::AlignCenter );
  _creditMemo->addColumn(tr("Amount"),    _moneyColumn, Qt::AlignRight  );
  _creditMemo->addColumn(tr("Balance"),   _moneyColumn, Qt::AlignRight  );
  _creditMemo->addColumn(tr("Currency"),  _currencyColumn, Qt::AlignLeft);
  if(!_privleges->check("MaintainCreditMemos"))
    _newCreditMemo->setEnabled(false);
  connect(_creditMemo, SIGNAL(valid(bool)), this, SLOT(sCreditMemoSelected(bool)));
  connect(_creditMemo, SIGNAL(itemSelected(int)), _viewCreditMemo, SLOT(animateClick()));
  connect(omfgThis, SIGNAL(creditMemosUpdated()), this, SLOT(sFillCreditMemoList()));

  _payments->addColumn(tr("Type"),         _whsColumn,      Qt::AlignLeft  );
  _payments->addColumn(tr("Status"),       _whsColumn,      Qt::AlignLeft  );
  _payments->addColumn(tr("Timestamp"),    _timeDateColumn, Qt::AlignLeft  );
  _payments->addColumn(tr("Entered By"),   _userColumn,     Qt::AlignLeft  );
  _payments->addColumn(tr("Total Amount"), _moneyColumn,    Qt::AlignRight );
  _payments->addColumn(tr("Currency"),     _currencyColumn, Qt::AlignLeft  );
  _payments->addColumn(tr("S/O #"),        _orderColumn,    Qt::AlignLeft  );
  _payments->addColumn(tr("Reference"),    _orderColumn,    Qt::AlignLeft  );
  _payments->addColumn(tr("Allocated"),    _moneyColumn,    Qt::AlignRight );
  _payments->addColumn(tr("Currency"),     _currencyColumn, Qt::AlignLeft  );

  if (omfgThis->singleCurrency())
  {
    _arhist->hideColumn(7);
    _invoice->hideColumn(7);
    _creditMemo->hideColumn(6);
    _payments->hideColumn(5);
    _payments->hideColumn(8);
  }

  _edit->setEnabled(_privleges->check("MaintainCustomerMasters"));
}
Пример #2
0
opportunity::opportunity(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : XDialog(parent, name, modal, fl)
{
  setupUi(this);

  if(!_privileges->check("EditOwner")) _owner->setEnabled(false);

  connect(_crmacct, SIGNAL(newId(int)), this, SLOT(sHandleCrmacct(int)));
  connect(_buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
  connect(_buttonBox, SIGNAL(accepted()), this, SLOT(sSave()));
  connect(_deleteTodoItem, SIGNAL(clicked()), this, SLOT(sDeleteTodoItem()));
  connect(_viewTodoItem, SIGNAL(clicked()), this, SLOT(sViewTodoItem()));
  connect(_editTodoItem, SIGNAL(clicked()), this, SLOT(sEditTodoItem()));
  connect(_newTodoItem, SIGNAL(clicked()), this, SLOT(sNewTodoItem()));
  connect(_todoList, SIGNAL(itemSelected(int)), _editTodoItem, SLOT(animateClick()));
  connect(_todoList, SIGNAL(populateMenu(QMenu*, QTreeWidgetItem*, int)), this, SLOT(sPopulateTodoMenu(QMenu*)));
  connect(_todoList, SIGNAL(valid(bool)), this, SLOT(sHandleTodoPrivs()));
  connect(_deleteSale, SIGNAL(clicked()), this, SLOT(sDeleteSale()));
  connect(_viewSale, SIGNAL(clicked()), this, SLOT(sViewSale()));
  connect(_editSale, SIGNAL(clicked()), this, SLOT(sEditSale()));
  connect(_convertQuote, SIGNAL(clicked()), this, SLOT(sConvertQuote()));
  connect(_printSale, SIGNAL(clicked()), this, SLOT(sPrintSale()));
  connect(_salesList, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*)), this, SLOT(sPopulateSalesMenu(QMenu*)));
  connect(_salesList, SIGNAL(valid(bool)), this, SLOT(sHandleSalesPrivs()));
  connect(omfgThis,	SIGNAL(quotesUpdated(int, bool)), this, SLOT(sFillSalesList()));
  connect(omfgThis,	SIGNAL(salesOrdersUpdated(int, bool)), this, SLOT(sFillSalesList()));
  connect(_charass, SIGNAL(itemSelected(int)), _editCharacteristic, SLOT(animateClick()));
  connect(_newCharacteristic, SIGNAL(clicked()), this, SLOT(sNewCharacteristic()));
  connect(_editCharacteristic, SIGNAL(clicked()), this, SLOT(sEditCharacteristic()));
  connect(_deleteCharacteristic, SIGNAL(clicked()), this, SLOT(sDeleteCharacteristic()));
  connect(_assignedTo, SIGNAL(newId(int)), this, SLOT(sHandleAssigned()));

  _probability->setValidator(0);
  
  _opheadid = -1;
  _custid = -1;
  _prospectid = -1;
  
  _todoList->addColumn(tr("Active"),   _statusColumn, Qt::AlignRight, true, "todoitem_active");
  _todoList->addColumn(tr("Priority"),   _userColumn, Qt::AlignRight, true, "incdtpriority_name");
  _todoList->addColumn(tr("Owner"),      _userColumn, Qt::AlignLeft, false, "todoitem_owner_username");
  _todoList->addColumn(tr("Assigned"),   _userColumn, Qt::AlignLeft,  true, "todoitem_username" );
  _todoList->addColumn(tr("Name"),               100, Qt::AlignLeft,  true, "todoitem_name" );
  _todoList->addColumn(tr("Description"),         -1, Qt::AlignLeft,  true, "todoitem_description" );
  _todoList->addColumn(tr("Status"),   _statusColumn, Qt::AlignLeft,  true, "todoitem_status" );
  _todoList->addColumn(tr("Due Date"),   _dateColumn, Qt::AlignLeft,  true, "todoitem_due_date" );

  _salesList->addColumn(tr("Doc #"),       _orderColumn, Qt::AlignLeft,  true, "sale_number" );
  _salesList->addColumn(tr("Type"),                  -1, Qt::AlignLeft,  true, "sale_type" );
  _salesList->addColumn(tr("Date"),         _dateColumn, Qt::AlignLeft,  true, "sale_date" );
  _salesList->addColumn(tr("Ext. Price"),  _priceColumn, Qt::AlignRight, true, "sale_extprice");

  _charass->addColumn(tr("Characteristic"), _itemColumn, Qt::AlignLeft,  true, "char_name" );
  _charass->addColumn(tr("Value"),          -1,          Qt::AlignLeft,  true, "charass_value" );
  _charass->addColumn(tr("Default"),        _ynColumn,   Qt::AlignCenter,true, "charass_default" );

  _owner->setUsername(omfgThis->username());
  _owner->setType(UsernameLineEdit::UsersActive);

  _assignedTo->setType(UsernameLineEdit::UsersActive);

  _saved = false;
}