void XComboBox::setType(XComboBoxTypes pType) { if (_type == pType) return; if (pType != Adhoc) { setListSchemaName(""); setListTableName(""); } _type = pType; if (_x_metrics == 0) return; // If we're in Designer, don't populate QObject *ancestor = this; bool designMode; for ( ; ancestor; ancestor = ancestor->parent()) { designMode = ancestor->inherits("xTupleDesigner"); if (designMode) return; } XSqlQuery query; switch (pType) { case Adhoc: break; case UOMs: setAllowNull(TRUE); query.exec( "SELECT uom_id, uom_name, uom_name " "FROM uom " "ORDER BY uom_name;" ); break; case ClassCodes: query.exec( "SELECT classcode_id, (classcode_code || '-' || classcode_descrip), classcode_code " "FROM classcode " "ORDER BY classcode_code;" ); break; case ItemGroups: query.exec( "SELECT itemgrp_id, itemgrp_name, itemgrp_name " "FROM itemgrp " "ORDER BY itemgrp_name;" ); break; case CostCategories: query.exec( "SELECT costcat_id, (costcat_code || '-' || costcat_descrip), costcat_code " "FROM costcat " "ORDER BY costcat_code;" ); break; case ProductCategories: query.exec( "SELECT prodcat_id, (prodcat_code || ' - ' || prodcat_descrip), prodcat_code " "FROM prodcat " "ORDER BY prodcat_code;" ); break; case PlannerCodes: query.exec( "SELECT plancode_id, (plancode_code || '-' || plancode_name), plancode_code " "FROM plancode " "ORDER BY plancode_code;" ); break; case CustomerTypes: query.exec( "SELECT custtype_id, (custtype_code || '-' || custtype_descrip), custtype_code " "FROM custtype " "ORDER BY custtype_code;" ); break; case CustomerGroups: query.exec( "SELECT custgrp_id, custgrp_name, custgrp_name " "FROM custgrp " "ORDER BY custgrp_name;" ); break; case VendorTypes: query.exec( "SELECT vendtype_id, (vendtype_code || '-' || vendtype_descrip), vendtype_code " "FROM vendtype " "ORDER BY vendtype_code;" ); break; case VendorGroups: query.exec( "SELECT vendgrp_id, vendgrp_name, vendgrp_name " "FROM vendgrp " "ORDER BY vendgrp_name;" ); break; case SalesRepsActive: query.exec( "SELECT salesrep_id, (salesrep_number || '-' || salesrep_name), salesrep_number " "FROM salesrep " "WHERE (salesrep_active) " "ORDER by salesrep_number;" ); break; case ShipVias: setAllowNull(TRUE); setEditable(TRUE); query.exec( "SELECT shipvia_id, (shipvia_code || '-' || shipvia_descrip), shipvia_code " "FROM shipvia " "ORDER BY shipvia_code;" ); break; case SalesReps: query.exec( "SELECT salesrep_id, (salesrep_number || '-' || salesrep_name), salesrep_number " "FROM salesrep " "ORDER by salesrep_number;" ); break; case ShippingCharges: query.exec( "SELECT shipchrg_id, (shipchrg_name || '-' || shipchrg_descrip), shipchrg_name " "FROM shipchrg " "ORDER by shipchrg_name;" ); break; case ShippingForms: query.exec( "SELECT shipform_id, shipform_name, shipform_name " "FROM shipform " "ORDER BY shipform_name;" ); break; case Terms: query.exec( "SELECT terms_id, (terms_code || '-' || terms_descrip), terms_code " "FROM terms " "ORDER by terms_code;" ); break; case ARTerms: query.exec( "SELECT terms_id, (terms_code || '-' || terms_descrip), terms_code " "FROM terms " "WHERE (terms_ar) " "ORDER by terms_code;" ); break; case APTerms: query.exec( "SELECT terms_id, (terms_code || '-' || terms_descrip), terms_code " "FROM terms " "WHERE (terms_ap) " "ORDER by terms_code;" ); break; case ARBankAccounts: query.exec( "SELECT bankaccnt_id, (bankaccnt_name || '-' || bankaccnt_descrip), bankaccnt_name " "FROM bankaccnt " "WHERE (bankaccnt_ar) " "ORDER BY bankaccnt_name;" ); break; case APBankAccounts: query.exec( "SELECT bankaccnt_id, (bankaccnt_name || '-' || bankaccnt_descrip), bankaccnt_name " "FROM bankaccnt " "WHERE (bankaccnt_ap) " "ORDER BY bankaccnt_name;" ); break; case AccountingPeriods: query.exec( "SELECT period_id, (formatDate(period_start) || '-' || formatDate(period_end)), (formatDate(period_start) || '-' || formatDate(period_end)) " "FROM period " "ORDER BY period_start DESC;" ); break; case FinancialLayouts: query.exec( "SELECT flhead_id, flhead_name, flhead_name " "FROM flhead " "WHERE (flhead_active) " "ORDER BY flhead_name;" ); break; case FiscalYears: query.exec( "SELECT yearperiod_id, formatdate(yearperiod_start) || '-' || formatdate(yearperiod_end), formatdate(yearperiod_start) || '-' || formatdate(yearperiod_end)" " FROM yearperiod" " ORDER BY yearperiod_start DESC;" ); break; case SoProjects: setAllowNull(TRUE); query.exec( "SELECT prj_id, (prj_number || '-' || prj_name), prj_number " "FROM prj " "WHERE (prj_so) " "ORDER BY prj_name;" ); break; case WoProjects: setAllowNull(TRUE); query.exec( "SELECT prj_id, (prj_number || '-' || prj_name), prj_number " "FROM prj " "WHERE (prj_wo) " "ORDER BY prj_name;" ); break; case PoProjects: setAllowNull(TRUE); query.exec( "SELECT prj_id, (prj_number || '-' || prj_name), prj_number " "FROM prj " "WHERE (prj_po) " "ORDER BY prj_name;" ); break; case Currencies: query.exec( "SELECT curr_id, currConcat(curr_abbr, curr_symbol), curr_abbr" " FROM curr_symbol " "ORDER BY curr_base DESC, curr_abbr;" ); break; case CurrenciesNotBase: query.exec( "SELECT curr_id, currConcat(curr_abbr, curr_symbol), curr_abbr" " FROM curr_symbol " " WHERE curr_base = FALSE " "ORDER BY curr_abbr;" ); break; case Companies: query.exec( "SELECT company_id, company_number, company_number " "FROM company " "ORDER BY company_number;" ); break; case ProfitCenters: setEditable(_x_metrics->boolean("GLFFProfitCenters")); query.exec( "SELECT prftcntr_id, prftcntr_number, prftcntr_number " "FROM prftcntr " "ORDER BY prftcntr_number;" ); break; case Subaccounts: setEditable(_x_metrics->boolean("GLFFSubaccounts")); query.exec( "SELECT subaccnt_id, subaccnt_number, subaccnt_number " "FROM subaccnt " "ORDER BY subaccnt_number;" ); break; case AddressCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='ADDR')" "ORDER BY cmnttype_name;" ); break; case BBOMHeadCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='BBH')" "ORDER BY cmnttype_name;" ); break; case BBOMItemCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='BBI')" "ORDER BY cmnttype_name;" ); break; case BOMHeadCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='BMH')" "ORDER BY cmnttype_name;" ); break; case BOMItemCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='BMI')" "ORDER BY cmnttype_name;" ); break; case BOOHeadCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='BOH')" "ORDER BY cmnttype_name;" ); break; case BOOItemCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='BOI')" "ORDER BY cmnttype_name;" ); break; case CRMAccountCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='CRMA')" "ORDER BY cmnttype_name;" ); break; case ContactCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='T')" "ORDER BY cmnttype_name;" ); break; case CustomerCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='C')" "ORDER BY cmnttype_name;" ); break; case EmployeeCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='EMP')" "ORDER BY cmnttype_name;" ); break; case IncidentCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='INCDT')" "ORDER BY cmnttype_name;" ); break; case ItemCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='I')" "ORDER BY cmnttype_name;" ); break; case ItemSiteCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='IS')" "ORDER BY cmnttype_name;" ); break; case ItemSourceCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='IR')" "ORDER BY cmnttype_name;" ); break; case LocationCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='L')" "ORDER BY cmnttype_name;" ); break; case LotSerialCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='LS')" "ORDER BY cmnttype_name;" ); break; case OpportunityCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='OPP')" "ORDER BY cmnttype_name;" ); break; case ProjectCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='J')" "ORDER BY cmnttype_name;" ); break; case PurchaseOrderCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='P')" "ORDER BY cmnttype_name;" ); break; case PurchaseOrderItemCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='PI')" "ORDER BY cmnttype_name;" ); break; case ReturnAuthCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='RA')" "ORDER BY cmnttype_name;" ); break; case ReturnAuthItemCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='RI')" "ORDER BY cmnttype_name;" ); break; case QuoteCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='Q')" "ORDER BY cmnttype_name;" ); break; case QuoteItemCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='QI')" "ORDER BY cmnttype_name;" ); break; case SalesOrderCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='S')" "ORDER BY cmnttype_name;" ); break; case SalesOrderItemCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='SI')" "ORDER BY cmnttype_name;" ); break; case TaskCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='TA')" "ORDER BY cmnttype_name;" ); break; case TodoItemCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='TD')" "ORDER BY cmnttype_name;" ); break; case TransferOrderCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='TO')" "ORDER BY cmnttype_name;" ); break; case TransferOrderItemCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='TI')" "ORDER BY cmnttype_name;" ); break; case VendorCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='V')" "ORDER BY cmnttype_name;" ); break; case WarehouseCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='WH')" "ORDER BY cmnttype_name;" ); break; case WorkOrderCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype JOIN cmnttypesource ON (cmnttypesource_cmnttype_id=cmnttype_id)" " JOIN source ON (source_id=cmnttypesource_source_id) " "WHERE (source_name='W')" "ORDER BY cmnttype_name;" ); break; case AllCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype " "ORDER BY cmnttype_name;" ); break; case AllProjects: query.exec( "SELECT prj_id, prj_name, prj_name " "FROM prj " "ORDER BY prj_name;" ); break; case Users: query.exec( "SELECT usr_id, usr_username, usr_username " "FROM usr " "ORDER BY usr_username;" ); break; case SalesCategories: query.exec( "SELECT salescat_id, (salescat_name || '-' || salescat_descrip), salescat_name " "FROM salescat " "ORDER BY salescat_name;" ); break; case ExpenseCategories: query.exec( "SELECT expcat_id, (expcat_code || '-' || expcat_descrip), expcat_code " "FROM expcat " "ORDER BY expcat_code;" ); break; case ReasonCodes: query.exec( "SELECT rsncode_id, (rsncode_code || '-' || rsncode_descrip), rsncode_code" " FROM rsncode " "ORDER BY rsncode_code;" ); break; case ARCMReasonCodes: query.exec( "SELECT rsncode_id, (rsncode_code || '-' || rsncode_descrip), rsncode_code" " FROM rsncode " " WHERE ( (rsncode_doctype IS NULL) OR (rsncode_doctype='ARCM') ) " "ORDER BY rsncode_code;" ); break; case ARDMReasonCodes: query.exec( "SELECT rsncode_id, (rsncode_code || '-' || rsncode_descrip), rsncode_code" " FROM rsncode " " WHERE ( (rsncode_doctype IS NULL) OR (rsncode_doctype='ARDM') ) " "ORDER BY rsncode_code;" ); break; case ReturnReasonCodes: query.exec( "SELECT rsncode_id, (rsncode_code || '-' || rsncode_descrip), rsncode_code" " FROM rsncode " " WHERE ( (rsncode_doctype IS NULL) OR (rsncode_doctype='RA') ) " "ORDER BY rsncode_code;" ); break; case TaxCodes: query.exec( "SELECT tax_id, (tax_code || '-' || tax_descrip), tax_code" " FROM tax " "ORDER BY tax_code;" ); break; case WorkCenters: query.exec( "SELECT wrkcnt_id, (wrkcnt_code || '-' || wrkcnt_descrip), wrkcnt_code" " FROM wrkcnt " "ORDER BY wrkcnt_code;" ); break; case CRMAccounts: setAllowNull(TRUE); query.exec( "SELECT crmacct_id, (crmacct_number || '-' || crmacct_name), crmacct_number" " FROM crmacct " "ORDER BY crmacct_number;" ); break; case Honorifics: setAllowNull(TRUE); query.exec( "SELECT hnfc_id, hnfc_code, hnfc_code" " FROM hnfc " "ORDER BY hnfc_code;" ); break; case IncidentSeverity: query.exec( "SELECT incdtseverity_id, incdtseverity_name, incdtseverity_name" " FROM incdtseverity" " ORDER BY incdtseverity_order, incdtseverity_name;" ); break; case IncidentPriority: query.exec( "SELECT incdtpriority_id, incdtpriority_name, incdtpriority_name" " FROM incdtpriority" " ORDER BY incdtpriority_order, incdtpriority_name;" ); break; case IncidentResolution: query.exec( "SELECT incdtresolution_id, incdtresolution_name, incdtresolution_name" " FROM incdtresolution" " ORDER BY incdtresolution_order, incdtresolution_name;" ); break; case IncidentCategory: query.exec( "SELECT incdtcat_id, incdtcat_name, incdtcat_name" " FROM incdtcat" " ORDER BY incdtcat_order, incdtcat_name;" ); break; case TaxAuths: query.exec( "SELECT taxauth_id, taxauth_code, taxauth_code" " FROM taxauth" " ORDER BY taxauth_code;" ); break; case TaxTypes: query.exec( "SELECT taxtype_id, taxtype_name, taxtype_name" " FROM taxtype" " ORDER BY taxtype_name;" ); break; case Agent: query.exec( "SELECT usr_id, usr_username, usr_username " " FROM usr" " WHERE (usr_agent) " " ORDER BY usr_username;" ); break; case Reports: query.exec( "SELECT a.report_id, a.report_name, a.report_name " "FROM report a, " " (SELECT MIN(report_grade) AS report_grade, report_name " " FROM report " " GROUP BY report_name) b " "WHERE ((a.report_name=b.report_name)" " AND (a.report_grade=b.report_grade)) " "ORDER BY report_name;" ); break; case OpportunityStages: query.exec("SELECT opstage_id, opstage_name, opstage_name " " FROM opstage" " ORDER BY opstage_order;"); break; case OpportunitySources: query.exec("SELECT opsource_id, opsource_name, opsource_name " " FROM opsource;"); break; case OpportunityTypes: query.exec("SELECT optype_id, optype_name, optype_name " " FROM optype;"); break; case Locales: query.exec("SELECT locale_id, locale_code, locale_code " " FROM locale" " ORDER BY locale_code;"); break; case LocaleLanguages: query.exec("SELECT lang_id, lang_name, lang_name " " FROM lang" " WHERE lang_qt_number IS NOT NULL" " ORDER BY lang_name;"); break; case Countries: query.exec("SELECT country_id, country_name, country_name " " FROM country" " ORDER BY country_name;"); break; case LocaleCountries: query.exec("SELECT country_id, country_name, country_name " " FROM country" " WHERE country_qt_number IS NOT NULL" " ORDER BY country_name;"); break; case RegistrationTypes: query.exec("SELECT regtype_id, regtype_code, regtype_code " " FROM regtype" " ORDER BY regtype_code;"); break; case SiteTypes: query.exec("SELECT sitetype_id, sitetype_name, sitetype_name " " FROM sitetype" " ORDER BY sitetype_name;"); break; case FreightClasses: query.exec( "SELECT freightclass_id, (freightclass_code || '-' || freightclass_descrip), freightclass_code " "FROM freightclass " "ORDER BY freightclass_code;" ); break; case TaxClasses: query.exec( "SELECT taxclass_id, (taxclass_code || '-' || taxclass_descrip), taxclass_code " "FROM taxclass " "ORDER BY taxclass_code;" ); break; case TaxZones: query.exec( "SELECT taxzone_id, (taxzone_code || '-' || taxzone_descrip), taxzone_code " "FROM taxzone " "ORDER BY taxzone_code;" ); break; } populate(query); switch (pType) { case SoProjects: case WoProjects: case PoProjects: setEnabled(count() > 1); break; case Currencies: if (count() <= 1) { hide(); if (_label) _label->hide(); } break; case CurrenciesNotBase: if (count() < 1) { hide(); if (_label) _label->hide(); } break; default: break; } }
void XComboBox::setType(XComboBoxTypes pType) { if (_type == pType) return; if (pType != Adhoc) { setListSchemaName(""); setListTableName(""); } _type = pType; if (_x_metrics == 0) return; XSqlQuery query; switch (pType) { case Adhoc: break; case UOMs: setAllowNull(TRUE); query.exec( "SELECT uom_id, uom_name, uom_name " "FROM uom " "ORDER BY uom_name;" ); break; case ClassCodes: query.exec( "SELECT classcode_id, (classcode_code || '-' || classcode_descrip), classcode_code " "FROM classcode " "ORDER BY classcode_code;" ); break; case ItemGroups: query.exec( "SELECT itemgrp_id, itemgrp_name, itemgrp_name " "FROM itemgrp " "ORDER BY itemgrp_name;" ); break; case CostCategories: query.exec( "SELECT costcat_id, (costcat_code || '-' || costcat_descrip), costcat_code " "FROM costcat " "ORDER BY costcat_code;" ); break; case ProductCategories: query.exec( "SELECT prodcat_id, (prodcat_code || ' - ' || prodcat_descrip), prodcat_code " "FROM prodcat " "ORDER BY prodcat_code;" ); break; case PlannerCodes: query.exec( "SELECT plancode_id, (plancode_code || '-' || plancode_name), plancode_code " "FROM plancode " "ORDER BY plancode_code;" ); break; case CustomerTypes: query.exec( "SELECT custtype_id, (custtype_code || '-' || custtype_descrip), custtype_code " "FROM custtype " "ORDER BY custtype_code;" ); break; case CustomerGroups: query.exec( "SELECT custgrp_id, custgrp_name, custgrp_name " "FROM custgrp " "ORDER BY custgrp_name;" ); break; case VendorTypes: query.exec( "SELECT vendtype_id, (vendtype_code || '-' || vendtype_descrip), vendtype_code " "FROM vendtype " "ORDER BY vendtype_code;" ); break; case VendorGroups: query.exec( "SELECT vendgrp_id, vendgrp_name, vendgrp_name " "FROM vendgrp " "ORDER BY vendgrp_name;" ); break; case SalesRepsActive: query.exec( "SELECT salesrep_id, (salesrep_number || '-' || salesrep_name), salesrep_number " "FROM salesrep " "WHERE (salesrep_active) " "ORDER by salesrep_number;" ); break; case ShipVias: setAllowNull(TRUE); setEditable(TRUE); query.exec( "SELECT shipvia_id, (shipvia_code || '-' || shipvia_descrip), shipvia_code " "FROM shipvia " "ORDER BY shipvia_code;" ); break; case SalesReps: query.exec( "SELECT salesrep_id, (salesrep_number || '-' || salesrep_name), salesrep_number " "FROM salesrep " "ORDER by salesrep_number;" ); break; case ShippingCharges: query.exec( "SELECT shipchrg_id, (shipchrg_name || '-' || shipchrg_descrip), shipchrg_name " "FROM shipchrg " "ORDER by shipchrg_name;" ); break; case ShippingForms: query.exec( "SELECT shipform_id, shipform_name, shipform_name " "FROM shipform " "ORDER BY shipform_name;" ); break; case Terms: query.exec( "SELECT terms_id, (terms_code || '-' || terms_descrip), terms_code " "FROM terms " "ORDER by terms_code;" ); break; case ARTerms: query.exec( "SELECT terms_id, (terms_code || '-' || terms_descrip), terms_code " "FROM terms " "WHERE (terms_ar) " "ORDER by terms_code;" ); break; case APTerms: query.exec( "SELECT terms_id, (terms_code || '-' || terms_descrip), terms_code " "FROM terms " "WHERE (terms_ap) " "ORDER by terms_code;" ); break; case ARBankAccounts: query.exec( "SELECT bankaccnt_id, (bankaccnt_name || '-' || bankaccnt_descrip), bankaccnt_name " "FROM bankaccnt " "WHERE (bankaccnt_ar) " "ORDER BY bankaccnt_name;" ); break; case APBankAccounts: query.exec( "SELECT bankaccnt_id, (bankaccnt_name || '-' || bankaccnt_descrip), bankaccnt_name " "FROM bankaccnt " "WHERE (bankaccnt_ap) " "ORDER BY bankaccnt_name;" ); break; case AccountingPeriods: query.exec( "SELECT period_id, (formatDate(period_start) || '-' || formatDate(period_end)), (formatDate(period_start) || '-' || formatDate(period_end)) " "FROM period " "ORDER BY period_start DESC;" ); break; case FinancialLayouts: query.exec( "SELECT flhead_id, flhead_name, flhead_name " "FROM flhead " "WHERE (flhead_active) " "ORDER BY flhead_name;" ); break; case FiscalYears: query.exec( "SELECT yearperiod_id, formatdate(yearperiod_start) || '-' || formatdate(yearperiod_end), formatdate(yearperiod_start) || '-' || formatdate(yearperiod_end)" " FROM yearperiod" " ORDER BY yearperiod_start DESC;" ); break; case SoProjects: setAllowNull(TRUE); query.exec( "SELECT prj_id, (prj_number || '-' || prj_name), prj_number " "FROM prj " "WHERE (prj_so) " "ORDER BY prj_name;" ); break; case WoProjects: setAllowNull(TRUE); query.exec( "SELECT prj_id, (prj_number || '-' || prj_name), prj_number " "FROM prj " "WHERE (prj_wo) " "ORDER BY prj_name;" ); break; case PoProjects: setAllowNull(TRUE); query.exec( "SELECT prj_id, (prj_number || '-' || prj_name), prj_number " "FROM prj " "WHERE (prj_po) " "ORDER BY prj_name;" ); break; case Currencies: query.exec( "SELECT curr_id, currConcat(curr_abbr, curr_symbol), curr_abbr" " FROM curr_symbol " "ORDER BY curr_base DESC, curr_abbr;" ); break; case CurrenciesNotBase: query.exec( "SELECT curr_id, currConcat(curr_abbr, curr_symbol), curr_abbr" " FROM curr_symbol " " WHERE curr_base = FALSE " "ORDER BY curr_abbr;" ); break; case Companies: query.exec( "SELECT company_id, company_number, company_number " "FROM company " "ORDER BY company_number;" ); break; case ProfitCenters: setEditable(_x_metrics->boolean("GLFFProfitCenters")); query.exec( "SELECT prftcntr_id, prftcntr_number, prftcntr_number " "FROM prftcntr " "ORDER BY prftcntr_number;" ); break; case Subaccounts: setEditable(_x_metrics->boolean("GLFFSubaccounts")); query.exec( "SELECT subaccnt_id, subaccnt_number, subaccnt_number " "FROM subaccnt " "ORDER BY subaccnt_number;" ); break; case CustomerCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype " "WHERE (strpos(cmnttype_usedin, 'C')>0)" "ORDER BY cmnttype_name;" ); break; case VendorCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype " "WHERE (strpos(cmnttype_usedin, 'V')>0)" "ORDER BY cmnttype_name;" ); break; case ItemCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype " "WHERE (strpos(cmnttype_usedin, 'I')>0)" "ORDER BY cmnttype_name;" ); break; case ProjectCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype " "WHERE (strpos(cmnttype_usedin, 'J')>0)" "ORDER BY cmnttype_name;" ); break; case LotSerialCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype " "WHERE (strpos(cmnttype_usedin, 'L')>0)" "ORDER BY cmnttype_name;" ); break; case AllCommentTypes: query.exec( "SELECT cmnttype_id, cmnttype_name, cmnttype_name " "FROM cmnttype " "ORDER BY cmnttype_name;" ); break; case AllProjects: query.exec( "SELECT prj_id, prj_name, prj_name " "FROM prj " "ORDER BY prj_name;" ); break; case Users: query.exec( "SELECT usr_id, usr_username, usr_username " "FROM usr " "ORDER BY usr_username;" ); break; case SalesCategories: query.exec( "SELECT salescat_id, (salescat_name || '-' || salescat_descrip), salescat_name " "FROM salescat " "ORDER BY salescat_name;" ); break; case ExpenseCategories: query.exec( "SELECT expcat_id, (expcat_code || '-' || expcat_descrip), expcat_code " "FROM expcat " "ORDER BY expcat_code;" ); break; case ReasonCodes: query.exec( "SELECT rsncode_id, (rsncode_code || '-' || rsncode_descrip), rsncode_code" " FROM rsncode " "ORDER BY rsncode_code;" ); break; case TaxCodes: query.exec( "SELECT tax_id, (tax_code || '-' || tax_descrip), tax_code" " FROM tax " "ORDER BY tax_code;" ); break; case WorkCenters: query.exec( "SELECT wrkcnt_id, (wrkcnt_code || '-' || wrkcnt_descrip), wrkcnt_code" " FROM wrkcnt " "ORDER BY wrkcnt_code;" ); break; case CRMAccounts: setAllowNull(TRUE); query.exec( "SELECT crmacct_id, (crmacct_number || '-' || crmacct_name), crmacct_number" " FROM crmacct " "ORDER BY crmacct_number;" ); break; case Honorifics: setAllowNull(TRUE); query.exec( "SELECT hnfc_id, hnfc_code, hnfc_code" " FROM hnfc " "ORDER BY hnfc_code;" ); break; case IncidentSeverity: query.exec( "SELECT incdtseverity_id, incdtseverity_name, incdtseverity_name" " FROM incdtseverity" " ORDER BY incdtseverity_order, incdtseverity_name;" ); break; case IncidentPriority: query.exec( "SELECT incdtpriority_id, incdtpriority_name, incdtpriority_name" " FROM incdtpriority" " ORDER BY incdtpriority_order, incdtpriority_name;" ); break; case IncidentResolution: query.exec( "SELECT incdtresolution_id, incdtresolution_name, incdtresolution_name" " FROM incdtresolution" " ORDER BY incdtresolution_order, incdtresolution_name;" ); break; case IncidentCategory: query.exec( "SELECT incdtcat_id, incdtcat_name, incdtcat_name" " FROM incdtcat" " ORDER BY incdtcat_order, incdtcat_name;" ); break; case TaxAuths: query.exec( "SELECT taxauth_id, taxauth_code, taxauth_code" " FROM taxauth" " ORDER BY taxauth_code;" ); break; case TaxTypes: query.exec( "SELECT taxtype_id, taxtype_name, taxtype_name" " FROM taxtype" " ORDER BY taxtype_name;" ); break; case Agent: query.exec( "SELECT usr_id, usr_username, usr_username " " FROM usr" " WHERE (usr_agent) " " ORDER BY usr_username;" ); break; case Reports: query.exec( "SELECT a.report_id, a.report_name, a.report_name " "FROM report a, " " (SELECT MIN(report_grade) AS report_grade, report_name " " FROM report " " GROUP BY report_name) b " "WHERE ((a.report_name=b.report_name)" " AND (a.report_grade=b.report_grade)) " "ORDER BY report_name;" ); break; case OpportunityStages: query.exec("SELECT opstage_id, opstage_name, opstage_name " " FROM opstage" " ORDER BY opstage_order;"); break; case OpportunitySources: query.exec("SELECT opsource_id, opsource_name, opsource_name " " FROM opsource;"); break; case OpportunityTypes: query.exec("SELECT optype_id, optype_name, optype_name " " FROM optype;"); break; case Locales: query.exec("SELECT locale_id, locale_code, locale_code " " FROM locale" " ORDER BY locale_code;"); break; case LocaleLanguages: query.exec("SELECT lang_id, lang_name, lang_name " " FROM lang" " WHERE lang_qt_number IS NOT NULL" " ORDER BY lang_name;"); break; case Countries: query.exec("SELECT country_id, country_name, country_name " " FROM country" " ORDER BY country_name;"); break; case LocaleCountries: query.exec("SELECT country_id, country_name, country_name " " FROM country" " WHERE country_qt_number IS NOT NULL" " ORDER BY country_name;"); break; case RegistrationTypes: query.exec("SELECT regtype_id, regtype_code, regtype_code " " FROM regtype" " ORDER BY regtype_code;"); break; case SiteTypes: query.exec("SELECT sitetype_id, sitetype_name, sitetype_name " " FROM sitetype" " ORDER BY sitetype_name;"); break; } populate(query); switch (pType) { case SoProjects: case WoProjects: case PoProjects: setEnabled(count() > 1); break; case Currencies: if (count() <= 1) { hide(); if (_label) _label->hide(); } break; case CurrenciesNotBase: if (count() < 1) { hide(); if (_label) _label->hide(); } break; default: break; } }