void incident::sDeleteTodoItem() { XSqlQuery incidentDeleteTodoItem; incidentDeleteTodoItem.prepare("SELECT deleteTodoItem(:todoitem_id) AS result;"); incidentDeleteTodoItem.bindValue(":todoitem_id", _todoList->id()); incidentDeleteTodoItem.exec(); if (incidentDeleteTodoItem.first()) { int result = incidentDeleteTodoItem.value("result").toInt(); if (result < 0) { ErrorReporter::error(QtCriticalMsg, this, tr("Error Deleting To-Do Item"), storedProcErrorLookup("deleteTodoItem", result), __FILE__, __LINE__); return; } else sFillTodoList(); } else if (ErrorReporter::error(QtCriticalMsg, this, tr("Error Deleting To-Do Item"), incidentDeleteTodoItem, __FILE__, __LINE__)) { return; } }
void opportunity::populate() { q.prepare("SELECT ophead_name," " ophead_crmacct_id," " ophead_owner_username," " ophead_opstage_id, ophead_opsource_id," " ophead_optype_id," " ophead_probability_prcnt, ophead_amount," " COALESCE(ophead_curr_id, basecurrid()) AS curr_id," " ophead_target_date, ophead_actual_date," " ophead_notes" " FROM ophead" " WHERE(ophead_id=:ophead_id); "); q.bindValue(":ophead_id", _opheadid); q.exec(); if(q.first()) { _name->setText(q.value("ophead_name").toString()); _crmacct->setId(q.value("ophead_crmacct_id").toInt()); _owner->setUsername(q.value("ophead_owner_username").toString()); _oppstage->setNull(); if(!q.value("ophead_opstage_id").toString().isEmpty()) _oppstage->setId(q.value("ophead_opstage_id").toInt()); _oppsource->setNull(); if(!q.value("ophead_opsource_id").toString().isEmpty()) _oppsource->setId(q.value("ophead_opsource_id").toInt()); _opptype->setNull(); if(!q.value("ophead_optype_id").toString().isEmpty()) _opptype->setId(q.value("ophead_optype_id").toInt()); _probability->clear(); if(!q.value("ophead_probability_prcnt").toString().isEmpty()) _probability->setText(q.value("ophead_probability_prcnt").toDouble()); _amount->clear(); _amount->setId(q.value("curr_id").toInt()); if(!q.value("ophead_amount").toString().isEmpty()) _amount->setLocalValue(q.value("ophead_amount").toDouble()); _targetDate->clear(); if(!q.value("ophead_target_date").toString().isEmpty()) _targetDate->setDate(q.value("ophead_target_date").toDate()); _actualDate->clear(); if(!q.value("ophead_actual_date").toString().isEmpty()) _actualDate->setDate(q.value("ophead_actual_date").toDate()); _notes->setText(q.value("ophead_notes").toString()); _comments->setId(_opheadid); sFillTodoList(); sFillCharList(); } }
void incident::sEditTodoItem() { ParameterList params; params.append("mode", "edit"); params.append("todoitem_id", _todoList->id()); todoItem newdlg(this, 0, true); newdlg.set(params); if (newdlg.exec() != XDialog::Rejected) sFillTodoList(); }
void opportunity::sEditTodoItem() { ParameterList params; params.append("mode", "edit"); params.append("todoitem_id", _todoList->id()); todoItem newdlg(this, 0, true); newdlg.set(params); if (newdlg.exec() == XDialog::Accepted) sFillTodoList(); }
void incident::populate() { q.prepare("SELECT incdt_number," " incdt_crmacct_id," " COALESCE(incdt_cntct_id,-1) AS incdt_cntct_id," " (cntct_first_name || ' ' || cntct_last_name) AS cntct_name," " incdt_summary, incdt_descrip," " incdt_item_id, incdt_ls_id," " incdt_status, incdt_assigned_username," " incdt_incdtcat_id, incdt_incdtseverity_id," " incdt_incdtpriority_id, incdt_incdtresolution_id" " FROM incdt LEFT OUTER JOIN cntct ON (incdt_cntct_id=cntct_id)" " WHERE (incdt_id=:incdt_id); "); q.bindValue(":incdt_id", _incdtid); q.exec(); if(q.first()) { _crmacct->setId(q.value("incdt_crmacct_id").toInt()); _cntct->setId(q.value("incdt_cntct_id").toInt()); _number->setText(q.value("incdt_number").toString()); _assignedTo->setUsername(q.value("incdt_assigned_username").toString()); _category->setNull(); if(!q.value("incdt_incdtcat_id").toString().isEmpty()) _category->setId(q.value("incdt_incdtcat_id").toInt()); _status->setCurrentIndex(_statusCodes.indexOf(q.value("incdt_status").toString())); _severity->setNull(); if(!q.value("incdt_incdtseverity_id").toString().isEmpty()) _severity->setId(q.value("incdt_incdtseverity_id").toInt()); _priority->setNull(); if(!q.value("incdt_incdtpriority_id").toString().isEmpty()) _priority->setId(q.value("incdt_incdtpriority_id").toInt()); _resolution->setNull(); if(!q.value("incdt_incdtresolution_id").toString().isEmpty()) _resolution->setId(q.value("incdt_incdtresolution_id").toInt()); if(!q.value("incdt_item_id").toString().isEmpty()) _item->setId(q.value("incdt_item_id").toInt()); else _item->setId(-1); if(!q.value("incdt_ls_id").toString().isEmpty()) _lotserial->setId(q.value("incdt_ls_id").toInt()); else _lotserial->setId(-1); _description->setText(q.value("incdt_summary").toString()); _notes->setText(q.value("incdt_descrip").toString()); _comments->setId(_incdtid); sFillHistoryList(); sFillTodoList(); } }
void incident::sNewTodoItem() { if (! save(true)) return; ParameterList params; params.append("mode", "new"); params.append("incdt_id", _incdtid); todoItem newdlg(this, 0, true); newdlg.set(params); if (newdlg.exec() == XDialog::Accepted) sFillTodoList(); }
void opportunity::sNewTodoItem() { if (! save(true)) return; ParameterList params; params.append("mode", "new"); params.append("ophead_id", _opheadid); todoItem newdlg(this, 0, true); newdlg.set(params); if (newdlg.exec() == XDialog::Accepted) sFillTodoList(); }
void opportunity::sNewTodoItem() { if (! save(true)) return; ParameterList params; params.append("mode", "new"); params.append("ophead_id", _opheadid); if (_crmacct->isValid()) params.append("crmacct_id", _crmacct->id()); todoItem newdlg(this, 0, true); newdlg.set(params); if (!newdlg.exec() == XDialog::Rejected) sFillTodoList(); }
void incident::sDeleteTodoItem() { q.prepare("SELECT deleteTodoItem(:todoitem_id) AS result;"); q.bindValue(":todoitem_id", _todoList->id()); q.exec(); if (q.first()) { int result = q.value("result").toInt(); if (result < 0) { systemError(this, storedProcErrorLookup("deleteTodoItem", result)); return; } else sFillTodoList(); } else if (q.lastError().type() != QSqlError::None) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return; } }
void incident::populate() { XSqlQuery incidentpopulate; incidentpopulate.prepare("SELECT incdt_number," " incdt_crmacct_id," " COALESCE(incdt_cntct_id,-1) AS incdt_cntct_id," " (cntct_first_name || ' ' || cntct_last_name) AS cntct_name," " incdt_summary, incdt_descrip," " incdt_item_id, incdt_ls_id," " incdt_status, incdt_assigned_username," " incdt_incdtcat_id, incdt_incdtseverity_id," " incdt_incdtpriority_id, incdt_incdtresolution_id," " incdt_owner_username, incdt_recurring_incdt_id," " COALESCE(incdt_aropen_id, -1) AS docId," " COALESCE(aropen_docnumber, '') AS docNumber," " CASE WHEN (aropen_doctype='C') THEN :creditMemo" " WHEN (aropen_doctype='D') THEN :debitMemo" " WHEN (aropen_doctype='I') THEN :invoice" " WHEN (aropen_doctype='R') THEN :cashdeposit" " ELSE ''" " END AS docType, " " COALESCE(incdt_prj_id,-1) AS incdt_prj_id," " COALESCE(incdt_public, false) AS incdt_public," " aropen_doctype " "FROM incdt LEFT OUTER JOIN cntct ON (incdt_cntct_id=cntct_id)" " LEFT OUTER JOIN aropen ON (incdt_aropen_id=aropen_id) " "WHERE (incdt_id=:incdt_id); "); incidentpopulate.bindValue(":incdt_id", _incdtid); incidentpopulate.bindValue(":creditMemo", tr("Credit Memo")); incidentpopulate.bindValue(":debitMemo", tr("Debit Memo")); incidentpopulate.bindValue(":invoice", tr("Invoice")); incidentpopulate.bindValue(":cashdeposit", tr("Customer Deposit")); incidentpopulate.exec(); if(incidentpopulate.first()) { _cntct->setId(incidentpopulate.value("incdt_cntct_id").toInt()); _crmacct->setId(incidentpopulate.value("incdt_crmacct_id").toInt()); _owner->setUsername(incidentpopulate.value("incdt_owner_username").toString()); _number->setText(incidentpopulate.value("incdt_number").toString()); _assignedTo->setUsername(incidentpopulate.value("incdt_assigned_username").toString()); _category->setNull(); if(!incidentpopulate.value("incdt_incdtcat_id").toString().isEmpty()) _category->setId(incidentpopulate.value("incdt_incdtcat_id").toInt()); _status->setCurrentIndex(_statusCodes.indexOf(incidentpopulate.value("incdt_status").toString())); _severity->setNull(); if(!incidentpopulate.value("incdt_incdtseverity_id").toString().isEmpty()) _severity->setId(incidentpopulate.value("incdt_incdtseverity_id").toInt()); _priority->setNull(); if(!incidentpopulate.value("incdt_incdtpriority_id").toString().isEmpty()) _priority->setId(incidentpopulate.value("incdt_incdtpriority_id").toInt()); _resolution->setNull(); if(!incidentpopulate.value("incdt_incdtresolution_id").toString().isEmpty()) _resolution->setId(incidentpopulate.value("incdt_incdtresolution_id").toInt()); if(!incidentpopulate.value("incdt_item_id").toString().isEmpty()) _item->setId(incidentpopulate.value("incdt_item_id").toInt()); else _item->setId(-1); if(!incidentpopulate.value("incdt_ls_id").toString().isEmpty()) _lotserial->setId(incidentpopulate.value("incdt_ls_id").toInt()); else _lotserial->setId(-1); _description->setText(incidentpopulate.value("incdt_summary").toString()); _notes->setText(incidentpopulate.value("incdt_descrip").toString()); _comments->setId(_incdtid); _documents->setId(_incdtid); _charass->setId(_incdtid); _alarms->setId(_incdtid); _project->setId(incidentpopulate.value("incdt_prj_id").toInt()); _public->setChecked(incidentpopulate.value("incdt_public").toBool()); _docType->setText(incidentpopulate.value("docType").toString()); _docNumber->setText(incidentpopulate.value("docNumber").toString()); _aropenid = incidentpopulate.value("docId").toInt(); _ardoctype = incidentpopulate.value("aropen_doctype").toString(); if (_aropenid > 0) _viewAR->setEnabled(true); _recurring->setParent(incidentpopulate.value("incdt_recurring_incdt_id").isNull() ? _incdtid : incidentpopulate.value("incdt_recurring_incdt_id").toInt(), "INCDT"); sFillHistoryList(); sFillTodoList(); emit populated(); } }
void incident::populate() { q.prepare("SELECT incdt_number," " incdt_crmacct_id," " COALESCE(incdt_cntct_id,-1) AS incdt_cntct_id," " (cntct_first_name || ' ' || cntct_last_name) AS cntct_name," " incdt_summary, incdt_descrip," " incdt_item_id, incdt_ls_id," " incdt_status, incdt_assigned_username," " incdt_incdtcat_id, incdt_incdtseverity_id," " incdt_incdtpriority_id, incdt_incdtresolution_id, incdt_owner_username, " " COALESCE(incdt_aropen_id, -1) AS docId," " COALESCE(aropen_docnumber, '') AS docNumber," " CASE WHEN (aropen_doctype='C') THEN :creditMemo" " WHEN (aropen_doctype='D') THEN :debitMemo" " WHEN (aropen_doctype='I') THEN :invoice" " WHEN (aropen_doctype='R') THEN :cashdeposit" " ELSE ''" " END AS docType " "FROM incdt LEFT OUTER JOIN cntct ON (incdt_cntct_id=cntct_id)" " LEFT OUTER JOIN aropen ON (incdt_aropen_id=aropen_id) " "WHERE (incdt_id=:incdt_id); "); q.bindValue(":incdt_id", _incdtid); q.bindValue(":creditMemo", tr("C/M")); q.bindValue(":debitMemo", tr("D/M")); q.bindValue(":invoice", tr("Invoice")); q.bindValue(":cashdeposit", tr("C/D")); q.exec(); if(q.first()) { _crmacct->setId(q.value("incdt_crmacct_id").toInt()); _cntct->setId(q.value("incdt_cntct_id").toInt()); _owner->setUsername(q.value("incdt_owner_username").toString()); _number->setText(q.value("incdt_number").toString()); _assignedTo->setUsername(q.value("incdt_assigned_username").toString()); _category->setNull(); if(!q.value("incdt_incdtcat_id").toString().isEmpty()) _category->setId(q.value("incdt_incdtcat_id").toInt()); _status->setCurrentIndex(_statusCodes.indexOf(q.value("incdt_status").toString())); _statusCache=_status->currentIndex(); _severity->setNull(); if(!q.value("incdt_incdtseverity_id").toString().isEmpty()) _severity->setId(q.value("incdt_incdtseverity_id").toInt()); _priority->setNull(); if(!q.value("incdt_incdtpriority_id").toString().isEmpty()) _priority->setId(q.value("incdt_incdtpriority_id").toInt()); _resolution->setNull(); if(!q.value("incdt_incdtresolution_id").toString().isEmpty()) _resolution->setId(q.value("incdt_incdtresolution_id").toInt()); if(!q.value("incdt_item_id").toString().isEmpty()) _item->setId(q.value("incdt_item_id").toInt()); else _item->setId(-1); if(!q.value("incdt_ls_id").toString().isEmpty()) _lotserial->setId(q.value("incdt_ls_id").toInt()); else _lotserial->setId(-1); _description->setText(q.value("incdt_summary").toString()); _notes->setText(q.value("incdt_descrip").toString()); _comments->setId(_incdtid); _documents->setId(_incdtid); _alarms->setId(_incdtid); _docType->setText(q.value("docType").toString()); _docNumber->setText(q.value("docNumber").toString()); _aropenid = q.value("docId").toInt(); if (_aropenid > 0) _viewAR->setEnabled(true); sFillHistoryList(); sFillTodoList(); _updated=false; } }