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); } } }
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); } } }
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; } }
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); } } }
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; }
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); } }
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; }
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; }