Skip to content

Commit

Permalink
Add general ledger
Browse files Browse the repository at this point in the history
  • Loading branch information
ishanpranav committed Aug 19, 2024
1 parent 0f0749d commit c0e95d2
Show file tree
Hide file tree
Showing 4 changed files with 227 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Liber.Forms/FormattedStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@
<data name="general-journal" xml:space="preserve">
<value>General Journal</value>
</data>
<data name="general-ledger" xml:space="preserve">
<value>General Ledger</value>
</data>
<data name="Income" xml:space="preserve">
<value>Revenues</value>
</data>
Expand Down
8 changes: 8 additions & 0 deletions src/Liber.Forms/Liber.Forms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
<None Remove="styles\cash-flow-statement.xslt" />
<None Remove="styles\comparative-balance-sheet.xslt" />
<None Remove="styles\comprehensive-income-statement.xslt" />
<None Remove="styles\customer-report.xslt" />
<None Remove="styles\equity-statement.xslt" />
<None Remove="styles\financial-statement.xslt" />
<None Remove="styles\general-ledger.xslt" />
<None Remove="styles\income-statement.xslt" />
</ItemGroup>

Expand Down Expand Up @@ -99,6 +101,12 @@
<Content Include="styles\base\financial-statement.xslt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="styles\customer-report.xslt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="styles\general-ledger.xslt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="styles\general-journal.xslt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down
108 changes: 108 additions & 0 deletions src/Liber.Forms/styles/customer-report.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
general-ledger.xslt
Copyright (c) 2023-2024 Ishan Pranav. All rights reserved.
Licensed under the MIT License.
-->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:liber="urn:liber"
exclude-result-prefixes="msxsl">
<xsl:include href="base/financial-statement.xslt"/>
<xsl:output method="html" indent="yes"/>
<xsl:template match="/report">
<xsl:call-template name="financial-statement">
<xsl:with-param name="title" select="title"/>
<xsl:with-param name="table">
<thead>
<tr>
<th colspan="5" class="subtitle">
<xsl:value-of select="company/name"/>
</th>
</tr>
<tr>
<th colspan="5" class="title">
<xsl:value-of select="title"/>
</th>
</tr>
<tr>
<th colspan="5" class="bar dateline">
<xsl:value-of select="liber:ftspanl(started, posted)"/>
</th>
</tr>
<tr>
<th class="left">
<xsl:value-of select="liber:gets('date')"/>
</th>
<th class="left">
<xsl:value-of select="liber:gets('name')"/>
</th>
<th></th>
<th>
<xsl:value-of select="liber:gets('debit')"/>
</th>
<th>
<xsl:value-of select="liber:gets('credit')"/>
</th>
</tr>
<tr>
<th class="heading" colspan="1"></th>
<td class="heading left">
<xsl:value-of select="liber:gets('description')"/>
</td>
<th class="heading">
<xsl:value-of select="liber:gets('account')"/>
</th>
<th class="heading" colspan="2"></th>
</tr>
</thead>
<tbody>
<xsl:for-each select="company/transaction">
<tr>
<td class="left">
<xsl:value-of select="liber:fdates(posted)"/>
</td>
<td class="left" colspan="2">
<xsl:value-of select="name"/>
</td>
<td class="subtotal" colspan="2"></td>
</tr>
<xsl:for-each select="line[account = //account/name]">
<tr>
<td colspan="1"></td>
<td class="left">
<xsl:value-of select="description"/>
</td>
<td class="left in-2">
<xsl:value-of select="account"/>
</td>
<td class="right">
<xsl:value-of select="liber:fm(debit)"/>
</td>
<td class="right">
<xsl:value-of select="liber:fm(credit)"/>
</td>
</tr>
</xsl:for-each>
</xsl:for-each>
</tbody>
<tfoot>
<tr>
<th class="left" colspan="3">
<xsl:value-of select="liber:gets('total')"/>
</th>
<td class="total right">
<xsl:value-of select="liber:fm(sum(company/transaction/line[account = //account/name]/debit))"/>
</td>
<td class="total right">
<xsl:value-of select="liber:fm(sum(company/transaction/line[account = //account/name]/credit))"/>
</td>
</tr>
</tfoot>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>
108 changes: 108 additions & 0 deletions src/Liber.Forms/styles/general-ledger.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
general-ledger.xslt
Copyright (c) 2023-2024 Ishan Pranav. All rights reserved.
Licensed under the MIT License.
-->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:liber="urn:liber"
exclude-result-prefixes="msxsl">
<xsl:include href="base/financial-statement.xslt"/>
<xsl:output method="html" indent="yes"/>
<xsl:template match="/report">
<xsl:call-template name="financial-statement">
<xsl:with-param name="title" select="title"/>
<xsl:with-param name="table">
<thead>
<tr>
<th colspan="5" class="subtitle">
<xsl:value-of select="company/name"/>
</th>
</tr>
<tr>
<th colspan="5" class="title">
<xsl:value-of select="title"/>
</th>
</tr>
<tr>
<th colspan="5" class="bar dateline">
<xsl:value-of select="liber:ftspanl(started, posted)"/>
</th>
</tr>
<tr>
<th class="left">
<xsl:value-of select="liber:gets('date')"/>
</th>
<th class="left">
<xsl:value-of select="liber:gets('name')"/>
</th>
<th></th>
<th>
<xsl:value-of select="liber:gets('debit')"/>
</th>
<th>
<xsl:value-of select="liber:gets('credit')"/>
</th>
</tr>
<tr>
<th class="heading" colspan="1"></th>
<td class="heading left">
<xsl:value-of select="liber:gets('description')"/>
</td>
<th class="heading">
<xsl:value-of select="liber:gets('account')"/>
</th>
<th class="heading" colspan="2"></th>
</tr>
</thead>
<tbody>
<xsl:for-each select="company/transaction">
<tr>
<td class="left">
<xsl:value-of select="liber:fdates(posted)"/>
</td>
<td class="left" colspan="2">
<xsl:value-of select="name"/>
</td>
<td class="subtotal" colspan="2"></td>
</tr>
<xsl:for-each select="line[account = //account/name]">
<tr>
<td colspan="1"></td>
<td class="left">
<xsl:value-of select="description"/>
</td>
<td class="left in-2">
<xsl:value-of select="account"/>
</td>
<td class="right">
<xsl:value-of select="liber:fm(debit)"/>
</td>
<td class="right">
<xsl:value-of select="liber:fm(credit)"/>
</td>
</tr>
</xsl:for-each>
</xsl:for-each>
</tbody>
<tfoot>
<tr>
<th class="left" colspan="3">
<xsl:value-of select="liber:gets('total')"/>
</th>
<td class="total right">
<xsl:value-of select="liber:fm(sum(company/transaction/line[account = //account/name]/debit))"/>
</td>
<td class="total right">
<xsl:value-of select="liber:fm(sum(company/transaction/line[account = //account/name]/credit))"/>
</td>
</tr>
</tfoot>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

0 comments on commit c0e95d2

Please sign in to comment.