zthwr 10 місяців тому
батько
коміт
7a68dcb7a5

+ 532 - 0
mmpac/so/src/client/nc/ui/so/so002/FtCountDLG.java

@@ -0,0 +1,532 @@
+package nc.ui.so.so002;
+import nc.ui.pub.beans.UIDialog;
+import nc.ui.pub.beans.UIPanel;
+import nc.ui.pub.beans.UISplitPane;
+import nc.ui.pub.bill.BillCardPanel;
+import nc.ui.pub.bill.BillEditEvent;
+import nc.ui.pub.bill.BillEditListener;
+import nc.ui.pub.bill.BillEditListener2;
+import nc.ui.uif2.model.AbstractAppModel;
+import nc.vo.pub.lang.UFDouble;
+import nc.vo.so.so002.SaleVO;
+import nc.vo.so.so002.SaleinvoiceBVO;
+import nc.vo.so.so002.SaleinvoiceVO;
+import nc.ui.erm.costshare.common.CommonConfirmDialogUtils;
+import nc.ui.ml.NCLangRes;
+import nc.ui.pub.ClientEnvironment;
+import nc.ui.pub.beans.UIButton;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.ValidationException;
+import nc.ui.pub.beans.MessageDialog;
+/**
+ * 分摊界面
+ *@Description: TODO
+ *@Author: ZTH
+ *@Date:2023年12月29日 上午9:46:15
+ *@Version: V1.0
+ */
+
+@SuppressWarnings("deprecation")
+public class FtCountDLG extends UIDialog implements BillEditListener {
+
+	/**
+	 * 金额分摊
+	 */
+	private static final long serialVersionUID = -2624122850765833692L;
+	/** 确定按钮 */
+	private UIButton btnOK;
+	/** 取消按钮 */
+	private UIButton btnNO;
+	/**增行按钮*/
+	private UIButton btnAdd;
+	/**重新排号*/
+	private UIButton btnRrn;
+	/**删行按钮*/
+	private UIButton btnDel;
+	private BillCardPanel jlcardPanel;
+	private SaleInvoiceCardPanel ivjBillCardPanel;//销售发票界面
+	private ActionHandler actionHandler = new ActionHandler();
+	private UIPanel ivjUIPanel0 = null;
+	private UIPanel ivjUIPane2 = null;
+	private UIPanel btnUIPanel;
+	private UISplitPane splitPane;
+	private ClientEnvironment ce = ClientEnvironment.getInstance();
+	
+	private UIButton getBtnOK() {
+		if (btnOK == null) {
+			btnOK = new UIButton();
+			btnOK.setName("btnOK");
+			btnOK.setText("确定(Y)");
+		}
+		return this.btnOK;
+	}
+
+	private UIButton getBtnNO() {
+		if (btnNO == null) {
+			btnNO = new UIButton();
+			btnNO.setName("btnON");
+			btnNO.setText("取消(C)");
+		}
+		return this.btnNO;
+	}
+	
+	
+	private UIButton  getBtnDelLine(){
+		if (btnDel == null) {
+			btnDel = new UIButton();
+			btnDel.setName("btnDel");
+			btnDel.setText("删行");
+		}
+		return this.btnDel;
+	}
+	
+	private UIButton  getBtnAddLine(){
+		if (btnAdd == null) {
+			btnAdd = new UIButton();
+			btnAdd.setName("btnAdd");
+			btnAdd.setText("增行");
+		}
+		return this.btnAdd;
+	}
+	
+	private UIButton  getBtnRrnLine(){
+		if (btnRrn == null) {
+			btnRrn = new UIButton();
+			btnRrn.setName("btnRrn");
+			btnRrn.setText("重新排号");
+		}
+		return this.btnRrn;
+	}
+	
+    public FtCountDLG(){
+		
+		super();
+		initialize();
+		
+	}
+    
+    
+    public FtCountDLG(SaleInvoiceCardPanel ivjBillCardPanel){
+		super();
+		this.ivjBillCardPanel=ivjBillCardPanel;
+		initialize();
+		try {
+			doAction();
+		} catch (BusinessException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+    
+    
+	/**
+	 * 初始化
+	 */
+	private void initialize() {	
+		setLayout(new BorderLayout());
+		this.setBounds(200, 150, 650, 350);
+		this.setTitle("分摊界面");
+		this.setResizable(true);
+		add(getUIPanel0(), BorderLayout.NORTH);
+		add(getUIPane(), BorderLayout.CENTER);
+		add(this.getBtnUIPanel(), BorderLayout.SOUTH);
+		// 添加监听
+		this.addActionListener();
+		
+		
+		
+	}
+	
+	
+	/**
+	 * 界面的监听
+	 */
+	private void addActionListener() {
+		// TODO Auto-generated method stub
+//	    this.getBtnAddLine().addActionListener(this.actionHandler);
+		this.getBtnOK().addActionListener(this.actionHandler);
+		this.getBtnNO().addActionListener(this.actionHandler);
+//		this.getBtnDelLine().addActionListener(this.actionHandler);
+//		this.getBtnRrnLine().addActionListener(this.actionHandler);
+		this.getBillCardPanel().addEditListener(this);//编辑后监听
+//		this.getBillCardPanel().addBodyEditListener2(this);//编辑前监听
+	}
+	
+	private UIPanel getUIPanel0() {
+		if (ivjUIPanel0 == null) {
+			try {
+				ivjUIPanel0 = new UIPanel();
+				ivjUIPanel0.setLayout(new FlowLayout(FlowLayout.LEFT));
+//				ivjUIPanel0.add(getTypeLabel());
+//				ivjUIPanel0.add(getTypePanel());
+//				ivjUIPanel0.add(getBtnAddLine());
+//				ivjUIPanel0.add(getBtnDelLine());
+//				ivjUIPanel0.add(getBtnRrnLine());
+			} catch (Throwable ivjExc) {
+			
+			}
+		}
+		return this.ivjUIPanel0;
+	}
+	
+
+	
+	private UIPanel getUIPane() {
+		if (ivjUIPane2 == null) {
+			ivjUIPane2 = new UIPanel();
+			ivjUIPane2.setLayout(new BorderLayout());
+			ivjUIPane2.setPreferredSize(new Dimension(0, 500));
+			// ivjUIPanel2.add(getTablePanel(), BorderLayout.CENTER);
+			ivjUIPane2.add(getUISplitPane(), BorderLayout.CENTER);
+		}
+		return this.ivjUIPane2;
+	}
+	
+	public UISplitPane getUISplitPane() {
+		if (splitPane == null) {
+			splitPane = new UISplitPane(UISplitPane.VERTICAL_SPLIT);
+			splitPane.setTopComponent(getBillCardPanel());
+			// splitPane.setDividerLocation(80);//上间距
+			splitPane.setOneTouchExpandable(true);
+			splitPane.setDividerSize(3);
+		}
+		return this.splitPane;
+	}
+	
+	public BillCardPanel getBillCardPanel() {
+		if (jlcardPanel == null) {
+			jlcardPanel = new BillCardPanel();
+			jlcardPanel.setName("jlcardPanel");
+			jlcardPanel.loadTemplet("FT99", null,ce.getUser().getPrimaryKey(),ce.getCorporation().getPrimaryKey());
+	//		billListPanel.setTatolRowShow(true);  //合计
+		}
+		return this.jlcardPanel;
+	}
+	
+
+	@Override
+	public void afterEdit(BillEditEvent arg0) {
+		//手工填的数量不可以大于合计数量
+		if("ftnum".equals(arg0.getKey())) {
+			int row=arg0.getRow();
+			UFDouble ftnum=new UFDouble(arg0.getValue().toString());//手工填的数量
+			UFDouble totalnum = new UFDouble(this.getBillCardPanel().getBodyValueAt(row, "totalnum").toString()) ;  //合计数量
+			
+			if(ftnum.compareTo(totalnum)>0) {
+				 MessageDialog.showErrorDlg(this.jlcardPanel, null, "分摊数量不可以大于合计数量!");
+				 this.getBillCardPanel().setBodyValueAt(null, row, "ftnum");
+				 return;
+				
+			}
+			
+		}
+		
+	}
+
+	@Override
+	public void bodyRowChange(BillEditEvent arg0) {
+		// TODO Auto-generated method stub
+		
+	}
+	
+	public UIPanel getBtnUIPanel() {
+		if (btnUIPanel == null) {
+			btnUIPanel = new nc.ui.pub.beans.UIPanel();
+			btnUIPanel.add(this.getBtnOK(), this.getBtnOK().getName());
+			btnUIPanel.add(this.getBtnNO(), this.getBtnNO().getName());
+		}
+		return this.btnUIPanel;
+	}
+	
+	class ActionHandler implements ActionListener {
+		public void actionPerformed(ActionEvent e) {
+			   // 确定按钮执行事件
+			if (e.getSource() == FtCountDLG.this.getBtnOK()) {
+				
+				FtCountDLG.this.doOKAction();
+			}
+			   // 取消按钮执行事件
+			if (e.getSource() == FtCountDLG.this.getBtnNO()) {
+				
+				FtCountDLG.this.doNOAction();
+			}
+			   // 增行按钮执行事件
+			if (e.getSource() == FtCountDLG.this.getBtnAddLine()) {
+				
+				FtCountDLG.this.doAddAction();
+			}
+			
+			   // 删行按钮执行事件
+			if (e.getSource() == FtCountDLG.this.getBtnDelLine()) {
+				
+				FtCountDLG.this.doDelAction();
+			}
+			
+			
+			   // 重新排号按钮执行事件
+			if (e.getSource() == FtCountDLG.this.getBtnRrnLine()) {
+				
+				FtCountDLG.this.doRrnAction();
+			}
+			
+
+		}
+	}
+	
+	
+    public void  doDelAction() {
+  //  	MessageDialog.showHintDlg(null, "提示", "删行啦!!!!!!!!");
+    	// 获取选取的行号
+		int[] selectedRowNo = this.jlcardPanel.getBillTable()
+				.getSelectedRows();
+		if (null == selectedRowNo || selectedRowNo.length < 1) {
+			String message =
+	    	          nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4012003_0",
+	    	              "04012003-0003")/* @res "请选择要删除的材料行" */;
+	    	      MessageDialog.showErrorDlg(this.jlcardPanel, null, message);
+		}
+    
+    	
+    	this.jlcardPanel.getBillModel().delLine(selectedRowNo);
+    	
+    }
+	
+	
+	
+	
+    public void doAddAction() {
+    		
+      this.jlcardPanel.getBillModel().addLine();
+      int rowcount =  this.jlcardPanel .getBillModel().getRowCount();
+      for (int i = 0; i <rowcount; i++) {
+    	  this.jlcardPanel.setBodyValueAt("" + (i * 10 + 10), i, "row"); 
+      }
+      
+	}
+	
+	
+	public void doRrnAction() {
+	  int rowcount = this.jlcardPanel.getBillModel().getRowCount();
+      for (int i = 0; i < rowcount; i++) {
+         this.jlcardPanel.setBodyValueAt("" + (i * 10 + 10), i,"row");
+       }
+		
+	}
+    
+	public void doNOAction() {
+		if (UIDialog.ID_YES == CommonConfirmDialogUtils
+				.showConfirmCancelDialog(ivjBillCardPanel)){
+			
+			this.dispose();
+			
+		}
+	}
+		
+	
+	public void doOKAction() {
+		
+	  try {
+		  getBillCardPanel().dataNotNullValidate();//非空校验
+		} catch (ValidationException e) {
+			// TODO 自动生成的 catch 块
+			e.printStackTrace();
+			String msg="nc.vo.pub.NullFieldException:";
+//			ShowStatusBarMsgUtil.showErrorMsgWithClear("提示", e.toString().substring(
+//					e.toString().indexOf(msg)+msg.length()), ivjBillCardPanel);
+			MessageDialog.showErrorDlg(jlcardPanel, "错误", e.toString().substring(
+					e.toString().indexOf(msg)+msg.length()));
+		    return;
+		}
+	  
+	  //修改销售发票明细的数量
+	  setReturnParam();
+	  
+	  this.dispose();
+	  
+	}
+	
+	
+	//根据开票类型合计数量
+	
+	public void doAction() throws BusinessException{
+		Map<String,UFDouble> mapkplx=new HashMap<String,UFDouble>();//主数量
+		Map<String,UFDouble> mapkplx2=new HashMap<String,UFDouble>();//辅数量
+		for (int i =0;i<this.ivjBillCardPanel.getBillModel().getRowCount(); i++) {
+//			this.getBillCardPanel().addLine();
+//			int rowcount = this.getBillCardPanel().getBillModel().getRowCount();
+//			this.getBillCardPanel().setBodyValueAt(10*(i+1)+"", rowcount - 1, "row");
+			String vdef15 = (String) this.ivjBillCardPanel.getBodyValueAt(i, "vdef15");//开票类型
+//			this.getBillCardPanel().setBodyValueAt(vdef15, rowcount - 1, "fttype");
+			Object nnumberobj = this.ivjBillCardPanel.getBodyValueAt(i, "nnumber");//主数量
+			Object npacknumberobj =  this.ivjBillCardPanel.getBodyValueAt(i, "npacknumber");//辅数量
+			Object scalefactor=  this.ivjBillCardPanel.getBodyValueAt(i, "scalefactor");//换算率
+//			this.getBillCardPanel().setBodyValueAt(nnumber, rowcount - 1, "totalnum");
+			
+			if(null==mapkplx.get(vdef15)) {
+				mapkplx.put(vdef15, new UFDouble(nnumberobj.toString()));
+			}else {
+				UFDouble newsl=mapkplx.get(vdef15).add(new UFDouble(nnumberobj.toString()));
+				mapkplx.put(vdef15, newsl);
+			}
+			
+			if(null!=npacknumberobj) {
+				if(null==mapkplx2.get(vdef15)) {
+					mapkplx2.put(vdef15, new UFDouble(npacknumberobj.toString()));
+				}else {
+					UFDouble newsl=mapkplx2.get(vdef15).add(new UFDouble(npacknumberobj.toString()));
+					mapkplx2.put(vdef15, newsl);
+				}
+			}
+			
+		}
+		
+		 int i=0;
+		 for (Map.Entry<String,UFDouble> entry : mapkplx.entrySet()) {
+			 this.getBillCardPanel().addLine();
+			 int rowcount = this.getBillCardPanel().getBillModel().getRowCount();
+			 this.getBillCardPanel().setBodyValueAt(10*(i+1)+"", rowcount - 1, "row"); 
+			 this.getBillCardPanel().setBodyValueAt(entry.getKey(), rowcount - 1, "fttype");//开票类型
+			 this.getBillCardPanel().setBodyValueAt(entry.getValue(), rowcount - 1, "totalnum");//合计数量
+			 i+=1;
+		 }
+		
+		
+	}
+	
+	
+	//修改销售发票明细的数量,set金额
+	
+	public void setReturnParam() {
+		Map<String,UFDouble> mapcount=new HashMap<String,UFDouble>();//记录每个开票类型数量合计,用于分摊金额
+		Map<String,UFDouble> mapamount=new HashMap<String,UFDouble>();//记录每个开票类型含税金额
+		for (int i =0;i<this.jlcardPanel.getBillModel().getRowCount(); i++) {
+		//	MessageDialog.showHintDlg(jlcardPanel, "测",this.jlcardPanel.getBillModel().getRowCount()+"" );
+			String fttype=(String) this.jlcardPanel.getBodyValueAt(i, "fttype");//开票类型
+			UFDouble amount=(UFDouble) this.jlcardPanel.getBodyValueAt(i, "amount");//客户手工填的【含税金额】
+			UFDouble ftnum=(UFDouble) this.jlcardPanel.getBodyValueAt(i, "ftnum");//客户手工填的【分摊数量】
+//			UFDouble count=UFDouble.ZERO_DBL;
+			mapamount.put(fttype, amount);
+			mapcount.put(fttype, ftnum);
+			//销售发票列循环
+			for (int j =0;j<this.ivjBillCardPanel.getBillModel().getRowCount(); j++) {
+				String vdef15 = (String) this.ivjBillCardPanel.getBodyValueAt(j, "vdef15");//开票类型
+				Object nnumberobj = this.ivjBillCardPanel.getBodyValueAt(j, "nnumber");//主数量
+				
+				UFDouble  nnumber=new UFDouble(nnumberobj.toString());//销售发票主数量
+				
+				//同开票类型
+				if(fttype.equals(vdef15)) {
+					//手工填的计算后的数量小于销售发票的数量,数量改成手工计算后的数量
+					if(ftnum.sub(nnumber).compareTo(UFDouble.ZERO_DBL)<0) {
+						this.ivjBillCardPanel.setBodyValueAt(ftnum, j, "nnumber");
+						//说明分摊完了还有同开票类型的,就删除这条数据
+						if(ftnum.compareTo(UFDouble.ZERO_DBL)==0) {
+							int[] selectedRowNo = {j};
+							this.ivjBillCardPanel.getBillModel().delLine(selectedRowNo);
+						}else {
+							//count.add(ftnum);
+						}
+						ftnum=UFDouble.ZERO_DBL;
+					}else {
+						//手工填的大于了销售发票明细的数量,就不用改数量,扣减掉明细数量
+						ftnum=ftnum.sub(nnumber);
+						//count.add(nnumber);
+					}
+				}
+				
+			}
+		//	mapcount.put(fttype, count);
+		}
+		
+		
+		
+		//含税金额分摊计算
+		
+//		MessageDialog.showHintDlg(ivjBillCardPanel, "测",this.ivjBillCardPanel.getBillModel().getRowCount()+"" );
+		//数量分摊后的销售发票明细数据
+		for (int j =0;j<this.ivjBillCardPanel.getBillModel().getRowCount(); j++) {
+			String vdef15 = (String) this.ivjBillCardPanel.getBodyValueAt(j, "vdef15");//开票类型
+			Object nnumberobj = this.ivjBillCardPanel.getBodyValueAt(j, "nnumber");//主数量
+			UFDouble nnumber=new UFDouble(nnumberobj.toString());
+			UFDouble sumcount=mapcount.get(vdef15);//合计数量
+			UFDouble summount=mapamount.get(vdef15);//含税金额
+			UFDouble bcje=summount.multiply(new UFDouble(nnumberobj.toString()).div(sumcount));//行预分摊含税金额
+//			this.ivjBillCardPanel.setBodyValueAt(bcje, j, "noriginalcursummny");//原币价税合计	
+//			this.ivjBillCardPanel.setBodyValueAt(bcje, j, "nsummny");//本币价税合计
+//			this.ivjBillCardPanel.setBodyValueAt(bcje, j, "nsubsummny");//冲减前原币金额
+//			this.ivjBillCardPanel.setBodyValueAt(bcje, j, "nsubcursummny");//冲减前本币金额
+			
+			//含税单价=行预分摊含税金额/主数量
+			UFDouble ntaxprice=bcje.div(nnumber).setScale(2, UFDouble.ROUND_HALF_UP);
+			this.ivjBillCardPanel.setBodyValueAt(ntaxprice, j, "ntaxprice");//本币含税单价
+			this.ivjBillCardPanel.setBodyValueAt(ntaxprice, j, "noriginalcurtaxprice");//原币含税单价
+			
+			this.ivjBillCardPanel.setBodyValueAt(ntaxprice, j, "nquoteoriginalcurtaxprice");//报价单位原币含税单价 
+			this.ivjBillCardPanel.setBodyValueAt(ntaxprice, j, "nquotetaxprice");//报价单位本币含税单价
+			this.ivjBillCardPanel.setBodyValueAt(ntaxprice, j, "noriginalcurtaxnetprice");//原币含税净价
+			this.ivjBillCardPanel.setBodyValueAt(ntaxprice, j, "ntaxnetprice");//本币含税净价
+			this.ivjBillCardPanel.setBodyValueAt(ntaxprice, j, "nquotetaxnetprice");//报价单位本币含税净价 
+			this.ivjBillCardPanel.setBodyValueAt(ntaxprice, j, "nquoteoriginalcurtaxnetprice");//报价单位原币含税净价
+			this.ivjBillCardPanel.setBodyValueAt(ntaxprice, j, "nsubquotetaxprice");//冲减前报价单位本币含税单价
+			this.ivjBillCardPanel.setBodyValueAt(ntaxprice, j, "nsubquotetaxnetprice");//冲减前报价单位本币含税净价
+			this.ivjBillCardPanel.setBodyValueAt(ntaxprice, j, "nsubtaxnetprice");//冲减前主计量单位本币含税净价
+			
+			//不含税单价=含税单价/(1+13%)
+			UFDouble wsmny=ntaxprice.div(new UFDouble("1.13")).setScale(2, UFDouble.ROUND_HALF_UP);
+			this.ivjBillCardPanel.setBodyValueAt(wsmny, j, "nprice");//本币无税单价
+			this.ivjBillCardPanel.setBodyValueAt(wsmny, j, "noriginalcurprice");//原币无税单价
+			this.ivjBillCardPanel.setBodyValueAt(wsmny, j, "nquoteoriginalcurprice");//报价单位原币无税单价 
+			this.ivjBillCardPanel.setBodyValueAt(wsmny, j, "nquoteprice");//报价单位本币无税单价  
+			this.ivjBillCardPanel.setBodyValueAt(wsmny, j, "nnetprice");//本币无税净价
+			this.ivjBillCardPanel.setBodyValueAt(wsmny, j, "nquoteoriginalcurnetprice");//报价单位原币无税净价
+			this.ivjBillCardPanel.setBodyValueAt(wsmny, j, "nquotenetprice");//报价单位本币无税净价
+			this.ivjBillCardPanel.setBodyValueAt(wsmny, j, "noriginalcurnetprice");//原币无税净价
+			this.ivjBillCardPanel.setBodyValueAt(wsmny, j, "nquotenetprice");//报价单位本币无税净价
+			this.ivjBillCardPanel.setBodyValueAt(wsmny, j, "nquoteprice");//报价单位本币无税单价
+			this.ivjBillCardPanel.setBodyValueAt(wsmny, j, "nsubquoteprice");//冲减前报价单位本币无税单价
+			this.ivjBillCardPanel.setBodyValueAt(wsmny, j, "nsubquotenetprice");//冲减前报价单位本币无税净价
+
+			
+			UFDouble noriginalcursummny=ntaxprice.multiply(nnumber).setScale(2, UFDouble.ROUND_HALF_UP);
+			
+			this.ivjBillCardPanel.setBodyValueAt(noriginalcursummny, j, "noriginalcursummny");//原币价税合计	
+			this.ivjBillCardPanel.setBodyValueAt(noriginalcursummny, j, "nsummny");//本币价税合计			
+			this.ivjBillCardPanel.setBodyValueAt(noriginalcursummny, j, "nsubsummny");//冲减前原币金额
+			this.ivjBillCardPanel.setBodyValueAt(noriginalcursummny, j, "nsubcursummny");//冲减前本币金额
+			
+			UFDouble wsje= ntaxprice.div(new UFDouble("1.13")).multiply(nnumber).setScale(2, UFDouble.ROUND_HALF_UP);
+			this.ivjBillCardPanel.setBodyValueAt(wsje.setScale(2, UFDouble.ROUND_HALF_UP), j, "noriginalcurmny");//原币无税金额
+			this.ivjBillCardPanel.setBodyValueAt(wsje.setScale(2, UFDouble.ROUND_HALF_UP), j, "nmny");//本币无税金额
+			
+			//税额=价税合计-无税金额(不含税单价*数量)
+			UFDouble se=noriginalcursummny.sub(wsje.setScale(2, UFDouble.ROUND_HALF_UP));
+			this.ivjBillCardPanel.setBodyValueAt(se, j, "noriginalcurtaxmny");//原币税额
+			this.ivjBillCardPanel.setBodyValueAt(se, j, "ntaxmny");//本币税额
+
+			
+			
+			
+		}
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	}
+	
+
+	
+}

+ 312 - 0
mmpac/so/src/client/nc/ui/so/so002/SaleInvoiceBtn.java

@@ -0,0 +1,312 @@
+package nc.ui.so.so002;
+
+import nc.ui.pub.ButtonObject;
+import nc.ui.pub.pf.PfUtilClient;
+import nc.ui.scm.pub.bill.ButtonTree;
+import nc.ui.scm.pub.bill.ScmButtonConst;
+import nc.vo.pub.BusinessException;
+import nc.vo.scm.pub.SCMEnv;
+
+public class SaleInvoiceBtn {
+	public final String BTN_ATP = "可用量";
+	public final String BTN_CUSTINFO = "客户信息";
+	public final String BTN_CUSTCREDIT = "客户信用";
+	public final String BTN_PRIFIT = "毛利预估";
+	public final String BTN_SoTax = "传金税";
+	public final String BTN_UniteInvoice = "合并开票";
+	public final String BTN_UniteCancel = "放弃合并";
+	public final String BTN_Gathe = "出库汇总开票";
+	public final String BTN_ExecRpt = "发票执行情况";
+	public final String BTN_AuditFlowStatus = "审批流状态";
+	public final String BTN_OpposeAct = "生成对冲发票";
+	public final String BTN_RefAdd = "参照增行";
+	public final String BTN_FetchCost = "取成本价";
+	public final String BTN_CardEdit = "卡片编辑";
+	public final String BTN_ReRowNO = "重排行号";
+	public final String BTN_ImportTaxCode = "导入税票号";
+	public final String BTN_ToEinv = "申请开票";
+	private ButtonTree bt = null;
+	public ButtonObject m_boBusiType = null;
+	public ButtonObject m_boAdd = null;
+	public ButtonObject m_boSave = null;
+	public ButtonObject m_boMaintain = null;
+	public ButtonObject m_boModify = null;
+	public ButtonObject m_boCancel = null;
+	public ButtonObject m_boBlankOut = null;
+	public ButtonObject m_boCancelTransfer = null;
+	public ButtonObject m_boUnite = null;
+	public ButtonObject m_boUniteCancel = null;
+	public ButtonObject m_boLineOper = null;
+	public ButtonObject m_boAddLine = null;
+	public ButtonObject m_boDelLine = null;
+	public ButtonObject m_boInsertLine = null;
+	public ButtonObject m_boCopyLine = null;
+	public ButtonObject m_boPasteLine = null;
+	public ButtonObject m_boPasteLineTail = null;
+	public ButtonObject m_boCardEdit = null;
+	public ButtonObject m_boReRowNO = null;
+	public ButtonObject m_boRefAdd = null;
+	public ButtonObject m_boFetchCost = null;
+	public ButtonObject m_boApprove = null;
+	public ButtonObject m_boAction = null;
+	public ButtonObject m_boSendAudit = null;
+	public ButtonObject m_boTakeBack = null;
+	public ButtonObject m_boUnApprove = null;
+	public ButtonObject m_boQuery = null;
+	public ButtonObject m_boBrowse = null;
+	public ButtonObject m_boRefresh = null;
+	public ButtonObject m_boLocal = null;
+	public ButtonObject m_boFirst = null;
+	public ButtonObject m_boPrev = null;
+	public ButtonObject m_boNext = null;
+	public ButtonObject m_boLast = null;
+	public ButtonObject m_boSelectAll = null;
+	public ButtonObject m_boUnSelectAll = null;
+	public ButtonObject m_boCard = null;
+	public ButtonObject m_boPrintManage = null;
+	public ButtonObject m_boPreview = null;
+	public ButtonObject m_boPrint = null;
+	public ButtonObject m_boBillCombin = null;
+	public ButtonObject m_boGather = null;
+	public ButtonObject m_boAssistFunction = null;
+	public ButtonObject m_boOpposeAct = null;
+	public ButtonObject m_boSoTax = null;
+	public ButtonObject m_boDocument = null;
+	public ButtonObject m_boImportTaxCode = null;
+	public ButtonObject m_boToEinv = null;
+	public ButtonObject m_boAssistant = null;
+	public ButtonObject m_boOrderQuery = null;
+	public ButtonObject m_boATP = null;
+	public ButtonObject m_boAuditFlowStatus = null;
+	public ButtonObject m_boCustInfo = null;
+	public ButtonObject m_boExecRpt = null;
+	public ButtonObject m_boCustCredit = null;
+	public ButtonObject m_boPrifit = null;
+	private ButtonObject[] aryButtonGroup = null;
+	
+	 public ButtonObject m_bocount = null ;//分摊按钮
+	
+
+	public String getBusiType() {
+		if (null != this.m_boBusiType.getChildButtonGroup() && this.m_boBusiType.getChildButtonGroup().length > 0) {
+			ButtonObject[] var1 = this.m_boBusiType.getChildButtonGroup();
+			int var2 = var1.length;
+
+			for (int var3 = 0; var3 < var2; ++var3) {
+				ButtonObject chidbtn = var1[var3];
+				if (chidbtn.isSelected()) {
+					return chidbtn.getTag();
+				}
+			}
+
+			return this.m_boBusiType.getChildButtonGroup()[0].getTag();
+		} else {
+			return null;
+		}
+	}
+
+	public ButtonObject[] getButtonArray() {
+		return this.aryButtonGroup;
+	}
+
+	public void setStateByBillStatus(SaleInvoiceListPanel listPanel) {
+		int iState = listPanel.getBillStatus();
+		switch (iState) {
+			case 1 :
+				this.m_boBlankOut.setEnabled(true);
+				this.m_boModify.setEnabled(true);
+				this.m_boApprove.setEnabled(true);
+				this.m_boUnApprove.setEnabled(false);
+				this.m_boDocument.setEnabled(true);
+				this.m_boOrderQuery.setEnabled(true);
+				this.m_boOrderQuery.setEnabled(true);
+				break;
+			case 2 :
+				this.m_boBlankOut.setEnabled(false);
+				this.m_boApprove.setEnabled(false);
+				this.m_boUnApprove.setEnabled(true);
+				this.m_boModify.setEnabled(false);
+				this.m_boDocument.setEnabled(true);
+				this.m_boOrderQuery.setEnabled(true);
+				this.m_boOrderQuery.setEnabled(false);
+			case 3 :
+			case 4 :
+			case 6 :
+			default :
+				break;
+			case 5 :
+				this.m_boModify.setEnabled(false);
+				this.m_boAction.setEnabled(false);
+				this.m_boAssistant.setEnabled(false);
+				this.m_boPrint.setEnabled(false);
+				this.m_boDocument.setEnabled(false);
+				this.m_boOrderQuery.setEnabled(false);
+				this.m_boOrderQuery.setEnabled(false);
+				this.m_boPreview.setEnabled(false);
+				this.m_boAuditFlowStatus.setEnabled(false);
+				break;
+			case 7 :
+				this.m_boBlankOut.setEnabled(false);
+				this.m_boApprove.setEnabled(true);
+				this.m_boUnApprove.setEnabled(false);
+				this.m_boSave.setEnabled(false);
+				this.m_boModify.setEnabled(false);
+				break;
+			case 8 :
+				this.m_boBlankOut.setEnabled(true);
+				this.m_boModify.setEnabled(true);
+				this.m_boSave.setEnabled(false);
+				this.m_boCancel.setEnabled(false);
+				this.m_boApprove.setEnabled(true);
+				this.m_boUnApprove.setEnabled(false);
+				this.m_boDocument.setEnabled(true);
+				this.m_boOrderQuery.setEnabled(true);
+				this.m_boOrderQuery.setEnabled(true);
+		}
+
+		int selectRow = listPanel.getHeadTable().getSelectedRow();
+		int iOppStatus = 0;
+		if (selectRow > -1 && listPanel.getHeadItem("fcounteractflag") != null
+				&& listPanel.getHeadBillModel().getValueAt(selectRow, "fcounteractflag") != null
+				&& listPanel.getHeadItem("fcounteractflag")
+						.converType(listPanel.getHeadBillModel().getValueAt(selectRow, "fcounteractflag")) != null) {
+			iOppStatus = Integer.parseInt(listPanel.getHeadItem("fcounteractflag")
+					.converType(listPanel.getHeadBillModel().getValueAt(selectRow, "fcounteractflag")).toString());
+		}
+
+		if (iState == 2 && iOppStatus == 1) {
+			this.m_boUnApprove.setEnabled(false);
+		}
+
+		if (iState == 2 && iOppStatus == 0) {
+			this.m_boOpposeAct.setEnabled(true);
+		} else {
+			this.m_boOpposeAct.setEnabled(false);
+		}
+
+	}
+
+	public SaleInvoiceBtn() {
+		try {
+			this.bt = new ButtonTree(SaleInvoiceTools.getNodeCode());
+		} catch (BusinessException var7) {
+			SCMEnv.out(var7);
+			return;
+		}
+
+		this.m_boBusiType = this.bt.getButton("业务类型");
+		this.m_boAdd = this.bt.getButton("增加");
+		this.m_bocount= this.bt.getButton("分摊");
+		PfUtilClient.retBusiAddBtn(this.m_boBusiType, this.m_boAdd, SaleInvoiceTools.getLoginPk_Corp(), "32");
+		ButtonObject[] busitypebtns = this.m_boBusiType.getChildButtonGroup();
+		if (null != busitypebtns && busitypebtns.length > 0) {
+			busitypebtns[0].setSelected(true);
+		}
+
+		this.m_boBusiType.setCheckboxGroup(true);
+		this.m_boRefAdd = this.bt.getButton("参照增行");
+		this.m_boRefAdd.removeAllChildren();
+		ButtonObject[] var2 = this.m_boAdd.getChildButtonGroup();
+		int var3 = var2.length;
+
+		for (int var4 = 0; var4 < var3; ++var4) {
+			ButtonObject childbtn = var2[var4];
+			ButtonObject newbtn = new ButtonObject(childbtn.getName(), childbtn.getHint(), childbtn.getCode());
+			newbtn.setTag(childbtn.getTag());
+			newbtn.setPowerContrl(false);
+			this.m_boRefAdd.addChildButton(newbtn);
+		}
+
+		this.m_boFetchCost = this.bt.getButton("取成本价");
+		this.m_boSave = this.bt.getButton("保存");
+		this.m_boMaintain = this.bt.getButton("维护");
+		this.m_boModify = this.bt.getButton("修改");
+//		this.m_bocount = this.bt.getButton(ScmButtonConst.BTN_COUNT);//add by ZTH
+		this.m_boCancel = this.bt.getButton("取消");
+		this.m_boBlankOut = this.bt.getButton("删除");
+		this.m_boCancelTransfer = this.bt.getButton("放弃转单");
+		this.m_boUnite = this.bt.getButton("合并开票");
+		this.m_boUniteCancel = this.bt.getButton("放弃合并");
+		this.m_boLineOper = this.bt.getButton("行操作");
+		this.m_boAddLine = this.bt.getButton("增行");
+		this.m_boDelLine = this.bt.getButton("删行");
+		this.m_boInsertLine = this.bt.getButton("插入行");
+		this.m_boCopyLine = this.bt.getButton("复制行");
+		this.m_boPasteLine = this.bt.getButton("粘贴行");
+		this.m_boPasteLineTail = this.bt.getButton("粘贴行到表尾");
+		this.m_boCardEdit = this.bt.getButton("卡片编辑");
+		this.m_boReRowNO = this.bt.getButton("重排行号");
+		this.m_boApprove = this.bt.getButton("审核");
+		this.m_boAction = this.bt.getButton("执行");
+		this.m_boSendAudit = this.bt.getButton("送审");
+		this.m_boTakeBack = this.bt.getButton("收回");
+		this.m_boUnApprove = this.bt.getButton("弃审");
+		this.m_boQuery = this.bt.getButton("查询");
+//		this.m_bocount = this.bt.getButton("分摊2");
+		this.m_boBrowse = this.bt.getButton("浏览");
+		this.m_boRefresh = this.bt.getButton("刷新");
+		this.m_boLocal = this.bt.getButton("定位");
+		this.m_boFirst = this.bt.getButton("首页");
+		this.m_boPrev = this.bt.getButton("上页");
+		this.m_boNext = this.bt.getButton("下页");
+		this.m_boLast = this.bt.getButton("末页");
+		this.m_boSelectAll = this.bt.getButton("全选");
+		this.m_boUnSelectAll = this.bt.getButton("全消");
+		this.m_boCard = this.bt.getButton("卡片显示/列表显示");
+		this.m_boPrintManage = this.bt.getButton("打印管理");
+		this.m_boPreview = this.bt.getButton("预览");
+		this.m_boPrint = this.bt.getButton("打印");
+		this.m_boBillCombin = this.bt.getButton("合并显示");
+		this.m_boGather = this.bt.getButton("出库汇总开票");
+		this.m_boAssistFunction = this.bt.getButton("辅助功能");
+		this.m_boOpposeAct = this.bt.getButton("生成对冲发票");
+		this.m_boSoTax = this.bt.getButton("传金税");
+		this.m_boDocument = this.bt.getButton("文档管理");
+		this.m_boImportTaxCode = this.bt.getButton("导入税票号");
+		this.m_boToEinv = this.bt.getButton("申请开票");
+		this.m_boAssistant = this.bt.getButton("辅助查询");
+		this.m_boOrderQuery = this.bt.getButton("联查");
+		this.m_boATP = this.bt.getButton("可用量");
+		this.m_boATP.setVisible(false);
+		this.m_boAuditFlowStatus = this.bt.getButton("审批流状态");
+		this.m_boCustInfo = this.bt.getButton("客户信息");
+		this.m_boExecRpt = this.bt.getButton("发票执行情况");
+		this.m_boCustCredit = this.bt.getButton("客户信用");
+		this.m_boPrifit = this.bt.getButton("毛利预估");
+		this.m_boATP.setTag("ATP");
+		this.m_boCustInfo.setTag("CustInfo");
+		this.m_boCustCredit.setTag("CustCredited");
+		this.m_boPrifit.setTag("Prifit");
+		this.m_boSoTax.setTag("SoTax");
+		this.m_boApprove.setTag("APPROVE");
+		this.m_boBlankOut.setTag("SoBlankOut");
+		this.m_boUnApprove.setTag("SoUnApprove");
+		this.m_boUnite.setTag("UNITE");
+		this.m_boUniteCancel.setTag("UNUNITE");
+		this.m_boSendAudit.setTag("SAVE");
+//		this.m_bocount = this.bt.getButton("分摊2");
+		this.aryButtonGroup = this.bt.getButtonArray();
+	}
+
+	public void changeButtonsWhenBusiTypeSelected(ButtonObject bo) {
+		this.m_boBusiType.setTag(bo.getTag());
+		PfUtilClient.retAddBtn(this.m_boAdd, SaleInvoiceTools.getLoginPk_Corp(), "32", bo);
+		PfUtilClient.retAddBtn(this.m_boRefAdd, SaleInvoiceTools.getLoginPk_Corp(), "32", bo);
+		boolean isBizAutoRegister = false;
+
+		try {
+			isBizAutoRegister = SaleinvoiceBO_Client.isBizAutoRegister(this.getBusiType());
+		} catch (Exception var4) {
+			SCMEnv.out(var4);
+		}
+
+		if (isBizAutoRegister) {
+			this.m_boAdd.addChildButton(this.m_boGather);
+		}
+
+	}
+
+	public ButtonObject[] getApproveActionButtonAry() {
+		return new ButtonObject[]{this.m_boDocument, this.m_boAuditFlowStatus, this.m_boApprove, this.m_boOrderQuery};
+	}
+}

+ 3885 - 0
mmpac/so/src/client/nc/ui/so/so002/SaleInvoiceUI.java

@@ -0,0 +1,3885 @@
+package nc.ui.so.so002;
+
+import com.yonyou.einvoice.utils.EinvoiceType;
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.Vector;
+import java.util.Map.Entry;
+import nc.bs.bd.b21.BusinessCurrencyRateUtil;
+import nc.bs.framework.common.NCLocator;
+import nc.itf.scm.so.so002.IEinvService;
+import nc.itf.scm.so.so002.ISaleinvoice;
+import nc.ui.ml.NCLangRes;
+import nc.ui.pf.change.PfUtilUITools;
+import nc.ui.pf.pub.PfUIDataCache;
+import nc.ui.pf.query.ICheckRetVO;
+import nc.ui.pub.ButtonObject;
+import nc.ui.pub.ClientEnvironment;
+import nc.ui.pub.ToftPanel;
+import nc.ui.pub.beans.MessageDialog;
+import nc.ui.pub.beans.UIMenuItem;
+import nc.ui.pub.beans.UIRadioButton;
+import nc.ui.pub.beans.UIRefPane;
+import nc.ui.pub.bill.BillActionListener;
+import nc.ui.pub.bill.BillCardPanel;
+import nc.ui.pub.bill.BillItem;
+import nc.ui.pub.bill.BillMouseEnent;
+import nc.ui.pub.bill.BillTableMouseListener;
+import nc.ui.pub.linkoperate.ILinkAdd;
+import nc.ui.pub.linkoperate.ILinkAddData;
+import nc.ui.pub.linkoperate.ILinkApprove;
+import nc.ui.pub.linkoperate.ILinkApproveData;
+import nc.ui.pub.linkoperate.ILinkMaintain;
+import nc.ui.pub.linkoperate.ILinkMaintainData;
+import nc.ui.pub.linkoperate.ILinkQuery;
+import nc.ui.pub.linkoperate.ILinkQueryData;
+import nc.ui.pub.para.SysInitBO_Client;
+import nc.ui.pub.pf.PfUtilClient;
+import nc.ui.pub.workflownote.FlowStateDlg;
+import nc.ui.scm.file.DocumentManager;
+import nc.ui.scm.goldtax.TransGoldTaxDlg;
+import nc.ui.scm.plugin.InvokeEventProxy;
+import nc.ui.scm.print.BillPrintTool;
+import nc.ui.scm.print.IFreshTsListener;
+import nc.ui.scm.print.PrintLogClient;
+import nc.ui.scm.pub.BillTools;
+import nc.ui.scm.pub.BusiBillManageTool;
+import nc.ui.scm.pub.cache.NormalConditionCache;
+import nc.ui.scm.pub.def.DefSetTool;
+import nc.ui.scm.pub.panel.RelationsCal;
+import nc.ui.scm.pub.panel.SetColor;
+import nc.ui.scm.pub.report.BillRowNo;
+import nc.ui.scm.pub.report.LocateDialog;
+import nc.ui.scm.so.SaleBillType;
+import nc.ui.scm.sourcebill.SourceBillFlowDlg;
+import nc.ui.so.pub.plugin.SOPluginUI;
+import nc.ui.so.so001.SaleOrderBO_Client;
+import nc.ui.so.so002.SaleInvoiceUI;
+import nc.vo.arap.pub.ArapBusinessException;
+import nc.vo.bd.CorpVO;
+import nc.vo.jcom.lang.StringUtil;
+import nc.vo.pub.AggregatedValueObject;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.ValidationException;
+import nc.vo.pub.lang.UFBoolean;
+import nc.vo.pub.lang.UFDateTime;
+import nc.vo.pub.lang.UFDouble;
+import nc.vo.pub.para.SysInitVO;
+import nc.vo.pub.pf.Pfi18nTools;
+import nc.vo.pub.pfflow01.BillbusinessVO;
+import nc.vo.scm.bd.SmartVODataUtils;
+import nc.vo.scm.constant.EditDocBillStatusParamConst;
+import nc.vo.scm.datapower.BtnPowerVO;
+import nc.vo.scm.goldtax.Configuration;
+import nc.vo.scm.goldtax.GoldTaxHeadVO;
+import nc.vo.scm.goldtax.GoldTaxVO;
+import nc.vo.scm.plugin.Action;
+import nc.vo.scm.pu.Timer;
+import nc.vo.scm.pub.SCMEnv;
+import nc.vo.scm.pub.session.ClientLink;
+import nc.vo.scm.pub.smart.ObjectUtils;
+import nc.vo.scm.pub.smart.SmartVO;
+import nc.vo.so.pub.CustCreditVO;
+import nc.vo.so.pub.ExceptionUtils;
+import nc.vo.so.pub.SOCurrencyRateUtil;
+import nc.vo.so.so001.SaleOrderVO;
+import nc.vo.so.so002.SaleVO;
+import nc.vo.so.so002.SaleinvoiceBVO;
+import nc.vo.so.so002.SaleinvoiceDealMnyTools;
+import nc.vo.so.so002.SaleinvoiceSplitTools;
+import nc.vo.so.so002.SaleinvoiceVO;
+import nc.vo.so.so006.ProfitHeaderVO;
+import nc.vo.so.so006.ProfitItemVO;
+import nc.vo.so.so006.ProfitVO;
+import nc.vo.so.so012.EstimateCheckException;
+import u8c.ui.excel.ExcelFileProcess;
+import u8c.ui.pub.page.IPageClientUI;
+import u8c.ui.pub.page.PageQueryClientBO;
+import u8c.ui.scm.pub.procc.IBatchWorker;
+import u8c.ui.scm.pub.procc.ProccDlg;
+import u8c.ui.scm.pub.procc.ShowToolsInThread;
+import u8c.vo.pub.page.QueryPageInfo;
+import u8c.vo.scm.constant.ScmAPIType;
+
+public class SaleInvoiceUI extends ToftPanel
+		implements
+			BillTableMouseListener,
+			ICheckRetVO,
+			ILinkApprove,
+			ILinkQuery,
+			IFreshTsListener,
+			IInvoiceListPanel,
+			IInvoiceCardPanel,
+			ILinkMaintain,
+			ILinkAdd,
+			IBatchWorker,
+			BillActionListener,
+			IPageClientUI {
+	private static final int CardShow = 1;
+	private static final int ListShow = 0;
+	private static final long serialVersionUID = 1L;
+	private SaleInvoiceQueryDlg dlgQuery = null;
+	private boolean existErrRows = false;
+	private boolean isAddLineButn = false;
+	private SaleInvoiceCardPanel ivjBillCardPanel = null;
+	private SaleInvoiceListPanel ivjBillListPanel = null;
+	private boolean m_bEverQuery = false;
+	private boolean m_bInMsgPanel = false;
+	private SaleInvoiceBtn m_buttons = null;
+	private int m_iOperationState = 2;
+	private int m_iShowState = 0;
+	private PrintLogClient m_PrintLogClient = null;
+	private ProccDlg m_proccdlg = null;
+	private SaleInvoiceVOCache m_vocache = new SaleInvoiceVOCache();
+	private InvokeEventProxy pluginproxy = null;
+	private ExcelFileProcess fileProcess;
+	private ClientEnvironment ce = ClientEnvironment.getInstance();
+	SaleInvoiceTools st = null;
+	private BillCardPanel jlcardPanel = null;
+	public SaleInvoiceUI() {
+	}
+	
+
+	public SaleInvoiceUI(String pk_corp, String billType, String businessType, String operator, String billID) {
+		this.initialize();
+		SaleinvoiceVO invoicevo = null;
+
+		try {
+			invoicevo = SaleinvoiceBO_Client.queryBillDataByID(billID);
+		} catch (Exception var8) {
+			SCMEnv.out(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000657") + var8);
+		}
+
+		if (null != invoicevo && null != invoicevo.getHeadVO()) {
+			this.getBillCardPanel().loadCardData(invoicevo);
+			this.setShowState(1);
+			this.setOperationState(2);
+			this.setButtonsStateBrowse();
+			this.getBillCardPanel().setEnabled(false);
+			this.updateUI();
+		} else {
+			MessageDialog.showHintDlg(this, NCLangRes.getInstance().getStrByID("SCMCOMMON", "UPPSCMCommon-000270"),
+					NCLangRes.getInstance().getStrByID("4008bill", "UPP4008bill-000062"));
+		}
+
+	}
+
+	public void addId(List<String> blueids, Map<String, String[]> redmap, SaleVO salevo, List<String> cannotEinvList) {
+		if (salevo.getFcounteractflag() == 0) {
+			blueids.add(salevo.getPrimaryKey());
+		} else if (salevo.getFcounteractflag() == 2 && salevo.getVsrceinvcode() != null) {
+			redmap.put(salevo.getPrimaryKey(),
+					new String[]{salevo.getVsrceinvcode(), salevo.getVsrceinvnumber(), salevo.getVredletterinfo(),
+							salevo.getVredflushcause() == null ? null : salevo.getVredflushcause().toString()});
+		} else {
+			String vbillcode = salevo.getVreceiptcode();
+			if (vbillcode != null && vbillcode.length() != 0) {
+				cannotEinvList.add(vbillcode);
+			}
+		}
+
+	}
+
+	public String checkVO(SaleinvoiceVO aggvo) {
+		if (!aggvo.getHeadVO().getCcurrencyid().equals("00010000000000000001")) {
+			return "单据币种不是人民币,不可以开票!";
+		} else {
+			SaleinvoiceBVO[] var2 = aggvo.getBodyVO();
+			int var3 = var2.length;
+
+			for (int var4 = 0; var4 < var3; ++var4) {
+				SaleinvoiceBVO body = var2[var4];
+				if (body.getPk_taxclass() == null) {
+					return "税收分类不能为空!";
+				}
+			}
+
+			return null;
+		}
+	}
+
+	public void dealResult(SaleVO head, String result) {
+		if ("4".equals(result)) {
+			head.setFeinvstatus(3);
+		} else if ("2".equals(result)) {
+			head.setFeinvstatus(1);
+		} else {
+			this.showErrorMessage("申请开票失败!原因是:" + result);
+		}
+
+	}
+
+	public void deletevoicefromui(String csaleid) {
+		try {
+			int rowcount;
+			if (this.getShowState() == 0) {
+				this.getBillListPanel().getHeadBillModel()
+						.delLine(new int[]{this.getBillListPanel().getHeadTable().getSelectedRow()});
+				this.getBillListPanel().getBodyBillModel().clearBodyData();
+			} else {
+				rowcount = this.getBillListPanel().getHeadBillModel().getRowCount();
+				int i = 0;
+
+				while (true) {
+					if (i >= rowcount) {
+						this.getBillCardPanel().addNew();
+						break;
+					}
+
+					String id = (String) this.getBillListPanel().getHeadBillModel().getValueAt(i, "csaleid");
+					if (id != null && id.equals(csaleid)) {
+						this.getBillListPanel().getHeadBillModel().delLine(new int[]{i});
+						this.getBillListPanel().getBodyBillModel().clearBodyData();
+					}
+
+					++i;
+				}
+			}
+
+			rowcount = this.getVOCache().findPos(csaleid);
+			this.getVOCache().removeVOAt(rowcount);
+		} catch (Exception var5) {
+			this.showHintMessage(NCLangRes.getInstance().getStrByID("SCMCOMMON", "UPPSCMCommon-000256"));
+			SCMEnv.out(var5.getMessage());
+		}
+
+	}
+
+	public void doAddAction(ILinkAddData addData) {
+		SaleinvoiceVO[] vosNew = null;
+    //ZTH
+		try {
+			if ("30".equals(addData.getSourceBillType())) {
+				SaleOrderVO order = (SaleOrderVO) SaleOrderBO_Client.queryData(addData.getSourceBillID());
+				vosNew = new SaleinvoiceVO[]{(SaleinvoiceVO) PfUtilUITools.runChangeData("30", "32", order)};
+			}
+
+			if (vosNew != null && vosNew.length != 0) {
+				SaleinvoiceSplitTools splittools = new SaleinvoiceSplitTools();
+				SaleinvoiceVO[] aryRetVO = splittools.splitSaleinvoiceVOs(vosNew);
+				SaleinvoiceDealMnyTools dealmnytools = new SaleinvoiceDealMnyTools();
+				dealmnytools.dealMny(aryRetVO);
+				this.processNewVO(aryRetVO);
+				this.getVOCache().setCacheData(aryRetVO);
+				this.add(this.getBillCardPanel(), "Center");
+				this.getBillCardPanel().loadCardData(this.getVOCache().getCurrentVO());
+				this.getBillCardPanel().modify(this.getVOCache().getCurrentVO());
+				this.setShowState(1);
+				this.setOperationState(6);
+				this.setButtonsStateEdit();
+				this.showHintMessage(NCLangRes.getInstance().getStrByID("SCMCommon", "UPPSCMCommon-000350"));
+			}
+			
+//			FtCountDLG ftdlg=new FtCountDLG(getBillCardPanel());
+//			ftdlg.show();
+			
+		} catch (Exception var6) {
+			MessageDialog.showErrorDlg(this, "", var6.getMessage());
+		}
+	}
+
+	public void doApproveAction(ILinkApproveData approvedata) {
+		this.setInMsgPanel(true);
+		this.getBillCardPanel().loadCardDataByID(approvedata.getBillID());
+		this.getBillCardPanel().setEnabled(false);
+		SaleinvoiceVO vosInvoice = this.getVo();
+		this.getVOCache().setCacheData(new SaleinvoiceVO[]{vosInvoice});
+		this.setOperationState(2);
+		this.setShowState(1);
+		if (!this.isInMsgPanel()) {
+			this.setButtonsStateByBillStatue();
+		}
+
+		this.setButtonsStateMsgCenterApprove();
+	}
+
+	public void doMaintainAction(ILinkMaintainData maintaindata) {
+		this.getBillCardPanel().loadCardDataByID(maintaindata.getBillID());
+		SaleinvoiceVO saleinvoice = this.getVo();
+		this.getVOCache().setCacheData(new SaleinvoiceVO[]{saleinvoice});
+		if (saleinvoice.getHeadVO().getDapprovedate() == null) {
+			this.onModify();
+		} else {
+			this.onCard();
+		}
+
+	}
+
+	public void doQueryAction(ILinkQueryData querydata) {
+		this.getBillCardPanel().loadCardDataByID(querydata.getBillID());
+		this.getBillCardPanel().setEnabled(false);
+		SaleinvoiceVO vosInvoice = this.getVo();
+		this.getVOCache().setCacheData(new SaleinvoiceVO[]{vosInvoice});
+		this.setOperationState(2);
+		this.setShowState(1);
+		if (!this.isInMsgPanel()) {
+			this.setButtonsStateByBillStatue();
+		}
+
+		this.setButtonsStateByLinkQueryBusitype();
+	}
+
+	public void doThreadWork(String WorkName) {
+		if ("APPROVE".equals(WorkName)) {
+			this.doApproveWork();
+		} else if ("SoUnApprove".equals(WorkName)) {
+			this.doUnApproveWork();
+		} else if ("UNITE".equals(WorkName)) {
+			this.batchAutoUnit();
+		} else if ("UNUNITE".equals(WorkName)) {
+			this.batchCancelUnit();
+		} else if ("SoBlankOut".equals(WorkName)) {
+			this.doDeleteWork();
+		} else if ("SAVE".equals(WorkName)) {
+			this.doSendAuditWork();
+		}
+
+	}
+
+	public void freshTs(String sBillID, String sTS, Integer iPrintCount) {
+		if (sTS != null && sTS.trim().length() > 0) {
+			String csaleid;
+			int i;
+			int iloop;
+			if (0 == this.getShowState()) {
+				if (null == sBillID || sBillID.trim().length() <= 0) {
+					return;
+				}
+
+				csaleid = null;
+				i = 0;
+
+				for (iloop = this.getBillListPanel().getHeadTable().getRowCount(); i < iloop; ++i) {
+					csaleid = (String) this.getBillListPanel().getHeadBillModel().getValueAt(i, "csaleid");
+					if (sBillID.equals(csaleid)) {
+						this.getBillListPanel().getHeadBillModel().setValueAt(sTS, i, "ts");
+						this.getBillListPanel().getHeadBillModel().setValueAt(iPrintCount, i, "iprintcount");
+						break;
+					}
+				}
+			} else {
+				this.getBillCardPanel().setHeadItem("ts", sTS);
+				this.getBillCardPanel().setTailItem("iprintcount", iPrintCount);
+				csaleid = null;
+				i = 0;
+
+				for (iloop = this.getBillListPanel().getHeadTable().getRowCount(); i < iloop; ++i) {
+					csaleid = (String) this.getBillListPanel().getHeadBillModel().getValueAt(i, "csaleid");
+					if (sBillID.equals(csaleid)) {
+						this.getBillListPanel().getHeadBillModel().setValueAt(sTS, i, "ts");
+						this.getBillListPanel().getHeadBillModel().setValueAt(iPrintCount, i, "iprintcount");
+						break;
+					}
+				}
+			}
+
+			SaleinvoiceVO ordvo = this.getVOCache().getVO_Load(sBillID);
+			if (ordvo != null) {
+				ordvo.getHeadVO().setIprintcount(iPrintCount);
+				ordvo.getHeadVO().setTs(new UFDateTime(sTS.trim()));
+			}
+
+		}
+	}
+
+	public SaleInvoiceCardPanel getBillCardPanel() {
+		if (this.ivjBillCardPanel == null) {
+			this.ivjBillCardPanel = new SaleInvoiceCardPanel(this);
+		}
+
+		return this.ivjBillCardPanel;
+	}
+
+	public SaleInvoiceListPanel getBillListPanel() {
+		if (this.ivjBillListPanel == null) {
+			this.ivjBillListPanel = new SaleInvoiceListPanel(this);
+		}
+
+		return this.ivjBillListPanel;
+	}
+
+	public SaleInvoiceBtn getBtns() {
+		if (this.m_buttons == null) {
+			this.m_buttons = new SaleInvoiceBtn();
+		}
+
+		return this.m_buttons;
+	}
+
+	public int getOperationState() {
+		return this.m_iOperationState;
+	}
+
+	public InvokeEventProxy getPluginProxy() {
+		try {
+			if (null == this.pluginproxy) {
+				this.pluginproxy = new InvokeEventProxy("so", "32", new SOPluginUI(this, "32"));
+			}
+		} catch (Exception var2) {
+			this.showErrorMessage(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000656") + var2);
+		}
+
+		return this.pluginproxy;
+	}
+
+	public SaleInvoiceTools getSaleinvoiceTools() {
+		if (null == this.st) {
+			this.st = new SaleInvoiceTools();
+			this.st.setNodecode(this.getModuleCode());
+		}
+
+		return this.st;
+	}
+
+	public String getTitle() {
+		return this.getBillCardPanel().getBillData().getTitle();
+	}
+
+	public HashSet getUpSourcrBillbid() {
+		HashSet hbodyid = new HashSet(0);
+		if (6 == this.getOperationState()) {
+			SaleinvoiceVO billvo = (SaleinvoiceVO) this.getBillCardPanel().getBillValueVO(SaleinvoiceVO.class.getName(),
+					SaleVO.class.getName(), SaleinvoiceBVO.class.getName());
+			if (billvo != null && billvo.getChildrenVO() != null && billvo.getChildrenVO().length > 0) {
+				int iLength = billvo.getBodyVO().length;
+
+				for (int i = 0; i < iLength; ++i) {
+					hbodyid.add(billvo.getBodyVO()[i].getCupsourcebillbodyid());
+				}
+			}
+		}
+
+		return hbodyid;
+	}
+
+	public SaleinvoiceVO getVo() {
+		SaleinvoiceVO voInvoice = null;
+		if (this.getShowState() == 0) {
+			voInvoice = this.getBillListPanel().getSelectedVO();
+		} else {
+			voInvoice = this.getBillCardPanel().getVO();
+		}
+
+		return voInvoice;
+	}
+
+	public SaleInvoiceVOCache getVOCache() {
+		return this.m_vocache;
+	}
+
+	public void informWhenInterrupt(String sActionName) {
+		if ("APPROVE".equals(sActionName)) {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000041"));
+		} else if ("SoUnApprove".equals(sActionName)) {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000042"));
+		} else if ("UNITE".equals(sActionName)) {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100041"));
+		} else if ("UNUNITE".equals(sActionName)) {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100042"));
+		} else if ("SAVE".equals(sActionName)) {
+			ShowToolsInThread.showMessage(this.m_proccdlg, "送审操作被用户中断!");
+		}
+
+	}
+
+	public void informWhenSucceed(String sActionName) {
+		if ("APPROVE".equals(sActionName)) {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000043"));
+		} else if ("SoUnApprove".equals(sActionName)) {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000044"));
+		} else if ("UNITE".equals(sActionName)) {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100043"));
+		} else if ("UNUNITE".equals(sActionName)) {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100044"));
+		} else if ("SAVE".equals(sActionName)) {
+			ShowToolsInThread.showMessage(this.m_proccdlg, "送审操作结束!");
+		}
+
+	}
+
+	public boolean isInMsgPanel() {
+		return this.m_bInMsgPanel;
+	}
+
+	public void mouse_doubleclick(BillMouseEnent e) {
+		if (e.getPos() == 0) {
+			this.onCard();
+			if (this.getBillCardPanel().isNewBill()) {
+				this.onModify();
+			}
+		}
+
+	}
+
+	public void onAfterAction(ButtonObject bo) {
+		SaleinvoiceVO voInv = this.getVOForAction();
+
+		try {
+			PfUtilClient.processAction(bo.getTag(), "32", SaleInvoiceTools.getLoginDate().toString(), voInv,
+					voInv.getHeadVO().getPrimaryKey());
+			this.showHintMessage(bo.getName() + NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000067"));
+		} catch (Exception var4) {
+			this.showErrorMessage(bo.getName() + NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000069"));
+			SCMEnv.out(var4.getMessage());
+		}
+
+	}
+
+	public void onButtonClicked(ButtonObject bo) {
+		this.showHintMessage("");
+
+		try {
+			this.getPluginProxy().beforeButtonClicked(bo);
+		} catch (BusinessException var4) {
+			SCMEnv.out(var4);
+			this.showErrorMessage(var4.getMessage());
+			return;
+		}
+
+		if (this.getShowState() == 0) {
+			if (this.getBillListPanel().getHeadTable().getSelectedRowCount() > 1
+					&& (bo == this.getBtns().m_boApprove || bo == this.getBtns().m_boBlankOut
+							|| bo == this.getBtns().m_boUnApprove || bo == this.getBtns().m_boUnite
+							|| bo == this.getBtns().m_boUniteCancel || bo == this.getBtns().m_boSendAudit)) {
+				this.m_proccdlg = new ProccDlg(this, bo.getHint(), this, bo.getTag());
+				this.m_proccdlg.showModal();
+				return;
+			}
+		} else {
+			this.getBillCardPanel().stopEditing();
+		}
+
+		if (bo.getParent() == this.getBtns().m_boBusiType) {
+			this.onBusiType(bo);
+		} else if (bo.getParent() == this.getBtns().m_boAdd) {
+			if (bo == this.getBtns().m_boGather) {
+				this.onOutSumMakeInvoice();
+			} else {
+				this.onNew(bo);
+			}
+		} else if (bo.getParent() == this.getBtns().m_boRefAdd) {
+			this.onRefAddLine(bo);
+		} else if (bo == this.getBtns().m_boFetchCost) {
+			this.onFetchCost();
+		} else if (bo == this.getBtns().m_boSave) {
+			this.onSave();
+		} else if (bo == this.getBtns().m_boApprove) {
+			this.onApprove();
+		} else if (bo == this.getBtns().m_boCard) {
+			if (this.getShowState() == 1) {
+				this.onList();
+			} else {
+				this.onCard();
+			}
+		} else if (bo.getParent() == this.getBtns().m_boMaintain) {
+			if (bo == this.getBtns().m_boModify) {
+				this.onModify();
+			} else if (bo == this.getBtns().m_boCancel) {
+				this.onCancelSave();
+			} else if (bo == this.getBtns().m_boBlankOut) {
+				this.onBlankOut();
+			} else if (bo == this.getBtns().m_boCancelTransfer) {
+				this.onCancelTransfer();
+			} else if (bo == this.getBtns().m_boUnite) {
+				this.onUnite();
+			} else if (bo == this.getBtns().m_boUniteCancel) {
+				this.onUniteCancel();
+			}
+		} else if (bo.getParent() == this.getBtns().m_boLineOper) {
+			if (bo == this.getBtns().m_boDelLine) {
+				this.getBillCardPanel().actionDelLine();
+				this.setOperationState(6);
+				this.setButtonsStateEdit();
+			} else if (bo == this.getBtns().m_boAddLine) {
+				this.isAddLineButn = true;
+				this.getBillCardPanel().actionAddLine();
+				this.setOperationState(6);
+				this.setButtonsStateEdit();
+				this.isAddLineButn = false;
+			} else if (bo == this.getBtns().m_boCopyLine) {
+				this.getBillCardPanel().actionCopyLine();
+				this.setOperationState(6);
+				this.setButtonsStateEdit();
+			} else if (bo == this.getBtns().m_boPasteLine) {
+				this.getBillCardPanel().actionPasteLine();
+				this.setOperationState(6);
+				this.setButtonsStateEdit();
+			} else if (bo == this.getBtns().m_boInsertLine) {
+				this.getBillCardPanel().actionInsertLine();
+				this.setOperationState(6);
+				this.setButtonsStateEdit();
+			} else if (bo == this.getBtns().m_boPasteLineTail) {
+				this.getBillCardPanel().actionPasteLineToTail();
+				this.setOperationState(6);
+				this.setButtonsStateEdit();
+			} else if (bo == this.getBtns().m_boCardEdit) {
+				this.getBillCardPanel().startRowCardEdit();
+				this.setOperationState(6);
+				this.setButtonsStateEdit();
+			} else if (bo == this.getBtns().m_boReRowNO) {
+				BillRowNo.addNewRowNo(this.getBillCardPanel(), "32", "crowno");
+			}
+		} else if (bo.getParent() == this.getBtns().m_boAction) {
+			if (bo == this.getBtns().m_boSendAudit) {
+				this.onSendAudit();
+			}
+
+			if (bo == this.getBtns().m_boTakeBack) {
+				this.onTakeBack();
+			} else if (bo == this.getBtns().m_boUnApprove) {
+				this.onUnApprove();
+			}
+		} else {
+			if (bo == this.getBtns().m_boQuery) {
+				this.onQuery();
+				return;
+			}
+
+			if (bo.getParent() == this.getBtns().m_boBrowse) {
+				if (bo == this.getBtns().m_boRefresh) {
+					this.onRefresh();
+				} else if (bo == this.getBtns().m_boLocal) {
+					this.onLocal();
+				} else if (bo == this.getBtns().m_boFirst) {
+					this.onFirst();
+				} else if (bo == this.getBtns().m_boPrev) {
+					this.onPrev();
+				} else if (bo == this.getBtns().m_boNext) {
+					this.onNext();
+				} else if (bo == this.getBtns().m_boLast) {
+					this.onLast();
+				} else if (bo == this.getBtns().m_boSelectAll) {
+					this.onSelectAll();
+				} else if (bo == this.getBtns().m_boUnSelectAll) {
+					this.onUnSelectAll();
+				}
+			} else if (bo.getParent() == this.getBtns().m_boPrintManage) {
+				if (bo == this.getBtns().m_boPrint) {
+					this.onPrint(false);
+				} else if (bo == this.getBtns().m_boPreview) {
+					this.onPrint(true);
+				} else if (bo == this.getBtns().m_boBillCombin) {
+					this.onBillCombin();
+				}
+			} else if (bo.getParent() == this.getBtns().m_boAssistant) {
+				if (bo == this.getBtns().m_boOrderQuery) {
+					this.onOrderQuery();
+				} else if (bo == this.getBtns().m_boExecRpt) {
+					this.onExecQuery();
+				} else if (bo == this.getBtns().m_boATP) {
+					this.onATP();
+				} else if (bo == this.getBtns().m_boAuditFlowStatus) {
+					this.onAuditFlowStatus();
+				} else if (bo == this.getBtns().m_boCustInfo) {
+					this.onCustInfo();
+				} else if (bo == this.getBtns().m_boCustCredit) {
+					this.onCustCredit();
+				} else if (bo == this.getBtns().m_boPrifit) {
+					this.onPrifit();
+				}
+			} else if (bo.getParent() == this.getBtns().m_boAssistFunction) {
+				if (bo == this.getBtns().m_boOpposeAct) {
+					this.onOpposeAct();
+				} else if (bo == this.getBtns().m_boImportTaxCode) {
+					this.onImportTaxCode();
+				} else if (bo == this.getBtns().m_boSoTax) {
+					this.onSoTax();
+				} else if (bo == this.getBtns().m_boToEinv) {
+					this.onToEinv();
+				} else if (bo == this.getBtns().m_boDocument) {
+					this.onDocument();
+				}
+			} else if ("导入excel数据".equals(bo.getName())) {
+				this.onBillImportExcel();
+			} else if ("导出excel模板".equals(bo.getName())) {
+				this.onBillDownloadExcel();
+			}else  if(bo == this.getBtns().m_bocount) {
+			//	MessageDialog.showHintDlg(null, "提示", "分摊监听");
+				FtCountDLG ftdlg=new FtCountDLG(getBillCardPanel());
+				ftdlg.show();
+				
+			}
+		}
+
+		try {
+			this.getPluginProxy().afterButtonClicked(bo);
+		} catch (BusinessException var3) {
+			SCMEnv.out(var3);
+			this.showErrorMessage(var3.getMessage());
+		}
+
+		if (!bo.getCode().equals(this.getBtns().m_boFetchCost.getCode()) && this.existErrRows) {
+			SetColor.resetColor(this.getBillCardPanel());
+			this.existErrRows = false;
+		}
+
+	}
+
+	public ExcelFileProcess getFileProcess() {
+		if (this.fileProcess == null) {
+			this.fileProcess = new ExcelFileProcess(this);
+		}
+
+		return this.fileProcess;
+	}
+
+	private void onBillDownloadExcel() {
+		this.getFileProcess().downLoadDefaultFile(ScmAPIType.SO_INVOICE.getFilePath());
+	}
+
+	private void onBillImportExcel() {
+		this.getFileProcess().importExcelData(ScmAPIType.SO_INVOICE.getServerName());
+	}
+
+	public boolean onClosing() {
+		if (this.getOperationState() == 6) {
+			int nReturn = MessageDialog.showYesNoCancelDlg(this,
+					NCLangRes.getInstance().getStrByID("SCMCOMMON", "UPPSCMCommon-000270"),
+					NCLangRes.getInstance().getStrByID("common", "UCH001"));
+			if (nReturn == 4) {
+				this.onSave();
+				return true;
+			} else {
+				return nReturn == 8;
+			}
+		} else {
+			return true;
+		}
+	}
+
+	public boolean onEditAction(int action) {
+		if (0 == action && !this.isAddLineButn) {
+			this.getBillCardPanel().actionAddLine();
+			return false;
+		} else {
+			return true;
+		}
+	}
+
+	public void reloadDataAfterRun() {
+		Vector vTemp = new Vector();
+		Object oTemp = null;
+
+		for (int i = 0; i < this.getBillListPanel().getHeadBillModel().getRowCount(); ++i) {
+			oTemp = this.getBillListPanel().getHeadBillModel().getValueAt(i, "csaleid");
+			if (oTemp != null) {
+				vTemp.addElement(oTemp.toString());
+			}
+		}
+
+		if (vTemp.size() > 0) {
+			String[] id = new String[vTemp.size()];
+			vTemp.copyInto(id);
+			String sql = "so_saleinvoice.dr = 0 and so_saleinvoice.csaleid in ('";
+
+			for (int i = 0; i < id.length - 1; ++i) {
+				sql = sql + id[i] + "','";
+			}
+
+			sql = sql + id[id.length - 1] + "')";
+			SaleinvoiceVO[] vosInvoice = null;
+
+			try {
+				vosInvoice = SaleinvoiceBO_Client.queryBillData(sql, (String) null, false);
+			} catch (Exception var7) {
+				SCMEnv.out(var7);
+				MessageDialog.showErrorDlg(this, NCLangRes.getInstance().getStrByID("scmcommon", "UPPSCMCommon-000059"),
+						var7.getMessage());
+			}
+
+			this.getVOCache().setCacheData(vosInvoice);
+			this.onList();
+		}
+
+	}
+
+	public void setButtonsState() {
+		if (this.getOperationState() == 2) {
+			this.setButtonsStateBrowse();
+		} else if (this.getOperationState() == 6) {
+			this.setButtonsStateEdit();
+		} else if (this.getOperationState() == 11) {
+			this.setButtonsStateOPP();
+		} else if (this.getOperationState() == 9) {
+			this.setButtonsStateMsgCenterApprove();
+		} else if (this.getOperationState() == 7) {
+			this.setButtonsStateByBillStatue();
+		} else if (this.getOperationState() == 8) {
+			this.setButtonsStateByLinkQueryBusitype();
+		}
+
+		this.getPluginProxy().setButtonStatus();
+	}
+
+	public void setOperationState(int iState) {
+		this.m_iOperationState = iState;
+	}
+
+	public void setStateByBillStatus() {
+		int iState = this.getBillListPanel().getBillStatus();
+		switch (iState) {
+			case 1 :
+				this.getBtns().m_boBlankOut.setEnabled(true);
+				this.getBtns().m_boModify.setEnabled(true);
+				this.getBtns().m_boApprove.setEnabled(true);
+				this.getBtns().m_boUnApprove.setEnabled(false);
+				this.getBtns().m_boDocument.setEnabled(true);
+				this.getBtns().m_boOrderQuery.setEnabled(true);
+				this.getBtns().m_boOrderQuery.setEnabled(true);
+				break;
+			case 2 :
+				this.getBtns().m_boBlankOut.setEnabled(false);
+				this.getBtns().m_boApprove.setEnabled(false);
+				this.getBtns().m_boUnApprove.setEnabled(true);
+				this.getBtns().m_boModify.setEnabled(false);
+				this.getBtns().m_boDocument.setEnabled(true);
+				this.getBtns().m_boOrderQuery.setEnabled(true);
+				this.getBtns().m_boOrderQuery.setEnabled(false);
+			case 3 :
+			case 4 :
+			case 6 :
+			default :
+				break;
+			case 5 :
+				this.getBtns().m_boModify.setEnabled(false);
+				this.getBtns().m_boAction.setEnabled(false);
+				this.getBtns().m_boAssistant.setEnabled(false);
+				this.getBtns().m_boPrint.setEnabled(false);
+				this.getBtns().m_boDocument.setEnabled(false);
+				this.getBtns().m_boOrderQuery.setEnabled(false);
+				this.getBtns().m_boOrderQuery.setEnabled(false);
+				this.getBtns().m_boPreview.setEnabled(false);
+				this.getBtns().m_boAuditFlowStatus.setEnabled(false);
+				break;
+			case 7 :
+				this.getBtns().m_boBlankOut.setEnabled(false);
+				this.getBtns().m_boApprove.setEnabled(true);
+				this.getBtns().m_boUnApprove.setEnabled(false);
+				this.getBtns().m_boSave.setEnabled(false);
+				this.getBtns().m_boModify.setEnabled(false);
+				break;
+			case 8 :
+				this.getBtns().m_boBlankOut.setEnabled(true);
+				this.getBtns().m_boModify.setEnabled(true);
+				this.getBtns().m_boSave.setEnabled(false);
+				this.getBtns().m_boCancel.setEnabled(false);
+				this.getBtns().m_boApprove.setEnabled(true);
+				this.getBtns().m_boUnApprove.setEnabled(false);
+				this.getBtns().m_boDocument.setEnabled(true);
+				this.getBtns().m_boOrderQuery.setEnabled(true);
+				this.getBtns().m_boOrderQuery.setEnabled(true);
+		}
+
+		int selectRow = this.getBillListPanel().getHeadTable().getSelectedRow();
+		int iOppStatus = 0;
+		if (selectRow > -1 && this.getBillListPanel().getHeadItem("fcounteractflag") != null
+				&& this.getBillListPanel().getHeadBillModel().getValueAt(selectRow, "fcounteractflag") != null
+				&& this.getBillListPanel().getHeadItem("fcounteractflag").converType(
+						this.getBillListPanel().getHeadBillModel().getValueAt(selectRow, "fcounteractflag")) != null) {
+			iOppStatus = Integer.parseInt(this.getBillListPanel().getHeadItem("fcounteractflag")
+					.converType(this.getBillListPanel().getHeadBillModel().getValueAt(selectRow, "fcounteractflag"))
+					.toString());
+		}
+
+		if (iState == 2 && iOppStatus == 1) {
+			this.getBtns().m_boUnApprove.setEnabled(false);
+		}
+
+		if (iState == 2 && iOppStatus == 0) {
+			this.getBtns().m_boOpposeAct.setEnabled(true);
+		} else {
+			this.getBtns().m_boOpposeAct.setEnabled(false);
+		}
+
+	}
+
+	public void updateCache() {
+		this.getVOCache().setCacheData((SaleinvoiceVO[]) null);
+		SaleinvoiceVO[] sales = null;
+
+		try {
+			if (this.getQueryDlg().getConditionVO() != null) {
+				sales = SaleinvoiceBO_Client.queryBillData(this.getQueryDlg().getWhere(),
+						this.getClientEnvironment().getUser().getPrimaryKey(), this.getQueryDlg().getIsSelAuditing());
+			}
+		} catch (Exception var3) {
+			SCMEnv.out(var3);
+			this.showErrorMessage(var3.getMessage());
+		}
+
+		this.getVOCache().setCacheData(sales);
+	}
+
+	private void batchAutoUnit() {
+		TreeMap tmapvos = null;
+		HashMap<Object, SaleinvoiceVO> hSuccess = new HashMap();
+		ShowToolsInThread.showStatus(this.m_proccdlg, new Integer(0));
+		ShowToolsInThread.showMessage(this.m_proccdlg,
+				NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100045"));
+
+		try {
+			tmapvos = (TreeMap) this.getBillListPanel().getBatchWorkInvoiceVOs(false);
+			if (null == tmapvos || tmapvos.size() <= 0) {
+				this.showHintMessage(NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100046"));
+				return;
+			}
+		} catch (Exception var19) {
+			this.showErrorMessage(var19.getMessage());
+			return;
+		}
+
+		int max = this.m_proccdlg.getUIProgressBar1().getMaximum();
+		int maxcount = tmapvos.size();
+		ShowToolsInThread.showMessage(this.m_proccdlg,
+				NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100047"));
+		SaleinvoiceVO saleinvoice = null;
+		Iterator iter = tmapvos.keySet().iterator();
+		int count = 0;
+
+		while (true) {
+			if (iter.hasNext()) {
+				Object key = iter.next();
+				saleinvoice = (SaleinvoiceVO) tmapvos.get(key);
+				saleinvoice.getParentVO().setCapproveid((String) null);
+				ShowToolsInThread.showStatus(this.m_proccdlg,
+						new Integer((int) ((double) max * (1.0D * (double) count / (double) maxcount))));
+				ShowToolsInThread.showMessage(this.m_proccdlg,
+						NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100048", (String) null,
+								new String[]{saleinvoice.getParentVO().getVreceiptcode()}));
+				saleinvoice.setCuruserid(this.getClientEnvironment().getUser().getPrimaryKey());
+
+				try {
+					if (!this.m_proccdlg.isInterrupted()) {
+						if (saleinvoice.getHeadVO().getFstatus() != 1) {
+							throw new BusinessException(
+									NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100063"));
+						}
+
+						if (saleinvoice.getHsArsubAcct() != null && saleinvoice.getHsArsubAcct().size() > 0) {
+							throw new BusinessException(
+									NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100064"));
+						}
+
+						saleinvoice = SaleinvoiceBO_Client.autoUniteInvoiceToUI(saleinvoice,
+								new ClientLink(ClientEnvironment.getInstance()));
+						String sMsg;
+						if (saleinvoice.getHsArsubAcct() != null && saleinvoice.getHsArsubAcct().size() > 0) {
+							hSuccess.put(key, saleinvoice);
+							sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100049", (String) null,
+									new String[]{saleinvoice.getParentVO().getVreceiptcode()});
+							ShowToolsInThread.showMessage(this.m_proccdlg, sMsg, sMsg);
+							continue;
+						}
+
+						sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100051", (String) null,
+								new String[]{saleinvoice.getParentVO().getVreceiptcode()});
+						ShowToolsInThread.showMessage(this.m_proccdlg, sMsg, sMsg);
+						continue;
+					}
+				} catch (Exception var17) {
+					String sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100052", (String) null,
+							new String[]{saleinvoice.getParentVO().getVreceiptcode()});
+					sMsg = sMsg + var17.getMessage();
+					ShowToolsInThread.showMessage(this.m_proccdlg, " ", sMsg);
+					if (!this.m_proccdlg.getckHint().isSelected()) {
+						continue;
+					}
+
+					sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100052", (String) null,
+							new String[]{saleinvoice.getParentVO().getVreceiptcode()});
+					if (ShowToolsInThread.showYesNoDlg(this.m_proccdlg, var17.getMessage() + "\n" + sMsg
+							+ NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100053")) == 4) {
+						continue;
+					}
+
+					this.m_proccdlg.Interrupt();
+				} finally {
+					++count;
+				}
+			}
+
+			ShowToolsInThread.showStatus(this.m_proccdlg, new Integer(max));
+			if (this.m_proccdlg.isInterrupted()) {
+				ShowToolsInThread.showMessage(this.m_proccdlg,
+						NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100041"));
+			} else {
+				ShowToolsInThread.showMessage(this.m_proccdlg,
+						NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100043"));
+			}
+
+			try {
+				Thread.sleep(500L);
+			} catch (Exception var16) {
+				;
+			}
+
+			if (hSuccess.size() >= 0) {
+				ShowToolsInThread.showMessage(this.m_proccdlg,
+						NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000054"));
+				ShowToolsInThread.doLoadAdminData(this);
+			}
+
+			return;
+		}
+	}
+
+	private void batchCancelUnit() {
+		TreeMap tmapvos = null;
+		HashMap<Object, SaleinvoiceVO> hSuccess = new HashMap();
+		ShowToolsInThread.showStatus(this.m_proccdlg, new Integer(0));
+		ShowToolsInThread.showMessage(this.m_proccdlg,
+				NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100055"));
+
+		try {
+			tmapvos = (TreeMap) this.getBillListPanel().getBatchWorkInvoiceVOs(false);
+		} catch (Exception var14) {
+			this.showErrorMessage(var14.getMessage());
+			return;
+		}
+
+		if (null != tmapvos && tmapvos.size() > 0) {
+			int max = this.m_proccdlg.getUIProgressBar1().getMaximum();
+			int maxcount = tmapvos.size();
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100057"));
+			SaleinvoiceVO voInvoice = null;
+			Iterator iter = tmapvos.keySet().iterator();
+			int count = 0;
+
+			while (iter.hasNext()) {
+				Object key = iter.next();
+				voInvoice = (SaleinvoiceVO) tmapvos.get(key);
+				voInvoice.getHeadVO().setCapproveid((String) null);
+				ShowToolsInThread.showStatus(this.m_proccdlg,
+						new Integer((int) ((double) max * (1.0D * (double) count / (double) maxcount))));
+				ShowToolsInThread.showMessage(this.m_proccdlg, NCLangRes.getInstance().getStrByID("40060501",
+						"UPP40060501-100058", (String) null, new String[]{voInvoice.getParentVO().getVreceiptcode()}));
+				voInvoice.setCuruserid(this.getClientEnvironment().getUser().getPrimaryKey());
+				if (this.m_proccdlg.isInterrupted()) {
+					break;
+				}
+
+				this.getBillCardPanel().loadCardData(voInvoice);
+				SaleinvoiceVO hvo = this.getBillCardPanel().getVO();
+				this.getBillCardPanel().setOldVO(hvo);
+				this.getBillCardPanel().updateValue();
+				boolean needUnitCancel = this.getBillCardPanel().uniteCancel();
+				if (needUnitCancel) {
+					String sBusinessException = this.onSave();
+					String sMsg;
+					if (sBusinessException != null) {
+						sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100061", (String) null,
+								new String[]{voInvoice.getParentVO().getVreceiptcode()});
+						sMsg = sMsg + sBusinessException;
+						ShowToolsInThread.showMessage(this.m_proccdlg, " ", sMsg);
+						if (this.m_proccdlg.getckHint().isSelected()) {
+							sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100061", (String) null,
+									new String[]{voInvoice.getParentVO().getVreceiptcode()});
+							if (ShowToolsInThread.showYesNoDlg(this.m_proccdlg, sBusinessException + "\n" + sMsg
+									+ NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100062")) == 4) {
+								continue;
+							}
+
+							this.m_proccdlg.Interrupt();
+							break;
+						}
+					} else {
+						voInvoice = (SaleinvoiceVO) this.getBillCardPanel().getBillValueVO(
+								SaleinvoiceVO.class.getName(), SaleVO.class.getName(), SaleinvoiceBVO.class.getName());
+						hSuccess.put(key, voInvoice);
+						sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100059", (String) null,
+								new String[]{voInvoice.getParentVO().getVreceiptcode()});
+						ShowToolsInThread.showMessage(this.m_proccdlg, sMsg, sMsg);
+					}
+
+					++count;
+				}
+			}
+
+			ShowToolsInThread.showStatus(this.m_proccdlg, new Integer(max));
+			if (this.m_proccdlg.isInterrupted()) {
+				ShowToolsInThread.showMessage(this.m_proccdlg,
+						NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100042"));
+			} else {
+				ShowToolsInThread.showMessage(this.m_proccdlg,
+						NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100044"));
+			}
+
+			try {
+				Thread.sleep(500L);
+			} catch (Exception var13) {
+				;
+			}
+
+			if (hSuccess.size() >= 0) {
+				ShowToolsInThread.showMessage(this.m_proccdlg,
+						NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000054"));
+				ShowToolsInThread.doLoadAdminData(this);
+			}
+
+		} else {
+			this.showHintMessage(NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100056"));
+		}
+	}
+
+	private void changeRefAddButtonByBusiType(String nowBusitype) {
+		if (nowBusitype == null || nowBusitype.trim().length() == 0) {
+			this.getBtns().m_boRefAdd.removeAllChildren();
+		}
+
+		BillbusinessVO[] billBusiVOs = PfUIDataCache.getSourceByCorpAndBillAndBusi(SaleInvoiceTools.getLoginPk_Corp(),
+				"32", nowBusitype);
+		this.getBtns().m_boRefAdd.removeAllChildren();
+		if (billBusiVOs != null) {
+			ButtonObject btnAddChild = null;
+
+			for (int i = 0; i < billBusiVOs.length; ++i) {
+				String showName = Pfi18nTools.i18nBilltypeName(billBusiVOs[i].getPk_billtype(),
+						billBusiVOs[i].getBilltypename());
+				btnAddChild = new ButtonObject(showName);
+				btnAddChild.setPowerContrl(false);
+				btnAddChild.setTag(
+						billBusiVOs[i].getPk_billtype().trim() + ":" + billBusiVOs[i].getPk_businesstype().trim());
+				this.getBtns().m_boRefAdd.addChildButton(btnAddChild);
+			}
+
+		}
+	}
+
+	private SaleinvoiceBVO[] checkBeforeRefAdd(SaleinvoiceVO[] addvos) {
+		if (null != addvos && addvos.length != 0) {
+			SaleinvoiceVO curbill = (SaleinvoiceVO) this.getBillCardPanel().getBillValueVO(
+					SaleinvoiceVO.class.getName(), SaleVO.class.getName(), SaleinvoiceBVO.class.getName());
+			SaleVO curhead = curbill.getHeadVO();
+			SaleVO addhead = null;
+			StringBuilder errmsg = new StringBuilder();
+			ArrayList<SaleinvoiceBVO> toAddBody = new ArrayList();
+			SaleinvoiceVO[] var7 = addvos;
+			int var8 = addvos.length;
+
+			for (int var9 = 0; var9 < var8; ++var9) {
+				SaleinvoiceVO addvo = var7[var9];
+				addhead = addvo.getHeadVO();
+				if (this.checkHeadItem(curhead.getCreceiptcorpid(), addhead.getCreceiptcorpid())) {
+					errmsg.append(this.getErrMsg(addvo, "ccustbaseid"));
+				} else if (this.checkHeadItem(curhead.getCsalecorpid(), addhead.getCsalecorpid())) {
+					errmsg.append(this.getErrMsg(addvo, "csalecorpid"));
+				} else if (this.checkHeadItem(curhead.getCcalbodyid(), addhead.getCcalbodyid())) {
+					errmsg.append(this.getErrMsg(addvo, "ccalbodyid"));
+				} else if (this.checkHeadItem(curhead.getCcurrencyid(), addhead.getCcurrencyid())) {
+					errmsg.append(this.getErrMsg(addvo, "ccurrencyid"));
+				} else {
+					SaleinvoiceBVO[] var11 = addvo.getBodyVO();
+					int var12 = var11.length;
+
+					for (int var13 = 0; var13 < var12; ++var13) {
+						SaleinvoiceBVO toaddbvo = var11[var13];
+						toaddbvo.setNuniteinvoicemny(new UFDouble(0));
+						toAddBody.add(toaddbvo);
+					}
+				}
+			}
+
+			if (errmsg.length() > 0) {
+				this.showErrorMessage(errmsg.toString());
+			}
+
+			SaleinvoiceBVO[] bodys = new SaleinvoiceBVO[toAddBody.size()];
+			return (SaleinvoiceBVO[]) toAddBody.toArray(bodys);
+		} else {
+			return null;
+		}
+	}
+
+	private boolean checkHeadItem(String curstr, String addstr) {
+		return null != curstr && curstr.trim().length() != 0 && null != addstr && addstr.trim().length() != 0
+				&& !curstr.equals(addstr);
+	}
+
+	private void doApproveWork() {
+		TreeMap tmapvos = null;
+		HashMap<Object, SaleinvoiceVO> hSuccess = new HashMap();
+		ShowToolsInThread.showStatus(this.m_proccdlg, new Integer(0));
+		ShowToolsInThread.showMessage(this.m_proccdlg,
+				NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000045"));
+
+		try {
+			tmapvos = (TreeMap) this.getBillListPanel().getBatchWorkInvoiceVOs(false);
+			if (null == tmapvos || tmapvos.size() <= 0) {
+				this.showHintMessage(NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000046"));
+				return;
+			}
+		} catch (Exception var22) {
+			this.showErrorMessage(var22.getMessage());
+			return;
+		}
+
+		int max = this.m_proccdlg.getUIProgressBar1().getMaximum();
+		int maxcount = tmapvos.size();
+		ShowToolsInThread.showMessage(this.m_proccdlg,
+				NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000047"));
+		SaleinvoiceVO saleinvoice = null;
+		Iterator iter = tmapvos.keySet().iterator();
+		int count = 0;
+
+		while (iter.hasNext()) {
+			Object key = iter.next();
+			saleinvoice = (SaleinvoiceVO) tmapvos.get(key);
+			ShowToolsInThread.showStatus(this.m_proccdlg,
+					new Integer((int) ((double) max * (1.0D * (double) count / (double) maxcount))));
+			ShowToolsInThread.showMessage(this.m_proccdlg, NCLangRes.getInstance().getStrByID("40060501",
+					"UPP40060501-000048", (String) null, new String[]{saleinvoice.getParentVO().getVreceiptcode()}));
+			saleinvoice.setCuruserid(this.getClientEnvironment().getUser().getPrimaryKey());
+
+				try {
+					if (this.m_proccdlg.isInterrupted()) {
+						break;
+					}
+					if (this.onApprove(saleinvoice)) {
+						hSuccess.put(key, saleinvoice);
+						String	sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000049", (String) null,
+								new String[]{saleinvoice.getParentVO().getVreceiptcode()});
+						ShowToolsInThread.showMessage(this.m_proccdlg, sMsg, sMsg);
+					} else {
+						String	sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000051", (String) null,
+								new String[]{saleinvoice.getParentVO().getVreceiptcode()});
+						ShowToolsInThread.showMessage(this.m_proccdlg, sMsg, sMsg);
+					}
+				} catch (Exception e) {
+					String sMsg = nc.ui.ml.NCLangRes.getInstance().getStrByID("40060501",
+				            "UPP40060501-000052", null, new String[] {
+				              ((SaleVO) saleinvoice.getParentVO()).getVreceiptcode()
+				            });
+				        sMsg += e.getMessage();
+				        ShowToolsInThread.showMessage(m_proccdlg, " ", sMsg);
+				        // ShowToolsInThread.showMessage(proccdlg, " ", "发票["
+				        // + ((SaleVO) saleinvoice.getParentVO())
+				        // .getVreceiptcode() + "]审批失败:" + e.getMessage());
+				        if (m_proccdlg.getckHint().isSelected()) {
+				          sMsg = nc.ui.ml.NCLangRes.getInstance().getStrByID("40060501",
+				              "UPP40060501-000052", null, new String[] {
+				                ((SaleVO) saleinvoice.getParentVO()).getVreceiptcode()
+				              });
+				          if (ShowToolsInThread.showYesNoDlg(m_proccdlg, e.getMessage()
+				              + "\n"
+				              + sMsg
+				              + nc.ui.ml.NCLangRes.getInstance().getStrByID("40060501",
+				                  "UPP40060501-000053")/*
+				                                         * @res "是否继续审批以下的发票?"
+				                                         */) == MessageDialog.ID_YES) {
+				            continue;
+				          }
+				          else {
+				            m_proccdlg.Interrupt();
+				            break;
+				          }
+				        }
+				      }
+				
+				finally {
+				  count++;
+			}
+		}
+
+		ShowToolsInThread.showStatus(this.m_proccdlg, new Integer(max));
+		if (this.m_proccdlg.isInterrupted()) {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000041"));
+		} else {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000043"));
+		}
+
+		try {
+			Thread.sleep(500L);
+		} catch (Exception var18) {
+			;
+		}
+
+		if (hSuccess.size() > 0) {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000054"));
+			ShowToolsInThread.doLoadAdminData(this);
+		}
+
+	}
+
+	private void doSendAuditWork() {
+		TreeMap tmapvos = null;
+		HashMap<Object, SaleinvoiceVO> hSuccess = new HashMap();
+		ShowToolsInThread.showStatus(this.m_proccdlg, new Integer(0));
+		ShowToolsInThread.showMessage(this.m_proccdlg, "正在进行送审前准备。");
+
+		try {
+			tmapvos = (TreeMap) this.getBillListPanel().getBatchWorkInvoiceVOs(false);
+			if (null == tmapvos || tmapvos.size() <= 0) {
+				this.showHintMessage("请选择待送审的发票。");
+				return;
+			}
+		} catch (Exception var19) {
+			this.showErrorMessage(var19.getMessage());
+			return;
+		}
+
+		int max = this.m_proccdlg.getUIProgressBar1().getMaximum();
+		int maxcount = tmapvos.size();
+		ShowToolsInThread.showMessage(this.m_proccdlg, "开始送审。");
+		SaleinvoiceVO saleinvoice = null;
+		Iterator iter = tmapvos.keySet().iterator();
+		int count = 0;
+
+		while (iter.hasNext()) {
+			Object key = iter.next();
+			saleinvoice = (SaleinvoiceVO) tmapvos.get(key);
+			ShowToolsInThread.showStatus(this.m_proccdlg,
+					new Integer((int) ((double) max * (1.0D * (double) count / (double) maxcount))));
+			ShowToolsInThread.showMessage(this.m_proccdlg, "正在送审发票" + saleinvoice.getParentVO().getVreceiptcode());
+			saleinvoice.setCuruserid(this.getClientEnvironment().getUser().getPrimaryKey());
+
+			try {
+				if (this.m_proccdlg.isInterrupted()) {
+					break;
+				}
+
+				String sMsg;
+				if (this.onSendAudit(saleinvoice)) {
+					hSuccess.put(key, saleinvoice);
+					sMsg = "发票" + saleinvoice.getParentVO().getVreceiptcode() + "送审成功!";
+					ShowToolsInThread.showMessage(this.m_proccdlg, sMsg, sMsg);
+				} else {
+					sMsg = "发票[" + saleinvoice.getParentVO().getVreceiptcode() + "]送审操作被用户取消!";
+					ShowToolsInThread.showMessage(this.m_proccdlg, sMsg, sMsg);
+				}
+			} catch (Exception var17) {
+				String sMsg = "发票[" + saleinvoice.getParentVO().getVreceiptcode() + "]送审失败!";
+				sMsg = sMsg + var17.getMessage();
+				ShowToolsInThread.showMessage(this.m_proccdlg, " ", sMsg);
+				if (this.m_proccdlg.getckHint().isSelected()) {
+					sMsg = "发票[" + saleinvoice.getParentVO().getVreceiptcode() + "]送审失败";
+					if (ShowToolsInThread.showYesNoDlg(this.m_proccdlg,
+							var17.getMessage() + "\n" + sMsg + "是否继续送审以下的发票?") != 4) {
+						this.m_proccdlg.Interrupt();
+						break;
+					}
+				}
+			} finally {
+				++count;
+			}
+		}
+
+		ShowToolsInThread.showStatus(this.m_proccdlg, new Integer(max));
+		if (this.m_proccdlg.isInterrupted()) {
+			ShowToolsInThread.showMessage(this.m_proccdlg, "送审操作被用户中断!");
+		} else {
+			ShowToolsInThread.showMessage(this.m_proccdlg, "送审操作结束!");
+		}
+
+		try {
+			Thread.sleep(500L);
+		} catch (Exception var16) {
+			;
+		}
+
+		if (hSuccess.size() > 0) {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000054"));
+			ShowToolsInThread.doLoadAdminData(this);
+		}
+
+	}
+
+	private void doDeleteWork() {
+		TreeMap tmapvos = null;
+		HashMap<Object, SaleinvoiceVO> hSuccess = new HashMap();
+		ShowToolsInThread.showStatus(this.m_proccdlg, new Integer(0));
+
+		try {
+			tmapvos = (TreeMap) this.getBillListPanel().getBatchWorkInvoiceVOs(true);
+			if (null == tmapvos || tmapvos.size() <= 0) {
+				this.showHintMessage(NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100071"));
+				return;
+			}
+		} catch (Exception var19) {
+			this.showErrorMessage(var19.getMessage());
+			return;
+		}
+
+		int max = this.m_proccdlg.getUIProgressBar1().getMaximum();
+		int maxcount = tmapvos.size();
+		SaleinvoiceVO saleinvoice = null;
+		Iterator iter = tmapvos.keySet().iterator();
+		int count = 0;
+
+		while (iter.hasNext()) {
+			Object key = iter.next();
+			saleinvoice = (SaleinvoiceVO) tmapvos.get(key);
+			ShowToolsInThread.showStatus(this.m_proccdlg,
+					new Integer((int) ((double) max * (1.0D * (double) count / (double) maxcount))));
+
+			try {
+				if (this.m_proccdlg.isInterrupted()) {
+					break;
+				}
+
+				String sMsg;
+				if (this.onDelete(saleinvoice)) {
+					hSuccess.put(key, saleinvoice);
+					sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100072", (String) null,
+							new String[]{saleinvoice.getParentVO().getVreceiptcode()});
+					ShowToolsInThread.showMessage(this.m_proccdlg, sMsg, sMsg);
+				} else {
+					sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100073", (String) null,
+							new String[]{saleinvoice.getParentVO().getVreceiptcode()});
+					ShowToolsInThread.showMessage(this.m_proccdlg, sMsg, sMsg);
+				}
+			} catch (Exception var17) {
+				String sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100074", (String) null,
+						new String[]{saleinvoice.getParentVO().getVreceiptcode()});
+				sMsg = sMsg + var17.getMessage();
+				ShowToolsInThread.showMessage(this.m_proccdlg, " ", sMsg);
+				if (this.m_proccdlg.getckHint().isSelected()) {
+					sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100074", (String) null,
+							new String[]{saleinvoice.getParentVO().getVreceiptcode()});
+					if (ShowToolsInThread.showYesNoDlg(this.m_proccdlg, var17.getMessage() + "\n" + sMsg
+							+ NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100075")) != 4) {
+						this.m_proccdlg.Interrupt();
+						break;
+					}
+				}
+			} finally {
+				++count;
+			}
+		}
+
+		ShowToolsInThread.showStatus(this.m_proccdlg, new Integer(max));
+		if (this.m_proccdlg.isInterrupted()) {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100069"));
+		} else {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100070"));
+		}
+
+		try {
+			Thread.sleep(500L);
+		} catch (Exception var16) {
+			;
+		}
+
+		if (hSuccess.size() > 0) {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000054"));
+			ShowToolsInThread.doLoadAdminData(this);
+		}
+
+	}
+
+	private void doUnApproveWork() {
+		TreeMap tmapvos = null;
+		HashMap<Object, SaleinvoiceVO> hSuccess = new HashMap();
+		ShowToolsInThread.showStatus(this.m_proccdlg, new Integer(0));
+		ShowToolsInThread.showMessage(this.m_proccdlg,
+				NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000055"));
+
+		try {
+			tmapvos = (TreeMap) this.getBillListPanel().getBatchWorkInvoiceVOs(false);
+			if (null == tmapvos || tmapvos.size() <= 0) {
+				this.showHintMessage(NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000056"));
+				return;
+			}
+		} catch (Exception var20) {
+			this.showErrorMessage(var20.getMessage());
+			return;
+		}
+
+		int max = this.m_proccdlg.getUIProgressBar1().getMaximum();
+		int maxcount = tmapvos.size();
+		ShowToolsInThread.showMessage(this.m_proccdlg,
+				NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000057"));
+		SaleinvoiceVO saleinvoice = null;
+		Iterator iter = tmapvos.keySet().iterator();
+		int count = 0;
+		boolean isnext = true;
+
+		while (iter.hasNext()) {
+			Object key = "";
+			if (isnext) {
+				key = iter.next();
+			}
+
+			saleinvoice = (SaleinvoiceVO) tmapvos.get(key);
+			if (saleinvoice == null) {
+				isnext = true;
+			} else {
+				ShowToolsInThread.showStatus(this.m_proccdlg,
+						new Integer((int) ((double) max * (1.0D * (double) count / (double) maxcount))));
+				ShowToolsInThread.showMessage(this.m_proccdlg,
+						NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000058", (String) null,
+								new String[]{saleinvoice.getParentVO().getVreceiptcode()}));
+
+				try {
+					if (this.m_proccdlg.isInterrupted()) {
+						break;
+					}
+
+					String sMsg;
+					if (this.onUnApprove(saleinvoice)) {
+						hSuccess.put(key, saleinvoice);
+						sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000059", (String) null,
+								new String[]{saleinvoice.getParentVO().getVreceiptcode()});
+						ShowToolsInThread.showMessage(this.m_proccdlg, sMsg, sMsg);
+					} else {
+						hSuccess.put(key, saleinvoice);
+						sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000060", (String) null,
+								new String[]{saleinvoice.getParentVO().getVreceiptcode()});
+						ShowToolsInThread.showMessage(this.m_proccdlg, sMsg, sMsg);
+					}
+				} catch (Exception var18) {
+					String sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000061", (String) null,
+							new String[]{saleinvoice.getParentVO().getVreceiptcode()});
+					sMsg = sMsg + var18.getMessage();
+					ShowToolsInThread.showMessage(this.m_proccdlg, " ", sMsg);
+					if (this.m_proccdlg.getckHint().isSelected()) {
+						sMsg = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000061", (String) null,
+								new String[]{saleinvoice.getParentVO().getVreceiptcode()});
+						if (ShowToolsInThread.showYesNoDlg(this.m_proccdlg, sMsg + var18.getMessage()
+								+ NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000062")) == 4) {
+							continue;
+						}
+
+						this.m_proccdlg.Interrupt();
+						break;
+					}
+				} finally {
+					++count;
+				}
+
+				isnext = true;
+			}
+		}
+
+		ShowToolsInThread.showStatus(this.m_proccdlg, new Integer(max));
+		if (this.m_proccdlg.isInterrupted()) {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000042"));
+		} else {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000044"));
+		}
+
+		try {
+			Thread.sleep(500L);
+		} catch (Exception var17) {
+			;
+		}
+
+		if (hSuccess.size() > 0) {
+			ShowToolsInThread.showMessage(this.m_proccdlg,
+					NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000054"));
+			ShowToolsInThread.doLoadAdminData(this);
+		}
+
+	}
+
+	private int getDefaultInvoiceType() {
+		String defaultInvoiceType = this.getBillCardPanel().getHeadItem("finvoicetype").getDefaultValue();
+		if (defaultInvoiceType != null && defaultInvoiceType.trim().length() > 0) {
+			try {
+				String[][] invoiceType = this.st.getInvoiceType();
+				int i = 0;
+
+				for (int loop = invoiceType.length; i < loop; ++i) {
+					if (defaultInvoiceType.trim().equals(invoiceType[i][1].trim())) {
+						return i;
+					}
+				}
+			} catch (Exception var5) {
+				SCMEnv.out(var5);
+			}
+		}
+
+		return 0;
+	}
+
+	private String getErrMsg(SaleinvoiceVO vo, String key) {
+		if (null == vo) {
+			return "";
+		} else {
+			StringBuilder errmsg = new StringBuilder();
+			String keyname = null;
+			if ("ccustbaseid".equals(key)) {
+				keyname = NCLangRes.getInstance().getStrByID("common", "UC000-0001589");
+			} else if ("csalecorpid".equals(key)) {
+				keyname = NCLangRes.getInstance().getStrByID("common", "UC000-0004128");
+			} else if ("ccalbodyid".equals(key)) {
+				keyname = NCLangRes.getInstance().getStrByID("common", "UC000-0001825");
+			} else if ("ccurrencyid".equals(key)) {
+				keyname = NCLangRes.getInstance().getStrByID("common", "UC000-0001755");
+			}
+
+			if (null != keyname) {
+				int i = 0;
+
+				for (int loop = vo.getBodyVO().length; i < loop; ++i) {
+					errmsg.append(NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100093", (String) null,
+							new String[]{vo.getBodyVO()[i].getCupsourcebillcode(), vo.getBodyVO()[i].getUpsourcerowno(),
+									keyname}))
+							.append("\n");
+				}
+			}
+
+			return errmsg.length() > 0 ? errmsg.toString() : "";
+		}
+	}
+
+	private PrintLogClient getPrintLogClient() {
+		if (this.m_PrintLogClient == null) {
+			this.m_PrintLogClient = new PrintLogClient();
+			this.m_PrintLogClient.addFreshTsListener(this);
+		}
+
+		return this.m_PrintLogClient;
+	}
+
+	private SaleInvoiceQueryDlg getQueryDlg() {
+		if (this.dlgQuery == null) {
+			this.dlgQuery = new SaleInvoiceQueryDlg(this);
+		}
+
+		return this.dlgQuery;
+	}
+
+	private int getShowState() {
+		return this.m_iShowState;
+	}
+
+	private SourceBillFlowDlg getSourceDlg() {
+		SourceBillFlowDlg soureDlg = new SourceBillFlowDlg(this, "32", this.getVo().getHeadVO().getCsaleid(),
+				this.getBillCardPanel().getBusiType(), this.getBillCardPanel().getOperator(),
+				this.getVo().getHeadVO().getVreceiptcode());
+		return soureDlg;
+	}
+
+	private SaleinvoiceVO getVOForAction() {
+		SaleinvoiceVO voInvoice = null;
+		if (this.getShowState() == 0) {
+			voInvoice = this.getBillListPanel().getVOForAction();
+		} else {
+			voInvoice = this.getBillCardPanel().getVOForAction();
+		}
+
+		return voInvoice;
+	}
+
+	private void initialize() {
+      this.setName("SaleInvoice");
+      this.setSize(774, 419);
+      this.add(this.getBillCardPanel(), "Center");
+      BillTools.addReSortRowNoToPopMenu(this.getBillCardPanel(), (String)null);
+      BillTools.addCardEditToBodyMenus(this.getBillCardPanel(), (String)null);
+      UIMenuItem[] bodyMenuItems = this.getBillCardPanel().getBodyMenuItems();
+      int ilength = bodyMenuItems.length;
+      if (ilength > 2) {
+    	    bodyMenuItems[ilength-1].addActionListener(new ActionListener(){
+    	        public void actionPerformed(ActionEvent e) {
+    	              onBoCardEdit();            
+    	        }});
+    	    bodyMenuItems[ilength-2].addActionListener(new ActionListener(){
+    	      public void actionPerformed(ActionEvent e) {
+    	        nc.ui.scm.pub.report.BillRowNo.addNewRowNo(getBillCardPanel(), 
+    	            SaleBillType.SaleInvoice, "crowno");          
+    	      }});
+         
+         
+      }
+
+      this.getBillCardPanel().setBusiType(this.getBtns().getBusiType());
+      this.setShowState(1);
+      this.setOperationState(2);
+      this.setButtons(this.getBtns().getButtonArray());
+      this.setButtonsStateBrowse();
+      this.getBillCardPanel().addActionListener(this);
+      this.getBillCardPanel().setEnabled(false);
+      this.getBillListPanel().addMouseListener(this);
+      this.getBillListPanel().showPagePanel(this);
+   }
+
+	private void onApprove() {
+		SaleinvoiceVO voInvoice = this.getVOForAction();
+		voInvoice.setCl(new ClientLink(this.getClientEnvironment()));
+		HashMap hsnewvo = null;
+
+		String res;
+		try {
+			if (SaleInvoiceTools.getLoginDate().before(voInvoice.getHeadVO().getDbilldate())) {
+				throw new BusinessException(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000659"));
+			}
+
+			voInvoice.getHeadVO().setDapprovedate(this.getClientEnvironment().getDate());
+			voInvoice.getHeadVO().setDaudittime(new UFDateTime(System.currentTimeMillis()));
+			hsnewvo = (HashMap) PfUtilClient.processActionFlow(this, "APPROVE", "32",
+					this.getClientEnvironment().getDate().toString(), voInvoice, (Object) null);
+		} catch (ArapBusinessException var5) {
+			res = var5.m_ResMessage.strMessage;
+			MessageDialog.showHintDlg(this, NCLangRes.getInstance().getStrByID("40040401", "UPPSCMCommon-000270"), res);
+		} catch (Exception var6) {
+			this.showErrorMessage(var6.getMessage());
+			SCMEnv.out(var6.getMessage());
+			return;
+		}
+
+		if (!PfUtilClient.isSuccess()) {
+			this.showHintMessage(NCLangRes.getInstance().getStrByID("40060301", "UPP40060301-000254"));
+		} else {
+			this.updateUIValue(hsnewvo);
+			int status = -1;
+			if (this.getShowState() == 0) {
+				status = this.getVOCache().getCurrentVO().getHeadVO().getFstatus();
+			} else if (this.getShowState() == 1) {
+				status = SmartVODataUtils.getInteger(this.getBillCardPanel().getHeadItem("fstatus").getValueObject());
+			}
+
+			res = NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100095");
+			if (7 == status) {
+				res = res + NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000088");
+			} else if (8 == status) {
+				res = res + NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100096");
+			} else if (1 == status) {
+				res = res + NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100097");
+			} else {
+				res = res + NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-100098");
+			}
+
+			this.showHintMessage(res);
+		}
+	}
+
+	private boolean onApprove(SaleinvoiceVO saleinvoice) throws Exception {
+		if (null != saleinvoice && null != saleinvoice.getHeadVO()) {
+			try {
+				if (SaleInvoiceTools.getLoginDate().before(saleinvoice.getHeadVO().getDbilldate())) {
+					throw new BusinessException(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000671"));
+				} else {
+					Object otemp = PfUtilClient.processActionFlow(this, "APPROVE", "32",
+							this.getClientEnvironment().getDate().toString(), saleinvoice, (Object) null);
+					if (null != otemp) {
+						String ErrMsg = otemp.toString();
+						if (ErrMsg != null && ErrMsg.startsWith("ERR")) {
+							ShowToolsInThread.showMessage(this.m_proccdlg, ErrMsg.substring(3));
+						}
+					}
+
+					return PfUtilClient.isSuccess();
+				}
+			} catch (Exception var4) {
+				throw var4;
+			}
+		} else {
+			return false;
+		}
+	}
+
+	private void onATP() {
+		try {
+			PfUtilClient.processActionNoSendMessage(this, "ATP", "32", this.getClientEnvironment().getDate().toString(),
+					this.getBillCardPanel().getVO(), this.getBillCardPanel().getVOOnlySelectedRow(), (String) null,
+					(AggregatedValueObject) null);
+		} catch (Exception var2) {
+			SCMEnv.out(var2.getMessage());
+			this.showErrorMessage(var2.getMessage());
+		}
+
+	}
+
+	private void onAuditFlowStatus() {
+		SaleinvoiceVO invoicevo = this.getVo();
+		if (null != invoicevo && invoicevo.getParentVO() != null) {
+			SaleVO header = invoicevo.getHeadVO();
+			String pk = header.getCsaleid();
+			if (pk == null) {
+				this.showErrorMessage(NCLangRes.getInstance().getStrByID("SCMCOMMON", "UPPSCMCommon-000067"));
+			} else {
+				FlowStateDlg approvestatedlg = new FlowStateDlg(this, "32", pk);
+				approvestatedlg.showModal();
+			}
+		} else {
+			this.showErrorMessage(NCLangRes.getInstance().getStrByID("SCMCOMMON", "UPPSCMCommon-000199"));
+		}
+
+	}
+
+	private void onBillCombin() {
+		SOCollectSettingDlg dlg = new SOCollectSettingDlg(this, "32", SaleInvoiceTools.getNodeCode(),
+				SaleInvoiceTools.getLoginPk_Corp(), SaleInvoiceTools.getLoginUserId(), SaleinvoiceVO.class.getName(),
+				SaleVO.class.getName(), SaleinvoiceBVO.class.getName());
+		dlg.setBilltype("32");
+		dlg.setNodecode(SaleInvoiceTools.getNodeCode());
+		Configuration configuation = Configuration.load(this.getClientEnvironment().getCorporation().getPk_corp());
+		ArrayList<String> aryfixgroup = new ArrayList();
+		if (configuation.isMergeInvClass()) {
+			aryfixgroup.add("invclasscode");
+			aryfixgroup.add("invclassname");
+			aryfixgroup.add("ccurrencytypename");
+			this.getBillCardPanel().getBodyItem("invclasscode").setShow(true);
+			this.getBillCardPanel().getBodyItem("invclassname").setShow(true);
+		} else {
+			aryfixgroup.add("cinventorycode");
+			aryfixgroup.add("cinventoryname");
+			aryfixgroup.add("GG");
+			aryfixgroup.add("XX");
+			aryfixgroup.add("ccurrencytypename");
+		}
+
+		if (configuation.isMergePrice()) {
+			aryfixgroup.add("noriginalcurtaxnetprice");
+		}
+
+		String[] fixgroup = new String[aryfixgroup.size()];
+		aryfixgroup.toArray(fixgroup);
+		String[] groupSel = SaleInvoiceCollectSetCache.getSaleInvoiceCollectSetCache("groupSel");
+		String[] sumSel = SaleInvoiceCollectSetCache.getSaleInvoiceCollectSetCache("sumSel");
+		String[] avgSel = SaleInvoiceCollectSetCache.getSaleInvoiceCollectSetCache("avgSel");
+		String[] proAvgSel = SaleInvoiceCollectSetCache.getSaleInvoiceCollectSetCache("proAvgSel");
+		fixgroup = groupSel == null ? fixgroup : groupSel;
+		String[] sumItems = new String[]{"noriginalcurtaxmny", "noriginalcurmny", "noriginalcursummny", "nnumber",
+				"noriginalcurdiscountmny", "ntaxmny", "nmny", "nsummny", "ndiscountmny", "nsimulatecostmny", "ncostmny",
+				"nsubsummny", "nsubcursummny"};
+		sumItems = sumSel == null ? sumItems : sumSel;
+		String[] proAvgItems = new String[]{"nsubtaxnetprice", "nsubqutaxnetpri", "nsubqunetpri", "nsubqutaxpri",
+				"nsubqupri", "nqutaxnetprice", "nqunetprice", "nqutaxprice", "nquprice", "nqocurtaxnetpri",
+				"nquoricurnetpri", "nquoricurtaxpri", "nquoricurpri", "ntaxnetprice", "nnetprice", "ntaxprice",
+				"nprice", "noriginalcurtaxnetprice", "noriginalcurnetprice", "noriginalcurtaxprice",
+				"noriginalcurprice"};
+		proAvgItems = proAvgSel == null ? proAvgItems : proAvgSel;
+		dlg.initData(this.getBillCardPanel(), fixgroup, (String[]) null, sumItems, avgSel, proAvgItems, "nnumber");
+		dlg.showModal();
+		this.showHintMessage(NCLangRes.getInstance().getStrByID("40060501", "UPT40060501-000058"));
+	}
+
+	private void onBlankOut() {
+		if (MessageDialog.showYesNoDlg(this, NCLangRes.getInstance().getStrByID("common", "UC001-0000039"),
+				NCLangRes.getInstance().getStrByID("common", "UCH002")) == 4) {
+			SaleinvoiceVO voInvoice = this.getVOForAction();
+			if (voInvoice.getHeadVO().isStrike()) {
+				if (MessageDialog.showYesNoDlg(this, NCLangRes.getInstance().getStrByID("common", "UC001-0000039"),
+						NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000161")) != 4) {
+					return;
+				}
+
+				if (null == voInvoice.getHsSelectedARSubHVO() || voInvoice.getHsSelectedARSubHVO().size() == 0) {
+					try {
+						Hashtable htstrike = SaleinvoiceBO_Client
+								.queryStrikeData(voInvoice.getHeadVO().getPrimaryKey());
+						voInvoice.setHsSelectedARSubHVO(htstrike);
+					} catch (Exception var4) {
+						SCMEnv.out(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000658")
+								+ var4.getMessage());
+						return;
+					}
+				}
+			}
+
+			voInvoice.setAllinvoicevo(voInvoice);
+			voInvoice.setBstrikeflag(new UFBoolean(false));
+
+			try {
+				this.getPluginProxy().beforeAction(Action.DELETE, new SaleinvoiceVO[]{voInvoice});
+				this.onDelete(voInvoice);
+			} catch (Exception var3) {
+				this.showErrorMessage(var3.getMessage());
+				SCMEnv.out(var3.getMessage());
+				return;
+			}
+
+			this.getVOCache().removeVOBy(voInvoice.getHeadVO().getCsaleid());
+			if (this.getShowState() == 0) {
+				this.getBillListPanel().getHeadBillModel()
+						.delLine(new int[]{this.getBillListPanel().getHeadTable().getSelectedRow()});
+				this.getBillListPanel().updateUI();
+			} else {
+				this.getBillCardPanel().loadCardData(this.getVOCache().getVO_Load(this.getVOCache().getPos()));
+			}
+
+			this.setOperationState(2);
+			this.setButtonsStateBrowse();
+		}
+	}
+
+	private void onBoCardEdit() {
+		this.getBillCardPanel().startRowCardEdit();
+	}
+
+	private void onBusiType(ButtonObject bo) {
+		bo.setSelected(true);
+		this.getBillCardPanel().setBusiType(bo.getTag());
+		this.getBtns().changeButtonsWhenBusiTypeSelected(bo);
+		this.setButtons(this.getBtns().getButtonArray());
+		this.setOperationState(2);
+		this.setButtonsStateBrowse();
+		this.setTitleText(this.getBillCardPanel().getTitle());
+	}
+
+	private void onCancelSave() {
+		if (null != this.getVOCache().getCurrentVO() && null != this.getVOCache().getCurrentVO().getHeadVO()
+				&& this.getVOCache().getCurrentVO().getHeadVO().isNew()
+				&& !this.getBillCardPanel().isOutSumMakeInvoice()) {
+			this.getVOCache().removeVOAt(this.getVOCache().getPos());
+		}
+
+		if (null == this.getVOCache().getCurrentVO() && null != this.getVOCache().getOldVO()
+				&& null != this.getVOCache().getOldVO().getHeadVO()) {
+			String csaleid = this.getVOCache().getOldVO().getHeadVO().getCsaleid();
+			this.getVOCache().setPos(this.getVOCache().findPos(csaleid));
+		}
+
+		this.getBillCardPanel().setPanelAfterCancelSave(this.getVOCache().getCurrentVO());
+		this.setOperationState(2);
+		this.setButtonsStateBrowse();
+		this.showHintMessage("");
+		this.getBillCardPanel().setOutSumMakeInvoice(false);
+		this.updateUI();
+	}
+
+	private void onCancelTransfer() {
+		if (this.getShowState() == 0) {
+			int[] iaSerialNum = this.getBillListPanel().getHeadTable().getSelectedRows();
+
+			for (int i = iaSerialNum.length - 1; i >= 0; --i) {
+				if (this.getVOCache().getVO_Load(iaSerialNum[i]).getHeadVO().isNew()) {
+					this.getVOCache().removeVOAt(iaSerialNum[i]);
+				}
+			}
+
+			this.getBillListPanel().getHeadBillModel().delLine(iaSerialNum);
+			this.getBillListPanel().updateUI();
+		} else {
+			this.getVOCache().removeVOAt(this.getVOCache().getPos());
+			this.getBillCardPanel().loadCardData(this.getVOCache().getVO_Load(this.getVOCache().rollToNextPos()));
+		}
+
+		this.setButtonsStateBrowse();
+	}
+
+	private void onCard() {
+		if (this.getShowState() == 0) {
+			this.remove(this.getBillListPanel());
+			this.add(this.getBillCardPanel(), "Center");
+			this.getVOCache().setPos(this.getBillListPanel().getHeadTable().getSelectedRow());
+		}
+
+		this.getBillCardPanel().loadCardData(this.getVOCache().getVO_Load(this.getVOCache().getPos()));
+		this.showHintMessage(NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000065"));
+		DefSetTool.updateCardDefValues(this.getBillCardPanel().getBillData(), "vdef", "pk_defdoc");
+		this.setShowState(1);
+		this.setOperationState(2);
+		this.setButtonsStateBrowse();
+		this.getBillCardPanel().setEnabled(false);
+		this.updateUI();
+	}
+
+	private void onCustCredit() {
+		String sCust = null;
+		String sBiztype = null;
+		String cproductid = null;
+		if (this.getShowState() == 0) {
+			int iselbodyrow = this.getBillListPanel().getBodyTable().getSelectedRow();
+			if (iselbodyrow < 0) {
+				iselbodyrow = 0;
+			}
+
+			Object oTemp = this.getBillListPanel().getBodyBillModel().getValueAt(iselbodyrow, "ccustomerid");
+			sCust = oTemp == null ? null : oTemp.toString();
+			oTemp = this.getBillListPanel().getHeadBillModel()
+					.getValueAt(this.getBillListPanel().getHeadTable().getSelectedRow(), "cbiztype");
+			sBiztype = oTemp == null ? null : oTemp.toString();
+			if (this.st.SO_27 != null && this.st.SO_27.booleanValue()
+					&& this.getBillListPanel().getBodyBillModel().getRowCount() > 0) {
+				cproductid = (String) this.getBillListPanel().getBodyBillModel().getValueAt(0, "cprolineid");
+			}
+		} else {
+			sCust = this.getBillCardPanel().getCCustomerid();
+			sBiztype = this.getBillCardPanel().getBusiType();
+			if (this.st.SO_27 != null && this.st.SO_27.booleanValue() && this.getBillCardPanel().getRowCount() > 0) {
+				cproductid = (String) this.getBillCardPanel().getBodyValueAt(0, "cprolineid");
+			}
+		}
+
+		CustCreditVO voCredit = new CustCreditVO();
+		voCredit.setPk_cumandoc(sCust);
+		voCredit.setCbiztype(sBiztype);
+		voCredit.setCproductline(cproductid);
+
+		try {
+			PfUtilClient.processActionFlow(this, "CustCredited", "32", this.getClientEnvironment().getDate().toString(),
+					this.getVo(), voCredit);
+		} catch (BusinessException var6) {
+			this.showErrorMessage(var6.getMessage());
+			var6.printStackTrace();
+		} catch (Exception var7) {
+			this.showErrorMessage(var7.getMessage());
+			SCMEnv.out(var7.getMessage());
+		}
+
+	}
+
+	private void onCustInfo() {
+		Object ob = null;
+		if (this.getShowState() == 0) {
+			ob = this.getBillListPanel().getHeadBillModel()
+					.getValueAt(this.getBillListPanel().getHeadTable().getSelectedRow(), "creceiptcorpid");
+		} else {
+			ob = this.getBillCardPanel().getHeadItem("creceiptcorpid").getValue();
+		}
+
+		try {
+			PfUtilClient.processActionNoSendMessage(this, "CustInfo", "32",
+					this.getClientEnvironment().getDate().toString(), this.getVOForAction(), ob, (String) null,
+					(AggregatedValueObject) null);
+		} catch (Exception var3) {
+			this.showErrorMessage(this.getBtns().m_boCustInfo.getName()
+					+ NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000069"));
+			SCMEnv.out(var3.getMessage());
+		}
+
+	}
+
+	private boolean onDelete(SaleinvoiceVO vo) throws Exception {
+		if (vo == null) {
+			return false;
+		} else {
+			vo.getHeadVO().setVoldreceiptcode(vo.getHeadVO().getVreceiptcode());
+			vo.setCl(new ClientLink(this.getClientEnvironment()));
+			vo.setStatus(3);
+			vo.getParentVO().setStatus(3);
+			SaleVO newsourheadvo = null;
+
+			try {
+				newsourheadvo = (SaleVO) PfUtilClient.processActionFlow(this, "SoBlankOut", "32",
+						this.getClientEnvironment().getDate().toString(), vo, (Object) null);
+			} catch (Exception var9) {
+				throw var9;
+			}
+
+			SaleVO blankhead = vo.getHeadVO();
+			if (2 == blankhead.getFcounteractflag() && null != newsourheadvo) {
+				String newbillid = newsourheadvo.getCsaleid();
+				int i = 0;
+
+				for (int iloop = this.getBillListPanel().getHeadBillModel().getRowCount(); i < iloop; ++i) {
+					String currentpk = (String) this.getBillListPanel().getHeadBillModel().getValueAt(i, "csaleid");
+					if (newbillid.equals(currentpk)) {
+						SaleinvoiceVO oldvo = this.getVOCache().getVO_Load(newbillid);
+						if (oldvo != null) {
+							oldvo.getHeadVO().setTs(newsourheadvo.getTs());
+							oldvo.getHeadVO().setFcounteractflag(newsourheadvo.getFcounteractflag());
+							this.getVOCache().setSaleinvoiceVO(newbillid, oldvo);
+							this.getBillListPanel().getHeadBillModel().setValueAt(newsourheadvo.getTs(), i, "ts");
+							this.getBillListPanel().getHeadBillModel().setValueAt(newsourheadvo.getFcounteractflag(), i,
+									"fcounteractflag");
+						}
+					}
+				}
+			}
+
+			if (PfUtilClient.isSuccess()) {
+				this.showHintMessage(NCLangRes.getInstance().getStrByID("scmsopreor", "UPPscmsopreor-000055"));
+				return true;
+			} else {
+				return false;
+			}
+		}
+	}
+
+	private void onDocument() {
+		this.showHintMessage(this.getBtns().m_boDocument.getHint());
+		String id = null;
+		if (this.getShowState() == 0) {
+			int selectrow = this.getBillListPanel().getHeadTable().getSelectedRow();
+			id = this.getBillListPanel().getHeadBillModel().getValueAt(selectrow, "csaleid").toString();
+		} else {
+			id = (String) this.getBillCardPanel().getHeadItem("csaleid").getValueObject();
+		}
+
+		SaleinvoiceVO voInv = this.getVo();
+		if (voInv != null && voInv.getHeadVO() != null && id != null && !"".equals(id)) {
+			SysInitVO m_voBillStatus = null;
+
+			try {
+				m_voBillStatus = SysInitBO_Client.queryByParaCode("0001", "SCM21");
+			} catch (BusinessException var10) {
+				SCMEnv.error(var10);
+				this.showErrorMessage("获取参数SCM20出错" + var10.getMessage());
+			}
+
+			String paramValue = m_voBillStatus.getValue();
+			String enable = "true";
+			if (paramValue == null || "".equals(paramValue)) {
+				enable = "false";
+			}
+
+			SaleVO head = voInv.getHeadVO();
+			String billcode = head.getVreceiptcode();
+			Integer billstatus = head.getFstatus() == null ? new Integer(1) : head.getFstatus();
+			if (UFBoolean.valueOf(enable).booleanValue() && !"12345678".equals(paramValue) && !paramValue
+					.contains((CharSequence) EditDocBillStatusParamConst.SO_STATUS.get(String.valueOf(billstatus)))) {
+				enable = "false";
+			}
+
+			BtnPowerVO pVo = new BtnPowerVO(billcode, enable, enable, "true", enable);
+			DocumentManager.showDM(this, "32", id, pVo);
+		}
+	}
+
+	private void onExecQuery() {
+		SaleinvoiceVO voInv = this.getVo();
+		if (voInv != null) {
+			try {
+				PfUtilClient.processActionNoSendMessage(this, "InvoiceExecRpt", "32",
+						this.getClientEnvironment().getDate().toString(), voInv, voInv.getHeadVO().getCsaleid(),
+						(String) null, (AggregatedValueObject) null);
+			} catch (Exception var3) {
+				this.showErrorMessage(NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000069"));
+				SCMEnv.out(var3.getMessage());
+			}
+
+		}
+	}
+
+	private void onFetchCost() {
+		SaleinvoiceVO saleinvoice = (SaleinvoiceVO) this.getBillCardPanel()
+				.getBillValueVO(SaleinvoiceVO.class.getName(), SaleVO.class.getName(), SaleinvoiceBVO.class.getName());
+		if (null != saleinvoice && null != saleinvoice.getHeadVO() && null != saleinvoice.getBodyVO()) {
+			SaleinvoiceBVO[] body = saleinvoice.getBodyVO();
+			Hashtable<String, Integer> saleout = new Hashtable();
+			ArrayList<String> aryrowno = new ArrayList();
+			ArrayList<Integer> errindex = new ArrayList();
+		
+			for (int i=0,iloop = body.length;i<iloop;i++){
+				if ("4C".equals(body[i].getCupreceipttype()) && null != body[i].getCupsourcebillbodyid()) {
+					saleout.put(body[i].getCupsourcebillbodyid(), i);
+				}
+			}
+
+			Hashtable hcostprice = new Hashtable();
+			Set<String> keyset = saleout.keySet();
+			String[] saleoutbid = null;
+			if (keyset.size() > 0) {
+				try {
+					saleoutbid = new String[keyset.size()];
+					keyset.toArray(saleoutbid);
+					hcostprice = SaleinvoiceBO_Client.queryCostPrice(saleoutbid);
+				} catch (Exception var20) {
+					SCMEnv.out(var20.getMessage());
+					MessageDialog.showErrorDlg(this,
+							NCLangRes.getInstance().getStrByID("scmcommon", "UPPSCMCommon-000059"), var20.getMessage());
+				}
+
+				for (int i=0,iloop =saleoutbid.length;i<iloop;i++){
+					int row = (Integer) saleout.get(saleoutbid[i]);
+					UFDouble nexchangeotobrate = body[row].getNexchangeotobrate();
+					if (hcostprice.containsKey(saleoutbid[i]) && hcostprice.get(saleoutbid[i]) != null) {
+						UFDouble ncostprice = new UFDouble((BigDecimal) hcostprice.get(saleoutbid[i]));
+						UFDouble noriginalcurprice = null;
+
+						try {
+							String pk_corp = saleinvoice.getHeadVO().getPk_corp();
+							BusinessCurrencyRateUtil currateutil = new BusinessCurrencyRateUtil(pk_corp);
+							SOCurrencyRateUtil socurrateutil = new SOCurrencyRateUtil(pk_corp);
+							String pk_curtype = saleinvoice.getHeadVO().getCcurrencyid();
+							noriginalcurprice = currateutil.getAmountByOpp(socurrateutil.getLocalCurrPK(), pk_curtype,
+									ncostprice, nexchangeotobrate,
+									saleinvoice.getHeadVO().getDbilldate() == null
+											? this.getClientEnvironment().getDate().toString()
+											: saleinvoice.getHeadVO().getDbilldate().toString());
+						} catch (Exception var19) {
+							SCMEnv.out(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000672") + var19);
+							this.showErrorMessage(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000673")
+									+ var19.getMessage());
+							return;
+						}
+
+						UFDouble ndiscountrate;
+						UFDouble nitemdiscount;
+						if (this.st.SA_02.booleanValue()) {
+							ndiscountrate = body[row].getNtaxrate() == null ? new UFDouble(0) : body[row].getNtaxrate();
+							nitemdiscount = noriginalcurprice
+									.multiply((new UFDouble(1)).add(ndiscountrate.div(new UFDouble(100))));
+							this.getBillCardPanel().setBodyValueAt(nitemdiscount, row, "noriginalcurtaxnetprice");
+						} else {
+							this.getBillCardPanel().setBodyValueAt(noriginalcurprice, row, "noriginalcurnetprice");
+						}
+
+						ndiscountrate = this.getBillCardPanel().getBodyValueAt(row, "ndiscountrate") == null
+								? new UFDouble(100)
+								: SmartVODataUtils
+										.getUFDouble(this.getBillCardPanel().getBodyValueAt(row, "ndiscountrate"));
+						nitemdiscount = this.getBillCardPanel().getBodyValueAt(row, "nitemdiscountrate") == null
+								? new UFDouble(100)
+								: SmartVODataUtils
+										.getUFDouble(this.getBillCardPanel().getBodyValueAt(row, "nitemdiscountrate"));
+						this.getBillCardPanel().setBodyValueAt(
+								ndiscountrate.multiply(nitemdiscount).div(new UFDouble(100)), row, "ndiscountrate");
+						RelationsCal.calculate(row, this.getBillCardPanel(),
+								this.getBillCardPanel().getCalculatePara("noriginalcurtaxnetprice"),
+								"noriginalcurtaxnetprice", SaleinvoiceBVO.getDescriptions(), SaleinvoiceBVO.getKeys(),
+								"nc.vo.so.so002.SaleinvoiceBVO", "nc.vo.so.so002.SaleVO");
+						this.getBillCardPanel().setBodyValueAt(ndiscountrate, row, "ndiscountrate");
+						this.getBillCardPanel().setBodyValueAt(
+								this.getBillCardPanel().getBodyValueAt(row, "noriginalcursummny"), row, "nsubsummny");
+						this.getBillCardPanel().setBodyValueAt(this.getBillCardPanel().getBodyValueAt(row, "nsummny"),
+								row, "nsubcursummny");
+					} else {
+						aryrowno.add(body[row].getCrowno());
+						errindex.add(row);
+					}
+				}
+			}
+
+			if (aryrowno.size() > 0) {
+				StringBuilder errstr = new StringBuilder();
+
+				for (int i=0;i<aryrowno.size();i++){
+					errstr.append(">").append((String) aryrowno.get(i)).append(
+							"< " + NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000674") + " \n");
+				}
+
+				SetColor.setErrRowColor(this.getBillCardPanel(), errindex);
+				this.showErrorMessage(errstr.toString());
+				this.existErrRows = true;
+			}
+
+			this.getBillCardPanel().setHeadItem("ninvoicediscountrate", new UFDouble(100));
+			this.getBillCardPanel().setHeadItem("ntotalsummny",
+					this.getBillCardPanel().calcurateTotal("noriginalcursummny"));
+			this.getBillCardPanel().execHeadFormula("nnetmny->ntotalsummny-nstrikemny");
+		}
+	}
+
+	private void onFirst() {
+		this.getVOCache().rollToFirstPos();
+		SaleinvoiceVO voCur = this.getVOCache().getCurrentVO();
+		this.getBillCardPanel().loadCardData(voCur);
+		this.setOperationState(2);
+		this.setButtonsStateBrowse();
+	}
+
+	private void onImportTaxCode() {
+		try {
+			GoldTaxVO[] goldTaxVOs = (new TransGoldTaxDlg(this)).importGoldTax();
+			if (goldTaxVOs == null) {
+				return;
+			}
+
+			if (goldTaxVOs.length == 0) {
+				this.showErrorMessage("从选择的文件中,未找到可导入的数据!");
+				return;
+			}
+
+			SCMEnv.out("导入金税VO数组长度 goldTaxVOs.length = " + goldTaxVOs.length);
+			String[][] invoicetypes = this.getSaleinvoiceTools().getInvoiceType();
+			String pk_corp = ClientEnvironment.getInstance().getCorporation().getPk_corp();
+			Map<String, String> typeMap = new HashMap();
+			String[][] var5 = invoicetypes;
+			int i = invoicetypes.length;
+
+			int results;
+			for (results = 0; results < i; ++results) {
+				String[] invoicetype = var5[results];
+				typeMap.put(invoicetype[1], invoicetype[0]);
+			}
+
+			HashMap<String, SaleVO> hmHeadVO = new HashMap();
+
+			for (i = 0; i < goldTaxVOs.length; ++i) {
+				GoldTaxHeadVO taxHeadVO = goldTaxVOs[i].getParentVO();
+				String billcode = taxHeadVO.getCode();
+				SaleVO saleVO;
+				String typeInt;
+				String taxno;
+				if (hmHeadVO.containsKey(billcode)) {
+					saleVO = (SaleVO) hmHeadVO.get(billcode);
+					typeInt = saleVO.getCgoldtaxcode() == null ? "" : saleVO.getCgoldtaxcode();
+					taxno = taxHeadVO.getTaxBillNo() == null ? "" : taxHeadVO.getTaxBillNo();
+					saleVO.setCgoldtaxcode(typeInt + "," + taxno);
+				} else {
+					saleVO = new SaleVO();
+					saleVO.setPk_corp(pk_corp);
+					saleVO.setVreceiptcode(taxHeadVO.getCode());
+					typeInt = (String) typeMap.get(taxHeadVO.getMemo());
+					if (typeInt != null) {
+						saleVO.setFinvoicetype(Integer.valueOf(typeInt));
+					}
+
+					saleVO.setDeinvdate(taxHeadVO.getBillDate());
+					saleVO.setPk_corp(this.getCorpPrimaryKey());
+					taxno = taxHeadVO.getTaxBillNo();
+					saleVO.setCgoldtaxcode(taxHeadVO.getTaxBillNo());
+					if (taxno.indexOf(",") != -1) {
+						saleVO.setVeinvcode(taxno.split(",")[0]);
+						saleVO.setVeinvnumber(taxno.split(",")[1]);
+					}
+
+					hmHeadVO.put(taxHeadVO.getCode(), saleVO);
+				}
+			}
+
+			SaleVO[] voHeads = (SaleVO[]) hmHeadVO.values().toArray(new SaleVO[0]);
+			results = SaleinvoiceBO_Client.updateSaleinvoiceValue(voHeads,
+					new String[]{"deinvdate", "cgoldtaxcode", "veinvcode", "veinvnumber"},
+					new String[]{"vreceiptcode", "pk_corp"});
+			this.showHintMessage(
+					NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000661") + results + "条数据");
+		} catch (Exception var12) {
+			SCMEnv.error(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000662"), var12);
+			this.showErrorMessage(
+					NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000663") + var12.getMessage());
+		}
+
+	}
+
+	private void onLast() {
+		this.getVOCache().rollToLastPos();
+		SaleinvoiceVO voCur = this.getVOCache().getCurrentVO();
+		this.getBillCardPanel().loadCardData(voCur);
+		this.setOperationState(2);
+		this.setButtonsStateBrowse();
+	}
+
+	private void onList() {
+		this.remove(this.getBillCardPanel());
+		this.add(this.getBillListPanel(), "Center");
+		this.getBillListPanel().reLoadData(this.getVOCache());
+		this.setShowState(0);
+		this.setOperationState(2);
+		this.setButtonsStateBrowse();
+		this.updateUI();
+		this.getBillListPanel().getHeadTable().getSelectionModel().setSelectionInterval(this.getVOCache().getPos(),
+				this.getVOCache().getPos());
+	}
+
+	private void onLocal() {
+		LocateDialog dlg = new LocateDialog(this, this.getBillListPanel().getHeadTable());
+		dlg.showModal();
+	}
+
+	private void onModify() {
+		if (this.getShowState() == 0) {
+			int iRow = this.getBillListPanel().getHeadTable().getSelectedRow();
+			if (iRow < 0) {
+				this.showErrorMessage(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000667"));
+				return;
+			}
+
+			this.getVOCache().setPos(iRow);
+			this.remove(this.getBillListPanel());
+			this.repaint();
+			this.add(this.getBillCardPanel(), "Center");
+			this.setShowState(1);
+			this.getBillCardPanel().loadCardData(this.getVOCache().getCurrentVO());
+		}
+
+		SaleinvoiceVO VO = this.getVOCache().getCurrentVO();
+		this.getBillCardPanel().modify(VO);
+		this.changeRefAddButtonByBusiType(VO.getHeadVO().getCbiztype());
+		BillItem item = this.getBillCardPanel().getHeadItem("ccustbankid");
+		UIRefPane bankref = null;
+		if (item.getDataType() == 5) {
+			bankref = (UIRefPane) item.getComponent();
+			if (bankref.getRefModel() != null) {
+				bankref.getRefModel().setPk_corp(this.getCorpPrimaryKey());
+			}
+		}
+
+		item = this.getBillCardPanel().getHeadItem("ccustomerbank");
+		if (item.getDataType() == 5) {
+			bankref = (UIRefPane) item.getComponent();
+			if (bankref.getRefModel() != null) {
+				bankref.getRefModel().setPk_corp(this.getCorpPrimaryKey());
+			}
+		}
+
+		String[] removeFields = new String[]{"alrconfinconum", "alrconfincomny"};
+
+		for (int j = 0; j < VO.getBodyVO().length; ++j) {
+			for (int i = 0; i < removeFields.length; ++i) {
+				this.getBillCardPanel().setBodyValueAt((Object) null, j, removeFields[i]);
+			}
+		}
+
+		String bankId = VO.getParentVO().getCcustbankid();
+		bankref.setPK(bankId);
+		String bankNo = bankref.getRefCode();
+		this.getBillCardPanel().setHeadItem("ccustomerbankNo", bankNo);
+		this.setOperationState(6);
+		this.setButtonsStateEdit();
+		this.showHintMessage(NCLangRes.getInstance().getStrByID("SCMCommon", "UPPSCMCommon-000350"));
+	}
+
+	private void onNew(ButtonObject bo) {
+		PfUtilClient.childButtonClicked(bo, SaleInvoiceTools.getLoginPk_Corp(), "40060302",
+				SaleInvoiceTools.getLoginUserId(), "32", this);
+		SaleinvoiceVO[] vosNew = null;
+		if (!PfUtilClient.makeFlag && PfUtilClient.isCloseOK()) {
+			vosNew = (SaleinvoiceVO[]) ((SaleinvoiceVO[]) PfUtilClient.getRetVos());
+		}
+
+		if (null != vosNew && vosNew.length != 0) {
+			SaleinvoiceSplitTools splittools = new SaleinvoiceSplitTools();
+			SaleinvoiceVO[] aryRetVO = splittools.splitSaleinvoiceVOs(vosNew);
+			SaleinvoiceDealMnyTools dealmnytools = new SaleinvoiceDealMnyTools();
+			dealmnytools.dealMny(aryRetVO);
+			this.processNewVO(aryRetVO);
+			if (aryRetVO.length > 1) {
+				this.getVOCache().setCacheData(aryRetVO);
+				this.onList();
+			} else {
+				this.getVOCache().addVO(aryRetVO[0]);
+				this.getVOCache().rollToLastPos();
+				if (0 == this.getShowState()) {
+					this.remove(this.getBillListPanel());
+					this.add(this.getBillCardPanel(), "Center");
+				}
+
+				this.getBillCardPanel().loadCardData(aryRetVO[0]);
+				this.getBillCardPanel().modify(aryRetVO[0]);
+				DefSetTool.updateCardDefValues(this.getBillCardPanel().getBillData(), "vdef", "pk_defdoc");
+				this.setShowState(1);
+				this.setOperationState(6);
+				this.showHintMessage(NCLangRes.getInstance().getStrByID("SCMCommon", "UPPSCMCommon-000350"));
+				this.setButtonsStateEdit();
+			}
+
+		}
+	}
+
+	private void onNext() {
+		this.getVOCache().rollToNextPos();
+		SaleinvoiceVO voCur = this.getVOCache().getCurrentVO();
+		this.getBillCardPanel().loadCardData(voCur);
+		this.setOperationState(2);
+		this.setButtonsStateBrowse();
+	}
+
+	private void onOpposeAct() {
+		SaleinvoiceVO voOld = this.getVo();
+		SaleinvoiceVO voOpp = null;
+
+		try {
+			voOpp = SaleInvoiceTools.getOppVO(voOld);
+		} catch (Exception var4) {
+			SCMEnv.out(var4);
+			MessageDialog.showErrorDlg(this, "", var4.getMessage());
+			return;
+		}
+
+		if (voOpp != null) {
+			if (this.getShowState() == 0) {
+				this.remove(this.getBillListPanel());
+				this.add(this.getBillCardPanel(), "Center");
+			}
+
+			this.getBillCardPanel().setPanelWhenOPP(voOpp);
+			this.setShowState(1);
+			this.setButtonsStateBrowse();
+			this.setOperationState(11);
+			this.setButtonsStateOPP();
+		}
+	}
+
+	private void onOrderQuery() {
+		this.showHintMessage(this.getBtns().m_boOrderQuery.getHint());
+		this.getSourceDlg().showModal();
+	}
+
+	private void onOutSumMakeInvoice() {
+		if (this.getShowState() == 0) {
+			this.remove(this.getBillListPanel());
+			this.add(this.getBillCardPanel(), "Center");
+			this.setShowState(1);
+		}
+
+		this.getBillCardPanel().setPanelWhenOutSumMakeInvoice();
+		this.getBillCardPanel().getHeadItem("finvoicetype").setValue(this.getDefaultInvoiceType());
+		this.setOperationState(6);
+		this.setButtonsStateEdit();
+	}
+
+	private void onPrev() {
+		this.getVOCache().rollToPreviousPos();
+		SaleinvoiceVO voCur = this.getVOCache().getCurrentVO();
+		this.getBillCardPanel().loadCardData(voCur);
+		this.setOperationState(2);
+		this.setButtonsStateBrowse();
+	}
+
+	private void onPrifit() {
+		ProfitVO voProfit = new ProfitVO();
+		int i;
+		ProfitItemVO bodyVO;
+		String gg;
+		String xx;
+		ProfitItemVO[] bodyVOs;
+		if (this.getShowState() == 0) {
+			int row = this.getBillListPanel().getHeadTable().getSelectedRow();
+			ProfitHeaderVO headVO = new ProfitHeaderVO();
+			headVO.setPkcorp(this.getCorpPrimaryKey());
+			headVO.setCcalbodyid((String) this.getBillListPanel().getHeadBillModel().getValueAt(row, "ccalbodyid"));
+			headVO.setCcalbodyname((String) this.getBillListPanel().getHeadBillModel().getValueAt(row, "ccalbodyname"));
+			headVO.setBilltype(this.getBillListPanel().getBillType());
+			if (this.getBillListPanel().getBodyTable().getRowCount() > 0) {
+				String curID = (String) ((String) this.getBillListPanel().getBodyBillModel().getValueAt(0,
+						"ccurrencytypeid"));
+				headVO.setCurrencyid(curID);
+			}
+
+			bodyVOs = new ProfitItemVO[this.getBillListPanel().getBodyBillModel().getRowCount()];
+
+			for (i = 0; i < bodyVOs.length; ++i) {
+				bodyVO = new ProfitItemVO();
+				bodyVO.setCinventoryid(
+						(String) this.getBillListPanel().getBodyBillModel().getValueAt(i, "cinventoryid"));
+				bodyVO.setCode((String) this.getBillListPanel().getBodyBillModel().getValueAt(i, "cinventorycode"));
+				bodyVO.setName((String) this.getBillListPanel().getBodyBillModel().getValueAt(i, "cinventoryname"));
+				gg = (String) this.getBillListPanel().getBodyBillModel().getValueAt(i, "GG");
+				gg = gg == null ? "" : gg;
+				xx = (String) this.getBillListPanel().getBodyBillModel().getValueAt(i, "XX");
+				xx = xx == null ? "" : xx;
+				bodyVO.setSize(gg + xx);
+				bodyVO.setCbatchid((String) this.getBillListPanel().getBodyBillModel().getValueAt(i, "cbatchid"));
+				bodyVO.setNumber((UFDouble) this.getBillListPanel().getBodyBillModel().getValueAt(i, "nnumber"));
+				bodyVO.setNnetprice((UFDouble) this.getBillListPanel().getBodyBillModel().getValueAt(i, "nnetprice"));
+				bodyVO.setCbodycalbodyid(
+						(String) this.getBillListPanel().getBodyBillModel().getValueAt(i, "cadvisecalbodyid"));
+				bodyVO.setCbodycalbodyname(
+						(String) this.getBillListPanel().getBodyBillModel().getValueAt(i, "cadvisecalbodyname"));
+				bodyVO.setCbodywarehouseid(
+						(String) this.getBillListPanel().getBodyBillModel().getValueAt(i, "cbodywarehouseid"));
+				bodyVO.setCbodywarehousename(
+						(String) this.getBillListPanel().getBodyBillModel().getValueAt(i, "cbodywarehousename"));
+				if (this.getBillListPanel().getBodyBillModel().getValueAt(i, "blargessflag") != null
+						&& this.getBillListPanel().getBodyBillModel().getValueAt(i, "blargessflag").toString()
+								.equals("false")) {
+					bodyVO.m_blargessflag = new UFBoolean(false);
+				} else {
+					bodyVO.m_blargessflag = new UFBoolean(true);
+				}
+
+				bodyVO.setNmny((UFDouble) this.getBillListPanel().getBodyBillModel().getValueAt(i, "nmny"));
+				bodyVOs[i] = bodyVO;
+			}
+
+			voProfit.setParentVO(headVO);
+			voProfit.setChildrenVO(bodyVOs);
+		} else {
+			ProfitHeaderVO headVO = new ProfitHeaderVO();
+			headVO.setPkcorp(this.getCorpPrimaryKey());
+			headVO.setCcalbodyid(this.getBillCardPanel().getHeadItem("ccalbodyid").getValue());
+			UIRefPane ccalbodyid = (UIRefPane) this.getBillCardPanel().getHeadItem("ccalbodyid").getComponent();
+			headVO.setCcalbodyname(ccalbodyid.getRefName());
+			headVO.setBilltype(this.getBillCardPanel().getBillType());
+			headVO.setCurrencyid(this.getBillCardPanel().getHeadItem("ccurrencyid").getValue());
+			bodyVOs = new ProfitItemVO[this.getBillCardPanel().getRowCount()];
+
+			for (i = 0; i < bodyVOs.length; ++i) {
+				bodyVO = new ProfitItemVO();
+				bodyVO.setCinventoryid((String) this.getBillCardPanel().getBodyValueAt(i, "cinventoryid"));
+				bodyVO.setCode((String) this.getBillCardPanel().getBodyValueAt(i, "cinventorycode"));
+				bodyVO.setName((String) this.getBillCardPanel().getBodyValueAt(i, "cinventoryname"));
+				gg = (String) this.getBillCardPanel().getBodyValueAt(i, "GG");
+				gg = gg == null ? "" : gg;
+				xx = (String) this.getBillCardPanel().getBodyValueAt(i, "XX");
+				xx = xx == null ? "" : xx;
+				bodyVO.setSize(gg + xx);
+				bodyVO.setCbatchid((String) this.getBillCardPanel().getBodyValueAt(i, "cbatchid"));
+				bodyVO.setNumber((UFDouble) this.getBillCardPanel().getBodyValueAt(i, "nnumber"));
+				bodyVO.setNnetprice((UFDouble) this.getBillCardPanel().getBodyValueAt(i, "nnetprice"));
+				bodyVO.setCbodycalbodyid((String) this.getBillCardPanel().getBodyValueAt(i, "cadvisecalbodyid"));
+				bodyVO.setCbodycalbodyname((String) this.getBillCardPanel().getBodyValueAt(i, "cadvisecalbodyname"));
+				bodyVO.setCbodywarehouseid((String) this.getBillCardPanel().getBodyValueAt(i, "cbodywarehouseid"));
+				bodyVO.setCbodywarehousename((String) this.getBillCardPanel().getBodyValueAt(i, "cbodywarehousename"));
+				if (this.getBillCardPanel().getBodyValueAt(i, "blargessflag") != null
+						&& this.getBillCardPanel().getBodyValueAt(i, "blargessflag").toString().equals("false")) {
+					bodyVO.m_blargessflag = new UFBoolean(false);
+				} else {
+					bodyVO.m_blargessflag = new UFBoolean(true);
+				}
+
+				bodyVO.setNmny((UFDouble) this.getBillCardPanel().getBodyValueAt(i, "nmny"));
+				bodyVOs[i] = bodyVO;
+			}
+
+			voProfit.setParentVO(headVO);
+			voProfit.setChildrenVO(bodyVOs);
+		}
+
+		try {
+			PfUtilClient.processAction(this, "Prifit", "32", this.getClientEnvironment().getDate().toString(),
+					this.getBillCardPanel().getVO(), voProfit);
+		} catch (ValidationException var9) {
+			this.showErrorMessage(var9.getMessage());
+		} catch (Exception var10) {
+			this.showErrorMessage(NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000069"));
+			SCMEnv.out(var10.getMessage());
+		}
+
+	}
+
+	private void onPrint(boolean previewflag) {
+		boolean total = this.getBillCardPanel().getBodyPanel().isTatolRow();
+		this.getBillCardPanel().getBodyPanel().setTotalRowShow(false);
+
+		try {
+			ArrayList<SaleinvoiceVO> alPrintVO = new ArrayList();
+			int[] selectRows;
+			if (0 == this.getShowState() && !previewflag) {
+				selectRows = this.getBillListPanel().getHeadTable().getSelectedRows();
+				int i = 0;
+
+				for (int iloop = selectRows.length; i < iloop; ++i) {
+					this.getBillCardPanel().loadCardData(this.getVOCache().getVO_Load(selectRows[i]));
+					SaleinvoiceVO saleinvoice = (SaleinvoiceVO) this.getBillCardPanel().getBillValueVO(
+							SaleinvoiceVO.class.getName(), SaleVO.class.getName(), SaleinvoiceBVO.class.getName());
+					alPrintVO.add(saleinvoice);
+				}
+			} else {
+				if (0 == this.getShowState()) {
+					selectRows = this.getBillListPanel().getHeadTable().getSelectedRows();
+					this.getBillCardPanel().loadCardData(this.getVOCache().getVO_Load(selectRows[0]));
+				}
+
+				SaleinvoiceVO saleinvoice = (SaleinvoiceVO) this.getBillCardPanel().getBillValueVO(
+						SaleinvoiceVO.class.getName(), SaleVO.class.getName(), SaleinvoiceBVO.class.getName());
+				alPrintVO.add(saleinvoice);
+			}
+
+			BillPrintTool printTool = new BillPrintTool(this, SaleInvoiceTools.getNodeCode(), alPrintVO,
+					this.getBillCardPanel().getBillData(), (Class) null, SaleInvoiceTools.getLoginPk_Corp(),
+					SaleInvoiceTools.getLoginUserId(), "vreceiptcode", "csaleid");
+			if (previewflag) {
+				printTool.onCardPrintPreview(this.getBillCardPanel(), this.getBillListPanel(), "32");
+			} else if (0 == this.getShowState()) {
+				printTool.onBatchPrint(this.getBillListPanel(), "32", this.getPrintLogClient());
+			} else {
+				printTool.onCardPrint(this.getBillCardPanel(), this.getBillListPanel(), "32", this.getPrintLogClient());
+			}
+
+			this.showHintMessage(this.getPrintLogClient().getPrintResultMsg(previewflag));
+		} catch (Exception var11) {
+			SCMEnv.out(var11);
+		} finally {
+			this.getBillCardPanel().getBodyPanel().setTotalRowShow(total);
+		}
+
+	}
+
+	private void onQuery() {
+		if (this.getQueryDlg().showModal() != 2) {
+			Component[] normalConditions = this.getQueryDlg().getUIPanelNormal().getComponents();
+			List<String> selConName = new ArrayList();
+
+			for (int i = 0; i < normalConditions.length; ++i) {
+				UIRadioButton selBut = (UIRadioButton) normalConditions[i];
+				if (selBut.isSelected()) {
+					selConName.add(selBut.getName());
+				}
+			}
+
+			NormalConditionCache.putNormalConditionToCache("40060501", selConName);
+			this.m_bEverQuery = true;
+			this.getBillListPanel().getPagePanel().setQueryStatus();
+			this.onRefresh();
+		}
+	}
+
+	private void onRefAddLine(ButtonObject bo) {
+		SaleinvoiceVO curVo = (SaleinvoiceVO) this.getBillCardPanel().getBillData()
+				.getBillValueVO(SaleinvoiceVO.class.getName(), SaleVO.class.getName(), SaleinvoiceBVO.class.getName());
+		PfUtilClient.childButtonClicked(bo, SaleInvoiceTools.getLoginPk_Corp(), "40060302",
+				SaleInvoiceTools.getLoginUserId(), "32", this, curVo);
+		SaleinvoiceVO[] vosRefAddLine = null;
+		if (!PfUtilClient.makeFlag && PfUtilClient.isCloseOK()) {
+			vosRefAddLine = (SaleinvoiceVO[]) ((SaleinvoiceVO[]) PfUtilClient.getRetVos());
+		}
+
+		if (vosRefAddLine != null && vosRefAddLine.length != 0) {
+			SaleinvoiceSplitTools splittools = new SaleinvoiceSplitTools();
+			SaleinvoiceVO[] aryRetVO = splittools.splitSaleinvoiceVOs(vosRefAddLine);
+			SaleinvoiceBVO[] addToCardBody = this.checkBeforeRefAdd(aryRetVO);
+			SaleinvoiceVO curcardvo = (SaleinvoiceVO) this.getBillCardPanel().getBillData().getBillValueVO(
+					SaleinvoiceVO.class.getName(), SaleVO.class.getName(), SaleinvoiceBVO.class.getName());
+			ArrayList<SaleinvoiceBVO> arynewbvo = new ArrayList();
+			SaleinvoiceBVO[] var9 = curcardvo.getBodyVO();
+			int oldrowcount = var9.length;
+
+			int j;
+			for (j = 0; j < oldrowcount; ++j) {
+				SaleinvoiceBVO bvo = var9[j];
+				if (bvo.getCinvoice_bid() == null || bvo.getCinvoice_bid().length() == 0) {
+					arynewbvo.add(bvo);
+				}
+			}
+
+			SaleinvoiceBVO[] newbvo;
+			int i;
+			if (arynewbvo.size() > 0) {
+				int size = arynewbvo.size();
+				newbvo = new SaleinvoiceBVO[arynewbvo.size() + addToCardBody.length];
+				j = 0;
+
+				for (i = size; j < i; ++j) {
+					newbvo[j] = (SaleinvoiceBVO) arynewbvo.get(j);
+				}
+
+				j = 0;
+
+				for (i = addToCardBody.length; j < i; ++j) {
+					newbvo[j + size] = addToCardBody[j];
+				}
+
+				curcardvo.setChildrenVO(newbvo);
+			} else {
+				curcardvo.setChildrenVO(addToCardBody);
+			}
+
+			SaleinvoiceDealMnyTools dealmnytools = new SaleinvoiceDealMnyTools();
+			dealmnytools.dealMny(new SaleinvoiceVO[]{curcardvo});
+			if (addToCardBody.length > 0) {
+				newbvo = addToCardBody;
+				j = addToCardBody.length;
+
+				for (i = 0; i < j; ++i) {
+					SaleinvoiceBVO bvo = newbvo[i];
+					bvo.setNewVOSubData();
+				}
+
+				oldrowcount = this.getBillCardPanel().getRowCount();
+				int[] addlinerow = new int[addToCardBody.length];
+
+				for (i = 0; i < addToCardBody.length; ++i) {
+					addlinerow[i] = oldrowcount + i;
+					this.getBillCardPanel().getBodyPanel().addLine();
+				}
+
+				this.getBillCardPanel().getBillModel().setBodyRowVOs(addToCardBody, addlinerow);
+				BillRowNo.addLineRowNos(this.getBillCardPanel(), "32", "crowno", oldrowcount - 1, addlinerow);
+				boolean isshow = this.getBillCardPanel().getBodyItem("cinvclassid").isShow();
+				int[] var25 = addlinerow;
+				int var14 = addlinerow.length;
+
+				for (int var15 = 0; var15 < var14; ++var15) {
+					Integer rowindex = var25[var15];
+					this.getBillCardPanel().getBillModel().setRowState(rowindex, 1);
+					this.getBillCardPanel().getBillModel().execLoadFormulaByRow(rowindex);
+					if (isshow && null == this.getBillCardPanel().getBodyValueAt(rowindex, "cinvclassid")) {
+						String[] invclformul = new String[]{
+								"cinvclassid->getColValue(bd_invbasdoc,pk_invcl,pk_invbasdoc,cinvbasdocid)"};
+						this.getBillCardPanel().execBodyFormulas(rowindex, invclformul);
+					}
+
+					Object largess = this.getBillCardPanel().getBodyValueAt(rowindex, "blargessflag");
+					boolean blargess = largess == null ? false : SmartVODataUtils.getUFBoolean(largess).booleanValue();
+					this.getBillCardPanel().setCellEditable(rowindex, "cinventorycode", false);
+					this.getBillCardPanel().getBillCardTools()
+							.setCellEditableByLargess(blargess && !this.st.SO_59.booleanValue(), rowindex);
+					this.getBillCardPanel().setAssistChange(rowindex);
+					if (null != this.getBillCardPanel().getBodyValueAt(rowindex, "cpackunitid")
+							&& !"".equals(this.getBillCardPanel().getBodyValueAt(rowindex, "cpackunitid"))) {
+						this.getBillCardPanel().initScalefactor(rowindex);
+						String[] appendFormulaViaPrice = new String[]{"norgviaprice->noriginalcurprice*scalefactor",
+								"norgviapricetax->noriginalcurtaxprice*scalefactor"};
+						this.getBillCardPanel().execBodyFormulas(rowindex, appendFormulaViaPrice);
+					}
+				}
+
+				this.getBillCardPanel().initFreeItem();
+			}
+
+			this.setButtonsStateEdit();
+			this.getBillCardPanel().setHeadItem("ntotalsummny",
+					this.getBillCardPanel().calcurateTotal("noriginalcursummny"));
+			this.getBillCardPanel().execHeadFormula("nnetmny->ntotalsummny-nstrikemny");
+			this.showHintMessage(NCLangRes.getInstance().getStrByID("SCMCommon", "UPPSCMCommon-000350"));
+		}
+	}
+
+	private void onRefresh() {
+		Timer timer = new Timer();
+		timer.start();
+		SaleinvoiceVO[] vosInvoice = null;
+
+		try {
+			String where = this.getQueryDlg().getWhere();
+			PageQueryClientBO bo = new PageQueryClientBO(this.getBillListPanel().getPagePanel());
+			SaleVO[] headVOs = (SaleVO[]) bo.queryData(where, SaleVO.class);
+			if (headVOs != null && headVOs.length > 0) {
+				vosInvoice = new SaleinvoiceVO[headVOs.length];
+
+				for (int i = 0; i < headVOs.length; ++i) {
+					vosInvoice[i] = new SaleinvoiceVO();
+					vosInvoice[i].setParentVO(headVOs[i]);
+				}
+			}
+		} catch (BusinessException var7) {
+			SCMEnv.out(var7);
+			MessageDialog.showErrorDlg(this, NCLangRes.getInstance().getStrByID("scmcommon", "UPPSCMCommon-000059"),
+					var7.getMessage());
+		}
+
+		timer.addExecutePhase(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000675"));
+		this.getVOCache().setCacheData(vosInvoice);
+		timer.addExecutePhase(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000676"));
+		this.getBillListPanel().getHeadBillModel().setSortColumn((String) null);
+		this.onList();
+		timer.addExecutePhase(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000677"));
+		timer.showAllExecutePhase(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000678"));
+	}
+
+	private String onSave() {
+		String sMessage = null;
+		SaleinvoiceVO voSaved = this.getBillCardPanel().getSaveVO();
+		if (null == voSaved) {
+			return sMessage;
+		} else {
+			voSaved.setCl(new ClientLink(this.getClientEnvironment()));
+			this.showHintMessage(NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000080"));
+			SCMEnv.out(
+					NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000668") + System.currentTimeMillis());
+			SaleinvoiceVO newinvoicevo = null;
+
+			try {
+				this.getPluginProxy().beforeAction(Action.SAVE, new SaleinvoiceVO[]{voSaved});
+				voSaved.processVOForTrans();
+				ObjectUtils.objectReference(voSaved);
+				boolean bContinue = true;
+				UFBoolean bCheck = UFBoolean.TRUE;
+
+				while (true) {
+					if (!bContinue) {
+						this.getPluginProxy().afterAction(Action.SAVE, new SaleinvoiceVO[]{voSaved});
+						break;
+					}
+
+					try {
+						if (this.getBillCardPanel().isNewBill()) {
+							newinvoicevo = (SaleinvoiceVO) PfUtilClient.processActionNoSendMessage(this, "PreKeep",
+									"32", this.getClientEnvironment().getDate().toString(), voSaved, bCheck,
+									(String) null, (AggregatedValueObject) null);
+						} else {
+							newinvoicevo = (SaleinvoiceVO) PfUtilClient.processActionNoSendMessage(this, "PreModify",
+									"32", this.getClientEnvironment().getDate().toString(), voSaved, bCheck,
+									(String) null, (AggregatedValueObject) null);
+						}
+
+						bContinue = false;
+					} catch (Exception var10) {
+						Exception ex = ExceptionUtils.marshException(var10);
+						if (!(ex instanceof EstimateCheckException)) {
+							throw ex;
+						}
+
+						this.showErrorMessage(ex.getMessage());
+						bCheck = UFBoolean.FALSE;
+						bContinue = true;
+					}
+				}
+			} catch (Exception var11) {
+				sMessage = var11.getMessage();
+				this.showErrorMessage(sMessage);
+				SCMEnv.out(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000669") + var11);
+				return sMessage;
+			}
+
+			this.showHintMessage(NCLangRes.getInstance().getStrByID("40060501", "UPP40060501-000083"));
+			Object ofcounteractflag = this.getBillCardPanel().getHeadItem("fcounteractflag").getValueObject();
+			Integer fcounteractflag = SmartVODataUtils.getInteger(ofcounteractflag);
+			if (this.getBillCardPanel().isNewBill() && null != fcounteractflag && 2 == fcounteractflag) {
+				SaleinvoiceVO voUp = this.getVOCache().getVO_Load(voSaved.getBodyVO()[0].getCupinvoicebillid());
+				SaleVO voNewHead = null;
+
+				try {
+					voNewHead = SaleinvoiceBO_Client.queryHeadDataByID(voUp.getHeadVO().getCsaleid());
+				} catch (Exception var9) {
+					SCMEnv.out(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000670") + var9);
+					sMessage = var9.getMessage();
+				}
+
+				if (null != voNewHead) {
+					voUp.getHeadVO().setTs(voNewHead.getTs());
+					voUp.getHeadVO().setFcounteractflag(voNewHead.getFcounteractflag());
+					voUp.setParentVO(voNewHead);
+					this.getVOCache().setSaleinvoiceVO(voUp.getHeadVO().getCsaleid(), voUp);
+				}
+			}
+
+			this.getBillCardPanel().setPanelAfterSave(newinvoicevo, this.isInMsgPanel());
+			this.updateCacheVOByCard();
+			SetColor.resetColor(this.getBillCardPanel());
+			this.getBillCardPanel().setOutSumMakeInvoice(false);
+			this.setOperationState(2);
+			this.setButtonsStateBrowse();
+			return sMessage;
+		}
+	}
+
+	private void onSelectAll() {
+		if (!this.getVOCache().isEmpty()) {
+			this.getBillListPanel().getHeadTable().setRowSelectionInterval(0,
+					this.getBillListPanel().getHeadTable().getRowCount() - 1);
+			this.setButtonsStateBrowse();
+		}
+
+	}
+
+	private void onSendAudit() {
+		if (this.getOperationState() != 2) {
+			this.onSave();
+		}
+
+		SaleinvoiceVO voCur = this.getVo();
+		if (null != voCur && null != voCur.getParentVO()) {
+			try {
+				HashMap<String, SmartVO> hsnewvo = (HashMap) PfUtilClient.processAction("SAVE", "32",
+						this.getClientEnvironment().getDate().toString(), voCur);
+				this.updateUIValue(hsnewvo);
+				if (PfUtilClient.isSuccess()) {
+					this.setButtonsStateBrowse();
+					this.showHintMessage(NCLangRes.getInstance().getStrByID("40060301", "UPP40060301-000291"));
+				} else {
+					this.showHintMessage(NCLangRes.getInstance().getStrByID("40060301", "UPP40060301-000292"));
+				}
+			} catch (Exception var3) {
+				this.showWarningMessage(
+						var3.getMessage() + NCLangRes.getInstance().getStrByID("SCMCOMMON", "UPPSCMCommon-000408"));
+			}
+		} else {
+			this.showErrorMessage(NCLangRes.getInstance().getStrByID("SCMCOMMON", "UPPSCMCommon-000199"));
+		}
+
+	}
+
+	private void onTakeBack() {
+		SaleinvoiceVO voCur = this.getVo();
+		if (null != voCur && null != voCur.getParentVO()) {
+			try {
+				HashMap<String, SmartVO> hsnewvo = (HashMap) PfUtilClient.processAction("TAKEBACK", "32",
+						this.getClientEnvironment().getDate().toString(), voCur);
+				this.updateUIValue(hsnewvo);
+				if (PfUtilClient.isSuccess()) {
+					this.setButtonsStateBrowse();
+					this.showHintMessage(NCLangRes.getInstance().getStrByID("40060301", "UPP40060301-000291"));
+				} else {
+					this.showHintMessage(NCLangRes.getInstance().getStrByID("40060301", "UPP40060301-000292"));
+				}
+			} catch (Exception var3) {
+				this.showWarningMessage(
+						var3.getMessage() + NCLangRes.getInstance().getStrByID("SCMCOMMON", "UPPSCMCommon-000408"));
+			}
+		} else {
+			this.showErrorMessage(NCLangRes.getInstance().getStrByID("SCMCOMMON", "UPPSCMCommon-000199"));
+		}
+
+	}
+
+	private void onSoTax() {
+		Map<String, SaleinvoiceVO> voMapOfId = new HashMap();
+		List<GoldTaxVO> goldList = new ArrayList();
+		int rowCount;
+		if (this.getShowState() == 0) {
+			SaleinvoiceVO[] saleinvoiceVOs = this.getBillListPanel().getSelectedVOs();
+			SaleinvoiceVO[] var4 = saleinvoiceVOs;
+			int var5 = saleinvoiceVOs.length;
+
+			for (rowCount = 0; rowCount < var5; ++rowCount) {
+				SaleinvoiceVO saleinvoiceVO = var4[rowCount];
+				goldList.add(saleinvoiceVO.convertGoldTaxVO());
+				voMapOfId.put(saleinvoiceVO.getParentVO().getPrimaryKey(), saleinvoiceVO);
+			}
+		} else {
+			SaleinvoiceVO vo = this.getBillCardPanel().getVO();
+			if (null != vo) {
+				goldList.add(vo.convertGoldTaxVO());
+				voMapOfId.put(vo.getParentVO().getPrimaryKey(), vo);
+			}
+		}
+
+		TransGoldTaxDlg goldTaxDlg = new TransGoldTaxDlg(this);
+		goldTaxDlg.setGoldTaxVOs((GoldTaxVO[]) goldList.toArray(new GoldTaxVO[goldList.size()]));
+		if (1 == goldTaxDlg.showModal()) {
+			SCMEnv.out(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000664"));
+
+			try {
+				UFDateTime transTime = ClientEnvironment.getServerTime();
+				Map<String, UFDateTime> tsMap = SaleinvoiceBO_Client
+						.updateWhenToGoldTax(new ArrayList(voMapOfId.keySet()), transTime);
+				if (this.getShowState() == 0) {
+					rowCount = this.getBillListPanel().getHeadBillModel().getRowCount();
+
+					for (int row = 0; row < rowCount; ++row) {
+						String id = (String) this.getBillListPanel().getHeadBillModel().getValueAt(row, "csaleid");
+						if (!StringUtil.isEmpty(id)) {
+							UFDateTime ts = (UFDateTime) tsMap.get(id);
+							if (null != ts) {
+								this.getBillListPanel().getHeadBillModel().setValueAt(ts, row, "ts");
+								this.getBillListPanel().getHeadBillModel().setValueAt(UFBoolean.TRUE, row,
+										"btogoldtax");
+								this.getBillListPanel().getHeadBillModel().setValueAt(transTime.toString(), row,
+										"dtogoldtaxtime");
+								SaleinvoiceVO saleinvoiceVO = (SaleinvoiceVO) voMapOfId.get(id);
+								if (null != saleinvoiceVO) {
+									saleinvoiceVO.getParentVO().setAttributeValue("ts", ts);
+									saleinvoiceVO.getParentVO().setAttributeValue("btogoldtax", UFBoolean.TRUE);
+									saleinvoiceVO.getParentVO().setAttributeValue("dtogoldtaxtime",
+											transTime.toString());
+									this.getVOCache().setSaleinvoiceVO(saleinvoiceVO.getParentVO().getPrimaryKey(),
+											saleinvoiceVO);
+								}
+							}
+						}
+					}
+				} else if (this.getShowState() == 1) {
+					String id = (String) this.getBillCardPanel().getHeadItem("csaleid").getValueObject();
+					if (!StringUtil.isEmpty(id)) {
+						UFDateTime ts = (UFDateTime) tsMap.get(id);
+						if (null != ts) {
+							this.getBillCardPanel().setHeadItem("ts", ts);
+							this.getBillCardPanel().setHeadItem("btogoldtax", UFBoolean.TRUE);
+							this.getBillCardPanel().setHeadItem("dtogoldtaxtime", transTime.toString());
+							SaleinvoiceVO saleinvoiceVO = (SaleinvoiceVO) voMapOfId.get(id);
+							if (null != saleinvoiceVO) {
+								saleinvoiceVO.getParentVO().setAttributeValue("ts", ts);
+								saleinvoiceVO.getParentVO().setAttributeValue("btogoldtax", UFBoolean.TRUE);
+								saleinvoiceVO.getParentVO().setAttributeValue("dtogoldtaxtime", transTime.toString());
+								this.getVOCache().setSaleinvoiceVO(saleinvoiceVO.getParentVO().getPrimaryKey(),
+										saleinvoiceVO);
+							}
+						}
+					}
+				}
+			} catch (Exception var11) {
+				SCMEnv.error(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000665"), var11);
+			}
+		} else {
+			SCMEnv.out(NCLangRes.getInstance().getStrByID("40060301", "UPT40060301-000666"));
+		}
+
+	}
+
+	private void onToEinv() {
+		List<String> blueList = new ArrayList();
+		Map<String, String[]> redmap = new HashMap();
+		CorpVO corpvo = ClientEnvironment.getInstance().getCorporation();
+		String pk_corp = corpvo.getPk_corp();
+		if (corpvo.getTaxcode() == null) {
+			this.showErrorMessage("请输入公司的纳税人识别号!");
+		} else {
+			List<String> cannotEinvList = new ArrayList();
+			List<SaleinvoiceVO> redListVos = new ArrayList();
+			SaleinvoiceVO[] saleinvoiceVOs;
+			SaleinvoiceVO[] redreason;
+			SaleinvoiceVO vo;
+			SaleVO head;
+			String csaleid;
+			if (this.getShowState() == 0) {
+				saleinvoiceVOs = this.getBillListPanel().getSelectedVOs();
+				redreason = saleinvoiceVOs;
+				int i = saleinvoiceVOs.length;
+
+				int var10;
+				for (var10 = 0; var10 < i; ++var10) {
+					vo = redreason[var10];
+					head = vo.getParentVO();
+					if (head.getFstatus() == 2 && head.getFeinvstatus() != 3
+							&& EinvoiceType.getEinvoiceType(head.getFinvoicetype()) != null
+							&& head.getFcounteractflag() == 2) {
+						redListVos.add(vo);
+					}
+				}
+
+				if (redListVos.size() > 1) {
+					StringBuilder errMsg = new StringBuilder();
+					errMsg.append(NCLangRes.getInstance().getStrByID("40060501", "UPT40060501-200020"))
+							.append(redListVos.size())
+							.append(NCLangRes.getInstance().getStrByID("40060501", "UPT40060501-200021"));
+
+					for (i = 0; i < redListVos.size(); ++i) {
+						errMsg.append(((SaleinvoiceVO) redListVos.get(i)).getHeadVO().getVreceiptcode()).append(";");
+					}
+
+					this.showErrorMessage(errMsg.toString());
+					return;
+				}
+
+				redreason = saleinvoiceVOs;
+				i = saleinvoiceVOs.length;
+
+				for (var10 = 0; var10 < i; ++var10) {
+					vo = redreason[var10];
+					head = vo.getParentVO();
+					csaleid = this.checkVO(vo);
+					if (csaleid != null) {
+						this.showErrorMessage(csaleid);
+						return;
+					}
+
+					if (head.getFstatus() == 2 && head.getFeinvstatus() != 3
+							&& EinvoiceType.getEinvoiceType(head.getFinvoicetype()) != null
+							&& (head.getFcounteractflag() == 0 || head.getFcounteractflag() == 2)) {
+						this.addId(blueList, redmap, head, cannotEinvList);
+					}
+				}
+			} else if (this.getShowState() == 1) {
+				SaleinvoiceVO saleinvoiceVO = this.getBillCardPanel().getVO();
+				String error = this.checkVO(saleinvoiceVO);
+				if (error != null) {
+					this.showErrorMessage(error);
+					return;
+				}
+
+				this.addId(blueList, redmap, saleinvoiceVO.getHeadVO(), cannotEinvList);
+				if (saleinvoiceVO.getHeadVO().getFcounteractflag() == 2
+						&& saleinvoiceVO.getHeadVO().getVsrceinvcode() != null
+						&& EinvoiceType.getEinvoiceType(saleinvoiceVO.getHeadVO().getFinvoicetype()) != null) {
+					redListVos.add(saleinvoiceVO);
+				}
+			}
+
+			saleinvoiceVOs = null;
+			redreason = null;
+			if (redListVos.size() == 1) {
+				SaleinvoiceVO redvo = (SaleinvoiceVO) redListVos.get(0);
+				SaleVO headvo = redvo.getHeadVO();
+				if (headvo.getFinvoicetype().equals(EinvoiceType.VAT_SPECIAL_INVOICE)) {
+					RedNumberDlg rednumdlg = new RedNumberDlg();
+					if (rednumdlg.showModal() != 1) {
+						return;
+					}
+
+					String rednumber = rednumdlg.getTextFieldCode().getText();
+					if (rednumber == null || rednumber.equals("")) {
+						this.showErrorMessage(NCLangRes.getInstance().getStrByID("40060501", "UPT40060501-200019"));
+						return;
+					}
+
+					headvo.setVredletterinfo(rednumber);
+					if (redmap.get(headvo.getCsaleid()) != null) {
+						((String[]) redmap.get(headvo.getCsaleid()))[2] = rednumber;
+					}
+				} else if (headvo.getFinvoicetype().equals(EinvoiceType.ELE_SPECIAL_VAT_INVOICE)
+						|| headvo.getFinvoicetype().equals(EinvoiceType.ELE_GENERAL_VAT_INVOICE)
+						|| headvo.getFinvoicetype().equals(EinvoiceType.VAT_GENERAL_INVOICE)
+						|| headvo.getFinvoicetype().equals(EinvoiceType.VAT_ELE_GENERAL_INVOICE)) {
+					RedReasonDlg redreasondlg = new RedReasonDlg(headvo.getFinvoicetype());
+					if (redreasondlg.showModal() != 1) {
+						return;
+					}
+
+					Integer redreason2 = redreasondlg.getTextFieldCode().getSelectedIndex();
+					redreason2 = redreason2 + 1;
+					if ((headvo.getFinvoicetype() == EinvoiceType.ELE_SPECIAL_VAT_INVOICE
+							|| headvo.getFinvoicetype() == EinvoiceType.ELE_GENERAL_VAT_INVOICE) && redreason2 == 2) {
+						redreason2 = redreason2 + 1;
+					}
+
+					headvo.setVredflushcause(redreason2);
+					if (redmap.get(headvo.getCsaleid()) != null) {
+						((String[]) redmap.get(headvo.getCsaleid()))[3] = redreason.toString();
+					}
+				}
+			}
+
+			IEinvService service = (IEinvService) NCLocator.getInstance().lookup(IEinvService.class);
+			HashMap statusMap = new HashMap();
+
+			try {
+				if (!blueList.isEmpty()) {
+					String[] blueids = new String[blueList.size()];
+					blueList.toArray(blueids);
+					Map<String, String> blueStatusMap = service.makeBlueInvoice(pk_corp, blueids);
+					this.combineStatusMap(statusMap, blueStatusMap);
+				}
+
+				if (!redmap.isEmpty()) {
+					Map<String, String> redStatusMap = service.makeRedInvoice(pk_corp, redmap);
+					this.combineStatusMap(statusMap, redStatusMap);
+				}
+			} catch (BusinessException var19) {
+				this.showErrorMessage(var19.getMessage());
+				SCMEnv.out(var19);
+				return;
+			}
+
+			String msg;
+			if (cannotEinvList.size() != 0 && statusMap.isEmpty()) {
+				msg = "发票号 " + (String) cannotEinvList.get(0) + (cannotEinvList.size() == 1 ? " " : " 等")
+						+ "为未开票已对冲的蓝字发票,或是未开票已对冲的蓝字发票对冲后生成的红字发票,无法开票!";
+				this.showErrorMessage(msg);
+			} else if (!statusMap.isEmpty()) {
+				
+				if (this.getShowState() == 0) {
+					int[] rows = this.getBillListPanel().getHeadTable().getSelectedRows();
+					int[] var35 = rows;
+					int var36 = rows.length;
+
+					for (int row = 0; row < var36; ++row) {
+						 row = var35[row];
+						SaleinvoiceVO vo2 = this.getVOCache().getVO_Load(row);
+						SaleVO head2 = vo2.getParentVO();
+						String csaleid2 = head2.getCsaleid();
+						if (blueList.contains(csaleid2) || redmap.containsKey(csaleid2)) {
+							this.dealResult(head2, (String) statusMap.get(csaleid2));
+							this.getVOCache().setSaleinvoiceVO(row, vo2);
+						}
+					}
+
+					this.getBillListPanel().reLoadData(this.getVOCache());
+				} else if (this.getShowState() == 1) {
+					vo = this.getBillCardPanel().getVO();
+					head = vo.getHeadVO();
+					csaleid = head.getCsaleid();
+					int row = this.getVOCache().findPos(csaleid);
+					this.dealResult(head, (String) statusMap.get(csaleid));
+					this.getVOCache().setSaleinvoiceVO(row, vo);
+					this.getBillCardPanel().loadCardData(vo);
+				}
+
+				msg = "已经申请开票。刷新可以查看发票最新状态!";
+				if (cannotEinvList.size() != 0) {
+					String errMsg = "另外,发票号 " + (String) cannotEinvList.get(0)
+							+ (cannotEinvList.size() == 1 ? " " : " 等") + "为未开票已对冲的蓝字发票,或是未开票已对冲的蓝字发票对冲后生成的红字发票,无法开票!";
+					msg = msg + errMsg;
+				}
+
+				this.showHintMessage(msg);
+			}
+		}
+	}
+
+	private void combineStatusMap(Map<String, String> combinedMap, Map<String, String> currentStatusMap) {
+		if (currentStatusMap != null && currentStatusMap.size() != 0) {
+			combinedMap.putAll(currentStatusMap);
+		}
+
+	}
+
+	private void onUnApprove() {
+		SaleinvoiceVO voInvoice = this.getVOForAction();
+		HashMap<String, SmartVO> hsnewvo = null;
+		voInvoice.setAllinvoicevo(voInvoice);
+		voInvoice.setBstrikeflag(UFBoolean.FALSE);
+		voInvoice.setCuruserid(this.getClientEnvironment().getUser().getPrimaryKey());
+
+		try {
+			hsnewvo = (HashMap) PfUtilClient.processActionFlow(this, "SoUnApprove", "32",
+					this.getClientEnvironment().getDate().toString(), voInvoice, (Object) null);
+		} catch (Exception var4) {
+			this.showErrorMessage(var4.getMessage());
+			SCMEnv.out(var4);
+			return;
+		}
+
+		if (PfUtilClient.isSuccess()) {
+			this.updateUIValue(hsnewvo);
+			this.showHintMessage(NCLangRes.getInstance().getStrByID("scmcommon", "UPPSCMCommon-000184"));
+		}
+
+	}
+
+	private boolean onUnApprove(SaleinvoiceVO vo) throws Exception {
+		if (vo == null) {
+			return false;
+		} else {
+			SaleinvoiceVO saleinvoice = vo;
+			if (vo.getChildrenVO() != null) {
+				for (int i = 0; i < vo.getChildrenVO().length; ++i) {
+					vo.getChildrenVO()[i].setStatus(0);
+				}
+			}
+
+			try {
+				PfUtilClient.processActionFlow(this, "SoUnApprove", "32",
+						this.getClientEnvironment().getDate().toString(), saleinvoice, (Object) null);
+			} catch (Exception var4) {
+				throw var4;
+			}
+
+			return PfUtilClient.isSuccess();
+		}
+	}
+
+	private void onUnite() {
+		if (this.getShowState() != 0 && this.getBillCardPanel().unite()) {
+			this.setButtonsStateEdit();
+			this.showHintMessage(NCLangRes.getInstance().getStrByID("40060501", "UPT40060501-000048"));
+		}
+	}
+
+	private void onUniteCancel() {
+		if (this.getShowState() == 1) {
+			if (!this.getBillCardPanel().uniteCancel()) {
+				return;
+			}
+		} else {
+			this.onModify();
+			this.onUniteCancel();
+		}
+
+		this.setButtonsStateEdit();
+	}
+
+	private void onUnSelectAll() {
+		if (!this.getVOCache().isEmpty()) {
+			this.getBillListPanel().getHeadTable().removeRowSelectionInterval(0,
+					this.getBillListPanel().getHeadTable().getRowCount() - 1);
+			this.setButtonsStateBrowse();
+		}
+
+	}
+
+	private void processNewVO(SaleinvoiceVO[] newinvoicevos) {
+		int defaultinvoicetype = this.getDefaultInvoiceType();
+		SaleinvoiceVO[] var3 = newinvoicevos;
+		int var4 = newinvoicevos.length;
+
+		for (int var5 = 0; var5 < var4; ++var5) {
+			SaleinvoiceVO newinvoicevo = var3[var5];
+			newinvoicevo.getHeadVO().setFinvoicetype(defaultinvoicetype);
+			newinvoicevo.processNewVO();
+		}
+
+	}
+
+	private void setButtonsStateBrowse() {
+		boolean haveVOSelected = false;
+		SaleinvoiceVO voFromPanel = null;
+		SaleinvoiceVO[] vosFromList = null;
+		if (this.getShowState() == 0) {
+			voFromPanel = this.getBillListPanel().getSelectedVO();
+			vosFromList = this.getBillListPanel().getSelectedVOsForSelChanged();
+		} else if (this.getVOCache().isEmpty()) {
+			voFromPanel = null;
+		} else {
+			voFromPanel = this.getBillCardPanel().getVO();
+		}
+
+		haveVOSelected = voFromPanel != null;
+		boolean haveNewBill = false;
+		int iBillStatus;
+		int feinvstatus;
+		if (haveVOSelected && voFromPanel.getHeadVO().isNew()) {
+			haveNewBill = true;
+		} else {
+			iBillStatus = this.getVOCache().getSize();
+
+			for (feinvstatus = 0; feinvstatus < iBillStatus; ++feinvstatus) {
+				if (this.getVOCache().getVO_NotLoad(feinvstatus).getHeadVO().isNew()) {
+					haveNewBill = true;
+					break;
+				}
+			}
+		}
+
+		this.getBtns().m_boBusiType.setEnabled(!haveNewBill);
+		this.getBtns().m_boAdd.setEnabled(!haveNewBill);
+		this.getBtns().m_boSave.setEnabled(false);
+		this.getBtns().m_boMaintain.setEnabled(haveVOSelected);
+		iBillStatus = -1;
+		feinvstatus = 0;
+		if (haveVOSelected) {
+			iBillStatus = voFromPanel.getHeadVO().getFstatus();
+			feinvstatus = voFromPanel.getHeadVO().getFeinvstatus();
+		}
+
+		boolean billStatusForSendAudit;
+		if (haveVOSelected && (iBillStatus == 8 || iBillStatus == 1)) {
+			this.getBtns().m_boModify.setEnabled(true);
+		} else if (iBillStatus == 7) {
+			billStatusForSendAudit = voFromPanel.getHeadVO().getCapproveid() != null;
+			this.getBtns().m_boModify.setEnabled(!billStatusForSendAudit);
+		} else {
+			this.getBtns().m_boModify.setEnabled(false);
+		}
+
+		this.getBtns().m_boCancel.setEnabled(false);
+		if (!haveVOSelected || voFromPanel.getHeadVO().isNew() || iBillStatus != 8 && iBillStatus != 1) {
+			this.getBtns().m_boBlankOut.setEnabled(false);
+		} else {
+			this.getBtns().m_boBlankOut.setEnabled(true);
+		}
+
+		if (haveVOSelected && voFromPanel.getHeadVO().isNew()) {
+			this.getBtns().m_boCancelTransfer.setEnabled(true);
+		} else {
+			this.getBtns().m_boCancelTransfer.setEnabled(false);
+		}
+
+		this.getBtns().m_boUnite.setEnabled(false);
+		this.getBtns().m_boUniteCancel.setEnabled(false);
+		if (!this.getBtns().m_boModify.isEnabled() && !this.getBtns().m_boCancel.isEnabled()
+				&& !this.getBtns().m_boBlankOut.isEnabled() && !this.getBtns().m_boCancelTransfer.isEnabled()
+				&& !this.getBtns().m_boUnite.isEnabled() && !this.getBtns().m_boUniteCancel.isEnabled()) {
+			this.getBtns().m_boMaintain.setEnabled(false);
+		}
+
+		this.getBtns().m_boLineOper.setEnabled(false);
+		this.getBtns().m_boRefAdd.setEnabled(false);
+		this.getBtns().m_boFetchCost.setEnabled(false);
+		this.getBtns().m_boApprove.setEnabled(haveVOSelected && !voFromPanel.getHeadVO().isNew() && iBillStatus != 2);
+		this.getBtns().m_boAction.setEnabled(haveVOSelected);
+		int selectedNum;
+		if (haveVOSelected) {
+			if (voFromPanel.getHeadVO().isNew()) {
+				this.getBtns().m_boSendAudit.setEnabled(false);
+				this.getBtns().m_boTakeBack.setEnabled(false);
+				this.getBtns().m_boUnApprove.setEnabled(false);
+			} else {
+				billStatusForSendAudit = true;
+				boolean sendAuditEnble = false;
+				if (vosFromList != null && vosFromList.length > 0) {
+					for (int i = 0; i < vosFromList.length; ++i) {
+						selectedNum = vosFromList[i].getHeadVO().getFstatus();
+						if (1 == selectedNum || 8 == selectedNum) {
+							sendAuditEnble = true;
+							break;
+						}
+					}
+				} else if (iBillStatus != 1 && iBillStatus != 8) {
+					sendAuditEnble = false;
+				} else {
+					sendAuditEnble = BusiBillManageTool.isNeedSendToAudit("32",
+							this.getClientEnvironment().getCorporation().getPrimaryKey(),
+							this.getBtns().m_boBusiType.getTag(), (String) null,
+							this.getClientEnvironment().getUser().getPrimaryKey());
+				}
+
+				this.getBtns().m_boSendAudit.setEnabled(sendAuditEnble);
+				if (1 != iBillStatus && 8 != iBillStatus) {
+					if (7 == iBillStatus) {
+						this.getBtns().m_boTakeBack.setEnabled(true);
+						this.getBtns().m_boUnApprove.setEnabled(false);
+					} else {
+						this.getBtns().m_boTakeBack.setEnabled(false);
+						this.getBtns().m_boUnApprove.setEnabled(true);
+					}
+				} else {
+					this.getBtns().m_boTakeBack.setEnabled(false);
+					this.getBtns().m_boUnApprove.setEnabled(false);
+				}
+			}
+
+			if (feinvstatus == 1 || feinvstatus == 3) {
+				this.getBtns().m_boUnApprove.setEnabled(false);
+			}
+		}
+
+		this.getBtns().m_boQuery.setEnabled(!haveNewBill);
+		this.getBtns().m_boBrowse.setEnabled(true);
+		this.getBtns().m_boRefresh.setEnabled(this.m_bEverQuery && !haveNewBill);
+		this.getBtns().m_boLocal.setEnabled(!this.getVOCache().isEmpty());
+		if (this.getShowState() == 1) {
+			this.getBtns().m_boFirst.setEnabled(!this.getVOCache().isEmpty());
+			this.getBtns().m_boNext.setEnabled(!this.getVOCache().isEmpty());
+			this.getBtns().m_boPrev.setEnabled(!this.getVOCache().isEmpty());
+			this.getBtns().m_boLast.setEnabled(!this.getVOCache().isEmpty());
+			if (this.getVOCache().getPos() == 0) {
+				this.getBtns().m_boFirst.setEnabled(false);
+				this.getBtns().m_boPrev.setEnabled(false);
+			}
+
+			if (this.getVOCache().getPos() == this.getVOCache().getSize() - 1) {
+				this.getBtns().m_boNext.setEnabled(false);
+				this.getBtns().m_boLast.setEnabled(false);
+			}
+		} else {
+			this.getBtns().m_boFirst.setEnabled(false);
+			this.getBtns().m_boNext.setEnabled(false);
+			this.getBtns().m_boPrev.setEnabled(false);
+			this.getBtns().m_boLast.setEnabled(false);
+		}
+
+		if (this.getShowState() == 0) {
+			if (this.getVOCache().isEmpty()) {
+				this.getBtns().m_boSelectAll.setEnabled(false);
+				this.getBtns().m_boUnSelectAll.setEnabled(false);
+			} else {
+				selectedNum = this.getBillListPanel().getHeadTable().getSelectedRowCount();
+				this.getBtns().m_boSelectAll.setEnabled(selectedNum != this.getVOCache().getSize());
+				this.getBtns().m_boUnSelectAll.setEnabled(selectedNum > 0);
+			}
+		} else {
+			this.getBtns().m_boSelectAll.setEnabled(false);
+			this.getBtns().m_boUnSelectAll.setEnabled(false);
+		}
+
+		if (this.getShowState() == 1) {
+			this.getBtns().m_boCard.setName(NCLangRes.getInstance().getStrByID("SCMCOMMON", "UPPSCMCommon-000464"));
+			this.getBtns().m_boCard.setHint(NCLangRes.getInstance().getStrByID("SCMCOMMON", "UPPSCMCommon-000464"));
+			this.getBtns().m_boCard.setEnabled(!this.getVOCache().isEmpty());
+		} else {
+			this.getBtns().m_boCard.setName(NCLangRes.getInstance().getStrByID("SCMCOMMON", "UPPSCMCommon-000463"));
+			this.getBtns().m_boCard.setHint(NCLangRes.getInstance().getStrByID("SCMCOMMON", "UPPSCMCommon-000463"));
+			this.getBtns().m_boCard.setEnabled(haveVOSelected);
+		}
+
+		this.getBtns().m_boPrintManage.setEnabled(haveVOSelected);
+		this.getBtns().m_boPreview.setEnabled(true);
+		this.getBtns().m_boPrint.setEnabled(true);
+		if (this.getShowState() == 1) {
+			this.getBtns().m_boBillCombin.setEnabled(true);
+		} else {
+			this.getBtns().m_boBillCombin.setEnabled(false);
+		}
+
+		this.getBtns().m_boAssistFunction.setEnabled(true);
+		if (iBillStatus == 2) {
+			this.getBtns().m_boOpposeAct.setEnabled(true);
+		} else {
+			this.getBtns().m_boOpposeAct.setEnabled(false);
+		}
+
+		if (haveVOSelected && !voFromPanel.getHeadVO().isNew()) {
+			this.getBtns().m_boSoTax.setEnabled(true);
+		} else {
+			this.getBtns().m_boSoTax.setEnabled(false);
+		}
+
+		this.getBtns().m_boDocument.setEnabled(true);
+		if (iBillStatus != 2 || feinvstatus == 3
+				|| EinvoiceType.getEinvoiceType(voFromPanel.getHeadVO().getFinvoicetype()) == null
+				|| voFromPanel.getHeadVO().getFcounteractflag() != 0
+						&& voFromPanel.getHeadVO().getFcounteractflag() != 2) {
+			this.getBtns().m_boToEinv.setEnabled(false);
+		} else {
+			this.getBtns().m_boToEinv.setEnabled(true);
+		}
+
+		this.getBtns().m_boAssistant.setEnabled(haveVOSelected);
+		if (this.isInMsgPanel()) {
+			this.getBtns().m_boOrderQuery.setEnabled(true);
+		} else {
+			this.getBtns().m_boOrderQuery.setEnabled(haveVOSelected && !voFromPanel.getHeadVO().isNew());
+		}
+
+		this.getBtns().m_boATP.setEnabled(true);
+		this.getBtns().m_boAuditFlowStatus.setEnabled(true);
+		this.getBtns().m_boCustInfo.setEnabled(true);
+		this.getBtns().m_boExecRpt.setEnabled(true);
+		this.getBtns().m_boCustCredit.setEnabled(true);
+		this.getBtns().m_boPrifit.setEnabled(true);
+		this.updateButtons();
+	}
+
+	private void setButtonsStateByBillStatue() {
+		this.getBtns().m_boModify.setEnabled(false);
+		switch (this.getBillCardPanel().getBillStatus()) {
+			case 1 :
+				this.getBtns().m_boAction.setEnabled(true);
+				this.getBtns().m_boApprove.setEnabled(true);
+				this.getBtns().m_boDocument.setEnabled(false);
+				this.getBtns().m_boOrderQuery.setEnabled(false);
+				this.getBtns().m_boSendAudit.setEnabled(true);
+				this.getBtns().m_boTakeBack.setEnabled(false);
+				break;
+			case 2 :
+				this.getBtns().m_boApprove.setEnabled(false);
+				this.getBtns().m_boDocument.setEnabled(true);
+				this.getBtns().m_boOrderQuery.setEnabled(true);
+				this.getBtns().m_boSendAudit.setEnabled(false);
+				this.getBtns().m_boTakeBack.setEnabled(false);
+			case 3 :
+			case 4 :
+			default :
+				break;
+			case 5 :
+				this.getBtns().m_boAction.setEnabled(false);
+				this.getBtns().m_boAssistant.setEnabled(false);
+				this.getBtns().m_boPrint.setEnabled(false);
+				this.getBtns().m_boDocument.setEnabled(false);
+				this.getBtns().m_boOrderQuery.setEnabled(false);
+				this.getBtns().m_boSendAudit.setEnabled(false);
+				this.getBtns().m_boTakeBack.setEnabled(false);
+		}
+
+		this.updateButtons();
+	}
+
+	private void setButtonsStateByLinkQueryBusitype() {
+		this.setButtonsStateBrowse();
+		this.getBtns().m_boAdd.setEnabled(true);
+		this.getBtns().m_boBusiType.setEnabled(true);
+		this.updateButtons();
+	}
+
+	private void setButtonsStateEdit() {
+		this.getBtns().m_boBusiType.setEnabled(false);
+		this.getBtns().m_boAdd.setEnabled(false);
+		this.getBtns().m_boSave.setEnabled(true);
+		this.getBtns().m_boMaintain.setEnabled(true);
+		this.getBtns().m_boModify.setEnabled(false);
+		this.getBtns().m_boBlankOut.setEnabled(false);
+		this.getBtns().m_boCancelTransfer.setEnabled(false);
+		this.getBtns().m_boCancel.setEnabled(true);
+		this.getBtns().m_boUnite.setEnabled(false);
+		this.getBtns().m_boUniteCancel.setEnabled(false);
+		if (this.getBillCardPanel().getVO() != null) {
+			if (this.getBillCardPanel().getVO().getHeadVO().getFcounteractflag() == 2) {
+				this.getBtns().m_boUnite.setEnabled(false);
+				this.getBtns().m_boUniteCancel.setEnabled(false);
+			} else {
+				this.getBtns().m_boUnite.setEnabled(this.getBillCardPanel().getVO().getHeadVO().isLgtZero());
+				this.getBtns().m_boUniteCancel.setEnabled(this.getBillCardPanel().getVO().getHeadVO().isLgtZero()
+						&& this.getBillCardPanel().getVO().getHeadVO().isStrike());
+			}
+		}
+
+		boolean isStrike = this.getBillCardPanel().isStrike();
+		if (null != this.getBillCardPanel().getVO()
+				&& 2 == this.getBillCardPanel().getVO().getHeadVO().getFcounteractflag()) {
+			this.getBtns().m_boLineOper.setEnabled(false);
+			this.getBtns().m_boAddLine.setEnabled(false);
+			this.getBtns().m_boDelLine.setEnabled(false);
+			this.getBtns().m_boInsertLine.setEnabled(false);
+			this.getBtns().m_boCopyLine.setEnabled(false);
+			this.getBtns().m_boPasteLine.setEnabled(false);
+			this.getBtns().m_boPasteLineTail.setEnabled(false);
+		} else {
+			this.getBtns().m_boLineOper.setEnabled(true);
+			this.getBtns().m_boAddLine.setEnabled(!isStrike);
+			this.getBtns().m_boDelLine.setEnabled(!isStrike);
+			this.getBtns().m_boCopyLine.setEnabled(!isStrike);
+			this.getBtns().m_boPasteLine.setEnabled(!isStrike);
+			this.getBtns().m_boInsertLine.setEnabled(!isStrike);
+			this.getBtns().m_boPasteLineTail.setEnabled(!isStrike);
+		}
+
+		this.getBtns().m_boCardEdit.setEnabled(!isStrike);
+		this.getBtns().m_boReRowNO.setEnabled(true);
+		if (null == this.getBillCardPanel().getVO()
+				|| 2 != this.getBillCardPanel().getVO().getHeadVO().getFcounteractflag()
+						&& 1 != this.getBillCardPanel().getVO().getHeadVO().getFcounteractflag()) {
+			this.getBtns().m_boRefAdd.setEnabled(!isStrike);
+		} else {
+			this.getBtns().m_boRefAdd.setEnabled(false);
+		}
+
+		this.getBtns().m_boFetchCost.setEnabled(!isStrike);
+		this.getBtns().m_boApprove.setEnabled(false);
+		this.getBtns().m_boAction.setEnabled(false);
+		this.getBtns().m_boSendAudit.setEnabled(false);
+		this.getBtns().m_boTakeBack.setEnabled(false);
+		this.getBtns().m_boUnApprove.setEnabled(false);
+		this.getBtns().m_boQuery.setEnabled(false);
+		this.getBtns().m_boBrowse.setEnabled(false);
+		this.getBtns().m_boRefresh.setEnabled(false);
+		this.getBtns().m_boLocal.setEnabled(false);
+		this.getBtns().m_boFirst.setEnabled(false);
+		this.getBtns().m_boNext.setEnabled(false);
+		this.getBtns().m_boPrev.setEnabled(false);
+		this.getBtns().m_boLast.setEnabled(false);
+		this.getBtns().m_boSelectAll.setEnabled(false);
+		this.getBtns().m_boUnSelectAll.setEnabled(false);
+		this.getBtns().m_boCard.setEnabled(false);
+		this.getBtns().m_boPrintManage.setEnabled(true);
+		this.getBtns().m_boPreview.setEnabled(false);
+		this.getBtns().m_boPrint.setEnabled(false);
+		this.getBtns().m_boBillCombin.setEnabled(true);
+		this.getBtns().m_boAssistFunction.setEnabled(true);
+		this.getBtns().m_boOpposeAct.setEnabled(true);
+		this.getBtns().m_boSoTax.setEnabled(true);
+		this.getBtns().m_boDocument.setEnabled(true);
+		this.getBtns().m_boAssistant.setEnabled(true);
+		this.getBtns().m_boOrderQuery.setEnabled(false);
+		this.getBtns().m_boATP.setEnabled(true);
+		this.getBtns().m_boAuditFlowStatus.setEnabled(true);
+		this.getBtns().m_boCustInfo.setEnabled(true);
+		this.getBtns().m_boExecRpt.setEnabled(false);
+		this.getBtns().m_boCustCredit.setEnabled(true);
+		this.getBtns().m_boPrifit.setEnabled(true);
+		this.getBillCardPanel().setBodyMenuShow(!isStrike);
+		this.updateButtons();
+	}
+
+	private void setButtonsStateMsgCenterApprove() {
+		this.getBtns().m_boAssistant.setEnabled(true);
+		this.getBtns().m_boDocument.setEnabled(true);
+		this.getBtns().m_boAuditFlowStatus.setEnabled(true);
+		this.getBtns().m_boApprove.setEnabled(true);
+		this.getBtns().m_boOrderQuery.setEnabled(true);
+		this.updateButtons();
+	}
+
+	private void setButtonsStateOPP() {
+		this.getBtns().m_boAction.setEnabled(false);
+		this.getBtns().m_boBrowse.setEnabled(false);
+		this.getBtns().m_boPrint.setEnabled(false);
+		this.getBtns().m_boPreview.setEnabled(false);
+		this.getBtns().m_boModify.setEnabled(false);
+		this.getBtns().m_boCancel.setEnabled(true);
+		this.getBtns().m_boSave.setEnabled(true);
+		this.getBtns().m_boCancelTransfer.setEnabled(false);
+		this.getBtns().m_boPrev.setEnabled(false);
+		this.getBtns().m_boNext.setEnabled(false);
+		this.getBtns().m_boCard.setEnabled(false);
+		this.getBtns().m_boLineOper.setEnabled(false);
+		this.getBtns().m_boRefAdd.setEnabled(false);
+		this.getBtns().m_boFetchCost.setEnabled(false);
+		this.getBtns().m_boDocument.setEnabled(false);
+		this.getBtns().m_boOrderQuery.setEnabled(false);
+		this.getBtns().m_boAuditFlowStatus.setEnabled(false);
+		this.getBtns().m_boBlankOut.setEnabled(false);
+		this.getBtns().m_boModify.setEnabled(false);
+		this.getBtns().m_boApprove.setEnabled(false);
+		this.getBtns().m_boUnApprove.setEnabled(false);
+		this.getBtns().m_boSendAudit.setEnabled(true);
+		this.getBtns().m_boTakeBack.setEnabled(false);
+		this.getBtns().m_boUnite.setEnabled(false);
+		this.getBtns().m_boUniteCancel.setEnabled(false);
+		this.getBillCardPanel().setBodyMenuShow(false);
+		this.updateButtons();
+	}
+
+	private void setInMsgPanel(boolean newBInMsgPanel) {
+		this.m_bInMsgPanel = newBInMsgPanel;
+	}
+
+	private void setShowState(int showState) {
+		this.m_iShowState = showState;
+	}
+
+	private void updateCacheVOByCard() {
+		SaleinvoiceVO voInvoice = this.getBillCardPanel().getVO();
+		SaleVO voHead = voInvoice.getHeadVO();
+		if (null == this.getVOCache().getVO_Load(voHead.getCsaleid())) {
+			SaleinvoiceVO catchevo = this.getVOCache().getVO_NotLoad(this.getVOCache().getPos());
+			if (null != catchevo && null != catchevo.getHeadVO().getCsaleid()) {
+				this.getVOCache().addVO(voInvoice);
+			} else if (this.getBillCardPanel().isOutSumMakeInvoice()) {
+				this.getVOCache().addVO(voInvoice);
+			} else {
+				this.getVOCache().setSaleinvoiceVO(this.getVOCache().getPos(), voInvoice);
+			}
+		} else {
+			this.getVOCache().setSaleinvoiceVO(voHead.getCsaleid(), voInvoice);
+		}
+
+		this.getVOCache().setPos(this.getVOCache().findPos(voInvoice.getHeadVO().getCsaleid()));
+	}
+
+	private void updateCacheVOByList() {
+		int iSelectedRow = this.getBillListPanel().getHeadTable().getSelectedRow();
+		if (iSelectedRow >= 0) {
+			SaleVO hvo = (SaleVO) this.getBillListPanel().getHeadBillModel().getBodyValueRowVO(iSelectedRow,
+					SaleVO.class.getName());
+			SaleinvoiceBVO[] bvos = (SaleinvoiceBVO[]) ((SaleinvoiceBVO[]) this.getBillListPanel().getBodyBillModel()
+					.getBodyValueVOs(SaleinvoiceBVO.class.getName()));
+			SaleinvoiceVO voInvoice = new SaleinvoiceVO();
+			voInvoice.setParentVO(hvo);
+			voInvoice.setChildrenVO(bvos);
+			this.getVOCache().setSaleinvoiceVO(voInvoice.getHeadVO().getCsaleid(), voInvoice);
+		}
+	}
+
+	private void updateUIValue(HashMap<String, SmartVO> hsnewvo) {
+		if (hsnewvo != null && hsnewvo.size() != 0) {
+			ISaleinvoice invoiceService = (ISaleinvoice) NCLocator.getInstance().lookup(ISaleinvoice.class);
+
+			try {
+				Map<String, UFDateTime> bodyts = invoiceService
+						.queryTsByBids((String[]) hsnewvo.keySet().toArray(new String[0]));
+				if (bodyts != null && !bodyts.isEmpty()) {
+					Iterator var4 = bodyts.entrySet().iterator();
+
+					while (var4.hasNext()) {
+						Entry<String, UFDateTime> entry = (Entry) var4.next();
+						String bid = (String) entry.getKey();
+						SmartVO bvo = (SmartVO) hsnewvo.get(bid);
+						if (bvo != null) {
+							bvo.setAttributeValue("ts", entry.getValue());
+						}
+					}
+				}
+			} catch (BusinessException var8) {
+				this.showHintMessage("查询发票ts失败");
+			}
+
+			if (this.getShowState() == 0) {
+				this.getBillListPanel().updateUIValue(hsnewvo);
+				this.updateCacheVOByList();
+				this.getBillListPanel().updateUI();
+			} else if (this.getShowState() == 1) {
+				this.getBillCardPanel().updateUIValue(hsnewvo);
+				this.updateCacheVOByCard();
+				this.getBillCardPanel().updateUI();
+			}
+
+			this.setOperationState(2);
+			this.setButtonsStateBrowse();
+		}
+	}
+
+	protected ArrayList getFormulaItemHeader() {
+		ArrayList arylistHeadField = new ArrayList();
+		String[] aryItemField1 = new String[]{"deptname", "cdeptname", "cdeptid"};
+		arylistHeadField.add(aryItemField1);
+		String[] aryItemField2 = new String[]{"psnname", "cemployeename", "cemployeeid"};
+		arylistHeadField.add(aryItemField2);
+		return arylistHeadField;
+	}
+
+	protected void postInit() {
+		this.initialize();
+	}
+
+	private boolean onSendAudit(SaleinvoiceVO saleinvoice) throws Exception {
+		if (null != saleinvoice && null != saleinvoice.getHeadVO()) {
+			try {
+				int iBillStatus = saleinvoice.getHeadVO().getFstatus();
+				if (1 != iBillStatus && 8 != iBillStatus) {
+					throw new BusinessException(
+							"发票" + saleinvoice.getHeadVO().getVreceiptcode() + "不是自由态或审批未通过状态,无法送审。");
+				} else {
+					Object otemp = PfUtilClient.processActionFlow(this, "SAVE", "32",
+							this.getClientEnvironment().getDate().toString(), saleinvoice, (Object) null);
+					if (null != otemp) {
+						String ErrMsg = otemp.toString();
+						if (ErrMsg != null && ErrMsg.startsWith("ERR")) {
+							ShowToolsInThread.showMessage(this.m_proccdlg, ErrMsg.substring(3));
+						}
+					}
+
+					return PfUtilClient.isSuccess();
+				}
+			} catch (Exception var5) {
+				throw var5;
+			}
+		} else {
+			return false;
+		}
+	}
+
+	public void pageQuery(QueryPageInfo pageInfo) {
+		this.onRefresh();
+	}
+
+	public String getPageServiceName() {
+		return "u8c.bs.so.saleinvoice.page.SaleInvoicePageService";
+	}
+}