object srvReferenciaGenerica: TsrvReferenciaGenerica
  OldCreateOrder = True
  OnCreate = DARemoteServiceCreate
  SessionManager = dmServer.SessionManager
  AcquireConnection = True
  ServiceSchema = schReferenciaGenerica
  ServiceAdapter = DABINAdapter
  OnAfterProcessTransactionAction = pptaNone
  ExportedDataTables = <>
  CacheElements = <>
  Options = [rsoProcessDeltasWithoutUpdateRules]
  Height = 362
  Width = 469
  object schReferenciaGenerica: TDASchema
    ConnectionManager = dmServer.ConnectionManager
    DataDictionary = dmServer.DataDictionary
    Diagrams = dmServer.DADiagrams
    Datasets = <
      item
        Params = <
          item
            Name = 'NUMINF'
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'CLAVE1'
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'CLAVE2'
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'CLAVE3'
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'NUMCON'
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end>
        Statements = <
          item
            Connection = 'GFT_VARELA'
            SQL = 
              'SELECT NUMINF, CLAVE1, CLAVE2, CLAVE3, NUMCON'#10'FROM RDX_REFERENCI' +
              'A_GENERICA'#10'WHERE NUMINF = :NUMINF AND'#10'      CLAVE1 = :CLAVE1 AND' +
              #10'      CLAVE2 = :CLAVE2 AND'#10'      CLAVE3 = :CLAVE3 AND'#10'      NUM' +
              'CON = :NUMCON'
            StatementType = stSQL
            ColumnMappings = <
              item
                DatasetField = 'NUMINF'
                TableField = 'NUMINF'
              end
              item
                DatasetField = 'CLAVE1'
                TableField = 'CLAVE1'
              end
              item
                DatasetField = 'CLAVE2'
                TableField = 'CLAVE2'
              end
              item
                DatasetField = 'CLAVE3'
                TableField = 'CLAVE3'
              end
              item
                DatasetField = 'NUMCON'
                TableField = 'NUMCON'
              end>
          end>
        Name = '_ExisteFilaReferenciaGenerica'
        Fields = <
          item
            Name = 'NUMINF'
            DataType = datString
            Size = 35
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'CLAVE1'
            DataType = datFloat
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'CLAVE2'
            DataType = datInteger
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'CLAVE3'
            DataType = datInteger
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'NUMCON'
            DataType = datInteger
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end>
        BusinessRulesClient.ScriptLanguage = rslPascalScript
        BusinessRulesServer.ScriptLanguage = rslPascalScript
      end
      item
        Params = <>
        Statements = <
          item
            Connection = 'GFT_VARELA'
            SQL = 
              'SELECT'#10'       CODCENTRO,'#10'       CENTRO = CASE WHEN (CODCENTRO = ' +
              'CENTRO) THEN'#10'                       CENTRO'#10'                  ELS' +
              'E'#10'                      CODCENTRO + '#39' - '#39' + CENTRO'#10'             ' +
              '     END,'#10'       CODVENDEDOR,'#10'       VENDEDOR = CASE WHEN (CODVE' +
              'NDEDOR = VENDEDOR) THEN'#10'                       VENDEDOR'#10'        ' +
              '          ELSE'#10'                      CODVENDEDOR + '#39' - '#39' + VENDE' +
              'DOR'#10'                  END,'#10'       FECHA,'#10'       NUMTALON,'#10'      ' +
              ' CANTIDAD ='#10'           CASE WHEN (VTAPROCESO <> 0) THEN'#10'        ' +
              '        REPLACE(CAST(VTAPROCESO AS VARCHAR), '#39'.000'#39', '#39#39') + '#39' (ve' +
              'nta proceso)'#39#10'           ELSE'#10'               CASE WHEN (VTAFINAL' +
              ' <> 0) THEN'#10'                    REPLACE(CAST(VTAFINAL AS VARCHAR' +
              '), '#39'.000'#39', '#39#39') + '#39' (venta final/resc.)'#39#10'               ELSE'#10'    ' +
              '               CASE WHEN (VTATERM <> 0) THEN'#10'                   ' +
              '     REPLACE(CAST(VTATERM AS VARCHAR), '#39'.000'#39', '#39#39') + '#39' (venta te' +
              'rm./dev.)'#39#10'                   ELSE'#10'                       '#39'0'#39#10'  ' +
              '                 END'#10'               END'#10'           END,'#10'  VALTOT' +
              #10'FROM RDX_V_REFERENCIA_GENERICA'#10'ORDER BY CENTRO, VENDEDOR, FECHA'
            StatementType = stSQL
            ColumnMappings = <
              item
                DatasetField = 'CENTRO'
                TableField = 'CENTRO'
              end
              item
                DatasetField = 'VENDEDOR'
                TableField = 'VENDEDOR'
              end
              item
                DatasetField = 'FECHA'
                TableField = 'FECHA'
              end
              item
                DatasetField = 'NUMTALON'
                TableField = 'NUMTALON'
              end
              item
                DatasetField = 'VALTOT'
                TableField = 'VALTOT'
              end
              item
                DatasetField = 'CANTIDAD'
                TableField = 'CANTIDAD'
              end
              item
                DatasetField = 'CODCENTRO'
                TableField = 'CODCENTRO'
              end
              item
                DatasetField = 'CODVENDEDOR'
                TableField = 'CODVENDEDOR'
              end>
          end>
        Name = 'InformeRefGenerica'
        Fields = <
          item
            Name = 'CODCENTRO'
            DataType = datString
            Size = 17
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'CENTRO'
            DataType = datString
            Size = 255
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'CODVENDEDOR'
            DataType = datString
            Size = 17
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'VENDEDOR'
            DataType = datString
            Size = 255
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'FECHA'
            DataType = datDateTime
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'NUMTALON'
            DataType = datString
            Size = 35
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'CANTIDAD'
            DataType = datString
            Size = 8000
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'VALTOT'
            DataType = datFloat
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end>
        BusinessRulesClient.ScriptLanguage = rslPascalScript
        BusinessRulesServer.ScriptLanguage = rslPascalScript
      end
      item
        Params = <
          item
            Name = 'CODIGO'
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'TALLA'
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'COLOR'
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end>
        Statements = <
          item
            Connection = 'GFT_VARELA'
            SQL = 
              'SELECT'#10'  PRODUTOS_BARRA.CODIGO_BARRA,'#10'  PRODUTOS_BARRA.COR_PRODU' +
              'TO,'#10'  PRODUTOS.DESC_PRODUTO,'#10'  PRODUTOS.PRODUTO,'#10'  PRODUTOS_BARR' +
              'A.GRADE'#10'FROM'#10'  PRODUTOS'#10'  INNER JOIN PRODUTOS_BARRA ON (PRODUTOS' +
              '.PRODUTO = PRODUTOS_BARRA.PRODUTO)'#10'WHERE PRODUTOS_BARRA.PRODUTO ' +
              '= :CODIGO'#10'AND PRODUTOS_BARRA.GRADE = :TALLA'#10'AND PRODUTOS_BARRA.C' +
              'OR_PRODUTO = :COLOR'
            StatementType = stSQL
            ColumnMappings = <
              item
                DatasetField = 'CODIGO_BARRA'
                TableField = 'CODIGO_BARRA'
              end
              item
                DatasetField = 'COR_PRODUTO'
                TableField = 'COR_PRODUTO'
              end
              item
                DatasetField = 'DESC_PRODUTO'
                TableField = 'DESC_PRODUTO'
              end
              item
                DatasetField = 'PRODUTO'
                TableField = 'PRODUTO'
              end
              item
                DatasetField = 'GRADE'
                TableField = 'GRADE'
              end>
          end>
        Name = 'GetProducto'
        Description = 'Datos de una prenda'
        Fields = <
          item
            Name = 'CODIGO_BARRA'
            DataType = datString
            Size = 25
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'COR_PRODUTO'
            DataType = datString
            Size = 10
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'DESC_PRODUTO'
            DataType = datString
            Size = 40
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'PRODUTO'
            DataType = datString
            Size = 12
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'GRADE'
            DataType = datString
            Size = 8
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end>
        BusinessRulesClient.ScriptLanguage = rslPascalScript
        BusinessRulesServer.ScriptLanguage = rslPascalScript
      end
      item
        Params = <>
        Statements = <
          item
            Connection = 'GFT_VARELA'
            TargetTable = 'RDX_V_REFERENCIA_GENERICA'
            SQL = 
              'SELECT '#10'    NUMINF, CLAVE1, CLAVE2, CLAVE3, NUMCON, FECHA,'#10'    C' +
              'ODCENTRO,'#10'       CENTRO = CASE WHEN (CODCENTRO = CENTRO) THEN'#10'  ' +
              '                     CENTRO'#10'                  ELSE'#10'             ' +
              '         CODCENTRO + '#39' - '#39' + CENTRO'#10'                  END,'#10'    C' +
              'ODVENDEDOR,'#10'       VENDEDOR = CASE WHEN (CODVENDEDOR = VENDEDOR)' +
              ' THEN'#10'                       VENDEDOR'#10'                  ELSE'#10'   ' +
              '                   CODVENDEDOR + '#39' - '#39' + VENDEDOR'#10'              ' +
              '    END,'#10'    NUMTALON, CODIGO_BARRA, CODIGO, PRODUCTO, COLOR, TA' +
              'LLA, VTAPROCESO,'#10'    VTAFINAL, VTATERM, VALTOT, ESTADO, FECHACAM' +
              'BIO'#10'  FROM'#10'    RDX_V_REFERENCIA_GENERICA'#10'ORDER BY CENTRO, VENDED' +
              'OR, FECHA'
            StatementType = stSQL
            ColumnMappings = <
              item
                DatasetField = 'NUMINF'
                TableField = 'NUMINF'
              end
              item
                DatasetField = 'CLAVE1'
                TableField = 'CLAVE1'
              end
              item
                DatasetField = 'CLAVE2'
                TableField = 'CLAVE2'
              end
              item
                DatasetField = 'CLAVE3'
                TableField = 'CLAVE3'
              end
              item
                DatasetField = 'FECHA'
                TableField = 'FECHA'
              end
              item
                DatasetField = 'CODCENTRO'
                TableField = 'CODCENTRO'
              end
              item
                DatasetField = 'CENTRO'
                TableField = 'CENTRO'
              end
              item
                DatasetField = 'CODVENDEDOR'
                TableField = 'CODVENDEDOR'
              end
              item
                DatasetField = 'VENDEDOR'
                TableField = 'VENDEDOR'
              end
              item
                DatasetField = 'NUMTALON'
                TableField = 'NUMTALON'
              end
              item
                DatasetField = 'CODIGO_BARRA'
                TableField = 'CODIGO_BARRA'
              end
              item
                DatasetField = 'CODIGO'
                TableField = 'CODIGO'
              end
              item
                DatasetField = 'PRODUCTO'
                TableField = 'PRODUCTO'
              end
              item
                DatasetField = 'COLOR'
                TableField = 'COLOR'
              end
              item
                DatasetField = 'TALLA'
                TableField = 'TALLA'
              end
              item
                DatasetField = 'VTAPROCESO'
                TableField = 'VTAPROCESO'
              end
              item
                DatasetField = 'VTAFINAL'
                TableField = 'VTAFINAL'
              end
              item
                DatasetField = 'VTATERM'
                TableField = 'VTATERM'
              end
              item
                DatasetField = 'VALTOT'
                TableField = 'VALTOT'
              end
              item
                DatasetField = 'ESTADO'
                TableField = 'ESTADO'
              end
              item
                DatasetField = 'FECHACAMBIO'
                TableField = 'FECHACAMBIO'
              end
              item
                DatasetField = 'NUMCON'
                TableField = 'NUMCON'
              end>
          end>
        Name = 'ReferenciaGenerica'
        Fields = <
          item
            Name = 'NUMINF'
            DataType = datString
            Size = 35
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = True
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'CLAVE1'
            DataType = datFloat
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = True
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'CLAVE2'
            DataType = datInteger
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = True
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'CLAVE3'
            DataType = datInteger
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = True
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'NUMCON'
            DataType = datInteger
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'FECHA'
            DataType = datDateTime
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'CODCENTRO'
            DataType = datString
            Size = 17
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'CENTRO'
            DataType = datString
            Size = 45
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'CODVENDEDOR'
            DataType = datString
            Size = 17
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'VENDEDOR'
            DataType = datString
            Size = 86
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'NUMTALON'
            DataType = datString
            Size = 35
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'CODIGO_BARRA'
            DataType = datString
            Size = 25
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'CODIGO'
            DataType = datString
            Size = 12
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'PRODUCTO'
            DataType = datString
            Size = 40
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'COLOR'
            DataType = datString
            Size = 10
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'TALLA'
            DataType = datString
            Size = 8
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'VTAPROCESO'
            DataType = datFloat
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'VTAFINAL'
            DataType = datFloat
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'VTATERM'
            DataType = datFloat
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'VALTOT'
            DataType = datFloat
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'ESTADO'
            DataType = datString
            Size = 1
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end
          item
            Name = 'FECHACAMBIO'
            DataType = datDateTime
            BlobType = dabtUnknown
            DisplayWidth = 0
            Alignment = taLeftJustify
            InPrimaryKey = False
            Calculated = False
            ServerCalculated = False
            Lookup = False
            LookupCache = False
          end>
        BusinessRulesClient.ScriptLanguage = rslPascalScript
        BusinessRulesServer.ScriptLanguage = rslPascalScript
      end>
    JoinDataTables = <>
    UnionDataTables = <>
    Commands = <
      item
        Params = <
          item
            Name = 'ESTADO'
            DataType = datString
            Size = 1
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'FECHACAMBIO'
            DataType = datDateTime
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'CODIGO_BARRA'
            DataType = datString
            Size = 25
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'VTAPROCESO'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'VTAFINAL'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'VTATERM'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'VALTOT'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'OLD_NUMINF'
            DataType = datString
            Size = 35
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'OLD_CLAVE1'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'OLD_CLAVE2'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'OLD_CLAVE3'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'OLD_NUMCON'
            DataType = datInteger
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end>
        Statements = <
          item
            Connection = 'GFT_VARELA'
            TargetTable = 'RDX_REFERENCIA_GENERICA'
            SQL = 
              'UPDATE RDX_REFERENCIA_GENERICA'#10'  SET '#10'    ESTADO = :ESTADO,'#10'    ' +
              'FECHACAMBIO = :FECHACAMBIO,'#10'    CODIGO_BARRA = :CODIGO_BARRA,'#10'  ' +
              '  CANESP = :VTAPROCESO,'#10'    CANVENNET = :VTAFINAL,'#10'    CANVEN = ' +
              ':VTATERM,'#10'    VALVEN = :VALTOT'#10'  WHERE'#10'    (NUMINF = :OLD_NUMINF' +
              ') AND'#10'    (CLAVE1 = :OLD_CLAVE1) AND'#10'    (CLAVE2 = :OLD_CLAVE2) ' +
              'AND'#10'    (CLAVE3 = :OLD_CLAVE3) AND'#10'    (NUMCON = :OLD_NUMCON)'
            StatementType = stSQL
            ColumnMappings = <>
          end>
        Name = 'Update_ReferenciaGenerica'
      end
      item
        Params = <
          item
            Name = 'ESTADO'
            DataType = datString
            Size = 1
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end>
        Statements = <
          item
            Connection = 'GFT_VARELA'
            TargetTable = 'RDX_REFERENCIA_GENERICA'
            SQL = 
              'INSERT INTO RDX_REFERENCIA_GENERICA'#10'(NUMINF, CLAVE1, CLAVE2, CLA' +
              'VE3, ENESPERA, FECHACAMBIO)'#10'SELECT V.NUMINF, V.CLAVE1, V.CLAVE2,' +
              ' V.CLAVE3, :ESTADO, CURRENT_TIMESTAMP'#10'FROM RDX_V_REFERENCIA_GENE' +
              'RICA V'
            StatementType = stSQL
            ColumnMappings = <>
          end>
        Name = 'CambiarEstado'
      end
      item
        Params = <
          item
            Name = 'NUMINF'
            DataType = datString
            Size = 35
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'CLAVE1'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'CLAVE2'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'CLAVE3'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'ESTADO'
            DataType = datString
            Size = 1
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'FECHACAMBIO'
            DataType = datDateTime
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'CODIGO_BARRA'
            DataType = datString
            Size = 25
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'VTATERM'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'VTAPROCESO'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'VTAFINAL'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'VALTOT'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end>
        Statements = <
          item
            Connection = 'GFT_VARELA'
            TargetTable = 'RDX_REFERENCIA_GENERICA'
            SQL = 
              'begin'#10'     declare @NUMINF varchar(35)'#10'     declare @CLAVE1 nume' +
              'ric(10, 0)'#10'     declare @CLAVE2 numeric(5, 0)'#10'     declare @CLAV' +
              'E3 numeric(5, 0)'#10'     declare @ESTADO char(1)'#10'     declare @FECH' +
              'ACAMBIO datetime'#10'     declare @CODIGO_BARRA varchar(25)'#10'     dec' +
              'lare @VTATERM numeric(15, 3)'#10'     declare @VTAPROCESO numeric(15' +
              ', 3)'#10'     declare @VTAFINAL numeric(15, 3)'#10'     declare @NUMCON ' +
              'smallint'#10'     declare @VALTOT numeric(15, 3)'#10#10'     set @NUMINF =' +
              ' :NUMINF'#10'     set @CLAVE1 = :CLAVE1'#10'     set @CLAVE2 = :CLAVE2'#10' ' +
              '    set @CLAVE3 = :CLAVE3'#10'     set @ESTADO = :ESTADO'#10'     set @F' +
              'ECHACAMBIO = :FECHACAMBIO'#10'     set @CODIGO_BARRA = :CODIGO_BARRA' +
              #10'     set @VTATERM = :VTATERM'#10'     set @VTAPROCESO = :VTAPROCESO' +
              #10'     set @VTAFINAL = :VTAFINAL'#10'     set @VALTOT = :VALTOT'#10#10'    ' +
              ' set @NUMCON = 0'#10#10'     select @NUMCON = isnull(max(NUMCON) + 1, ' +
              '0)'#10'     from RDX_REFERENCIA_GENERICA'#10'     where (NUMINF = @NUMIN' +
              'F) and'#10'           (CLAVE1 = @CLAVE1) and'#10'           (CLAVE2 = @C' +
              'LAVE2) and'#10'           (CLAVE3 = @CLAVE3)'#10#10'     INSERT INTO RDX_R' +
              'EFERENCIA_GENERICA'#10'       (NUMINF, CLAVE1, CLAVE2, CLAVE3,'#10'     ' +
              '  ESTADO, FECHACAMBIO, CODIGO_BARRA,'#10'       CANVEN, CANESP, CANV' +
              'ENNET, VALVEN, NUMCON)'#10'     VALUES'#10'      (@NUMINF, @CLAVE1, @CLA' +
              'VE2, @CLAVE3,'#10'      @ESTADO, @FECHACAMBIO, @CODIGO_BARRA,'#10'      ' +
              '@VTATERM, @VTAPROCESO, @VTAFINAL, @VALTOT, @NUMCON)'#10#10'end'
            StatementType = stSQL
            ColumnMappings = <>
          end>
        Name = 'Insert_ReferenciaGenerica'
      end
      item
        Params = <
          item
            Name = 'OLD_NUMINF'
            DataType = datString
            Size = 35
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'OLD_CLAVE1'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'OLD_CLAVE2'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'OLD_CLAVE3'
            DataType = datFloat
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end
          item
            Name = 'OLD_NUMCON'
            DataType = datInteger
            BlobType = dabtUnknown
            Value = ''
            ParamType = daptInput
          end>
        Statements = <
          item
            Connection = 'GFT_VARELA'
            TargetTable = 'RDX_REFERENCIA_GENERICA'
            SQL = 
              'DELETE '#10'  FROM'#10'    RDX_REFERENCIA_GENERICA'#10'  WHERE'#10'    (NUMINF =' +
              ' :OLD_NUMINF) AND '#10'    (CLAVE1 = :OLD_CLAVE1) AND '#10'    (CLAVE2 =' +
              ' :OLD_CLAVE2) AND '#10'    (CLAVE3 = :OLD_CLAVE3) AND'#10'    (NUMCON = ' +
              ':OLD_NUMCON)'
            StatementType = stSQL
            ColumnMappings = <>
          end>
        Name = 'Delete_ReferenciaGenerica'
      end>
    RelationShips = <>
    UpdateRules = <>
    Version = 0
    Left = 56
    Top = 32
  end
  object bpReferenciaGenerica: TDABusinessProcessor
    Schema = schReferenciaGenerica
    InsertCommandName = 'Insert_ReferenciaGenerica'
    DeleteCommandName = 'Delete_ReferenciaGenerica'
    UpdateCommandName = 'Update_ReferenciaGenerica'
    ReferencedDataset = 'ReferenciaGenerica'
    ProcessorOptions = [poAutoGenerateRefreshDataset, poPrepareCommands]
    UpdateMode = updWhereKeyOnly
    Left = 208
    Top = 32
  end
  object frxDBCabecera: TfrxDBDataset
    UserName = 'frxReferenciasGenericas'
    CloseDataSource = False
    DataSource = dsReferenciasGenericas
    Left = 120
    Top = 128
  end
  object dsReferenciasGenericas: TDADataSource
    DataSet = tbl_ReferenciasGenericas.Dataset
    DataTable = tbl_ReferenciasGenericas
    Left = 120
    Top = 176
  end
  object frxReport1: TfrxReport
    Version = '3.23.7'
    DotMatrixReport = False
    EngineOptions.DoublePass = True
    IniFile = '\Software\Fast Reports'
    PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator]
    PreviewOptions.OutlineWidth = 180
    PreviewOptions.Zoom = 1.000000000000000000
    PrintOptions.Printer = 'Default'
    ReportOptions.CreateDate = 37871.995398692100000000
    ReportOptions.Description.Strings = (
      'Demonstrates how to create simple list report.')
    ReportOptions.LastChange = 38902.414757476900000000
    ReportOptions.VersionBuild = '1'
    ReportOptions.VersionMajor = '12'
    ReportOptions.VersionMinor = '13'
    ReportOptions.VersionRelease = '1'
    ScriptLanguage = 'PascalScript'
    ScriptText.Strings = (
      'begin'
      ''
      'end.')
    StoreInDFM = False
    Left = 40
    Top = 128
    Datasets = <
      item
        DataSet = frxDBCabecera
        DataSetName = 'frxReferenciasGenericas'
      end>
    Variables = <>
    Style = <
      item
        Name = 'Concepto normal'
        Color = clNone
        Font.Charset = ANSI_CHARSET
        Font.Color = clWindowText
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = []
      end
      item
        Name = 'Concepto subtotal'
        Color = 15790320
        Font.Charset = ANSI_CHARSET
        Font.Color = clWindowText
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
      end
      item
        Name = 'Cabecera de columna'
        Color = 15790320
        Font.Charset = ANSI_CHARSET
        Font.Color = clWindowText
        Font.Height = -12
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
        Frame.Typ = [ftLeft, ftRight, ftTop, ftBottom]
      end
      item
        Name = 'Concepto titulo'
        Color = clNone
        Font.Charset = ANSI_CHARSET
        Font.Color = clWindowText
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
      end>
  end
  object tbl_ReferenciasGenericas: TDACDSDataTable
    RemoteUpdatesOptions = []
    Fields = <>
    Params = <>
    MasterMappingMode = mmDataRequest
    StreamingOptions = [soDisableEventsWhileStreaming]
    RemoteFetchEnabled = False
    ReadOnly = False
    DetailOptions = [dtCascadeOpenClose, dtCascadeApplyUpdates, dtAutoFetch, dtCascadeDelete, dtCascadeUpdate, dtDisableLogOfCascadeDeletes, dtDisableLogOfCascadeUpdates, dtIncludeInAllInOneFetch]
    MasterOptions = [moCascadeOpenClose, moCascadeApplyUpdates, moCascadeDelete, moCascadeUpdate, moDisableLogOfCascadeDeletes, moDisableLogOfCascadeUpdates]
    IndexDefs = <>
    Left = 120
    Top = 232
  end
  object ADOConnection1: TADOConnection
    ConnectionString = 
      'Provider=SQLNCLI.1;Password=123456;Persist Security Info=True;Us' +
      'er ID=usuario_gft;Initial Catalog=gft_varela;Data Source=localho' +
      'st'
    Provider = 'SQLNCLI.1'
    Left = 344
    Top = 136
  end
  object ADOQuery1: TADOQuery
    Connection = ADOConnection1
    CursorType = ctStatic
    Parameters = <>
    SQL.Strings = (
      'SELECT'
      '       CENTRO = CASE WHEN (CODCENTRO = CENTRO) THEN'
      '                       CENTRO'
      '                  ELSE'
      '                      CODCENTRO + '#39' - '#39' + CENTRO'
      '                  END,'
      '       VENDEDOR = CASE WHEN (CODVENDEDOR = VENDEDOR) THEN'
      '                       VENDEDOR'
      '                  ELSE'
      '                      CODVENDEDOR + '#39' - '#39' + VENDEDOR'
      '                  END,'
      '       FECHA,'
      '       NUMTALON,'
      '       CANTIDAD ='
      '           CASE WHEN (VTAPROCESO <> 0) THEN'
      
        '                REPLACE(CAST(VTAPROCESO AS VARCHAR), '#39'.000'#39', '#39#39')' +
        ' + '#39' (venta proceso)'#39
      '           ELSE'
      '               CASE WHEN (VTAFINAL <> 0) THEN'
      
        '                    REPLACE(CAST(VTAFINAL AS VARCHAR), '#39'.000'#39', '#39 +
        #39') + '#39' (venta final/resc.)'#39
      '               ELSE'
      '                   CASE WHEN (VTATERM <> 0) THEN'
      
        '                        REPLACE(CAST(VTATERM AS VARCHAR), '#39'.000'#39 +
        ', '#39#39') + '#39' (venta term./dev.)'#39
      '                   ELSE'
      '                       '#39'0'#39
      '                   END'
      '               END'
      '           END,'
      '  VALTOT'
      'FROM RDX_V_REFERENCIA_GENERICA'
      'ORDER BY CENTRO, VENDEDOR, FECHA')
    Left = 344
    Top = 200
  end
  object DataSource1: TDataSource
    DataSet = ADOQuery1
    Left = 240
    Top = 144
  end
  object DABINAdapter: TDABINAdapter
    BufferSize = 262144
    IsCompatibleV4 = True
    Left = 336
    Top = 32
  end
end
