|
53 | 53 | (define desc-header (N_ "Description")) |
54 | 54 | (define sale-header (N_ "Sale")) |
55 | 55 | (define tax-header (N_ "Tax")) |
| 56 | +(define job-header (N_ "Job")) |
56 | 57 | (define credit-header (N_ "Credits")) |
57 | 58 | (define debit-header (N_ "Debits")) |
58 | 59 | (define balance-header (N_ "Balance")) |
|
158 | 159 | (vector-ref columns-used 9)) |
159 | 160 | (define (doclink-col columns-used) |
160 | 161 | (vector-ref columns-used 10)) |
| 162 | +(define (job-col columns-used) |
| 163 | + (vector-ref columns-used 11)) |
161 | 164 |
|
162 | 165 | (define (num-cols columns-used section) |
163 | 166 | (let* ((date? (date-col columns-used)) |
164 | 167 | (due? (date-due-col columns-used)) |
165 | 168 | (ref? (ref-col columns-used)) |
166 | 169 | (type? (type-col columns-used)) |
167 | 170 | (desc? (desc-col columns-used)) |
| 171 | + (job? (job-col columns-used)) |
168 | 172 | (sale? (sale-col columns-used)) |
169 | 173 | (tax? (tax-col columns-used)) |
170 | 174 | (credit? (credit-col columns-used)) |
|
175 | 179 | (amt? (or credit? debit?)) |
176 | 180 | (cols-alist |
177 | 181 | (list |
178 | | - (list 'lhs-cols date? due? ref? type? desc? sale? tax? credit? debit? bal? |
| 182 | + (list 'lhs-cols date? due? ref? type? job? desc? sale? tax? credit? debit? bal? |
179 | 183 | doclink?) |
180 | | - (list 'ptt-span date? due? ref? type? desc? doclink?) |
| 184 | + (list 'ptt-span date? due? ref? type? job? desc? doclink?) |
181 | 185 | (list 'mid-spac spacer?) |
182 | 186 | (list 'rhs-cols date? ref? type? desc? amt? amt?) |
183 | 187 | (list 'rhs-span date? ref? type? desc?))) |
|
191 | 195 | (map opt-val |
192 | 196 | (list date-header due-date-header reference-header type-header |
193 | 197 | desc-header sale-header tax-header debit-header credit-header |
194 | | - balance-header doclink-header)))) |
| 198 | + balance-header doclink-header job-header)))) |
195 | 199 |
|
196 | 200 | (define (make-heading-list column-vector link-option) |
197 | 201 | (let ((heading-list '())) |
|
205 | 209 | (addto! heading-list (G_ type-header))) |
206 | 210 | (if (desc-col column-vector) |
207 | 211 | (addto! heading-list (G_ desc-header))) |
| 212 | + (if (job-col column-vector) |
| 213 | + (addto! heading-list (G_ job-header))) |
208 | 214 | (if (doclink-col column-vector) |
209 | 215 | (addto! heading-list (C_ "Column header for 'Document Link'" "L"))) |
210 | 216 | (if (sale-col column-vector) |
|
259 | 265 | (gnc:invoice-anchor-text inv) |
260 | 266 | (gncInvoiceGetID inv))) |
261 | 267 |
|
| 268 | +(define (invoice->job invoice) |
| 269 | + (let ((owner (gncInvoiceGetOwner invoice))) |
| 270 | + (and (eqv? (gncOwnerGetType owner) GNC-OWNER-JOB) (gncOwnerGetJob owner)))) |
| 271 | + |
262 | 272 | (define (split->reference split) |
263 | 273 | (let* ((txn (xaccSplitGetParent split)) |
264 | 274 | (type (xaccTransGetTxnType txn))) |
|
336 | 346 | ;; |
337 | 347 | ;; Make a row list based on the visible columns |
338 | 348 | ;; |
339 | | -(define (add-row table odd-row? column-vector date due-date ref type-str |
| 349 | +(define (add-row table odd-row? column-vector date due-date ref type-str job |
340 | 350 | desc doclink currency amt debit credit sale tax lhs-class |
341 | 351 | link-option link-rows) |
342 | 352 | (define nrows (if link-rows (length link-rows) 1)) |
|
429 | 439 | (addif (ref-col column-vector) ref) |
430 | 440 | (addif (type-col column-vector) type-str) |
431 | 441 | (addif (desc-col column-vector) desc) |
| 442 | + (addif (job-col column-vector) job) |
432 | 443 | (addif (doclink-col column-vector) doclink))) |
433 | 444 | (map |
434 | 445 | (lambda (str) |
@@ -548,7 +559,7 @@ and do not match the transaction.")))))))) |
548 | 559 | payable? date-type currency))))) |
549 | 560 |
|
550 | 561 | (define (add-balance-row odd-row? total) |
551 | | - (add-row table odd-row? used-columns start-date #f "" (G_ "Balance") "" #f |
| 562 | + (add-row table odd-row? used-columns start-date #f #f #f (G_ "Balance") "" #f |
552 | 563 | currency total #f #f #f #f #f |
553 | 564 | link-option (case link-option |
554 | 565 | ((none) '(())) |
@@ -794,6 +805,8 @@ and do not match the transaction.")))))))) |
794 | 805 | table odd-row? used-columns date (gncInvoiceGetDateDue invoice) |
795 | 806 | (split->reference split) |
796 | 807 | (split->type-str split payable?) |
| 808 | + (let ((job (invoice->job invoice))) |
| 809 | + (and job (gnc:make-html-text (gncJobGetID job)))) |
797 | 810 | (splits->desc (list split)) |
798 | 811 | (and (not (string-null? (gncInvoiceGetDocLink invoice))) |
799 | 812 | (gnc:html-invoice-doclink-anchor |
@@ -834,6 +847,7 @@ and do not match the transaction.")))))))) |
834 | 847 | table odd-row? used-columns date #f |
835 | 848 | (split->reference split) |
836 | 849 | (split->type-str split payable?) |
| 850 | + #f |
837 | 851 | (splits->desc (xaccTransGetAPARAcctSplitList txn #t) #t) |
838 | 852 | (and (not (string-null? (xaccTransGetDocLink txn))) |
839 | 853 | (gnc:html-transaction-doclink-anchor |
@@ -887,6 +901,11 @@ and do not match the transaction.")))))))) |
887 | 901 | (N_ "Display Columns") type-header |
888 | 902 | "g" (N_ "Display the transaction type?") #t) |
889 | 903 |
|
| 904 | + (unless (eqv? GNC-OWNER-JOB owner-type) |
| 905 | + (gnc-register-simple-boolean-option |
| 906 | + options (N_ "Display Columns") job-header |
| 907 | + "gg" (N_ "Display the associated job?") #f)) |
| 908 | + |
890 | 909 | (gnc-register-simple-boolean-option options |
891 | 910 | (N_ "Display Columns") desc-header |
892 | 911 | "ha" (N_ "Display the transaction description?") #t) |
|
0 commit comments