object DMEstadisticas: TDMEstadisticas
  OldCreateOrder = False
  Height = 516
  Width = 699
  object dsqcampanyas: TDataSource
    DataSet = qcampanyas
    OnDataChange = dsqcampanyasDataChange
    Left = 56
    Top = 8
  end
  object qcampanyas: TZReadOnlyQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      'select * from campanyas order by id desc')
    Params = <>
    Left = 56
    Top = 24
    object qcampanyasid: TIntegerField
      FieldName = 'id'
      Required = True
    end
    object qcampanyasidempresa: TIntegerField
      FieldName = 'idempresa'
      Required = True
    end
    object qcampanyasid_anterior: TIntegerField
      FieldName = 'id_anterior'
    end
    object qcampanyasdescripcion: TWideStringField
      FieldName = 'descripcion'
      Required = True
      Size = 80
    end
    object qcampanyasfechainicio: TDateField
      FieldName = 'fechainicio'
      Required = True
    end
    object qcampanyasfechafin: TDateField
      FieldName = 'fechafin'
      Required = True
    end
    object qcampanyasult_pesada: TIntegerField
      FieldName = 'ult_pesada'
    end
  end
  object qproduccion: TZReadOnlyQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'SELECT parcela,mprima as mprima,sum(peso_neto_teorico),sum(peso_' +
        'neto) FROM v_ea_pesadaslotes where   parcela=:PARCELA and idea>0' +
        ' and fecha>=:FINICIO and fecha<=:FFIN  group by parcela,mprima')
    Params = <
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end>
    Left = 56
    Top = 88
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end>
    object qproduccionparcela: TWideStringField
      FieldName = 'parcela'
      Size = 100
    end
    object qproduccionmprima: TWideStringField
      FieldName = 'mprima'
      Size = 30
    end
    object qproduccionsumpeso_neto: TFloatField
      DisplayLabel = 'Peso Neto'
      FieldName = 'sum(peso_neto)'
      ReadOnly = True
      DisplayFormat = '#0.00'
    end
    object qproduccionsumpeso_neto_teorico: TFloatField
      FieldName = 'sum(peso_neto_teorico)'
      ReadOnly = True
    end
  end
  object dsqproduccion: TDataSource
    DataSet = qproduccion
    Left = 56
    Top = 72
  end
  object dsqproducciondetallexx: TDataSource
    DataSet = qproduccion_detallesxx
    Left = 40
    Top = 136
  end
  object qproduccion_almacen: TZReadOnlyQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'select * from v_ea_pesadaslotes where resto_cajas>0 and destino=' +
        ':ALMACEN order by mprima,id_envase,desc_formato')
    Params = <
      item
        DataType = ftUnknown
        Name = 'ALMACEN'
        ParamType = ptUnknown
      end>
    Left = 48
    Top = 224
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'ALMACEN'
        ParamType = ptUnknown
      end>
    object qproduccion_almacenid: TIntegerField
      FieldName = 'id'
      Required = True
    end
    object qproduccion_almacenidempresa: TIntegerField
      FieldName = 'idempresa'
      Required = True
    end
    object qproduccion_almacenidea: TIntegerField
      FieldName = 'idea'
      Required = True
    end
    object qproduccion_almacenid_palet: TWideStringField
      FieldName = 'id_palet'
      Required = True
      Size = 30
    end
    object qproduccion_almacennum_palets: TIntegerField
      FieldName = 'num_palets'
      Required = True
    end
    object qproduccion_almacenid_palet2: TWideStringField
      FieldName = 'id_palet2'
      Size = 30
    end
    object qproduccion_almacennum_palets2: TIntegerField
      FieldName = 'num_palets2'
    end
    object qproduccion_almacenid_envase: TWideStringField
      FieldName = 'id_envase'
      Required = True
      Size = 30
    end
    object qproduccion_almacennum_envases: TIntegerField
      FieldName = 'num_envases'
      Required = True
    end
    object qproduccion_almaceniddestino: TIntegerField
      FieldName = 'iddestino'
      Required = True
    end
    object qproduccion_almacendestino: TWideStringField
      FieldName = 'destino'
      Required = True
      Size = 40
    end
    object qproduccion_almacenpeso_bruto: TFloatField
      FieldName = 'peso_bruto'
      Required = True
      DisplayFormat = '#0.00'
    end
    object qproduccion_almacentara: TFloatField
      FieldName = 'tara'
      DisplayFormat = '#0.00'
    end
    object qproduccion_almacenpeso_neto: TFloatField
      FieldName = 'peso_neto'
      Required = True
      DisplayFormat = '#0.00'
    end
    object qproduccion_almacenpeso_neto_teorico: TFloatField
      FieldName = 'peso_neto_teorico'
      Required = True
      DisplayFormat = '#0.00'
    end
    object qproduccion_almacenpeso_medio: TFloatField
      FieldName = 'peso_medio'
      Required = True
      DisplayFormat = '#0.00'
    end
    object qproduccion_almacentemperatura: TFloatField
      FieldName = 'temperatura'
    end
    object qproduccion_almacenfecha: TDateField
      FieldName = 'fecha'
      Required = True
      DisplayFormat = 'dd/mm/yy'
    end
    object qproduccion_almacenfechatrabajo: TDateField
      FieldName = 'fechatrabajo'
      Required = True
      EditMask = 'dd/mm/yy'
    end
    object qproduccion_almacenhora: TTimeField
      FieldName = 'hora'
      Required = True
    end
    object qproduccion_almacenCEA: TWideStringField
      FieldName = 'CEA'
      Size = 42
    end
    object qproduccion_almacenresto_cajas: TFloatField
      FieldName = 'resto_cajas'
      Required = True
    end
    object qproduccion_almacenresto_pesoneto: TFloatField
      FieldName = 'resto_pesoneto'
      Required = True
      DisplayFormat = '#0.00'
    end
    object qproduccion_almacenlote: TIntegerField
      FieldName = 'lote'
      Required = True
    end
    object qproduccion_almacenorigen: TWideStringField
      FieldName = 'origen'
      Required = True
      Size = 100
    end
    object qproduccion_almacenidorigen: TIntegerField
      FieldName = 'idorigen'
    end
    object qproduccion_almacenmprima: TWideStringField
      FieldName = 'mprima'
      Size = 40
    end
    object qproduccion_almacengen_caja: TIntegerField
      FieldName = 'gen_caja'
      Required = True
    end
    object qproduccion_almacencosto: TFloatField
      FieldName = 'costo'
      Required = True
      DisplayFormat = '#0.00'
    end
    object qproduccion_almacencoste_manipulacion: TFloatField
      FieldName = 'coste_manipulacion'
      Required = True
    end
    object qproduccion_almacendias_camara: TIntegerField
      FieldName = 'dias_camara'
      Required = True
    end
    object qproduccion_almacencosto_camara: TFloatField
      FieldName = 'costo_camara'
      Required = True
    end
    object qproduccion_almacencodigoR: TWideStringField
      FieldName = 'codigoR'
      Required = True
    end
    object qproduccion_almacenparcela: TWideStringField
      FieldName = 'parcela'
      Size = 100
    end
    object qproduccion_almacenfecha_cierre: TDateField
      FieldName = 'fecha_cierre'
      DisplayFormat = 'dd/mm/yy'
    end
    object qproduccion_almacencosto_materiales: TFloatField
      FieldName = 'costo_materiales'
      Required = True
    end
    object qproduccion_almacencosto_cosechar: TFloatField
      FieldName = 'costo_cosechar'
      Required = True
    end
    object qproduccion_almacenborrado: TIntegerField
      FieldName = 'borrado'
      Required = True
    end
    object qproduccion_almacenseleccionado: TIntegerField
      FieldName = 'seleccionado'
      Required = True
    end
    object qproduccion_almacenobservaciones: TWideStringField
      FieldName = 'observaciones'
      Size = 500
    end
    object qproduccion_almacentipo_trabajo: TWideStringField
      FieldName = 'tipo_trabajo'
      Size = 60
    end
    object qproduccion_almacentipo_generador: TWideStringField
      FieldName = 'tipo_generador'
      Size = 60
    end
    object qproduccion_almacenremanipulado: TIntegerField
      FieldName = 'remanipulado'
      Required = True
    end
    object qproduccion_almacenfecha_envasado: TDateField
      FieldName = 'fecha_envasado'
    end
    object qproduccion_almacencodean: TWideStringField
      FieldName = 'codean'
      Size = 100
    end
    object qproduccion_almacencodssc: TWideStringField
      FieldName = 'codssc'
      Size = 100
    end
    object qproduccion_almacenpedidocliente: TIntegerField
      FieldName = 'pedidocliente'
    end
    object qproduccion_almacencosto_sinmt: TFloatField
      FieldName = 'costo_sinmt'
    end
    object qproduccion_almacenmprima_p: TWideStringField
      FieldName = 'mprima_p'
      Size = 40
    end
    object qproduccion_almacenrecuperar_envases: TIntegerField
      FieldName = 'recuperar_envases'
      Required = True
    end
    object qproduccion_almacenidalbaran: TWideStringField
      FieldName = 'idalbaran'
      Size = 22
    end
    object qproduccion_almacenes_entrada: TIntegerField
      FieldName = 'es_entrada'
      Required = True
    end
    object qproduccion_almacendesc_calibre: TWideStringField
      FieldName = 'desc_calibre'
      Size = 40
    end
    object qproduccion_almacendesc_formato: TWideStringField
      FieldName = 'desc_formato'
      Size = 100
    end
    object qproduccion_almacendesc_envase: TWideStringField
      FieldName = 'desc_envase'
      Size = 100
    end
    object qproduccion_almacenidfactura: TWideStringField
      FieldName = 'idfactura'
      Size = 40
    end
  end
  object dsqproduccionalmacen: TDataSource
    DataSet = qproduccion_almacen
    Left = 48
    Top = 200
  end
  object qcontenido: TZReadOnlyQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'select destino,sum(num_envases) as envases,sum(peso_neto) as pes' +
        'oneto,sum(peso_neto_teorico) as pesonetoteorico,'
      
        'id_envase,desc_formato,mprima from v_ea_pesadaslotes where resto' +
        '_cajas>0 and resto_pesoneto>0 and destino=:ALMACEN group by dest' +
        'ino,id_envase,desc_formato,mprima order by mprima,id_envase,desc' +
        '_formato')
    Params = <
      item
        DataType = ftUnknown
        Name = 'ALMACEN'
        ParamType = ptUnknown
      end>
    Left = 216
    Top = 56
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'ALMACEN'
        ParamType = ptUnknown
      end>
    object qcontenidodestino: TWideStringField
      FieldName = 'destino'
      Required = True
      Size = 40
    end
    object qcontenidoenvases: TLargeintField
      FieldName = 'envases'
      ReadOnly = True
    end
    object qcontenidopesoneto: TFloatField
      FieldName = 'pesoneto'
      ReadOnly = True
      DisplayFormat = '#0.000'
    end
    object qcontenidopesonetoteorico: TFloatField
      FieldName = 'pesonetoteorico'
      ReadOnly = True
      DisplayFormat = '#0.000'
    end
    object qcontenidoid_envase: TWideStringField
      FieldName = 'id_envase'
      Required = True
      Size = 30
    end
    object qcontenidomprima: TWideStringField
      FieldName = 'mprima'
      Size = 30
    end
    object qcontenidodesc_formato: TWideStringField
      FieldName = 'desc_formato'
      Size = 100
    end
  end
  object dsqcontenido: TDataSource
    DataSet = qcontenido
    Left = 216
    Top = 16
  end
  object dsqproduccionimpresion: TDataSource
    AutoEdit = False
    DataSet = qproduccionimpresion
    Left = 216
    Top = 136
  end
  object qproduccionimpresion: TZReadOnlyQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'select * from v_ea_pesadaslotes where resto_cajas>0 and resto_pe' +
        'soneto>0 and codigoR like(:R) and destino=:ALMACEN order by id_e' +
        'nvase,desc_formato,lote,fecha,id,mprima')
    Params = <
      item
        DataType = ftUnknown
        Name = 'R'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'ALMACEN'
        ParamType = ptUnknown
      end>
    Left = 216
    Top = 152
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'R'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'ALMACEN'
        ParamType = ptUnknown
      end>
    object qproduccionimpresionid: TIntegerField
      FieldName = 'id'
      Required = True
    end
    object qproduccionimpresionidempresa: TIntegerField
      FieldName = 'idempresa'
      Required = True
    end
    object qproduccionimpresionidea: TIntegerField
      FieldName = 'idea'
      Required = True
    end
    object qproduccionimpresionid_palet: TWideStringField
      FieldName = 'id_palet'
      Required = True
      Size = 30
    end
    object qproduccionimpresionnum_palets: TIntegerField
      FieldName = 'num_palets'
      Required = True
    end
    object qproduccionimpresionid_palet2: TWideStringField
      FieldName = 'id_palet2'
      Size = 30
    end
    object qproduccionimpresionnum_palets2: TIntegerField
      FieldName = 'num_palets2'
    end
    object qproduccionimpresionid_envase: TWideStringField
      FieldName = 'id_envase'
      Required = True
      Size = 30
    end
    object qproduccionimpresionnum_envases: TIntegerField
      FieldName = 'num_envases'
      Required = True
    end
    object qproduccionimpresioniddestino: TIntegerField
      FieldName = 'iddestino'
      Required = True
    end
    object qproduccionimpresiondestino: TWideStringField
      FieldName = 'destino'
      Required = True
      Size = 40
    end
    object qproduccionimpresionpeso_bruto: TFloatField
      FieldName = 'peso_bruto'
      Required = True
    end
    object qproduccionimpresiontara: TFloatField
      FieldName = 'tara'
    end
    object qproduccionimpresionpeso_neto: TFloatField
      FieldName = 'peso_neto'
      Required = True
    end
    object qproduccionimpresionpeso_neto_teorico: TFloatField
      FieldName = 'peso_neto_teorico'
      Required = True
    end
    object qproduccionimpresionpeso_medio: TFloatField
      FieldName = 'peso_medio'
      Required = True
    end
    object qproduccionimpresiontemperatura: TFloatField
      FieldName = 'temperatura'
    end
    object qproduccionimpresionfecha: TDateField
      FieldName = 'fecha'
      Required = True
    end
    object qproduccionimpresionfechatrabajo: TDateField
      FieldName = 'fechatrabajo'
      Required = True
    end
    object qproduccionimpresionhora: TTimeField
      FieldName = 'hora'
      Required = True
    end
    object qproduccionimpresionCEA: TWideStringField
      FieldName = 'CEA'
      Size = 42
    end
    object qproduccionimpresionresto_cajas: TFloatField
      FieldName = 'resto_cajas'
      Required = True
    end
    object qproduccionimpresionresto_pesoneto: TFloatField
      FieldName = 'resto_pesoneto'
      Required = True
    end
    object qproduccionimpresionlote: TIntegerField
      FieldName = 'lote'
      Required = True
    end
    object qproduccionimpresionorigen: TWideStringField
      FieldName = 'origen'
      Required = True
      Size = 100
    end
    object qproduccionimpresionidorigen: TIntegerField
      FieldName = 'idorigen'
    end
    object qproduccionimpresionmprima: TWideStringField
      FieldName = 'mprima'
      Size = 40
    end
    object qproduccionimpresiongen_caja: TIntegerField
      FieldName = 'gen_caja'
      Required = True
    end
    object qproduccionimpresioncosto: TFloatField
      FieldName = 'costo'
      Required = True
    end
    object qproduccionimpresioncoste_manipulacion: TFloatField
      FieldName = 'coste_manipulacion'
      Required = True
    end
    object qproduccionimpresiondias_camara: TIntegerField
      FieldName = 'dias_camara'
      Required = True
    end
    object qproduccionimpresioncosto_camara: TFloatField
      FieldName = 'costo_camara'
      Required = True
    end
    object qproduccionimpresioncodigoR: TWideStringField
      FieldName = 'codigoR'
      Required = True
    end
    object qproduccionimpresionparcela: TWideStringField
      FieldName = 'parcela'
      Size = 100
    end
    object qproduccionimpresionfecha_cierre: TDateField
      FieldName = 'fecha_cierre'
    end
    object qproduccionimpresioncosto_materiales: TFloatField
      FieldName = 'costo_materiales'
      Required = True
    end
    object qproduccionimpresioncosto_cosechar: TFloatField
      FieldName = 'costo_cosechar'
      Required = True
    end
    object qproduccionimpresionborrado: TIntegerField
      FieldName = 'borrado'
      Required = True
    end
    object qproduccionimpresionseleccionado: TIntegerField
      FieldName = 'seleccionado'
      Required = True
    end
    object qproduccionimpresionobservaciones: TWideStringField
      FieldName = 'observaciones'
      Size = 500
    end
    object qproduccionimpresiontipo_trabajo: TWideStringField
      FieldName = 'tipo_trabajo'
      Size = 60
    end
    object qproduccionimpresiontipo_generador: TWideStringField
      FieldName = 'tipo_generador'
      Size = 60
    end
    object qproduccionimpresionremanipulado: TIntegerField
      FieldName = 'remanipulado'
      Required = True
    end
    object qproduccionimpresionfecha_envasado: TDateField
      FieldName = 'fecha_envasado'
    end
    object qproduccionimpresioncodean: TWideStringField
      FieldName = 'codean'
      Size = 100
    end
    object qproduccionimpresioncodssc: TWideStringField
      FieldName = 'codssc'
      Size = 100
    end
    object qproduccionimpresionpedidocliente: TIntegerField
      FieldName = 'pedidocliente'
    end
    object qproduccionimpresioncosto_sinmt: TFloatField
      FieldName = 'costo_sinmt'
    end
    object qproduccionimpresionmprima_p: TWideStringField
      FieldName = 'mprima_p'
      Size = 40
    end
    object qproduccionimpresionrecuperar_envases: TIntegerField
      FieldName = 'recuperar_envases'
      Required = True
    end
    object qproduccionimpresionidalbaran: TWideStringField
      FieldName = 'idalbaran'
      Size = 22
    end
    object qproduccionimpresiones_entrada: TIntegerField
      FieldName = 'es_entrada'
      Required = True
    end
    object qproduccionimpresiondesc_calibre: TWideStringField
      FieldName = 'desc_calibre'
      Size = 40
    end
    object qproduccionimpresiondesc_formato: TWideStringField
      FieldName = 'desc_formato'
      Size = 100
    end
  end
  object ZReadOnlyQuery1: TZReadOnlyQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'select destino,sum(num_envases) as envases,sum(peso_neto) as pes' +
        'oneto,sum(peso_neto_teorico) as pesonetoteorico,'
      
        'id_envase,mprima from ea_pesadas group by destino,id_envase,mpri' +
        'ma order by destino,id_envase desc')
    Params = <>
    MasterFields = 'nombre'
    MasterSource = DM.dsqalmacenes
    LinkedFields = 'destino'
    Left = 320
    Top = 56
    object WideStringField4: TWideStringField
      FieldName = 'destino'
      Required = True
      Size = 40
    end
    object LargeintField1: TLargeintField
      FieldName = 'envases'
      ReadOnly = True
    end
    object FloatField8: TFloatField
      FieldName = 'pesoneto'
      ReadOnly = True
      DisplayFormat = '#0.000'
    end
    object FloatField9: TFloatField
      FieldName = 'pesonetoteorico'
      ReadOnly = True
      DisplayFormat = '#0.000'
    end
    object WideStringField6: TWideStringField
      FieldName = 'id_envase'
      Required = True
      Size = 30
    end
    object WideStringField7: TWideStringField
      FieldName = 'mprima'
      Size = 30
    end
  end
  object DataSource1: TDataSource
    DataSet = ZReadOnlyQuery1
    Left = 320
    Top = 32
  end
  object ZReadOnlyQuery2: TZReadOnlyQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'select destino,sum(num_envases) as envases,sum(peso_neto) as pes' +
        'oneto,sum(peso_neto_teorico) as pesonetoteorico,'
      
        'id_envase,mprima from ea_pesadas group by destino,id_envase,mpri' +
        'ma order by destino,id_envase desc')
    Params = <>
    MasterFields = 'nombre'
    MasterSource = DM.dsqalmacenes
    LinkedFields = 'destino'
    Left = 408
    Top = 64
    object WideStringField8: TWideStringField
      FieldName = 'destino'
      Required = True
      Size = 40
    end
    object LargeintField2: TLargeintField
      FieldName = 'envases'
      ReadOnly = True
    end
    object FloatField10: TFloatField
      FieldName = 'pesoneto'
      ReadOnly = True
      DisplayFormat = '#0.000'
    end
    object FloatField11: TFloatField
      FieldName = 'pesonetoteorico'
      ReadOnly = True
      DisplayFormat = '#0.000'
    end
    object WideStringField9: TWideStringField
      FieldName = 'id_envase'
      Required = True
      Size = 30
    end
    object WideStringField10: TWideStringField
      FieldName = 'mprima'
      Size = 30
    end
  end
  object DataSource2: TDataSource
    DataSet = ZReadOnlyQuery2
    Left = 408
    Top = 40
  end
  object qsalidas: TZReadOnlyQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'SELECT parcela,mprima as mprima,sum(peso_neto_teorico),sum(peso_' +
        'neto) FROM v_ea_pesadaslotes pl'
      
        ' where (idea=0 or iddestino in (select id from almacenes where f' +
        'inal=1)) and iddestino<>0 and iddestino in (select id from almac' +
        'enes where produccion=0) and fecha>=:FINICIO and fecha<=:FFIN an' +
        'd parcela=:PARCELA and mprima_p in (select id from materias_prim' +
        'as where desechos=0) group by parcela,mprima  order by mprima')
    Params = <
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end>
    Left = 432
    Top = 168
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end>
    object WideStringField1: TWideStringField
      FieldName = 'parcela'
      Size = 100
    end
    object WideStringField2: TWideStringField
      FieldName = 'mprima'
      Size = 30
    end
    object FloatField2: TFloatField
      DisplayLabel = 'Peso Neto'
      FieldName = 'sum(peso_neto)'
      ReadOnly = True
      DisplayFormat = '#0.00'
    end
    object qsalidassumpeso_neto_teorico: TFloatField
      FieldName = 'sum(peso_neto_teorico)'
      ReadOnly = True
    end
  end
  object qsalidasdetalles: TZReadOnlyQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'SELECT * FROM v_ea_pesadaslotes where (idea=0 or iddestino in (s' +
        'elect id from almacenes where final=1)) and iddestino<>0 and idd' +
        'estino in (select id from almacenes where produccion=0) and fech' +
        'a>=:FINICIO and fecha<=:FFIN and parcela=:PARCELA and mprima_p i' +
        'n (select id from materias_primas where desechos=0) order by mpr' +
        'ima,id_envase,id desc')
    Params = <
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end>
    Left = 432
    Top = 232
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end>
    object qsalidasdetallesid: TIntegerField
      FieldName = 'id'
      Required = True
    end
    object qsalidasdetallesidempresa: TIntegerField
      FieldName = 'idempresa'
      Required = True
    end
    object qsalidasdetallesidea: TIntegerField
      FieldName = 'idea'
      Required = True
    end
    object qsalidasdetallesid_palet: TWideStringField
      FieldName = 'id_palet'
      Required = True
      Size = 30
    end
    object qsalidasdetallesnum_palets: TIntegerField
      FieldName = 'num_palets'
      Required = True
    end
    object qsalidasdetallesid_palet2: TWideStringField
      FieldName = 'id_palet2'
      Size = 30
    end
    object qsalidasdetallesnum_palets2: TIntegerField
      FieldName = 'num_palets2'
    end
    object qsalidasdetallesid_envase: TWideStringField
      FieldName = 'id_envase'
      Required = True
      Size = 30
    end
    object qsalidasdetallesnum_envases: TIntegerField
      FieldName = 'num_envases'
    end
    object qsalidasdetallesiddestino: TIntegerField
      FieldName = 'iddestino'
      Required = True
    end
    object qsalidasdetallesdestino: TWideStringField
      FieldName = 'destino'
      Required = True
      Size = 100
    end
    object qsalidasdetallespeso_bruto: TFloatField
      FieldName = 'peso_bruto'
      Required = True
      DisplayFormat = '#0.00'
    end
    object qsalidasdetallestara: TFloatField
      FieldName = 'tara'
      Required = True
      DisplayFormat = '#0.00'
    end
    object qsalidasdetallespeso_neto: TFloatField
      FieldName = 'peso_neto'
      Required = True
      DisplayFormat = '#0.00'
    end
    object qsalidasdetallespeso_neto_teorico: TFloatField
      FieldName = 'peso_neto_teorico'
      Required = True
      DisplayFormat = '#0.00'
    end
    object qsalidasdetallespeso_medio: TFloatField
      FieldName = 'peso_medio'
      Required = True
      DisplayFormat = '#0.00'
    end
    object qsalidasdetallestemperatura: TFloatField
      FieldName = 'temperatura'
    end
    object qsalidasdetallesfecha: TDateField
      FieldName = 'fecha'
      Required = True
      DisplayFormat = 'dd/mm/yy'
    end
    object qsalidasdetallesfechatrabajo: TDateField
      FieldName = 'fechatrabajo'
      Required = True
      DisplayFormat = 'dd/mm/yy'
    end
    object qsalidasdetalleshora: TTimeField
      FieldName = 'hora'
      Required = True
    end
    object qsalidasdetallesCEA: TWideStringField
      FieldName = 'CEA'
      Size = 42
    end
    object qsalidasdetallesresto_cajas: TFloatField
      FieldName = 'resto_cajas'
      Required = True
    end
    object qsalidasdetallesresto_pesoneto: TFloatField
      FieldName = 'resto_pesoneto'
      Required = True
    end
    object qsalidasdetalleslote: TIntegerField
      FieldName = 'lote'
      Required = True
    end
    object qsalidasdetallesorigen: TWideStringField
      FieldName = 'origen'
      Required = True
      Size = 100
    end
    object qsalidasdetallesidorigen: TIntegerField
      FieldName = 'idorigen'
    end
    object qsalidasdetallesmprima: TWideStringField
      FieldName = 'mprima'
      Size = 40
    end
    object qsalidasdetallesmprima_p: TWideStringField
      FieldName = 'mprima_p'
      Size = 40
    end
    object qsalidasdetallesgen_caja: TIntegerField
      FieldName = 'gen_caja'
      Required = True
    end
    object qsalidasdetallescosto: TFloatField
      FieldName = 'costo'
      Required = True
    end
    object qsalidasdetallescoste_manipulacion: TFloatField
      FieldName = 'coste_manipulacion'
      Required = True
      DisplayFormat = '#0.00'
    end
    object qsalidasdetallesdias_camara: TIntegerField
      FieldName = 'dias_camara'
      Required = True
    end
    object qsalidasdetallescosto_camara: TFloatField
      FieldName = 'costo_camara'
      Required = True
    end
    object qsalidasdetallescodigoR: TWideStringField
      FieldName = 'codigoR'
      Required = True
    end
    object qsalidasdetallesparcela: TWideStringField
      FieldName = 'parcela'
      Size = 100
    end
    object qsalidasdetallesfecha_cierre: TDateField
      FieldName = 'fecha_cierre'
    end
    object qsalidasdetallescosto_materiales: TFloatField
      FieldName = 'costo_materiales'
      Required = True
      DisplayFormat = '#0.00'
    end
    object qsalidasdetallescosto_cosechar: TFloatField
      FieldName = 'costo_cosechar'
      Required = True
    end
    object qsalidasdetallesborrado: TIntegerField
      FieldName = 'borrado'
      Required = True
    end
    object qsalidasdetallesseleccionado: TIntegerField
      FieldName = 'seleccionado'
      Required = True
    end
    object qsalidasdetallesobservaciones: TWideStringField
      FieldName = 'observaciones'
      Size = 500
    end
    object qsalidasdetallestipo_trabajo: TWideStringField
      FieldName = 'tipo_trabajo'
      Size = 60
    end
    object qsalidasdetallestipo_generador: TWideStringField
      FieldName = 'tipo_generador'
      Size = 60
    end
    object qsalidasdetallesremanipulado: TIntegerField
      FieldName = 'remanipulado'
      Required = True
    end
    object qsalidasdetallesfecha_envasado: TDateField
      FieldName = 'fecha_envasado'
    end
    object qsalidasdetallescodean: TWideStringField
      FieldName = 'codean'
      Size = 100
    end
    object qsalidasdetallescodssc: TWideStringField
      FieldName = 'codssc'
      Size = 100
    end
    object qsalidasdetallespedidocliente: TIntegerField
      FieldName = 'pedidocliente'
    end
    object qsalidasdetallescosto_sinmt: TFloatField
      FieldName = 'costo_sinmt'
    end
    object qsalidasdetallesrecuperar_envases: TIntegerField
      FieldName = 'recuperar_envases'
      Required = True
    end
  end
  object dsqsalidas: TDataSource
    DataSet = qsalidas
    Left = 424
    Top = 136
  end
  object dsqsalidasdetalles: TDataSource
    DataSet = qsalidasdetalles
    Left = 448
    Top = 208
  end
  object dsqinfsalidas: TDataSource
    DataSet = qinfsalidas
    Left = 152
    Top = 312
  end
  object qinfsalidas: TZQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        '(select v.id,v.fecha,v.fechatrabajo,v.parcela,v.mprima as mprima' +
        ',v.mprima_p as mprima_p,v.id_envase,v.num_envases,v.destino as c' +
        'liente,'#39' '#39' as ciudad,v.peso_neto,v.peso_neto_teorico,v.peso_medi' +
        'o,v.temperatura,v.lote,v.idalbaran,v.costo_materiales,v.coste_ma' +
        'nipulacion'
      
        ' from v_ea_pesadaslotes v where v.mprima=v.mprima_p and (v.idea=' +
        '0 or v.iddestino in (select id from almacenes where final=1)) an' +
        'd v.iddestino<>0 and v.iddestino in (select id from almacenes wh' +
        'ere produccion=0) and fecha>=:FINICIO and fecha<=:FFIN and v.ped' +
        'idocliente is null and parcela=:PARCELA and mprima_p in (select ' +
        'id from materias_primas where desechos=0))'
      ' UNION ALL'
      
        '(select v.id,v.fecha,v.fechatrabajo,v.parcela,v.mprima as mprima' +
        ',v.mprima_p as mprima_p,v.id_envase,v.num_envases,c.nombre as cl' +
        'iente,p.iddestino as ciudad,v.peso_neto,v.peso_neto_teorico,v.pe' +
        'so_medio,v.temperatura,v.lote,v.idalbaran,v.costo_materiales,v.c' +
        'oste_manipulacion '
      
        ' from v_ea_pesadaslotes v, pedidos p,clientes c where (v.idea=0 ' +
        'or v.iddestino in (select id from almacenes where final=1)) and ' +
        'v.iddestino<>0 and v.iddestino in (select id from almacenes wher' +
        'e produccion=0) and fecha>=:FINICIO and fecha<=:FFIN and v.pedid' +
        'ocliente is not null and v.pedidocliente=p.id and p.idcliente=c.' +
        'id and parcela=:PARCELA and mprima_p in (select id from materias' +
        '_primas where desechos=0))'
      ' order by mprima,id desc, fecha')
    Params = <
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end>
    Left = 160
    Top = 336
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end>
    object qinfsalidasid: TIntegerField
      FieldName = 'id'
      ReadOnly = True
    end
    object qinfsalidasfecha: TDateField
      FieldName = 'fecha'
      ReadOnly = True
    end
    object qinfsalidasfechatrabajo: TDateField
      FieldName = 'fechatrabajo'
      ReadOnly = True
    end
    object qinfsalidasparcela: TWideStringField
      FieldName = 'parcela'
      ReadOnly = True
      Size = 100
    end
    object qinfsalidasmprima: TWideStringField
      FieldName = 'mprima'
      ReadOnly = True
      Size = 40
    end
    object qinfsalidasmprima_p: TWideStringField
      FieldName = 'mprima_p'
      ReadOnly = True
      Size = 40
    end
    object qinfsalidasid_envase: TWideStringField
      FieldName = 'id_envase'
      ReadOnly = True
      Size = 30
    end
    object qinfsalidasnum_envases: TIntegerField
      FieldName = 'num_envases'
      ReadOnly = True
    end
    object qinfsalidascliente: TWideStringField
      FieldName = 'cliente'
      ReadOnly = True
      Size = 100
    end
    object qinfsalidasciudad: TWideStringField
      FieldName = 'ciudad'
      ReadOnly = True
      Size = 40
    end
    object qinfsalidaspeso_neto: TFloatField
      FieldName = 'peso_neto'
      ReadOnly = True
    end
    object qinfsalidaspeso_neto_teorico: TFloatField
      FieldName = 'peso_neto_teorico'
      ReadOnly = True
    end
    object qinfsalidaspeso_medio: TFloatField
      FieldName = 'peso_medio'
      ReadOnly = True
    end
    object qinfsalidastemperatura: TFloatField
      FieldName = 'temperatura'
      ReadOnly = True
    end
    object qinfsalidaslote: TIntegerField
      FieldName = 'lote'
      ReadOnly = True
    end
    object qinfsalidasidalbaran: TWideStringField
      FieldName = 'idalbaran'
      ReadOnly = True
      Size = 22
    end
    object qinfsalidascosto_materiales: TFloatField
      FieldName = 'costo_materiales'
      ReadOnly = True
      DisplayFormat = '#0.00'
    end
    object qinfsalidascoste_manipulacion: TFloatField
      FieldName = 'coste_manipulacion'
      ReadOnly = True
      DisplayFormat = '#0.00'
    end
  end
  object dsqinfentradas: TDataSource
    DataSet = qinfentradas
    Left = 256
    Top = 328
  end
  object qinfentradas: TZQuery
    Connection = DM.DBagrigest
    SortType = stDescending
    SQL.Strings = (
      
        '(select v.id,v.fecha,v.fechatrabajo,v.parcela,v.mprima as mprima' +
        ',v.mprima_p as mprima_p,v.id_envase,v.num_envases,v.destino as c' +
        'liente,'#39' '#39' as ciudad,v.peso_neto,v.peso_neto_teorico,v.peso_medi' +
        'o,v.temperatura,v.lote,v.idalbaran,v.costo_materiales,v.coste_ma' +
        'nipulacion '
      
        ' from v_ea_pesadaslotes v where v.idea>0 and fecha>=:FINICIO and' +
        ' fecha<=:FFIN and v.pedidocliente is null and parcela=:PARCELA )'
      ' UNION ALL'
      
        '(select v.id,v.fecha,v.fechatrabajo,v.parcela,v.mprima as mprima' +
        ',v.mprima_p as mprima_p,v.id_envase,v.num_envases,c.nombre as cl' +
        'iente,p.iddestino as ciudad,v.peso_neto,v.peso_neto_teorico,v.pe' +
        'so_medio,v.temperatura,v.lote,v.idalbaran,v.costo_materiales,v.c' +
        'oste_manipulacion '
      
        '  from v_ea_pesadaslotes v, pedidos p,clientes c where v.idea>0 ' +
        'and fecha>=:FINICIO and fecha<=:FFIN and v.pedidocliente is not ' +
        'null and v.pedidocliente=p.id and p.idcliente=c.id and parcela=:' +
        'PARCELA )'
      ' order by mprima,id desc, fecha')
    Params = <
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end>
    Left = 256
    Top = 344
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end>
    object qinfentradasid: TIntegerField
      FieldName = 'id'
      ReadOnly = True
    end
    object qinfentradasfecha: TDateField
      FieldName = 'fecha'
      ReadOnly = True
    end
    object qinfentradasfechatrabajo: TDateField
      FieldName = 'fechatrabajo'
      ReadOnly = True
    end
    object qinfentradasparcela: TWideStringField
      FieldName = 'parcela'
      ReadOnly = True
      Size = 100
    end
    object qinfentradasmprima: TWideStringField
      FieldName = 'mprima'
      ReadOnly = True
      Size = 40
    end
    object qinfentradasid_envase: TWideStringField
      FieldName = 'id_envase'
      ReadOnly = True
      Size = 30
    end
    object qinfentradasnum_envases: TIntegerField
      FieldName = 'num_envases'
      ReadOnly = True
    end
    object qinfentradascliente: TWideStringField
      FieldName = 'cliente'
      ReadOnly = True
      Size = 100
    end
    object qinfentradasciudad: TWideStringField
      FieldName = 'ciudad'
      ReadOnly = True
      Size = 40
    end
    object qinfentradaspeso_neto: TFloatField
      FieldName = 'peso_neto'
      ReadOnly = True
    end
    object qinfentradaspeso_neto_teorico: TFloatField
      FieldName = 'peso_neto_teorico'
      ReadOnly = True
    end
    object qinfentradaspeso_medio: TFloatField
      FieldName = 'peso_medio'
      ReadOnly = True
    end
    object qinfentradastemperatura: TFloatField
      FieldName = 'temperatura'
      ReadOnly = True
    end
    object qinfentradaslote: TIntegerField
      FieldName = 'lote'
      ReadOnly = True
    end
    object qinfentradasmprima_p: TWideStringField
      FieldName = 'mprima_p'
      ReadOnly = True
      Size = 40
    end
    object qinfentradasidalbaran: TWideStringField
      FieldName = 'idalbaran'
      ReadOnly = True
      Size = 22
    end
    object qinfentradascosto_materiales: TFloatField
      FieldName = 'costo_materiales'
      ReadOnly = True
      DisplayFormat = '#0.00'
    end
    object qinfentradascoste_manipulacion: TFloatField
      FieldName = 'coste_manipulacion'
      ReadOnly = True
      DisplayFormat = '#0.00'
    end
  end
  object dsqdesechos: TDataSource
    DataSet = qdesechos
    Left = 560
    Top = 136
  end
  object qdesechos: TZReadOnlyQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'SELECT parcela,mprima as mprima,sum(peso_neto_teorico),sum(peso_' +
        'neto) FROM v_ea_pesadaslotes pl'
      
        ' where (idea=0 or iddestino in (select id from almacenes where f' +
        'inal=1)) and iddestino<>0 and iddestino in (select id from almac' +
        'enes where produccion=0) and fecha>=:FINICIO and fecha<=:FFIN an' +
        'd parcela=:PARCELA and mprima_p in (select id from materias_prim' +
        'as where desechos=1) group by parcela,mprima_p  order by mprima')
    Params = <
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end>
    Left = 568
    Top = 168
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end>
    object qdesechosparcela: TWideStringField
      FieldName = 'parcela'
      Size = 100
    end
    object qdesechosmprima: TWideStringField
      FieldName = 'mprima'
      Size = 40
    end
    object qdesechossumpeso_neto_teorico: TFloatField
      FieldName = 'sum(peso_neto_teorico)'
      ReadOnly = True
    end
    object qdesechossumpeso_neto: TFloatField
      FieldName = 'sum(peso_neto)'
      ReadOnly = True
    end
  end
  object dsqdesechosdetalles: TDataSource
    DataSet = qdesechosdetalles
    Left = 584
    Top = 208
  end
  object qdesechosdetalles: TZReadOnlyQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'SELECT * FROM v_ea_pesadaslotes where (idea=0 or iddestino in (s' +
        'elect id from almacenes where final=1)) and iddestino<>0 and idd' +
        'estino in (select id from almacenes where produccion=0) and fech' +
        'a>=:FINICIO and fecha<=:FFIN and parcela=:PARCELA and mprima_p i' +
        'n (select id from materias_primas where desechos=1) order by mpr' +
        'ima,id_envase,id desc')
    Params = <
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end>
    Left = 568
    Top = 232
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end>
    object qdesechosdetallesid: TIntegerField
      FieldName = 'id'
      Required = True
    end
    object qdesechosdetallesidempresa: TIntegerField
      FieldName = 'idempresa'
      Required = True
    end
    object qdesechosdetallesidea: TIntegerField
      FieldName = 'idea'
      Required = True
    end
    object qdesechosdetallesid_palet: TWideStringField
      FieldName = 'id_palet'
      Required = True
      Size = 30
    end
    object qdesechosdetallesnum_palets: TIntegerField
      FieldName = 'num_palets'
      Required = True
    end
    object qdesechosdetallesid_palet2: TWideStringField
      FieldName = 'id_palet2'
      Size = 30
    end
    object qdesechosdetallesnum_palets2: TIntegerField
      FieldName = 'num_palets2'
    end
    object qdesechosdetallesid_envase: TWideStringField
      FieldName = 'id_envase'
      Required = True
      Size = 40
    end
    object qdesechosdetallesnum_envases: TIntegerField
      FieldName = 'num_envases'
    end
    object qdesechosdetallesiddestino: TIntegerField
      FieldName = 'iddestino'
      Required = True
    end
    object qdesechosdetallesdestino: TWideStringField
      FieldName = 'destino'
      Required = True
      Size = 100
    end
    object qdesechosdetallespeso_bruto: TFloatField
      FieldName = 'peso_bruto'
      Required = True
    end
    object qdesechosdetallestara: TFloatField
      FieldName = 'tara'
      Required = True
    end
    object qdesechosdetallespeso_neto: TFloatField
      FieldName = 'peso_neto'
      Required = True
    end
    object qdesechosdetallespeso_neto_teorico: TFloatField
      FieldName = 'peso_neto_teorico'
      Required = True
    end
    object qdesechosdetallespeso_medio: TFloatField
      FieldName = 'peso_medio'
      Required = True
    end
    object qdesechosdetallestemperatura: TFloatField
      FieldName = 'temperatura'
    end
    object qdesechosdetallesfecha: TDateField
      FieldName = 'fecha'
      Required = True
    end
    object qdesechosdetallesfechatrabajo: TDateField
      FieldName = 'fechatrabajo'
      Required = True
    end
    object qdesechosdetalleshora: TTimeField
      FieldName = 'hora'
      Required = True
    end
    object qdesechosdetallesCEA: TWideStringField
      FieldName = 'CEA'
      Size = 42
    end
    object qdesechosdetallesresto_cajas: TFloatField
      FieldName = 'resto_cajas'
      Required = True
    end
    object qdesechosdetallesresto_pesoneto: TFloatField
      FieldName = 'resto_pesoneto'
      Required = True
    end
    object qdesechosdetalleslote: TIntegerField
      FieldName = 'lote'
      Required = True
    end
    object qdesechosdetallesorigen: TWideStringField
      FieldName = 'origen'
      Required = True
      Size = 100
    end
    object qdesechosdetallesidorigen: TIntegerField
      FieldName = 'idorigen'
    end
    object qdesechosdetallesmprima: TWideStringField
      FieldName = 'mprima'
      Size = 40
    end
    object qdesechosdetallesmprima_p: TWideStringField
      FieldName = 'mprima_p'
      Size = 40
    end
    object qdesechosdetallesgen_caja: TIntegerField
      FieldName = 'gen_caja'
      Required = True
    end
    object qdesechosdetallescosto: TFloatField
      FieldName = 'costo'
      Required = True
    end
    object qdesechosdetallescoste_manipulacion: TFloatField
      FieldName = 'coste_manipulacion'
      Required = True
    end
    object qdesechosdetallesdias_camara: TIntegerField
      FieldName = 'dias_camara'
      Required = True
    end
    object qdesechosdetallescosto_camara: TFloatField
      FieldName = 'costo_camara'
      Required = True
    end
    object qdesechosdetallescodigoR: TWideStringField
      FieldName = 'codigoR'
      Required = True
    end
    object qdesechosdetallesparcela: TWideStringField
      FieldName = 'parcela'
      Size = 100
    end
    object qdesechosdetallesfecha_cierre: TDateField
      FieldName = 'fecha_cierre'
    end
    object qdesechosdetallescosto_materiales: TFloatField
      FieldName = 'costo_materiales'
      Required = True
    end
    object qdesechosdetallescosto_cosechar: TFloatField
      FieldName = 'costo_cosechar'
      Required = True
    end
    object qdesechosdetallesborrado: TIntegerField
      FieldName = 'borrado'
      Required = True
    end
    object qdesechosdetallesseleccionado: TIntegerField
      FieldName = 'seleccionado'
      Required = True
    end
    object qdesechosdetallesobservaciones: TWideStringField
      FieldName = 'observaciones'
      Size = 500
    end
    object qdesechosdetallestipo_trabajo: TWideStringField
      FieldName = 'tipo_trabajo'
      Size = 60
    end
    object qdesechosdetallestipo_generador: TWideStringField
      FieldName = 'tipo_generador'
      Size = 60
    end
    object qdesechosdetallesremanipulado: TIntegerField
      FieldName = 'remanipulado'
      Required = True
    end
    object qdesechosdetallesfecha_envasado: TDateField
      FieldName = 'fecha_envasado'
    end
    object qdesechosdetallescodean: TWideStringField
      FieldName = 'codean'
      Size = 100
    end
    object qdesechosdetallescodssc: TWideStringField
      FieldName = 'codssc'
      Size = 100
    end
    object qdesechosdetallespedidocliente: TIntegerField
      FieldName = 'pedidocliente'
    end
    object qdesechosdetallescosto_sinmt: TFloatField
      FieldName = 'costo_sinmt'
    end
    object qdesechosdetallesrecuperar_envases: TIntegerField
      FieldName = 'recuperar_envases'
      Required = True
    end
    object qdesechosdetallesidalbaran: TWideStringField
      FieldName = 'idalbaran'
      Size = 22
    end
    object qdesechosdetalleses_entrada: TIntegerField
      FieldName = 'es_entrada'
      Required = True
    end
    object qdesechosdetallesdesc_calibre: TWideStringField
      FieldName = 'desc_calibre'
      Size = 40
    end
    object qdesechosdetallesdesc_formato: TWideStringField
      FieldName = 'desc_formato'
      Size = 100
    end
    object qdesechosdetallesdesc_envase: TWideStringField
      FieldName = 'desc_envase'
      Size = 100
    end
    object qdesechosdetallesidfactura: TWideStringField
      FieldName = 'idfactura'
      Size = 40
    end
  end
  object dsqinfdesechos: TDataSource
    DataSet = qinfdesechos
    Left = 360
    Top = 328
  end
  object qinfdesechos: TZQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        '(select v.id,v.fecha,v.fechatrabajo,v.parcela,v.mprima as mprima' +
        ',v.mprima_p as mprima_p,v.id_envase,v.num_envases,v.destino as c' +
        'liente,'#39' '#39' as ciudad,v.peso_neto,v.peso_neto_teorico,v.peso_medi' +
        'o,v.temperatura,v.lote,v.idalbaran,v.costo_materiales,v.coste_ma' +
        'nipulacion '
      
        ' from v_ea_pesadaslotes v where (v.idea=0 or v.iddestino in (sel' +
        'ect id from almacenes where final=1)) and v.iddestino<>0 and v.i' +
        'ddestino in (select id from almacenes where produccion=0) and fe' +
        'cha>=:FINICIO and fecha<=:FFIN and v.pedidocliente is null and p' +
        'arcela=:PARCELA and mprima_p in (select id from materias_primas ' +
        'where desechos=1))'
      ' UNION ALL'
      
        '(select v.id,v.fecha,v.fechatrabajo,v.parcela,v.mprima as mprima' +
        ',v.mprima_p as mprima_p,v.id_envase,v.num_envases,c.nombre as cl' +
        'iente,p.iddestino as ciudad,v.peso_neto,v.peso_neto_teorico,v.pe' +
        'so_medio,v.temperatura,v.lote,v.idalbaran,v.costo_materiales,v.c' +
        'oste_manipulacion '
      
        ' from v_ea_pesadaslotes v, pedidos p,clientes c where (v.idea=0 ' +
        'or v.iddestino in (select id from almacenes where final=1)) and ' +
        'v.iddestino<>0 and v.iddestino in (select id from almacenes wher' +
        'e produccion=0) and fecha>=:FINICIO and fecha<=:FFIN and v.pedid' +
        'ocliente is not null and v.pedidocliente=p.id and p.idcliente=c.' +
        'id and parcela=:PARCELA and mprima_p in (select id from materias' +
        '_primas where desechos=1))'
      ' order by mprima,id desc, fecha')
    Params = <
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end>
    Left = 368
    Top = 352
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end>
    object qinfdesechosid: TIntegerField
      FieldName = 'id'
      ReadOnly = True
    end
    object qinfdesechosfecha: TDateField
      FieldName = 'fecha'
      ReadOnly = True
    end
    object qinfdesechosfechatrabajo: TDateField
      FieldName = 'fechatrabajo'
      ReadOnly = True
    end
    object qinfdesechosparcela: TWideStringField
      FieldName = 'parcela'
      ReadOnly = True
      Size = 100
    end
    object qinfdesechosmprima: TWideStringField
      FieldName = 'mprima'
      ReadOnly = True
      Size = 40
    end
    object qinfdesechosmprima_p: TWideStringField
      FieldName = 'mprima_p'
      ReadOnly = True
      Size = 40
    end
    object qinfdesechosid_envase: TWideStringField
      FieldName = 'id_envase'
      ReadOnly = True
      Size = 40
    end
    object qinfdesechosnum_envases: TIntegerField
      FieldName = 'num_envases'
      ReadOnly = True
    end
    object qinfdesechoscliente: TWideStringField
      FieldName = 'cliente'
      ReadOnly = True
      Size = 100
    end
    object qinfdesechosciudad: TWideStringField
      FieldName = 'ciudad'
      ReadOnly = True
      Size = 40
    end
    object qinfdesechospeso_neto: TFloatField
      FieldName = 'peso_neto'
      ReadOnly = True
    end
    object qinfdesechospeso_neto_teorico: TFloatField
      FieldName = 'peso_neto_teorico'
      ReadOnly = True
    end
    object qinfdesechospeso_medio: TFloatField
      FieldName = 'peso_medio'
      ReadOnly = True
    end
    object qinfdesechostemperatura: TFloatField
      FieldName = 'temperatura'
      ReadOnly = True
    end
    object qinfdesechoslote: TIntegerField
      FieldName = 'lote'
      ReadOnly = True
    end
    object qinfdesechosidalbaran: TWideStringField
      FieldName = 'idalbaran'
      ReadOnly = True
      Size = 22
    end
    object qinfdesechoscosto_materiales: TFloatField
      FieldName = 'costo_materiales'
      ReadOnly = True
      DisplayFormat = '#0.00'
    end
    object qinfdesechoscoste_manipulacion: TFloatField
      FieldName = 'coste_manipulacion'
      ReadOnly = True
      DisplayFormat = '#0.00'
    end
  end
  object qproduccion_detallesxx: TZReadOnlyQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'SELECT * FROM v_ea_pesadaslotes where idea>0 and fecha>=:FINICIO' +
        ' and fecha<=:FFIN and parcela=:PARCELA  order by mprima,id_envas' +
        'e,id desc')
    Params = <
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end>
    Left = 48
    Top = 144
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'FINICIO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FFIN'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PARCELA'
        ParamType = ptUnknown
      end>
    object qproduccion_detallesxxid: TIntegerField
      FieldName = 'id'
      Required = True
    end
    object qproduccion_detallesxxidempresa: TIntegerField
      FieldName = 'idempresa'
      Required = True
    end
    object qproduccion_detallesxxidea: TIntegerField
      FieldName = 'idea'
      Required = True
    end
    object qproduccion_detallesxxid_palet: TWideStringField
      FieldName = 'id_palet'
      Required = True
      Size = 30
    end
    object qproduccion_detallesxxnum_palets: TIntegerField
      FieldName = 'num_palets'
      Required = True
    end
    object qproduccion_detallesxxid_palet2: TWideStringField
      FieldName = 'id_palet2'
      Size = 30
    end
    object qproduccion_detallesxxnum_palets2: TIntegerField
      FieldName = 'num_palets2'
    end
    object qproduccion_detallesxxid_envase: TWideStringField
      FieldName = 'id_envase'
      Required = True
      Size = 40
    end
    object qproduccion_detallesxxnum_envases: TIntegerField
      FieldName = 'num_envases'
    end
    object qproduccion_detallesxxiddestino: TIntegerField
      FieldName = 'iddestino'
      Required = True
    end
    object qproduccion_detallesxxdestino: TWideStringField
      FieldName = 'destino'
      Required = True
      Size = 100
    end
    object qproduccion_detallesxxpeso_bruto: TFloatField
      FieldName = 'peso_bruto'
      Required = True
    end
    object qproduccion_detallesxxtara: TFloatField
      FieldName = 'tara'
      Required = True
    end
    object qproduccion_detallesxxpeso_neto: TFloatField
      FieldName = 'peso_neto'
      Required = True
    end
    object qproduccion_detallesxxpeso_neto_teorico: TFloatField
      FieldName = 'peso_neto_teorico'
      Required = True
    end
    object qproduccion_detallesxxpeso_medio: TFloatField
      FieldName = 'peso_medio'
      Required = True
    end
    object qproduccion_detallesxxtemperatura: TFloatField
      FieldName = 'temperatura'
    end
    object qproduccion_detallesxxfecha: TDateField
      FieldName = 'fecha'
      Required = True
    end
    object qproduccion_detallesxxfechatrabajo: TDateField
      FieldName = 'fechatrabajo'
      Required = True
    end
    object qproduccion_detallesxxhora: TTimeField
      FieldName = 'hora'
      Required = True
    end
    object qproduccion_detallesxxCEA: TWideStringField
      FieldName = 'CEA'
      Size = 42
    end
    object qproduccion_detallesxxresto_cajas: TFloatField
      FieldName = 'resto_cajas'
      Required = True
    end
    object qproduccion_detallesxxresto_pesoneto: TFloatField
      FieldName = 'resto_pesoneto'
      Required = True
    end
    object qproduccion_detallesxxlote: TIntegerField
      FieldName = 'lote'
      Required = True
    end
    object qproduccion_detallesxxorigen: TWideStringField
      FieldName = 'origen'
      Required = True
      Size = 100
    end
    object qproduccion_detallesxxidorigen: TIntegerField
      FieldName = 'idorigen'
    end
    object qproduccion_detallesxxmprima: TWideStringField
      FieldName = 'mprima'
      Size = 40
    end
    object qproduccion_detallesxxmprima_p: TWideStringField
      FieldName = 'mprima_p'
      Size = 40
    end
    object qproduccion_detallesxxgen_caja: TIntegerField
      FieldName = 'gen_caja'
      Required = True
    end
    object qproduccion_detallesxxcosto: TFloatField
      FieldName = 'costo'
      Required = True
    end
    object qproduccion_detallesxxcoste_manipulacion: TFloatField
      FieldName = 'coste_manipulacion'
      Required = True
    end
    object qproduccion_detallesxxdias_camara: TIntegerField
      FieldName = 'dias_camara'
      Required = True
    end
    object qproduccion_detallesxxcosto_camara: TFloatField
      FieldName = 'costo_camara'
      Required = True
    end
    object qproduccion_detallesxxcodigoR: TWideStringField
      FieldName = 'codigoR'
      Required = True
    end
    object qproduccion_detallesxxparcela: TWideStringField
      FieldName = 'parcela'
      Size = 100
    end
    object qproduccion_detallesxxfecha_cierre: TDateField
      FieldName = 'fecha_cierre'
    end
    object qproduccion_detallesxxcosto_materiales: TFloatField
      FieldName = 'costo_materiales'
      Required = True
    end
    object qproduccion_detallesxxcosto_cosechar: TFloatField
      FieldName = 'costo_cosechar'
      Required = True
    end
    object qproduccion_detallesxxborrado: TIntegerField
      FieldName = 'borrado'
      Required = True
    end
    object qproduccion_detallesxxseleccionado: TIntegerField
      FieldName = 'seleccionado'
      Required = True
    end
    object qproduccion_detallesxxobservaciones: TWideStringField
      FieldName = 'observaciones'
      Size = 500
    end
    object qproduccion_detallesxxtipo_trabajo: TWideStringField
      FieldName = 'tipo_trabajo'
      Size = 60
    end
    object qproduccion_detallesxxtipo_generador: TWideStringField
      FieldName = 'tipo_generador'
      Size = 60
    end
    object qproduccion_detallesxxremanipulado: TIntegerField
      FieldName = 'remanipulado'
      Required = True
    end
    object qproduccion_detallesxxfecha_envasado: TDateField
      FieldName = 'fecha_envasado'
    end
    object qproduccion_detallesxxcodean: TWideStringField
      FieldName = 'codean'
      Size = 100
    end
    object qproduccion_detallesxxcodssc: TWideStringField
      FieldName = 'codssc'
      Size = 100
    end
    object qproduccion_detallesxxpedidocliente: TIntegerField
      FieldName = 'pedidocliente'
    end
    object qproduccion_detallesxxcosto_sinmt: TFloatField
      FieldName = 'costo_sinmt'
    end
    object qproduccion_detallesxxrecuperar_envases: TIntegerField
      FieldName = 'recuperar_envases'
      Required = True
    end
    object qproduccion_detallesxxidalbaran: TWideStringField
      FieldName = 'idalbaran'
      Size = 22
    end
    object qproduccion_detallesxxes_entrada: TIntegerField
      FieldName = 'es_entrada'
      Required = True
    end
    object qproduccion_detallesxxdesc_calibre: TWideStringField
      FieldName = 'desc_calibre'
      Size = 40
    end
    object qproduccion_detallesxxdesc_formato: TWideStringField
      FieldName = 'desc_formato'
      Size = 100
    end
    object qproduccion_detallesxxdesc_envase: TWideStringField
      FieldName = 'desc_envase'
      Size = 100
    end
    object qproduccion_detallesxxidfactura: TWideStringField
      FieldName = 'idfactura'
      Size = 40
    end
  end
end
