      [:td.text-right (-> record :value format-number)]
      [:td.text-right
       {:class (if (<= 0 (:gain record)) "gain" "loss")}
-      (-> record :gain format-number)]
-     [:td
-      [:div.btn-group
-       (glyph-button :remove
-                     (format "/transactions/%s/unbuy" (-> record :lot-transactions first :transaction-id))
-                     {:size :extra-small
-                      :data-method :post
-                      :data-confirm "Are you sure you want to undo this purchase?"
-                      :level :danger
-                      :title "Click here to undo this purchase"})]]]
-    (map lot-transaction-row (:lot-transactions record))))
+      (-> record :gain format-number)]]))
+
+(defn- lot-section
+  [record]
+  (html
+    [:div.row
+     [:div.col-sm-12
+      [:table.table.table-striped
+       [:tr
+        [:th.text-right "Shares Owned"]
+        [:th.text-right "Purchase Price"]
+        [:th.text-right "Current Price"]
+        [:th.text-right "Cost"]
+        [:th.text-right "Value"]
+        [:th.text-right "Gain"]]
+       (lot-row record)]]]
+    [:div.row
+     [:div.col-sm-10.col-sm-offset-2
+      (lot-transactions-table (:lot-transactions record))]]))
 
 (defn index
   [{{:keys [account-id commodity-id]} :params}]

        commodity (commodities/find-by-id (env :db) (Integer. commodity-id))
        records (reports/lot-report (env :db) (:id account) (:id commodity))]
    (with-lots-layout (format "Lots of %s in %s" (:symbol commodity) (:name account)) (:entity-id account) {}
      [:table.table.table-striped
       [:tr
        [:th.text-right "Purchase Date"]
        [:th.text-right "Shares Owned"]
        [:th.text-right "Purchase Price"]
        [:th.text-right "Current Price"]
        [:th.text-right "Cost"]
        [:th.text-right "Value"]
        [:th.text-right "Gain"]
        [:th.text-right "&nbsp;"]]
       (html
         (map lot-row records)
         [:tr.report-summary
          [:td.text-right {:colspan 2} "shares"]
          [:td.text-right {:colspan 3} "cost"]
          [:td.text-right "value"]
          [:td.text-right "gain"]
          [:td "&nbsp;"]])]
      [:a.btn.btn-default {:href (format "/accounts/%s" (:id account))
                           :title "Click here to return to the account page"}
       "Back"])))

  [:tr
   [:td.text-right (-> record :trade-date format-date)]
   [:td.text-right (format "%s%s"
                           (if (= :buy (:action record)) "+ " "- ")
                           (-> record :shares format-number))]
   [:td.text-right (-> record :price format-number)]
   [:td.text-right (-> record :value format-number)]
   [:td.text-right (-> record :gain format-number)]
   [:td.text-center
    [:div.btn-group
     (if (= :buy (:action record))
       (glyph-button :remove
                     (format "/transactions/%s/unbuy" (:transaction-id record))
                     {:size :extra-small
                      :data-method :post
                      :data-confirm "Are you sure you want to undo this purchase?"
                      :level :danger
                      :title "Click here to undo this purchase"})
       (glyph-button :remove
                     (format "/transactions/%s/unsell" (:transaction-id record))
                     {:size :extra-small
                      :data-method :post
                      :data-confirm "Are you sure you want to undo this sale?"
                      :level :danger
                      :title "Click here to undo this sale."}))]]])

(defn- lot-transactions-table
  [records]
  [:table.table.table-striped
   [:tr
    [:th.text-right "Trade Date"]
    [:th.text-right "Shares"]
    [:th.text-right "Price"]
    [:th.text-right "Value"]
    [:th.text-right "Gain"]
    [:th.text-right "&nbsp;"]]
   (map lot-transaction-row records)])

(defn- lot-row
  [record]
  (html
    [:tr
     [:td.text-right (-> record :shares-owned format-number)]
     [:td.text-right (-> record :purchase-price format-number)]
     [:td.text-right (-> record :current-price format-number)]
