object controlstock: Tcontrolstock
  Left = 0
  Top = 0
  Caption = 'Control de Stocks de almacen'
  ClientHeight = 508
  ClientWidth = 972
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  KeyPreview = True
  OldCreateOrder = False
  Position = poOwnerFormCenter
  OnKeyDown = FormKeyDown
  OnKeyPress = FormKeyPress
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  object Panel1: TPanel
    Left = 0
    Top = 0
    Width = 972
    Height = 49
    Align = alTop
    TabOrder = 0
    object Label5: TLabel
      Left = 434
      Top = 4
      Width = 36
      Height = 13
      Alignment = taRightJustify
      Caption = 'Fecha:'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ParentFont = False
    end
    object Label1: TLabel
      Left = 427
      Top = 25
      Width = 43
      Height = 13
      Alignment = taRightJustify
      Caption = 'Familia:'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ParentFont = False
    end
    object Button3: TButton
      Left = 916
      Top = 1
      Width = 55
      Height = 47
      Align = alRight
      Caption = 'A Excel'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ImageAlignment = iaBottom
      ImageIndex = 0
      ParentFont = False
      TabOrder = 0
      OnClick = Button3Click
    end
    object btAnuevo: TButton
      Left = 1
      Top = 1
      Width = 55
      Height = 47
      Align = alLeft
      Caption = 'Nuevo'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ImageAlignment = iaBottom
      ImageIndex = 0
      Images = BASE.listaiconos
      ParentFont = False
      TabOrder = 1
      OnClick = btAnuevoClick
    end
    object btaimprimir: TButton
      Left = 858
      Top = 1
      Width = 58
      Height = 47
      Align = alRight
      Caption = 'Imprimir'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ImageAlignment = iaBottom
      ImageIndex = 10
      Images = BASE.listaiconos
      ParentFont = False
      TabOrder = 2
      OnClick = btaimprimirClick
    end
    object btAguardar: TButton
      Left = 166
      Top = 1
      Width = 55
      Height = 47
      Align = alLeft
      Caption = 'Guardar'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ImageAlignment = iaBottom
      ImageIndex = 140
      Images = BASE.listaiconos
      ParentFont = False
      TabOrder = 3
      OnClick = btAguardarClick
    end
    object DBEdit1: TDBEdit
      Left = 476
      Top = 2
      Width = 145
      Height = 21
      DataField = 'fecha'
      DataSource = dsqstock
      TabOrder = 4
    end
    object btAmodificar: TButton
      Left = 111
      Top = 1
      Width = 55
      Height = 47
      Align = alLeft
      Caption = 'Editar'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ImageAlignment = iaBottom
      ImageIndex = 2
      Images = BASE.listaiconos
      ParentFont = False
      TabOrder = 5
    end
    object btAborrar: TButton
      Left = 56
      Top = 1
      Width = 55
      Height = 47
      Align = alLeft
      Caption = 'Borrar'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ImageAlignment = iaBottom
      ImageIndex = 1
      Images = BASE.listaiconos
      ParentFont = False
      TabOrder = 6
      OnClick = btAborrarClick
    end
    object btAcancelar: TButton
      Left = 221
      Top = 1
      Width = 55
      Height = 47
      Align = alLeft
      Caption = 'Cancelar'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ImageAlignment = iaBottom
      ImageIndex = 3
      Images = BASE.listaiconos
      ParentFont = False
      TabOrder = 7
      OnClick = btAcancelarClick
    end
    object btregularizar: TButton
      Left = 276
      Top = 1
      Width = 133
      Height = 47
      Align = alLeft
      Caption = 'Regularizar Stocks'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ImageAlignment = iaBottom
      ImageIndex = 154
      Images = BASE.listaiconos
      ParentFont = False
      TabOrder = 8
      OnClick = btregularizarClick
    end
    object DBCheckBox1: TDBCheckBox
      Left = 641
      Top = 26
      Width = 97
      Height = 17
      Alignment = taLeftJustify
      Caption = 'Regularizado'
      DataField = 'regularizado'
      DataSource = dsqstock
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ParentFont = False
      TabOrder = 9
      ValueChecked = '1'
      ValueUnchecked = '0'
    end
    object combofamilia: TDBLookupComboBox
      Left = 476
      Top = 24
      Width = 145
      Height = 21
      DropDownRows = 20
      KeyField = 'id'
      ListField = 'descripcion'
      ListSource = dsqfamilias
      NullValueKey = 46
      TabOrder = 10
      OnClick = combofamiliaClick
    end
    object chkactivos: TCheckBox
      Left = 641
      Top = -2
      Width = 97
      Height = 30
      Alignment = taLeftJustify
      Caption = 'Solo art'#237'culos activos'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ParentFont = False
      TabOrder = 11
      WordWrap = True
      OnClick = chkactivosClick
    end
  end
  object Panel2: TPanel
    Left = 0
    Top = 49
    Width = 97
    Height = 459
    Align = alLeft
    Caption = 'Panel2'
    TabOrder = 1
    object DBGrid1: TDBGrid
      Left = 1
      Top = 1
      Width = 95
      Height = 457
      Align = alClient
      DataSource = dsqstock
      TabOrder = 0
      TitleFont.Charset = DEFAULT_CHARSET
      TitleFont.Color = clWindowText
      TitleFont.Height = -11
      TitleFont.Name = 'Tahoma'
      TitleFont.Style = []
      Columns = <
        item
          Expanded = False
          FieldName = 'fecha'
          Visible = True
        end>
    end
  end
  object gridstocks: TDBGrid
    Left = 97
    Top = 49
    Width = 875
    Height = 459
    Align = alClient
    DataSource = dsqstockdetalle
    TabOrder = 2
    TitleFont.Charset = DEFAULT_CHARSET
    TitleFont.Color = clWindowText
    TitleFont.Height = -11
    TitleFont.Name = 'Tahoma'
    TitleFont.Style = []
    Columns = <
      item
        Expanded = False
        FieldName = 'familia'
        Title.Caption = 'Familia'
        Width = 187
        Visible = True
      end
      item
        Expanded = False
        FieldName = 'codigo'
        Title.Caption = 'C'#243'digo'
        Width = 130
        Visible = True
      end
      item
        Expanded = False
        FieldName = 'descripcion'
        Title.Caption = 'Descripci'#243'n'
        Width = 355
        Visible = True
      end
      item
        Expanded = False
        FieldName = 'stock'
        Title.Caption = 'Stock'
        Width = 83
        Visible = True
      end
      item
        Expanded = False
        FieldName = 'stock_real'
        Title.Caption = 'Stock Real'
        Width = 79
        Visible = True
      end>
  end
  object SaveDialog1: TSaveDialog
    Left = 624
    Top = 40
  end
  object qstockdetalle: TZQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'select * from control_stock_detalle where ide=:EMPRESA and fecha' +
        '=:FECHA and (familia in (select descripcion from familias where ' +
        'grupo like (:GRUPO)) or familia is null) and codigo in (select c' +
        'odigo from articulosf where activo like(:ACTIVO)) order by  fech' +
        'a desc,familia, descripcion')
    Params = <
      item
        DataType = ftUnknown
        Name = 'EMPRESA'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FECHA'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'GRUPO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'ACTIVO'
        ParamType = ptUnknown
      end>
    Left = 416
    Top = 152
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'EMPRESA'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FECHA'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'GRUPO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'ACTIVO'
        ParamType = ptUnknown
      end>
    object qstockdetalleide: TIntegerField
      FieldName = 'ide'
      Required = True
    end
    object qstockdetallefecha: TDateField
      FieldName = 'fecha'
      Required = True
    end
    object qstockdetallecodigo: TWideStringField
      FieldName = 'codigo'
      Required = True
      Size = 40
    end
    object qstockdetalledescripcion: TWideStringField
      FieldName = 'descripcion'
      Required = True
      Size = 100
    end
    object qstockdetallestock: TFloatField
      FieldName = 'stock'
      Required = True
    end
    object qstockdetallestock_real: TFloatField
      FieldName = 'stock_real'
      Required = True
    end
    object qstockdetallefamilia: TWideStringField
      FieldName = 'familia'
      Size = 90
    end
  end
  object qstock: TZQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      'select * from control_stock order by fecha desc')
    Params = <>
    Left = 320
    Top = 88
    object qstockide: TIntegerField
      FieldName = 'ide'
      Required = True
    end
    object qstockfecha: TDateField
      FieldName = 'fecha'
      Required = True
      DisplayFormat = 'dd/mm/yyyy'
      EditMask = '!99/99/0000;1;_'
    end
    object qstockregularizado: TIntegerField
      FieldName = 'regularizado'
    end
  end
  object dsqstockdetalle: TDataSource
    DataSet = qstockdetalle
    Left = 328
    Top = 160
  end
  object dsqstock: TDataSource
    DataSet = qstock
    OnStateChange = dsqstockStateChange
    OnDataChange = dsqstockDataChange
    Left = 248
    Top = 96
  end
  object frxPDFExport1: TfrxPDFExport
    UseFileCache = True
    ShowProgress = True
    OverwritePrompt = False
    DataOnly = False
    InteractiveFormsFontSubset = 'A-Z,a-z,0-9,#43-#47 '
    OpenAfterExport = False
    PrintOptimized = False
    Outline = False
    Background = False
    HTMLTags = True
    Quality = 95
    Transparency = False
    Author = 'FastReport'
    Subject = 'FastReport PDF export'
    ProtectionFlags = [ePrint, eModify, eCopy, eAnnot]
    HideToolbar = False
    HideMenubar = False
    HideWindowUI = False
    FitWindow = False
    CenterWindow = False
    PrintScaling = False
    PdfA = False
    PDFStandard = psNone
    PDFVersion = pv17
    Left = 536
    Top = 16
  end
  object dbinfstock: TfrxDBDataset
    UserName = 'dbinfstock'
    CloseDataSource = False
    FieldAliases.Strings = (
      'ide=ide'
      'fecha=fecha'
      'codigo=codigo'
      'descripcion=descripcion'
      'stock=stock'
      'stock_real=stock_real'
      'familia=familia')
    DataSet = qstockdetalle
    BCDToCurrency = False
    Left = 528
    Top = 112
  end
  object infstock: TfrxReport
    Version = '6.9.3'
    DotMatrixReport = False
    IniFile = '\Software\Fast Reports'
    PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick]
    PreviewOptions.Zoom = 1.000000000000000000
    PrintOptions.Printer = 'Default'
    PrintOptions.PrintOnSheet = 0
    ReportOptions.CreateDate = 44046.382540810200000000
    ReportOptions.LastChange = 44978.384740914350000000
    ScriptLanguage = 'PascalScript'
    ScriptText.Strings = (
      'begin'
      ''
      'end.')
    Left = 584
    Top = 8
    Datasets = <
      item
        DataSet = dbinfstock
        DataSetName = 'dbinfstock'
      end>
    Variables = <>
    Style = <>
    object Data: TfrxDataPage
      Height = 1000.000000000000000000
      Width = 1000.000000000000000000
    end
    object Page1: TfrxReportPage
      PaperWidth = 210.000000000000000000
      PaperHeight = 297.000000000000000000
      PaperSize = 9
      LeftMargin = 10.000000000000000000
      RightMargin = 10.000000000000000000
      TopMargin = 10.000000000000000000
      BottomMargin = 10.000000000000000000
      Frame.Typ = []
      MirrorMode = []
      object GroupHeader1: TfrxGroupHeader
        FillType = ftBrush
        Frame.Typ = []
        Height = 94.488188980000000000
        Top = 18.897650000000000000
        Width = 718.110700000000000000
        Condition = 'dbinfstock."familia"'
        StartNewPage = True
        object Memo5: TfrxMemoView
          AllowVectorExport = True
          Left = 4.225726670000000000
          Top = 2.637599999999990000
          Width = 642.520100000000000000
          Height = 41.574830000000000000
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -35
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = []
          Memo.UTF8W = (
            'Inventario a fecha de: [FECHA]')
          ParentFont = False
        end
        object Memo1: TfrxMemoView
          AllowVectorExport = True
          Left = 160.338590000000000000
          Top = 65.216408500000000000
          Width = 61.542053330000000000
          Height = 22.677180000000000000
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -16
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = []
          Memo.UTF8W = (
            'C'#243'digo')
          ParentFont = False
        end
        object Memo2: TfrxMemoView
          AllowVectorExport = True
          Left = 243.175943340000000000
          Top = 65.216408500000000000
          Width = 109.606370000000000000
          Height = 22.677180000000000000
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -16
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = []
          Memo.UTF8W = (
            'Descripci'#243'n')
          ParentFont = False
        end
        object Memo3: TfrxMemoView
          AllowVectorExport = True
          Left = 567.677490000000000000
          Top = 65.216408500000000000
          Width = 55.708720000000000000
          Height = 22.677180000000000000
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -16
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = []
          Memo.UTF8W = (
            'Stock')
          ParentFont = False
        end
        object Memo4: TfrxMemoView
          AllowVectorExport = True
          Left = 632.563390010000000000
          Top = 65.276746670000000000
          Width = 81.601113330000000000
          Height = 22.677180000000000000
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -16
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = []
          Memo.UTF8W = (
            'Stock Real')
          ParentFont = False
        end
        object Line1: TfrxLineView
          AllowVectorExport = True
          Left = 4.166666670000000000
          Top = 88.674396670000000000
          Width = 718.110700000000000000
          Color = clBlack
          Frame.Typ = [ftTop]
        end
        object Memo6: TfrxMemoView
          AllowVectorExport = True
          Left = 6.666666670000000000
          Top = 65.216408500000000000
          Width = 61.542053330000000000
          Height = 22.677180000000000000
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -16
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = []
          Memo.UTF8W = (
            'Fam'#237'lia')
          ParentFont = False
        end
      end
      object MasterData1: TfrxMasterData
        FillType = ftBrush
        Frame.Typ = []
        Height = 18.897637795275600000
        Top = 136.063080000000000000
        Width = 718.110700000000000000
        DataSet = dbinfstock
        DataSetName = 'dbinfstock'
        RowCount = 0
        object frxDBDataset1codigo: TfrxMemoView
          AllowVectorExport = True
          Left = 159.671923330000000000
          Width = 82.224490000000000000
          Height = 18.897650000000000000
          DataField = 'codigo'
          DataSet = dbinfstock
          DataSetName = 'dbinfstock'
          Frame.Typ = []
          Memo.UTF8W = (
            '[dbinfstock."codigo"]')
        end
        object frxDBDataset1descripcion: TfrxMemoView
          AllowVectorExport = True
          Left = 242.342609990000000000
          Width = 317.480520000000000000
          Height = 18.897650000000000000
          DataField = 'descripcion'
          DataSet = dbinfstock
          DataSetName = 'dbinfstock'
          Frame.Typ = []
          Memo.UTF8W = (
            '[dbinfstock."descripcion"]')
        end
        object frxDBDataset1stock: TfrxMemoView
          AllowVectorExport = True
          Left = 545.118430000000000000
          Width = 79.370130000000000000
          Height = 18.897650000000000000
          DataField = 'stock'
          DataSet = dbinfstock
          DataSetName = 'dbinfstock'
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = []
          HAlign = haRight
          Memo.UTF8W = (
            '[dbinfstock."stock"]')
          ParentFont = False
        end
        object frxDBDataset1stock_real: TfrxMemoView
          AllowVectorExport = True
          Left = 631.450526660000000000
          Width = 79.370130000000000000
          Height = 18.897650000000000000
          DataField = 'stock_real'
          DataSet = dbinfstock
          DataSetName = 'dbinfstock'
          Font.Charset = DEFAULT_CHARSET
          Font.Color = clBlack
          Font.Height = -13
          Font.Name = 'Arial'
          Font.Style = []
          Frame.Typ = []
          HAlign = haRight
          Memo.UTF8W = (
            '[dbinfstock."stock_real"]')
          ParentFont = False
        end
        object Memo7: TfrxMemoView
          AllowVectorExport = True
          Left = 1.666666660000000000
          Width = 158.057823330000000000
          Height = 18.897650000000000000
          DataSet = dbinfstock
          DataSetName = 'dbinfstock'
          Frame.Typ = []
          Memo.UTF8W = (
            '[dbinfstock."familia"]')
        end
      end
    end
  end
  object qentradasdetalle: TZQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'select ed.*,e.fecha from entradas_detalle ed,entradas e where ed' +
        '.identrada=e.id and id_propio=:ARTICULO and ed.idempresa=:EMPRES' +
        'A and ed.identrada in (select id from entradas where fecha<=:FEC' +
        'HA) order by fecha desc;')
    Params = <
      item
        DataType = ftUnknown
        Name = 'ARTICULO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'EMPRESA'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FECHA'
        ParamType = ptUnknown
      end>
    Left = 784
    Top = 120
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'ARTICULO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'EMPRESA'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FECHA'
        ParamType = ptUnknown
      end>
    object qentradasdetalleid: TIntegerField
      FieldName = 'id'
      Required = True
    end
    object qentradasdetalleidempresa: TIntegerField
      FieldName = 'idempresa'
      Required = True
    end
    object qentradasdetalleidentrada: TIntegerField
      FieldName = 'identrada'
      Required = True
    end
    object qentradasdetalleidproveedor: TIntegerField
      FieldName = 'idproveedor'
      Required = True
    end
    object qentradasdetallecodigo: TWideStringField
      FieldName = 'codigo'
      Required = True
      Size = 50
    end
    object qentradasdetalleid_propio: TWideStringField
      FieldName = 'id_propio'
      Size = 40
    end
    object qentradasdetalledescripcion: TWideStringField
      FieldName = 'descripcion'
      Required = True
      Size = 100
    end
    object qentradasdetallelote: TWideStringField
      FieldName = 'lote'
      Size = 40
    end
    object qentradasdetallecantidad: TFloatField
      FieldName = 'cantidad'
      Required = True
    end
    object qentradasdetallestock: TFloatField
      FieldName = 'stock'
      Required = True
    end
    object qentradasdetalleprecio: TFloatField
      FieldName = 'precio'
      Required = True
    end
    object qentradasdetalletipo_iva: TIntegerField
      FieldName = 'tipo_iva'
      Required = True
    end
    object qentradasdetallebase: TFloatField
      FieldName = 'base'
      Required = True
    end
    object qentradasdetalletotal: TFloatField
      FieldName = 'total'
      Required = True
    end
    object qentradasdetallefecha: TDateField
      FieldName = 'fecha'
      Required = True
    end
  end
  object qaux2: TZQuery
    Connection = DM.DBagrigest
    Params = <>
    Left = 480
    Top = 88
  end
  object qauxentradas: TZQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      'select * from entradas')
    Params = <>
    Left = 512
    Top = 216
    object qauxentradasid: TIntegerField
      FieldName = 'id'
      Required = True
    end
    object qauxentradasidempresa: TIntegerField
      FieldName = 'idempresa'
      Required = True
    end
    object qauxentradasidproveedor: TIntegerField
      FieldName = 'idproveedor'
      Required = True
    end
    object qauxentradasfecha: TDateField
      FieldName = 'fecha'
      Required = True
    end
    object qauxentradasdocumento: TWideStringField
      FieldName = 'documento'
      Required = True
      Size = 30
    end
    object qauxentradasbase: TFloatField
      FieldName = 'base'
      Required = True
    end
    object qauxentradastotaliva: TFloatField
      FieldName = 'totaliva'
      Required = True
    end
    object qauxentradastotalentrada: TFloatField
      FieldName = 'totalentrada'
      Required = True
    end
  end
  object qauxentradasdetalle: TZQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      'select * from entradas_detalle')
    Params = <>
    Left = 624
    Top = 192
    object qauxentradasdetalleid: TIntegerField
      FieldName = 'id'
      Required = True
    end
    object qauxentradasdetalleidempresa: TIntegerField
      FieldName = 'idempresa'
      Required = True
    end
    object qauxentradasdetalleidentrada: TIntegerField
      FieldName = 'identrada'
      Required = True
    end
    object qauxentradasdetalleidproveedor: TIntegerField
      FieldName = 'idproveedor'
      Required = True
    end
    object qauxentradasdetallecodigo: TWideStringField
      FieldName = 'codigo'
      Required = True
      Size = 50
    end
    object qauxentradasdetalleid_propio: TWideStringField
      FieldName = 'id_propio'
      Size = 40
    end
    object qauxentradasdetalledescripcion: TWideStringField
      FieldName = 'descripcion'
      Required = True
      Size = 100
    end
    object qauxentradasdetallelote: TWideStringField
      FieldName = 'lote'
      Size = 40
    end
    object qauxentradasdetallecantidad: TFloatField
      FieldName = 'cantidad'
      Required = True
    end
    object qauxentradasdetallestock: TFloatField
      FieldName = 'stock'
    end
    object qauxentradasdetalleprecio: TFloatField
      FieldName = 'precio'
      Required = True
    end
    object qauxentradasdetalletipo_iva: TIntegerField
      FieldName = 'tipo_iva'
      Required = True
    end
    object qauxentradasdetallebase: TFloatField
      FieldName = 'base'
      Required = True
    end
    object qauxentradasdetalletotal: TFloatField
      FieldName = 'total'
      Required = True
    end
  end
  object qfamilias: TZReadOnlyQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      'select * from grupos order by descripcion')
    Params = <>
    Left = 240
    Top = 224
    object qfamiliasidempresa: TIntegerField
      FieldName = 'idempresa'
      Required = True
    end
    object qfamiliasid: TIntegerField
      FieldName = 'id'
      Required = True
    end
    object qfamiliasdescripcion: TWideStringField
      FieldName = 'descripcion'
      Size = 100
    end
    object qfamiliasactivo: TIntegerField
      FieldName = 'activo'
      Required = True
    end
  end
  object dsqfamilias: TDataSource
    DataSet = qfamilias
    OnDataChange = dsqfamiliasDataChange
    Left = 208
    Top = 208
  end
  object qaux: TZQuery
    Connection = DM.DBagrigest
    Params = <>
    Left = 424
    Top = 96
  end
  object qupdateentradasdetalle: TZQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'update entradas_detalle set stock=cantidad where id_propio=:ARTI' +
        'CULO and idempresa=:EMPRESA and identrada in (select id from ent' +
        'radas where fecha>:FECHA)')
    Params = <
      item
        DataType = ftUnknown
        Name = 'ARTICULO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'EMPRESA'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FECHA'
        ParamType = ptUnknown
      end>
    Left = 784
    Top = 176
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'ARTICULO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'EMPRESA'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FECHA'
        ParamType = ptUnknown
      end>
  end
  object qupdate0entradasdetalle: TZQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'update entradas_detalle set stock=0 where id_propio=:ARTICULO an' +
        'd idempresa=:EMPRESA and identrada in (select id from entradas w' +
        'here fecha<=:FECHA)')
    Params = <
      item
        DataType = ftUnknown
        Name = 'ARTICULO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'EMPRESA'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FECHA'
        ParamType = ptUnknown
      end>
    Left = 784
    Top = 224
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'ARTICULO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'EMPRESA'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'FECHA'
        ParamType = ptUnknown
      end>
  end
  object qdetalle: TZQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'select * from entradas_detalle where idempresa=:EMPRESA and id=:' +
        'ID')
    Params = <
      item
        DataType = ftUnknown
        Name = 'EMPRESA'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'ID'
        ParamType = ptUnknown
      end>
    Left = 784
    Top = 272
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'EMPRESA'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'ID'
        ParamType = ptUnknown
      end>
    object qdetalleid: TIntegerField
      FieldName = 'id'
      Required = True
    end
    object qdetalleidempresa: TIntegerField
      FieldName = 'idempresa'
      Required = True
    end
    object qdetalleidentrada: TIntegerField
      FieldName = 'identrada'
      Required = True
    end
    object qdetalleidproveedor: TIntegerField
      FieldName = 'idproveedor'
      Required = True
    end
    object qdetallecodigo: TWideStringField
      FieldName = 'codigo'
      Required = True
      Size = 50
    end
    object qdetalleid_propio: TWideStringField
      FieldName = 'id_propio'
      Size = 40
    end
    object qdetalledescripcion: TWideStringField
      FieldName = 'descripcion'
      Required = True
      Size = 100
    end
    object qdetallelote: TWideStringField
      FieldName = 'lote'
      Size = 40
    end
    object qdetallecantidad: TFloatField
      FieldName = 'cantidad'
      Required = True
    end
    object qdetallestock: TFloatField
      FieldName = 'stock'
      Required = True
    end
    object qdetalleprecio: TFloatField
      FieldName = 'precio'
      Required = True
    end
    object qdetalletipo_iva: TIntegerField
      FieldName = 'tipo_iva'
      Required = True
    end
    object qdetallebase: TFloatField
      FieldName = 'base'
      Required = True
    end
    object qdetalletotal: TFloatField
      FieldName = 'total'
      Required = True
    end
  end
  object qentradas2: TZQuery
    Connection = DM.DBagrigest
    SQL.Strings = (
      
        'select id,idempresa,fecha from entradas where fecha>=:FECHA and ' +
        '(id,idempresa) in (select identrada,idempresa from entradas_deta' +
        'lle where cantidad>=0 and id_propio=:ARTICULO and idempresa=:EMP' +
        'RESA) order by fecha desc')
    Params = <
      item
        DataType = ftUnknown
        Name = 'FECHA'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'ARTICULO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'EMPRESA'
        ParamType = ptUnknown
      end>
    Left = 784
    Top = 320
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'FECHA'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'ARTICULO'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'EMPRESA'
        ParamType = ptUnknown
      end>
    object qentradas2id: TIntegerField
      FieldName = 'id'
      Required = True
    end
    object qentradas2idempresa: TIntegerField
      FieldName = 'idempresa'
      Required = True
    end
    object qentradas2fecha: TDateField
      FieldName = 'fecha'
      Required = True
    end
  end
end
