print as
This commit is contained in:
@@ -10,9 +10,12 @@
|
|||||||
(defn fields->data [x]
|
(defn fields->data [x]
|
||||||
(-> x
|
(-> x
|
||||||
(assoc-in [:data :address] (:address x))
|
(assoc-in [:data :address] (:address x))
|
||||||
(dissoc :address)))
|
(assoc-in [:data :print-as] (:print-as x))
|
||||||
|
(dissoc :address)
|
||||||
|
(dissoc :print-as)))
|
||||||
|
|
||||||
(def all-fields [:name
|
(def all-fields [:name
|
||||||
|
:print-as
|
||||||
:code
|
:code
|
||||||
:id
|
:id
|
||||||
:invoice-reminder-schedule
|
:invoice-reminder-schedule
|
||||||
|
|||||||
@@ -47,6 +47,18 @@
|
|||||||
:vendor
|
:vendor
|
||||||
{:fields {:id {:type 'Int}
|
{:fields {:id {:type 'Int}
|
||||||
:name {:type 'String}
|
:name {:type 'String}
|
||||||
|
:code {:type 'String}
|
||||||
|
|
||||||
|
:print_as {:type 'String}
|
||||||
|
:primary_contact {:type 'String}
|
||||||
|
:primary_email {:type 'String}
|
||||||
|
:primary_phone {:type 'String}
|
||||||
|
|
||||||
|
:secondary_contact {:type 'String}
|
||||||
|
:secondary_email {:type 'String}
|
||||||
|
:secondary_phone {:type 'String}
|
||||||
|
|
||||||
|
|
||||||
:default_expense_account {:type 'Int}
|
:default_expense_account {:type 'Int}
|
||||||
:invoice_reminder_schedule {:type 'String}}}
|
:invoice_reminder_schedule {:type 'String}}}
|
||||||
:reminder
|
:reminder
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
(let [output-stream (ByteArrayOutputStream.)]
|
(let [output-stream (ByteArrayOutputStream.)]
|
||||||
(pdf/pdf
|
(pdf/pdf
|
||||||
[{:left-margin 10 :right-margin 0 :top-margin 0 :bottom-margin 0 :size :letter}
|
[{:left-margin 10 :right-margin 0 :top-margin 0 :bottom-margin 0 :size :letter}
|
||||||
(let [{:keys [paid-to company check date amount memo] {vendor-name :name :as vendor} :vendor} check
|
(let [{:keys [paid-to company check date amount memo] {print-as :print-as vendor-name :name :as vendor} :vendor} check
|
||||||
df (DecimalFormat. "#,###.00")
|
df (DecimalFormat. "#,###.00")
|
||||||
word-amount (num->words amount)
|
word-amount (num->words amount)
|
||||||
|
|
||||||
@@ -51,7 +51,9 @@
|
|||||||
|
|
||||||
[[:cell {:size 16 :leading 16} "PAY"]
|
[[:cell {:size 16 :leading 16} "PAY"]
|
||||||
[:cell {:size 6 :leading 6 } "TO THE ORDER OF"]
|
[:cell {:size 6 :leading 6 } "TO THE ORDER OF"]
|
||||||
[:cell {:colspan 7} vendor-name]
|
[:cell {:colspan 7} (if (seq print-as)
|
||||||
|
print-as
|
||||||
|
vendor-name)]
|
||||||
[:cell {:colspan 3} amount]]
|
[:cell {:colspan 3} amount]]
|
||||||
|
|
||||||
[[:cell {}]
|
[[:cell {}]
|
||||||
@@ -226,7 +228,7 @@
|
|||||||
(companies/upsert company-id updated-company)
|
(companies/upsert company-id updated-company)
|
||||||
(doseq [{:keys [invoice-id amount]} invoice-payments]
|
(doseq [{:keys [invoice-id amount]} invoice-payments]
|
||||||
(invoices/apply-payment invoice-id amount))
|
(invoices/apply-payment invoice-id amount))
|
||||||
{:invoices (invoices/get-multi (map :id (doto (mapcat first checks) println)))
|
{:invoices (invoices/get-multi (map :id (mapcat first checks)))
|
||||||
:pdf-url (merge-pdfs (map (comp :s3-key second) checks))}))
|
:pdf-url (merge-pdfs (map (comp :s3-key second) checks))}))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#(not (str/blank? %))))
|
#(not (str/blank? %))))
|
||||||
|
|
||||||
(s/def ::name ::required-identifier)
|
(s/def ::name ::required-identifier)
|
||||||
|
(s/def ::print-as (s/nilable string?))
|
||||||
|
|
||||||
(s/def ::email (s/nilable (s/and string? (s/or :is-email #(re-matches email-regex %)
|
(s/def ::email (s/nilable (s/and string? (s/or :is-email #(re-matches email-regex %)
|
||||||
:is-empty #(= % "")))))
|
:is-empty #(= % "")))))
|
||||||
@@ -30,17 +31,18 @@
|
|||||||
|
|
||||||
(s/def ::vendor (s/keys :req-un [::name]
|
(s/def ::vendor (s/keys :req-un [::name]
|
||||||
:opt-un [::code
|
:opt-un [::code
|
||||||
::id
|
::id
|
||||||
::invoice-reminder-schedule
|
::print-as
|
||||||
::primary-contact
|
::invoice-reminder-schedule
|
||||||
::primary-email
|
::primary-contact
|
||||||
::primary-phone
|
::primary-email
|
||||||
::secondary-contact
|
::primary-phone
|
||||||
::secondary-email
|
::secondary-contact
|
||||||
::secondary-phone
|
::secondary-email
|
||||||
::address
|
::secondary-phone
|
||||||
|
::address
|
||||||
::default-expense-account
|
::default-expense-account
|
||||||
]))
|
]))
|
||||||
|
|
||||||
|
|
||||||
(def vendor-spec (apply hash-map (drop 1 (s/form ::vendor))))
|
(def vendor-spec (apply hash-map (drop 1 (s/form ::vendor))))
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
[:id :name :locations [:bank-accounts [:id :number :check-number :name] ]]]
|
[:id :name :locations [:bank-accounts [:id :number :check-number :name] ]]]
|
||||||
[:vendor
|
[:vendor
|
||||||
[:id :name :default-expense-account]]]}
|
[:id :name :default-expense-account :primary-contact :primary-email :primary-phone :secondary-contact :secondary-email :secondary-phone :print-as :invoice-reminder-schedule :code]]]}
|
||||||
|
|
||||||
:on-success [::received-initial]}}))))
|
:on-success [::received-initial]}}))))
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,6 @@
|
|||||||
(re-frame/reg-event-db
|
(re-frame/reg-event-db
|
||||||
::received-vendors
|
::received-vendors
|
||||||
(fn [db [_ vendors]]
|
(fn [db [_ vendors]]
|
||||||
|
|
||||||
(assoc db :vendors (reduce (fn [vendors vendor]
|
(assoc db :vendors (reduce (fn [vendors vendor]
|
||||||
(assoc vendors (:id vendor) vendor))
|
(assoc vendors (:id vendor) vendor))
|
||||||
{}
|
{}
|
||||||
|
|||||||
@@ -33,8 +33,18 @@
|
|||||||
:spec ::entity/name
|
:spec ::entity/name
|
||||||
:event change-event
|
:event change-event
|
||||||
:subscription vendor}]]]]
|
:subscription vendor}]]]]
|
||||||
|
|
||||||
[horizontal-field
|
[horizontal-field
|
||||||
|
[:label.label "Print Checks As"]
|
||||||
|
[:div.control
|
||||||
|
[bind-field
|
||||||
|
[:input.input {:type "text"
|
||||||
|
:field :print-as
|
||||||
|
:spec ::entity/print-as
|
||||||
|
:event change-event
|
||||||
|
:subscription vendor}]]]]
|
||||||
|
|
||||||
|
#_[horizontal-field
|
||||||
[:label.label "Code"]
|
[:label.label "Code"]
|
||||||
[:div.control
|
[:div.control
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user