Historical profit and loss

From MediaWiki

(Difference between revisions)
Jump to: navigation, search
(Replaced content with "{{profit and loss for|{{CURRENTYEAR}}}} {{historical see also}} Category:Finance Category:Database")
 
(3 intermediate revisions not shown)
Line 1: Line 1:
-
{{more statistics for|{{CURRENTYEAR}}|profit and loss}}{{note|This report is in development, and data shown on this page may be missing, poorly organized, inaccurate, or flat-out wrong.}}
+
{{profit and loss for|{{CURRENTYEAR}}}}
-
{{#tag:mysql|
+
-
WITH CTE AS (
+
-
  SELECT Source AS account, 'Debits' AS type, -Amount AS Amount
+
-
  FROM sa_general_journal
+
-
  UNION ALL
+
-
  SELECT Destination, 'Credits', Amount
+
-
  FROM sa_general_journal
+
-
)
+
-
SELECT acc.ID, acc.Name,
+
-
      SUM(CASE WHEN CTE.type = 'Debits'  THEN Amount END) AS Debits,
+
-
      SUM(CASE WHEN CTE.type = 'Credits' THEN Amount END) AS Credits,
+
-
      SUM(Amount) AS Net
+
-
FROM CTE
+
-
JOIN sa_accounts acc ON CTE.account = acc.ID
+
-
  WHERE acc.Report = "PL"
+
-
GROUP BY acc.ID, acc.Name
+
-
|database=EcoReality}}
+
{{historical see also}}
{{historical see also}}

Latest revision as of 18:16, 15 May 2020

This information is only available to logged-in users. Please log in or ask for an account to see this information.


See Also

Share your opinion


blog comments powered by Disqus
Personal tools
Get our newsletter!
Name:
Email Address:

disturbance
entry points
help (off site)
Environmental jobs, green volunteering, good work! Powered by the wind! This server and other
EcoReality operations
are 100% wind powered.
Powered by Mac OS X Powered by Mac MediaWiki Powered by MariaDB Powered by Valentina Studio Pro