-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06d936b
commit 0eb6be4
Showing
15 changed files
with
288 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Schedule AL | ||
|
||
As per the Indian Income tax law, citizens are obligated to report | ||
their entire Assets and Liabilities if the total income exceeds ₹50 | ||
lakh. Paisa helps with the computation of the amount. | ||
|
||
| code | Section | Details | | ||
|-----------|----------------|------------------------------------------------------------------------------| | ||
| immovable | A (1) | Immovable Assets | | ||
| metal | B (1) (i) | Jewellery, bullion etc. | | ||
| art | B (1) (ii) | Archaeological collections, drawings, painting, sculpture or any work of art | | ||
| vechicle | B (1) (iii) | Vehicles, yachts, boats and aircrafts | | ||
| bank | B (1) (iv) (a) | Financial assets: Bank (including all deposits) | | ||
| share | B (1) (iv) (b) | Financial assets: Shares and securities | | ||
| insurance | B (1) (iv) (c) | Financial assets: Insurance policies | | ||
| loan | B (1) (iv) (d) | Financial assets: Loans and advances given | | ||
| cash | B (1) (iv) (e) | Financial assets: Cash in hand | | ||
| liability | C (1) | Liabilities | | ||
|
||
|
||
All you need to do is to specify the accounts that belong to each | ||
section. Paisa will compute the total as on the last day of the | ||
previous financial year. | ||
|
||
|
||
```yaml | ||
schedule_al: | ||
- code: bank | ||
accounts: | ||
- Assets:Checking | ||
- code: share | ||
accounts: | ||
- Assets:Equity:* | ||
- Assets:Debt:* | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Tax | ||
|
||
Paisa provides few features to help with tax filing and tax | ||
optimization. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package server | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/ananthakumaran/paisa/internal/accounting" | ||
"github.com/ananthakumaran/paisa/internal/model/posting" | ||
"github.com/ananthakumaran/paisa/internal/query" | ||
"github.com/ananthakumaran/paisa/internal/utils" | ||
"github.com/gin-gonic/gin" | ||
"github.com/samber/lo" | ||
"github.com/spf13/viper" | ||
"gorm.io/gorm" | ||
) | ||
|
||
type ScheduleALSection struct { | ||
Code string `json:"code"` | ||
Section string `json:"section"` | ||
Details string `json:"details"` | ||
} | ||
|
||
var Sections []ScheduleALSection | ||
|
||
func init() { | ||
Sections = []ScheduleALSection{ | ||
{Code: "immovable", Section: "A (1)", Details: "Immovable Assets"}, | ||
{Code: "metal", Section: "B (1) (i)", Details: "Jewellery, bullion etc"}, | ||
{Code: "art", Section: "B (1) (ii)", Details: "Archaeological collections, drawings, painting, sculpture or any work of art"}, | ||
{Code: "vechicle", Section: "B (1) (ii)", Details: "Vehicles, yachts, boats and aircrafts"}, | ||
{Code: "bank", Section: "B (1) (iv) (a)", Details: "Financial assets: Bank (including all deposits)"}, | ||
{Code: "share", Section: "B (1) (iv) (b)", Details: "Financial assets: Shares and securities"}, | ||
{Code: "insurance", Section: "B (1) (iv) (c)", Details: "Financial assets: Insurance policies"}, | ||
{Code: "loan", Section: "B (1) (iv) (d)", Details: "Financial assets: Loans and advances given"}, | ||
{Code: "cash", Section: "B (1) (iv) (e)", Details: "Financial assets: Cash in hand"}, | ||
{Code: "liability", Section: "C (1)", Details: "Liabilities"}, | ||
} | ||
} | ||
|
||
type ScheduleALConfig struct { | ||
Code string | ||
Accounts []string | ||
} | ||
|
||
type ScheduleALEntry struct { | ||
Section ScheduleALSection `json:"section"` | ||
Amount float64 `json:"amount"` | ||
} | ||
|
||
func GetScheduleAL(db *gorm.DB) gin.H { | ||
var configs []ScheduleALConfig | ||
viper.UnmarshalKey("schedule_al", &configs) | ||
now := time.Now() | ||
|
||
postings := query.Init(db).Like("Assets:%").All() | ||
time := utils.BeginningOfFinancialYear(now) | ||
postings = lo.Filter(postings, func(p posting.Posting, _ int) bool { return p.Date.Before(time) }) | ||
|
||
entries := lo.Map(Sections, func(section ScheduleALSection, _ int) ScheduleALEntry { | ||
config, found := lo.Find(configs, func(config ScheduleALConfig) bool { | ||
return config.Code == section.Code | ||
}) | ||
|
||
var amount float64 | ||
|
||
if found { | ||
ps := accounting.FilterByGlob(postings, config.Accounts) | ||
amount = accounting.CostBalance(ps) | ||
} else { | ||
amount = 0 | ||
} | ||
|
||
return ScheduleALEntry{ | ||
Section: section, | ||
Amount: amount, | ||
} | ||
}) | ||
return gin.H{"schedule_al_entries": entries, "date": time.AddDate(0, 0, -1)} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import * as d3 from "d3"; | ||
import dayjs from "dayjs"; | ||
import { ajax, formatCurrency, ScheduleALEntry, setHtml } from "./utils"; | ||
|
||
export default async function () { | ||
const { schedule_al_entries: scheduleALEntries, date: date } = await ajax( | ||
"/api/schedule_al" | ||
); | ||
|
||
setHtml("schedule-al-date", dayjs(date).format("DD MMM YYYY")); | ||
renderBreakdowns(scheduleALEntries); | ||
} | ||
|
||
function renderBreakdowns(scheduleALEntries: ScheduleALEntry[]) { | ||
const tbody = d3.select(".d3-schedule-al"); | ||
const trs = tbody.selectAll("tr").data(Object.values(scheduleALEntries)); | ||
|
||
trs.exit().remove(); | ||
trs | ||
.enter() | ||
.append("tr") | ||
.merge(trs as any) | ||
.html((s) => { | ||
return ` | ||
<td>${s.section.code}</td> | ||
<td>${s.section.section}</td> | ||
<td>${s.section.details}</td> | ||
<td class='has-text-right'>${formatCurrency(s.amount)}</td> | ||
`; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.