Updated BOM script formats dollars and cents properly. Need to format another column for minimum

This commit is contained in:
Matt McWilliams 2024-11-28 13:20:49 -05:00
parent 95a41e1443
commit 49e63b292d
2 changed files with 17 additions and 17 deletions

View File

@ -41,21 +41,21 @@ Actual price of a full build may be higher.
| Part | Qty | Cost (USD) |
|-------------------------------------|-----|------------|
| M4 hex bolt 40mm | 4 | 2.4 |
| M3 sliding t slot nut | 25 | 1.25 |
| M3 hex cap bolt 8mm | 25 | 2.0 |
| M3 hex cap bolt 6mm | 8 | 0.56 |
| M3 hex cap bolt 12mm | 1 | 0.08 |
| L298N Motor driver module | 1 | 2.87 |
| ESP32 GPIO breakout board | 1 | 5.99 |
| ESP32 Dev board | 1 | 6.66 |
| 608-RS Ball Bearing | 1 | 0.17 |
| 250RPM DC geared motor | 2 | 29.98 |
| 2020 Aluminum extrusion 420mm | 2 | 5.1 |
| 2020 Aluminum extrusion 260mm | 4 | 6.4 |
| 100RPM DC geared motor with encoder | 1 | 16.19 |
|---------|---------------|------------------------------------|
| TOTAL | 76 | 79.65 |
| M4 hex bolt 40mm | 4 | $2.40 |
| M3 sliding t slot nut | 25 | $1.25 |
| M3 hex cap bolt 8mm | 25 | $2.00 |
| M3 hex cap bolt 6mm | 8 | $0.56 |
| M3 hex cap bolt 12mm | 1 | $0.08 |
| L298N Motor driver module | 1 | $2.87 |
| ESP32 GPIO breakout board | 1 | $5.99 |
| ESP32 Dev board | 1 | $6.66 |
| 608-RS Ball Bearing | 1 | $0.17 |
| 250RPM DC geared motor | 2 | $29.98 |
| 2020 Aluminum extrusion 420mm | 2 | $5.10 |
| 2020 Aluminum extrusion 260mm | 4 | $6.40 |
| 100RPM DC geared motor with encoder | 1 | $16.19 |
|---------|---------------|--------------------------------------------------|
| TOTAL | 76 | $79.65 |
<!-- /bom -->

View File

@ -55,10 +55,10 @@ sqlite3 :memory: -cmd '.mode csv' -cmd ".import ${DESTINATION} bom" -cmd ".impor
'SELECT SUM(quantity),part,part_id, SUM(quantity) * (COALESCE((SELECT CEIL(prices.price / prices.quantity) FROM prices WHERE prices.part = bom.part LIMIT 1), 0)) as price FROM bom GROUP BY part ORDER BY part DESC;' >> "${TOTAL}"
sqlite3 :memory: -cmd '.mode csv' -cmd ".import ${TOTAL} bom" -cmd '.mode markdown' \
"SELECT part as Part, quantity as Qty, CAST(price / 100.00 as MONEY) as 'Cost (USD)' FROM bom ORDER BY part DESC;"
"SELECT part as Part, quantity as Qty, printf('$%.2f', CAST(price AS FLOAT) / 100) 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), CAST(SUM(price) / 100.00 as MONEY) FROM bom;" | grep -v 'SUM('
"SELECT 'TOTAL', SUM(quantity), printf('$%.2f', CAST(SUM(price) AS FLOAT) / 100) FROM bom;" | grep -v 'SUM('
sqlite3 :memory: -cmd '.mode csv' -cmd ".import ${TOTAL} bom"\
"SELECT SUM(quantity), 'TOTAL', 'N/A', SUM(price) FROM bom;" | tr -d '"' >> "${TOTAL}"