using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using LLNet.Utils;
using LLNet.GUI;

namespace LLNet.Tienda
{
    public partial class FrmBitacora : Form
    {
        /**************************Idalí GF************************************/
        public static DateTime Fecha = DateTime.Now; //Fecha a consultar

        public FrmBitacora()
        {
            InitializeComponent();
        }

        #region sbtnSalir_Click
        private void sbtnSalir_Click(object sender, EventArgs e)
        {
            Close();
        }
        #endregion

        #region mCalendario_DateSelected
        private void mCalendario_DateSelected(object sender, DateRangeEventArgs e)
        {
            Fecha = mCalendario.SelectionRange.Start;
            gridcMarcas.DataSource = null; //Limpia el datagrid
            FrmBitacora_Load(null, null);
        }
        #endregion

        #region FrmBitacora_Load
        private void FrmBitacora_Load(object sender, EventArgs e)
        {
            DataSet ds_marcas = new DataSet();
            //
            if (Fecha.Year == 1)
            {
                Fecha = DateTime.Now;
            }
            //
            Utils.QueryParams parametro = new LLNet.Utils.QueryParams();
            parametro.AddReplaceParam("fecha", Fecha.ToString()); //Envia la fecha de la marca a consultar
            ds_marcas = GUI.CApp.bll.getDataSet("PDV", "C_MARCAS_FECHA", parametro);
            //Llena el datagrid
            gridcMarcas.DataSource = ds_marcas;
            gridcMarcas.DataMember = ds_marcas.Tables[0].ToString();
        }
        #endregion

        #region FrmBitacora_KeyDown
        private void FrmBitacora_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F6)
            {
                Close();
            }
        }
        #endregion
    }
}