using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FEQ0000.Purchase
{
    public partial class rPurchase : Form
    {
        public rPurchase()
        {
            InitializeComponent();
        }

        private void rPurchase_Load(object sender, EventArgs e)
        {
            this.dtSD.Text = DateTime.Now.Year.ToString("0000") + "-01-01";
            this.dtED.Text = DateTime.Now.Year.ToString("0000") + "-12-31";

            this.rpv1.PageCountMode = Microsoft.Reporting.WinForms.PageCountMode.Actual;
            this.rpv1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.PageWidth;

            this.cmbReport.SelectedIndex = 0;

            refreshData();
        }

        private void btSearch_Click(object sender, EventArgs e)
        {
            refreshData();
        }
        void refreshData()
        {
            this.ta.FillDate(this.dsPurchase.Purchase, dtSD.Text, dtED.Text,FCOMMON.info.Login.gcode);

            //Set DataSource
            Microsoft.Reporting.WinForms.ReportDataSource DsEQ = new Microsoft.Reporting.WinForms.ReportDataSource();
            DsEQ.Name = "DataSet1";
            DsEQ.Value = this.dsPurchase.Purchase;

            switch (this.cmbReport.SelectedIndex)
            {
                case 0: //사용자 - 월
                    this.rpv1.LocalReport.ReportEmbeddedResource = "FEQ0000.Purchase.Rpt_Purchase.rdlc";
                    break;
                case 1: //공정 - 월
                    this.rpv1.LocalReport.ReportEmbeddedResource = "FEQ0000.Purchase.Rpt_PurchasePrc.rdlc";
                    break;
                case 2: //프로젝트 - 월
                    this.rpv1.LocalReport.ReportEmbeddedResource = "FEQ0000.Purchase.Rpt_PurchasePrj.rdlc";
                    break;
            }
            this.rpv1.LocalReport.DataSources.Clear();
            this.rpv1.LocalReport.DataSources.Add(DsEQ);
            this.rpv1.RefreshReport();


        }
    }
}
