示例#1
0
 void Export(Account a, string filename)
 {
     if (filename.ToLowerInvariant().EndsWith(".txf"))
     {
         TaxReportDialog options = new TaxReportDialog();
         options.Owner = App.Current.MainWindow;
         if (options.ShowDialog() == true)
         {
             TxfExporter e = new TxfExporter(this.myMoney);
             using (StreamWriter sw = new StreamWriter(filename))
             {
                 e.ExportCapitalGains(a, sw, options.Year, options.ConsolidateSecuritiesOnDateSold);
             }
         }
     }
     else
     {
         Exporters     e    = new Exporters();
         List <object> data = new List <object>();
         foreach (object row in this.MyMoney.Transactions.GetTransactionsFrom(a))
         {
             data.Add(row);
         }
         e.Export(filename, data);
     }
 }
 void Export(Account a, string filename)
 {
     if (filename.ToLowerInvariant().EndsWith(".txf"))
     {
         TaxReportDialog options = new TaxReportDialog();
         options.Month = Settings.TheSettings.FiscalYearStart;
         options.Owner = App.Current.MainWindow;
         if (options.ShowDialog() == true)
         {
             TxfExporter e = new TxfExporter(this.myMoney);
             using (StreamWriter sw = new StreamWriter(filename))
             {
                 DateTime startDate = new DateTime(options.Year, options.Month + 1, 1);
                 if (options.Month > 0)
                 {
                     // then the FY year ends on the specified year.
                     startDate = startDate.AddYears(-1);
                 }
                 DateTime endDate = startDate.AddYears(1);
                 e.ExportCapitalGains(a, sw, startDate, endDate, options.ConsolidateSecuritiesOnDateSold);
             }
         }
     }
     else
     {
         Exporters     e    = new Exporters();
         List <object> data = new List <object>();
         foreach (object row in this.MyMoney.Transactions.GetTransactionsFrom(a))
         {
             data.Add(row);
         }
         e.Export(filename, data);
     }
 }