コード例 #1
0
ファイル: CLPFragment2.java プロジェクト: florin-b/LSFPRD
  private void performSaveClp() {
    try {

      HashMap<String, String> params = new HashMap<String, String>();

      String localAlertSD = "true";

      // pentru KA nu se cere aprobarea SD-ului local
      if (UserInfo.getInstance().getTipAcces().equals("10")
          || UserInfo.getInstance().getTipAcces().equals("27")) {
        localAlertSD = "false";
      }

      String localDep = UserInfo.getInstance().getCodDepart();

      // consilieri
      if (UserInfo.getInstance().getTipAcces().equals("17")
          || UserInfo.getInstance().getTipAcces().equals("18")) {
        localDep = CLPFragment1.departamentConsilier;
      }

      params.put("comanda", CreareClp.comandaFinala);
      params.put("codAgent", UserInfo.getInstance().getCod());
      params.put("filiala", UserInfo.getInstance().getUnitLog());
      params.put("depart", localDep);
      params.put("alertSD", localAlertSD);
      params.put("serData", operatiiClp.serializeComandaClp(comandaCLP));

      operatiiClp.salveazaComanda(params);

    } catch (Exception e) {
      Toast.makeText(getActivity(), e.toString(), Toast.LENGTH_SHORT).show();
    }
  }
コード例 #2
0
ファイル: CLPFragment2.java プロジェクト: florin-b/LSFPRD
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View v = inflater.inflate(R.layout.clp_fragment_2, container, false);

    opArticol = OperatiiArticolFactory.createObject("OperatiiArticolImpl", getActivity());
    opArticol.setListener(this);

    nf2 = NumberFormat.getInstance();

    this.tglButton = (ToggleButton) v.findViewById(R.id.togglebuttonClp);
    addListenerToggle();
    this.tglButton.setChecked(true);

    operatiiClp = new ClpDAO(getActivity());
    operatiiClp.setClpDAOListener(this);

    this.tglTipArtBtn = (ToggleButton) v.findViewById(R.id.tglTipArtClp);
    addListenerTglTipArtBtn();

    txtNumeArticol = (EditText) v.findViewById(R.id.txtNumeArtClp);

    this.articoleBtn = (Button) v.findViewById(R.id.articoleBtnClp);
    addListenerBtnArticole();

    this.listViewArticole = (ListView) v.findViewById(R.id.listArticole);

    textValoareGreutate = (TextView) v.findViewById(R.id.textValoareGreutate);

    textTotalGreutate = (TextView) v.findViewById(R.id.textTotalGreutate);
    layoutTotalGreutate = (LinearLayout) v.findViewById(R.id.layoutTotalGreutate);
    layoutTotalGreutate.setVisibility(View.INVISIBLE);

    layoutGreutate = (LinearLayout) v.findViewById(R.id.layoutGreutate);
    layoutGreutate.setVisibility(View.INVISIBLE);

    listViewArticole.setOnItemClickListener(new MyOnItemSelectedListener());

    spinnerDepoz = (Spinner) v.findViewById(R.id.spinnerDepozClp);
    ArrayAdapter<String> adapterSpinnerDepoz =
        new ArrayAdapter<String>(
            getActivity(), android.R.layout.simple_spinner_item, getDepozite());
    adapterSpinnerDepoz.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinnerDepoz.setAdapter(adapterSpinnerDepoz);
    spinnerDepoz.setOnItemSelectedListener(new OnSelectDepozit());

    textNumeArticol = (TextView) v.findViewById(R.id.textNumeArticolClp);
    textNumeArticol.setVisibility(View.INVISIBLE);
    textCodArticol = (TextView) v.findViewById(R.id.textCodArticolClp);
    textCodArticol.setVisibility(View.INVISIBLE);

    labelStoc = (TextView) v.findViewById(R.id.labelStocClp);
    labelStoc.setVisibility(View.INVISIBLE);

    textStoc = (TextView) v.findViewById(R.id.textStocClp);
    textStoc.setVisibility(View.INVISIBLE);

    textUm = (TextView) v.findViewById(R.id.textUmClp);
    textUm.setVisibility(View.INVISIBLE);

    labelCantArt = (TextView) v.findViewById(R.id.labelCantArtClp);
    labelCantArt.setVisibility(View.INVISIBLE);
    textCantArt = (EditText) v.findViewById(R.id.txtCantArtClp);
    textCantArt.setVisibility(View.INVISIBLE);

    layoutArtHeader = (LinearLayout) v.findViewById(R.id.layoutHeaderArtClp);
    layoutArtDet = (LinearLayout) v.findViewById(R.id.layoutDetArtClp);

    this.slidingDrawerArt = (SlidingDrawer) v.findViewById(R.id.articoleSlidingDrawer);
    addDrawerListener();

    listArtCmdClp = (ListView) v.findViewById(R.id.listArtCmdClp);

    listArtSelClp = new ArrayList<HashMap<String, String>>();
    adapterListArtClp =
        new SimpleAdapter(
            getActivity(),
            listArtSelClp,
            R.layout.articol_row_clp,
            new String[] {
              "nrCrt",
              "numeArt",
              "codArt",
              "cantArt",
              "depozit",
              "Umb",
              "sintetic",
              "greutate",
              "umgreutate",
              "depart"
            },
            new int[] {
              R.id.textNrCrt,
              R.id.textNumeArt,
              R.id.textCodArt,
              R.id.textCantArt,
              R.id.textDepozit,
              R.id.textCantUmb,
              R.id.textSintetic,
              R.id.textGreutate,
              R.id.textUmGreutate,
              R.id.textDepart
            });

    listArtCmdClp.setAdapter(adapterListArtClp);
    listArtCmdClp.setClickable(true);
    addListenerListArtSel();
    registerForContextMenu(listArtCmdClp);

    this.saveArtBtnClp = (Button) v.findViewById(R.id.saveArtBtnClp);
    this.saveArtBtnClp.setVisibility(View.INVISIBLE);
    addListenerBtnSaveArticole();

    layoutSaveClp = (TableLayout) v.findViewById(R.id.layoutSaveClp);
    layoutSaveClp.setVisibility(View.INVISIBLE);

    CLPFragment2.slidingDrawerSaveClp = (SlidingDrawer) v.findViewById(R.id.slidingDrawerClp);
    addDrawerClpListener();

    this.slideButtonClp = (Button) v.findViewById(R.id.slideButtonClp);

    this.saveClpButton = (Button) v.findViewById(R.id.saveClpBtn);
    addListenerSaveClpBtn();

    mProgressClp = (ProgressBar) v.findViewById(R.id.progress_bar_saveclp);
    mProgressClp.setVisibility(View.INVISIBLE);

    spinnerUMClp = (Spinner) v.findViewById(R.id.spinnerUMClp);

    listUmVanz = new ArrayList<HashMap<String, String>>();
    adapterUmVanz =
        new SimpleAdapter(
            getActivity(),
            listUmVanz,
            R.layout.simplerowlayout,
            new String[] {"rowText"},
            new int[] {R.id.textRowName});
    spinnerUMClp.setAdapter(adapterUmVanz);
    spinnerUMClp.setVisibility(View.GONE);
    spinnerUMClp.setOnItemSelectedListener(new OnSelectUnitMas());

    comandaCLP = new ComandaCreataCLP();

    return v;
  }