public bool Equals(EncabezadoImp obj) { return(this.Moneda == obj.Moneda && this.Fecha_Transmision.Equals(obj.Fecha_Transmision) && this.RNC_Empresa.Equals(obj.RNC_Empresa) && this.CodBanco.Equals(obj.CodBanco)); }
public static void Print(EncabezadoImp item) { folder = null; decimal total = 0; StringBuilder printer = new StringBuilder(); EncabezadoPrint ep = new EncabezadoPrint() { RNC_Empresa = item.RNC_Empresa, CodBanco = item.CodBanco, Moneda = item.Moneda, MonedaEntity = item.MonedaEntity, Detalles = Casting(item.DetalleImp.ToList()), Fecha_Transmision = item.Fecha_Transmision, DetalleImp = item.DetalleImp, MesPago = item.MesPago, Id = item.Id }; printer.AppendLine(ep.ToString()); foreach (DetallePrint i in ep.Detalles) { printer.AppendLine(i.ToString()); total += i.SalarioISR; } printer.Append("S ") .Append(ep.DetalleImp.Count.ToString().PadRight(5)) .Append(total.ToString().PadRight(10)); Console.WriteLine(printer.ToString()); var dir = new FolderBrowserDialog(); if (dir.ShowDialog() == DialogResult.OK) { folder = dir.SelectedPath; } else { folder = string.Empty; } // If the file name is not an empty string open it for saving. if (folder != "") { string filename = folder + $"\\file{DateTime.Now.ToString("yyyyMMddHHmmss")}.txt"; // Saves the Image via a FileStream created by the OpenFile method. StreamWriter fs = File.AppendText(filename); fs.WriteLine(printer.ToString()); fs.Close(); MessageBox.Show("Archivo Impreso!!!!!!!!!!!!!!!!!"); } }