public TabBillingComps() {
    try {

      setTitle(CallCenterBK.constants.billingComps());
      setCanClose(true);

      billingCompsDS = DataSource.get("BillingCompsDS");

      mainLayout = new VLayout(5);
      mainLayout.setWidth100();
      mainLayout.setHeight100();
      mainLayout.setMargin(5);

      searchForm = new DynamicForm();
      searchForm.setAutoFocus(true);
      searchForm.setWidth(830);
      searchForm.setTitleWidth(250);
      searchForm.setNumCols(4);
      mainLayout.addMember(searchForm);

      billingCompNameItem = new TextItem();
      billingCompNameItem.setTitle(CallCenterBK.constants.companyName());
      billingCompNameItem.setWidth(250);
      billingCompNameItem.setName("billingCompNameItem");

      phoneIndexItem = new TextItem();
      phoneIndexItem.setTitle(CallCenterBK.constants.index());
      phoneIndexItem.setWidth(250);
      phoneIndexItem.setName("phoneIndexItem");

      hasCalcItem = new SelectItem();
      hasCalcItem.setTitle(CallCenterBK.constants.hasCalculation());
      hasCalcItem.setWidth(250);
      hasCalcItem.setName("hasCalcItem");
      hasCalcItem.setDefaultToFirstOption(true);
      hasCalcItem.setValueMap(ClientMapUtil.getInstance().getHasCalculations());

      operatorItem = new SelectItem();
      operatorItem.setTitle(CallCenterBK.constants.operator());
      operatorItem.setWidth(200);
      operatorItem.setName("operator_src");
      operatorItem.setDefaultToFirstOption(true);
      ClientUtils.fillCombo(
          operatorItem, "OperatorsDS", "searchOperators", "operator_src", "operator_src_descr");

      searchForm.setFields(billingCompNameItem, phoneIndexItem, hasCalcItem, operatorItem);

      HLayout buttonLayout = new HLayout(5);
      buttonLayout.setWidth(830);
      buttonLayout.setHeight(30);
      buttonLayout.setAlign(Alignment.RIGHT);

      clearButton = new IButton();
      clearButton.setTitle(CallCenterBK.constants.clear());

      findButton = new IButton();
      findButton.setTitle(CallCenterBK.constants.find());

      buttonLayout.setMembers(findButton, clearButton);
      mainLayout.addMember(buttonLayout);

      ToolStrip toolStrip = new ToolStrip();
      toolStrip.setWidth100();
      toolStrip.setPadding(5);
      mainLayout.addMember(toolStrip);

      addBtn = new ToolStripButton(CallCenterBK.constants.add(), "addIcon.png");
      addBtn.setLayoutAlign(Alignment.LEFT);
      addBtn.setWidth(50);
      toolStrip.addButton(addBtn);

      editBtn = new ToolStripButton(CallCenterBK.constants.modify(), "editIcon.png");
      editBtn.setLayoutAlign(Alignment.LEFT);
      editBtn.setWidth(50);
      toolStrip.addButton(editBtn);

      deleteBtn = new ToolStripButton(CallCenterBK.constants.disable(), "deleteIcon.png");
      deleteBtn.setLayoutAlign(Alignment.LEFT);
      deleteBtn.setWidth(50);
      toolStrip.addButton(deleteBtn);

      toolStrip.addSeparator();

      billingCompBillByDayBtn =
          new ToolStripButton(CallCenterBK.constants.telCombBillByDay(), "billing.png");
      billingCompBillByDayBtn.setLayoutAlign(Alignment.LEFT);
      billingCompBillByDayBtn.setWidth(50);
      toolStrip.addButton(billingCompBillByDayBtn);

      billingCompBillByMonthBtn =
          new ToolStripButton(CallCenterBK.constants.telCombBillByMonth(), "billing.png");
      billingCompBillByMonthBtn.setLayoutAlign(Alignment.LEFT);
      billingCompBillByMonthBtn.setWidth(50);
      toolStrip.addButton(billingCompBillByMonthBtn);

      billingCompsGrid = new ListGrid();

      billingCompsGrid.setWidth100();
      billingCompsGrid.setHeight100();
      billingCompsGrid.setAlternateRecordStyles(true);
      billingCompsGrid.setDataSource(billingCompsDS);
      billingCompsGrid.setAutoFetchData(false);
      billingCompsGrid.setShowFilterEditor(false);
      billingCompsGrid.setCanEdit(false);
      billingCompsGrid.setCanRemoveRecords(false);
      billingCompsGrid.setFetchOperation("searchAllBillingComps");
      billingCompsGrid.setShowRowNumbers(true);
      billingCompsGrid.setCanHover(true);
      billingCompsGrid.setShowHover(true);
      billingCompsGrid.setShowHoverComponents(true);
      billingCompsGrid.setWrapCells(true);
      billingCompsGrid.setFixedRecordHeights(false);
      billingCompsGrid.setCanDragSelectText(true);

      ListGridField billing_company_name =
          new ListGridField("billing_company_name", CallCenterBK.constants.companyName());

      ListGridField our_percent =
          new ListGridField("our_percent", CallCenterBK.constants.ourPercent(), 150);

      ListGridField has_calculation_descr =
          new ListGridField("has_calculation_descr", CallCenterBK.constants.hasCalculation(), 150);

      ListGridField call_price =
          new ListGridField("call_price", CallCenterBK.constants.callPrice(), 150);

      our_percent.setAlign(Alignment.CENTER);
      has_calculation_descr.setAlign(Alignment.CENTER);
      call_price.setAlign(Alignment.CENTER);

      billingCompsGrid.setFields(
          billing_company_name, our_percent, has_calculation_descr, call_price);

      mainLayout.addMember(billingCompsGrid);
      findButton.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              search();
            }
          });

      billingCompNameItem.addKeyPressHandler(
          new KeyPressHandler() {
            @Override
            public void onKeyPress(KeyPressEvent event) {
              if (event.getKeyName().equals("Enter")) {
                search();
              }
            }
          });

      phoneIndexItem.addKeyPressHandler(
          new KeyPressHandler() {
            @Override
            public void onKeyPress(KeyPressEvent event) {
              if (event.getKeyName().equals("Enter")) {
                search();
              }
            }
          });

      clearButton.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              billingCompNameItem.clearValue();
            }
          });

      addBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              DlgAddEditBillingComps dlgAddEditBillingComp =
                  new DlgAddEditBillingComps(billingCompsGrid, null);
              dlgAddEditBillingComp.show();
            }
          });

      editBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord();

              if (listGridRecord == null) {
                SC.say(CallCenterBK.constants.pleaseSelrecord());
                return;
              }

              DlgAddEditBillingComps dlgAddEditBillingComp =
                  new DlgAddEditBillingComps(billingCompsGrid, listGridRecord);
              dlgAddEditBillingComp.show();
            }
          });
      deleteBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              final ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenterBK.constants.pleaseSelrecord());
                return;
              }
              SC.ask(
                  CallCenterBK.constants.askForDisable(),
                  new BooleanCallback() {
                    @Override
                    public void execute(Boolean value) {
                      if (value) {
                        delete(listGridRecord);
                      }
                    }
                  });
            }
          });

      billingCompsGrid.addRecordDoubleClickHandler(
          new RecordDoubleClickHandler() {
            @Override
            public void onRecordDoubleClick(RecordDoubleClickEvent event) {
              ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord();
              DlgAddEditBillingComps dlgAddEditBillingComp =
                  new DlgAddEditBillingComps(billingCompsGrid, listGridRecord);
              dlgAddEditBillingComp.show();
            }
          });

      billingCompBillByDayBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

              final ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenterBK.constants.pleaseSelrecord());
                return;
              }
              Integer billing_company_id = listGridRecord.getAttributeAsInt("billing_company_id");
              getBillingCompBillByDay(billing_company_id);
            }
          });
      billingCompBillByMonthBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

              final ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenterBK.constants.pleaseSelrecord());
                return;
              }
              Integer billing_company_id = listGridRecord.getAttributeAsInt("billing_company_id");
              getBillingCompBillByMonth(billing_company_id);
            }
          });

      setPane(mainLayout);
    } catch (Exception e) {
      SC.say(e.toString());
    }
  }
  public DlgAddEditTown(ListGrid cityGrid, ListGridRecord cityRecord) {
    super();
    this.lCityRecord = cityRecord;
    this.cityGrid = cityGrid;

    setTitle(cityRecord == null ? "ახალი ქალაქის დამატება" : "ქალაქის მოდიფიცირება");

    setHeight(310);
    setWidth(520);
    setShowMinimizeButton(false);
    setIsModal(true);
    setShowModalMask(true);
    setCanDrag(false);
    setCanDragReposition(false);
    setCanDragResize(false);
    setCanDragScroll(false);
    centerInPage();

    hLayout = new VLayout(5);
    hLayout.setWidth100();
    hLayout.setHeight100();
    hLayout.setPadding(10);

    dynamicForm = new DynamicForm();
    dynamicForm.setAutoFocus(true);
    dynamicForm.setWidth100();
    dynamicForm.setTitleWidth(200);
    dynamicForm.setNumCols(2);
    hLayout.addMember(dynamicForm);

    cityNameGeoItem = new TextItem();
    cityNameGeoItem.setTitle("დასახელება");
    cityNameGeoItem.setWidth(300);
    cityNameGeoItem.setName("town_name");

    cityCodeItem = new TextItem();
    cityCodeItem.setTitle("ქალაქის კოდი");
    cityCodeItem.setWidth(300);
    cityCodeItem.setName("town_code");

    cityNewCodeItem = new TextItem();
    cityNewCodeItem.setTitle("ქალაქის კოდი (ახალი)");
    cityNewCodeItem.setWidth(300);
    cityNewCodeItem.setName("town_new_code");

    ofGmtItem = new TextItem();
    ofGmtItem.setTitle("დრო");
    ofGmtItem.setWidth(300);
    ofGmtItem.setName("normal_gmt");

    ofGmtWinterItem = new TextItem();
    ofGmtWinterItem.setTitle("ზამთრის დრო");
    ofGmtWinterItem.setWidth(300);
    ofGmtWinterItem.setName("winter_gmt");

    countryItem = new ComboBoxItem();
    countryItem.setWidth(300);
    countryItem.setTitle("ქვეყანა");
    countryItem.setName("country_id");
    countryItem.setFetchMissingValues(true);
    countryItem.setFilterLocally(false);
    countryItem.setAddUnknownValues(false);

    townTypeItem = new ComboBoxItem();
    townTypeItem.setTitle("ქალაქის ტიპი");
    townTypeItem.setWidth(300);
    townTypeItem.setName("townTypeItem");
    townTypeItem.setFetchMissingValues(true);
    townTypeItem.setFilterLocally(false);
    townTypeItem.setAddUnknownValues(false);

    DataSource DescriptionsDS = DataSource.get("DescriptionsDS");
    townTypeItem.setOptionOperationId("searchDescriptionsOrderById");
    townTypeItem.setOptionDataSource(DescriptionsDS);
    townTypeItem.setValueField("description_id");
    townTypeItem.setDisplayField("description");

    Criteria criteria = new Criteria();
    criteria.setAttribute("description_type_id", "59000");
    townTypeItem.setOptionCriteria(criteria);
    townTypeItem.setAutoFetchData(false);

    townTypeItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            Criteria criteria = townTypeItem.getOptionCriteria();
            if (criteria != null) {
              String oldAttr = criteria.getAttribute("town_type_id");
              if (oldAttr != null) {
                Object nullO = null;
                criteria.setAttribute("town_type_id", nullO);
              }
            }
          }
        });

    countryItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            Criteria criteria = countryItem.getOptionCriteria();
            if (criteria != null) {
              String oldAttr = criteria.getAttribute("country_id");
              if (oldAttr != null) {
                Object nullO = null;
                criteria.setAttribute("country_id", nullO);
              }
            }
          }
        });

    isCapitalItem = new ComboBoxItem();
    isCapitalItem.setTitle("დედაქალაქი");
    isCapitalItem.setWidth(300);
    isCapitalItem.setName("capital_town");
    isCapitalItem.setValueMap(ClientMapUtil.getInstance().getIsCapital());

    dynamicForm.setFields(
        cityNameGeoItem,
        cityCodeItem,
        cityNewCodeItem,
        ofGmtItem,
        ofGmtWinterItem,
        countryItem,
        townTypeItem,
        isCapitalItem);

    HLayout hLayoutItem = new HLayout(5);
    hLayoutItem.setWidth100();
    hLayoutItem.setAlign(Alignment.RIGHT);

    IButton saveItem = new IButton();
    saveItem.setTitle("შენახვა");
    saveItem.setWidth(100);

    IButton cancItem = new IButton();
    cancItem.setTitle("დახურვა");
    cancItem.setWidth(100);

    hLayoutItem.setMembers(saveItem, cancItem);

    hLayout.addMember(hLayoutItem);

    cancItem.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            destroy();
          }
        });
    saveItem.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            saveCountry();
          }
        });

    addItem(hLayout);
    fillFields();
  }