PageRenderTime 89ms CodeModel.GetById 14ms app.highlight 65ms RepoModel.GetById 1ms app.codeStats 0ms

/webccr/src/com/emis/caesar/senao/notiy/TUserInterfaceNotify.java

https://bitbucket.org/sanliou/synccr
Java | 1349 lines | 988 code | 72 blank | 289 comment | 113 complexity | c640a292d1103512bd12da4e1637181a MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1package com.emis.caesar.senao.notiy;
   2
   3import com.emis.caesar.senao.data.TEntryEdit;
   4import com.emis.caesar.senao.data.TEntryEdits;
   5import com.emis.caesar.senao.data.TLoginData;
   6import com.emis.caesar.senao.event.TButtonEventContext;
   7import com.emis.caesar.senao.event.TEventContext;
   8import com.emis.caesar.senao.event.button.*;
   9import com.emis.caesar.senao.unit.*;
  10import com.emis.caesar.senao.unit.sale.TInvoice;
  11import com.emis.caesar.senao.unit.sale.TMember;
  12import com.emis.caesar.senao.unit.sale.TPayment;
  13import com.emis.caesar.senao.unit.sale.TSaleItem;
  14import com.emis.caesar.senao.util.CcrUtil;
  15import com.emis.caesarui.webccr.core.PromotionInfoList;
  16import com.emis.caesarui.webccr.ui.table.TSalePayTable;
  17import com.emis.caesarui.webccr.ui.table.TSalesTable;
  18import com.emis.caesarui.webccr.ui.window.*;
  19import com.emis.caesarui.webccr.webccr;
  20import com.emis.user.emisAuthFactory;
  21import com.emis.util.emisUtil;
  22import com.vaadin.event.FieldEvents;
  23import com.vaadin.server.Page;
  24import com.vaadin.server.VaadinService;
  25import com.vaadin.server.VaadinSession;
  26import com.vaadin.server.WrappedSession;
  27import com.vaadin.ui.*;
  28import de.steinwedel.messagebox.ButtonOption;
  29import de.steinwedel.messagebox.MessageBox;
  30
  31import java.util.ArrayList;
  32
  33public class TUserInterfaceNotify {
  34  TCcr FoCcr = null;
  35
  36  public TUserInterfaceNotify(TCcr oCcr_) {
  37    overWriteCcr(oCcr_);
  38  }
  39
  40  //
  41  public void overWriteCcr(TCcr oCcr_) {
  42    FoCcr = oCcr_;
  43  }
  44
  45  // 多個條件顯示本來得P_NO
  46  public void swEntryEdits(TEntryEdits oEdits_, TEventContext oEvent_, String sOkMethod_, String sCancelMethod_) {
  47    swEntryEdits(oEdits_, oEvent_, sOkMethod_, sCancelMethod_, "");
  48  }
  49
  50  /**
  51   * 建立一個可動態大小的視窗, 依_oEdits筆數, 建立一個STRING GRID.2欄, 一欄取得TEntryEdit的caption , 一欄輸入
  52   * 按下確定後. 執行oEvent_ .runEventMethod( _sOkMethod), 按下取消, 則呼叫oEvent_的oEvent_ .runEventMethod(_sCancelMethod_)
  53   *
  54   * @param oEdits_
  55   * @param oEvent_
  56   * @param sOkMethod_
  57   * @param sCancelMethod_
  58   */
  59  public void swEntryEdits(TEntryEdits oEdits_, TEventContext oEvent_, String sOkMethod_, String sCancelMethod_, String sCondition) {
  60    WinInputText _oInput = new WinInputText(oEdits_, oEvent_, sOkMethod_, sCancelMethod_, sCondition);
  61    _oInput.setModal(true);
  62    _oInput.setResizable(false);
  63    _oInput.setWidth("650px");
  64    _oInput.setClosable(false);
  65    _oInput.addStyleName("v-scrollable");
  66    int _iEditCnt = oEdits_.getEditCount();
  67    if (_iEditCnt > 0 && _iEditCnt > 12) {
  68      _oInput.setHeight((14 * 70) + "px");
  69    } else if (_iEditCnt > 0) {
  70      _oInput.setHeight(((_iEditCnt + 2) * 70) + "px");
  71    } else {
  72      _oInput.setHeight("70px");
  73    }
  74    UI.getCurrent().addWindow(_oInput);
  75    _oInput.addFocusListener(new FieldEvents.FocusListener() {
  76      @Override
  77      public void focus(FieldEvents.FocusEvent event) {
  78        _oInput.TextList.get(0).focus();
  79      }
  80    });
  81    _oInput.addCloseListener(new Window.CloseListener(){
  82      @Override
  83      public void windowClose(Window.CloseEvent e) {
  84        if (( UI.getCurrent() instanceof  webccr)) {
  85//          ((webccr) UI.getCurrent()).getlog().info(webccr.class,
  86//              "Before window close ReadOnly:"+((webccr) UI.getCurrent()).getInputLabel().isReadOnly());
  87          CcrUtil.setMessage("Before window close ReadOnly:"+((webccr) UI.getCurrent()).getInputLabel().isReadOnly());
  88          ((webccr) UI.getCurrent()).getInputLabel().focus();
  89//          ((webccr) UI.getCurrent()).getlog().info(webccr.class,
  90//              "After window close ReadOnly:"+((webccr) UI.getCurrent()).getInputLabel().isReadOnly());
  91          CcrUtil.setMessage("After window close ReadOnly:"+((webccr) UI.getCurrent()).getInputLabel().isReadOnly());
  92        }
  93      }
  94    });
  95  }
  96
  97  //add by Ares 20200207 判斷要適用優惠券、可否折上折,才可帶出優惠券滿額單
  98  public void swEntryEdits_COUPON(TEntryEdits oEdits_, TEventContext oEvent_, String sOkMethod_) {
  99      WinInputText_COUPON _oInput = new WinInputText_COUPON(oEdits_, oEvent_, sOkMethod_);
 100        _oInput.setModal(true);
 101        _oInput.setResizable(false);
 102        _oInput.setWidth("650px");
 103        _oInput.setClosable(false);
 104        _oInput.addStyleName("v-scrollable");
 105        int _iEditCnt = oEdits_.getEditCount();
 106        if (_iEditCnt > 0 && _iEditCnt > 12) {
 107            _oInput.setHeight((14 * 70) + "px");
 108        } else if (_iEditCnt > 0) {
 109            _oInput.setHeight(((_iEditCnt + 2) * 70) + "px");
 110        } else {
 111            _oInput.setHeight("70px");
 112        }
 113        UI.getCurrent().addWindow(_oInput);
 114        _oInput.addFocusListener(new FieldEvents.FocusListener() {
 115            @Override
 116            public void focus(FieldEvents.FocusEvent event) {
 117                _oInput.TextList.get(0).focus();
 118            }
 119        });
 120        _oInput.addCloseListener(new Window.CloseListener(){
 121            @Override
 122            public void windowClose(Window.CloseEvent e) {
 123                if (( UI.getCurrent() instanceof  webccr)) {
 124//          ((webccr) UI.getCurrent()).getlog().info(webccr.class,
 125//              "Before window close ReadOnly:"+((webccr) UI.getCurrent()).getInputLabel().isReadOnly());
 126                    CcrUtil.setMessage("Before window close ReadOnly:"+((webccr) UI.getCurrent()).getInputLabel().isReadOnly());
 127                    ((webccr) UI.getCurrent()).getInputLabel().focus();
 128//          ((webccr) UI.getCurrent()).getlog().info(webccr.class,
 129//              "After window close ReadOnly:"+((webccr) UI.getCurrent()).getInputLabel().isReadOnly());
 130                    CcrUtil.setMessage("After window close ReadOnly:"+((webccr) UI.getCurrent()).getInputLabel().isReadOnly());
 131                }
 132            }
 133        });
 134    }
 135
 136  /**
 137   * 彈出顯示YES/NO, 訊息為sMsg_的子視窗, YES/NO按鍵的預設位置由bDefaultYes控制
 138   * 按下YES後. 執行oEvent_ .runEventMethod( sYesMethod_),
 139   * 按下NOP 則呼叫oEvent_的oEvent_ .runEventMethod(_sNoMethod_)
 140   *
 141   * @param bDefaultYes
 142   * @param sMsg_
 143   * @param oEvent_
 144   * @param sYesMethod_
 145   * @param sNoMethod_
 146   */
 147  public void askYesOrNo(boolean bDefaultYes, String sMsg_, TEventContext oEvent_, String sYesMethod_, String sNoMethod_) {
 148    MessageBox _oMsgBox = MessageBox.createInfo();
 149    _oMsgBox.withCaption("訊息")
 150        .withMessage(sMsg_);
 151
 152    if (bDefaultYes) {
 153      _oMsgBox.withYesButton(() -> {
 154        oEvent_.runEventMethod(sYesMethod_);
 155      }, ButtonOption.focus())
 156          .withNoButton(() -> {
 157            oEvent_.runEventMethod(sNoMethod_);
 158          })
 159          .open();
 160    } else {
 161      _oMsgBox.withYesButton(() -> {
 162        oEvent_.runEventMethod(sYesMethod_);
 163      })
 164          .withNoButton(() -> {
 165            oEvent_.runEventMethod(sNoMethod_);
 166          }, ButtonOption.focus())
 167          .open();
 168    }
 169
 170  }
 171
 172  /**
 173   * 切換按鍵頁面. 第iBtnPanel_塊功能面版, 切換至指定iBtnPage_頁面
 174   *
 175   * @param sBtnPanel_
 176   * @param iBtnPage_
 177   */
 178  public void moveToBtnPage(String sBtnPanel_, int iBtnPage_) {
 179    webccr _oUI = (webccr) UI.getCurrent();
 180    if (iBtnPage_ == 0 || iBtnPage_ < 0) return; // 為0則表示不換頁
 181    if ("T".equals(sBtnPanel_)) {
 182      _oUI.changeTopButton(iBtnPage_ - 1);
 183    } else if ("B".equals(sBtnPanel_)) {
 184      _oUI.changeButton(iBtnPage_ - 1);
 185    }
 186  }
 187
 188  /**
 189   * 開啟WEBCCR主畫面
 190   */
 191  public void openWebCcr() {
 192    String EMIS_USER_BIND_NAME = "com.emis.user.emisCaesarUser.class";
 193    WrappedSession session = VaadinService.getCurrentRequest().getWrappedSession();
 194    session.setAttribute(EMIS_USER_BIND_NAME, FoCcr);
 195    VaadinSession.getCurrent().setAttribute(EMIS_USER_BIND_NAME, FoCcr);
 196    //
 197    String path = "/webccr";
 198    if (!emisUtil.isEmpty(FoCcr.getsHTTP())) {
 199      path += "?name=" + FoCcr.getsHTTP();
 200    }
 201    emisUtil.setLocation(path);
 202  }
 203
 204  // 關閉WEBCCR(關閉CHROME的網頁)
 205  public void closeWebCcr() {
 206    try {
 207      // 正常登出時, 將CASH_ID.IDNO_TOKEN清空
 208      FoCcr.wrDataToDb.updCASH_IDcolumnIDNO_TOKEN(FoCcr.getCcrID(), true);
 209//      ((webccr) UI.getCurrent()).getlog().info(login.class, "登出機號="+ FoCcr.getCcrID());
 210      CcrUtil.setMessage("登出機號="+ FoCcr.getCcrID());
 211      //
 212      String path = "/login";
 213      if (!emisUtil.isEmpty(FoCcr.getsHTTP())) {
 214        path += "?name=" + FoCcr.getsHTTP();
 215      }
 216      //
 217      WrappedSession session = VaadinService.getCurrentRequest().getWrappedSession();
 218      JavaScript.getCurrent().execute("window.onbeforeunload = function (e) { };");
 219      //
 220      emisAuthFactory.logout(emisUtil.getServletContext(), session);
 221      emisUtil.setLocation(path);
 222      UI.getCurrent().getSession().close();
 223    } catch (Exception e) {
 224//      ((webccr) UI.getCurrent()).getlog().error(webccr.class, e);
 225      CcrUtil.setMessage(emisUtil.getStackTrace(e));
 226    }
 227  }
 228
 229  /**
 230   * 商品查詢畫面, 若雙點擊grid上商品, 則回傳指定商品之P_NO, 其餘傳空白
 231   * TCcrConst.BTN_QUERY_PRODUCT
 232   * @param oEdit_
 233   * @param oEvent_
 234   * @param sOkMethod_
 235   * @param sCancelMethod_
 236   * @param sPLUMethod_
 237   */
 238  public void swQueryProductFrom(TEntryEdit oEdit_, TEventContext oEvent_, String sOkMethod_, String sCancelMethod_, String sPLUMethod_) {
 239    WinProductQry _oWinProdQry = new WinProductQry(oEdit_, oEvent_, sOkMethod_, sCancelMethod_, sPLUMethod_);
 240    _oWinProdQry.setModal(true);
 241    _oWinProdQry.setResizable(false);
 242    _oWinProdQry.setClosable(false);
 243    _oWinProdQry.setWidth("95%");
 244    _oWinProdQry.setHeight("95%");
 245    UI.getCurrent().addWindow(_oWinProdQry);
 246  }
 247
 248  /**
 249   * 門市群組庫存查詢 (同商品查詢畫面,Table不同)
 250   * TCcrConst.BTN_QUERY_S_STOCK
 251   */
 252  public void swQueryStockFrom(TEntryEdit oEdit_, TEventContext oEvent_, String sOkMethod_, String sCancelMethod_, String sPLUMethod_) {
 253    WinProductQry _oWinProdQry = new WinProductQry(oEdit_, oEvent_, sOkMethod_, sCancelMethod_, sPLUMethod_, TCcrConst.BTN_QUERY_S_STOCK);
 254    _oWinProdQry.setModal(true);
 255    _oWinProdQry.setResizable(false);
 256    _oWinProdQry.setClosable(false);
 257    _oWinProdQry.setWidth("95%");
 258    _oWinProdQry.setHeight("95%");
 259    UI.getCurrent().addWindow(_oWinProdQry);
 260  }
 261
 262  //開啟促銷單號頁面
 263  public void swPromotionFrom(String title,PromotionInfoList pmList, ArrayList<TSaleItem> SaleItemPool,
 264                              TEventContext oEvent_, String sOkMethod_, String sCancelMethod_) {
 265    WinPromotion _oWinPromotion = new WinPromotion(pmList, SaleItemPool, oEvent_, sOkMethod_, sCancelMethod_);
 266    _oWinPromotion.setCaption(title);
 267    _oWinPromotion.setModal(true);
 268    _oWinPromotion.setResizable(false);
 269    _oWinPromotion.setClosable(false);
 270    _oWinPromotion.setWidth("100%");
 271    _oWinPromotion.setHeight("100%");
 272    UI.getCurrent().addWindow(_oWinPromotion);
 273    _oWinPromotion.addFocusListener(new FieldEvents.FocusListener() {
 274      @Override
 275      public void focus(FieldEvents.FocusEvent event) {
 276        _oWinPromotion.gettPno().focus();
 277      }
 278    });
 279  }
 280
 281
 282
 283  //add by Ares 20200207 判斷要適用優惠券、可否折上折,才可帶出優惠券滿額單
 284  //開啟滿額單號頁面 by 折扣折讓
 285  public void swPromotionFrom1ByFI(PromotionInfoList pmList, TEntryEdit oEdit_, TEventContext oEvent_,
 286                                   String sOkMethod_, String sCancelMethod_, String sIS_COUPON_, String sCaption_) {
 287    //WinPromotion4FI_23 _oWinPromotion4FI_23 = new WinPromotion4FI_23(pmList, oEdit_, oEvent_, sOkMethod_, sCancelMethod_);
 288    WinPromotion4FI_23 _oWinPromotion4FI_23 = new WinPromotion4FI_23(pmList, oEdit_, oEvent_, sOkMethod_, sCancelMethod_, sIS_COUPON_, sCaption_);
 289    _oWinPromotion4FI_23.setModal(true);
 290    _oWinPromotion4FI_23.setResizable(false);
 291    _oWinPromotion4FI_23.setClosable(false);
 292    _oWinPromotion4FI_23.setWidth("60%");
 293    _oWinPromotion4FI_23.setHeight("50%");
 294    UI.getCurrent().addWindow(_oWinPromotion4FI_23);
 295  }
 296
 297    //add by Ares 20200207 判斷要適用優惠券、可否折上折,才可帶出優惠券滿額單
 298    //開啟滿額單號頁面 by 加購贈
 299    public void swPromotionFrom2ByFI(PromotionInfoList pmList, TEventContext oEvent_,
 300                                     String sOkMethod_, String sCancelMethod_, String sIS_COUPON_, String sCaption_) {
 301        //WinPromotion4FI _oWinPromotion4FI = new WinPromotion4FI(pmList, oEvent_, sOkMethod_, sCancelMethod_);
 302        WinPromotion4FI _oWinPromotion4FI = new WinPromotion4FI(pmList, oEvent_, sOkMethod_, sCancelMethod_, sIS_COUPON_, sCaption_);
 303
 304        _oWinPromotion4FI.setModal(true);
 305        _oWinPromotion4FI.setResizable(false);
 306        _oWinPromotion4FI.setClosable(false);
 307        _oWinPromotion4FI.setWidth("90%");
 308        _oWinPromotion4FI.setHeight("90%");
 309        UI.getCurrent().addWindow(_oWinPromotion4FI);
 310    }
 311
 312  //顯示清(讀)帳畫面, 畫面資料輸入完畢, 按下確認後, 將資料寫入oCcrLog_
 313  public boolean swSettleAccountsForm(TCcrLog oCcrLog_) {
 314    MessageBox.createWarning()
 315        .withCaption("訊息")
 316        .withMessage("功能開發中")
 317        .withWidth("400px")
 318        .withHeight("150").open();
 319    return true;
 320  }
 321
 322  public void swErrMsg(String sMsg_) {
 323    //swErrMsg(sMsg_, "400px");
 324    swErrMsg(sMsg_, "450");  //add by Ares 20200416 禮物卡串接銀科
 325  }
 326
 327  /**
 328   * 顯示錯誤訊息視窗
 329   *
 330   * @param sMsg_
 331   */
 332  public void swErrMsg(String sMsg_, String size) {
 333    MessageBox.createError()
 334        .withCaption("錯誤")
 335        .withMessage(sMsg_)
 336        .withWidth(size)
 337//        .withHeight("150")
 338        .withCloseButton(ButtonOption.focus())
 339        .open();
 340
 341  }
 342
 343  /**
 344   * 顯示錯誤訊息視窗
 345   *
 346   * @param sMsg_
 347   */
 348  public void swErrMsgNoSetSize(String sMsg_) {
 349    MessageBox.createError()
 350        .withCaption("錯誤")
 351        .withMessage(sMsg_)
 352        .withCloseButton(ButtonOption.focus())
 353        .open();
 354  }
 355
 356  /**
 357   * 顯示錯誤訊息視窗
 358   * 關閉後,執行Event內的Method
 359   */
 360  public void swErrMsgWithBtnEvent(String sMsg_,TEventContext oEventContext_,String sMethod_) {
 361    MessageBox.createError()
 362        .withCaption("錯誤")
 363        .withMessage(sMsg_)
 364        .withWidth("400px")
 365//        .withHeight("150")
 366        .withCloseButton(()->{
 367          oEventContext_.runEventMethod(sMethod_);
 368        },ButtonOption.focus())
 369        .open();
 370  }
 371
 372  /**
 373   *    檢查TextField必填,顯示錯誤訊息視窗 by Notification
 374   */
 375  public boolean emisEmptyValid(TextField oField, String sCaption, String sFieldName) {
 376    boolean _bValid = true;
 377    if (emisUtil.isEmpty(sCaption)) {
 378      sCaption = "必填";
 379    }
 380    if (emisUtil.isEmpty(oField.getValue())) {
 381      Notification notif = new Notification(sCaption, "「" + sFieldName + "」欄位不可為空白!", Notification.Type.WARNING_MESSAGE);
 382      notif.setDelayMsec(500);
 383      notif.show(oField.getUI().getPage());
 384      oField.focus();
 385      _bValid = false;
 386    }
 387    return _bValid;
 388  }
 389
 390  /**
 391   *    檢查DateField必填,顯示錯誤訊息視窗 by Notification
 392   */
 393  public static boolean emisEmptyValid(DateField oField, String sCaption, String sFieldName) {
 394    boolean _bValid = true;
 395    String _sMsg = "「" + sFieldName + "」欄位不可為空白!";
 396    if (emisUtil.isEmpty(sCaption)) {
 397      sCaption = "必填";
 398    }
 399    if (oField.getValue() == null) {
 400      _bValid = false;
 401      sCaption = "錯誤";
 402      _sMsg = "「" + sFieldName + "」欄位格式錯誤或不可為空白!";
 403    }
 404
 405    if (!_bValid) {
 406      Notification notif = new Notification(sCaption, _sMsg, Notification.Type.WARNING_MESSAGE);
 407      notif.setDelayMsec(500);
 408      notif.show(oField.getUI().getPage());
 409      oField.focus();
 410    }
 411    return _bValid;
 412  }
 413
 414  /**
 415   *    檢查NativeSelect必選,顯示錯誤訊息視窗 by Notification
 416   */
 417  public static boolean emisEmptyValid(NativeSelect oSelect, String sCaption, String sFieldName) {
 418    boolean _bValid = true;
 419    String _sMsg = "「" + sFieldName + "」下拉式選單未選擇項目!";
 420    if (emisUtil.isEmpty(sCaption)) {
 421      sCaption = "必選";
 422    }
 423    if (oSelect.getValue() == null || emisUtil.isEmpty((String)oSelect.getValue())) {
 424      _bValid = false;
 425    }
 426
 427    if (!_bValid) {
 428      Notification notif = new Notification(sCaption, _sMsg, Notification.Type.WARNING_MESSAGE);
 429      notif.setDelayMsec(500);
 430      notif.show(oSelect.getUI().getPage());
 431      oSelect.focus();
 432    }
 433    return _bValid;
 434  }
 435
 436  /**
 437   *    顯示錯誤訊息視窗 by Notification
 438   */
 439  public void emisErrValid(TextField oField, String sCaption,String sMsg_) {
 440    Notification notif = new Notification(sCaption, sMsg_, Notification.Type.WARNING_MESSAGE);
 441    notif.setDelayMsec(500);
 442    notif.show(oField.getUI().getPage());
 443    oField.focus();
 444  }
 445
 446  public void emisErrValid(DateField oField, String sCaption,String sMsg_) {
 447    Notification notif = new Notification(sCaption, sMsg_, Notification.Type.WARNING_MESSAGE);
 448    notif.setDelayMsec(500);
 449    notif.show(oField.getUI().getPage());
 450    oField.focus();
 451  }
 452
 453  public void emisErrValid(PasswordField oField, String sCaption,String sMsg_) {
 454    Notification notif = new Notification(sCaption, sMsg_, Notification.Type.WARNING_MESSAGE);
 455    notif.setDelayMsec(500);
 456    notif.show(oField.getUI().getPage());
 457    oField.focus();
 458  }
 459
 460  public void emisErrValid(CheckBox oField, String sCaption,String sMsg_) {
 461    Notification notif = new Notification(sCaption, sMsg_, Notification.Type.WARNING_MESSAGE);
 462    notif.setDelayMsec(500);
 463    notif.show(oField.getUI().getPage());
 464    oField.focus();
 465  }
 466
 467  public void emisErrValid(String sCaption, String sMsg_) {
 468    Notification notif = new Notification(sCaption, sMsg_, Notification.Type.WARNING_MESSAGE);
 469    notif.setDelayMsec(500);
 470  }
 471
 472  /**
 473   * 判斷編號欄位之起始編號迄是否大於終止編號  by Notification
 474   * if (!emisSeqValid(INPUTE_DATE_S, INPUTE_DATE_E, "有效日期", "", 1)) return;
 475   *
 476   * @param oField1 起始欄位物件
 477   * @param oField2 結束欄位物件
 478   * @param sMsg    欄位名稱訊息
 479   * @param sUMsg   自訂訊息
 480   * @param iShowType   訊息顯示方式 0:Notification;other:MessageBox
 481   * @return
 482   */
 483  public boolean emisSeqValid(Object oField1, Object oField2, String sMsg, String sUMsg, int iShowType) {
 484    String sField1 = "";
 485    String sField2 = "";
 486    Page page = null;
 487    TextField FocusTextField = null;
 488    DateField FocusDateField = null;
 489    boolean _bValid = true;
 490    String _sShow = "";
 491
 492    if (oField1 instanceof TextField && oField2 instanceof TextField) {
 493      TextField oText1 = (TextField) oField1;
 494      TextField oText2 = (TextField) oField2;
 495      if (!emisUtil.isEmpty(oText1.getValue()) || !emisUtil.isEmpty(oText2.getValue())) {
 496        sField1 = oText1.getValue();
 497        sField2 = oText2.getValue();
 498        page = oText1.getUI().getPage();
 499        FocusTextField = oText2;
 500      }
 501    } else if (oField1 instanceof DateField && oField2 instanceof DateField) {
 502      DateField oDate1 = (DateField) oField1;
 503      DateField oDate2 = (DateField) oField2;
 504      if (oDate1.getValue() != null || oDate2.getValue() != null) {
 505        if (oDate1.getValue() != null) {
 506          sField1 = emisUtil.formatDateTime("%Y%M%D", oDate1.getValue());
 507        } else {
 508          sField1 = "0";
 509        }
 510        if (oDate2.getValue() != null) {
 511          sField2 = emisUtil.formatDateTime("%Y%M%D", oDate2.getValue());
 512        } else {
 513          sField2 = "0";
 514        }
 515        page = oDate1.getUI().getPage();
 516        FocusDateField = oDate2;
 517      }
 518    }
 519    if (!emisUtil.isEmpty(sField1) && !emisUtil.isEmpty(sField2)) {
 520      try {
 521        int _iField1Val = Integer.parseInt(sField1);
 522        int _iField2Val = Integer.parseInt(sField2);
 523        if (_iField1Val > _iField2Val) _bValid = false;
 524        if (!emisUtil.isEmpty(sMsg)) {
 525          _sShow = "「" + sMsg + "」起始不可大於終止!";
 526        } else {
 527          _sShow = sUMsg;
 528        }
 529        if (!_bValid) {
 530          // 顯示訊息方式
 531          if (iShowType == 0) {
 532            Notification notif = new Notification("警告", _sShow, Notification.Type.WARNING_MESSAGE);
 533            notif.setDelayMsec(500);
 534            notif.show(page);
 535          } else {
 536            swWarningMsg(_sShow);
 537          }
 538          if (FocusTextField != null) {
 539            FocusTextField.focus();
 540          } else if(FocusDateField != null) {
 541            FocusDateField.focus();
 542          }
 543        }
 544      } catch (Exception e) {
 545//        ((webccr) UI.getCurrent()).getlog().error(webccr.class, e);
 546        CcrUtil.setMessage(emisUtil.getStackTrace(e));
 547      }
 548    }
 549    return _bValid;
 550  }
 551
 552  /**
 553   * 顯示警告視窗
 554   *
 555   * @param sMsg_
 556   */
 557  public void swWarningMsg(String sMsg_) {
 558    MessageBox.createWarning()
 559        .withCaption("警告")
 560        .withMessage(sMsg_)
 561        .withWidth("400px")
 562//        .withHeight("150")
 563        .withCloseButton(ButtonOption.focus())
 564        .open();
 565  }
 566
 567  /**
 568   * 顯示一般訊息
 569   *
 570   * @param sMsg_
 571   */
 572  public void swMessage(String sMsg_) {
 573    MessageBox.createInfo()
 574        .withCaption("訊息")
 575        .withMessage(sMsg_)
 576        .withWidth("400px")
 577//        .withHeight("150")
 578        .withOkButton(ButtonOption.focus()).open();
 579  }
 580
 581  /**
 582   * 顯示一般訊息
 583   * @param sMsg_
 584   * @param oEventContext_
 585   * @param sMethod_
 586   */
 587  public void swMessageWithBtnEvent(String sMsg_,TEventContext oEventContext_,String sMethod_) {
 588    MessageBox.createInfo().withCaption("訊息")
 589        .withMessage(sMsg_).withWidth("400px").withHeight("150")
 590        .withOkButton(()->{
 591          oEventContext_.runEventMethod(sMethod_);
 592        },ButtonOption.focus())
 593        .open();
 594  }
 595
 596  /**
 597   * 取得登入畫面的輸入值
 598   *
 599   * @param oData_
 600   * @return
 601   */
 602  public boolean receiveLoginData(TLoginData oData_) {
 603    if (!"".equals(oData_.UIxS_NO) && !"".equals(oData_.UIxPASSWORD)
 604        && !"".equals(oData_.UIxSALE_DATE)) {
 605      return true;
 606    }
 607    return false;
 608  }
 609
 610  //將sMsg_輸出至輸入框
 611  public void wrMessageToMainDisplay(String sMsg_) {
 612    if ((UI.getCurrent() instanceof webccr)){
 613      ((webccr) UI.getCurrent()).setShowMsg(sMsg_);
 614      ((webccr) UI.getCurrent()).setInput("");
 615      FoCcr.setMainDisplayReset(true);
 616    }
 617  }
 618
 619  /**
 620   * 取得主畫面, 輸入框已輸入字串值
 621   *
 622   * @return
 623   */
 624  public String receivceMainDisplayEntryData() {
 625    return ((webccr) UI.getCurrent()).getInput();
 626  }
 627
 628  /**
 629   * 更新主畫面交易內容, 不含grid. N(not)I(Include)G(Grid)
 630   */
 631  public void updateMainFormNIG() {
 632    try {
 633      webccr _oWebccr = (webccr) UI.getCurrent();
 634//      _oWebccr.setInput("");
 635      if (FoCcr.getCurrentSale() != null) {
 636        _oWebccr.getFlSlNo().setValue(FoCcr.getCurrentSale().getSn() + "");//交易序號
 637        _oWebccr.getFlUID().setValue(FoCcr.getCurrentSale().getUID());//統一編號
 638        _oWebccr.getFlCsNo().setValue(FoCcr.getCurrentSale().getFsCS_NO()); // 經銷商
 639//        _oWebccr.getFlOwner().setValue(FoCcr.getCurrentSale().getOwner()); //買受人
 640        _oWebccr.getFlTotalAmt().setValue(((long) FoCcr.getCurrentSale().getRealSaleTotal()) + "");//銷售金額
 641        _oWebccr.getFlTotalOrderAmt().setValue(((long) FoCcr.getCurrentSale().getOrderTotal()) + "");//客訂金額
 642        _oWebccr.getFlTotalPayAmt().setValue(((long) FoCcr.getCurrentSale().getRealSaleTotal()) + "");//應付金額
 643        _oWebccr.getFlChangeAmt().setValue(((long) FoCcr.getCurrentSale().getUnpaidAmout()) + ""); //未付款(+)/找零(-)
 644        TInvoice _oInvoce = FoCcr.getCurrentSale().getInvoice();
 645        if (_oInvoce != null) {
 646          if (!emisUtil.isEmpty(_oInvoce.getDonate())) {
 647            _oWebccr.getFlCarryDonate().setValue(_oInvoce.getDonate());
 648          } else if (!emisUtil.isEmpty(_oInvoce.getCarrierCode())) {
 649            _oWebccr.getFlCarryDonate().setValue(_oInvoce.getCarrierCode());
 650          }
 651        }
 652      } else {
 653        _oWebccr.getFlSlNo().setValue("");//交易序號
 654        _oWebccr.getFlUID().setValue("");//統一編號
 655        _oWebccr.getFlCsNo().setValue(""); // 經銷商
 656//        _oWebccr.getFlOwner().setValue(""); //買受人
 657        _oWebccr.getFlTotalAmt().setValue("0");//銷售金額
 658        _oWebccr.getFlTotalOrderAmt().setValue("0");//客訂金額
 659        _oWebccr.getFlTotalPayAmt().setValue("0");//應付金額
 660        _oWebccr.getFlChangeAmt().setValue("0"); //未付款(+)/找零(-)
 661        _oWebccr.getFlCarryDonate().setValue("");
 662      }
 663
 664      if (FoCcr.getUser() != null) {
 665        _oWebccr.getFlSaler().setValue(FoCcr.getUser().getFLDxUSERNAME()); //售貨員
 666      } else {
 667        _oWebccr.getFlSaler().setValue(""); //售貨員
 668      }
 669      _oWebccr.getFlSysDate().setValue(FoCcr.getSaleDate() + "/" + emisUtil.todayTime(":"));//交易日期
 670      _oWebccr.getFlStoreNo().setValue(FoCcr.getStore().getFLDxS_NO());//門市
 671      _oWebccr.getFlIdNo().setValue(FoCcr.getCcrID());//機號
 672      _oWebccr.getFlInvNo().setValue(FoCcr.getCurrentInvoiceNo());//發票編號
 673
 674      //TODO
 675      _oWebccr.getFlInvCount().setValue("");//發票剩餘張數
 676      _oWebccr.getFlCcrState().setValue(getCcrStateStr(FoCcr.getCurrnetState()));
 677
 678      //會員信息
 679      if (FoCcr.getCurrentSale() != null && FoCcr.getCurrentSale().getFoMerber()!=null) {
 680        TMember member= FoCcr.getCurrentSale().getFoMerber();
 681        _oWebccr.getFlMEM_NAME().setValue(member.getFLDxNAME());
 682        _oWebccr.getFlMEM_POINT().setValue(member.getFLDxPOINT());
 683        if ("Y".equals(member.getFLDxDOUBLE_AUTH())) {
 684          _oWebccr.getFlMEM_DOUBLE_AUTH().setValue(member.getFLDxDOUBLE_AUTH()
 685            + "(" + member.getFLDxPOINT_MAX_EXCHANGE_RATE() + "%)");
 686        } else {
 687          _oWebccr.getFlMEM_DOUBLE_AUTH().setValue(member.getFLDxDOUBLE_AUTH());
 688        }
 689        _oWebccr.getFlMEM_JOINSTORE ().setValue(member.getFLDxJOINSTORE());
 690        _oWebccr.getFlMEM_EMAIL().setValue(member.getFLDxEMAIL());
 691        _oWebccr.getFlMEM_ADDRESS().setValue(member.getFLDxADDRESS());
 692        _oWebccr.getFlMEM_SEX().setValue(member.getFLDxSEX());
 693        _oWebccr.getFlMEM_BIRTHDAY().setValue(member.getFLDxBIRTHDAY());
 694        _oWebccr.getFlMEN_NUMBER().setValue(member.getFLDxMOBILE());
 695      }else{
 696        _oWebccr.getFlMEM_NAME().setValue("");
 697        _oWebccr.getFlMEM_POINT().setValue("");
 698        _oWebccr.getFlMEM_DOUBLE_AUTH().setValue("");
 699        _oWebccr.getFlMEM_JOINSTORE ().setValue("");
 700        _oWebccr.getFlMEM_EMAIL().setValue("");
 701        _oWebccr.getFlMEM_ADDRESS().setValue("");
 702        _oWebccr.getFlMEM_SEX().setValue("");
 703        _oWebccr.getFlMEM_BIRTHDAY().setValue("");
 704        _oWebccr.getFlMEN_NUMBER().setValue("");
 705      }
 706    } catch (Exception e) {
 707      CcrUtil.setMessage(emisUtil.getStackTrace(e));
 708    }
 709  }
 710
 711  /**
 712   * 更新主畫面上所有內容值
 713   */
 714  public void updateMainForm() {
 715    try {
 716      webccr _oWebccr = (webccr) UI.getCurrent();
 717      if (FoCcr.getCurrentSale() != null) {
 718        ((TSalesTable) _oWebccr.getFTSaleTable()).refreshTbl(FoCcr);
 719        ((TSalePayTable) _oWebccr.getFTSalePayTable()).refreshTbl(FoCcr);
 720      } else {
 721        ((TSalesTable) _oWebccr.getFTSaleTable()).removeAllItems();
 722        ((TSalePayTable) _oWebccr.getFTSalePayTable()).removeAllItems();
 723      }
 724      updateMainFormNIG();
 725    } catch (Exception e) {
 726//      ((webccr) UI.getCurrent()).getlog().error(webccr.class, e);
 727      CcrUtil.setMessage(emisUtil.getStackTrace(e));
 728    }
 729  }
 730
 731  /**
 732   * 插入oSaleItem_至主畫上交易明細grid
 733   *
 734   * @param oSaleItem_
 735   * @return
 736   */
 737  public boolean insertSaleItemToMainForm(TSaleItem oSaleItem_) {
 738    try {
 739      webccr _oWebccr = (webccr) UI.getCurrent();
 740      TSalesTable _oTbl = ((TSalesTable) _oWebccr.getFTSaleTable());
 741      _oTbl.addItem(oSaleItem_);
 742      //Todo select 把子標移到新增加當下SaleItem
 743//      _oTbl.select(oSaleItem_);
 744      updateMainForm();
 745      return true;
 746    } catch (Exception e) {
 747//      ((webccr) UI.getCurrent()).getlog().error(webccr.class, e);
 748      CcrUtil.setMessage(emisUtil.getStackTrace(e));
 749    }
 750    return false;
 751  }
 752
 753  /**
 754   * 主畫面上將oSaleItem_標記刪除(雙刪線)
 755   *
 756   * @param oSaleItem_
 757   * @return
 758   */
 759  public boolean delSaleItemToMainForm(TSaleItem oSaleItem_) {
 760    updateMainForm();
 761    return false;
 762  }
 763
 764  //插入oPayment_至主畫面上付款明細
 765  public boolean insertPaymentToMainForm(TPayment oPayment_) {
 766    try {
 767      webccr _oWebccr = (webccr) UI.getCurrent();
 768      TSalePayTable _oTbl = ((TSalePayTable) _oWebccr.getFTSalePayTable());
 769      _oTbl.addItem(oPayment_);
 770      //Todo select 把子標移到新增加當下SaleItem
 771//      _oTbl.select(oSaleItem_);
 772      updateMainForm();
 773      return true;
 774    } catch (Exception e) {
 775//      ((webccr) UI.getCurrent()).getlog().error(webccr.class, e);
 776      CcrUtil.setMessage(emisUtil.getStackTrace(e));
 777    }
 778    return false;
 779  }
 780
 781  //主畫面上將oPayment_標記刪除
 782  public boolean delPaymentToMainForm(TPayment oPayment_) {
 783    updateMainForm();
 784    return false;
 785  }
 786
 787  //交易查詢
 788  public void swQuerySale(String sSaleDate_, TEventContext oEvent_, String sCancelMethod_) {
 789    SaleQry _oSaleQry = new SaleQry(sSaleDate_, oEvent_, sCancelMethod_);
 790    _oSaleQry.setModal(true);
 791    _oSaleQry.setResizable(false);
 792    _oSaleQry.setClosable(false);
 793    _oSaleQry.setWidth("95%");
 794    _oSaleQry.setHeight("100%");
 795    UI.getCurrent().addWindow(_oSaleQry);
 796  }
 797
 798  /**
 799   * 顯示清(讀)帳畫面, 畫面資料輸入完畢, 按下確認後, 將資料寫入oCcrLog_
 800   *
 801   * @param oEvent_
 802   * @param sOkMethod_
 803   * @param sCancelMethod_
 804   * @return
 805   */
 806  public boolean swSettleAccountsForm(TCcrLog oCcrLog_, TEventContext oEvent_, boolean isLogin, String sOkMethod_, String sCancelMethod_) {
 807    WinSettleAccount _oWinStlAcc = new WinSettleAccount(oCcrLog_, oEvent_, isLogin, sOkMethod_, sCancelMethod_);
 808    _oWinStlAcc.setModal(true);
 809    _oWinStlAcc.setResizable(false);
 810    _oWinStlAcc.setClosable(false);
 811    _oWinStlAcc.setHeight("100%");
 812    //_oWinStlAcc.setWidth("380px");  //add by Ares 20200701 振興券匯款、餘額的紀錄與計算,同現金方式
 813    _oWinStlAcc.setWidth("600px");
 814    UI.getCurrent().addWindow(_oWinStlAcc);
 815    return true;
 816  }
 817
 818  // 門號申辦 / 固網申辦
 819  public void swPhoneNumber(TEntryEdit oEdit_, TEventContext oEvent_, String sOkMethod_, String sCancelMethod_) {
 820    WinPhoneNumber _oPhoneNumber = new WinPhoneNumber(oEdit_, oEvent_, sOkMethod_, sCancelMethod_);
 821    _oPhoneNumber.setModal(true);
 822    _oPhoneNumber.setResizable(false);
 823    _oPhoneNumber.setClosable(false);
 824    _oPhoneNumber.setWidth("900px");
 825    //_oPhoneNumber.setHeight("85%");
 826    _oPhoneNumber.setHeight("90%");  //add by Ares 20190722 特殊商品才需輸入卡片金額
 827    _oPhoneNumber.addStyleName("v-scrollable");
 828    UI.getCurrent().addWindow(_oPhoneNumber);
 829  }
 830
 831  // 領機
 832  public void swReceivePhone(TEntryEdit oEdit_ ,TEventContext oEvent_, String sOkMethod_, String sCancelMethod_) {
 833    WinReceivePhone _oReceivePhone = new WinReceivePhone(oEdit_, oEvent_, sOkMethod_, sCancelMethod_);
 834    _oReceivePhone.setModal(true);
 835    _oReceivePhone.setResizable(false);
 836    _oReceivePhone.setClosable(false);
 837    _oReceivePhone.setWidth("500px");
 838    _oReceivePhone.setHeight("310px");
 839    UI.getCurrent().addWindow(_oReceivePhone);
 840  }
 841  // 弹窗-是否購買鈦金服務
 842  public void swTservice1(TEntryEdit oEdit_, TBtnTService oEvent_, String sOkMethod_, String sCancelMethod_) {
 843    WinTService1 _oTService1 = new WinTService1(oEdit_, oEvent_, sOkMethod_, sCancelMethod_);
 844    _oTService1.setModal(true);
 845    _oTService1.setResizable(false);
 846    _oTService1.setClosable(false);
 847    _oTService1.setWidth("600px");
 848    _oTService1.setHeight("450px");
 849    _oTService1.addStyleName("v-scrollable");
 850    UI.getCurrent().addWindow(_oTService1);
 851  }
 852  // 弹窗-鈦金服務 T_SERVICE 輸入客戶姓名、手機號碼(必填) 
 853  public void swTservice2(TEntryEdits oEdits_, TBtnTService oEvent_, String sOkMethod_, String sCancelMethod_) {
 854    WinTService2 _oTService1 = new WinTService2(oEdits_, oEvent_, sOkMethod_, sCancelMethod_);
 855    _oTService1.setModal(true);
 856    _oTService1.setResizable(false);
 857    _oTService1.setClosable(false);
 858    _oTService1.setWidth("600px");
 859    _oTService1.setHeight("240px");
 860    _oTService1.addStyleName("v-scrollable");
 861    UI.getCurrent().addWindow(_oTService1);
 862  }
 863  // 彈窗--是否購買鈦金服務(新)
 864  public void swTserviceNew1(TEntryEdit oEdit_, TBtnTServiceNew oEvent_, String sOkMethod_, String sCancelMethod_) {
 865    WinTServiceNew1 _oTServiceNew1 = new WinTServiceNew1(oEdit_, oEvent_, sOkMethod_, sCancelMethod_);
 866    _oTServiceNew1.setModal(true);
 867    _oTServiceNew1.setResizable(false);
 868    _oTServiceNew1.setClosable(false);
 869    _oTServiceNew1.setWidth("600px");
 870    _oTServiceNew1.setHeight("450px");
 871    _oTServiceNew1.addStyleName("v-scrollable");
 872    UI.getCurrent().addWindow(_oTServiceNew1);
 873  }
 874  // 弹窗-鈦金服務 T_SERVICE_NEW 輸入客戶姓名、手機號碼(必填)、身分證後四碼(AS)
 875  public void swTserviceNew2(TEntryEdits oEdits_, TBtnTServiceNew oEvent_, String sOkMethod_, String sCancelMethod_) {
 876    WinTServiceNew2 _oTServiceNew2 = new WinTServiceNew2(oEdits_, oEvent_, sOkMethod_, sCancelMethod_);
 877    _oTServiceNew2.setModal(true);
 878    _oTServiceNew2.setResizable(false);
 879    _oTServiceNew2.setClosable(false);
 880    _oTServiceNew2.setWidth("600px");
 881    _oTServiceNew2.setHeight("250px");
 882    _oTServiceNew2.addStyleName("v-scrollable");
 883    UI.getCurrent().addWindow(_oTServiceNew2);
 884  }
 885  // 弹窗--經銷&企業戶 CS_NO
 886  public void swCsNo(TEntryEdit oEdit_, TBtnCS_NO oEvent_, String sOkMethod_, String sCancelMethod_) {
 887    WinCsNo _oTService1 = new WinCsNo(oEdit_, oEvent_, sOkMethod_, sCancelMethod_);
 888    _oTService1.setModal(true);
 889    _oTService1.setResizable(false);
 890    _oTService1.setClosable(false);
 891    _oTService1.setWidth("520px");
 892    _oTService1.setHeight("600px");
 893    _oTService1.addStyleName("v-scrollable");
 894    UI.getCurrent().addWindow(_oTService1);
 895  }
 896  // 弹窗--代收
 897  public void swCollection(TBtnCollection oEvent_, String sOkMethod_, String sCancelMethod_) {
 898    WinCollection _oTService1 = new WinCollection(oEvent_, sOkMethod_, sCancelMethod_);
 899    _oTService1.setModal(true);
 900    _oTService1.setResizable(false);
 901    _oTService1.setClosable(false);
 902    _oTService1.setWidth("520px");
 903    _oTService1.setHeight("410px");
 904    _oTService1.addStyleName("v-scrollable");
 905    UI.getCurrent().addWindow(_oTService1);
 906  }
 907  // 弹窗-會員點數兌換-折抵金額
 908  public void swMemPointAmt(TEntryEdit oEdit_, TEventContext oEvent_, String sOkMethod_, String sCancelMethod_) {
 909    WinMemPointAmt _oTService1 = new WinMemPointAmt(oEdit_, oEvent_, sOkMethod_, sCancelMethod_);
 910    _oTService1.setModal(true);
 911    _oTService1.setResizable(false);
 912    _oTService1.setClosable(false);
 913    _oTService1.setWidth("600px");
 914    _oTService1.setHeight("220px");
 915    _oTService1.addStyleName("v-scrollable");
 916    UI.getCurrent().addWindow(_oTService1);
 917  }
 918  // 個案開帳
 919  public void swCaseSale(TEventContext oEvent_, String sCancelMethod_) {
 920    WinCaseSale _oCaseSale = new WinCaseSale(oEvent_, sCancelMethod_);
 921    _oCaseSale.setModal(true);
 922    _oCaseSale.setResizable(false);
 923    _oCaseSale.setClosable(false);
 924    _oCaseSale.setWidth("60%");
 925    _oCaseSale.setHeight("100%");
 926    UI.getCurrent().addWindow(_oCaseSale);
 927  }
 928  //彈窗--小白單手動列印
 929  public void swSMHandPrint(TEventContext oEvent_, String sOkMethod_){
 930    WinSM _oSM = new WinSM(oEvent_, sOkMethod_);
 931    _oSM.setModal(true);
 932    _oSM.setResizable(false);
 933    _oSM.setClosable(false);
 934    _oSM.setWidth("500px");
 935    //add by Ares 20181024 小白單批次列印
 936    //_oSM.setHeight("350px");
 937    _oSM.setHeight("450px");
 938    _oSM.addStyleName("v-scrollable");
 939    UI.getCurrent().addWindow(_oSM);
 940  }
 941
 942
 943  //彈窗--全退&作廢
 944  public void swFullVoid(TEventContext oEvent_, String sOkMethod_, String sCancelMethod_){
 945    WinFullVoid _oFullVoid = new WinFullVoid(oEvent_, sOkMethod_, sCancelMethod_);
 946    _oFullVoid.setModal(true);
 947    _oFullVoid.setResizable(false);
 948    _oFullVoid.setClosable(false);
 949    _oFullVoid.setWidth("90%");
 950    _oFullVoid.setHeight("90%");
 951    _oFullVoid.addStyleName("v-scrollable");
 952    UI.getCurrent().addWindow(_oFullVoid);
 953  }
 954
 955  /**
 956   *  作廢或折讓選項
 957   *  1. INV_TYPE = 6 直接作廢 不用輸入發票編號與隨機碼
 958   *  2. (INV_TYPE = 8 || INV_TYPE = 4) & 跨期 -> 折讓
 959   *  3. INV_TYPE = 8 & (載具||愛心碼) & 無跨期 > 作廢 不用輸入發票編號與隨機碼
 960   *  4 (INV_TYPE = 8 || INV_TYPE = 4) & 無跨期 > 其他
 961   */
 962  //中華家電宅配 by daff 20200107
 963  public void swVoidDisc(TEventContext oEvent_, String sOkMethod_) {
 964    webccr webccr = (webccr) UI.getCurrent();
 965    String OriginDate = webccr.getFoCCR().getCurrentSale().getOriginDate();
 966    String CreateDate = webccr.getFoCCR().getCurrentSale().getCreateDate();
 967    boolean bFALG = CcrUtil.isDISCOUNT(OriginDate, CreateDate);
 968//    ((webccr) UI.getCurrent()).getlog().info(webccr.class, "VOID bFALG=" + bFALG);
 969    CcrUtil.setMessage("VOID bFALG=" + bFALG);
 970    boolean bEnable = webccr.getFoCCR().getCurrentSale().getInvType().equals(TCcrConst.INV_TYPE_NONE) ? true : false;
 971//    ((webccr) UI.getCurrent()).getlog().info(webccr.class, "VOID bEnable=" + bEnable);
 972    CcrUtil.setMessage("VOID bEnable=" + bEnable);
 973    String SL_INVTYPE = webccr.getFoCCR().getCurrentSale().getInvType(); //發票別
 974
 975    //中華家電宅配 by daff 20200107 開窗(全退 作廢/折讓/取消) 前檢核 - 20200915 fix
 976    WinVoid_Disc _Void_Disc = new WinVoid_Disc(oEvent_, sOkMethod_);
 977    boolean open_ = _Void_Disc.chkMBMS_disc(oEvent_, sOkMethod_);
 978    if (open_) {
 979        if (bEnable) {
 980            //作廢
 981            webccr.getFoCCR().getCurrentSale().setIncomeKind(TCcrConst.SIK_CANCEL); // 收入類別
 982            //WinVoid_Disc _Void_Disc = new WinVoid_Disc(oEvent_, sOkMethod_);
 983            _Void_Disc = new WinVoid_Disc(oEvent_, sOkMethod_);
 984            _Void_Disc.doOK(oEvent_, sOkMethod_);
 985        } else if (!bEnable && !bFALG) {
 986            // 折讓
 987            webccr.getFoCCR().getCurrentSale().setIncomeKind(TCcrConst.SIK_DISCOUNT);  // 收入類別
 988            webccr.getFoCCR().getCurrentSale().setInvType(TCcrConst.INV_TYPE_DISCOUNT); // 發票別
 989            //WinVoid_Disc _Void_Disc = new WinVoid_Disc(oEvent_, sOkMethod_);
 990            _Void_Disc = new WinVoid_Disc(oEvent_, sOkMethod_);
 991            _Void_Disc.doOK(oEvent_, sOkMethod_);
 992        } else if (SL_INVTYPE.equals(TCcrConst.INV_TYPE_ELEC) &&
 993                (!emisUtil.isEmpty(webccr.getFoCCR().getCurrentSale().getInvoice().getCarrierType()) ||
 994                        !emisUtil.isEmpty(webccr.getFoCCR().getCurrentSale().getInvoice().getDonate())) &&
 995                bFALG) {
 996            webccr.getFoCCR().getCurrentSale().setIncomeKind(TCcrConst.SIK_CANCEL); // 收入類別
 997            //WinVoid_Disc _Void_Disc = new WinVoid_Disc(oEvent_, sOkMethod_);
 998            _Void_Disc = new WinVoid_Disc(oEvent_, sOkMethod_);
 999            _Void_Disc.doOK(oEvent_, sOkMethod_);
1000        } else {
1001            //WinVoid_Disc _Void_Disc = new WinVoid_Disc(oEvent_, sOkMethod_);
1002            _Void_Disc = new WinVoid_Disc(oEvent_, sOkMethod_);
1003            //boolean open_ = _Void_Disc.chkMBMS_disc(oEvent_, sOkMethod_);//中華家電宅配 by daff 20200107 開窗(全退 作廢/折讓/取消) 前檢核
1004            _Void_Disc.setModal(true);
1005            _Void_Disc.setResizable(false);
1006            _Void_Disc.setClosable(false);
1007            _Void_Disc.setWidth("280px");
1008            _Void_Disc.setHeight("240px");
1009            _Void_Disc.addStyleName("v-scrollable");
1010            //UI.getCurrent().addWindow(_Void_Disc);
1011            //if(open_) {//中華家電宅配 by daff 20200107
1012            UI.getCurrent().addWindow(_Void_Disc);
1013            //}
1014        }
1015    }
1016  }
1017  // 弹窗-二手機回收作業
1018  public void swSenaoSec(TSenaoSec FoSenaoSec, TEventContext oEvent_, String sOkMethod_, String sCancelMethod_) {
1019    WinSenaoSec _oTService1 = new WinSenaoSec(FoSenaoSec, oEvent_, sOkMethod_, sCancelMethod_);
1020    _oTService1.setModal(true);
1021    _oTService1.setResizable(false);
1022    _oTService1.setClosable(false);
1023    _oTService1.setWidth("900px");
1024    _oTService1.setHeight("600px");
1025    _oTService1.addStyleName("v-scrollable");
1026    UI.getCurrent().addWindow(_oTService1);
1027  }
1028  // 銷退/重銷 申請 (鈦金、IMEI)
1029  public void swReturn(TEntryEdits oEdits_, TButtonEventContext oEvent_, ArrayList listReturn_, String sOkMethod_, String sCancelMethod_) {
1030    WinSalesReturn _oSalesReturn = new WinSalesReturn(oEdits_, oEvent_, listReturn_, sOkMethod_, sCancelMethod_);
1031    _oSalesReturn.setModal(true);
1032    _oSalesReturn.setResizable(false);
1033    _oSalesReturn.setClosable(false);
1034    _oSalesReturn.setWidth("30%");
1035    _oSalesReturn.setHeight("65%");
1036    _oSalesReturn.addStyleName("v-scrollable");
1037    UI.getCurrent().addWindow(_oSalesReturn);
1038  }
1039  // 門號解約 / 固網解約
1040  public void swCancelContract(TEntryEdits oEdits_, TButtonEventContext oEvent_, int iType_, String sOkMethod_, String sCancelMethod_) {
1041    WinCancelContract _oCancelContract = new WinCancelContract(oEdits_, oEvent_, iType_, sOkMethod_, sCancelMethod_);
1042    _oCancelContract.setModal(true);
1043    _oCancelContract.setResizable(false);
1044    _oCancelContract.setClosable(false);
1045    _oCancelContract.setWidth("60%");
1046    _oCancelContract.setHeight("90%");
1047    _oCancelContract.addStyleName("v-scrollable");
1048    UI.getCurrent().addWindow(_oCancelContract);
1049  }
1050  // 交易備忘-聯單號碼&手機號碼&個資 (門號解約/固網解約)
1051  public void swSaleMemo(TEntryEdits oEdits_, TButtonEventContext oEvent_, String sOkMethod_) {
1052    WinSaleMemo _oSaleMemo = new WinSaleMemo(oEdits_, oEvent_, sOkMethod_);
1053    _oSaleMemo.setModal(true);
1054    _oSaleMemo.setResizable(false);
1055    _oSaleMemo.setClosable(false);
1056    _oSaleMemo.setWidth("30%");
1057    _oSaleMemo.setHeight("30%");
1058    _oSaleMemo.addStyleName("v-scrollable");
1059    UI.getCurrent().addWindow(_oSaleMemo);
1060  }
1061  // 包膜(料號 4802開頭)作業 / 有客訂商品且非電視宅配 顧客資料
1062  //add by Ares 20181107 電視宅配修改
1063  //public void swCustomer(TEventContext oEvent_, String sCaption_, String sOkMethod_, String sIMEI_) {
1064  public void swCustomer(TEventContext oEvent_, String sCaption_, String sOkMethod_, String sCancelMethod_, String sIMEI_) {
1065    //WinCustomer _oCustomer = new WinCustomer(oEvent_, sCaption_, sOkMethod_, sIMEI_);
1066    WinCustomer _oCustomer = new WinCustomer(oEvent_, sCaption_, sOkMethod_, sCancelMethod_, sIMEI_);
1067    _oCustomer.setModal(true);
1068    _oCustomer.setResizable(false);
1069    _oCustomer.setClosable(false);
1070    _oCustomer.setWidth("47%");
1071    _oCustomer.setHeight("70%");
1072    UI.getCurrent().addWindow(_oCustomer);
1073  }
1074  // 宅配派工
1075  //add by Ares 20181107 電視宅配修改
1076  //public void swDelivery(TEventContext oEvent_, String sOkMethod_, boolean bIsOrder) {
1077  public void swDelivery(TEventContext oEvent_, String sOkMethod_, String sCancelMethod_, boolean bIsOrder) {
1078    //WinDelivery _oDelivery = new WinDelivery(oEvent_, sOkMethod_);
1079    WinDelivery _oDelivery = new WinDelivery(oEvent_, sOkMethod_, sCancelMethod_);
1080    _oDelivery.setModal(true);
1081    _oDelivery.setResizable(false);
1082    _oDelivery.setClosable(false);
1083    _oDelivery.setWidth("38%");
1084    _oDelivery.setHeight("100%");
1085    _oDelivery.setOrder(bIsOrder);
1086    UI.getCurrent().addWindow(_oDelivery);
1087  }
1088  // 特殊商品快取功能
1089  public void swSpecialProduct(TEntryEdits oEdits_, TButtonEventContext oEvent_, ArrayList listProduct_, String sOkMethod_, String sCancelMethod_) {
1090    WinSpecialProduct _oSpecialProduct = new WinSpecialProduct(oEdits_, oEvent_, listProduct_, sOkMethod_, sCancelMethod_);
1091    _oSpecialProduct.setModal(true);
1092    _oSpecialProduct.setResizable(false);
1093    _oSpecialProduct.setClosable(false);
1094    _oSpecialProduct.setWidth("30%");
1095    _oSpecialProduct.setHeight("70%");
1096    _oSpecialProduct.addStyleName("v-scrollable");
1097    UI.getCurrent().addWindow(_oSpecialProduct);
1098  }
1099  // 愛心碼
1100  public void swEinvDonate(TEntryEdits oEdits_, TButtonEventContext oEvent_, ArrayList listDonate_, String sOkMethod_, String sCancelMethod_) {
1101    WinEinvDonate _oEinvDonate = new WinEinvDonate(oEdits_, oEvent_, listDonate_, sOkMethod_, sCancelMethod_);
1102    _oEinvDonate.setModal(true);
1103    _oEinvDonate.setResizable(false);
1104    _oEinvDonate.setClosable(false);
1105    _oEinvDonate.setWidth("30%");
1106    _oEinvDonate.setHeight("70%");
1107    _oEinvDonate.addStyleName("v-scrollable");
1108    UI.getCurrent().addWindow(_oEinvDonate);
1109  }
1110  // 預購取件 企客(ENT)特殊處理
1111  public void swPreOrderCsNo(TEntryEdits oEdits_, TButtonEventContext oEvent_, ArrayList listSale_, String sPayMethod_, String sCancelMethod_) {
1112    WinPreOrderCsNo _oPreOrderCsNo = new WinPreOrderCsNo(oEdits_, oEvent_, listSale_, sPayMethod_, sCancelMethod_);
1113    _oPreOrderCsNo.setModal(true);
1114    _oPreOrderCsNo.setResizable(false);
1115    _oPreOrderCsNo.setClosable(false);
1116    _oPreOrderCsNo.setWidth("50%");
1117    _oPreOrderCsNo.setHeight("70%");
1118    UI.getCurrent().addWindow(_oPreOrderCsNo);
1119  }
1120  // 門市繳費畫面
1121  public void swStorePayment(TBtnStorePayment oEvent_, String sOkMethod_, String sCancelMethod_) {
1122    WinStorePayment _oStorePayment = new WinStorePayment(oEvent_, sOkMethod_, sCancelMethod_);
1123    _oStorePayment.setModal(true);
1124    _oStorePayment.setResizable(false);
1125    _oStorePayment.setClosable(false);
1126    _oStorePayment.setWidth("600px");
1127    _oStorePayment.setHeight("500px");
1128    UI.getCurrent().addWindow(_oStorePayment);
1129  }
1130  // 舊機回收(一般)
1131  public void swSenaoSecNew(TSenaoSecNew SenaoSecNew, TEventContext oEvent_, String sOkMethod_, String sCancelMethod_) {
1132    WinSenaoSecNew _oSenaoSecNew = new WinSenaoSecNew(SenaoSecNew, oEvent_, sOkMethod_, sCancelMethod_);
1133    _oSenaoSecNew.setModal(true);
1134    _oSenaoSecNew.setResizable(false);
1135    _oSenaoSecNew.setClosable(false);
1136    _oSenaoSecNew.setWidth("400px");
1137    _oSenaoSecNew.setHeight("200px");
1138    UI.getCurrent().addWindow(_oSenaoSecNew);
1139  }
1140  //dongle機交易明細查詢
1141  public void swDongleUuCard() {
1142    WinUuCardDongle _oDongleUuCard = new WinUuCardDongle();
1143    _oDongleUuCard.setModal(true);
1144    _oDongleUuCard.setResizable(false);
1145    _oDongleUuCard.setClosable(false);
1146    _oDongleUuCard.setWidth("400px");
1147    _oDongleUuCard.setHeight("240px");
1148//    _oDongleUuCard.addStyleName("v-scrollable");
1149    UI.getCurrent().addWindow(_oDongleUuCard);
1150  }
1151  // LINE PAY 識別碼
1152  public void swLinePayIdentifier(int iEntryAmt, TBtnLinePay oEvent_) {
1153    WinLinePay _oLinePay = new WinLinePay(iEntryAmt, oEvent_);
1154    _oLinePay.setModal(true);
1155    _oLinePay.setResizable(false);
1156    _oLinePay.setClosable(false);
1157    _oLinePay.setWidth("400px");
1158    _oLinePay.setHeight("180px");
1159    UI.getCurrent().addWindow(_oLinePay);
1160  }
1161
1162  // 會員福利金QRCODE
1163  public void swBenefitQRCode(TBtnBenefit oEvent_) {
1164    WinBenefit _oBenefit = new WinBenefit(oEvent_);
1165    _oBenefit.setModal(true);
1166    _oBenefit.setResizable(false);
1167    _oBenefit.setClosable(false);
1168    _oBenefit.setWidth("400px");
1169    _oBenefit.setHeight("180px");
1170    UI.getCurrent().addWindow(_oBenefit);
1171  }
1172
1173  //add by Ares 20181009 HAMIPOINT QRCODE
1174  public void swHamiPointQRCode(TBtnHamiPoint oEvent_) {
1175    WinHamiPoint _oHamiPoint = new WinHamiPoint(oEvent_);
1176    _oHamiPoint.setModal(true);
1177    _oHamiPoint.setResizable(false);
1178    _oHamiPoint.setClosable(false);
1179    _oHamiPoint.setWidth("400px");
1180    _oHamiPoint.setHeight("180px");
1181    UI.getCurrent().addWindow(_oHamiPoint);
1182  }
1183  //add by Ares 20191120 舊會員程式MARK
1184  /*
1185  // 輸入會員視窗
1186  public void swMemQry(TEventContext oEvent_, String sOkMethod_, String sCancelMethod_) {
1187    WinMemQry _oWinMemQry = new WinMemQry(oEvent_, sOkMethod_, sCancelMethod_);
1188    _oWinMemQry.setModal(true);
1189    _oWinMemQry.setResizable(false);
1190    _oWinMemQry.setClosable(false);
1191    _oWinMemQry.setWidth("40%");
1192    _oWinMemQry.setHeight("30%");
1193    UI.getCurrent().addWindow(_oWinMemQry);
1194  }
1195*/
1196    //add by Ares 20190502 會員分級
1197    // 新輸入會員視窗
1198    //public void swQueryMemberInfo(TEventContext oEvent_, String sOkMethod_, String sCancelMethod_) {
1199    public void swQueryMemberInfo(TEventContext oEvent_, String sOkMethod_, String sCancelMethod_, String Query_Mode_) {    //add by Ares 20190829 會員分級問題修正
1200        WinQueryMemberInfo _oWinQueryMemberInfo = new WinQueryMemberInfo(oEvent_, sOkMethod_, sCancelMethod_, Query_Mode_);
1201        _oWinQueryMemberInfo.setModal(true);
1202        _oWinQueryMemberInfo.setResizable(false);
1203        _oWinQueryMemberInfo.setClosable(false);
1204        _oWinQueryMemberInfo.setWidth("50%");
1205        //_oWinQueryMemberInfo.setHeight("30%");
1206        UI.getCurrent().addWindow(_oWinQueryMemberInfo);
1207    }
1208
1209    //add by Ares 20191118 一致性員購
1210    // 輸入員工代碼視窗
1211    public void swQueryEmpPurchaseInfo(TEntryEdit oEdit_, TEventContext oEvent_, String sOkMethod_, String sCancelMethod_, String sPartnerEmployeeId_) {
1212        WinEmpPurchaseInfo _oTService1 = new WinEmpPurchaseInfo(oEdit_, oEvent_, sOkMethod_, sCancelMethod_, sPartnerEmployeeId_);
1213        _oTService1.setModal(true);
1214        _oTService1.setResizable(false);
1215        _oTService1.setClosable(false);
1216        _oTService1.setWidth("600px");
1217        _oTService1.setHeight("220px");
1218        _oTService1.addStyleName("v-scrollable");
1219        UI.getCurrent().addWindow(_oTService1);
1220    }
1221    /*
1222    public void swQueryEmpPurchaseInfo(TEventContext oEvent_, String sOkMethod_, String sCancelMethod_, String Query_Mode_) {    //add by Ares 20190

Large files files are truncated, but you can click here to view the full file