/**
 * @version $Id : UIShopListCond.java,v 1.0 Exp $
 * @author      : xxxx xx
 * <br>Description :ショップ管理の一覧・検索の画面に対するbeansクラスを作成します。
 * <p>History</p>
 * <p>Author&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reason</p>
 * ============&nbsp;&nbsp;&nbsp;==========&nbsp;&nbsp;===========================<br>
 * 							  2003/08/05  Original
 */
package jp.co.sint.beans.mallmgr;

import javax.servlet.http.*;
import java.util.*;
import java.sql.*;

import org.apache.log4j.Category;
import jp.co.sint.database.*;
import jp.co.sint.basic.*;
import jp.co.sint.config.*;
import jp.co.sint.tools.*;

// 7.1.1 ST0236 追加

public class UICustListCond extends SIBasic {
  // ログ用のインスタンスの生成
  private static Category log = Category.getInstance(SIConfig.SILOG4J_WEBSHOP_CATEGORY_NAME);
  // 全ての条件を保存する用
  SITableConditionManager tableConditionMan = new SITableConditionManager();
  
  // 7.2.1 ST2015 修正 ここから
  private String custCodeFrom = "";
  private String custCodeTo = "";
  // 7.2.1 ST2015 修正 ここまで
  private String[] memberLevelCodeUI = new String[0];
  private String memberLevelFirst = "1";
  private String custCompanyFlg = "";
  private String custName = "";
  private String custPronName = "";
  private String newMailFlg = "";
  private String emailTxt = "";
  private String mailExpectFlg = "";// メール送信確認用フラグ
  private int intDelFlg = Integer.parseInt(SIConfig.SIDEL_FLG_NORMAL);// 削除フラグ 初期値は0: 7.3.0 ST2027 追加
  private String storeTelTxt = "";// 電話番号 7.3.0 PI-NES0501 追加
  private String registRoute = "";// 登録経路 7.3.0 PI-NES0501 追加
  private String companyName = "";// サロン名
  private String corporationName = "";// 会社名
  private String makerCode = "";
  private String address = "";// 都道府県
  private String address2 = "";// 市区町村
  private String job = "";
  private String chargeCode = "";
  private String howToKnow = "";// 顧客属性２
  private String[] hobby = new String[0];// 顧客属性３
  private String hobbySelect = "0";//顧客属性３検索条件選択 0:AND 1:OR
  private String receivableFlg = "";
  private String introductionMailFlg = "";
  private String noDeliveryFlg = "";
  private String memberLevelFixedFlg = "";
  private String pdfOutputFlg1 = "";
  private String pdfOutputFlg2 = "";
  private String rankChangeYear = "";
  private String rankChangeMonth = "";
  private String rePromotionFlg = "1";
  private String addressListFlg = "1";
  private String hairCosmeFlg = "";
  private String mailStatus = "";
  private String sendMailFlg = "";
  private String noRequestFlg = "";
  private String openingFlg = "";
  private String openingPlanDateYearFrom = "";
  private String openingPlanDateMonthFrom = "";
  private String openingPlanDateYearTo = "";
  private String openingPlanDateMonthTo = "";
  
  // PDF出力タイプ
  private String pdfType = SIPDFConf.SIPDF_TYPE_DIRECTMAIL;
  
  // ダイレクトメール用の顧客コード
  private String[] custCodeHid = new String[0];
  
  // 削除用の顧客コード
  private String[] custCodeChk = new String[0];
  
  private boolean searchFlg = true;
  
  public UICustListCond() {}
  
  // コンストラクタ
  public UICustListCond(HttpServletRequest lRequest, SIURLParameter lUrlParam) {// 7.1.1 ST0236 修正
    init(lRequest, lUrlParam);// 7.1.1 ST0236 修正
  }
  
  /**
   * init 入力したデータを基づいて、このbeansを設定します。
   * 
   * @param request
   * @param lUrlParam
   * @return void
   * @throws なし
   */
  public void init(HttpServletRequest lRequest, SIURLParameter lUrlParam) {
    super.init(lRequest, lUrlParam);
    if (!((String) lUrlParam.getParam("editModeTxt")).equals(SIConfig.SIEDIT_MODE_INSERT) && !((String) lUrlParam.getParam("editModeTxt")).equals(SIConfig.SIEDIT_MODE_UPDATE)) {
      this.setEncode(SIConfig.SIENCODE_SHIFT_JIS);
      this.setCustCodeFrom((String) lUrlParam.getParam("custCodeFrom"));
      this.setCustCodeTo((String) lUrlParam.getParam("custCodeTo"));
      this.setMemberLevelCodeUI(lRequest.getParameterValues("memberLevelCodeUI_S"));
      this.setCustCompanyFlg((String) lUrlParam.getParam("custCompanyFlgTxt_S"));
      this.setCustName((String) lUrlParam.getParam("custName_S"));
      this.setCustPronName((String) lUrlParam.getParam("custPronName_S"));
      this.setNewMailFlg((String) lUrlParam.getParam("newMailFlg"));
      this.setEmailTxt((String) lUrlParam.getParam("emailTxt"));
      this.setDelFlg(Integer.parseInt((String) lUrlParam.getParam("intDelFlg")));
      this.setStoreTelTxt((String) lUrlParam.getParam("storeTelTxt"));
      this.setRegistRoute((String) lUrlParam.getParam("registRoute"));
      this.setCompanyName((String) lUrlParam.getParam("companyName"));
      this.setCorporationName((String) lUrlParam.getParam("corporationName"));
      this.setMakerCode((String) lUrlParam.getParam("makerCode"));
      this.setAddress((String) lUrlParam.getParam("address"));
      this.setAddress2((String) lUrlParam.getParam("address2"));
      this.setJob((String) lUrlParam.getParam("job"));
      this.setChargeCode((String) lUrlParam.getParam("chargeCode"));
      this.setHowToKnow((String) lUrlParam.getParam("howToKnow"));
      this.setHobby(lRequest.getParameterValues("hobby"));
      this.setHobbySelect((String) lUrlParam.getParam("hobbySelect"));
      this.setReceivableFlg((String) lUrlParam.getParam("receivableFlg"));
      this.setIntroductionMailFlg((String) lUrlParam.getParam("introductionMailFlg"));
      this.setNoDeliveryFlg((String) lUrlParam.getParam("noDeliveryFlg"));
      this.setMemberLevelFixedFlg((String) lUrlParam.getParam("memberLevelFixedFlg"));
      this.setMemberLevelFirst("0");
      this.setPdfOutputFlg1((String) lUrlParam.getParam("pdfOutputFlg1"));
      this.setPdfOutputFlg2((String) lUrlParam.getParam("pdfOutputFlg2"));
      this.setRankChangeYear((String) lUrlParam.getParam("rankChangeYear"));
      this.setRankChangeMonth((String) lUrlParam.getParam("rankChangeMonth"));
      this.setRePromotionFlg((String) lUrlParam.getParam("rePromotionFlg"));
      this.setAddressListFlg((String) lUrlParam.getParam("addressListFlg"));
      this.setHairCosmeFlg((String) lUrlParam.getParam("hairCosmeFlg"));
      this.setMailStatus((String) lUrlParam.getParam("mailStatus"));
      this.setSendMailFlg((String) lUrlParam.getParam("sendMailFlg"));
      this.setNoRequestFlg((String) lUrlParam.getParam("noRequestFlg"));
      this.setOpeningFlg((String) lUrlParam.getParam("openingFlg"));
      this.setOpeningPlanDateYearFrom((String) lUrlParam.getParam("openingPlanDateYearFrom"));
      this.setOpeningPlanDateMonthFrom((String) lUrlParam.getParam("openingPlanDateMonthFrom"));
      this.setOpeningPlanDateYearTo((String) lUrlParam.getParam("openingPlanDateYearTo"));
      this.setOpeningPlanDateMonthTo((String) lUrlParam.getParam("openingPlanDateMonthTo"));
    }
  }
  
