@Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    // pie chart
    MenuItem itemChart = menu.findItem(R.id.menu_chart);
    if (itemChart != null) {
      itemChart.setVisible(!(((PayeesReportActivity) getActivity()).mIsDualPanel));
      itemChart.setIcon(UIHelper.resolveIdAttribute(getActivity(), R.attr.ic_action_pie_chart));
    }
  }
  @Override
  public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    super.onLoadFinished(loader, data);
    switch (loader.getId()) {
      case ID_LOADER:
        if (data == null) return;

        // parse cursor for calculate total
        double totalAmount = 0;
        while (data.moveToNext()) {
          totalAmount += data.getDouble(data.getColumnIndex("TOTAL"));
        }

        CurrencyService currencyService = new CurrencyService(getContext());

        TextView txtColumn2 = (TextView) mFooterListView.findViewById(R.id.textViewColumn2);
        txtColumn2.setText(
            currencyService.getBaseCurrencyFormatted(MoneyFactory.fromDouble(totalAmount)));

        // solve bug chart
        if (data.getCount() > 0) {
          getListView().removeFooterView(mFooterListView);
          getListView().addFooterView(mFooterListView);
        }
        // handler to show chart
        if (((PayeesReportActivity) getActivity()).mIsDualPanel) {
          Handler handler = new Handler();
          handler.postDelayed(
              new Runnable() {

                @Override
                public void run() {
                  showChart();
                }
              },
              1 * 1000);
        }
    }
  }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    setListAdapter(null);
    setShowMenuItemSearch(true);

    // create header view
    mHeaderListView =
        (LinearLayout) addListViewHeaderFooter(R.layout.item_generic_report_2_columns);
    TextView txtColumn1 = (TextView) mHeaderListView.findViewById(R.id.textViewColumn1);
    TextView txtColumn2 = (TextView) mHeaderListView.findViewById(R.id.textViewColumn2);
    // set header
    txtColumn1.setText(R.string.payee);
    txtColumn1.setTypeface(null, Typeface.BOLD);
    txtColumn2.setText(R.string.amount);
    txtColumn2.setTypeface(null, Typeface.BOLD);
    // add to list view
    getListView().addHeaderView(mHeaderListView);

    // create footer view
    mFooterListView =
        (LinearLayout) addListViewHeaderFooter(R.layout.item_generic_report_2_columns);
    txtColumn1 = (TextView) mFooterListView.findViewById(R.id.textViewColumn1);
    txtColumn2 = (TextView) mFooterListView.findViewById(R.id.textViewColumn2);
    // set footer
    txtColumn1.setText(R.string.total);
    txtColumn1.setTypeface(null, Typeface.BOLD_ITALIC);
    txtColumn2.setText(R.string.total);
    txtColumn2.setTypeface(null, Typeface.BOLD_ITALIC);
    // add to list view
    // getListView().addFooterView(mFooterListView);

    // set adapter
    PayeeReportAdapter adapter = new PayeeReportAdapter(getActivity(), null);
    setListAdapter(adapter);

    super.onActivityCreated(savedInstanceState);
  }