package com.kingdee.eas.fi.ar.client;

import java.awt.event.ActionEvent;
import java.util.Date;

import com.kingdee.eas.custom.gggl.AdvertInfo;
import com.kingdee.eas.custom.gggl.Hyhelper;
import com.kingdee.eas.custom.gggl.SaleContractInfo;
import com.kingdee.eas.util.SysUtil;
import com.kingdee.eas.util.client.MsgBox;
import com.kingdee.eas.xr.helper.DateDaySub;

public class OtherBillEditUIPIEx extends  OtherBillEditUI{

	public OtherBillEditUIPIEx() throws Exception {
		super();
	}
	protected void verifyInput(ActionEvent e) throws Exception {
		// TODO Auto-generated method stub
		super.verifyInput(e);
	
	}
	public void actionSubmit_actionPerformed(ActionEvent arg0) throws Exception {
		// TODO Auto-generated method stub
	  if(this.editData.get("saleContract")!=null&&this.editData.getBoolean("isTk")){
		  SaleContractInfo  saleInfo=   (SaleContractInfo) this.editData.get("saleContract");
		  Date nowDate=new Date();
			for(int i=0;i<kdtEntry.getRowCount();i++){
				if(kdtEntry.getCell(i, "advert")!=null){
					AdvertInfo info= (AdvertInfo) kdtEntry.getCell(i, "advert").getValue();
					Date endDate=Hyhelper.getEndDate(saleInfo.getId().toString(), info.getId().toString());
					int subMonth=DateDaySub.getSubMonth(nowDate, endDate);
					if(subMonth<12){
						MsgBox.showInfo("广告位："+info.getName()+",租赁截至日期与当前日期相差不大于等于12个月不能退款提交！");
		    			SysUtil.abort();
					}
					
				}
			}
		}
		super.actionSubmit_actionPerformed(arg0);
	}

}
