Add Bonanza Produce multi-invoice statement template

- Added multi-invoice template for Bonanza Produce with :multi and :multi-match? flags
- Template uses keywords for statement header to identify multi-invoice format
- Extracts invoice-number, date, customer-identifier (from RETURN line), and total
- Parses 4 invoices from statement PDF 13595522.pdf
- All tests pass (29 assertions, 0 failures, 0 errors)

- Added test: parse-bonanza-produce-statement-13595522
- Updated invoice-template-creator skill: emphasized test-first approach
This commit is contained in:
2026-02-08 07:16:55 -08:00
parent 26dbde5bd3
commit 8a0395dc4a
9 changed files with 1059 additions and 3 deletions

View File

@@ -32,3 +32,22 @@
(str (:customer-identifier result) " " (str/trim (:account-number result)))))
;; Total is parsed as string, not number (per current behavior)
(is (= "23.22" (:total result)))))))
(deftest parse-bonanza-produce-statement-13595522
(testing "Should parse Bonanza Produce statement 13595522 with multiple invoices"
(let [pdf-file (io/file "dev-resources/13595522.pdf")
pdf-text (:out (clojure.java.shell/sh "pdftotext" "-layout" (str pdf-file) "-"))
results (sut/parse pdf-text)]
(is (some? results) "parse should return results")
(is (= 4 (count results)) "Should parse 4 invoices from statement")
(doseq [result results]
(is (= "Bonanza Produce" (:vendor-code result)))
(is (= "600 VISTA WAY" (:customer-identifier result))))
(is (= "03876838" (:invoice-number (nth results 0))))
(is (= "03877314" (:invoice-number (nth results 1))))
(is (= "03878619" (:invoice-number (nth results 2))))
(is (= "03879035" (:invoice-number (nth results 3))))
(is (= "891.65" (:total (nth results 0))))
(is (= "720.33" (:total (nth results 1))))
(is (= "853.16" (:total (nth results 2))))
(is (= "1066.60" (:total (nth results 3)))))))