Skip to content

Instantly share code, notes, and snippets.

@dockimbel
Last active May 7, 2020 09:49
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dockimbel/08e40961e5f7836d29591dd06d1a56f9 to your computer and use it in GitHub Desktop.
Save dockimbel/08e40961e5f7836d29591dd06d1a56f9 to your computer and use it in GitHub Desktop.
Red [] L: charset "ABCDEFGHI" D: union N: charset "123456789" charset "0"
repeat y 9 [repeat x 9 [col: either x = 1 [#"^(2028)"][#"A" + (x - 2)]
append p: [] set ref: (to word! rejoin [col y - 1]) make face! [size: 90x24
type: pick [text field] header?: (y = 1) or (x = 1)
offset: -20x10 + as-pair ((x - 1) * size/x + 2) ((y - 1) * size/y + 1)
text: form case [y = 1 [col] x = 1 [y - 1] 'else [copy ""]]
para: make para! [align: pick [center right] header?]
extra: object [name: form ref formula: old: none]
actors: context [on-create: on-unfocus: function [f e][f/color: none
if rel: f/extra/old [react/unlink rel 'all]
if #"=" = first f/extra/formula: copy text: copy f/text [parse remove text
[any [p: L N not ["/" skip not N] insert p " " insert "/data "
| L skip | p: some D opt [dot some D] insert p " " insert " " | skip]]
f/text: rejoin [f/extra/name "/data: any [math/safe [" text {] "#UND"]}]
if f/data [any [react f/extra/old: f/data do f/data]]]
] on-focus: func [f e][f/text: any [f/extra/formula f/text] f/color: yello]
]]]]
A1/text: "Designation"
B1/text: "Quantity"
C1/text: "Price $"
D1/text: "Total $"
E1/text: "Tax rate:"
F1/text: "12%"
A2/text: "PC"
B2/text: "1"
C2/text: "500"
D2/text: "=B2*C2"
E2/text: "Average price:"
F2/text: "=(C2+C3+C4)/3"
A3/text: "Monitor"
B3/text: "2"
C3/text: "250"
D3/text: "=B3*C3"
E3/text: "Nb of items :"
F3/text: "=B2+B3+B4"
A4/text: "Desk"
B4/text: "1"
C4/text: "120"
D4/text: "=B4*C4"
E4/text: "Avg price / items:"
F4/text: "=F2/F3"
C5/text: "TOTAL $"
D5/text: "=D2+D3+D4"
C6/text: "VAT"
D6/text: "=D5*F1"
view make face! [type: 'window text: "PicoSheets demo" size: 840x250 pane: p]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment