Ejemplo n.º 1
0
 private void _Bt_Exportar_Click(object sender, EventArgs e)
 {
     if (_Dg_Grid.RowCount > 0)
     {
         try
         {
             if (_Sfd_1.ShowDialog() == DialogResult.OK)
             {
                 var _Dt_Tabla = new DataTable();
                 if (_Dg_Grid.DataSource.GetType() == typeof(DataView))
                 {
                     _Dt_Tabla = ((DataView)_Dg_Grid.DataSource).ToTable();
                 }
                 else
                 {
                     _Dt_Tabla = (DataTable)_Dg_Grid.DataSource;
                 }
                 Cursor = Cursors.WaitCursor;
                 Clases._Cls_ExcelUtilidades _MyExcel = new T3.Clases._Cls_ExcelUtilidades();
                 _MyExcel._Mtd_DatasetToExcel(_Dt_Tabla, _Sfd_1.FileName, "CONTEO_INVENT " + CLASES._Cls_Varios_Metodos._Mtd_SQLGetDate().Day.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Year.ToString(), _Dg_Grid.Columns);
                 _MyExcel = null;
                 Cursor   = Cursors.Default;
             }
         }
         catch { Cursor = Cursors.Default; MessageBox.Show("Error al intentar exportar", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); }
     }
 }
Ejemplo n.º 2
0
        private void _Mtd_Exportar()
        {
            string _Str_Sql = "SELECT cvendedor AS Vendedor,cidrelacobro AS Relación,ccliente AS Cliente,CONVERT(NUMERIC,nc,18) AS NC,nc_ctotaldocu AS Monto,cnumdocu AS Factura FROM VST_CAJA_NC_APLICADAS_RPT WHERE cgroupcomp='" + Frm_Padre._Str_GroupComp + "' AND ccompany='" + Frm_Padre._Str_Comp + "' AND ccaja='" + _Txt_Caja.Text + "'";

            if (_Txt_Caja_2.Text.Trim().Length > 0)
            {
                _Str_Sql = "SELECT cvendedor AS Vendedor,cidrelacobro AS Relación,ccliente AS Cliente,CONVERT(NUMERIC,nc,18) AS NC,nc_ctotaldocu AS Monto,cnumdocu AS Factura FROM VST_CAJA_NC_APLICADAS_RPT WHERE cgroupcomp='" + Frm_Padre._Str_GroupComp + "' AND ccompany='" + Frm_Padre._Str_Comp + "' AND convert(numeric(18,0),ccaja) BETWEEN " + _Txt_Caja.Text + " AND " + _Txt_Caja_2.Text + " ORDER BY convert(numeric(18,0),ccaja)";
                DataSet _Ds = Program._MyClsCnn._mtd_conexion._Mtd_RetornarDataset(_Str_Sql);
                if (_Ds.Tables[0].Rows.Count > 0)
                {
                    if (_Sfd_1.ShowDialog() == DialogResult.OK)
                    {
                        Clases._Cls_ExcelUtilidades _MyExcel = new T3.Clases._Cls_ExcelUtilidades();
                        _MyExcel._Mtd_DatasetToExcel(_Ds.Tables[0], _Sfd_1.FileName, "NCAPLI_CAJ_" + _Txt_Caja.Text.Trim() + "_" + _Txt_Caja_2.Text.Trim());
                        _MyExcel = null;
                    }
                }
                else
                {
                    MessageBox.Show("No existen Notas de Crédito.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                int _Int_CajaPorCerrar = _Mtd_CajaPorCerrar();
                if (!_Chk_PorAplicar.Checked | (_Chk_PorAplicar.Checked & _Int_CajaPorCerrar > 0))
                {
                    if (_Chk_PorAplicar.Checked)
                    {
                        _Str_Sql = "SELECT cvendedor AS Vendedor,cidrelacobro AS Relación,ccliente AS Cliente,CONVERT(NUMERIC,nc,18) AS NC,nc_ctotaldocu AS Monto,cnumdocu AS Factura FROM VST_CAJA_NC_APLICADAS_RPT WHERE cgroupcomp='" + Frm_Padre._Str_GroupComp + "' AND ccompany='" + Frm_Padre._Str_Comp + "' AND ccaja='" + _Int_CajaPorCerrar + "'";
                    }
                    DataSet _Ds = Program._MyClsCnn._mtd_conexion._Mtd_RetornarDataset(_Str_Sql);
                    if (_Ds.Tables[0].Rows.Count > 0)
                    {
                        if (_Sfd_1.ShowDialog() == DialogResult.OK)
                        {
                            Clases._Cls_ExcelUtilidades _MyExcel = new T3.Clases._Cls_ExcelUtilidades();
                            if (_Chk_PorAplicar.Checked)
                            {
                                _MyExcel._Mtd_DatasetToExcel(_Ds.Tables[0], _Sfd_1.FileName, "NCPORAPLI_CAJ");
                            }
                            else
                            {
                                _MyExcel._Mtd_DatasetToExcel(_Ds.Tables[0], _Sfd_1.FileName, "NCAPLI_CAJ_" + _Txt_Caja.Text.Trim());
                            }
                            _MyExcel = null;
                        }
                    }
                    else
                    {
                        MessageBox.Show("No existen Notas de Crédito.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("No existe una caja por cerrar", "información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Ejemplo n.º 3
0
        private void _Mtd_GenerarListado()
        {
            string _Str_CodigoCompania = Frm_Padre._Str_Comp;

            string _Str_Sql = "select Grupo, Usuario, Nombre, 0 as Comision from VST_INC_VIS_LISTADO_INCENTIVADOS where ccompany = '" + _Str_CodigoCompania + "'";

            DataSet _Ds_Data = Program._MyClsCnn._mtd_conexion._Mtd_RetornarDataset(_Str_Sql);

            if (_Ds_Data.Tables[0].Rows.Count > 0)
            {
                Clases._Cls_ExcelUtilidades _Cls_ExcelUtilidades = new T3.Clases._Cls_ExcelUtilidades();
                _Cls_ExcelUtilidades._Mtd_DatasetToExcel(_Ds_Data.Tables[0], _Sfd_Generar.FileName, "LISTADO");
                _Cls_ExcelUtilidades = null;
            }
        }
Ejemplo n.º 4
0
        private void _Btn_Exportar_Click(object sender, EventArgs e)
        {
            if (_Dg_Grid2.RowCount > 0)
            {
                try
                {
                    if (_Sfd_1.ShowDialog() == DialogResult.OK)
                    {
                        Cursor = Cursors.WaitCursor;
                        Clases._Cls_ExcelUtilidades _MyExcel = new T3.Clases._Cls_ExcelUtilidades();

                        //Obtenemos el DataTable a exportar
                        var _Dt_Exportar = ((DataTable)_Dg_Grid2.DataSource).Copy();

                        //Removemos las Columnas no Necesarias
                        var      _Col_Columnas = _Dg_Grid2.Columns;
                        string[] remove_col    = new string[] { "_Dg_Grid2Col_cproveedor",
                                                                "_Dg_Grid2Col_c_nomb_comer",
                                                                "_Dg_Grid2Col_ctmovimiento",
                                                                "_Dg_Grid2Col_cgrupo" };
                        string[] remove_dt = new string[] { "cproveedor",
                                                            "c_nomb_comer",
                                                            "ctmovimiento",
                                                            "cgrupo" };
                        foreach (var item in remove_dt)
                        {
                            if (_Dt_Exportar.Columns.Contains(item.ToString()))
                            {
                                _Dt_Exportar.Columns.Remove(item.ToString());
                            }
                        }
                        foreach (var item in remove_col)
                        {
                            if (_Col_Columnas.Contains(item.ToString()))
                            {
                                _Col_Columnas.Remove(item.ToString());
                            }
                        }
                        //-----------------------------------

                        _MyExcel._Mtd_DatasetToExcel(_Dt_Exportar, _Sfd_1.FileName, "MOVIMIEN_INVENT_" + CLASES._Cls_Varios_Metodos._Mtd_SQLGetDate().Day.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Year.ToString(), _Col_Columnas);
                        _MyExcel = null;
                        Cursor   = Cursors.Default;
                    }
                }
                catch { Cursor = Cursors.Default; MessageBox.Show("Error al intentar exportar", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); }
            }
        }
Ejemplo n.º 5
0
        private void _Btn_Exportar_Click(object sender, EventArgs e)
        {
            Clases._Cls_ExcelUtilidades _MyExcel = new T3.Clases._Cls_ExcelUtilidades();

            Cursor = Cursors.WaitCursor;

            if (this._Ctr_Dialogo.ShowDialog() == DialogResult.OK)
            {
                if (this._Ctr_Dialogo.FileName != "")
                {
                    _MyExcel._Mtd_DatasetToExcel((DataTable)this._Dg_Grid.DataSource, this._Ctr_Dialogo.FileName, "Facturas");
                }
            }

            _MyExcel = null;

            Cursor = Cursors.Default;
        }
Ejemplo n.º 6
0
 private void _Btn_Exportar_Click(object sender, EventArgs e)
 {
     if (_Cmb_NR.SelectedIndex > 0)
     {
         SaveFileDialog _Sfd_1 = new SaveFileDialog();
         _Sfd_1.Filter = "xls files (*.xls)|*.xls";
         if (_Sfd_1.ShowDialog() == DialogResult.OK)
         {
             Cursor = Cursors.WaitCursor;
             Clases._Cls_ExcelUtilidades _MyExcel = new T3.Clases._Cls_ExcelUtilidades();
             _MyExcel._Mtd_DatasetToExcel(new DataTable[] { (DataTable)_Dg_Grid_NR.DataSource, (DataTable)_Dg_Grid_FAC.DataSource, (DataTable)_Dg_Grid_OC.DataSource }, _Sfd_1.FileName, new string[] { "Nota de Recepción", "Factura", "Orden de Compra" });
             _MyExcel = null;
             Cursor   = Cursors.Default;
         }
     }
     else
     {
         MessageBox.Show("Debe seleccionar una Nota de Recepción", "Requerimiento", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 7
0
 private void _Mtd_CrearGridExportar()
 {
     _Mtd_ActualizarDias(1);
     _Mtd_ActualizarDias(2);
     _Mtd_ActualizarDias(3);
     _Mtd_ActualizarDias(4);
     _Mtd_ActualizarDias(5);
     _Mtd_ActualizarDias(6);
     _Mtd_ActualizarDias(7);
     if (_Sfd_1.ShowDialog() == DialogResult.OK)
     {
         try
         {
             DataGridView _Dtg_Grid = new DataGridView();
             DataGridViewTextBoxColumn _Dtg_Columna  = new DataGridViewTextBoxColumn();
             DataGridViewTextBoxColumn _Dtg_Columna1 = new DataGridViewTextBoxColumn();
             DataGridViewTextBoxColumn _Dtg_Columna2 = new DataGridViewTextBoxColumn();
             DataGridViewTextBoxColumn _Dtg_Columna3 = new DataGridViewTextBoxColumn();
             DataGridViewTextBoxColumn _Dtg_Columna4 = new DataGridViewTextBoxColumn();
             DataGridViewTextBoxColumn _Dtg_Columna5 = new DataGridViewTextBoxColumn();
             _Dtg_Grid.Columns.Add(_Dtg_Columna);
             _Dtg_Grid.Columns.Add(_Dtg_Columna1);
             _Dtg_Grid.Columns.Add(_Dtg_Columna2);
             _Dtg_Grid.Columns.Add(_Dtg_Columna3);
             _Dtg_Grid.Columns.Add(_Dtg_Columna4);
             _Dtg_Grid.Columns.Add(_Dtg_Columna5);
             _Dtg_Grid.Columns[0].HeaderText = "Día";
             _Dtg_Grid.Columns[1].HeaderText = "Código";
             _Dtg_Grid.Columns[2].HeaderText = "Nombre";
             _Dtg_Grid.Columns[3].HeaderText = "Dirección";
             _Dtg_Grid.Columns[4].HeaderText = "Preferencia";
             _Dtg_Grid.Columns[5].HeaderText = "Hora";
             foreach (DataGridViewRow _Dtg_Row in _Dg_Lunes.Rows)
             {
                 _Dtg_Grid.Rows.Add(new object[] { "Lunes", _Dtg_Row.Cells[0].Value.ToString(), _Dtg_Row.Cells[1].Value.ToString(), _Dtg_Row.Cells[2].Value.ToString(), _Dtg_Row.Cells[3].Value.ToString(), _Dtg_Row.Cells[4].Value.ToString() });
             }
             foreach (DataGridViewRow _Dtg_Row in _Dg_Martes.Rows)
             {
                 _Dtg_Grid.Rows.Add(new object[] { "Martes", _Dtg_Row.Cells[0].Value.ToString(), _Dtg_Row.Cells[1].Value.ToString(), _Dtg_Row.Cells[2].Value.ToString(), _Dtg_Row.Cells[3].Value.ToString(), _Dtg_Row.Cells[4].Value.ToString() });
             }
             foreach (DataGridViewRow _Dtg_Row in _Dg_Miercoles.Rows)
             {
                 _Dtg_Grid.Rows.Add(new object[] { "Miércoles", _Dtg_Row.Cells[0].Value.ToString(), _Dtg_Row.Cells[1].Value.ToString(), _Dtg_Row.Cells[2].Value.ToString(), _Dtg_Row.Cells[3].Value.ToString(), _Dtg_Row.Cells[4].Value.ToString() });
             }
             foreach (DataGridViewRow _Dtg_Row in _Dg_Jueves.Rows)
             {
                 _Dtg_Grid.Rows.Add(new object[] { "Jueves", _Dtg_Row.Cells[0].Value.ToString(), _Dtg_Row.Cells[1].Value.ToString(), _Dtg_Row.Cells[2].Value.ToString(), _Dtg_Row.Cells[3].Value.ToString(), _Dtg_Row.Cells[4].Value.ToString() });
             }
             foreach (DataGridViewRow _Dtg_Row in _Dg_Viernes.Rows)
             {
                 _Dtg_Grid.Rows.Add(new object[] { "Viernes", _Dtg_Row.Cells[0].Value.ToString(), _Dtg_Row.Cells[1].Value.ToString(), _Dtg_Row.Cells[2].Value.ToString(), _Dtg_Row.Cells[3].Value.ToString(), _Dtg_Row.Cells[4].Value.ToString() });
             }
             foreach (DataGridViewRow _Dtg_Row in _Dg_Sabado.Rows)
             {
                 _Dtg_Grid.Rows.Add(new object[] { "Sábado", _Dtg_Row.Cells[0].Value.ToString(), _Dtg_Row.Cells[1].Value.ToString(), _Dtg_Row.Cells[2].Value.ToString(), _Dtg_Row.Cells[3].Value.ToString(), _Dtg_Row.Cells[4].Value.ToString() });
             }
             foreach (DataGridViewRow _Dtg_Row in _Dg_Domingo.Rows)
             {
                 _Dtg_Grid.Rows.Add(new object[] { "Domingo", _Dtg_Row.Cells[0].Value.ToString(), _Dtg_Row.Cells[1].Value.ToString(), _Dtg_Row.Cells[2].Value.ToString(), _Dtg_Row.Cells[3].Value.ToString(), _Dtg_Row.Cells[4].Value.ToString() });
             }
             if (_Dtg_Grid.Rows.Count > 0)
             {
                 Clases._Cls_ExcelUtilidades _Cls_Excel = new T3.Clases._Cls_ExcelUtilidades();
                 _Cls_Excel._Mtd_DgViewToExcel(_Dtg_Grid, _Sfd_1.FileName, "Rutas_" + _Dg_Zonas[0, _Dg_Zonas.CurrentCell.RowIndex].Value.ToString());
             }
         }
         catch
         {
         }
     }
 }
Ejemplo n.º 8
0
 private void _Mtd_Consultar()
 {
     Clases._Cls_ExcelUtilidades _MyExcel = new T3.Clases._Cls_ExcelUtilidades();
     _MyExcel._Mtd_DatasetToExcel(_Ds_Temp.Tables[0], _Sfd_1.FileName, "VALORIZACION_INV " + CLASES._Cls_Varios_Metodos._Mtd_SQLGetDate().Day.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Year.ToString());
     _MyExcel = null;
 }
Ejemplo n.º 9
0
 private void _Mtd_ExportarReporteProcesoExcel()
 {
     Clases._Cls_ExcelUtilidades _MyExcel = new T3.Clases._Cls_ExcelUtilidades();
     _MyExcel._Mtd_DatasetToExcel(_Ds_ExportarReporte.Tables[0], _Sfd_1.FileName, "COB_DET_CAJA_" + CLASES._Cls_Varios_Metodos._Mtd_SQLGetDate().Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString());
     _MyExcel = null;
 }