public Canvas SoCF( CashFlowStatement cf ) { var c = new Canvas( ); int max = "Other Investing Cash Flow Items, Total".Length * 6; // Net Income/Starting Line var laz = new Label( ); laz.FontSize = 10; laz.Content = "Net Income/Starting Line"; c.Children.Add( laz ); Canvas.SetLeft( laz, 0 ); Canvas.SetTop( laz, 0 ); var az = new Label( ); az.FontSize = 10; az.Content = FormattedCurrencyString(cf.Net_Income_and_Starting_Line); c.Children.Add( az ); Canvas.SetLeft( az, max ); Canvas.SetTop( az, 0 ); // Depreciation/Depletion var ldd = new Label( ); ldd.FontSize = 10; ldd.Content = "Depreciation/Depletion"; c.Children.Add( ldd ); Canvas.SetLeft( ldd, 0 ); Canvas.SetTop( ldd, 15 ); var dd = new Label( ); dd.FontSize = 10; dd.Content = FormattedCurrencyString( cf.Depreciation_and_Depletion ); c.Children.Add( dd ); Canvas.SetLeft( dd, max ); Canvas.SetTop( dd, 15 ); // Amortization var la = new Label( ); la.FontSize = 10; la.Content = "Amortization"; c.Children.Add( la ); Canvas.SetLeft( la, 0 ); Canvas.SetTop( la, 30 ); var a = new Label( ); a.FontSize = 10; a.Content = FormattedCurrencyString(cf.Amortization); c.Children.Add( a ); Canvas.SetLeft( a, max ); Canvas.SetTop( a, 30 ); // Deferred Taxes var lt = new Label( ); lt.FontSize = 10; lt.Content = "Deferred Taxes"; c.Children.Add( lt ); Canvas.SetLeft( lt, 0 ); Canvas.SetTop( lt, 45 ); var t = new Label( ); t.FontSize = 10; t.Content = FormattedCurrencyString(cf.Deferred_Taxes); c.Children.Add( t ); Canvas.SetLeft( t, max ); Canvas.SetTop( t, 45 ); // Non-Cash Items var lnci = new Label( ); lnci.FontSize = 10; lnci.Content = "Non-Cash Items"; c.Children.Add( lnci ); Canvas.SetLeft( lnci, 0 ); Canvas.SetTop( lnci, 60 ); var nci = new Label( ); nci.FontSize = 10; nci.Content = FormattedCurrencyString( cf.NonCash_Items ); c.Children.Add( nci ); Canvas.SetLeft( nci, max ); Canvas.SetTop( nci, 60 ); // Changes in Working Capital var lciwc = new Label( ); lciwc.FontSize = 10; lciwc.Content = "Changes in Working Capital"; c.Children.Add( lciwc ); Canvas.SetLeft( lciwc, 0 ); Canvas.SetTop( lciwc, 75 ); var ciwc = new Label( ); ciwc.FontSize = 10; ciwc.Content = FormattedCurrencyString( cf.Changes_in_Working_Capital ); c.Children.Add( ciwc ); Canvas.SetLeft( ciwc, max ); Canvas.SetTop( ciwc, 75 ); // Cash from Operating Activities var lcfoa = new Label( ); lcfoa.FontSize = 10; lcfoa.Content = "Cash from Operating Activities"; c.Children.Add( lcfoa ); Canvas.SetLeft( lcfoa, 0 ); Canvas.SetTop( lcfoa, 90 ); var cfoa = new Label( ); cfoa.FontSize = 10; cfoa.Content = FormattedCurrencyString( cf.Cash_from_Operating_Activities ); c.Children.Add( cfoa ); Canvas.SetLeft( cfoa, max ); Canvas.SetTop( cfoa, 90 ); // Capital Expenditures var lce = new Label( ); lce.FontSize = 10; lce.Content = "Capital Expenditures"; c.Children.Add( lce ); Canvas.SetLeft( lce, 0 ); Canvas.SetTop( lce, 105 ); var ce = new Label( ); ce.FontSize = 10; ce.Content = FormattedCurrencyString(cf.Capital_Expenditures); c.Children.Add( ce ); Canvas.SetLeft( ce, max ); Canvas.SetTop( ce, 105 ); // Other Investing Cash Flow Items, Total var loicfit = new Label( ); loicfit.FontSize = 10; loicfit.Content = "Other Investing Cash Flow Items, Total"; c.Children.Add( loicfit ); Canvas.SetLeft( loicfit, 0 ); Canvas.SetTop( loicfit, 120 ); var oicfit = new Label( ); oicfit.FontSize = 10; oicfit.Content = FormattedCurrencyString( cf.Other_Investing_Cash_Flow_Items__Total ); c.Children.Add( oicfit ); Canvas.SetLeft( oicfit, max ); Canvas.SetTop( oicfit, 120 ); // Cash from Investing Activities var lcfia = new Label( ); lcfia.FontSize = 10; lcfia.Content = "Cash from Investing Activities"; c.Children.Add( lcfia ); Canvas.SetLeft( lcfia, 0 ); Canvas.SetTop( lcfia, 135 ); var cfia = new Label( ); cfia.FontSize = 10; cfia.Content = FormattedCurrencyString( cf.Cash_from_Investing_Activities ); c.Children.Add( cfia ); Canvas.SetLeft( cfia, max ); Canvas.SetTop( cfia, 135 ); // Financing Cash Flow Items var lfcfi = new Label( ); lfcfi.FontSize = 10; lfcfi.Content = "Financing Cash Flow Items"; c.Children.Add( lfcfi ); Canvas.SetLeft( lfcfi, 0 ); Canvas.SetTop( lfcfi, 150 ); var fcfi = new Label( ); fcfi.FontSize = 10; fcfi.Content = FormattedCurrencyString(cf.Financing_Cash_Flow_Items); c.Children.Add( fcfi ); Canvas.SetLeft( fcfi, max ); Canvas.SetTop( fcfi, 150 ); // Total Cash Dividends Paid var ltcdp = new Label( ); ltcdp.FontSize = 10; ltcdp.Content = "Total Cash Dividends Paid"; c.Children.Add( ltcdp ); Canvas.SetLeft( ltcdp, 0 ); Canvas.SetTop( ltcdp, 165 ); var tcdp = new Label( ); tcdp.FontSize = 10; tcdp.Content = FormattedCurrencyString(cf.Total_Cash_Dividends_Paid); c.Children.Add( tcdp ); Canvas.SetLeft( tcdp, max ); Canvas.SetTop( tcdp, 165 ); // Issuance (Retirement) of Stock, Net var lirosn = new Label( ); lirosn.FontSize = 10; lirosn.Content = "Issuance (Retirement) of Stock, Net"; c.Children.Add( lirosn ); Canvas.SetLeft( lirosn, 0 ); Canvas.SetTop( lirosn, 180 ); var irosn = new Label( ); irosn.FontSize = 10; irosn.Content = FormattedCurrencyString(cf.Issuance__Retirement__of_Stock__Net); c.Children.Add( irosn ); Canvas.SetLeft( irosn, max ); Canvas.SetTop( irosn, 180 ); // Issuance (Retirement) of Debt, Net var lirodn = new Label( ); lirodn.FontSize = 10; lirodn.Content = "Issuance (Retirement) of Debt, Net"; c.Children.Add( lirodn ); Canvas.SetLeft( lirodn, 0 ); Canvas.SetTop( lirodn, 195 ); var irodn = new Label( ); irodn.FontSize = 10; irodn.Content = FormattedCurrencyString( cf.Issuance__Retirement__of_Debt__Net ); c.Children.Add( irodn ); Canvas.SetLeft( irodn, max ); Canvas.SetTop( irodn, 195 ); // Cash from Financing Activities var lcffa = new Label( ); lcffa.FontSize = 10; lcffa.Content = "Cash from Financing Activities"; c.Children.Add( lcffa ); Canvas.SetLeft( lcffa, 0 ); Canvas.SetTop( lcffa, 210 ); var cffa = new Label( ); cffa.FontSize = 10; cffa.Content = FormattedCurrencyString( cf.Cash_from_Financing_Activities ); c.Children.Add( cffa ); Canvas.SetLeft( cffa, max ); Canvas.SetTop( cffa, 210 ); // Foreign Exchange Effects var lfee = new Label( ); lfee.FontSize = 10; lfee.Content = "Foreign Exchange Effects"; c.Children.Add( lfee ); Canvas.SetLeft( lfee, 0 ); Canvas.SetTop( lfee, 225 ); var fee = new Label( ); fee.FontSize = 10; fee.Content = FormattedCurrencyString( cf.Foreign_Exchange_Effects ); c.Children.Add( fee ); Canvas.SetLeft( fee, max ); Canvas.SetTop( fee, 225 ); // Net Change in Cash var lncic = new Label( ); lncic.FontSize = 10; lncic.Content = "Net Change in Cash"; c.Children.Add( lncic ); Canvas.SetLeft( lncic, 0 ); Canvas.SetTop( lncic, 240 ); var ncic = new Label( ); ncic.FontSize = 10; ncic.Content = FormattedCurrencyString( cf.Net_Change_in_Cash ); c.Children.Add( ncic ); Canvas.SetLeft( ncic, max ); Canvas.SetTop( ncic, 240 ); // Cash Interest Paid, Supplemental var lcips = new Label( ); lcips.FontSize = 10; lcips.Content = "Cash Interest Paid, Supplemental"; c.Children.Add( lcips ); Canvas.SetLeft( lcips, 0 ); Canvas.SetTop( lcips, 255 ); var cips = new Label( ); cips.FontSize = 10; cips.Content = FormattedCurrencyString( cf.Cash_Interest_Paid__Supplemental ); c.Children.Add( cips ); Canvas.SetLeft( cips, max ); Canvas.SetTop( cips, 255 ); // Cash Taxes Paid, Supplemental var lctps = new Label( ); lctps.FontSize = 10; lctps.Content = "Cash Taxes Paid, Supplemental"; c.Children.Add( lctps ); Canvas.SetLeft( lctps, 0 ); Canvas.SetTop( lctps, 270 ); var ctps = new Label( ); ctps.FontSize = 10; ctps.Content = FormattedCurrencyString( cf.Cash_Taxes_Paid__Supplemental ); c.Children.Add( ctps ); Canvas.SetLeft( ctps, max ); Canvas.SetTop( ctps, 270 ); return c; }
static void SaveCashFlowStatement( CashFlowStatement cfs ) { string tabName = ( cfs.Period == Period.Annual ? "A" : "Q" ) + "_" + cfs.PeriodEnd.ToShortDateString( ).Replace( "/", "_" ); var ws = pck.Workbook.Worksheets.FirstOrDefault( i=> i.Name == tabName) == null ? pck.Workbook.Worksheets.Add( tabName ) : pck.Workbook.Worksheets.Add( tabName + "_2" ); ws.Cells [ 1, 1 ].Value = "Cashflow Statement for " + ( cfs.Period == Period.Annual ? " Year" : " Quarter" ) + " Ending " + cfs.PeriodEnd.ToShortDateString( ); ws.Cells [ "A1:H1" ].Merge = true; ws.Cells [ 3, 1 ].Value = "Net Income/Starting Line"; ws.Cells [ 3, 2 ].Value = cfs.Net_Income_and_Starting_Line; ws.Cells [ 4, 1 ].Value = "Depreciation/Depletion"; ws.Cells [ 4, 2 ].Value = cfs.Depreciation_and_Depletion; ws.Cells [ 5, 1 ].Value = "Amortization"; ws.Cells [ 5, 2 ].Value = cfs.Amortization; ws.Cells [ 6, 1 ].Value = "Deferred Taxes"; ws.Cells [ 6, 2 ].Value = cfs.Deferred_Taxes; ws.Cells [ 7, 1 ].Value = "Non-Cash Items"; ws.Cells [ 7, 2 ].Value = cfs.NonCash_Items; ws.Cells [ 8, 1 ].Value = "Changes in Working Capital"; ws.Cells [ 8, 2 ].Value = cfs.Changes_in_Working_Capital; ws.Cells [ 9, 1 ].Value = "Cash from Operating Activities"; ws.Cells [ 9, 2 ].Value = cfs.Cash_from_Operating_Activities; ws.Cells["A9:B9"].Style.Font.Bold = true; ws.Cells [ "A9:B9" ].Style.Border.Top.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thick; ws.Cells [ "A9:B9" ].Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thick; ws.Cells [ "A9:A9" ].Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thick; ws.Cells [ "B9:B9" ].Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thick; ws.Cells [ 10, 1 ].Value = "Capital Expenditures"; ws.Cells [ 10, 2 ].Value = cfs.Capital_Expenditures; ws.Cells [ 11, 1 ].Value = "Other Investing Cash Flow Items, Total"; ws.Cells [ 11, 2 ].Value = cfs.Other_Investing_Cash_Flow_Items__Total; ws.Cells [ 12, 1 ].Value = "Cash from Investing Activities"; ws.Cells [ 12, 2 ].Value = cfs.Cash_from_Investing_Activities; ws.Cells [ "A12:B12" ].Style.Font.Bold = true; ws.Cells [ "A12:B12" ].Style.Border.Top.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thick; ws.Cells [ "A12:B12" ].Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thick; ws.Cells [ "A12:A12" ].Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thick; ws.Cells [ "B12:B12" ].Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thick; ws.Cells [ 13, 1 ].Value = "Financing Cash Flow Items"; ws.Cells [ 13, 2 ].Value = cfs.Financing_Cash_Flow_Items; ws.Cells [ 14, 1 ].Value = "Total Cash Dividends Paid"; ws.Cells [ 14, 2 ].Value = cfs.Total_Cash_Dividends_Paid; ws.Cells [ 15, 1 ].Value = "Issuance (Retirement) of Stock, Net"; ws.Cells [ 15, 2 ].Value = cfs.Issuance__Retirement__of_Stock__Net; ws.Cells [ 16, 1 ].Value = "Issuance (Retirement) of Debt, Net"; ws.Cells [ 16, 2 ].Value = cfs.Issuance__Retirement__of_Debt__Net; ws.Cells [ 17, 1 ].Value = "Cash from Financing Activities"; ws.Cells [ 17, 2 ].Value = cfs.Cash_from_Financing_Activities; ws.Cells [ "A17:B17" ].Style.Font.Bold = true; ws.Cells [ "A17:B17" ].Style.Border.Top.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thick; ws.Cells [ "A17:B17" ].Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thick; ws.Cells [ "A17:A17" ].Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thick; ws.Cells [ "B17:B17" ].Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thick; ws.Cells [ 18, 1 ].Value = "Foreign Exchange Effects"; ws.Cells [ 18, 2 ].Value = cfs.Foreign_Exchange_Effects; ws.Cells [ 19, 1 ].Value = "Net Change in Cash"; ws.Cells [ 19, 2 ].Value = cfs.Net_Change_in_Cash; ws.Cells [ 20, 1 ].Value = "Cash Interest Paid, Supplemental"; ws.Cells [ 20, 2 ].Value = cfs.Cash_Interest_Paid__Supplemental; ws.Cells [ 21, 1 ].Value = "Cash Taxes Paid, Supplemental"; ws.Cells [ 21, 2 ].Value = cfs.Cash_Taxes_Paid__Supplemental; ws.Cells [ "A3:B3" ].Style.Border.Top.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin; ws.Cells [ "A3:A21" ].Style.Border.Left.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin; ws.Cells [ "B3:B21" ].Style.Border.Right.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin; ws.Cells [ "A21:B21" ].Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin; for ( int i = 3; i < 22; i++ ) { if ( ws.Cells [ i, 2 ].Value != null && Convert.ToDouble( ws.Cells [ i, 2 ].Value ) > 0 ) ws.Cells [ i, 2 ].Style.Numberformat.Format = "\"$\"#,##0;"; } //else }