object srvMedicacion: TsrvMedicacion
  OldCreateOrder = True
  OnCreate = DARemoteServiceCreate
  ConnectionName = 'IBX'
  ServiceSchema = schMedicacion
  ServiceDataStreamer = Bin2DataStreamer
  ExportedDataTables = <>
  Height = 209
  Width = 347
  object schMedicacion: TDASchema
    ConnectionManager = dmServer.ConnectionManager
    DataDictionary = DADataDictionary
    Datasets = <
      item
        Params = <>
        Statements = <
          item
            Connection = 'IBX'
            Default = True
            TargetTable = 'V_MEDICACION'
            StatementType = stAutoSQL
            ColumnMappings = <
              item
                DatasetField = 'ID'
                TableField = 'ID'
              end
              item
                DatasetField = 'ID_PACIENTE'
                TableField = 'ID_PACIENTE'
              end
              item
                DatasetField = 'REFERENCIA'
                TableField = 'REFERENCIA'
              end
              item
                DatasetField = 'NOMBRE'
                TableField = 'NOMBRE'
              end
              item
                DatasetField = 'FECHA_DESDE'
                TableField = 'FECHA_DESDE'
              end
              item
                DatasetField = 'FECHA_HASTA'
                TableField = 'FECHA_HASTA'
              end
              item
                DatasetField = 'TIPO'
                TableField = 'TIPO'
              end
              item
                DatasetField = 'NUMERO_SS'
                TableField = 'NUMERO_SS'
              end>
          end>
        Name = 'Medicacion'
        Fields = <
          item
            Name = 'ID'
            DataType = datAutoInc
            GeneratorName = 'GEN_MEDICACION_ID'
            ServerAutoRefresh = True
            DictionaryEntry = 'Medicacion_ID'
            InPrimaryKey = True
          end
          item
            Name = 'ID_PACIENTE'
            DataType = datInteger
            DictionaryEntry = 'Medicacion_ID_PACIENTE'
          end
          item
            Name = 'REFERENCIA'
            DataType = datString
            Size = 255
            DictionaryEntry = 'Medicacion_REFERENCIA'
          end
          item
            Name = 'NOMBRE'
            DataType = datString
            Size = 255
            ServerAutoRefresh = True
            DictionaryEntry = 'Medicacion_NOMBRE'
          end
          item
            Name = 'FECHA_DESDE'
            DataType = datDateTime
            DictionaryEntry = 'Medicacion_FECHA_DESDE'
          end
          item
            Name = 'FECHA_HASTA'
            DataType = datDateTime
            DictionaryEntry = 'Medicacion_FECHA_HASTA'
          end
          item
            Name = 'TIPO'
            DataType = datString
            Size = 1
            DictionaryEntry = 'Medicacion_TIPO'
          end
          item
            Name = 'NUMERO_SS'
            DataType = datString
            Size = 255
            ServerAutoRefresh = True
            DictionaryEntry = 'Medicacion_NUMERO_SS'
          end>
      end
      item
        Params = <>
        Statements = <
          item
            Connection = 'IBX'
            TargetTable = 'MEDICACION_DETALLES'
            StatementType = stAutoSQL
            ColumnMappings = <
              item
                DatasetField = 'ID'
                TableField = 'ID'
              end
              item
                DatasetField = 'ID_MEDICACION'
                TableField = 'ID_MEDICACION'
              end
              item
                DatasetField = 'POSICION'
                TableField = 'POSICION'
              end
              item
                DatasetField = 'TIPO_DETALLE'
                TableField = 'TIPO_DETALLE'
              end
              item
                DatasetField = 'ID_ARTICULO'
                TableField = 'ID_ARTICULO'
              end
              item
                DatasetField = 'REFERENCIA'
                TableField = 'REFERENCIA'
              end
              item
                DatasetField = 'CONCEPTO'
                TableField = 'CONCEPTO'
              end
              item
                DatasetField = 'CANTIDAD'
                TableField = 'CANTIDAD'
              end
              item
                DatasetField = 'POSOLOGIA'
                TableField = 'POSOLOGIA'
              end
              item
                DatasetField = 'FORMA_COLOR'
                TableField = 'FORMA_COLOR'
              end
              item
                DatasetField = 'LOTE'
                TableField = 'LOTE'
              end
              item
                DatasetField = 'VISIBLE'
                TableField = 'VISIBLE'
              end>
          end>
        Name = 'Medicacion_Detalles'
        Fields = <
          item
            Name = 'ID'
            DataType = datAutoInc
            GeneratorName = 'GEN_MEDICACION_DETALLES_ID'
            ServerAutoRefresh = True
            DictionaryEntry = 'Medicacion_Detalles_ID'
            InPrimaryKey = True
          end
          item
            Name = 'ID_MEDICACION'
            DataType = datInteger
            DictionaryEntry = 'Medicacion_Detalles_ID_MEDICACION'
          end
          item
            Name = 'POSICION'
            DataType = datInteger
            DictionaryEntry = 'Medicacion_Detalles_POSICION'
          end
          item
            Name = 'TIPO_DETALLE'
            DataType = datString
            Size = 25
            DictionaryEntry = 'Medicacion_Detalles_TIPO_DETALLE'
          end
          item
            Name = 'ID_ARTICULO'
            DataType = datInteger
            DictionaryEntry = 'Medicacion_Detalles_ID_ARTICULO'
          end
          item
            Name = 'REFERENCIA'
            DataType = datString
            Size = 255
            DictionaryEntry = 'Medicacion_Detalles_REFERENCIA'
          end
          item
            Name = 'CONCEPTO'
            DataType = datString
            Size = 2000
            DictionaryEntry = 'Medicacion_Detalles_CONCEPTO'
          end
          item
            Name = 'CANTIDAD'
            DataType = datCurrency
            DictionaryEntry = 'Medicacion_Detalles_CANTIDAD'
          end
          item
            Name = 'POSOLOGIA'
            DataType = datString
            Size = 255
            DictionaryEntry = 'Medicacion_Detalles_POSOLOGIA'
          end
          item
            Name = 'FORMA_COLOR'
            DataType = datString
            Size = 255
            DictionaryEntry = 'Medicacion_Detalles_FORMA_COLOR'
          end
          item
            Name = 'LOTE'
            DataType = datString
            Size = 255
            DictionaryEntry = 'Medicacion_Detalles_LOTE'
          end
          item
            Name = 'VISIBLE'
            DataType = datSmallInt
            DictionaryEntry = 'Medicacion_Detalles_VISIBLE'
          end>
      end>
    JoinDataTables = <>
    UnionDataTables = <>
    Commands = <
      item
        Params = <
          item
            Name = 'OLD_ID'
            Value = ''
          end>
        Statements = <
          item
            Connection = 'IBX'
            Default = True
            TargetTable = 'MEDICACION'
            SQL = 'DELETE '#10'  FROM'#10'    MEDICACION'#10'  WHERE'#10'    (ID = :OLD_ID)'#10
            StatementType = stSQL
            ColumnMappings = <>
          end>
        Name = 'Delete_Medicacion'
      end
      item
        Params = <
          item
            Name = 'ID'
            DataType = datAutoInc
            GeneratorName = 'GEN_MEDICACION_ID'
            Value = ''
          end
          item
            Name = 'ID_PACIENTE'
            DataType = datInteger
            Value = ''
          end
          item
            Name = 'REFERENCIA'
            DataType = datString
            Size = 255
            Value = ''
          end
          item
            Name = 'FECHA_DESDE'
            DataType = datDateTime
            Value = ''
          end
          item
            Name = 'FECHA_HASTA'
            DataType = datDateTime
            Value = ''
          end
          item
            Name = 'TIPO'
            DataType = datString
            Size = 255
            Value = ''
          end>
        Statements = <
          item
            Connection = 'IBX'
            Default = True
            TargetTable = 'MEDICACION'
            SQL = 
              'INSERT'#10'  INTO MEDICACION'#10'    (ID, ID_PACIENTE, REFERENCIA, FECHA' +
              '_DESDE, FECHA_HASTA, TIPO)'#10'  VALUES'#10'    (:ID, :ID_PACIENTE, :REF' +
              'ERENCIA, :FECHA_DESDE, :FECHA_HASTA, :TIPO)'#10
            StatementType = stSQL
            ColumnMappings = <>
          end>
        Name = 'Insert_Medicacion'
      end
      item
        Params = <
          item
            Name = 'ID_PACIENTE'
            DataType = datInteger
            Value = ''
          end
          item
            Name = 'REFERENCIA'
            DataType = datString
            Size = 255
            Value = ''
          end
          item
            Name = 'FECHA_DESDE'
            DataType = datDateTime
            Value = ''
          end
          item
            Name = 'FECHA_HASTA'
            DataType = datDateTime
            Value = ''
          end
          item
            Name = 'OLD_ID'
            Value = ''
          end>
        Statements = <
          item
            Connection = 'IBX'
            Default = True
            TargetTable = 'MEDICACION'
            SQL = 
              'UPDATE MEDICACION'#10'  SET '#10'    ID_PACIENTE = :ID_PACIENTE, '#10'    RE' +
              'FERENCIA = :REFERENCIA, '#10'    FECHA_DESDE = :FECHA_DESDE,'#10'    FEC' +
              'HA_HASTA = :FECHA_HASTA'#10'  WHERE'#10'    (ID = :OLD_ID)'#10
            StatementType = stSQL
            ColumnMappings = <>
          end>
        Name = 'Update_Medicacion'
      end
      item
        Params = <
          item
            Name = 'ID'
            DataType = datAutoInc
            GeneratorName = 'GEN_MEDICACION_DETALLES_ID'
            Value = ''
          end
          item
            Name = 'ID_MEDICACION'
            DataType = datInteger
            Value = ''
          end
          item
            Name = 'POSICION'
            DataType = datInteger
            Value = ''
          end
          item
            Name = 'TIPO_DETALLE'
            DataType = datString
            Size = 25
            Value = ''
          end
          item
            Name = 'ID_ARTICULO'
            DataType = datInteger
            Value = ''
          end
          item
            Name = 'REFERENCIA'
            DataType = datString
            Size = 255
            Value = ''
          end
          item
            Name = 'CONCEPTO'
            DataType = datString
            Size = 2000
            Value = ''
          end
          item
            Name = 'CANTIDAD'
            DataType = datCurrency
            Value = ''
          end
          item
            Name = 'POSOLOGIA'
            DataType = datString
            Size = 255
            Value = ''
          end
          item
            Name = 'FORMA_COLOR'
            DataType = datString
            Size = 255
            Value = ''
          end
          item
            Name = 'LOTE'
            DataType = datString
            Size = 255
            Value = ''
          end
          item
            Name = 'VISIBLE'
            DataType = datSmallInt
            Value = ''
          end>
        Statements = <
          item
            Connection = 'IBX'
            Default = True
            TargetTable = 'MEDICACION_DETALLES'
            SQL = 
              'INSERT'#10'  INTO MEDICACION_DETALLES'#10'    (ID, ID_MEDICACION, POSICI' +
              'ON, TIPO_DETALLE, ID_ARTICULO, '#10'     REFERENCIA, CONCEPTO, CANTI' +
              'DAD, POSOLOGIA, FORMA_COLOR, '#10'     LOTE, VISIBLE)'#10'  VALUES'#10'    (' +
              ':ID, :ID_MEDICACION, :POSICION, :TIPO_DETALLE, :ID_ARTICULO, '#10'  ' +
              '   :REFERENCIA, :CONCEPTO, :CANTIDAD, :POSOLOGIA, :FORMA_COLOR, ' +
              #10'     :LOTE, :VISIBLE)'
            StatementType = stSQL
            ColumnMappings = <>
          end>
        Name = 'Insert_Medicacion_Detalles'
      end
      item
        Params = <
          item
            Name = 'OLD_ID'
            DataType = datInteger
            Value = ''
          end>
        Statements = <
          item
            Connection = 'IBX'
            Default = True
            TargetTable = 'MEDICACION_DETALLES'
            SQL = 
              'DELETE '#10'  FROM'#10'    MEDICACION_DETALLES'#10'  WHERE'#10'    (ID = :OLD_ID' +
              ')'
            StatementType = stSQL
            ColumnMappings = <>
          end>
        Name = 'Delete_Medicacion_Detalles'
      end
      item
        Params = <
          item
            Name = 'ID'
            DataType = datInteger
            Value = ''
          end
          item
            Name = 'ID_MEDICACION'
            DataType = datInteger
            Value = ''
          end
          item
            Name = 'POSICION'
            DataType = datInteger
            Value = ''
          end
          item
            Name = 'TIPO_DETALLE'
            DataType = datString
            Size = 25
            Value = ''
          end
          item
            Name = 'ID_ARTICULO'
            DataType = datInteger
            Value = ''
          end
          item
            Name = 'REFERENCIA'
            DataType = datString
            Size = 255
            Value = ''
          end
          item
            Name = 'CONCEPTO'
            DataType = datString
            Size = 2000
            Value = ''
          end
          item
            Name = 'CANTIDAD'
            DataType = datCurrency
            Value = ''
          end
          item
            Name = 'POSOLOGIA'
            DataType = datString
            Size = 255
            Value = ''
          end
          item
            Name = 'FORMA_COLOR'
            DataType = datString
            Size = 255
            Value = ''
          end
          item
            Name = 'LOTE'
            DataType = datString
            Size = 255
            Value = ''
          end
          item
            Name = 'VISIBLE'
            DataType = datSmallInt
            Value = ''
          end
          item
            Name = 'OLD_ID'
            Value = ''
          end>
        Statements = <
          item
            Connection = 'IBX'
            Default = True
            TargetTable = 'MEDICACION_DETALLES'
            SQL = 
              'UPDATE MEDICACION_DETALLES'#10'  SET '#10'    ID = :ID,'#10'    ID_MEDICACIO' +
              'N = :ID_MEDICACION,'#10'    POSICION = :POSICION, '#10'    TIPO_DETALLE ' +
              '= :TIPO_DETALLE, '#10'    ID_ARTICULO = :ID_ARTICULO, '#10'    REFERENCI' +
              'A = :REFERENCIA, '#10'    CONCEPTO = :CONCEPTO, '#10'    CANTIDAD = :CAN' +
              'TIDAD, '#10'    POSOLOGIA = :POSOLOGIA, '#10'    FORMA_COLOR = :FORMA_CO' +
              'LOR, '#10'    LOTE = :LOTE, '#10'    VISIBLE = :VISIBLE'#10'  WHERE'#10'    (ID ' +
              '= :OLD_ID)'#10
            StatementType = stSQL
            ColumnMappings = <>
          end>
        Name = 'Update_Medicacion_Detalles'
      end>
    RelationShips = <
      item
        Name = 'FK_Medicacion_Detalles'
        MasterDatasetName = 'Medicacion'
        MasterFields = 'ID'
        DetailDatasetName = 'Medicacion_Detalles'
        DetailFields = 'ID_MEDICACION'
        RelationshipType = rtForeignKey
      end>
    UpdateRules = <
      item
        Name = 'Insert Medicacion'
        DoUpdate = False
        DoDelete = False
        DatasetName = 'Medicacion'
        FailureBehavior = fbRaiseException
      end
      item
        Name = 'Insert Medicacion_Detalles'
        DoUpdate = False
        DoDelete = False
        DatasetName = 'Medicacion_Detalles'
        FailureBehavior = fbRaiseException
      end
      item
        Name = 'Update Medicacion'
        DoInsert = False
        DoDelete = False
        DatasetName = 'Medicacion'
        FailureBehavior = fbRaiseException
      end
      item
        Name = 'Update Medicacion_Detalles'
        DoInsert = False
        DoDelete = False
        DatasetName = 'Medicacion_Detalles'
        FailureBehavior = fbRaiseException
      end
      item
        Name = 'Delete Medicacion_Detalles'
        DoUpdate = False
        DoInsert = False
        DatasetName = 'Medicacion_Detalles'
        FailureBehavior = fbRaiseException
      end
      item
        Name = 'Delete Medicacion'
        DoUpdate = False
        DoInsert = False
        DatasetName = 'Medicacion'
        FailureBehavior = fbRaiseException
      end>
    Version = 0
    Left = 56
    Top = 24
  end
  object bpMedicacion: TDABusinessProcessor
    Schema = schMedicacion
    InsertCommandName = 'Insert_Medicacion'
    DeleteCommandName = 'Delete_Medicacion'
    UpdateCommandName = 'Update_Medicacion'
    ReferencedDataset = 'Medicacion'
    ProcessorOptions = [poAutoGenerateRefreshDataset, poPrepareCommands]
    UpdateMode = updWhereKeyOnly
    Left = 224
    Top = 24
  end
  object bpMedicacion_Detalles: TDABusinessProcessor
    Schema = schMedicacion
    InsertCommandName = 'Insert_Medicacion_Detalles'
    DeleteCommandName = 'Delete_Medicacion_Detalles'
    UpdateCommandName = 'Update_Medicacion_Detalles'
    ReferencedDataset = 'Medicacion_Detalles'
    ProcessorOptions = [poAutoGenerateRefreshDataset, poPrepareCommands]
    UpdateMode = updWhereKeyOnly
    Left = 224
    Top = 88
  end
  object DADataDictionary: TDADataDictionary
    Fields = <
      item
        Name = 'Medicacion_ID'
        DataType = datAutoInc
        GeneratorName = 'GEN_MEDICACION_ID'
        Required = True
        DisplayLabel = 'ID'
        ServerAutoRefresh = True
      end
      item
        Name = 'Medicacion_ID_PACIENTE'
        DataType = datInteger
        DisplayLabel = 'ID_PACIENTE'
      end
      item
        Name = 'Medicacion_NOMBRE'
        DataType = datString
        Size = 255
        DisplayLabel = 'Nombre del paciente'
      end
      item
        Name = 'Medicacion_FECHA_HASTA'
        DataType = datDateTime
        DisplayLabel = 'Hasta'
      end
      item
        Name = 'Medicacion_Detalles_ID'
        DataType = datAutoInc
        GeneratorName = 'GEN_MEDICACION_DETALLES_ID'
        Required = True
        DisplayLabel = 'ID'
        ServerAutoRefresh = True
      end
      item
        Name = 'Medicacion_FECHA_DESDE'
        DataType = datDateTime
        DisplayLabel = 'Desde'
      end
      item
        Name = 'Medicacion_ID_MEDICACION'
        DataType = datInteger
        DisplayLabel = 'ID_MEDICACION'
      end
      item
        Name = 'Medicacion_REFERENCIA'
        DataType = datString
        Size = 255
        DisplayLabel = 'Referencia'
        ServerAutoRefresh = True
      end
      item
        Name = 'Medicacion_TIPO'
        DataType = datString
        Size = 1
        DisplayLabel = 'Tipo'
      end
      item
        Name = 'Medicacion_NUMERO_SS'
        DataType = datString
        Size = 255
        DisplayLabel = 'N'#250'mero SS'
      end
      item
        Name = 'Medicacion_Detalles_ID_MEDICACION'
        DataType = datInteger
        Required = True
      end
      item
        Name = 'Medicacion_Detalles_POSICION'
        DataType = datInteger
      end
      item
        Name = 'Medicacion_Detalles_TIPO_DETALLE'
        DataType = datString
        Size = 25
      end
      item
        Name = 'Medicacion_Detalles_ID_ARTICULO'
        DataType = datInteger
      end
      item
        Name = 'Medicacion_Detalles_REFERENCIA'
        DataType = datString
        Size = 255
        DisplayLabel = 'Referencia'
      end
      item
        Name = 'Medicacion_Detalles_CONCEPTO'
        DataType = datString
        Size = 2000
      end
      item
        Name = 'Medicacion_Detalles_CANTIDAD'
        DataType = datCurrency
      end
      item
        Name = 'Medicacion_Detalles_POSOLOGIA'
        DataType = datString
        Size = 255
        DisplayLabel = 'Posolog'#237'a'
      end
      item
        Name = 'Medicacion_Detalles_FORMA_COLOR'
        DataType = datString
        Size = 255
        DisplayLabel = 'Forma y color'
      end
      item
        Name = 'Medicacion_Detalles_LOTE'
        DataType = datString
        Size = 255
        DisplayLabel = 'Lote'
      end
      item
        Name = 'Medicacion_Detalles_VISIBLE'
        DataType = datSmallInt
      end>
    Left = 56
    Top = 144
  end
  object Bin2DataStreamer: TDABin2DataStreamer
    Left = 56
    Top = 80
  end
end
