                     :style :summary
                     :data (->> (interleave (-> result :totals :income)
                                            (-> result :totals :expense))
-                               (map :value)
                                (partition 2)
                                (map #(apply - %))
                                (map #(hash-map :value %)))}])))

      (reduce (fn [totals periods]
                (->> (interleave totals periods)
                     (partition 2)
                     (map #(apply + %))
                     (map #(hash-map :value %))))
              period-matrix))
    items))


                 nil)}
   (html
     [:td (:caption item)]
     (map #(vector :td.text-right (format-number (:value %))) (:data item))
     [:td.text-right (format-number (reduce + 0 (map :value (:data item))))])])

(defn- summarize-periods
  [items]
