dojo.provide("parus.balanceReportsExchangeJournalDialog");

dojo.require("dijit.Dialog");
dojo.require("dijit.form.Button");

dojo.require("parus.parus8");
dojo.require("parus.dialog");

dojo.declare("parus.balanceReportsExchangeJournalDialog", [parus.Dialog], {

  kind: null,

  catalog_name: null,

  postCreate: function() {
    this.inherited(arguments);

    this.grid.attr("store", new parus.gridData({
      queryid: "BalanceReportExchangeJournal",
      identityFieldName: "RN",
      onComplete: dojo.hitch(this, function(store, items, keywordArgs) {
        this.grid.selection.selectRange(0, items.length - 1);
      }),
      onGetConditions: dojo.hitch(this, function(store) {
        return {
          KIND: this.kind,
          CATALOG_NAME: this.catalog_name

        }
      })

    }));

    this.grid.setQuery({});

    this.popupMenu.bindDomNode(this.grid.viewsNode);
    parus.balance._createActionsButton(this.popupMenu, this.headerPane);

    var settings = parus.userdata.get(this.declaredClass);
    if (settings) {
      parus.gridSettingsDialog.mergeGridSettings(this.grid, settings.gridSettings);
      parus.gridSettingsDialog.mergeColorConditions(this.grid, settings.colorConditions);
      parus.gridSettingsDialog.mergeMenuSettings(this.popupMenu, settings.actionSettings, settings.userProcsActions, settings.userReportsActions, settings.userAppsActions);
      parus.gridSettingsDialog.mergeFilterBar(this.grid, settings.showFilterBar, settings.filterValues, settings.sortInfo);
    };


  }

});