  /**
   * validate 入力チェックを行います。
   * 
   * @param request データベースへのコネンクション
   * @return true:不正なデータがない false:不正なデータがある
   * @throws なし
   */
  public boolean validate(HttpServletRequest lRequest, Connection lConnection) {
    lRequest.removeAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY);
    SICustomErrors errors = new SICustomErrors();
    
    SICheckValid.checkValid(errors, "顧客コード", this.getCustCodeFrom(), SICheckDataConf.SICHECK_DATA_DIGIT_TYPE);
    SICheckValid.checkValid(errors, "顧客コード", this.getCustCodeFrom(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 16);
    SICheckValid.checkValid(errors, "顧客コードTo", this.getCustCodeTo(), SICheckDataConf.SICHECK_DATA_DIGIT_TYPE);
    SICheckValid.checkValid(errors, "顧客コードTo", this.getCustCodeTo(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 16);
    
    SICheckValid.checkValid(errors, "個人法人区分", this.getCustCompanyFlg(), SICheckDataConf.SICHECK_DATA_DIGIT_TYPE);
    SICheckValid.checkValid(errors, "個人法人区分", this.getCustCompanyFlg(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 1);
    
    SICheckValid.checkValid(errors, "顧客名", this.getCustName(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 40);// 7.2.0 ST0670 修正
    
    SICheckValid.checkValid(errors, "顧客名カナ", this.getCustPronName(), SICheckDataConf.SICHECK_DATA_ZENKAKU_KANA_TYPE);
    SICheckValid.checkValid(errors, "顧客名カナ", this.getCustPronName(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 50);
    
    SICheckValid.checkValid(errors, "メールアドレス", this.getEmailTxt(), SICheckDataConf.SICHECK_DATA_ASCII_TYPE);
    SICheckValid.checkValid(errors, "メールアドレス", this.getEmailTxt(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 128);
    
    SICheckValid.checkValid(errors, "サロン名", this.getCompanyName(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 40);
    SICheckValid.checkValid(errors, "会社名", this.getCorporationName(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 40);
    
    SICheckValid.checkValid(errors, "電話番号", this.getStoreTelTxt(), SICheckDataConf.SICHECK_DATA_DIGIT_TYPE);
    SICheckValid.checkValid(errors, "電話番号", this.getStoreTelTxt(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 16);
    
    if (SIUtil.isNotNull(this.getRankChangeYear()) ^ SIUtil.isNotNull(this.getRankChangeMonth())) {
      errors.addError(new SICustomError("input.data.date","ランク昇格月"));
    }
    
    if (SIUtil.isNotNull(this.getOpeningPlanDateYearFrom()) ^ SIUtil.isNotNull(this.getOpeningPlanDateMonthFrom())) {
      errors.addError(new SICustomError("input.data.date","オープン予定時期From"));
    }
    
    if (SIUtil.isNotNull(this.getOpeningPlanDateYearTo()) ^ SIUtil.isNotNull(this.getOpeningPlanDateMonthTo())) {
      errors.addError(new SICustomError("input.data.date","オープン予定時期To"));
    }
    
    if (SIUtil.isNotNull(this.getOpeningPlanDateYearFrom()) && SIUtil.isNotNull(this.getOpeningPlanDateMonthFrom())
        && SIUtil.isNotNull(this.getOpeningPlanDateYearTo()) && SIUtil.isNotNull(this.getOpeningPlanDateMonthTo())) {
      String openingPlanDateFrom = this.getOpeningPlanDateYearFrom()+"/"+this.getOpeningPlanDateMonthFrom()+"/01";
      String openingPlanDateTo = this.getOpeningPlanDateYearTo()+"/"+this.getOpeningPlanDateMonthTo()+"/01";
      try {
        if (!SICheckUtil.dateEqual(openingPlanDateFrom, openingPlanDateTo)) {
          SICheckValid.checkValid(errors, "オープン予定時期From", "オープン予定時期To", openingPlanDateFrom, openingPlanDateTo, SICheckDataConf.SICHECK_DATA_DATE_LESS_TYPE);
        }
      } catch (Exception e) {}
    }
    if (!errors.isEmpty()) {
      lRequest.setAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY, errors);
      this.searchFlg = false;
    }
    
    return errors.isEmpty();
  }
  
  /**
   * getCollection
   * 
   * @param Connection
   * @return Collection
   * @throws SIDBAccessException
   */
  public Collection getCollection(Connection lConnection, SILogin lLogin) throws SIDBAccessException {
    Statement lStatement = null;
    ResultSet lResultSet = null;
    SICust currCustomer = new SICust();
    StringBuffer lSqlBuf = new StringBuffer();
    Collection lResultColl = new ArrayList();
    StringBuffer lCountBuf = new StringBuffer();
    
    if (!this.searchFlg) { return lResultColl; }
    
    // 出力項目
    lCountBuf.append("SELECT count(DISTINCT c.custcode) FROM ");
    //lSqlBuf.append(" SELECT DISTINCT c.*,ch.chargename,olist.custcode AS oc,rlist.custcode AS rc,elist.custcode AS ec FROM  ");
    lSqlBuf.append(" SELECT DISTINCT c.*,ch.chargename FROM  ");
    
    lCountBuf.append(" (SELECT a.*,b.memberlevelname FROM custtbl a,memberlevelmtbl b WHERE a.memberlevelcode=b.memberlevelcode) c  ");
    lSqlBuf.append(" (SELECT a.*,b.memberlevelname FROM custtbl a,memberlevelmtbl b WHERE a.memberlevelcode=b.memberlevelcode) c  ");
    
    //lSqlBuf.append(" LEFT OUTER JOIN (SELECT h.custcode,max(h.ordercode) FROM ordertbl h,orderdetailtbl d WHERE h.ordercode=d.ordercode AND h.orderbranchcode=d.orderbranchcode AND h.status='1' AND d.shippmentdate IS NULL GROUP BY h.custcode) olist ON c.custcode=olist.custcode ");
    //lSqlBuf.append(" LEFT OUTER JOIN (SELECT custcode,max(reservecode) FROM reserveordertbl WHERE reserveflg IN ('0','1','3') GROUP BY custcode) rlist ON c.custcode=rlist.custcode ");
    //lSqlBuf.append(" LEFT OUTER JOIN (SELECT e.custcode,max(e.estimatecode) FROM estimatetbl e WHERE e.status=1 AND EXISTS (SELECT keepnumber FROM keepdetailtbl k WHERE e.keepnumber=k.keepnumber) GROUP BY e.custcode) elist ON c.custcode=elist.custcode ");
    
    lCountBuf.append(" LEFT OUTER JOIN (SELECT chargecode,chargename FROM chargetbl) ch ON c.chargecode=ch.chargecode ");
    lSqlBuf.append(" LEFT OUTER JOIN (SELECT chargecode,chargename FROM chargetbl) ch ON c.chargecode=ch.chargecode ");
    if (SIUtil.isNotNull(this.makerCode)) {
      lCountBuf.append(" LEFT OUTER JOIN custmakertbl f ON c.custcode = f.custcode ");
      lSqlBuf.append(" LEFT OUTER JOIN custmakertbl f ON c.custcode = f.custcode ");
    }
    if (this.hobby != null && this.hobby.length > 0 && !"0".equals(this.hobbySelect)) {
      lCountBuf.append(" LEFT OUTER JOIN (SELECT hobbyname,custcode FROM custhobbytbl) g ON c.custcode = g.custcode ");
      lSqlBuf.append(" LEFT OUTER JOIN (SELECT hobbyname,custcode FROM custhobbytbl) g ON c.custcode = g.custcode ");
    }
    lCountBuf.append(" WHERE 1=1");
    lSqlBuf.append(" WHERE 1=1");
    // 結合の条件
    String conditionSQL = this.getCondtionSQL();
    lCountBuf.append(conditionSQL);
    lSqlBuf.append(conditionSQL);
    
    log.debug("conditionSQL=" + conditionSQL);
    
    // 出力順
    lSqlBuf.append(" ORDER BY c.custcode DESC ");
    // 実行
    try {
      String rowCnt = SIDBUtil.getFirstData(lConnection, lCountBuf.toString());
      if (rowCnt.equals("") || rowCnt == null) {
        rowCnt = "0";
      }
      int lRecordCount = Integer.parseInt(rowCnt);// レコード数の取得
      
      int lPageSize = this.getPageSize();// ページサイズ
      int lPageNumber = this.getPageNumer();// ページ番号
      
      int lMaxPage = lRecordCount / lPageSize;
      if (lRecordCount % lPageSize > 0) {
        lMaxPage++;
      }
      if (lPageNumber > lMaxPage) lPageNumber = lMaxPage;
      
      // 開始レコードの番号の設定
      int lFromInx = (lPageNumber - 1) * lPageSize;
      // 終止のレコード番号の設定
      int lToInx = lFromInx + lPageSize - 1;
      if (lFromInx < 0) lFromInx = 0;
      if (lToInx < 0) lToInx = 0;
      
      log.debug("getCollection:lFromInx=" + lFromInx + ",lToInx=" + lToInx + ",lRecordCount=" + lRecordCount);
      
      log.debug("getCollection:lCmdtySqlBuf=" + lSqlBuf.toString());
      lStatement = lConnection.createStatement();
      lSqlBuf.append(" LIMIT ").append(lPageSize);
      if(lFromInx>0) lSqlBuf.append(" OFFSET ").append(lFromInx);
      lResultSet = lStatement.executeQuery(lSqlBuf.toString());
      
      for (int jj = 0; jj < lFromInx; jj++) lResultColl.add(null);
      
      int lIndex = 0;
      
      // レコードのセットの作成
      while (lResultSet.next() && lIndex < lPageSize) {
        currCustomer = new SICust();
        currCustomer.setEncode(SIConfig.SIENCODE_NONE);
        currCustomer.setCustCode(lResultSet.getString("CustCode"));
        currCustomer.setMemberLevelCode(lResultSet.getString("memberlevelcode"));
        currCustomer.setMemberLevelName(lResultSet.getString("memberlevelname"));
        currCustomer.setCustCompanyFlg(lResultSet.getString("custCompanyFlg"));
        currCustomer.setNewMailFlg(lResultSet.getString("NewMailFlg"));
        currCustomer.setIntroductionMailFlg(lResultSet.getString("introductionMailFlg"));
        currCustomer.setCustName(lResultSet.getString("custName"));
        currCustomer.setCustPronName(lResultSet.getString("custPronName"));
        currCustomer.setEmail(lResultSet.getString("Email"));
        currCustomer.setTel(lResultSet.getString("Tel"));
        currCustomer.setStoreTel(lResultSet.getString("StoreTel"));// 7.3.0 PI-NES0501 追加
        currCustomer.setRegistRoute(lResultSet.getString("RegistRoute"));// 7.3.0 PI-NES0501 追加
        currCustomer.setSex(lResultSet.getString("Sex"));
        currCustomer.setDelFlg(lResultSet.getInt("DelFlg"));// 7.3.0 ST2027 追加
        currCustomer.setCompanyName(lResultSet.getString("CompanyName"));
        currCustomer.setCorporationName(lResultSet.getString("CorporationName"));
        currCustomer.setCharge(lResultSet.getString("chargeName"));
        currCustomer.setPdfOutputDateTime(SIDBUtil.getDate(lResultSet.getTimestamp("pdfOutputDateTime")));
        currCustomer.setPdfOutputDateTime2(SIDBUtil.getDate(lResultSet.getTimestamp("pdfOutputDateTime2")));
        currCustomer.setPdfOutputDateTime3(SIDBUtil.getDate(lResultSet.getTimestamp("pdfOutputDateTime3")));
        currCustomer.setPdfOutputDateTime4(SIDBUtil.getDate(lResultSet.getTimestamp("pdfOutputDateTime4")));
        //if (SIUtil.isNotNull(lResultSet.getString("oc"))) currCustomer.setOrderFlg("1");
        //if (SIUtil.isNotNull(lResultSet.getString("rc"))) currCustomer.setReserveFlg("1");
        //if (SIUtil.isNotNull(lResultSet.getString("ec"))) currCustomer.setEstimateFlg("1");
        lResultColl.add(currCustomer);
        // メール送信確認用フラグ
        if (currCustomer.getNewMailFlg().equals("0")) {
          this.setMailExpectFlg("0");
        }
        lIndex++;
      }
      for (int jj = lFromInx + lPageSize; jj < lRecordCount; jj++)
        lResultColl.add(null);
      
    } catch (Exception ex) {
      log.debug("exception sql = " + lSqlBuf.toString());
      throw new SIDBAccessException(ex);
    } finally {
      SIDBUtil.close(lResultSet, lStatement);
    }
    return lResultColl;
  }
  
  /**
   * getCondtionSQL 検索条件に使用します。
   * 
   * @param
   * @return String
   * @throws
   */
  public String getCondtionSQL() {
    SITableConditionManager lConditionMan = new SITableConditionManager();
    
    //SITableCondition DD = new SITableCondition("", "c.CustCode", this.custCodeFrom, SIConfig.SICONDITION_TYPE_GREATER_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    SITableCondition DD = new SITableCondition("", "c.CustCode", this.custCodeFrom, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    DD.setBlankEnable(false);
    lConditionMan.add(DD);
    
    //DD = new SITableCondition("", "c.CustCode", this.custCodeTo, SIConfig.SICONDITION_TYPE_LESS_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    //lConditionMan.add(DD);
    
    if(this.memberLevelCodeUI != null && this.memberLevelCodeUI.length > 0) {
      StringBuffer sql = new StringBuffer();
      sql.append(" AND c.memberlevelcode IN (");
      for (int i=0; i<this.memberLevelCodeUI.length; i++){
        if (i>0) sql.append(",");
        sql.append(SIDBUtil.SQL2Str(this.memberLevelCodeUI[i]));
      }
      sql.append(")");
      DD = new SITableCondition(sql.toString());
      lConditionMan.add(DD);
    }else{
      DD = new SITableCondition(" AND false ");
      lConditionMan.add(DD);
    }
    
    DD = new SITableCondition("", "c.custCompanyFlg", this.custCompanyFlg, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    if (SIUtil.isNotNull(this.getPdfOutputFlg1())&&"0".equals(this.getPdfOutputFlg1())) {
      DD = new SITableCondition(" AND c.pdfOutputDateTime IS NOT NULL ");
      lConditionMan.add(DD);
    }else if (SIUtil.isNotNull(this.getPdfOutputFlg1())&&"1".equals(this.getPdfOutputFlg1())){
      DD = new SITableCondition(" AND c.pdfOutputDateTime IS NULL ");
      lConditionMan.add(DD);
    }
    
    if (SIUtil.isNotNull(this.getPdfOutputFlg2())&&"0".equals(this.getPdfOutputFlg2())) {
      DD = new SITableCondition(" AND ((c.pdfOutputDateTime2 IS NOT NULL AND c.memberlevelcode=1) OR (c.pdfOutputDateTime3 IS NOT NULL AND c.memberlevelcode=2) OR (c.pdfOutputDateTime4 IS NOT NULL AND c.memberlevelcode=3)) ");
      lConditionMan.add(DD);
    }else if (SIUtil.isNotNull(this.getPdfOutputFlg2())&&"1".equals(this.getPdfOutputFlg2())){
      DD = new SITableCondition(" AND ((c.pdfOutputDateTime2 IS NULL AND c.memberlevelcode=1) OR (c.pdfOutputDateTime3 IS NULL AND c.memberlevelcode=2) OR (c.pdfOutputDateTime4 IS NULL AND c.memberlevelcode=3)) ");
      lConditionMan.add(DD);
    }
    
    DD = new SITableCondition("", "c.newMailFlg", this.newMailFlg, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "c.mailStatus", this.mailStatus, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    if (SIUtil.isNotNull(this.getSendMailFlg())&&"1".equals(this.getSendMailFlg())) {
      DD = new SITableCondition(" AND c.newMailFlg='1' AND c.mailStatus IN ('0','8','9') ");
      lConditionMan.add(DD);
    }
    
    DD = new SITableCondition("", "c.introductionMailFlg", this.introductionMailFlg, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    String[] custNameList = this.custName.split(" |　");
    for (int i=0;i<custNameList.length;i++) {
      DD = new SITableCondition("", "c.custName", custNameList[i], SIConfig.SICONDITION_TYPE_LIKE, SIConfig.SICONDITION_TYPE_AND);
      lConditionMan.add(DD);
    }
    
    String[] custPronNameList = this.custPronName.split(" |　");
    for (int j=0;j<custPronNameList.length;j++) {
      DD = new SITableCondition("", "c.custPronName", custPronNameList[j], SIConfig.SICONDITION_TYPE_LIKE, SIConfig.SICONDITION_TYPE_AND);
      lConditionMan.add(DD);
    }
    
    DD = new SITableCondition("", "c.email", this.emailTxt, SIConfig.SICONDITION_TYPE_LIKE, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "c.companyname", this.companyName, SIConfig.SICONDITION_TYPE_LIKE, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "c.corporationname", this.corporationName, SIConfig.SICONDITION_TYPE_LIKE, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "f.makercode", this.makerCode, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "c.haircosmeflg", this.hairCosmeFlg, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "c.registRoute", this.getRegistRoute(), SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "c.noRequestFlg", this.getNoRequestFlg(), SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "c.openingFlg", this.getOpeningFlg(), SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    if (SIUtil.isNotNull(this.getAddressListFlg())&&"1".equals(this.addressListFlg)) {
      if (SIUtil.isNotNull(this.getAddress())&&SIUtil.isNotNull(this.getAddress2())) {
        DD = new SITableCondition(" AND c.custcode IN (SELECT ad.custcode FROM custaddresstbl ad WHERE ad.address1="+SIDBUtil.SQL2Str(this.getAddress())+" AND ad.address2||coalesce(ad.address3,'') LIKE '%"+SIDBUtil.SQL2Like(this.getAddress2())+"%') ");
        lConditionMan.add(DD);
      }else if (SIUtil.isNotNull(this.getAddress())) {
        DD = new SITableCondition(" AND c.custcode IN (SELECT ad.custcode FROM custaddresstbl ad WHERE ad.address1="+SIDBUtil.SQL2Str(this.getAddress())+") ");
        lConditionMan.add(DD);
      }else if (SIUtil.isNotNull(this.getAddress2())) {
        DD = new SITableCondition(" AND c.custcode IN (SELECT ad.custcode FROM custaddresstbl ad WHERE ad.address2||coalesce(ad.address3,'') LIKE '%"+SIDBUtil.SQL2Like(this.getAddress2())+"%') ");
        lConditionMan.add(DD);
      }
      if (SIUtil.isNotNull(this.storeTelTxt)) {
        DD = new SITableCondition(" AND (c.storetel LIKE '%"+SIDBUtil.SQL2Like(this.storeTelTxt)+"%' OR c.tel LIKE '%"+SIDBUtil.SQL2Like(this.storeTelTxt)+"%' OR c.custcode IN (SELECT ad.custcode FROM custaddresstbl ad WHERE ad.tel LIKE '%"+this.storeTelTxt+"%')) ");
        lConditionMan.add(DD);
      }
    }else{
      DD = new SITableCondition("", "c.address1", this.getAddress(), SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
      lConditionMan.add(DD);
      DD = new SITableCondition("", "c.address2||coalesce(c.address3,'')", this.getAddress2(), SIConfig.SICONDITION_TYPE_LIKE, SIConfig.SICONDITION_TYPE_AND);
      lConditionMan.add(DD);
      DD = new SITableCondition(" AND (c.storetel LIKE '%"+SIDBUtil.SQL2Like(this.storeTelTxt)+"%' OR c.tel LIKE '%"+SIDBUtil.SQL2Like(this.storeTelTxt)+"%') ");
      lConditionMan.add(DD);
    }
    
    if (SIUtil.isNotNull(this.getRankChangeYear())&&SIUtil.isNotNull(this.getRankChangeMonth())) {
      String rankChangeDate = this.getRankChangeYear() + "-" + this.getRankChangeMonth();
      StringBuffer rankSql = new StringBuffer();
      if (SIUtil.isNotNull(this.getRePromotionFlg())&&"1".equals(this.getRePromotionFlg())) {
        rankSql.append(" AND (");
        rankSql.append(" (rankDownFlg='0' AND to_char(c.rankchangedate1,'yyyy-mm')=").append(SIDBUtil.SQL2Str(rankChangeDate,")"));//降格経験なしのゴールド昇格月
        rankSql.append(" OR (rankDownFlg!='2' AND to_char(c.rankchangedate2,'yyyy-mm')=").append(SIDBUtil.SQL2Str(rankChangeDate,")"));//プラチナ降格経験なしのプラチナ昇格月
        rankSql.append(" ) ");
      } else {
        rankSql.append(" AND (");
        rankSql.append(" to_char(c.rankchangedate1,'yyyy-mm')=").append(SIDBUtil.SQL2Str(rankChangeDate));
        rankSql.append(" OR to_char(c.rankchangedate2,'yyyy-mm')=").append(SIDBUtil.SQL2Str(rankChangeDate));
        rankSql.append(" ) ");
      }
      DD = new SITableCondition(rankSql.toString());
      lConditionMan.add(DD);
    }
    
    if (SIUtil.isNotNull(this.getOpeningPlanDateYearFrom())&&SIUtil.isNotNull(this.getOpeningPlanDateMonthFrom())) {
      String openingPlanDateFrom = this.getOpeningPlanDateYearFrom() + "-" + this.getOpeningPlanDateMonthFrom() + "-01";
      StringBuffer openFromSql = new StringBuffer();
      if (SIUtil.isNotNull(this.getOpeningFlg())&&"1".equals(this.getOpeningFlg())) {
        openFromSql.append(" AND c.openingPlanDate>=").append(SIDBUtil.SQL2Str(openingPlanDateFrom," "));
        DD = new SITableCondition(openFromSql.toString());
        lConditionMan.add(DD);
      }
    }
    
    if (SIUtil.isNotNull(this.getOpeningPlanDateYearTo())&&SIUtil.isNotNull(this.getOpeningPlanDateMonthTo())) {
      String openingPlanDateTo = this.getOpeningPlanDateYearTo() + "-" + this.getOpeningPlanDateMonthTo() + "-01";
      StringBuffer openToSql = new StringBuffer();
      if (SIUtil.isNotNull(this.getOpeningFlg())&&"1".equals(this.getOpeningFlg())) {
        openToSql.append(" AND c.openingPlanDate<=").append(SIDBUtil.SQL2Str(openingPlanDateTo," "));
        DD = new SITableCondition(openToSql.toString());
        lConditionMan.add(DD);
      }
    }
    
    DD = new SITableCondition("", "c.job", this.getJob(), SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "c.chargecode", this.getChargeCode(), SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "c.howtoknow", this.getHowToKnow(), SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "c.receivableflg", this.getReceivableFlg(), SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "c.noDeliveryFlg", this.noDeliveryFlg, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "c.memberLevelFixedFlg", this.memberLevelFixedFlg, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    if(this.hobby != null && this.hobby.length > 0) {
      StringBuffer sql = new StringBuffer();
      if (this.hobbySelect.equals("0")){
        for (int i=0; i<this.hobby.length; i++){
          sql.append(" AND c.custcode IN (SELECT custcode FROM custhobbytbl WHERE hobbyname = ").append(SIDBUtil.SQL2Str(this.hobby[i],")"));
        }
      } else {
        sql.append(" AND g.hobbyname IN (");
        for (int i=0; i<this.hobby.length; i++){
          if (i>0) sql.append(",");
          sql.append(SIDBUtil.SQL2Str(this.hobby[i]));
        }
        sql.append(")");
      }
      DD = new SITableCondition(sql.toString());
      lConditionMan.add(DD);
    }
    
    // 7.3.0 ST2027 追加 ここから
    // 削除フラグ
    if (this.intDelFlg == Integer.parseInt(SIConfig.SIDEL_FLG_NORMAL)) { // 通常 ( DELETE 未満 )
      DD = new SITableCondition("", "c.delflg", new Integer(SIConfig.SIDEL_FLG_DELETE), SIConfig.SICONDITION_TYPE_LESS, SIConfig.SICONDITION_TYPE_AND);
      lConditionMan.add(DD);
    } else if (this.intDelFlg == Integer.parseInt(SIConfig.SIDEL_FLG_DELETE)) { // 削除済み ( = 削除 )
      DD = new SITableCondition("", "c.delflg ", new Integer(SIConfig.SIDEL_FLG_DELETE), SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
      lConditionMan.add(DD);
    } else if (this.intDelFlg == Integer.parseInt(SIConfig.SIDEL_FLG_REQUEST)) { // 削除依頼 ( = 削除依頼 )
      DD = new SITableCondition("", "c.delflg", new Integer(SIConfig.SIDEL_FLG_REQUEST), SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
      lConditionMan.add(DD);
    }
    
    
    return lConditionMan.getCondtionSQL();
  }
  
  public void initDelete(HttpServletRequest lRequest) {
    this.setCustCodeChk(lRequest.getParameterValues("checkbox_delete"));
    this.setCustCodeHid(lRequest.getParameterValues("checkbox_delete"));
  }
  
  public boolean validateSendMail(HttpServletRequest lRequest, Connection lConnection) {
    SICustomErrors errors = new SICustomErrors();
    // SITableConditionManager lConditionMan=new SITableConditionManager(); //7.2.0 ST1030 削除（不要のため）
    
    // チェックボックスのチェック
    if (this.getCustCodeChk() == null || this.getCustCodeChk().length == 0) {
      errors.addError(new SICustomError("input.data.checkbox.require", "新着メールを送信"));
    }
    
    if (!errors.isEmpty()) lRequest.setAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY, errors);
    else lRequest.removeAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY);
    
    return errors.isEmpty();
  }
  
  public boolean validatePDF(HttpServletRequest lRequest) {
    SICustomErrors errors = new SICustomErrors();
    
    // チェックボックスのチェック
    if (this.getCustCodeChk() == null || this.getCustCodeChk().length == 0) {
      errors.addError(new SICustomError("input.data.checkbox.require", "ダイレクトメールを出力"));
    }
    
    if (!errors.isEmpty()) lRequest.setAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY, errors);
    else lRequest.removeAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY);
    
    return errors.isEmpty();
  }
  
  public boolean validatePDF2(HttpServletRequest lRequest) {
    SICustomErrors errors = new SICustomErrors();
    
    // チェックボックスのチェック
    if (this.getCustCodeChk() == null || this.getCustCodeChk().length == 0) {
      errors.addError(new SICustomError("input.data.checkbox.require", "登録通知書を出力"));
    }
    
    if (!errors.isEmpty()) lRequest.setAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY, errors);
    else lRequest.removeAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY);
    
    return errors.isEmpty();
  }
  
  public boolean validatePDF3(HttpServletRequest lRequest,Connection lConnection) {
    SICustomErrors errors = new SICustomErrors();
    
    // チェックボックスのチェック
    if (this.getCustCodeChk() == null || this.getCustCodeChk().length == 0) {
      errors.addError(new SICustomError("input.data.checkbox.require", "ランク昇格通知書を出力"));
    }else{
      StringBuffer lSql = new StringBuffer("SELECT custcode FROM custtbl WHERE memberlevelcode='0' AND custcode IN (");
      for (int i = 0; i < this.getCustCodeChk().length;i++) {
        if (i>0) lSql.append(",");
        lSql.append("'").append(this.getCustCodeChk()[i]).append("'");
      }
      lSql.append(")");
      try{
        if(SIDBUtil.hasData(lConnection, lSql.toString())){
          errors.addError(new SICustomError("manager.message.freeword", "通常会員を含む昇格通知書は出力できません。"));
        }
      }catch(Exception e){
        errors.addError(new SICustomError("database.execute.error"));
      }
    }
    
    if (!errors.isEmpty()) lRequest.setAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY, errors);
    else lRequest.removeAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY);
    
    return errors.isEmpty();
  }
  
  public boolean validateDelete(HttpServletRequest lRequest, Connection lConnection) {
    SICustomErrors errors = new SICustomErrors();
    StringBuffer lSqlBuf = new StringBuffer();// 7.2.0 ST1030 追加
    // SITableConditionManager lConditionMan=new SITableConditionManager(); //7.2.0 ST1030 削除（不要のため）
    
    // チェックボックスのチェック
    if (this.getCustCodeChk() == null || this.getCustCodeChk().length == 0) {
      errors.addError(new SICustomError("input.data.checkbox.require", "削除"));
    }
    // 7.2.0 ST1030 追加 ここから
    // 紐付く受注が存在する顧客データを削除することはできない（受注修正機能の実装に伴い）
    if (errors.isEmpty()) {
      for (int ii = 0; ii < this.getCustCodeChk().length; ii++) {
        if (SIUtil.isNotNull(this.getCustCodeChk()[ii])) {
          lSqlBuf = new StringBuffer();
          // 7.3.0 ST2027 修正 ここから
          lSqlBuf.append("SELECT od.OrderCode FROM ").append(SIConfig.SIVIEW_ORDER_LATEST_NAME);
          lSqlBuf.append(" od, ").append(SIConfig.SIVIEW_ORDER_DETAIL_LATEST_NAME).append(" dv ");
          lSqlBuf.append(" WHERE od.CustCode=").append(SIDBUtil.SQL2Str(this.getCustCodeChk()[ii]));
          lSqlBuf.append(" AND ( od.ReceiptDate IS NULL OR dv.ShippmentDate IS NULL )");
          lSqlBuf.append(" AND ( od.Status='1' ) ");
          lSqlBuf.append(" AND od.OrderCode=dv.OrderCode ");
          // 7.3.0 ST2027 修正 ここまで
          try {
            if (SIDBUtil.hasData(lConnection, lSqlBuf.toString())) {
              errors.addError(new SICustomError("database.delete.lock4", this.getCustCodeChk()[ii]));
            }
          } catch (SIDBAccessException e) {
            e.printStackTrace();
            errors.addError(new SICustomError("database.delete.error"));
          }
        }
      }
    }
    // 7.2.0 ST1030 追加 ここまで
    
    // 7.3.0 ST2027 追加 ここから
    // 未確定（キャンセル、注文済み以外）の予約がある場合にも削除不可とする
    if (errors.isEmpty()) {
      for (int ii = 0; ii < this.getCustCodeChk().length; ii++) {
        if (SIUtil.isNotNull(this.getCustCodeChk()[ii])) {
          lSqlBuf = new StringBuffer();
          lSqlBuf.append("SELECT reservecode FROM ").append(SIConfig.SITABLE_RESERVE_ORDER_NAME);
          lSqlBuf.append(" WHERE CustCode=").append(SIDBUtil.SQL2Str(this.getCustCodeChk()[ii]));
          lSqlBuf.append(" AND reserveflg!='2' AND reserveflg!='5'");
          try {
            if (SIDBUtil.hasData(lConnection, lSqlBuf.toString())) {
              errors.addError(new SICustomError("database.delete.lock5", this.getCustCodeChk()[ii]));
            }
          } catch (SIDBAccessException e) {
            e.printStackTrace();
            errors.addError(new SICustomError("database.delete.error"));
          }
        }
      }
    }
    // 7.3.0 ST2027 追加 ここまで
    
    if (!errors.isEmpty()) lRequest.setAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY, errors);
    else lRequest.removeAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY);
    
    return errors.isEmpty();
  }
  
  // 7.2.1 ST2015 修正 ここから
  /**
   * @return
   */
  public String getCustCodeFrom() {
    return custCodeFrom;
  }
  
  /**
   * @return
   */
  public String getCustCodeTo() {
    return custCodeTo;
  }
  
  // 7.2.1 ST2015 修正 ここまで
  
  /**
   * @return
   */
  public String getCustName() {
    return custName;
  }
  
  /**
   * @return
   */
  public String getCustPronName() {
    return custPronName;
  }
  
  public String getNewMailFlg() {
    return newMailFlg;
  }
  
  public String getEmailTxt() {
    return emailTxt;
  }
  
  // 7.2.1 ST2015 修正 ここから
  /**
   * @param string
   */
  public void setCustCodeFrom(String string) {
    if (string == null) string = "";
    string = SIUtil.changeTo(string.trim(), this.encode);
    custCodeFrom = string;
  }
  
  /**
   * @param string
   */
  public void setCustCodeTo(String string) {
    if (string == null) string = "";
    string = SIUtil.changeTo(string.trim(), this.encode);
    custCodeTo = string;
  }
  
  // 7.2.1 ST2015 修正 ここまで
  
  /**
   * @param string
   */
  public void setCustName(String string) {
    if (string == null) string = "";
    string = SIUtil.changeTo(string.trim(), this.encode);
    custName = string;
  }
  
  /**
   * @param string
   */
  public void setCustPronName(String string) {
    if (string == null) string = "";
    string = SIUtil.changeTo(string.trim(), this.encode);
    custPronName = string;
  }
  
  /**
   * @param string
   */
  public void setNewMailFlg(String string) {
    if (string == null) string = "";
    string = SIUtil.changeTo(string.trim(), this.encode);
    newMailFlg = string;
  }
  
  /**
   * @return
   */
  public String[] getMemberLevelCodeUI() {
    return memberLevelCodeUI;
  }
  
  /**
   * @param string
   */
  public void setMemberLevelCodeUI(String[] string) {
    if (string == null) string = new String[0];
    memberLevelCodeUI = string;
  }
  
  /**
   * @return
   */
  public String getCustCompanyFlg() {
    return custCompanyFlg;
  }
  
  /**
   * @param string
   */
  public void setCustCompanyFlg(String string) {
    custCompanyFlg = string;
  }
  
  public void setEmailTxt(String string) {
    if (SIUtil.isNull(string)) string = "";
    this.emailTxt = SIUtil.changeTo(string.trim(), this.encode);
  }
  
  // 検索フラグ
  public void setSearchFlg(boolean newSearchFlg) {
    this.searchFlg = newSearchFlg;
  }
  
  // 検索フラグ
  public boolean getSearchFlg() {
    return this.searchFlg;
  }
  
  // setter of 削除のショップコード
  public void setCustCodeChk(String[] lCustCodeChk) {
    if (lCustCodeChk == null) lCustCodeChk = new String[0];
    this.custCodeChk = lCustCodeChk;
  }
  
  // getter of 削除のショップコード
  public String[] getCustCodeChk() {
    return this.custCodeChk;
  }
  
  // setter of ダイレクトメール用の顧客コード
  public void setCustCodeHid(String[] lCustCodeHid) {
    if (lCustCodeHid == null) lCustCodeHid = new String[0];
    this.custCodeHid = lCustCodeHid;
  }
  
  // getter of ダイレクトメール用の顧客コード
  public String[] getCustCodeHid() {
    return this.custCodeHid;
  }
  
  // setter of PDF帳票タイプ
  public void setPdfType(String lPdfType) {
    if (SIUtil.isNull(lPdfType)) lPdfType = SIPDFConf.SIPDF_TYPE_ORDER;
    this.pdfType = SIUtil.changeTo(lPdfType.trim(), this.encode);
    ;
  }
  
  // getter of PDF帳票タイプ
  public String getPdfType() {
    return this.pdfType;
  }
  
  // 7.3.0 ST2027 追加 ここから
  // 削除フラグ Setter
  public void setDelFlg(int intDelFlg) {
    this.intDelFlg = intDelFlg;
  }
  
  // 削除フラグ Getter
  public int getDelFlg() {
    return this.intDelFlg;
  }
  
  // 削除フラグ String型でのGetter
  public String getDelFlgConvStr() {
    return new Integer(this.intDelFlg).toString();
  }
  
  // 7.3.0 ST2027 追加 ここまで
  
  /**
   * @return
   */
  public String getMailExpectFlg() {
    return mailExpectFlg;
  }
  
  /**
   * @param string
   */
  public void setMailExpectFlg(String lMail) {
    if (SIUtil.isNull(lMail)) lMail = "";
    this.mailExpectFlg = SIUtil.changeTo(lMail.trim(), this.encode);
  }
  
  /**
   * @return storeTelTxt を戻します。
   */
  public String getStoreTelTxt() {
    return storeTelTxt;
  }
  
  /**
   * @param storeTelTxt storeTelTxt を設定。
   */
  public void setStoreTelTxt(String storeTelTxt) {
    this.storeTelTxt = storeTelTxt;
  }
  
  public String getRegistRoute() {
    return registRoute;
  }
  
  public void setRegistRoute(String registRoute) {
    this.registRoute = registRoute;
  }
  
  // getter of companyName
  public String getCompanyName() {
    return this.companyName;
  }
  
  // getter of corporationName
  public String getCorporationName() {
    return this.corporationName;
  }
  
  // setter of companyName
  public void setCompanyName(String companyName) {
    if (SIUtil.isNull(companyName)) companyName = "";
    this.companyName = SIUtil.changeTo(companyName.trim(), this.encode);
  }
  
  // setter of corporationName
  public void setCorporationName(String corporationName) {
    if (SIUtil.isNull(corporationName)) corporationName = "";
    this.corporationName = SIUtil.changeTo(corporationName.trim(), this.encode);
  }
  
  // getter of makerCode
  public String getMakerCode() {
    return this.makerCode;
  }
  
  // setter of makerCode
  public void setMakerCode(String makerCode) {
    if (SIUtil.isNull(makerCode)) makerCode = "";
    this.makerCode = SIUtil.changeTo(makerCode.trim(), this.encode);
  }
  
  //getter of address
  public String getAddress() {
    return this.address;
  }
  
  //getter of address2
  public String getAddress2() {
    return this.address2;
  }
  
  //getter of job
  public String getJob() {
    return this.job;
  }
  
  //setter of address
  public void setAddress(String address) {
    if (SIUtil.isNull(address)) address = "";
    this.address = SIUtil.changeTo(address.trim(), this.encode);
  }
  
  //setter of address2
  public void setAddress2(String address2) {
    if (SIUtil.isNull(address2)) address2 = "";
    this.address2 = SIUtil.changeTo(address2.trim(), this.encode);
  }
  
  //setter of job
  public void setJob(String job) {
    if (SIUtil.isNull(job)) job = "";
    this.job = SIUtil.changeTo(job.trim(), this.encode);
  }
  
  //getter of chargeCode
  public String getChargeCode() {
    return this.chargeCode;
  }
  
  //setter of chargeCode
  public void setChargeCode(String chargeCode) {
    if (SIUtil.isNull(chargeCode)) chargeCode = "";
    this.chargeCode = SIUtil.changeTo(chargeCode.trim(), this.encode);
  }
  
  //getter of howToKnow
  public String getHowToKnow() {
    return this.howToKnow;
  }
  
  //getter of hobby
  public String[] getHobby() {
    return this.hobby;
  }
  
  //getter of hobbySelect
  public String getHobbySelect() {
    return this.hobbySelect;
  }
  
  //setter of howToKnow
  public void setHowToKnow(String howToKnow) {
    if (SIUtil.isNull(howToKnow)) howToKnow = "";
    this.howToKnow = SIUtil.changeTo(howToKnow.trim(), this.encode);
  }
  
  //setter of hobby
  public void setHobby(String[] hobby) {
    if (hobby == null) hobby = new String[0];
    this.hobby = hobby;
  }
  
  //setter of hobbySelect
  public void setHobbySelect(String hobbySelect) {
    if (SIUtil.isNull(hobbySelect)) hobbySelect = "0";
    this.hobbySelect = SIUtil.changeTo(hobbySelect.trim(), this.encode);
  }
  
  //getter of receivableFlg
  public String getReceivableFlg() {
    return receivableFlg;
  }
  
  //setter of receivableFlg
  public void setReceivableFlg(String receivableFlg) {
    if (SIUtil.isNull(receivableFlg)) receivableFlg = "";
    this.receivableFlg = receivableFlg;
  }
  
  public String getIntroductionMailFlg() {
    return introductionMailFlg;
  }
  
  public void setIntroductionMailFlg(String introductionMailFlg) {
    if (SIUtil.isNull(introductionMailFlg)) introductionMailFlg = "";
    this.introductionMailFlg = introductionMailFlg;
  }
  
  public String getMemberLevelFirst() {
    return memberLevelFirst;
  }
  
  public String getMemberLevelFixedFlg() {
    return memberLevelFixedFlg;
  }
  
  public String getNoDeliveryFlg() {
    return noDeliveryFlg;
  }
  
  public void setMemberLevelFirst(String memberLevelFirst) {
    if (SIUtil.isNull(memberLevelFirst)) memberLevelFirst = "0";
    this.memberLevelFirst = memberLevelFirst;
  }
  
  public void setMemberLevelFixedFlg(String memberLevelFixedFlg) {
    if (SIUtil.isNull(memberLevelFixedFlg)) memberLevelFixedFlg = "";
    this.memberLevelFixedFlg = memberLevelFixedFlg;
  }
  
  public void setNoDeliveryFlg(String noDeliveryFlg) {
    if (SIUtil.isNull(noDeliveryFlg)) noDeliveryFlg = "";
    this.noDeliveryFlg = noDeliveryFlg;
  }
  
  public String getPdfOutputFlg1() {
    return pdfOutputFlg1;
  }
  
  public void setPdfOutputFlg1(String pdfOutputFlg1) {
    if (SIUtil.isNull(pdfOutputFlg1)) pdfOutputFlg1 = "";
    this.pdfOutputFlg1 = pdfOutputFlg1;
  }
  
  public String getPdfOutputFlg2() {
    return pdfOutputFlg2;
  }
  
  public void setPdfOutputFlg2(String pdfOutputFlg2) {
    if (SIUtil.isNull(pdfOutputFlg2)) pdfOutputFlg2 = "";
    this.pdfOutputFlg2 = pdfOutputFlg2;
  }
  
  public String getRankChangeMonth() {
    return rankChangeMonth;
  }
  
  public String getRankChangeYear() {
    return rankChangeYear;
  }
  
  public void setRankChangeMonth(String rankChangeMonth) {
    if (SIUtil.isNull(rankChangeMonth)) rankChangeMonth = "";
    this.rankChangeMonth = rankChangeMonth;
  }
  
  public void setRankChangeYear(String rankChangeYear) {
    if (SIUtil.isNull(rankChangeYear)) rankChangeYear = "";
    this.rankChangeYear = rankChangeYear;
  }
  
  public String getRePromotionFlg() {
    return rePromotionFlg;
  }
  
  public void setRePromotionFlg(String rePromotionFlg) {
    if (SIUtil.isNull(rePromotionFlg)) rePromotionFlg = "";
    this.rePromotionFlg = rePromotionFlg;
  }
  
  public String getAddressListFlg() {
    return addressListFlg;
  }
  
  public void setAddressListFlg(String addressListFlg) {
    if (SIUtil.isNull(addressListFlg)) addressListFlg = "";
    this.addressListFlg = addressListFlg;
  }
  
  public String getHairCosmeFlg() {
    return hairCosmeFlg;
  }
  
  public void setHairCosmeFlg(String hairCosmeFlg) {
    if (SIUtil.isNull(hairCosmeFlg)) hairCosmeFlg = "";
    this.hairCosmeFlg = hairCosmeFlg;
  }
  
  public String getMailStatus() {
    return mailStatus;
  }
  
  public String getSendMailFlg() {
    return sendMailFlg;
  }
  
  public void setMailStatus(String mailStatus) {
    if (SIUtil.isNull(mailStatus)) mailStatus = "";
    this.mailStatus = mailStatus;
  }
  
  public void setSendMailFlg(String sendMailflg) {
    if (SIUtil.isNull(sendMailflg)) sendMailflg = "";
    this.sendMailFlg = sendMailflg;
  }
  
  public String getNoRequestFlg() {
    return noRequestFlg;
  }
  
  public void setNoRequestFlg(String noRequestFlg) {
    if (SIUtil.isNull(noRequestFlg)) noRequestFlg = "";
    this.noRequestFlg = noRequestFlg;
  }
  
  public String getOpeningFlg() {
    return openingFlg;
  }
  
  public void setOpeningFlg(String openingFlg) {
    if (SIUtil.isNull(openingFlg)) openingFlg = "";
    this.openingFlg = openingFlg;
  }
  
  public String getOpeningPlanDateMonthFrom() {
    return openingPlanDateMonthFrom;
  }
  
  public void setOpeningPlanDateMonthFrom(String openingPlanDateMonthFrom) {
    if (SIUtil.isNull(openingPlanDateMonthFrom)) openingPlanDateMonthFrom = "";
    this.openingPlanDateMonthFrom = openingPlanDateMonthFrom;
  }
  
  public String getOpeningPlanDateMonthTo() {
    return openingPlanDateMonthTo;
  }
  
  public void setOpeningPlanDateMonthTo(String openingPlanDateMonthTo) {
    if (SIUtil.isNull(openingPlanDateMonthTo)) openingPlanDateMonthTo = "";
    this.openingPlanDateMonthTo = openingPlanDateMonthTo;
  }
  
  public String getOpeningPlanDateYearFrom() {
    return openingPlanDateYearFrom;
  }
  
  public void setOpeningPlanDateYearFrom(String openingPlanDateYearFrom) {
    if (SIUtil.isNull(openingPlanDateYearFrom)) openingPlanDateYearFrom = "";
    this.openingPlanDateYearFrom = openingPlanDateYearFrom;
  }
  
  public String getOpeningPlanDateYearTo() {
    return openingPlanDateYearTo;
  }
  
  public void setOpeningPlanDateYearTo(String openingPlanDateYearTo) {
    if (SIUtil.isNull(openingPlanDateYearTo)) openingPlanDateYearTo = "";
    this.openingPlanDateYearTo = openingPlanDateYearTo;
  }
}