예제 #1
0
plannedSchedule::plannedSchedule(QWidget * parent, const char * name, bool modal, Qt::WFlags fl)
    : XDialog(parent, name, modal, fl)
{
    setupUi(this);

    _pschheadid = -1;
    _presaved = false;

    connect(_cancel, SIGNAL(clicked()), this, SLOT(reject()));
    connect(_save, SIGNAL(clicked()), this, SLOT(sSave()));
    connect(_new, SIGNAL(clicked()), this, SLOT(sNew()));
    connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit()));
    connect(_copy, SIGNAL(clicked()), this, SLOT(sCopy()));
    connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete()));
    connect(_number, SIGNAL(lostFocus()), this, SLOT(sNumberChanged()));

    _list->addColumn(tr("#"),           _whsColumn,  Qt::AlignRight,  true,  "pschitem_linenumber"  );
    _list->addColumn(tr("Sched. Date"), _dateColumn, Qt::AlignCenter, true,  "pschitem_scheddate" );
    _list->addColumn(tr("Item Number"), -1,          Qt::AlignLeft,   true,  "item_number"   );
    _list->addColumn(tr("Qty"),         _qtyColumn,  Qt::AlignRight,  true,  "pschitem_qty"  );
    _list->addColumn(tr("Status"),      _whsColumn,  Qt::AlignCenter, true,  "pschitem_status" );

    //If not multi-warehouse hide whs control
    if (!_metrics->boolean("MultiWhs"))
    {
        _warehouseLit->hide();
        _warehouse->hide();
    }

}
예제 #2
0
project::project(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(_close, SIGNAL(clicked()), this, SLOT(sClose()));
  connect(_save, SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_printTasks, SIGNAL(clicked()), this, SLOT(sPrintTasks()));
  connect(_newTask, SIGNAL(clicked()), this, SLOT(sNewTask()));
  connect(_editTask, SIGNAL(clicked()), this, SLOT(sEditTask()));
  connect(_viewTask, SIGNAL(clicked()), this, SLOT(sViewTask()));
  connect(_deleteTask, SIGNAL(clicked()), this, SLOT(sDeleteTask()));
  connect(_number, SIGNAL(lostFocus()), this, SLOT(sNumberChanged()));

  _prjtask->addColumn( tr("Number"),      _itemColumn, Qt::AlignRight, true, "prjtask_number" );
  _prjtask->addColumn( tr("Name"),        _itemColumn, Qt::AlignLeft,  true, "prjtask_name"  );
  _prjtask->addColumn( tr("Description"), -1,          Qt::AlignLeft,  true, "prjtask_descrip" ); 

  _owner->setUsername(omfgThis->username());
  _assignedTo->setUsername(omfgThis->username());
  _owner->setType(UsernameLineEdit::UsersActive);
  _assignedTo->setType(UsernameLineEdit::UsersActive);
  
  _saved=false;

  populate();
}
예제 #3
0
project::project(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(_buttonBox, SIGNAL(rejected()), this, SLOT(sClose()));
  connect(_buttonBox, SIGNAL(accepted()), this, SLOT(sSave()));
  connect(_printTasks, SIGNAL(clicked()), this, SLOT(sPrintTasks()));
  connect(_newTask, SIGNAL(clicked()), this, SLOT(sNewTask()));
  connect(_editTask, SIGNAL(clicked()), this, SLOT(sEditTask()));
  connect(_viewTask, SIGNAL(clicked()), this, SLOT(sViewTask()));
  connect(_deleteTask, SIGNAL(clicked()), this, SLOT(sDeleteTask()));
  connect(_number, SIGNAL(lostFocus()), this, SLOT(sNumberChanged()));
  connect(_activity, SIGNAL(clicked()), this, SLOT(sActivity()));

  _prjtask->addColumn( tr("Number"),			_itemColumn,	Qt::AlignRight, true, "prjtask_number" );
  _prjtask->addColumn( tr("Name"),				_itemColumn,	Qt::AlignLeft,  true, "prjtask_name"  );
  _prjtask->addColumn( tr("Description"),		-1,				Qt::AlignLeft,  true, "prjtask_descrip" ); 
  _prjtask->addColumn( tr("Hours Balance"),		_itemColumn,	Qt::AlignRight, true, "prjtaskhrbal" );
  _prjtask->addColumn( tr("Expense Balance"),	_itemColumn, 	Qt::AlignRight, true, "prjtaskexpbal" );

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

  _totalHrBud->setPrecision(omfgThis->qtyVal());
  _totalHrAct->setPrecision(omfgThis->qtyVal());
  _totalHrBal->setPrecision(omfgThis->qtyVal());
  _totalExpBud->setPrecision(omfgThis->moneyVal());
  _totalExpAct->setPrecision(omfgThis->moneyVal());
  _totalExpBal->setPrecision(omfgThis->moneyVal());
  
  _saved=false;

  populate();
}
예제 #4
0
project::project(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(_close, SIGNAL(clicked()), this, SLOT(sClose()));
  connect(_save, SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_printTasks, SIGNAL(clicked()), this, SLOT(sPrintTasks()));
  connect(_newTask, SIGNAL(clicked()), this, SLOT(sNewTask()));
  connect(_editTask, SIGNAL(clicked()), this, SLOT(sEditTask()));
  connect(_viewTask, SIGNAL(clicked()), this, SLOT(sViewTask()));
  connect(_deleteTask, SIGNAL(clicked()), this, SLOT(sDeleteTask()));
  connect(_number, SIGNAL(lostFocus()), this, SLOT(sNumberChanged()));

  _prjtask->addColumn( tr("Number"),      _itemColumn, Qt::AlignRight, true, "prjtask_number" );
  _prjtask->addColumn( tr("Name"),        _itemColumn, Qt::AlignLeft,  true, "prjtask_name"  );
  _prjtask->addColumn( tr("Description"), -1,          Qt::AlignLeft,  true, "prjtask_descrip" ); 

  q.prepare("SELECT usr_id "
	    "FROM usr "
	    "WHERE (usr_username=CURRENT_USER);");
  q.exec();
  if (q.first())
  {
    _owner->setId(q.value("usr_id").toInt());
    _assignedTo->setId(q.value("usr_id").toInt());
  }  
  else if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    reject();
  }

  populate();
}
예제 #5
0
void plannedSchedule::sSave()
{
    // TODO: Check and rules that need to be enforced here.
    q.prepare("SELECT pschitem_id "
              "  FROM pschitem "
              " WHERE ((pschitem_scheddate NOT BETWEEN :startDate AND :endDate) "
              "   AND  (pschitem_pschhead_id=:pschhead_id)); ");
    q.bindValue(":pschhead_id", _pschheadid);
    q.bindValue(":startDate", _dates->startDate());
    q.bindValue(":endDate", _dates->endDate());
    q.exec();
    if(q.first())
    {
        QMessageBox::warning( this, tr("Scheduled Items Out of Date Range"),
                              tr("One or more of the Scheduled Items is outside the specified date\n"
                                 "range for this Planned Schedule. Please fix this before continuing.") );
        return;
    }

    if (_schedtype->currentIndex() == -1)
    {
        QMessageBox::critical( this, tr("Cannot Save Schedule"),
                               tr( "You must select a schedule type for this Schedule before creating it.\n" ) );
        _schedtype->setFocus();
        return;
    }

    if (!_dates->startDate().isValid())
    {
        QMessageBox::critical( this, tr("Cannot Save Schedule"),
                               tr( "You must enter a Start Date for this Schedule before creating it.\n" ) );
        _dates->setFocus();
        return;
    }

    if (!_dates->endDate().isValid())
    {
        QMessageBox::critical( this, tr("Cannot Save Schedule"),
                               tr( "You must enter an End Date for this Schedule before creating it.\n" ) );
        _dates->setFocus();
        return;
    }

    if (_number->text().length() == 0)
    {
        QMessageBox::critical( this, tr("Cannot Save Schedule"),
                               tr( "You must enter a Schedule Number for this Schedule before creating it.\n" ) );
        _number->setFocus();
        return;
    }

    if(cNew == _mode && _presaved != true)
    {
        q.prepare("INSERT INTO pschhead "
                  "      (pschhead_id, pschhead_number, pschhead_warehous_id,"
                  "       pschhead_descrip,"
                  "       pschhead_start_date, pschhead_end_date, pschhead_type) "
                  "VALUES(:pschhead_id, :number, :warehous_id,"
                  "       :descrip,"
                  "       :startDate, :endDate, :schedtype);");
    }
    else
        q.prepare("UPDATE pschhead "
                  "   SET pschhead_descrip=:descrip,"
                  "       pschhead_start_date=:startDate,"
                  "       pschhead_end_date=:endDate,"
                  "       pschhead_type=:schedtype "
                  " WHERE (pschhead_id=:pschhead_id); ");
    q.bindValue(":pschhead_id", _pschheadid);
    q.bindValue(":number", _number->text().trimmed().toUpper());
    q.bindValue(":descrip", _descrip->text());
    q.bindValue(":warehous_id", _warehouse->id());
    q.bindValue(":startDate", _dates->startDate());
    q.bindValue(":endDate", _dates->endDate());
    if (_schedtype->currentIndex() == 0)
        q.bindValue(":schedtype", "F");
    else if (_schedtype->currentIndex() == 1)
        q.bindValue(":schedtype", "N");
    else if (_schedtype->currentIndex() == 2)
        q.bindValue(":schedtype", "P");

    q.exec();

    disconnect(_number, SIGNAL(lostFocus()), this, SLOT(sNumberChanged()));
    accept();
}
예제 #6
0
project::project(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(_buttonBox,     SIGNAL(rejected()),        this, SLOT(sClose()));
  connect(_buttonBox,     SIGNAL(accepted()),        this, SLOT(sSave()));
  connect(_printTasks,    SIGNAL(clicked()),         this, SLOT(sPrintTasks()));
  connect(_queryTasks,    SIGNAL(clicked()),         this, SLOT(sFillTaskList()));
  connect(_newTask,       SIGNAL(clicked()),         this, SLOT(sNewTask()));
  connect(_editTask,      SIGNAL(clicked()),         this, SLOT(sEditTask()));
  connect(_viewTask,      SIGNAL(clicked()),         this, SLOT(sViewTask()));
  connect(_deleteTask,    SIGNAL(clicked()),         this, SLOT(sDeleteTask()));
  connect(_number,        SIGNAL(editingFinished()), this, SLOT(sNumberChanged()));
  connect(_crmacct,       SIGNAL(newId(int)),        this, SLOT(sCRMAcctChanged(int)));
  connect(_newCharacteristic, SIGNAL(clicked()),     this, SLOT(sNew()));
  connect(_editCharacteristic, SIGNAL(clicked()),    this, SLOT(sEdit()));
  connect(_deleteCharacteristic, SIGNAL(clicked()),  this, SLOT(sDelete()));
  connect(_prjtask, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*, QTreeWidgetItem*)));
  connect(_showSo, SIGNAL(toggled(bool)), this, SLOT(sFillTaskList()));
  connect(_showPo, SIGNAL(toggled(bool)), this, SLOT(sFillTaskList()));
  connect(_showWo, SIGNAL(toggled(bool)), this, SLOT(sFillTaskList()));
  connect(_showIn, SIGNAL(toggled(bool)), this, SLOT(sFillTaskList()));

  _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*2,   Qt::AlignCenter, true, "charass_default" );

  _prjtask->addColumn(tr("Name"),        _itemColumn,  Qt::AlignLeft,   true,  "name"   );
  _prjtask->addColumn(tr("Status"),      _orderColumn, Qt::AlignLeft,   true,  "status"   );
  _prjtask->addColumn(tr("Item #"),      _itemColumn,  Qt::AlignLeft,   true,  "item"   );
  _prjtask->addColumn(tr("Description"), -1          , Qt::AlignLeft,   true,  "descrip" );
  _prjtask->addColumn(tr("Account/Customer"), -1          , Qt::AlignLeft,   false,  "customer" );
  _prjtask->addColumn(tr("Contact"), -1          , Qt::AlignLeft,   false,  "contact" );
  _prjtask->addColumn(tr("City"), -1          , Qt::AlignLeft,   false,  "city" );
  _prjtask->addColumn(tr("State"), -1          , Qt::AlignLeft,   false,  "state" );
  _prjtask->addColumn(tr("Qty"),         _qtyColumn,   Qt::AlignRight,  true,  "qty"  );
  _prjtask->addColumn(tr("UOM"),         _uomColumn,   Qt::AlignLeft,   true,  "uom"  );
  _prjtask->addColumn(tr("Value"),      _qtyColumn,   Qt::AlignRight,  true,  "value"  );
  _prjtask->addColumn(tr("Due Date"),      _dateColumn,   Qt::AlignRight,  true,  "due"  );
  _prjtask->addColumn(tr("Assigned"),      _dateColumn,   Qt::AlignRight,  true,  "assigned"  );
  _prjtask->addColumn(tr("Started"),      _dateColumn,   Qt::AlignRight,  true,  "started"  );
  _prjtask->addColumn(tr("Completed"),      _dateColumn,   Qt::AlignRight,  true,  "completed"  );
  _prjtask->addColumn(tr("Hrs. Budget"),      _qtyColumn,   Qt::AlignRight,  true,  "hrs_budget"  );
  _prjtask->addColumn(tr("Hrs. Actual"),      _qtyColumn,   Qt::AlignRight,  true,  "hrs_actual"  );
  _prjtask->addColumn(tr("Hrs. Balance"),      _qtyColumn,   Qt::AlignRight,  true,  "hrs_balance"  );
  _prjtask->addColumn(tr("Exp. Budget"),      _priceColumn,   Qt::AlignRight,  true,  "exp_budget"  );
  _prjtask->addColumn(tr("Exp. Actual"),      _priceColumn,   Qt::AlignRight,  true,  "exp_actual"  );
  _prjtask->addColumn(tr("Exp. Balance"),      _priceColumn,   Qt::AlignRight,  true,  "exp_balance"  );

  _showSo->setChecked(true);
  _showWo->setChecked(true);
  _showPo->setChecked(true);
  _showIn->setChecked(true);

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

  _totalHrBud->setPrecision(omfgThis->qtyVal());
  _totalHrAct->setPrecision(omfgThis->qtyVal());
  _totalHrBal->setPrecision(omfgThis->qtyVal());
  _totalExpBud->setPrecision(omfgThis->moneyVal());
  _totalExpAct->setPrecision(omfgThis->moneyVal());
  _totalExpBal->setPrecision(omfgThis->moneyVal());
  
  _saved=false;

  QMenu * newMenu = new QMenu;
  QAction *menuItem;
  newMenu->addAction(tr("Task..."), this, SLOT(sNewTask()));
  newMenu->addSeparator();
  menuItem = newMenu->addAction(tr("Quote"), this, SLOT(sNewQuotation()));
  menuItem->setEnabled(_privileges->check("MaintainQuotes"));
  menuItem = newMenu->addAction(tr("Sales Order"), this, SLOT(sNewSalesOrder()));
  menuItem->setEnabled(_privileges->check("MaintainSalesOrders"));
  menuItem = newMenu->addAction(tr("Purchase Order"),   this, SLOT(sNewPurchaseOrder()));
  menuItem->setEnabled(_privileges->check("MaintainPurchaseOrders"));
  menuItem = newMenu->addAction(tr("Work Order"),   this, SLOT(sNewWorkOrder()));
  menuItem->setEnabled(_privileges->check("MaintainWorkOrders"));  _newTask->setMenu(newMenu); 
  _newTask->setMenu(newMenu); 

  populate();
}
예제 #7
0
project::project(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
    : XDialog(parent, name, modal, fl),
      _prjid(-1)
{
  setupUi(this);

  XSqlQuery projectType;
  projectType.prepare("SELECT prjtype_id, prjtype_descr FROM prjtype WHERE prjtype_active;");
  projectType.exec();
  _projectType->populate(projectType);
  if (projectType.lastError().type() != QSqlError::NoError)
  {
    systemError(this, projectType.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

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

  connect(_buttonBox,     SIGNAL(rejected()),        this, SLOT(sClose()));
  connect(_buttonBox,     SIGNAL(accepted()),        this, SLOT(sSave()));
  connect(_queryTasks,    SIGNAL(clicked()),         this, SLOT(sFillTaskList()));
  connect(_newTask,       SIGNAL(clicked()),         this, SLOT(sNewTask()));
  connect(_editTask,      SIGNAL(clicked()),         this, SLOT(sEditTask()));
  connect(_viewTask,      SIGNAL(clicked()),         this, SLOT(sViewTask()));
  connect(_deleteTask,    SIGNAL(clicked()),         this, SLOT(sDeleteTask()));
  connect(_number,        SIGNAL(editingFinished()), this, SLOT(sNumberChanged()));
  connect(_crmacct,       SIGNAL(newId(int)),        this, SLOT(sCRMAcctChanged(int)));
  connect(_prjtask, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*, QTreeWidgetItem*)));
  connect(_showSo, SIGNAL(toggled(bool)), this, SLOT(sFillTaskList()));
  connect(_showPo, SIGNAL(toggled(bool)), this, SLOT(sFillTaskList()));
  connect(_showWo, SIGNAL(toggled(bool)), this, SLOT(sFillTaskList()));
  connect(_showIn, SIGNAL(toggled(bool)), this, SLOT(sFillTaskList()));

  _charass->setType("PROJ");

  _prjtask->addColumn(tr("Name"),        _itemColumn,  Qt::AlignLeft,   true,  "name"   );
  _prjtask->addColumn(tr("Status"),      _orderColumn, Qt::AlignLeft,   true,  "status"   );
  _prjtask->addColumn(tr("Item #"),      _itemColumn,  Qt::AlignLeft,   true,  "item"   );
  _prjtask->addColumn(tr("Description"), -1          , Qt::AlignLeft,   true,  "descrip" );
  _prjtask->addColumn(tr("Account/Customer"), -1          , Qt::AlignLeft,   false,  "customer" );
  _prjtask->addColumn(tr("Contact"), -1          , Qt::AlignLeft,   false,  "contact" );
  _prjtask->addColumn(tr("City"), -1          , Qt::AlignLeft,   false,  "city" );
  _prjtask->addColumn(tr("State"), -1          , Qt::AlignLeft,   false,  "state" );
  _prjtask->addColumn(tr("Qty"),         _qtyColumn,   Qt::AlignRight,  true,  "qty"  );
  _prjtask->addColumn(tr("UOM"),         _uomColumn,   Qt::AlignLeft,   true,  "uom"  );
  _prjtask->addColumn(tr("Value"),      _qtyColumn,   Qt::AlignRight,  true,  "value"  );
  _prjtask->addColumn(tr("Due Date"),      _dateColumn,   Qt::AlignRight,  true,  "due"  );
  _prjtask->addColumn(tr("Assigned"),      _dateColumn,   Qt::AlignRight,  true,  "assigned"  );
  _prjtask->addColumn(tr("Started"),      _dateColumn,   Qt::AlignRight,  true,  "started"  );
  _prjtask->addColumn(tr("Completed"),      _dateColumn,   Qt::AlignRight,  true,  "completed"  );
  _prjtask->addColumn(tr("Hrs. Budget"),      _qtyColumn,   Qt::AlignRight,  true,  "hrs_budget"  );
  _prjtask->addColumn(tr("Hrs. Actual"),      _qtyColumn,   Qt::AlignRight,  true,  "hrs_actual"  );
  _prjtask->addColumn(tr("Hrs. Balance"),      _qtyColumn,   Qt::AlignRight,  true,  "hrs_balance"  );
  _prjtask->addColumn(tr("Exp. Budget"),      _priceColumn,   Qt::AlignRight,  true,  "exp_budget"  );
  _prjtask->addColumn(tr("Exp. Actual"),      _priceColumn,   Qt::AlignRight,  true,  "exp_actual"  );
  _prjtask->addColumn(tr("Exp. Balance"),      _priceColumn,   Qt::AlignRight,  true,  "exp_balance"  );

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

  _totalHrBud->setPrecision(omfgThis->qtyVal());
  _totalHrAct->setPrecision(omfgThis->qtyVal());
  _totalHrBal->setPrecision(omfgThis->qtyVal());
  _totalExpBud->setPrecision(omfgThis->moneyVal());
  _totalExpAct->setPrecision(omfgThis->moneyVal());
  _totalExpBal->setPrecision(omfgThis->moneyVal());
  
  _saved=false;

  QMenu * newMenu = new QMenu;
  QAction *menuItem;
  newMenu->addAction(tr("Task..."), this, SLOT(sNewTask()));
  newMenu->addSeparator();
  menuItem = newMenu->addAction(tr("Incident"), this, SLOT(sNewIncident()));
  menuItem->setEnabled(_privileges->check("MaintainPersonalIncidents") ||
                       _privileges->check("MaintainAllIncidents"));
  menuItem = newMenu->addAction(tr("Quote"), this, SLOT(sNewQuotation()));
  menuItem->setEnabled(_privileges->check("MaintainQuotes"));
  menuItem = newMenu->addAction(tr("Sales Order"), this, SLOT(sNewSalesOrder()));
  menuItem->setEnabled(_privileges->check("MaintainSalesOrders"));
  menuItem = newMenu->addAction(tr("Purchase Order"),   this, SLOT(sNewPurchaseOrder()));
  menuItem->setEnabled(_privileges->check("MaintainPurchaseOrders"));
  menuItem = newMenu->addAction(tr("Work Order"),   this, SLOT(sNewWorkOrder()));
  menuItem->setEnabled(_privileges->check("MaintainWorkOrders"));
  _newTask->setMenu(newMenu); 

  QMenu * printMenu = new QMenu;
  printMenu->addAction(tr("Print Tasks"), this, SLOT(sPrintTasks()));
  printMenu->addAction(tr("Print Orders"), this, SLOT(sPrintOrders()));
  _print->setMenu(printMenu);
}