Improve table process, last line is in USD

This commit is contained in:
Matt McWilliams 2024-11-06 14:28:37 -05:00
parent d700f1c265
commit 3f399f0a6c
2 changed files with 6 additions and 3 deletions

View File

@ -27,6 +27,9 @@ This project is for DIY filmmakers, independent artists and small film labs to h
# Bill of Materials
The costs listed are estimates based on per-unit costs found online.
Actual price of a full build may be higher.
<!-- bom -->
| Part | Qty | Cost (USD) |
@ -40,8 +43,8 @@ This project is for DIY filmmakers, independent artists and small film labs to h
| 2020 Aluminum extrusion 420mm | 2 | 5.22 |
| 2020 Aluminum extrusion 260mm | 4 | 6.44 |
| 100RPM DC geared motor with encoder | 1 | 17.02 |
|---------|---------------|------------|
| TOTAL | 65 | 7224 |
|---------|---------------|------------------------------------|
| TOTAL | 65 | 72.24 |
<!-- /bom -->

View File

@ -58,7 +58,7 @@ sqlite3 :memory: -cmd '.mode csv' -cmd ".import ${TOTAL} bom" -cmd '.mode markd
"SELECT part as Part, quantity as Qty, CAST(price / 100.00 as MONEY) as 'Cost (USD)' FROM bom ORDER BY part DESC;"
sqlite3 :memory: -cmd '.mode csv' -cmd ".import ${TOTAL} bom" -cmd '.mode markdown' \
"SELECT 'TOTAL', SUM(quantity), SUM(price) FROM bom;" | grep -v 'SUM('
"SELECT 'TOTAL', SUM(quantity), CAST(SUM(price) / 100.00 as MONEY) FROM bom;" | grep -v 'SUM('
sqlite3 :memory: -cmd '.mode csv' -cmd ".import ${TOTAL} bom"\
"SELECT SUM(quantity),'N/A','TOTAL', SUM(price) FROM bom;" | tr -d '"' >> "${TOTAL}"