[customer-summary] remove references to vendor/employee

* there's only customer-summary, no vendor/employee-summary. remove
  dead code and unused hidden options.
This commit is contained in:
Christopher Lam 2019-06-25 11:02:49 +08:00
parent e19fdf51e3
commit 7e9c9187c2

View File

@ -87,31 +87,19 @@
(define opthelp-sortascending (N_ "Choose the ordering of the column sort: Either ascending or descending.")) (define opthelp-sortascending (N_ "Choose the ordering of the column sort: Either ascending or descending."))
(define (options-generator acct-type-list owner-type inv-str) (define (options-generator)
(define options (gnc:new-options)) (define options (gnc:new-options))
(define (add-option new-option) (define (add-option new-option)
(gnc:register-option options new-option)) (gnc:register-option options new-option))
(add-option
(gnc:make-internal-option "__reg" "inv-str" inv-str))
(add-option
(gnc:make-internal-option "__reg" "owner-type" owner-type))
(gnc:options-add-date-interval! (gnc:options-add-date-interval!
options options gnc:pagename-general optname-from-date optname-to-date "b")
gnc:pagename-general optname-from-date optname-to-date
"b")
(add-option (add-option
(gnc:make-account-list-option (gnc:make-account-list-option
pagename-incomeaccounts optname-incomeaccounts pagename-incomeaccounts optname-incomeaccounts
"b" "b" opthelp-incomeaccounts
opthelp-incomeaccounts
;; This default-getter finds the first account of this type. TODO:
;; Find not only the first one, but all of them!
(lambda () (lambda ()
(gnc:filter-accountlist-type (gnc:filter-accountlist-type
(list ACCT-TYPE-INCOME) (list ACCT-TYPE-INCOME)
@ -121,10 +109,7 @@
(add-option (add-option
(gnc:make-account-list-option (gnc:make-account-list-option
pagename-expenseaccounts optname-expenseaccounts pagename-expenseaccounts optname-expenseaccounts
"b" "b" opthelp-expenseaccounts
opthelp-expenseaccounts
;; This default-getter finds the first account of this type. TODO:
;; Find not only the first one, but all of them!
(lambda () (lambda ()
(gnc:filter-accountlist-type (gnc:filter-accountlist-type
(list ACCT-TYPE-EXPENSE) (list ACCT-TYPE-EXPENSE)
@ -191,11 +176,6 @@
options) options)
(define (customer-options-generator)
(options-generator (list ACCT-TYPE-RECEIVABLE) GNC-OWNER-CUSTOMER
(_ "Invoice")))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (string-expand string character replace-string) (define (string-expand string character replace-string)
@ -238,10 +218,8 @@
(define (make-myname-table book date-format) (define (make-myname-table book date-format)
(let* ((table (gnc:make-html-table)) (let* ((table (gnc:make-html-table))
(table-outer (gnc:make-html-table))
(name (gnc:company-info book gnc:*company-name*)) (name (gnc:company-info book gnc:*company-name*))
(addy (gnc:company-info book gnc:*company-addy*))) (addy (gnc:company-info book gnc:*company-addy*)))
(gnc:html-table-set-style! (gnc:html-table-set-style!
table "table" table "table"
'attribute (list "border" 0) 'attribute (list "border" 0)
@ -250,25 +228,21 @@
'attribute (list "valign" "top") 'attribute (list "valign" "top")
'attribute (list "cellspacing" 0) 'attribute (list "cellspacing" 0)
'attribute (list "cellpadding" 0)) 'attribute (list "cellpadding" 0))
(if name (gnc:html-table-append-row! table (list name)))
(gnc:html-table-append-row! table (list (or name ""))) (if addy (gnc:html-table-append-row!
(gnc:html-table-append-row! table (list (string-expand table (list (string-expand addy #\newline "<br/>"))))
(or addy "")
#\newline "<br/>")))
(gnc:html-table-append-row! (gnc:html-table-append-row!
table (list (gnc-print-time64 (gnc:get-today) date-format))) table (list (gnc-print-time64 (gnc:get-today) date-format)))
(let ((table-outer (gnc:make-html-table)))
(gnc:html-table-set-style! (gnc:html-table-set-style!
table-outer "table" table-outer "table"
'attribute (list "border" 0) 'attribute (list "border" 0)
'attribute (list "width" "100%") 'attribute (list "width" "100%")
'attribute (list "valign" "top") 'attribute (list "valign" "top")
'attribute (list "cellspacing" 0) 'attribute (list "cellspacing" 0)
'attribute (list "cellpadding" 0)) 'attribute (list "cellpadding" 0))
(gnc:html-table-append-row! table-outer (list table))
(gnc:html-table-append-row! table-outer (list table)) table-outer)))
table-outer))
(define (markup-percent profit sales) (define (markup-percent profit sales)
(if (zero? sales) 0 (if (zero? sales) 0
@ -315,18 +289,13 @@
gnc-commodity-equiv)) gnc-commodity-equiv))
(book (gnc-get-current-book)) (book (gnc-get-current-book))
(date-format (gnc:options-fancy-date book)) (date-format (gnc:options-fancy-date book))
(type (opt-val "__reg" "owner-type"))
(ownerlist (gncBusinessGetOwnerList (ownerlist (gncBusinessGetOwnerList
book book
(gncOwnerTypeToQofIdType type) (gncOwnerTypeToQofIdType GNC-OWNER-CUSTOMER)
(opt-val gnc:pagename-display optname-show-inactive))) (opt-val gnc:pagename-display optname-show-inactive)))
(toplevel-total-sales (gnc:make-commodity-collector)) (toplevel-total-sales (gnc:make-commodity-collector))
(toplevel-total-expense (gnc:make-commodity-collector)) (toplevel-total-expense (gnc:make-commodity-collector))
(type-str (cond (type-str (N_ "Customer")))
((eqv? type GNC-OWNER-CUSTOMER) (N_ "Customer"))
((eqv? type GNC-OWNER-VENDOR) (N_ "Vendor"))
((eqv? type GNC-OWNER-EMPLOYEE) (N_ "Employee"))
(else ""))))
(gnc:html-document-set-title! (gnc:html-document-set-title!
document (string-append (_ type-str) " " (_ "Report"))) document (string-append (_ type-str) " " (_ "Report")))
@ -369,10 +338,7 @@
document document
(gnc:make-html-text (gnc:make-html-text
(string-append (string-append
(cond (_ "No valid customer selected.")
((eqv? type GNC-OWNER-CUSTOMER) (_ "No valid customer selected."))
((eqv? type GNC-OWNER-VENDOR) (_ "No valid vendor selected."))
((eqv? type GNC-OWNER-EMPLOYEE) (_ "No valid employee selected.")))
" " (_ "Click on the \"Options\" button to select a company."))))) " " (_ "Click on the \"Options\" button to select a company.")))))
(else (else
@ -521,7 +487,7 @@
'name (N_ "Customer Summary") 'name (N_ "Customer Summary")
'report-guid customer-report-guid 'report-guid customer-report-guid
'menu-path (list gnc:menuname-business-reports) 'menu-path (list gnc:menuname-business-reports)
'options-generator customer-options-generator 'options-generator options-generator
'renderer reg-renderer 'renderer reg-renderer
'in-menu? #t) 'in-menu? #t)