Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
balance_sheet_sql_report [2019/01/30 15:59]
kcifreo
balance_sheet_sql_report [2019/02/20 10:38]
kcifreo
Line 3: Line 3:
 This SQL (Report) can be used to pull the Balance Sheet for any period in an easy-to-export format. This SQL (Report) can be used to pull the Balance Sheet for any period in an easy-to-export format.
  
-<html><div style="margin-left: 40px;"> Note: **The Retained Earnings balance is not pulled into this report**. The retained earnings amount calculation is shown in a separate SQL below, but is not included as a row in the report </div></html>+Note: **The Retained Earnings balance is not pulled into this report**. The retained earnings amount calculation is shown in a separate SQL below, but is not included as a row in the report
 ===== Sample Export ===== ===== Sample Export =====
  
 |RowID||FormattedName||Balance|| |RowID||FormattedName||Balance||
 |1||Assets||NULL|| |1||Assets||NULL||
-|2||Undeposited Funds||NULL|| +|2||Undeposited Funds||NULL|| 
-|1||>> Undeposited Cash & Checks|| | | +|1||Undeposited Cash & Checks|| | | 
-|1||>> Undeposited AmEx||800.00|| +|1||Undeposited AmEx||800.00|| 
-|1||>> Undeposited Visa_MC||1024.00|| +|1||Undeposited Visa_MC||1024.00|| 
-|1||Inventory Assets||NULL||+|1||Inventory Assets||NULL||
  
 ===== Risk of Data Corruption if Run Improperly ===== ===== Risk of Data Corruption if Run Improperly =====
Line 19: Line 19:
 ===== SQL ===== ===== SQL =====
  
-[[:code_formatsql|code format"sql"]]+<code> 
 +code format"sql"
  
 DECLARE @GLDate datetime; DECLARE @GLDate datetime;
Line 49: Line 50:
 ( (
  
-<code> 
   SELECT   SELECT
-</code> 
  
-<code> 
     ROW_NUMBER() OVER(ORDER BY FormattedPath) as Row,     ROW_NUMBER() OVER(ORDER BY FormattedPath) as Row,
-</code> 
  
-<code> 
     GLTree.FormattedName,     GLTree.FormattedName,
-</code> 
  
-<code> 
     coalesce((select sum(Amount) from GL where GL.GLAccountID  GLTree.NodeID and EntryDateTime     coalesce((select sum(Amount) from GL where GL.GLAccountID  GLTree.NodeID and EntryDateTime
 </code> </code>