void project::sDeleteTask() { q.prepare("DELETE FROM prjtask" " WHERE (prjtask_id=:prjtask_id); "); q.bindValue(":prjtask_id", _prjtask->id()); q.exec(); sFillTaskList(); }
void project::sEditTask() { ParameterList params; params.append("mode", "edit"); params.append("prjtask_id", _prjtask->id()); task newdlg(this, "", TRUE); newdlg.set(params); if (newdlg.exec() != XDialog::Rejected) sFillTaskList(); }
void project::sNewTask() { ParameterList params; params.append("mode", "new"); params.append("prj_id", _prjid); params.append("prj_owner_username", _owner->username()); params.append("prj_usr_id", _assignedTo->id()); params.append("prj_start_date", _started->date()); params.append("prj_due_date", _due->date()); params.append("prj_assigned_date", _assigned->date()); params.append("prj_completed_date", _completed->date()); task newdlg(this, "", TRUE); newdlg.set(params); if (newdlg.exec() != XDialog::Rejected) sFillTaskList(); }
void project::populate() { q.prepare( "SELECT prj_number, prj_name, prj_descrip," " prj_so, prj_wo, prj_po, prj_status, " " prj_owner_username, prj_username, prj_start_date, " " prj_assigned_date, prj_due_date, prj_completed_date," " prj_recurring_prj_id " "FROM prj " "WHERE (prj_id=:prj_id);" ); q.bindValue(":prj_id", _prjid); q.exec(); if (q.first()) { _saved = true; _owner->setUsername(q.value("prj_owner_username").toString()); _number->setText(q.value("prj_number").toString()); _name->setText(q.value("prj_name").toString()); _descrip->setText(q.value("prj_descrip").toString()); _so->setChecked(q.value("prj_so").toBool()); _wo->setChecked(q.value("prj_wo").toBool()); _po->setChecked(q.value("prj_po").toBool()); _assignedTo->setUsername(q.value("prj_username").toString()); _started->setDate(q.value("prj_start_date").toDate()); _assigned->setDate(q.value("prj_assigned_date").toDate()); _due->setDate(q.value("prj_due_date").toDate()); _completed->setDate(q.value("prj_completed_date").toDate()); QString status = q.value("prj_status").toString(); _recurring->setParent(q.value("prj_recurring_prj_id").isNull() ? _prjid : q.value("prj_recurring_prj_id").toInt(), "J"); if("P" == status) _status->setCurrentIndex(0); else if("O" == status) _status->setCurrentIndex(1); else if("C" == status) _status->setCurrentIndex(2); } sFillTaskList(); _comments->setId(_prjid); _documents->setId(_prjid); emit populated(_prjid); }
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(); }
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); }