public int onHttpResponse(int code, String msg) {
    // TODO Auto-generated method stub
    dialog.dismiss();
    JSONObject jsonObject;
    try {
      jsonObject = new JSONObject(msg);
      if (jsonObject.getBoolean("success")) {
        dbi.deleteAll();

        m_adapter.clear();

        JSONArray arrfItem = jsonObject.getJSONArray("po");

        for (int j = 0; j < arrfItem.length(); j++) {
          pemesananDTO _penjualan = new pemesananDTO();
          _penjualan.fromJSON(arrfItem.getString(j));
          long insertedId = dbi.insert(_penjualan);
          dbi.setUploaded(insertedId);
        }

        m_orders = dbi.selectAll();
        for (int w = 0; w < m_orders.size(); w++) {
          m_adapter.add(m_orders.get(w));
        }
        m_adapter.notifyDataSetChanged();
      }
    } catch (JSONException e) {
      // TODO Auto-generated catch block

      showMessage("Format data rusak");
    }

    return 0;
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.listpenjualan);

    dbi = new DBPemesanan(this, Contents.getDBHelper().getDB());

    m_orders = dbi.selectAll();
    this.m_adapter = new OrderAdapter(this, R.layout.group_row, m_orders);
    setListAdapter(this.m_adapter);

    getListView().setOnItemClickListener(this);

    /* Intent cnf = new Intent();
    cnf.setClass(ListPemesanan.this, SyncDialog.class);
    startActivityForResult(cnf,1); */

    Button brefresh = (Button) findViewById(R.id.refresh);
    brefresh.setOnClickListener(
        new OnClickListener() {

          public void onClick(View arg0) {
            // TODO Auto-generated method stub
            /*Intent cnf = new Intent();
            cnf.setClass(ListPemesanan.this, SyncDialog.class);
            startActivityForResult(cnf,1); */
            if (isOnline()) {
              JSONObject outer = new JSONObject();
              JSONArray arrItems = new JSONArray();
              try {
                outer.put("user_id", Contents.getLogInfo().getUserid());
                for (int i = 0; i < m_orders.size(); i++) {
                  pemesananDTO penjualan = m_orders.get(i);
                  if (penjualan.getPOCode().trim().length() == 0) {
                    arrItems.put(penjualan.toJSON());
                  }
                }
                outer.put("po", arrItems);
              } catch (JSONException e) {
                System.out.println(e);
              }
              dialog =
                  ProgressDialog.show(
                      ListPemesanan.this, "", "Mengirim data. Mohon tunggu...", true);

              HttpRequest.instance()
                  .request(
                      dialog,
                      ListPemesanan.this,
                      Contents.urlServer + "po/syncpo",
                      outer.toString(),
                      0);
            } else {
              showMessage("Tidak terdapat koneksi");
            }
          }
        });
  }