@Override
	public void actionPerformed(ActionEvent e) {
		if (e.getActionCommand().equals("清空")) {
			resetAll();
		} else if (e.getActionCommand().equals("查询")) {
			select();
		} else if (e.getActionCommand().equals("保存")) {
			String ids = id.getText();
			CustomerService cs=new CustomerService();
			Customer cus = cs.getCustomer(ids);
			String pros = projectName.getSelectedItem().toString();
			String costs = cost.getText();
			String times = time.getText();
			String cnames = costName.getText();
			String operas = operator.getSelectedItem().toString();
			//**********校验
			if(!Check.checkNull(new String[]{"会员编号","消费项目","消费金额","操作人"}, new String[]{ids,pros,costs,operas})){
				return ;
			}
			if(!Check.checkNum(new String[]{"消费金额"}, new String[]{costs})){
				return ;
			}
			
			
			BigDecimal cos = new BigDecimal(costs);
			Costinfo c = new Costinfo();
			c.setCost(cos);
			c.setCostName(cnames);
			c.setCustomer(cus);
			c.setOperator(operas);
			c.setProjectName(pros);
			c.setTime(times);
			CostinfoService costser = new CostinfoService();
			
			CardinfoService cis = new CardinfoService();
			Cardinfo ci = cis.getCardinfoByCustomer(ids);
			BigDecimal am = ci.getAmount();
			if((new Date()).getTime()>(DateUtil.string2Date(ci.getEndDate(), "yyyy-MM-dd")).getTime()){
				JOptionPane.showMessageDialog(null, "会员卡已过期！", "提示", JOptionPane.INFORMATION_MESSAGE);
				return ;
			}
			if(am.subtract(cos).compareTo(new BigDecimal(0))<0){
				JOptionPane.showMessageDialog(null, "余额不足，请充值！", "提示", JOptionPane.INFORMATION_MESSAGE);
				return ;
			}else{
				costser.save(c);
				ci.setAmount(am.subtract(cos));
				ci.setCount(ci.getCount()+1);
				cis.save(ci);
				JOptionPane.showMessageDialog(null, "添加成功！", "提示", JOptionPane.INFORMATION_MESSAGE);
				reset();
			}
		} 
	}