|
|
@@ -132,6 +132,7 @@ public class SaleChartActivity extends BaseActivity implements OnClickListener{
|
|
|
}
|
|
|
};
|
|
|
};
|
|
|
+ private int type;
|
|
|
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
@@ -154,27 +155,50 @@ public class SaleChartActivity extends BaseActivity implements OnClickListener{
|
|
|
dialog.show();
|
|
|
falg=true;
|
|
|
break;
|
|
|
- case R.id.tv_premonth:
|
|
|
- calendar.add(Calendar.MONTH, -1);
|
|
|
- String date=new SimpleDateFormat("yyyy年MM月").format(calendar.getTime());
|
|
|
- tv_date.setText(date);
|
|
|
- dateMap.put("YEAR", calendar.get(Calendar.YEAR));
|
|
|
- dateMap.put("MONTH", calendar.get(Calendar.MONTH)+1);
|
|
|
- initData();
|
|
|
- break;
|
|
|
- case R.id.tv_nextmonth:
|
|
|
- calendar.add(Calendar.MONTH, +1);
|
|
|
- date=new SimpleDateFormat("yyyy年MM月").format(calendar.getTime());
|
|
|
- tv_date.setText(date);
|
|
|
- dateMap.put("YEAR", calendar.get(Calendar.YEAR));
|
|
|
- dateMap.put("MONTH", calendar.get(Calendar.MONTH)+1);
|
|
|
- initData();
|
|
|
- break;
|
|
|
+ case R.id.tv_premonth:
|
|
|
+ if (id==7) {
|
|
|
+ calendar.add(Calendar.DATE, -1);
|
|
|
+ String date = new SimpleDateFormat("yyyy年MM月dd日").format(calendar.getTime());
|
|
|
+ tv_date.setText(date);
|
|
|
+ String year=new SimpleDateFormat("yyyyMM").format(calendar.getTime());
|
|
|
+ dateMap.put("YEAR", year);
|
|
|
+ dateMap.put("MONTH", calendar.get(Calendar.MONTH) + 1);
|
|
|
+ dateMap.put("DAY", calendar.get(Calendar.DATE));
|
|
|
+ }else{
|
|
|
+ calendar.add(Calendar.MONTH, -1);
|
|
|
+ String date = new SimpleDateFormat("yyyy年MM月").format(calendar.getTime());
|
|
|
+ tv_date.setText(date);
|
|
|
+ dateMap.put("YEAR", calendar.get(Calendar.YEAR));
|
|
|
+ dateMap.put("MONTH", calendar.get(Calendar.MONTH) + 1);
|
|
|
+ dateMap.put("DAY", calendar.get(Calendar.DATE));
|
|
|
+ }
|
|
|
+ initData();
|
|
|
+ break;
|
|
|
+ case R.id.tv_nextmonth:
|
|
|
+ if (id==7) {
|
|
|
+ calendar.add(Calendar.DATE, +1);
|
|
|
+ String date = new SimpleDateFormat("yyyy年MM月dd日").format(calendar.getTime());
|
|
|
+ tv_date.setText(date);
|
|
|
+ String year=new SimpleDateFormat("yyyyMM").format(calendar.getTime());
|
|
|
+ dateMap.put("YEAR", year);
|
|
|
+ dateMap.put("MONTH", calendar.get(Calendar.MONTH) + 1);
|
|
|
+ dateMap.put("DAY", calendar.get(Calendar.DATE));
|
|
|
+ }else{
|
|
|
+ calendar.add(Calendar.MONTH, +1);
|
|
|
+ String date = new SimpleDateFormat("yyyy年MM月").format(calendar.getTime());
|
|
|
+ tv_date.setText(date);
|
|
|
+ dateMap.put("YEAR", calendar.get(Calendar.YEAR));
|
|
|
+ dateMap.put("MONTH", calendar.get(Calendar.MONTH) + 1);
|
|
|
+ dateMap.put("DAY", calendar.get(Calendar.DATE));
|
|
|
+ }
|
|
|
+ initData();
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private int id;
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
@@ -191,10 +215,29 @@ public class SaleChartActivity extends BaseActivity implements OnClickListener{
|
|
|
getSupportActionBar().setTitle("统计分析");
|
|
|
|
|
|
calendar = Calendar.getInstance(); // 设置当前日期
|
|
|
- String date=new SimpleDateFormat("yyyy年MM月").format(calendar.getTime());
|
|
|
- tv_date.setText(date);
|
|
|
- dateMap.put("YEAR", calendar.get(Calendar.YEAR));
|
|
|
- dateMap.put("MONTH", calendar.get(Calendar.MONTH) + 1);
|
|
|
+
|
|
|
+ /**@注释:获取type 饼图,直方图 */
|
|
|
+ Intent intent=getIntent();
|
|
|
+ id=intent.getIntExtra("Id", 0);
|
|
|
+ type=intent.getIntExtra("type", 1);
|
|
|
+
|
|
|
+ if (id==7) {//銷售按天統計
|
|
|
+ String date = new SimpleDateFormat("yyyy年MM月dd日").format(calendar.getTime());
|
|
|
+ tv_date.setText(date);
|
|
|
+ dateMap.put("YEAR", new SimpleDateFormat("yyyyMM").format(calendar.getTime()));
|
|
|
+ dateMap.put("MONTH", calendar.get(Calendar.MONTH) + 1);
|
|
|
+ dateMap.put("DAY", calendar.get(Calendar.DATE));
|
|
|
+ tv_nextmonth.setText("下一天");
|
|
|
+ tv_premonth.setText("上一天");
|
|
|
+ }else{
|
|
|
+ String date = new SimpleDateFormat("yyyy年MM月").format(calendar.getTime());
|
|
|
+ tv_date.setText(date);
|
|
|
+ dateMap.put("YEAR", calendar.get(Calendar.YEAR));
|
|
|
+ dateMap.put("MONTH", calendar.get(Calendar.MONTH) + 1);
|
|
|
+ dateMap.put("DAY", calendar.get(Calendar.DATE));
|
|
|
+ tv_nextmonth.setText("下一月");
|
|
|
+ tv_premonth.setText("上一月");
|
|
|
+ }
|
|
|
|
|
|
tv_date.setOnClickListener(this);
|
|
|
tv_premonth.setOnClickListener(this);
|
|
|
@@ -301,10 +344,7 @@ public class SaleChartActivity extends BaseActivity implements OnClickListener{
|
|
|
hl_adapter.notifyDataSetChanged();
|
|
|
}
|
|
|
url= Constants.getAppBaseUrl(this)+"mobile/common/getStatsByConfig.action";
|
|
|
- /**@注释:获取type 饼图,直方图 */
|
|
|
- Intent intent=getIntent();
|
|
|
- int id=intent.getIntExtra("Id", 0);
|
|
|
- int type=intent.getIntExtra("type", 1);
|
|
|
+
|
|
|
String sessionId= CommonUtil.getSharedPreferences(this, "sessionId");
|
|
|
progressDialog.show();
|
|
|
/**@注释:加载不同图 */
|