Imports wrd = Microsoft.Office.Interop.Word
Imports mediatheek.Data
Imports Mediatheek.dataacces

Public Class frmAlbumRapport
    Inherits System.Windows.Forms.Form

    Dim mAlbum As clsAlbum

#Region " Windows Form Designer generated code "

    Public Sub New(ByVal sAlbumID As String)
        MyBase.New()
        InitializeComponent()
        mAlbum = clsAlbumDA.GetAlbumByID(sAlbumID).Item(0)
        MyBase.Text = "Rapport voor " & mAlbum.AlbumNaam & " - " & clsFichegenerator.getGroepNaam(mAlbum)
    End Sub

    

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents sfdAlbumRapport As System.Windows.Forms.SaveFileDialog
    Friend WithEvents gpbRapportKeuzes As System.Windows.Forms.GroupBox
    Friend WithEvents btnRapport As System.Windows.Forms.Button
    Friend WithEvents chbVoorAlleAlbums As System.Windows.Forms.CheckBox
    Friend WithEvents chbLocatie As System.Windows.Forms.CheckBox
    Friend WithEvents chbOntleenHistoriek As System.Windows.Forms.CheckBox
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmAlbumRapport))
        Me.sfdAlbumRapport = New System.Windows.Forms.SaveFileDialog
        Me.gpbRapportKeuzes = New System.Windows.Forms.GroupBox
        Me.btnRapport = New System.Windows.Forms.Button
        Me.chbVoorAlleAlbums = New System.Windows.Forms.CheckBox
        Me.chbLocatie = New System.Windows.Forms.CheckBox
        Me.chbOntleenHistoriek = New System.Windows.Forms.CheckBox
        Me.PictureBox1 = New System.Windows.Forms.PictureBox
        Me.gpbRapportKeuzes.SuspendLayout()
        Me.SuspendLayout()
        '
        'sfdAlbumRapport
        '
        Me.sfdAlbumRapport.Filter = "Word Documenten (*.doc)|*.doc"
        Me.sfdAlbumRapport.Title = "Album Rapport opslaan als..."
        '
        'gpbRapportKeuzes
        '
        Me.gpbRapportKeuzes.Controls.Add(Me.btnRapport)
        Me.gpbRapportKeuzes.Controls.Add(Me.chbVoorAlleAlbums)
        Me.gpbRapportKeuzes.Controls.Add(Me.chbLocatie)
        Me.gpbRapportKeuzes.Controls.Add(Me.chbOntleenHistoriek)
        Me.gpbRapportKeuzes.Location = New System.Drawing.Point(56, 80)
        Me.gpbRapportKeuzes.Name = "gpbRapportKeuzes"
        Me.gpbRapportKeuzes.Size = New System.Drawing.Size(320, 120)
        Me.gpbRapportKeuzes.TabIndex = 0
        Me.gpbRapportKeuzes.TabStop = False
        '
        'btnRapport
        '
        Me.btnRapport.Location = New System.Drawing.Point(224, 56)
        Me.btnRapport.Name = "btnRapport"
        Me.btnRapport.Size = New System.Drawing.Size(75, 56)
        Me.btnRapport.TabIndex = 1
        Me.btnRapport.Text = "Rapport"
        '
        'chbVoorAlleAlbums
        '
        Me.chbVoorAlleAlbums.Location = New System.Drawing.Point(8, 88)
        Me.chbVoorAlleAlbums.Name = "chbVoorAlleAlbums"
        Me.chbVoorAlleAlbums.Size = New System.Drawing.Size(192, 24)
        Me.chbVoorAlleAlbums.TabIndex = 0
        Me.chbVoorAlleAlbums.Text = "Deze informatie voor alle albums"
        '
        'chbLocatie
        '
        Me.chbLocatie.Location = New System.Drawing.Point(8, 56)
        Me.chbLocatie.Name = "chbLocatie"
        Me.chbLocatie.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.chbLocatie.Size = New System.Drawing.Size(192, 24)
        Me.chbLocatie.TabIndex = 0
        Me.chbLocatie.Text = "Locatie ophalen"
        '
        'chbOntleenHistoriek
        '
        Me.chbOntleenHistoriek.Location = New System.Drawing.Point(8, 24)
        Me.chbOntleenHistoriek.Name = "chbOntleenHistoriek"
        Me.chbOntleenHistoriek.Size = New System.Drawing.Size(192, 24)
        Me.chbOntleenHistoriek.TabIndex = 0
        Me.chbOntleenHistoriek.Text = "Ontleenhistoriek"
        '
        'PictureBox1
        '
        Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
        Me.PictureBox1.Location = New System.Drawing.Point(0, 0)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(424, 64)
        Me.PictureBox1.TabIndex = 1
        Me.PictureBox1.TabStop = False
        '
        'frmAlbumRapport
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(416, 213)
        Me.Controls.Add(Me.PictureBox1)
        Me.Controls.Add(Me.gpbRapportKeuzes)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.MaximizeBox = False
        Me.Name = "frmAlbumRapport"
        Me.gpbRapportKeuzes.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

#Region "Events"

    Private Sub chbVoorAlleAlbums_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chbVoorAlleAlbums.CheckedChanged
        If chbVoorAlleAlbums.Checked Then
            MyBase.Text = "Rapport voor alle albums"
        ElseIf chbVoorAlleAlbums.Checked = False Then
            MyBase.Text = "Rapport voor " & mAlbum.AlbumNaam & " - " & clsFichegenerator.getGroepNaam(mAlbum)
        End If

    End Sub

    Private Sub btnRapport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRapport.Click

        Rapport()

    End Sub

#End Region

    Private Sub Rapport()

        'algemeen object
        Dim oData As Object

        Dim arlAlbums As ArrayList
        arlAlbums = clsAlbumDA.GetAlbums

        If chbVoorAlleAlbums.Checked = True Then
            'clsFichegenerator.AlbumRapport(arlAlbums, chbLocatie.Checked, chbOntleenHistoriek.Checked)
            oData = arlAlbums
        ElseIf chbVoorAlleAlbums.Checked = False Then
            'clsFichegenerator.AlbumRapport(mGegevenAlbum, chbLocatie.Checked, chbOntleenHistoriek.Checked)
            oData = mAlbum
        End If

        'genereert fiche voor 1 of meerdere albums (afhankelijk van inhoud oData
        'en voegt bij elk album locatie en ontleenhistoriek indien gevraagd

        clsFichegenerator.AlbumRapport(oData, chbLocatie.Checked, chbOntleenHistoriek.Checked, sfdAlbumRapport)

    End Sub

End Class
