Created
September 2, 2012 11:07
-
-
Save metametaclass/3596947 to your computer and use it in GitHub Desktop.
clojure and math formulas
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
:Recalc [ | |
;NB: 3 indexes for Cells array - SectionID,ColID,RowID | |
; Section var gets its value from :Section field | |
; no :Section field - default section 0 | |
;TODO: support for default SectionID for expression (in client) | |
;-------------section1 | |
{:Expr "Cell[Section,AllCol,114]:=Cell[Section,AllCol,115]-Cell[Section,AllCol,116] | |
" :Cycle "Cols" :Range cols-range :Section section-income-tax} | |
{:Expr "Cell[AllCol,119]:=Cell[AllCol,117]-Cell[AllCol,118] | |
" :Cycle "Cols" :Range cols-range :Section section-income-tax} | |
{:Expr "Cell[AllCol,120]:=If(Cell[AllCol,110]-Cell[AllCol,111]-Cell[AllCol,113]+Cell[AllCol,114]+ | |
Cell[AllCol,119]>=0, Cell[AllCol,110]-Cell[AllCol,111]-Cell[AllCol,113]+ | |
Cell[AllCol,114]+Cell[AllCol,119], 0) | |
" :Cycle "Cols" :Range cols-range :Section section-income-tax} | |
{:Expr "Cell[AllCol,121]:=If(Cell[AllCol,110]-Cell[AllCol,111]-Cell[AllCol,113]+Cell[AllCol,114]+ | |
Cell[AllCol,119]<0, Cell[AllCol,110]-Cell[AllCol,111]-Cell[AllCol,113]+ | |
Cell[AllCol,114]+Cell[AllCol,119], 0) | |
" :Cycle "Cols" :Range cols-range :Section section-income-tax} | |
{:Expr "Cell[AllCol,122]:=Cell[AllCol,120]+Cell[AllCol,121] | |
" :Cycle "Cols" :Range cols-range :Section section-income-tax} | |
{:Expr "Cell[AllCol,125]:=Cell[AllCol,123]+Cell[AllCol,124] | |
" :Cycle "Cols" :Range cols-range :Section section-income-tax} | |
{:Expr "Cell[AllCol,126]:=Cell[AllCol,122]-Cell[AllCol,125] | |
" :Cycle "Cols" :Range cols-range :Section section-income-tax} | |
;row 15: calculate tax by base*rate | |
{:Expr "Cell[AllCol,128]:=(Cell[AllCol,126]-Cell[AllCol,127])*18/100 | |
" :Cycle "Cols" :Range [102] :Section section-income-tax} | |
{:Expr "Cell[101,AllRow]:=Cell[102,AllRow]+Cell[103,AllRow]+ | |
Cell[104,AllRow]+Cell[105,AllRow]" | |
:Cycle "Rows" :Range [110 111 113 114 115 116 117 118 119 120 121 122 | |
123 124 125 126 127 128 129 130 131] :Section section-income-tax} | |
;row 20: tax to pay in RB | |
{:Expr "Cell[AllCol,134]:=Cell[AllCol,128]-Cell[AllCol,130]-Cell[AllCol,131]-Cell[AllCol,132]- | |
Cell[AllCol,133]" :Cycle "Cols" :Range [101] :Section section-income-tax} | |
;row 22: tax total | |
{:Expr "Cell[AllCol,136]:=Cell[AllCol,134]-Cell[AllCol,135] | |
" :Cycle "Cols" :Range [101] :Section section-income-tax} | |
;-----------------section3 | |
{:Expr "Cell[AllCol,140]:=Cell[AllCol,141]+Cell[AllCol,142]+Cell[AllCol,143]" | |
:Cycle "Cols" :Range [172 173 174 175 176] :Section 3} | |
{:Expr "Cell[AllCol,150]:=Cell[AllCol,141]*Cell[AllCol,144]*Cell[AllCol,146]/100" | |
:Cycle "Cols" :Range [172 173 174 175 176] :Section 3} | |
{:Expr "Cell[AllCol,151]:=Cell[AllCol,142]*Cell[AllCol,144]*Cell[AllCol,147]/100" | |
:Cycle "Cols" :Range [172 173 174 175 176] :Section 3} | |
{:Expr "Cell[AllCol,152]:=Cell[AllCol,143]*Cell[AllCol,144]*Cell[AllCol,148]/100" | |
:Cycle "Cols" :Range [172 173 174 175 176] :Section 3} | |
{:Expr "Cell[AllCol,149]:=Cell[AllCol,150]+Cell[AllCol,151]+Cell[AllCol,152]" | |
:Cycle "Cols" :Range [172 173 174 175 176] :Section 3} | |
;-----------------section6 | |
; {:Expr "Cell[6,183,157]:=Cell[1,101,126]" } | |
{:Expr "Cell[6,184,157]:=Cell[1,102,126]" } | |
{:Expr "Cell[6,185,157]:=Cell[1,103,126]" } | |
{:Expr "Cell[6,186,157]:=Cell[1,104,126]" } | |
{:Expr "Cell[6,187,157]:=Cell[1,105,126]" } | |
{:Expr "Cell[AllCol,163]:=Cell[AllCol,160]+Cell[AllCol,161]+Cell[AllCol,162]" | |
:Cycle "Cols" :Range [184 185 186 187] :Section 6} | |
{:Expr "Cell[AllCol,164]:=Cell[AllCol,157]-Cell[AllCol,163]" | |
:Cycle "Cols" :Range [184 185 186 187] :Section 6} | |
{:Expr "Cell[183,AllRow]:=Cell[184,AllRow]+Cell[185,AllRow]+ | |
Cell[186,AllRow]+Cell[187,AllRow]" | |
:Cycle "Rows" :Range "All" :Section 6} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment