ui/income.go
func (h *Handler) GetProductIncome(
	tkn, productID string) (*uint, error) {
	logger := h.logger.Add("method", "GetProductIncome",
		"productID", productID)

	return h.uintFromQuery(logger, tkn,
		`SELECT SUM(channels.receipt_balance)
		     FROM offerings
			  JOIN channels
			  ON channels.offering=offerings.id
		     	     AND offerings.product=$1`, productID)
}
func (h *Handler) GetProductIncome(
	tkn, productID string) (*uint, error) {
	logger := h.logger.Add("method", "GetProductIncome",
		"productID", productID)

	return h.uintFromQuery(logger, tkn,
		`SELECT SUM(channels.receipt_balance)
		     FROM offerings
			  JOIN channels
			  ON channels.offering=offerings.id
		     	     AND offerings.product=$1`, productID)
}
// GetProductIncome returns total receipt balance from all channels of all
// offerings with given product id.