Adds uploaded by for invoices, fixes REEL Produce, adds Mani Produce

This commit is contained in:
2024-09-25 08:36:45 -07:00
parent bcd78e7813
commit dc44233640
5 changed files with 44 additions and 26 deletions

View File

@@ -1,5 +1,6 @@
(ns auto-ap.parse.templates
(:require [auto-ap.parse.util :as u]
[auto-ap.logging :as alog]
[clojure.string :as str]))
@@ -700,8 +701,16 @@
:total [:trim-commas-and-negate nil]}
:multi #"\n"
:multi-match? #"^\s*Invoice\s{2,}"}
{:vendor "Mani Imports"
:keywords [#"Mani Imports"]
:extract {:date #"Order Date\s+([0-9]+/[0-9]+/[0-9]+)"
:customer-identifier #"Ship To:\s*(.*?)\n"
:invoice-number #"Invoice Number:\s+(.*?)\n"
:total #"Invoice Total:\s+([\d\-,]+\.\d{2,2}+)"}
:parser {:date [:clj-time "MM/dd/yyyy"]
:total [:trim-commas-and-negate nil]} }
{:vendor "Reel Produce"
:keywords [#"REEL Produce, Inc" #"Statement"]
:keywords [#"REEL Produce, Inc" #"Statem"]
:extract {:date #"\s*([0-9]+/[0-9]+/[0-9]+)"
:customer-identifier #"To:\s*\n\s+(.*?)\s{2,}"
:invoice-number #"INV #(\d+)"
@@ -749,22 +758,23 @@
{:vendor "Daylight Foods"
:keywords [#"CUSTNO"]
:extract (fn [sheet vendor]
(transduce (comp
(drop 1)
(filter
(fn [r]
(and
(seq r)
(->> r first not-empty))))
(map
(fn [[customer-number _ _ _ invoice-number date amount :as row]]
{:customer-identifier customer-number
:text (str/join " " row)
:full-text (str/join " " row)
:date (u/parse-value :clj-time "MM/dd/yyyy" (str/trim date))
:invoice-number invoice-number
:total (str amount)
:vendor-code vendor})))
conj
[]
sheet))}])
(alog/peek ::daylight-invoices
(transduce (comp
(drop 1)
(filter
(fn [r]
(and
(seq r)
(->> r first not-empty))))
(map
(fn [[customer-number _ _ _ invoice-number date amount :as row]]
{:customer-identifier customer-number
:text (str/join " " row)
:full-text (str/join " " row)
:date (u/parse-value :clj-time "MM/dd/yyyy" (str/trim date))
:invoice-number invoice-number
:total (str amount)
:vendor-code vendor})))
conj
[]
sheet)))}])