[business-reports] compact gnc:owner-report-text

This commit is contained in:
Christopher Lam 2019-12-01 22:30:45 +08:00
parent df1f033f41
commit a52d60f48e

View File

@ -71,29 +71,17 @@
(define (gnc:owner-report-text owner acc) (define (gnc:owner-report-text owner acc)
(let* ((end-owner (gncOwnerGetEndOwner owner)) (let* ((end-owner (gncOwnerGetEndOwner owner))
(type (gncOwnerGetType end-owner)) (type (gncOwnerGetType end-owner)))
(ref #f)) (gnc-build-url
URL-TYPE-OWNERREPORT
(cond (string-append
((eqv? type GNC-OWNER-CUSTOMER) (cond ((eqv? type GNC-OWNER-CUSTOMER) "owner=c:")
(set! ref "owner=c:")) ((eqv? type GNC-OWNER-VENDOR) "owner=v:")
((eqv? type GNC-OWNER-EMPLOYEE) "owner=e:")
((eqv? type GNC-OWNER-VENDOR) (else "unknown-type="))
(set! ref "owner=v:")) (gncOwnerReturnGUID end-owner)
(if (null? acc) "" (string-append "&acct=" (gncAccountGetGUID acc))))
((eqv? type GNC-OWNER-EMPLOYEE) "")))
(set! ref "owner=e:"))
(else (set! ref "unknown-type=")))
(if ref
(begin
(set! ref (string-append ref (gncOwnerReturnGUID end-owner)))
(if (not (null? acc))
(set! ref (string-append ref "&acct="
(gncAccountGetGUID acc))))
(gnc-build-url URL-TYPE-OWNERREPORT ref ""))
ref)))
;; Creates a new report instance for the given invoice. The given ;; Creates a new report instance for the given invoice. The given
;; report-template-id must refer to an existing report template, which ;; report-template-id must refer to an existing report template, which