コード例 #1
0
  @Override
  public SfsContentView inflate() {

    layoutInflater.inflate(R.layout.doc_order_cfr, this);
    if (_entity == null) return this;
    // заполнение полей заказа

    ((TextView) findViewById(R.id.order_descr))
        .setText(
            String.format(
                "№%03d/%09d от %td.%tm.%ty",
                _entity.Author.Id,
                _entity.Id,
                _entity.CreateDate,
                _entity.CreateDate,
                _entity.CreateDate));
    ((TextView) findViewById(R.id.order_amount)).setText(String.format("%.2f", _entity.mAmount));
    ((TextView) findViewById(R.id.order_outlet)).setText(_entity.Outlet.toString());
    ((TextView) findViewById(R.id.order_outlet_address))
        .setText(Utils.prepareAddress(_entity.Outlet.Address));
    if (_entity.CFR > 0) {
      DocInvoiceEntity invoice = Globals.getDerivedInvoice(_entity);
      if (invoice != null) {
        ((TextView) findViewById(R.id.invoice_descr))
            .setText(
                String.format(
                    "№%s от %td.%tm.%ty",
                    invoice.DocNo, invoice.ShipmentDate, invoice.ShipmentDate, invoice.CreateDate));
        ((TextView) findViewById(R.id.invoice_amount))
            .setText(String.format("%.2f", invoice.mAmount));
        ((TextView) findViewById(R.id.order_cfr_value))
            .setText(String.format("%d", _entity.Quantity - invoice.Quantity));
      }
      ((TextView) findViewById(R.id.order_cfr))
          .setText(String.format("%.0f%%", _entity.CFR * 100f));
    } else {
      ((TextView) findViewById(R.id.invoice_descr)).setText("Отгрузка не подтверждена");
      ((TextView) findViewById(R.id.invoice_amount)).setVisibility(GONE);
      ((TextView) findViewById(R.id.invoice_amount_label)).setVisibility(GONE);
      ((TextView) findViewById(R.id.order_cfr)).setVisibility(GONE);
      ((TextView) findViewById(R.id.order_cfr_label)).setVisibility(GONE);
      ((TextView) findViewById(R.id.order_cfr_value)).setVisibility(GONE);
      ((TextView) findViewById(R.id.order_cfr_value_label)).setVisibility(GONE);
    }

    return this;
  }
コード例 #2
0
  @Override
  public SfsContentView inflate() {
    layoutInflater.inflate(R.layout.visit_entity_view, this);
    mTabHost = (TabHost) findViewById(R.id.visit_tab);
    mTabHost.setup();
    mTabHost.setOnTabChangedListener(this);

    Utils.AddTab(mTabHost, _tabFactory, TABS_TAG_TASK, "Тип визита");
    Utils.AddTab(mTabHost, _tabFactory, TABS_TAG_TARGET, "Цели");
    Utils.AddTab(mTabHost, _tabFactory, TABS_TAG_ORDERS, "Заказы");
    Utils.AddTab(mTabHost, _tabFactory, TABS_TAG_STORECHECK, "Полка");
    Utils.AddTab(mTabHost, _tabFactory, TABS_TAG_TPR, "TPR");
    Utils.AddTab(mTabHost, _tabFactory, TABS_TAG_PAYMENT, "Долги");
    Utils.AddTab(mTabHost, _tabFactory, TABS_TAG_OUTLET, "Точка");
    visibilityControl();

    if (_catalog.Find(_entity)) {
      if (_catalog.Current().TaskEnd == null) {
        _catalog.Current().TaskBegin = new Date();
        _catalog.Current().TaskEnd = new Date();
        _catalog.save();
      }
    }
    refresh();

    _entity.setOnVisitTypeChangedListener(
        new OnVisitTypeChangedListener() {

          public void onVisitTypeChanged(TaskVisitEntity sender, int type) {
            visibilityControl();
          }
        });

    MainActivity.sInstance.mCurrentWorkday.stopGpsControl();

    return this;
  }