示例#1
0
        public override void OnExport(string filename, FormatoExportar formato)
        {
            System.Data.DataTable Tabla = this.Connection.Select(this.SelectCommand());

            Lfx.Types.OperationProgress Progreso = new Lfx.Types.OperationProgress("Generando archivos", "Leyendo información de los comprobantes");
            Progreso.Max = Tabla.Rows.Count * 3;
            Progreso.Begin();

            var ArchivoCitiVentas = new Lbl.Archivos.Salida.CitiVentas(Progreso);

            foreach (System.Data.DataRow Registro in Tabla.Rows)
            {
                Lbl.Comprobantes.ComprobanteFacturable ComprobanteFacturable = new Lbl.Comprobantes.ComprobanteFacturable(this.Connection, System.Convert.ToInt32(Registro["id_comprob"]));
                if (!ComprobanteFacturable.Anulado)
                {
                    ArchivoCitiVentas.Comprobantes.Add(ComprobanteFacturable);
                }
                Progreso.Advance(1);
            }

            var ArchivoCitiAlicuotas = new Lbl.Archivos.Salida.CitiVentasAlicuotas(ArchivoCitiVentas);

            var NombreArchivoBase = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(filename), System.IO.Path.GetFileNameWithoutExtension(filename));

            Progreso.Description = "Generando el archivo de ventas";
            ArchivoCitiVentas.Escribir(NombreArchivoBase + " Ventas.txt");

            Progreso.Description = "Generando el archivo de alícuotas";
            ArchivoCitiAlicuotas.Escribir(NombreArchivoBase + " Ventas Alícuotas.txt");

            Progreso.End();

            base.OnExport(filename, formato);
        }
 private void BotonImprimirAvanzado_Click(object sender, EventArgs e)
 {
     this.SaveFormat   = FormatoExportar.ImprimirAvanzado;
     this.DialogResult = DialogResult.OK;
     this.Hide();
 }
 private void BotonExcel_Click(object sender, System.EventArgs e)
 {
     this.SaveFormat   = FormatoExportar.ExcelXml;
     this.DialogResult = System.Windows.Forms.DialogResult.OK;
     this.Hide();
 }
示例#4
0
        protected override void ShowExportDialog()
        {
            if (Listado.Items.Count == 0)
            {
                Lfx.Workspace.Master.RunTime.Toast("No se puede imprimir o exportar el listado porque no contiene datos.", "Listado");
                return;
            }

            using (Lfc.FormularioListadoExportar FormExportar = new Lfc.FormularioListadoExportar())
            {
                if (FormExportar.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    FormatoExportar Formato = FormExportar.SaveFormat;
                    if (Formato == FormatoExportar.Imprimir)
                    {
                        this.OnPrint(false);
                    }
                    else if (Formato == FormatoExportar.ImprimirAvanzado)
                    {
                        this.OnPrint(true);
                    }
                    else
                    {
                        SaveFileDialog DialogoGuardar = new SaveFileDialog();
                        DialogoGuardar.OverwritePrompt = true;
                        DialogoGuardar.ValidateNames   = true;
                        DialogoGuardar.CheckPathExists = true;
                        switch (Formato)
                        {
                        case FormatoExportar.Html:
                            DialogoGuardar.DefaultExt = ".html";
                            DialogoGuardar.Filter     = "Formato HTML|*.htm;*.html";
                            break;

                        case FormatoExportar.Excel:
                            DialogoGuardar.DefaultExt = ".xlsx";
                            DialogoGuardar.Filter     = "Microsoft Excel 2007-2013|*.xlsx";
                            break;
                        }

                        DialogoGuardar.FileName = this.Text.Replace(":", "");
                        if (DialogoGuardar.ShowDialog() == DialogResult.OK)
                        {
                            Lazaro.Pres.Spreadsheet.Workbook Workbook = this.ToWorkbook();
                            string FileName = DialogoGuardar.FileName;
                            this.OnExport(FileName, Formato);
                            try
                            {
                                switch (Formato)
                                {
                                case FormatoExportar.Html:
                                    Workbook.SaveTo(FileName, Lazaro.Pres.Spreadsheet.SaveFormats.Html);
                                    break;

                                case FormatoExportar.Excel:
                                    Workbook.SaveTo(FileName, Lazaro.Pres.Spreadsheet.SaveFormats.Excel);
                                    break;
                                }
                            }
                            catch (Exception ex)
                            {
                                Lfx.Workspace.Master.RunTime.Toast("No se puede guardar el archivo. " + ex.Message, "Error");
                            }
                        }
                    }
                }
            }
        }
 private void BotonImprimirAvanzado_Click(object sender, EventArgs e)
 {
         this.SaveFormat = FormatoExportar.ImprimirAvanzado;
         this.DialogResult = DialogResult.OK;
         this.Hide();
 }
		private void BotonExcel_Click(object sender, System.EventArgs e)
		{
                        this.SaveFormat = FormatoExportar.ExcelXml;
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Hide();
		}