object ApiDatabaseModule: TApiDatabaseModule
  Height = 491
  Width = 640
  object OracleUniProvider1: TOracleUniProvider
    Left = 164
    Top = 38
  end
  object uqMapUnits: TUniQuery
    Connection = ucENTCAD
    SQL.Strings = (
      'SELECT'
      '  uc.ENTRYID,'
      '  uc.UNITID,'
      '  COALESCE(uc.UNITNAME, uc.CAR_NUMBER) AS UNITNAME,'
      '  uc.UNIT_DISTRICT,'
      '  uc.GPS_LATITUDE,'
      '  uc.GPS_LONGITUDE,'
      '  cdc.CODE_DESC AS CALL_TYPE,'
      '  cap.PRIORITY AS PRIORITY,'
      '  cus.CODE_DESC AS UNIT_STATUS_DESC,'
      '  uc.UPDATETIME AS UPDATE_TIME,'
      ''
      '  dua.UNITID AS DIS_UNITID,'
      ''
      '  p1.PF_LNAME AS OFFICER1_LNAME,'
      '  p1.PF_FNAME AS OFFICER1_FNAME,'
      '  p1.PF_EMPNUM AS OFFICER1_EMPNUM,'
      ''
      '  p2.PF_LNAME AS OFFICER2_LNAME,'
      '  p2.PF_FNAME AS OFFICER2_FNAME,'
      '  p2.PF_EMPNUM AS OFFICER2_EMPNUM'
      ''
      'FROM UNITS_CURRENT@AVL_LINK uc'
      'LEFT JOIN CFS_ACTIVE cfs ON uc.UNITID = cfs.UNITID'
      
        'LEFT JOIN COMPLAINT_ACTIVE cap ON cap.COMPLAINTID = cfs.COMPLAIN' +
        'TID'
      'LEFT JOIN CD_DISPATCHCODES cdc ON cdc.CODE = cap.DISPATCHCODE'
      'LEFT JOIN CD_UNITSTATUS cus ON cus.CODE = cfs.UNITSTATUS'
      'LEFT JOIN DIS_UNIT_ACTIVE dua ON dua.UNITID = uc.UNITID'
      'LEFT JOIN PERSONNEL p1 ON p1.PF_NAMEID = dua.OFFICER1ID'
      'LEFT JOIN PERSONNEL p2 ON p2.PF_NAMEID = dua.OFFICER2ID'
      ''
      ''
      '')
    ReadOnly = True
    Left = 464
    Top = 390
    object uqMapUnitsENTRYID: TFloatField
      FieldName = 'ENTRYID'
    end
    object uqMapUnitsUNITID: TFloatField
      FieldName = 'UNITID'
    end
    object uqMapUnitsUNITNAME: TStringField
      FieldName = 'UNITNAME'
      ReadOnly = True
    end
    object uqMapUnitsUNIT_DISTRICT: TStringField
      FieldName = 'UNIT_DISTRICT'
      Size = 8
    end
    object uqMapUnitsGPS_LATITUDE: TFloatField
      FieldName = 'GPS_LATITUDE'
    end
    object uqMapUnitsGPS_LONGITUDE: TFloatField
      FieldName = 'GPS_LONGITUDE'
    end
    object uqMapUnitsCALL_TYPE: TStringField
      FieldName = 'CALL_TYPE'
      ReadOnly = True
      Size = 60
    end
    object uqMapUnitsPRIORITY: TStringField
      FieldName = 'PRIORITY'
      ReadOnly = True
      Size = 6
    end
    object uqMapUnitsUNIT_STATUS_DESC: TStringField
      FieldName = 'UNIT_STATUS_DESC'
      ReadOnly = True
    end
    object uqMapUnitsUPDATE_TIME: TDateTimeField
      FieldName = 'UPDATE_TIME'
    end
    object uqMapUnitsOFFICER1_LNAME: TStringField
      FieldName = 'OFFICER1_LNAME'
      ReadOnly = True
      Size = 45
    end
    object uqMapUnitsOFFICER1_FNAME: TStringField
      FieldName = 'OFFICER1_FNAME'
      ReadOnly = True
      Size = 30
    end
    object uqMapUnitsOFFICER1_EMPNUM: TStringField
      FieldName = 'OFFICER1_EMPNUM'
      ReadOnly = True
      Size = 10
    end
    object uqMapUnitsOFFICER2_LNAME: TStringField
      FieldName = 'OFFICER2_LNAME'
      ReadOnly = True
      Size = 45
    end
    object uqMapUnitsOFFICER2_FNAME: TStringField
      FieldName = 'OFFICER2_FNAME'
      ReadOnly = True
      Size = 30
    end
    object uqMapUnitsOFFICER2_EMPNUM: TStringField
      FieldName = 'OFFICER2_EMPNUM'
      ReadOnly = True
      Size = 10
    end
    object uqMapUnitsDIS_UNITID: TFloatField
      FieldName = 'DIS_UNITID'
      ReadOnly = True
    end
  end
  object uqUnitList: TUniQuery
    Connection = ucENTCAD
    SQL.Strings = (
      'SELECT dua.UNITID, dua.UNITNAME,'
      '       cun.CODE_DESC AS CARNUMBER_DESC,'
      '       cd.CODE_DESC  AS DISTRICT_DESC,'
      '       cs.CODE_DESC  AS SECTOR_DESC,'
      '       p1.PF_EMPNUM  AS OFFICER1_EMPNUM,'
      '       p1.PF_LNAME   AS OFFICER1_LAST_NAME,'
      '       p1.PF_FNAME   AS OFFICER1_FIRST_NAME,'
      '       p1.PF_MI      AS OFFICER1_MI,'
      '       p2.PF_EMPNUM  AS OFFICER2_EMPNUM,'
      '       p2.PF_LNAME   AS OFFICER2_LAST_NAME,'
      '       p2.PF_FNAME   AS OFFICER2_FIRST_NAME,'
      '       p2.PF_MI      AS OFFICER2_MI,'
      '       ca.LOCATION,'
      '       ca.COMPLAINT,'
      '       ca.UNITSTATUS,'
      '       cus.CODE_DESC AS UNIT_STATUS_DESC,'
      '       cdc.CODE_DESC AS CALL_TYPE,'
      '       uc.ENTRYID,'
      '       uc.GPS_LATITUDE,'
      '       uc.GPS_LONGITUDE'
      'FROM DIS_UNIT_ACTIVE dua'
      
        'LEFT JOIN CD_UNIT_NUMBER         cun ON cun.AGENCYCODE = dua.CAR' +
        'NUMBER'
      
        'LEFT JOIN CD_DISTRICT            cd  ON cd.AGENCYCODE  = dua.DIS' +
        'TRICT'
      
        'LEFT JOIN CD_SECTOR              cs  ON cs.AGENCYCODE  = dua.SEC' +
        'TOR AND cs.CODE_TYPE = cd.AGENCYCODE'
      
        'LEFT JOIN PERSONNEL              p1  ON dua.OFFICER1ID = p1.PF_N' +
        'AMEID'
      
        'LEFT JOIN PERSONNEL              p2  ON dua.OFFICER2ID = p2.PF_N' +
        'AMEID'
      
        'LEFT JOIN CFS_ACTIVE             ca  ON dua.UNITID     = ca.UNIT' +
        'ID'
      
        'LEFT JOIN CD_UNITSTATUS          cus ON ca.UNITSTATUS  = cus.COD' +
        'E'
      
        'LEFT JOIN COMPLAINT_ACTIVE       cap ON cap.COMPLAINTID = ca.COM' +
        'PLAINTID'
      
        'LEFT JOIN CD_DISPATCHCODES       cdc ON cdc.CODE        = cap.DI' +
        'SPATCHCODE'
      
        'LEFT JOIN UNITS_CURRENT@AVL_LINK uc  ON dua.UNITID     = uc.UNIT' +
        'ID'
      'ORDER BY'
      '  CASE WHEN LENGTH(cd.CODE_DESC) = 1 THEN 0 ELSE 1 END,'
      '  cd.CODE_DESC,'
      '  dua.UNITNAME'
      ''
      '')
    ReadOnly = True
    Left = 76
    Top = 188
    object uqUnitListUNITID: TFloatField
      FieldName = 'UNITID'
    end
    object uqUnitListUNITNAME: TStringField
      FieldName = 'UNITNAME'
      Size = 10
    end
    object uqUnitListCARNUMBER_DESC: TStringField
      FieldName = 'CARNUMBER_DESC'
      ReadOnly = True
      Size = 120
    end
    object uqUnitListDISTRICT_DESC: TStringField
      FieldName = 'DISTRICT_DESC'
      ReadOnly = True
      Size = 120
    end
    object uqUnitListSECTOR_DESC: TStringField
      FieldName = 'SECTOR_DESC'
      ReadOnly = True
      Size = 120
    end
    object uqUnitListOFFICER1_EMPNUM: TStringField
      FieldName = 'OFFICER1_EMPNUM'
      ReadOnly = True
      Size = 10
    end
    object uqUnitListOFFICER1_LAST_NAME: TStringField
      FieldName = 'OFFICER1_LAST_NAME'
      ReadOnly = True
      Size = 45
    end
    object uqUnitListOFFICER1_FIRST_NAME: TStringField
      FieldName = 'OFFICER1_FIRST_NAME'
      ReadOnly = True
      Size = 30
    end
    object uqUnitListOFFICER1_MI: TStringField
      FieldName = 'OFFICER1_MI'
      ReadOnly = True
      Size = 1
    end
    object uqUnitListOFFICER2_EMPNUM: TStringField
      FieldName = 'OFFICER2_EMPNUM'
      ReadOnly = True
      Size = 10
    end
    object uqUnitListOFFICER2_LAST_NAME: TStringField
      FieldName = 'OFFICER2_LAST_NAME'
      ReadOnly = True
      Size = 45
    end
    object uqUnitListOFFICER2_FIRST_NAME: TStringField
      FieldName = 'OFFICER2_FIRST_NAME'
      ReadOnly = True
      Size = 30
    end
    object uqUnitListOFFICER2_MI: TStringField
      FieldName = 'OFFICER2_MI'
      ReadOnly = True
      Size = 1
    end
    object uqUnitListLOCATION: TStringField
      FieldName = 'LOCATION'
      ReadOnly = True
      Size = 30
    end
    object uqUnitListCOMPLAINT: TStringField
      FieldName = 'COMPLAINT'
      ReadOnly = True
      Size = 10
    end
    object uqUnitListUNITSTATUS: TFloatField
      FieldName = 'UNITSTATUS'
      ReadOnly = True
    end
    object uqUnitListUNIT_STATUS_DESC: TStringField
      FieldName = 'UNIT_STATUS_DESC'
      ReadOnly = True
    end
    object uqUnitListENTRYID: TFloatField
      FieldName = 'ENTRYID'
      ReadOnly = True
    end
    object uqUnitListGPS_LATITUDE: TFloatField
      FieldName = 'GPS_LATITUDE'
      ReadOnly = True
    end
    object uqUnitListGPS_LONGITUDE: TFloatField
      FieldName = 'GPS_LONGITUDE'
      ReadOnly = True
    end
    object uqUnitListCALL_TYPE: TStringField
      FieldName = 'CALL_TYPE'
      ReadOnly = True
      Size = 60
    end
  end
  object uqComplaintUnits: TUniQuery
    Connection = ucENTCAD
    SQL.Strings = (
      'SELECT'
      '  ca.COMPLAINTID,'
      '  ca.UNITID,'
      '  ca.UNITNAME,'
      '  ca.DATEDISPATCHED,'
      '  ca.DATERESPONDED,'
      '  ca.DATEARRIVED,'
      '  ca.DATECLEARED,'
      '  ca.LOCATION'
      'FROM CFS_ACTIVE ca'
      'WHERE ca.COMPLAINTID = :COMPLAINTID'
      'ORDER BY ca.DATEDISPATCHED')
    ReadOnly = True
    Left = 466
    Top = 326
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'COMPLAINTID'
        Value = Null
      end>
    object uqComplaintUnitsCOMPLAINTID: TFloatField
      FieldName = 'COMPLAINTID'
    end
    object uqComplaintUnitsUNITID: TFloatField
      FieldName = 'UNITID'
    end
    object uqComplaintUnitsUNITNAME: TStringField
      FieldName = 'UNITNAME'
      Size = 10
    end
    object uqComplaintUnitsDATEDISPATCHED: TDateTimeField
      FieldName = 'DATEDISPATCHED'
    end
    object uqComplaintUnitsDATERESPONDED: TDateTimeField
      FieldName = 'DATERESPONDED'
    end
    object uqComplaintUnitsDATEARRIVED: TDateTimeField
      FieldName = 'DATEARRIVED'
    end
    object uqComplaintUnitsDATECLEARED: TDateTimeField
      FieldName = 'DATECLEARED'
    end
    object uqComplaintUnitsLOCATION: TStringField
      FieldName = 'LOCATION'
      Size = 30
    end
  end
  object uqCFSMemos: TUniQuery
    Connection = ucENTCAD
    SQL.Strings = (
      'SELECT'
      '  cm.MEMO_ID,'
      '  cm.CFSID,'
      '  cm.MEMO_TYPE,'
      '  cm.TIMESTAMP,'
      '  cm.BADGE_NUMBER,'
      '  cm.REMARKS'
      'FROM CFS_MEMOS cm'
      'WHERE cm.CFSID = :CFSID'
      'ORDER BY cm.TIMESTAMP DESC')
    ReadOnly = True
    Left = 196
    Top = 248
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'CFSID'
        Value = nil
      end>
    object uqCFSMemosMEMO_ID: TFloatField
      FieldName = 'MEMO_ID'
      Required = True
    end
    object uqCFSMemosCFSID: TFloatField
      FieldName = 'CFSID'
    end
    object uqCFSMemosMEMO_TYPE: TFloatField
      FieldName = 'MEMO_TYPE'
    end
    object uqCFSMemosTIMESTAMP: TDateTimeField
      FieldName = 'TIMESTAMP'
    end
    object uqCFSMemosBADGE_NUMBER: TStringField
      FieldName = 'BADGE_NUMBER'
      Size = 6
    end
    object uqCFSMemosREMARKS: TStringField
      FieldName = 'REMARKS'
      Size = 2048
    end
  end
  object uqComplaintList: TUniQuery
    Connection = ucENTCAD
    SQL.Strings = (
      'SELECT'
      '  ca.COMPLAINTID,'
      '  ca.CFSID,'
      '  ca.COMPLAINT,'
      '  ca.AGENCY,'
      '  cdc.CODE_DESC AS DISPATCH_CODE_DESC,'
      '  ca.SOURCE,'
      '  ccs.CODE_DESC AS SOURCE_DESC,'
      '  ca.PRIORITY,'
      '  ca.ADDRESSID,'
      '  ca.ADDRESS,'
      '  ca.APARTMENT,'
      '  ca.CITY,'
      '  ca.BUSINESS,'
      '  cd.CODE_DESC AS DISPATCHDISTRICT,'
      '  ca.DISPATCHSECTOR,'
      '  ca.ADDRESSDISTRICT,'
      '  ca.ADDRESSSECTOR,'
      '  ca.XCOORD,'
      '  ca.YCOORD,'
      '  ca.WARNINGS,'
      '  ca.CONTACTS,'
      '  ca.HISTORY,'
      '  ct.DATEREPORTED,'
      '  ct.DATERECEIVED,'
      '  ct.DATEDISPATCHED,'
      '  ct.DATERESPONDED,'
      '  ct.DATEARRIVED,'
      '  ct.DATECLEARED,'
      '  cp.MOBILE_COLOR AS PRIORITY_COLOR,'
      '  cd.CODE_DESC AS DISTRICT_DESC,'
      '  cs.CODE_DESC AS SECTOR_DESC'
      'FROM COMPLAINT_ACTIVE ca'
      'JOIN COMPLAINT_TIMES ct ON ca.COMPLAINTID = ct.COMPLAINTID'
      'LEFT JOIN CD_DISPATCHCODES cdc ON ca.DISPATCHCODE = cdc.CODE'
      'LEFT JOIN CD_CALLSOURCES   ccs ON ca.SOURCE       = ccs.CODE'
      
        'LEFT JOIN CD_CALLPRIORITIES cp ON cp.CODE = ca.PRIORITY AND cp.A' +
        'GENCY = ca.AGENCY'
      
        'JOIN CD_DISTRICT cd            ON cd.AGENCYCODE  = ca.DISPATCHDI' +
        'STRICT'
      
        'LEFT JOIN CD_SECTOR   cs       ON cs.AGENCYCODE  = ca.DISPATCHSE' +
        'CTOR AND cs.CODE_TYPE = cd.AGENCYCODE'
      'WHERE ca.COMPLAINT IS NOT NULL'
      'ORDER BY cd.CODE_DESC, ct.DATEREPORTED DESC, ca.PRIORITY DESC;')
    ReadOnly = True
    OnCalcFields = uqComplaintListCalcFields
    Left = 78
    Top = 244
    object uqComplaintListCOMPLAINTID: TFloatField
      FieldName = 'COMPLAINTID'
      Required = True
    end
    object uqComplaintListCFSID: TFloatField
      FieldName = 'CFSID'
    end
    object uqComplaintListCOMPLAINT: TStringField
      FieldName = 'COMPLAINT'
      Size = 10
    end
    object uqComplaintListAGENCY: TStringField
      FieldName = 'AGENCY'
      Size = 6
    end
    object uqComplaintListDISPATCH_CODE_DESC: TStringField
      FieldName = 'DISPATCH_CODE_DESC'
      ReadOnly = True
      Size = 60
    end
    object uqComplaintListSOURCE: TStringField
      FieldName = 'SOURCE'
      Size = 6
    end
    object uqComplaintListSOURCE_DESC: TStringField
      FieldName = 'SOURCE_DESC'
      ReadOnly = True
      Size = 120
    end
    object uqComplaintListPRIORITY: TStringField
      FieldName = 'PRIORITY'
      Size = 6
    end
    object uqComplaintListADDRESSID: TFloatField
      FieldName = 'ADDRESSID'
    end
    object uqComplaintListADDRESS: TStringField
      FieldName = 'ADDRESS'
      Size = 64
    end
    object uqComplaintListAPARTMENT: TStringField
      FieldName = 'APARTMENT'
      Size = 6
    end
    object uqComplaintListCITY: TStringField
      FieldName = 'CITY'
    end
    object uqComplaintListBUSINESS: TStringField
      FieldName = 'BUSINESS'
      Size = 35
    end
    object uqComplaintListDISPATCHDISTRICT: TStringField
      FieldName = 'DISPATCHDISTRICT'
      Size = 6
    end
    object uqComplaintListDISPATCHSECTOR: TStringField
      FieldName = 'DISPATCHSECTOR'
      Size = 6
    end
    object uqComplaintListADDRESSDISTRICT: TStringField
      FieldName = 'ADDRESSDISTRICT'
      Size = 5
    end
    object uqComplaintListADDRESSSECTOR: TStringField
      FieldName = 'ADDRESSSECTOR'
      Size = 5
    end
    object uqComplaintListXCOORD: TFloatField
      FieldName = 'XCOORD'
    end
    object uqComplaintListYCOORD: TFloatField
      FieldName = 'YCOORD'
    end
    object uqComplaintListWARNINGS: TFloatField
      FieldName = 'WARNINGS'
    end
    object uqComplaintListCONTACTS: TFloatField
      FieldName = 'CONTACTS'
    end
    object uqComplaintListHISTORY: TFloatField
      FieldName = 'HISTORY'
    end
    object uqComplaintListDATEREPORTED: TDateTimeField
      FieldName = 'DATEREPORTED'
      ReadOnly = True
    end
    object uqComplaintListDATERECEIVED: TDateTimeField
      FieldName = 'DATERECEIVED'
      ReadOnly = True
    end
    object uqComplaintListDATEDISPATCHED: TDateTimeField
      FieldName = 'DATEDISPATCHED'
      ReadOnly = True
    end
    object uqComplaintListDATERESPONDED: TDateTimeField
      FieldName = 'DATERESPONDED'
      ReadOnly = True
    end
    object uqComplaintListDATEARRIVED: TDateTimeField
      FieldName = 'DATEARRIVED'
      ReadOnly = True
    end
    object uqComplaintListDATECLEARED: TDateTimeField
      FieldName = 'DATECLEARED'
      ReadOnly = True
    end
    object uqComplaintListcomplaintNumber: TStringField
      FieldKind = fkCalculated
      FieldName = 'complaintNumber'
      Size = 11
      Calculated = True
    end
    object uqComplaintListPRIORITY_COLOR: TFloatField
      FieldName = 'PRIORITY_COLOR'
      ReadOnly = True
    end
    object uqComplaintListDISTRICT_DESC: TStringField
      FieldName = 'DISTRICT_DESC'
      ReadOnly = True
      Size = 120
    end
    object uqComplaintListSECTOR_DESC: TStringField
      FieldName = 'SECTOR_DESC'
      ReadOnly = True
      Size = 120
    end
  end
  object uqComplaintDetails: TUniQuery
    Connection = ucENTCAD
    SQL.Strings = (
      'SELECT'
      '  ca.COMPLAINTID,'
      '  ca.CFSID,'
      '  ca.COMPLAINT,'
      '  ca.PRIORITY,'
      '  ca.DISPATCHCODE,'
      '  cdc.CODE_DESC AS DISPATCH_CODE_DESC,'
      '  cd.CODE_DESC AS DISPATCHDISTRICT,'
      '  ca.ADDRESS,'
      '  ca.BUSINESS,'
      '  ct.DATEREPORTED,'
      '  ct.DATERECEIVED,'
      '  ct.DATEDISPATCHED,'
      '  ct.DATERESPONDED,'
      '  ct.DATEARRIVED,'
      '  ct.DATECLEARED,'
      ''
      '  -- For enabling/disabling buttons (disable when = '#39'-1'#39')'
      '  ca.HISTORY,'
      '  ca.CONTACTS,'
      '  ca.WARNINGS,'
      ''
      '  -- For Contacts + Warnings lookups'
      '  ca.ADDRESSID,'
      '  ca.AGENCY,'
      ''
      '  -- For History matching (address parts)'
      '  a.STRNUMBER,'
      '  a.STRHNUMBER,'
      '  a.STRPREFIX,'
      '  a.STRNAME,'
      '  a.STRSUFFIX,'
      '  a.CITY,'
      '  0 as status'
      'FROM COMPLAINT_ACTIVE ca'
      'JOIN COMPLAINT_TIMES ct'
      '  ON ca.COMPLAINTID = ct.COMPLAINTID'
      'LEFT JOIN CD_DISPATCHCODES cdc'
      '  ON ca.DISPATCHCODE = cdc.CODE'
      'LEFT JOIN CD_DISTRICT cd'
      '  ON cd.AGENCYCODE = ca.DISPATCHDISTRICT'
      'LEFT JOIN ADDRESS a'
      '  ON ca.ADDRESSID = a.ADDRESSID'
      'WHERE ca.COMPLAINTID = :COMPLAINTID'
      ''
      'union'
      ''
      'SELECT'
      '  ca.COMPLAINTID,'
      '  ca.CFSID,'
      '  ca.COMPLAINT,'
      '  ca.PRIORITY,'
      '  ca.DISPATCHCODE,'
      '  cdc.CODE_DESC AS DISPATCH_CODE_DESC,'
      '  cd.CODE_DESC AS DISPATCHDISTRICT,'
      '  ca.ADDRESS,'
      '  ca.BUSINESS,'
      '  ct.DATEREPORTED,'
      '  ct.DATERECEIVED,'
      '  ct.DATEDISPATCHED,'
      '  ct.DATERESPONDED,'
      '  ct.DATEARRIVED,'
      '  ct.DATECLEARED,'
      ''
      '  -- For enabling/disabling buttons (disable when = '#39'-1'#39')'
      '  ca.HISTORY,'
      '  ca.CONTACTS,'
      '  ca.WARNINGS,'
      ''
      '  -- For Contacts + Warnings lookups'
      '  ca.ADDRESSID,'
      '  ca.AGENCY,'
      ''
      '  -- For History matching (address parts)'
      '  a.STRNUMBER,'
      '  a.STRHNUMBER,'
      '  a.STRPREFIX,'
      '  a.STRNAME,'
      '  a.STRSUFFIX,'
      '  a.CITY,'
      '  1 as status'
      'FROM COMPLAINT_ARCHIVE ca'
      'JOIN COMPLAINT_TIMES ct'
      '  ON ca.COMPLAINTID = ct.COMPLAINTID'
      'LEFT JOIN CD_DISPATCHCODES cdc'
      '  ON ca.DISPATCHCODE = cdc.CODE'
      'LEFT JOIN CD_DISTRICT cd'
      '  ON cd.AGENCYCODE = ca.DISPATCHDISTRICT'
      'LEFT JOIN ADDRESS a'
      '  ON ca.ADDRESSID = a.ADDRESSID'
      'WHERE ca.COMPLAINTID = :COMPLAINTID;'
      '')
    ReadOnly = True
    Left = 80
    Top = 302
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'COMPLAINTID'
        Value = Null
      end>
    object uqComplaintDetailsCOMPLAINTID: TFloatField
      FieldName = 'COMPLAINTID'
      Required = True
    end
    object uqComplaintDetailsCFSID: TFloatField
      FieldName = 'CFSID'
    end
    object uqComplaintDetailsCOMPLAINT: TStringField
      FieldName = 'COMPLAINT'
      Size = 10
    end
    object uqComplaintDetailsPRIORITY: TStringField
      FieldName = 'PRIORITY'
      Size = 6
    end
    object uqComplaintDetailsDISPATCHCODE: TStringField
      FieldName = 'DISPATCHCODE'
      Size = 6
    end
    object uqComplaintDetailsDISPATCH_CODE_DESC: TStringField
      FieldName = 'DISPATCH_CODE_DESC'
      ReadOnly = True
      Size = 60
    end
    object uqComplaintDetailsDISPATCHDISTRICT: TStringField
      FieldName = 'DISPATCHDISTRICT'
      Size = 120
    end
    object uqComplaintDetailsADDRESS: TStringField
      FieldName = 'ADDRESS'
      Size = 64
    end
    object uqComplaintDetailsDATEREPORTED: TDateTimeField
      FieldName = 'DATEREPORTED'
      ReadOnly = True
    end
    object uqComplaintDetailsDATERECEIVED: TDateTimeField
      FieldName = 'DATERECEIVED'
      ReadOnly = True
    end
    object uqComplaintDetailsDATEDISPATCHED: TDateTimeField
      FieldName = 'DATEDISPATCHED'
      ReadOnly = True
    end
    object uqComplaintDetailsDATERESPONDED: TDateTimeField
      FieldName = 'DATERESPONDED'
      ReadOnly = True
    end
    object uqComplaintDetailsDATEARRIVED: TDateTimeField
      FieldName = 'DATEARRIVED'
      ReadOnly = True
    end
    object uqComplaintDetailsDATECLEARED: TDateTimeField
      FieldName = 'DATECLEARED'
      ReadOnly = True
    end
    object uqComplaintDetailsHISTORY: TFloatField
      FieldName = 'HISTORY'
    end
    object uqComplaintDetailsCONTACTS: TFloatField
      FieldName = 'CONTACTS'
    end
    object uqComplaintDetailsWARNINGS: TFloatField
      FieldName = 'WARNINGS'
    end
    object uqComplaintDetailsADDRESSID: TFloatField
      FieldName = 'ADDRESSID'
    end
    object uqComplaintDetailsAGENCY: TStringField
      FieldName = 'AGENCY'
      Size = 6
    end
    object uqComplaintDetailsSTRNUMBER: TFloatField
      FieldName = 'STRNUMBER'
      ReadOnly = True
    end
    object uqComplaintDetailsSTRHNUMBER: TStringField
      FieldName = 'STRHNUMBER'
      ReadOnly = True
      Size = 1
    end
    object uqComplaintDetailsSTRPREFIX: TStringField
      FieldName = 'STRPREFIX'
      ReadOnly = True
      Size = 1
    end
    object uqComplaintDetailsSTRNAME: TStringField
      FieldName = 'STRNAME'
      ReadOnly = True
    end
    object uqComplaintDetailsSTRSUFFIX: TStringField
      FieldName = 'STRSUFFIX'
      ReadOnly = True
      Size = 2
    end
    object uqComplaintDetailsCITY: TStringField
      FieldName = 'CITY'
      ReadOnly = True
    end
    object uqComplaintDetailsBUSINESS: TStringField
      FieldName = 'BUSINESS'
      Size = 35
    end
    object uqComplaintDetailsSTATUS: TFloatField
      FieldName = 'STATUS'
      ReadOnly = True
    end
  end
  object ucENTCAD: TUniConnection
    ProviderName = 'Oracle'
    Port = 1521
    Username = 'ENTCAD'
    Server = 'BUFENTCAD'
    Connected = True
    LoginPrompt = False
    Left = 50
    Top = 36
    EncryptedPassword = 'BAFFB1FFABFFBCFFBEFFBBFF'
  end
  object uqMapComplaints: TUniQuery
    Connection = ucENTCAD
    SQL.Strings = (
      'SELECT'
      '  ca.COMPLAINTID,'
      '  cd.CODE_DESC AS DISPATCHDISTRICT,'
      '  ca.PRIORITY AS PRIORITY,'
      '  ca.BUSINESS,'
      '  cdc.MOBILE_MAP_CATEGORY AS DISPATCHCODECATEGORY,'
      ''
      '  SDO_CS.TRANSFORM('
      
        '    SDO_GEOMETRY(2001, 2262, SDO_POINT_TYPE(ca.XCOORD, ca.YCOORD' +
        ', NULL), NULL, NULL),'
      '    4326'
      '  ).sdo_point.x AS LNG,'
      ''
      '  SDO_CS.TRANSFORM('
      
        '    SDO_GEOMETRY(2001, 2262, SDO_POINT_TYPE(ca.XCOORD, ca.YCOORD' +
        ', NULL), NULL, NULL),'
      '    4326'
      '  ).sdo_point.y AS LAT,'
      ''
      '  cdc.CODE_DESC AS DISPATCH_CODE_DESC,'
      '  ca.ADDRESS AS ADDRESS'
      'FROM COMPLAINT_ACTIVE ca'
      'JOIN COMPLAINT_TIMES ct'
      '  ON ct.COMPLAINTID = ca.COMPLAINTID'
      'LEFT JOIN CD_DISPATCHCODES cdc'
      '  ON cdc.CODE = ca.DISPATCHCODE'
      'JOIN CD_DISTRICT cd'
      '  ON cd.AGENCYCODE = ca.DISPATCHDISTRICT'
      'WHERE ca.COMPLAINT IS NOT NULL'
      '  AND ca.XCOORD IS NOT NULL'
      '  AND ca.YCOORD IS NOT NULL;'
      ''
      ''
      ''
      '')
    ReadOnly = True
    OnCalcFields = uqMapComplaintsCalcFields
    Left = 468
    Top = 264
    object uqMapComplaintsCOMPLAINTID: TFloatField
      FieldName = 'COMPLAINTID'
      Required = True
    end
    object uqMapComplaintsDISPATCHDISTRICT: TStringField
      FieldName = 'DISPATCHDISTRICT'
      Size = 120
    end
    object uqMapComplaintsLNG: TFloatField
      FieldName = 'LNG'
    end
    object uqMapComplaintsLAT: TFloatField
      FieldName = 'LAT'
    end
    object uqMapComplaintsDISPATCH_CODE_DESC: TStringField
      FieldName = 'DISPATCH_CODE_DESC'
      ReadOnly = True
      Size = 60
    end
    object uqMapComplaintsPRIORITY: TStringField
      FieldName = 'PRIORITY'
      Size = 6
    end
    object uqMapComplaintsDISPATCHCODECATEGORY: TStringField
      FieldName = 'DISPATCHCODECATEGORY'
      ReadOnly = True
      Size = 50
    end
    object uqMapComplaintsADDRESS: TStringField
      FieldName = 'ADDRESS'
      Size = 64
    end
    object uqMapComplaintspriorityKey: TStringField
      FieldKind = fkCalculated
      FieldName = 'priorityKey'
      Calculated = True
    end
    object uqMapComplaintspngName: TStringField
      DisplayWidth = 100
      FieldKind = fkCalculated
      FieldName = 'pngName'
      Size = 100
      Calculated = True
    end
    object uqMapComplaintsBUSINESS: TStringField
      FieldName = 'BUSINESS'
      Size = 35
    end
  end
  object uqBadgeCounts: TUniQuery
    Connection = ucENTCAD
    SQL.Strings = (
      'select'
      '  (select count(*)'
      '     from COMPLAINT_ACTIVE ca'
      '     join COMPLAINT_TIMES  ct on ct.COMPLAINTID = ca.COMPLAINTID'
      '    where ca.COMPLAINT is not null) as Complaints,'
      ''
      '  (select count(distinct dua.UNITID)'
      '     from DIS_UNIT_ACTIVE dua) as Units'
      'from dual;'
      '')
    ReadOnly = True
    Left = 198
    Top = 190
    object uqBadgeCountsCOMPLAINTS: TFloatField
      FieldName = 'COMPLAINTS'
      ReadOnly = True
    end
    object uqBadgeCountsUNITS: TFloatField
      FieldName = 'UNITS'
      ReadOnly = True
    end
  end
  object uqMapComplaintUnitsList: TUniQuery
    Connection = ucENTCAD
    SQL.Strings = (
      'SELECT'
      '  ca.COMPLAINTID,'
      '  ca.UNITID,'
      '  ca.UNITNAME,'
      '  ca.DATEDISPATCHED,'
      '  ca.DATERESPONDED,'
      '  ca.DATEARRIVED,'
      '  ca.DATECLEARED,'
      '  ca.LOCATION'
      'FROM CFS_ACTIVE ca'
      'WHERE ca.COMPLAINTID IN ('
      '  SELECT c.COMPLAINTID'
      '  FROM COMPLAINT_ACTIVE c'
      '  WHERE c.XCOORD IS NOT NULL'
      '    AND c.YCOORD IS NOT NULL'
      ')'
      'ORDER BY ca.COMPLAINTID, ca.DATEDISPATCHED;')
    ReadOnly = True
    Left = 464
    Top = 202
    object uqMapComplaintUnitsListCOMPLAINTID: TFloatField
      FieldName = 'COMPLAINTID'
    end
    object uqMapComplaintUnitsListUNITID: TFloatField
      FieldName = 'UNITID'
    end
    object uqMapComplaintUnitsListUNITNAME: TStringField
      FieldName = 'UNITNAME'
      Size = 10
    end
    object uqMapComplaintUnitsListDATEDISPATCHED: TDateTimeField
      FieldName = 'DATEDISPATCHED'
    end
    object uqMapComplaintUnitsListDATERESPONDED: TDateTimeField
      FieldName = 'DATERESPONDED'
    end
    object uqMapComplaintUnitsListDATEARRIVED: TDateTimeField
      FieldName = 'DATEARRIVED'
    end
    object uqMapComplaintUnitsListDATECLEARED: TDateTimeField
      FieldName = 'DATECLEARED'
    end
    object uqMapComplaintUnitsListLOCATION: TStringField
      FieldName = 'LOCATION'
      Size = 30
    end
  end
  object uqComplaintHistory: TUniQuery
    Connection = ucENTCAD
    SQL.Strings = (
      'with ctx as ('
      '  select'
      '    ca.agency,'
      '    a.strnumber,'
      '    a.strhnumber,'
      '    a.strprefix,'
      '    a.strname,'
      '    a.strsuffix,'
      '    a.city'
      '  from complaint_active ca'
      '  left join address a on ca.addressid = a.addressid'
      '  where ca.complaintid = :COMPLAINTID'
      ')'
      'select'
      '  c.complaintid,'
      '  c.complaint,'
      '  c.apartment,'
      '  c.datereported,'
      '  cp.code_desc as dpriority,'
      '  cdc.code_desc as dcalltype'
      'from complaint_archive c'
      'join ctx on 1 = 1'
      'left join cd_callpriorities cp on c.priority = cp.code'
      'left join cd_dispatchcodes cdc on c.dispatchcode = cdc.code'
      'where c.agency = ctx.agency'
      'and ('
      '  (ctx.strnumber is null and c.strnumber is null)'
      '  or (ctx.strnumber is not null and c.strnumber = ctx.strnumber)'
      ')'
      'and (ctx.strhnumber is null or c.strhnumber = ctx.strhnumber)'
      'and (ctx.strprefix is null or c.strprefix = ctx.strprefix)'
      'and (ctx.strname is null or c.strname = ctx.strname)'
      'and (ctx.strsuffix is null or c.strsuffix = ctx.strsuffix)'
      'and (ctx.city is null or c.city = ctx.city)'
      'order by c.datereported desc')
    ReadOnly = True
    Left = 330
    Top = 72
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'COMPLAINTID'
        Value = Null
      end>
    object uqComplaintHistoryCOMPLAINTID: TFloatField
      FieldName = 'COMPLAINTID'
      Required = True
    end
    object uqComplaintHistoryCOMPLAINT: TStringField
      FieldName = 'COMPLAINT'
      Size = 10
    end
    object uqComplaintHistoryAPARTMENT: TStringField
      FieldName = 'APARTMENT'
      Size = 6
    end
    object uqComplaintHistoryDATEREPORTED: TDateTimeField
      FieldName = 'DATEREPORTED'
    end
    object uqComplaintHistoryDPRIORITY: TStringField
      FieldName = 'DPRIORITY'
      ReadOnly = True
      Size = 120
    end
    object uqComplaintHistoryDCALLTYPE: TStringField
      FieldName = 'DCALLTYPE'
      ReadOnly = True
      Size = 60
    end
  end
  object uqComplaintContacts: TUniQuery
    Connection = ucENTCAD
    SQL.Strings = (
      'with ctx as ('
      '  select ca.addressid'
      '  from complaint_active ca'
      '  where ca.complaintid = :COMPLAINTID'
      ')'
      'select'
      '  c.name,'
      '  c.phone,'
      '  ct.code_desc as dcontacttype,'
      '  c.remarks'
      'from dis_contact c'
      'join ctx on c.addressid = ctx.addressid'
      'left join cd_contact_type ct on c.contact_type = ct.code')
    ReadOnly = True
    Left = 330
    Top = 130
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'COMPLAINTID'
        Value = nil
      end>
  end
  object uqComplaintWarnings: TUniQuery
    Connection = ucENTCAD
    SQL.Strings = (
      'with ctx as ('
      '  select ca.agency, ca.addressid'
      '  from complaint_active ca'
      '  where ca.complaintid = :COMPLAINTID'
      '),'
      'sys as ('
      '  select s.warningdistance'
      '  from system s'
      '  join ctx on s.agency = ctx.agency'
      '),'
      'adr as ('
      '  select a.xcoord, a.ycoord'
      '  from address a'
      '  join ctx on a.addressid = ctx.addressid'
      ')'
      'select'
      '  wt.code_desc,'
      '  trim('
      '    nvl(a.strnumber, '#39#39') || '#39' '#39' ||'
      '    nvl(a.strhnumber, '#39#39') || '#39' '#39' ||'
      '    nvl(a.strprefix, '#39#39') || '#39' '#39' ||'
      '    nvl(a.strname, '#39#39') || '#39' '#39' ||'
      '    nvl(a.strsuffix, '#39#39') ||'
      
        '    case when a.apartment is not null then '#39' '#39' || a.apartment el' +
        'se '#39#39' end ||'
      '    case when a.city is not null then '#39', '#39' || a.city else '#39#39' end'
      '  ) as address_text,'
      '  case'
      
        '    when w.addressid <> (select addressid from ctx) then '#39'[SECON' +
        'DARY ADDRESS] - '#39' || nvl(w.notes, '#39#39')'
      '    else nvl(w.notes, '#39#39')'
      '  end as notes,'
      
        '  abs(sqrt(power(a.xcoord - (select xcoord from adr), 2) + power' +
        '(a.ycoord - (select ycoord from adr), 2))) as distance'
      'from dis_warning w'
      'join cd_warningtype wt on w.code = wt.code'
      'join address a on w.addressid = a.addressid'
      'where w.status = 1'
      'and ('
      '  a.addressid = (select addressid from ctx)'
      '  or ('
      '    (select xcoord from adr) > 0'
      '    and (select ycoord from adr) > 0'
      '    and nvl((select warningdistance from sys), 0) > 0'
      
        '    and a.xcoord between (select xcoord from adr) - (select warn' +
        'ingdistance from sys)'
      
        '                   and (select xcoord from adr) + (select warnin' +
        'gdistance from sys)'
      
        '    and a.ycoord between (select ycoord from adr) - (select warn' +
        'ingdistance from sys)'
      
        '                   and (select ycoord from adr) + (select warnin' +
        'gdistance from sys)'
      '  )'
      ')'
      'order by'
      '  distance,'
      '  decode(w.code, '#39'POL'#39', 1, '#39'FIR'#39', 2, 3),'
      '  wt.code_desc')
    ReadOnly = True
    Left = 488
    Top = 76
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'COMPLAINTID'
        Value = nil
      end>
  end
  object uqUnitDetails: TUniQuery
    Connection = ucENTCAD
    SQL.Strings = (
      'SELECT'
      '  dua.UNITID,'
      '  dua.UNITNAME,'
      '  cun.CODE_DESC AS CARNUMBER_DESC,'
      '  cd.CODE_DESC AS DISTRICT_DESC,'
      '  ca.LOCATION,'
      '  cus.CODE_DESC AS UNIT_STATUS_DESC,'
      '  p1.PF_LNAME AS OFFICER1_LNAME,'
      '  p1.PF_FNAME AS OFFICER1_FNAME,'
      '  p1.PF_EMPNUM AS OFFICER1_EMPNUM,'
      '  p2.PF_LNAME AS OFFICER2_LNAME,'
      '  p2.PF_FNAME AS OFFICER2_FNAME,'
      '  p2.PF_EMPNUM AS OFFICER2_EMPNUM,'
      '  uc.UPDATETIME AS UPDATE_TIME'
      'FROM DIS_UNITS_ACTIVE dua'
      'LEFT JOIN CD_UNIT_NUMBER cun ON cun.AGENCYCODE = dua.CARNUMBER'
      'LEFT JOIN CD_DISTRICT cd ON cd.AGENCYCODE = dua.DISTRICT'
      'LEFT JOIN CFS_ACTIVE ca ON dua.UNITID = ca.UNITID'
      'LEFT JOIN CD_UNITSTATUS cus ON ca.UNITSTATUS = cus.CODE'
      'LEFT JOIN PERSONNEL p1 ON dua.OFFICER1ID = p1.PF_NAMEID'
      'LEFT JOIN PERSONNEL p2 ON dua.OFFICER2ID = p2.PF_NAMEID'
      'LEFT JOIN UNITS_CURRENT@AVL_LINK uc ON dua.UNITID = uc.UNITID'
      'WHERE dua.UNITID = :UNITID')
    ReadOnly = True
    Left = 194
    Top = 312
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'UNITID'
        Value = nil
      end>
    object uqUnitDetailsUNITID: TFloatField
      FieldName = 'UNITID'
    end
    object uqUnitDetailsUNITNAME: TStringField
      FieldName = 'UNITNAME'
      Size = 10
    end
    object uqUnitDetailsCARNUMBER_DESC: TStringField
      FieldName = 'CARNUMBER_DESC'
      ReadOnly = True
      Size = 120
    end
    object uqUnitDetailsDISTRICT_DESC: TStringField
      FieldName = 'DISTRICT_DESC'
      ReadOnly = True
      Size = 120
    end
    object uqUnitDetailsLOCATION: TStringField
      FieldName = 'LOCATION'
      ReadOnly = True
      Size = 30
    end
    object uqUnitDetailsUNIT_STATUS_DESC: TStringField
      FieldName = 'UNIT_STATUS_DESC'
      ReadOnly = True
    end
    object uqUnitDetailsOFFICER1_LNAME: TStringField
      FieldName = 'OFFICER1_LNAME'
      ReadOnly = True
      Size = 45
    end
    object uqUnitDetailsOFFICER1_FNAME: TStringField
      FieldName = 'OFFICER1_FNAME'
      ReadOnly = True
      Size = 30
    end
    object uqUnitDetailsOFFICER1_EMPNUM: TStringField
      FieldName = 'OFFICER1_EMPNUM'
      ReadOnly = True
      Size = 10
    end
    object uqUnitDetailsOFFICER2_LNAME: TStringField
      FieldName = 'OFFICER2_LNAME'
      ReadOnly = True
      Size = 45
    end
    object uqUnitDetailsOFFICER2_FNAME: TStringField
      FieldName = 'OFFICER2_FNAME'
      ReadOnly = True
      Size = 30
    end
    object uqUnitDetailsOFFICER2_EMPNUM: TStringField
      FieldName = 'OFFICER2_EMPNUM'
      ReadOnly = True
      Size = 10
    end
    object uqUnitDetailsUPDATE_TIME: TDateTimeField
      FieldName = 'UPDATE_TIME'
      ReadOnly = True
    end
  end
  object uqUnitLogs: TUniQuery
    Connection = ucENTCAD
    SQL.Strings = (
      'select'
      '  dul."TIMESTAMP" as LOG_TIME,'
      '  dul.COMPLAINT as COMPLAINT_NUM,'
      '  dul.LOG as LOG_TEXT'
      'from ENTCAD.DIS_UNIT_LOG dul'
      'where dul.UNITID = :UNITID'
      'order by dul."TIMESTAMP" desc')
    ReadOnly = True
    Left = 190
    Top = 374
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'UNITID'
        Value = nil
      end>
    object uqUnitLogsLOG_TIME: TDateTimeField
      FieldName = 'LOG_TIME'
    end
    object uqUnitLogsCOMPLAINT_NUM: TStringField
      FieldName = 'COMPLAINT_NUM'
      Size = 10
    end
    object uqUnitLogsLOG_TEXT: TStringField
      FieldName = 'LOG_TEXT'
      Size = 2000
    end
  end
end
