/**
 * Copyright (c) 2003-2004 System Integrator Corporation.
 *                 All Rights Reserved.
 */
package jp.co.sint.beans.mallmgr;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;

import javax.servlet.http.HttpServletRequest;

import jp.co.sint.basic.SIBasic;
import jp.co.sint.basic.SILogin;
import jp.co.sint.basic.SINameValue;
import jp.co.sint.basic.SIOrderDelivery;
import jp.co.sint.basic.SIOrderDetail;
import jp.co.sint.basic.SIShippment;
import jp.co.sint.basic.SITax;
import jp.co.sint.config.SIConfig;
import jp.co.sint.config.SIDBMultiConf;
import jp.co.sint.config.SIPDFConf;
import jp.co.sint.database.SIDBAccessException;
import jp.co.sint.database.SIDBUtil;
import jp.co.sint.database.SIDateTimeType;
import jp.co.sint.database.SITableCondition;
import jp.co.sint.database.SITableConditionManager;
import jp.co.sint.tools.SICheckDataConf;
import jp.co.sint.tools.SICheckUtil;
import jp.co.sint.tools.SICheckValid;
import jp.co.sint.tools.SICustomError;
import jp.co.sint.tools.SICustomErrors;
import jp.co.sint.tools.SIDateTime;
import jp.co.sint.tools.SIErrorFactory;// 7.1.1 ST0187 追加
import jp.co.sint.tools.SIHTMLUtil;
import jp.co.sint.tools.SIUtil;
import jp.co.sint.tools.SIURLParameter;// 7.1.1 ST0236 追加

import org.apache.log4j.Category;

/**
 * @version $Id: UIShippmentListCond.java,v 1.0 2003/09/19 Exp $
 * @author asakura <br>
 * Description:
 * <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>
 * asakura 2003/09/19 11:06:28 Original
 */
public class UIShippmentListCond extends SIBasic {
  // ログ用のインスタンスの生成
  private static Category log = Category.getInstance(SIConfig.SILOG4J_WEBSHOP_CATEGORY_NAME);
  
  // 受注番号
  private String orderCodeTxt = "";
  
  // 顧客名カナ
  private String custPronNameTxt = "";
  
  // 顧客名
  private String custNameTxt = "";
  
  // 出荷支店
  private String allocateBranch = "";
  
  // 7.2.0 ST1034 追加 ここから
  // ショップコード
  private String shopCodeTxt = "";
  
  // 7.2.0 ST1034 追加 ここまで
  
  // 7.2.0 ST0302 追加 ここから
  // 受注番号From
  private String orderCodeFromTxt = "";
  
  // 受注番号To
  private String orderCodeToTxt = "";
  
  // 7.2.0 ST0302 追加 ここまで
  
  // 受注日の年(From)
  private String initDateYearFromCbo = "";
  
  // 受注日の月(From)
  private String initDateMonthFromCbo = "";
  
  // 受注日の日(From)
  private String initDateDayFromCbo = "";
  
  // 受注日の年(To)
  private String initDateYearToCbo = "";
  
  // 受注日の月(To)
  private String initDateMonthToCbo = "";
  
  // 受注日の日(To)
  private String initDateDayToCbo = "";
  
  // 入金状況
  private String receiptFlgRdo = "";
  
  // 出荷状況
  private String shippmentFlgRdo = "";
  
  // 出荷日の年(From)
  private String shippmentDateYearFromCbo = "";
  
  // 出荷日の月(From)
  private String shippmentDateMonthFromCbo = "";
  
  // 出荷日の日(From)
  private String shippmentDateDayFromCbo = "";
  
  // 出荷日の年(To)
  private String shippmentDateYearToCbo = "";
  
  // 出荷日の月(To)
  private String shippmentDateMonthToCbo = "";
  
  // 出荷日の日(To)
  private String shippmentDateDayToCbo = "";
  
  // 配送種別
  private String deliveryTypeCbo = "";
  
  // 7.3.0 PI-NES0501 追加 ここから
  // 対応支店フラグ
  private String branchFlgCbo = "0";
  
  // 担当者フラグ
  private String chargeFlgCbo = "0";
  
  // 委託フラグ
  private String consignFlgCbo = "0";
  
  // 対応支店コード
  private String branchCode = "";
  
  // 担当者コード
  private String chargeCode = "";
  
  // 対応支店リスト使用フラグ
  private boolean branchListEnable = false;
  
  // 担当者リスト使用フラグ
  private boolean chargeListEnable = false;
  
  // 担当者リスト作成用支店コード
  private String belongingBranchCode = "";
  
  // 7.3.0 PI-NES0501 追加 ここまで
  
  // 出荷日設定用のチェックボックス番号
  private String[] check = new String[0];
  
  // 出荷日設定用の受注コード
  private String[] orderCodeHid = new String[0];
  
  // 出荷日設定用の受注コード
  private String[] homeFlgHid = new String[0];
  
  // 出荷日設定用の受注配送先項番
  private String[] deliveryCodeHid = new String[0];
  
  // 出荷日設定用の受注明細番号
  private String[] detailCodeHid = new String[0];
  
  // 出荷日設定用の受注日時
  private String[] initDateTimeHid = new String[0];
  
  // 到着予定日
  private String[] arrivalPlanDate = new String[0];
  
  // 到着予定時間
  private String[] arrivalPlanTime = new String[0];
  
  // PDF出力用の出荷日 7.3.0 PI-NES0501 追加
  private String[] shippmentDateHid = new String[0];
  
  // 受注状態
  private String[] statusHid = new String[0];
  
  // 出荷日の年
  private String shippmentDateYearCbo = "";
  
  // 出荷日の月
  private String shippmentDateMonthCbo = "";
  
  // 出荷日の日
  private String shippmentDateDayCbo = "";
  
  // 並べ替え1
  private String firstOrderSel = "InitDateTime";
  
  // 並び順1
  private String firstOrderTxt = "1";
  
  // 検索用のＳＱＬ文
  private String conditionSQL = "";
  
  // 並び順
  private String orderBySQL = " ORDER BY InitDateTime DESC,OrderCode DESC ,DeliveryCode ASC ";
  
  // ページ番号
  private String pageNumberTxt = "1";
  
  // 検索できるかどうか？
  private boolean searchFlg = false;
  
  // PDF出力タイプ
  private String pdfType = SIPDFConf.SIPDF_TYPE_ORDER;
  
  // 宅配便タイプ
  private String deliType = "";
  
  // 納品書出力タイプ
  private String deliveryOutputType = "";
  
  // 出荷日設定check
  private String shippmentCheck = "";
  
  // 更新タイプ
  private String updateType = "";
  
  private String custCode = "";
  
  private String tel = "";
  
  private String emailTxt = "";
  
  private String companyName = "";
  
  private String orderRoute = "";
  
  // 出荷日の年
  private String selectShippmentDateYearCbo = "";
  
  // 出荷日の月
  private String selectShippmentDateMonthCbo = "";
  
  // 出荷日の日
  private String selectShippmentDateDayCbo = "";
  
  // 在庫コード
  private String individualCode = "";
  
  // 受注状態
  private String orderStatusRdo = "";
  
  // 運送会社名
  private String agentName = "";
  
  // 送り状問合せNo
  private String deliveryNumber = "";
  
  // 代引きフラグ
  private boolean cashFlg = false;
  
  // ショップ検索フラグ
  private boolean shopSearchFlg = false;// 7.2.0 ST1034 追加
  
  // 出荷支店（納品書）
  private String statementBranch = "";
  
  private String receivableFlg = "";
  
  private String orderCodeList = "";
  
  private String storageCode = "";
  
  public UIShippmentListCond() {
    // 初期値をセット
    SIDateTime date = new SIDateTime();
    this.setInitDateYearToCbo(date.getYearStr());
    this.setInitDateMonthToCbo(date.getMonthStr());
    this.setInitDateDayToCbo(date.getDayStr());
    
    this.setShippmentDateYearCbo(date.getYearStr());
    this.setShippmentDateMonthCbo(date.getMonthStr());
    this.setShippmentDateDayCbo(date.getDayStr());
    
    // 一ヶ月前
    date.addMonth(-1);
    
    this.setInitDateYearFromCbo(date.getYearStr());
    this.setInitDateMonthFromCbo(date.getMonthStr());
    this.setInitDateDayFromCbo(date.getDayStr());
    this.setOrderStatusRdo("1");
    
    // 検索条件を設定
    SITableConditionManager lConditionMan = new SITableConditionManager();
    if (SIDBMultiConf.SIDB_CURRENT_INX == SIDBMultiConf.SIDB_POSTGRESQL_INX) {
      lConditionMan.add(new SITableCondition("aa", "initDateTime", getInitDateFrom(), SIConfig.SICONDITION_TYPE_GREATER_EQUAL, SIConfig.SICONDITION_TYPE_AND));
      lConditionMan.add(new SITableCondition("aa", "initDateTime", getInitDateTo() + " 23:59:59", SIConfig.SICONDITION_TYPE_LESS_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    } else {
      lConditionMan.add(new SITableCondition("aa", "initDateTime", new SIDateTimeType(getInitDateFrom()), SIConfig.SICONDITION_TYPE_GREATER_EQUAL, SIConfig.SICONDITION_TYPE_AND));
      lConditionMan.add(new SITableCondition("aa", "initDateTime", new SIDateTimeType(getInitDateTo() + " 23:59:59"), SIConfig.SICONDITION_TYPE_LESS_EQUAL,
          SIConfig.SICONDITION_TYPE_AND));
    }
    lConditionMan.add(new SITableCondition("aa", "status", "1", SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    this.conditionSQL = lConditionMan.getCondtionSQL();
  }
  
  public UIShippmentListCond(SILogin lLogin) {
    // 初期値をセット
    SIDateTime date = new SIDateTime();
    this.setInitDateYearToCbo(date.getYearStr());
    this.setInitDateMonthToCbo(date.getMonthStr());
    this.setInitDateDayToCbo(date.getDayStr());
    
    this.setShippmentDateYearCbo(date.getYearStr());
    this.setShippmentDateMonthCbo(date.getMonthStr());
    this.setShippmentDateDayCbo(date.getDayStr());
    
    // 一ヶ月前
    date.addMonth(-1);
    
    this.setInitDateYearFromCbo(date.getYearStr());
    this.setInitDateMonthFromCbo(date.getMonthStr());
    this.setInitDateDayFromCbo(date.getDayStr());
    this.setOrderStatusRdo("1");
    
    // 検索条件を設定
    SITableConditionManager lConditionMan = new SITableConditionManager();
    if (SIDBMultiConf.SIDB_CURRENT_INX == SIDBMultiConf.SIDB_POSTGRESQL_INX) {
      lConditionMan.add(new SITableCondition("aa", "initDateTime", getInitDateFrom(), SIConfig.SICONDITION_TYPE_GREATER_EQUAL, SIConfig.SICONDITION_TYPE_AND));
      lConditionMan.add(new SITableCondition("aa", "initDateTime", getInitDateTo() + " 23:59:59", SIConfig.SICONDITION_TYPE_LESS_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    } else {
      lConditionMan.add(new SITableCondition("aa", "initDateTime", new SIDateTimeType(getInitDateFrom()), SIConfig.SICONDITION_TYPE_GREATER_EQUAL, SIConfig.SICONDITION_TYPE_AND));
      lConditionMan.add(new SITableCondition("aa", "initDateTime", new SIDateTimeType(getInitDateTo() + " 23:59:59"), SIConfig.SICONDITION_TYPE_LESS_EQUAL,
          SIConfig.SICONDITION_TYPE_AND));
    }
    if (!"0".equals(lLogin.getUserType())){
      this.setShippmentFlgRdo("0");
      this.setAllocateBranch(lLogin.getBranchCode());
      this.setStatementBranch(lLogin.getBranchCode());
      lConditionMan.add(new SITableCondition("bb", "shippmentDate", "", SIConfig.SICONDITION_TYPE_IS_NULL, SIConfig.SICONDITION_TYPE_AND));
      lConditionMan.add(new SITableCondition("ee", "branchcode", lLogin.getBranchCode(), SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    }
    if ("1".equals(lLogin.getUserType())) lConditionMan.add(new SITableCondition("ff", "storagecode", lLogin.getStorageCode(), SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    lConditionMan.add(new SITableCondition("aa", "status", "1", SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    this.conditionSQL = lConditionMan.getCondtionSQL();
  }
  
  public UIShippmentListCond(HttpServletRequest lRequest, SIURLParameter lUrlParam) {// 7.1.1 ST0236 修正
    init(lRequest, lUrlParam);// 7.1.1 ST0236 修正
  }
  
  // 7.3.0 PI-NES0501 追加 ここから
  /**
   * @return branchFlgCbo を戻します。
   */
  public String getBranchFlgCbo() {
    return branchFlgCbo;
  }
  
  /**
   * @return chargeFlgCbo を戻します。
   */
  public String getChargeFlgCbo() {
    return chargeFlgCbo;
  }
  
  /**
   * @return consignFlgCbo を戻します。
   */
  public String getConsignFlgCbo() {
    return consignFlgCbo;
  }
  
  /**
   * @param branchFlgCbo branchFlgCbo を設定。
   */
  public void setBranchFlgCbo(String branchFlgCbo) {
    if (SIUtil.isNull(branchFlgCbo)) branchFlgCbo = "0";
    this.branchFlgCbo = branchFlgCbo;
  }
  
  /**
   * @param chargeFlgCbo chargeFlgCbo を設定。
   */
  public void setChargeFlgCbo(String chargeFlgCbo) {
    if (SIUtil.isNull(chargeFlgCbo)) chargeFlgCbo = "0";
    this.chargeFlgCbo = chargeFlgCbo;
  }
  
  /**
   * @param consignFlgCbo consignFlgCbo を設定。
   */
  public void setConsignFlgCbo(String consignFlgCbo) {
    if (SIUtil.isNull(consignFlgCbo)) consignFlgCbo = "0";
    this.consignFlgCbo = consignFlgCbo;
  }
  
  /**
   * @return branchCode を戻します。
   */
  public String getBranchCode() {
    return branchCode;
  }
  
  /**
   * @return chargeCode を戻します。
   */
  public String getChargeCode() {
    return chargeCode;
  }
  
  /**
   * @param branchCode branchCode を設定。
   */
  public void setBranchCode(String branchCode) {
    if (SIUtil.isNull(branchCode)) branchCode = "";
    this.branchCode = branchCode;
  }
  
  /**
   * @param chargeCode chargeCode を設定。
   */
  public void setChargeCode(String chargeCode) {
    if (SIUtil.isNull(chargeCode)) chargeCode = "";
    this.chargeCode = chargeCode;
  }
  
  /**
   * @return branchListEnable を戻します。
   */
  public boolean isBranchListEnable() {
    return branchListEnable;
  }
  
  /**
   * @return chargeListEnable を戻します。
   */
  public boolean isChargeListEnable() {
    return chargeListEnable;
  }
  
  /**
   * @param branchListEnable branchListEnable を設定。
   */
  public void setBranchListEnable(boolean branchListEnable) {
    this.branchListEnable = branchListEnable;
  }
  
  /**
   * @param chargeListEnable chargeListEnable を設定。
   */
  public void setChargeListEnable(boolean chargeListEnable) {
    this.chargeListEnable = chargeListEnable;
  }
  
  /**
   * @return belongingBranchCode を戻します。
   */
  public String getBelongingBranchCode() {
    return belongingBranchCode;
  }
  
  /**
   * @param belongingBranchCode belongingBranchCode を設定。
   */
  public void setBelongingBranchCode(String belongingBranchCode) {
    if (SIUtil.isNull(belongingBranchCode)) belongingBranchCode = "";
    this.belongingBranchCode = belongingBranchCode;
  }
  
  /**
   * @return shippmentDateHid を戻します。
   */
  public String[] getShippmentDateHid() {
    return shippmentDateHid;
  }
  
  /**
   * @param shippmentDateHid shippmentDateHid を設定。
   */
  public void setShippmentDateHid(String[] shippmentDateHid) {
    this.shippmentDateHid = shippmentDateHid;
  }
  
  /**
   * @return companyName を戻します。
   */
  public String getCompanyName() {
    return companyName;
  }
  
  /**
   * @param companyName companyName を設定。
   */
  public void setCompanyName(String companyName) {
    if (SIUtil.isNull(companyName)) companyName = "";
    this.companyName = companyName;
  }
  
  /**
   * @return custCode を戻します。
   */
  public String getCustCode() {
    return custCode;
  }
  
  /**
   * @param custCode custCode を設定。
   */
  public void setCustCode(String custCode) {
    if (SIUtil.isNull(custCode)) custCode = "";
    this.custCode = custCode;
  }
  
  /**
   * @return emailTxt を戻します。
   */
  public String getEmailTxt() {
    return emailTxt;
  }
  
  /**
   * @param emailTxt emailTxt を設定。
   */
  public void setEmailTxt(String emailTxt) {
    if (SIUtil.isNull(emailTxt)) emailTxt = "";
    this.emailTxt = emailTxt;
  }
  
  /**
   * @return orderRoute を戻します。
   */
  public String getOrderRoute() {
    return orderRoute;
  }
  
  /**
   * @param orderRoute orderRoute を設定。
   */
  public void setOrderRoute(String orderRoute) {
    if (SIUtil.isNull(orderRoute)) orderRoute = "";
    this.orderRoute = orderRoute;
  }
  
  /**
   * @return tel を戻します。
   */
  public String getTel() {
    return tel;
  }
  
  /**
   * @param tel tel を設定。
   */
  public void setTel(String tel) {
    if (SIUtil.isNull(tel)) tel = "";
    this.tel = tel;
  }
  
  // 7.3.0 PI-NES0501 追加 ここまで
  public String getOrderStatusRdo() {
    return orderStatusRdo;
  }
  
  public void setOrderStatusRdo(String orderStatusRdo) {
    if (SIUtil.isNull(orderStatusRdo)) orderStatusRdo = "";
    this.orderStatusRdo = orderStatusRdo;
  }
  
  public String[] getStatusHid() {
    return statusHid;
  }
  
  public void setStatusHid(String[] statusHid) {
    this.statusHid = statusHid;
  }
  
  // setter of 受注番号
  public void setOrderCodeTxt(String lOrderCodeTxt) {
    if (SIUtil.isNull(lOrderCodeTxt)) lOrderCodeTxt = "";
    this.orderCodeTxt = SIUtil.changeTo(lOrderCodeTxt.trim(), this.encode);
  }
  
  // setter of 顧客名カナ
  public void setCustPronNameTxt(String lCustPronNameTxt) {
    if (SIUtil.isNull(lCustPronNameTxt)) lCustPronNameTxt = "";
    this.custPronNameTxt = SIUtil.changeTo(lCustPronNameTxt.trim(), this.encode);
  }
  
  // setter of 顧客名
  public void setCustNameTxt(String lCustNameTxt) {
    if (SIUtil.isNull(lCustNameTxt)) lCustNameTxt = "";
    this.custNameTxt = SIUtil.changeTo(lCustNameTxt.trim(), this.encode);
  }
  
  // setter of 出荷支店
  public void setAllocateBranch(String lAllocateBranch) {
    if (SIUtil.isNull(lAllocateBranch)) lAllocateBranch = "";
    this.allocateBranch = SIUtil.changeTo(lAllocateBranch.trim(), this.encode);
  }
  
  // 7.2.0 ST1034 追加 ここから
  // setter of ショップコード
  public void setShopCodeTxt(String lShopCode) {
    if (SIUtil.isNull(lShopCode)) lShopCode = "";
    this.shopCodeTxt = SIUtil.changeTo(lShopCode.trim(), this.encode);
  }
  
  // 7.2.0 ST1034 追加 ここまで
  
  // 7.2.0 ST0302 追加 ここから
  // setter of 受注番号From
  public void setOrderCodeFromTxt(String lOrderCode) {
    if (SIUtil.isNull(lOrderCode)) lOrderCode = "";
    this.orderCodeFromTxt = SIUtil.changeTo(lOrderCode.trim(), this.encode);
  }
  
  // setter of 受注番号To
  public void setOrderCodeToTxt(String lOrderCode) {
    if (SIUtil.isNull(lOrderCode)) lOrderCode = "";
    this.orderCodeToTxt = SIUtil.changeTo(lOrderCode.trim(), this.encode);
  }
  
  // 7.2.0 ST0302 追加 ここまで
  
  // setter of 受注日の年(From)
  public void setInitDateYearFromCbo(String lInitDateYearFromCbo) {
    if (SIUtil.isNull(lInitDateYearFromCbo)) lInitDateYearFromCbo = "";
    this.initDateYearFromCbo = SIUtil.changeTo(lInitDateYearFromCbo.trim(), this.encode);
  }
  
  // setter of 受注日の月(From)
  public void setInitDateMonthFromCbo(String lInitDateMonthFromCbo) {
    if (SIUtil.isNull(lInitDateMonthFromCbo)) lInitDateMonthFromCbo = "";
    this.initDateMonthFromCbo = SIUtil.changeTo(lInitDateMonthFromCbo.trim(), this.encode);
  }
  
  // setter of 受注日の日(From)
  public void setInitDateDayFromCbo(String lInitDateDayFromCbo) {
    if (SIUtil.isNull(lInitDateDayFromCbo)) lInitDateDayFromCbo = "";
    this.initDateDayFromCbo = SIUtil.changeTo(lInitDateDayFromCbo.trim(), this.encode);
  }
  
  // setter of 受注日の年(To)
  public void setInitDateYearToCbo(String lInitDateYearToCbo) {
    if (SIUtil.isNull(lInitDateYearToCbo)) lInitDateYearToCbo = "";
    this.initDateYearToCbo = SIUtil.changeTo(lInitDateYearToCbo.trim(), this.encode);
  }
  
  // setter of 受注日の月(To)
  public void setInitDateMonthToCbo(String lInitDateMonthToCbo) {
    if (SIUtil.isNull(lInitDateMonthToCbo)) lInitDateMonthToCbo = "";
    this.initDateMonthToCbo = SIUtil.changeTo(lInitDateMonthToCbo.trim(), this.encode);
  }
  
  // setter of 受注日の日(To)
  public void setInitDateDayToCbo(String lInitDateDayToCbo) {
    if (SIUtil.isNull(lInitDateDayToCbo)) lInitDateDayToCbo = "";
    this.initDateDayToCbo = SIUtil.changeTo(lInitDateDayToCbo.trim(), this.encode);
  }
  
  // setter of 出荷日の年(From)
  public void setShippmentDateYearFromCbo(String lShippmentDateYearFromCbo) {
    if (SIUtil.isNull(lShippmentDateYearFromCbo)) lShippmentDateYearFromCbo = "";
    this.shippmentDateYearFromCbo = SIUtil.changeTo(lShippmentDateYearFromCbo.trim(), this.encode);
  }
  
  // setter of 入金状況
  public void setReceiptFlgRdo(String lReceiptFlgRdo) {
    if (SIUtil.isNull(lReceiptFlgRdo)) lReceiptFlgRdo = "";
    this.receiptFlgRdo = SIUtil.changeTo(lReceiptFlgRdo.trim(), this.encode);
  }
  
  // setter of 出荷状況
  public void setShippmentFlgRdo(String lshippmentFlgRdo) {
    if (SIUtil.isNull(lshippmentFlgRdo)) lshippmentFlgRdo = "";
    this.shippmentFlgRdo = SIUtil.changeTo(lshippmentFlgRdo.trim(), this.encode);
  }
  
  // setter of 出荷日の月(From)
  public void setShippmentDateMonthFromCbo(String lShippmentDateMonthFromCbo) {
    if (SIUtil.isNull(lShippmentDateMonthFromCbo)) lShippmentDateMonthFromCbo = "";
    this.shippmentDateMonthFromCbo = SIUtil.changeTo(lShippmentDateMonthFromCbo.trim(), this.encode);
  }
  
  // setter of 出荷日の日(From)
  public void setShippmentDateDayFromCbo(String lShippmentDateDayFromCbo) {
    if (SIUtil.isNull(lShippmentDateDayFromCbo)) lShippmentDateDayFromCbo = "";
    this.shippmentDateDayFromCbo = SIUtil.changeTo(lShippmentDateDayFromCbo.trim(), this.encode);
  }
  
  // setter of 出荷日の年(To)
  public void setShippmentDateYearToCbo(String lShippmentDateYearToCbo) {
    if (SIUtil.isNull(lShippmentDateYearToCbo)) lShippmentDateYearToCbo = "";
    this.shippmentDateYearToCbo = SIUtil.changeTo(lShippmentDateYearToCbo.trim(), this.encode);
  }
  
  // setter of 出荷日の月(To)
  public void setShippmentDateMonthToCbo(String lShippmentDateMonthToCbo) {
    if (SIUtil.isNull(lShippmentDateMonthToCbo)) lShippmentDateMonthToCbo = "";
    this.shippmentDateMonthToCbo = SIUtil.changeTo(lShippmentDateMonthToCbo.trim(), this.encode);
  }
  
  // setter of 出荷日の日(To)
  public void setShippmentDateDayToCbo(String lShippmentDateDayToCbo) {
    if (SIUtil.isNull(lShippmentDateDayToCbo)) lShippmentDateDayToCbo = "";
    this.shippmentDateDayToCbo = SIUtil.changeTo(lShippmentDateDayToCbo.trim(), this.encode);
  }
  
  // setter of 配送種別
  public void setDeliveryTypeCbo(String str) {
    if (SIUtil.isNull(str)) str = "";
    this.deliveryTypeCbo = SIUtil.changeTo(str.trim(), this.encode);
  }
  
  // setter of 出荷日設定用の受注コード+受注配送先項番
  public void setCheck(String[] lCheck) {
    if (lCheck == null) lCheck = new String[0];
    this.check = lCheck;
  }
  
  // setter of 出荷日設定用の受注コード
  public void setOrderCodeHid(String[] lOrderCodeHid) {
    if (lOrderCodeHid == null) lOrderCodeHid = new String[0];
    this.orderCodeHid = lOrderCodeHid;
  }
  
  // setter of 自宅フラグ
  public void setHomeFlgHid(String[] lHomeFlgHid) {
    if (lHomeFlgHid == null) lHomeFlgHid = new String[0];
    this.homeFlgHid = lHomeFlgHid;
  }
  
  // setter of 出荷日設定用の受注配送先項番
  public void setDeliveryCodeHid(String[] lDeliveryCodeHid) {
    if (lDeliveryCodeHid == null) lDeliveryCodeHid = new String[0];
    this.deliveryCodeHid = lDeliveryCodeHid;
  }
  
  // setter of 出荷日設定用の受注日時
  public void setInitDateTimeHid(String[] lInitDateTimeHid) {
    if (lInitDateTimeHid == null) lInitDateTimeHid = new String[0];
    this.initDateTimeHid = lInitDateTimeHid;
  }
  
  // setter of 到着予定日
  public void setArrivalPlanDate(String[] str) {
    if (str == null) str = new String[0];
    this.arrivalPlanDate = str;
  }
  
  // setter of 到着予定時刻
  public void setArrivalPlanTime(String[] str) {
    if (str == null) str = new String[0];
    this.arrivalPlanTime = str;
  }
  
  // setter of 出荷日の年
  public void setShippmentDateYearCbo(String lShippmentDateYearCbo) {
    if (SIUtil.isNull(lShippmentDateYearCbo)) lShippmentDateYearCbo = "";
    this.shippmentDateYearCbo = SIUtil.changeTo(lShippmentDateYearCbo.trim(), this.encode);
  }
  
  // setter of 出荷日の月
  public void setShippmentDateMonthCbo(String lShippmentDateMonthCbo) {
    if (SIUtil.isNull(lShippmentDateMonthCbo)) lShippmentDateMonthCbo = "";
    this.shippmentDateMonthCbo = SIUtil.changeTo(lShippmentDateMonthCbo.trim(), this.encode);
  }
  
  // setter of 出荷日の日
  public void setShippmentDateDayCbo(String lShippmentDateDayCbo) {
    if (SIUtil.isNull(lShippmentDateDayCbo)) lShippmentDateDayCbo = "";
    this.shippmentDateDayCbo = SIUtil.changeTo(lShippmentDateDayCbo.trim(), this.encode);
  }
  
  // setter of 並べ替え1
  public void setFirstOrderSel(String lFirstOrderSel) {
    if (SIUtil.isNull(lFirstOrderSel)) lFirstOrderSel = "InitDateTime";
    this.firstOrderSel = SIUtil.changeTo(lFirstOrderSel.trim(), this.encode);
  }
  
  // setter of 並び順１
  public void setFirstOrderTxt(String lFirstOrderTxt) {
    if (SIUtil.isNull(lFirstOrderTxt)) lFirstOrderTxt = "0";
    this.firstOrderTxt = lFirstOrderTxt;
  }
  
  // setter of 検索用ＳＱＬ文
  public void setConditionSQL(String lConditionSQL) {
    if (SIUtil.isNull(lConditionSQL)) lConditionSQL = "";
    this.conditionSQL = SIUtil.changeTo(lConditionSQL.trim(), this.encode);
  }
  
  // setter of 並び順
  public void setOrderBySQL(String lOrderBySQL) {
    if (SIUtil.isNull(lOrderBySQL)) lOrderBySQL = " ORDER BY InitDateTime DESC,OrderCode DESC ,DeliveryCode ASC ";
    this.orderBySQL = lOrderBySQL;
  }
  
  // setter of ページ番号
  public void setPageNumberTxt(String lPageNumberTxt) {
    if (SIUtil.isNull(lPageNumberTxt)) lPageNumberTxt = "1";
    this.pageNumberTxt = lPageNumberTxt;
  }
  
  public void setPdfType(String lPdfType) {
    if (SIUtil.isNull(lPdfType)) lPdfType = SIPDFConf.SIPDF_TYPE_ORDER;
    this.pdfType = SIUtil.changeTo(lPdfType.trim(), this.encode);
    ;
  }
  
  public void setDeliType(String string) {
    if (SIUtil.isNull(string)) string = "";
    this.deliType = SIUtil.changeTo(string.trim(), this.encode);
    ;
  }
  
  // 納品書種類
  public void setDeliveryOutputType(String string) {
    if (SIUtil.isNull(string)) string = "";
    this.deliveryOutputType = SIUtil.changeTo(string.trim(), this.encode);
    ;
  }
  
  // 出荷日設定check
  public void setShippmentCheck(String string) {
    if (SIUtil.isNull(string)) string = "";
    this.shippmentCheck = SIUtil.changeTo(string.trim(), this.encode);
    ;
  }
  
  // 更新タイプ
  public void setUpdateType(String string) {
    if (SIUtil.isNull(string)) string = "";
    this.updateType = SIUtil.changeTo(string.trim(), this.encode);
    ;
  }
  
  // 7.2.0 ST1034 追加 ここから
  // ショップ検索フラグ
  public void setShopSearchFlg(boolean lShopSearchFlg) {
    this.shopSearchFlg = lShopSearchFlg;
  }
  
  // 7.2.0 ST1034 追加 ここまで
  
  // getter of 受注番号
  public String getOrderCodeTxt() {
    return this.orderCodeTxt;
  }
  
  // getter of 顧客名カナ
  public String getCustPronNameTxt() {
    return this.custPronNameTxt;
  }
  
  // getter of 顧客名
  public String getCustNameTxt() {
    return this.custNameTxt;
  }
  
  // getter of 出荷支店
  public String getAllocateBranch() {
    return this.allocateBranch;
  }
  
  // 7.2.0 ST1034 追加 ここから
  // getter of ショップコード
  public String getShopCodeTxt() {
    return this.shopCodeTxt;
  }
  
  // 7.2.0 ST1034 追加 ここまで
  
  // 7.2.0 ST0302 追加 ここから
  // getter of 受注番号From
  public String getOrderCodeFromTxt() {
    return this.orderCodeFromTxt;
  }
  
  // getter of 受注番号To
  public String getOrderCodeToTxt() {
    return this.orderCodeToTxt;
  }
  
  // 7.2.0 ST0302 追加 ここまで
  
  // getter of 受注日の年(From)
  public String getInitDateYearFromCbo() {
    return this.initDateYearFromCbo;
  }
  
  // getter of 受注日の月(From)
  public String getInitDateMonthFromCbo() {
    return this.initDateMonthFromCbo;
  }
  
  // getter of 受注日の日(From)
  public String getInitDateDayFromCbo() {
    return this.initDateDayFromCbo;
  }
  
  // getter of 受注日(From)
  public String getInitDateFrom() {
    return SIDateTime.getDate(getInitDateYearFromCbo(), getInitDateMonthFromCbo(), getInitDateDayFromCbo());
  }
  
  // getter of 受注日の年(To)
  public String getInitDateYearToCbo() {
    return this.initDateYearToCbo;
  }
  
  // getter of 受注日の月(To)
  public String getInitDateMonthToCbo() {
    return this.initDateMonthToCbo;
  }
  
  // getter of 受注日の日(To)
  public String getInitDateDayToCbo() {
    return this.initDateDayToCbo;
  }
  
  // getter of 受注日(To)
  public String getInitDateTo() {
    return SIDateTime.getDate(getInitDateYearToCbo(), getInitDateMonthToCbo(), getInitDateDayToCbo());
  }
  
  // getter of 出荷日の年(From)
  public String getShippmentDateYearFromCbo() {
    return this.shippmentDateYearFromCbo;
  }
  
  // getter of 入金状況
  public String getReceiptFlgRdo() {
    return this.receiptFlgRdo;
  }
  
  // getter of 出荷状況
  public String getShippmentFlgRdo() {
    return this.shippmentFlgRdo;
  }
  
  // getter of 出荷日の月(From)
  public String getShippmentDateMonthFromCbo() {
    return this.shippmentDateMonthFromCbo;
  }
  
  // getter of 出荷日の日(From)
  public String getShippmentDateDayFromCbo() {
    return this.shippmentDateDayFromCbo;
  }
  
  // getter of 出荷日(From)
  public String getShippmentDateFrom() {
    return SIDateTime.getDate(getShippmentDateYearFromCbo(), getShippmentDateMonthFromCbo(), getShippmentDateDayFromCbo());
  }
  
  // getter of 出荷日の年(To)
  public String getShippmentDateYearToCbo() {
    return this.shippmentDateYearToCbo;
  }
  
  // getter of 出荷日の月(To)
  public String getShippmentDateMonthToCbo() {
    return this.shippmentDateMonthToCbo;
  }
  
  // getter of 出荷日の日(To)
  public String getShippmentDateDayToCbo() {
    return this.shippmentDateDayToCbo;
  }
  
  // getter of 出荷日(To)
  public String getShippmentDateTo() {
    return SIDateTime.getDate(getShippmentDateYearToCbo(), getShippmentDateMonthToCbo(), getShippmentDateDayToCbo());
  }
  
  // getter of 出荷日の年
  public String getShippmentDateYearCbo() {
    return this.shippmentDateYearCbo;
  }
  
  // getter of 出荷日の月
  public String getShippmentDateMonthCbo() {
    return this.shippmentDateMonthCbo;
  }
  
  // getter of 出荷日の日
  public String getShippmentDateDayCbo() {
    return this.shippmentDateDayCbo;
  }
  
  // getter of 出荷日
  public String getShippmentDate() {
    return SIDateTime.getDate(getShippmentDateYearCbo(), getShippmentDateMonthCbo(), getShippmentDateDayCbo());
  }
  
  // getter of 配送種別
  public String getDeliveryTypeCbo() {
    return this.deliveryTypeCbo;
  }
  
  // getter of 出荷日設定用の受注コード+受注配送先項番
  public String[] getCheck() {
    return this.check;
  }
  
  // getter of 出荷日設定用の受注コード
  public String[] getOrderCodeHid() {
    return this.orderCodeHid;
  }
  
  // getter of 自宅フラグ
  public String[] getHomeFlgHid() {
    return this.homeFlgHid;
  }
  
  // getter of 出荷日設定用の受注配送先項番
  public String[] getDeliveryCodeHid() {
    return this.deliveryCodeHid;
  }
  
  // getter of 出荷日設定用の受注日時
  public String[] getInitDateTimeHid() {
    return this.initDateTimeHid;
  }
  
  // getter of 出荷予定日
  public String[] getArrivalPlanDate() {
    return this.arrivalPlanDate;
  }
  
  // getter of 出荷予定時間
  public String[] getArrivalPlanTime() {
    return this.arrivalPlanTime;
  }
  
  // getter of 並べ替え1
  public String getFirstOrderSel() {
    return this.firstOrderSel;
  }
  
  // getter of 並び順１
  public String getFirstOrderTxt() {
    return this.firstOrderTxt;
  }
  
  // getter of 検索用ＳＱＬ文
  public String getConditionSQL() {
    return this.conditionSQL;
  }
  
  // getter of 並び順
  public String getOrderBySQL() {
    return this.orderBySQL;
  }
  
  // getter of ページ番号
  public String getPageNumberTxt() {
    return this.pageNumberTxt;
  }
  
  // getter of PDF帳票タイプ
  public String getPdfType() {
    return this.pdfType;
  }
  
  // getter of 宅配便タイプ
  public String getDeliType() {
    return this.deliType;
  }
  
  // getter of 納品書種類
  public String getDeliveryOutputType() {
    return this.deliveryOutputType;
  }
  
  // getter of 出荷日設定check
  public String getShippmentCheck() {
    return this.shippmentCheck;
  }
  
  // getter of 更新タイプ
  public String getUpdateType() {
    return this.updateType;
  }
  
  // 7.2.0 ST1034 追加 ここから
  // getter of ショップ検索フラグ
  public boolean getShopSearchFlg() {
    return this.shopSearchFlg;
  }
  
  // 7.2.0 ST1034 追加 ここまで
  // getter of 明細番号
  public String[] getDetailCodeHid() {
    return detailCodeHid;
  }
  
  // setter of 明細番号
  public void setDetailCodeHid(String[] detailCodeHid) {
    this.detailCodeHid = detailCodeHid;
  }
  
  // getter of 在庫コード
  public String getIndividualCode() {
    return individualCode;
  }
  
  // setter of 在庫コード
  public void setIndividualCode(String individualCode) {
    if (SIUtil.isNull(individualCode)) individualCode = "";
    this.individualCode = individualCode;
  }
  
  /**
   * @return selectShippmentDateDayCbo を戻します。
   */
  public String getSelectShippmentDateDayCbo() {
    return selectShippmentDateDayCbo;
  }
  
  /**
   * @param selectShippmentDateDayCbo selectShippmentDateDayCbo を設定。
   */
  public void setSelectShippmentDateDayCbo(String selectShippmentDateDayCbo) {
    if (SIUtil.isNull(selectShippmentDateDayCbo)) selectShippmentDateDayCbo="";
    this.selectShippmentDateDayCbo = selectShippmentDateDayCbo;
  }
  
  /**
   * @return selectShippmentDateMonthCbo を戻します。
   */
  public String getSelectShippmentDateMonthCbo() {
    return selectShippmentDateMonthCbo;
  }
  
  /**
   * @param selectShippmentDateMonthCbo selectShippmentDateMonthCbo を設定。
   */
  public void setSelectShippmentDateMonthCbo(String selectShippmentDateMonthCbo) {
    if (SIUtil.isNull(selectShippmentDateMonthCbo)) selectShippmentDateMonthCbo="";
    this.selectShippmentDateMonthCbo = selectShippmentDateMonthCbo;
  }
  
  /**
   * @return selectShippmentDateYearCbo を戻します。
   */
  public String getSelectShippmentDateYearCbo() {
    return selectShippmentDateYearCbo;
  }
  
  /**
   * @param selectShippmentDateYearCbo selectShippmentDateYearCbo を設定。
   */
  public void setSelectShippmentDateYearCbo(String selectShippmentDateYearCbo) {
    if (SIUtil.isNull(selectShippmentDateYearCbo)) selectShippmentDateYearCbo="";
    this.selectShippmentDateYearCbo = selectShippmentDateYearCbo;
  }
  
  public String getSelectShippmentDate() {
    return SIDateTime.getDate(getSelectShippmentDateYearCbo(), getSelectShippmentDateMonthCbo(), getSelectShippmentDateDayCbo());
  }
  
  public String getDeliveryNumber() {
    return deliveryNumber;
  }
  
  public void setDeliveryNumber(String deliveryNumber) {
    if (SIUtil.isNull(deliveryNumber)) deliveryNumber = "";
    this.deliveryNumber = deliveryNumber;
  }
  
  public String getAgentName() {
    return agentName;
  }
  
  public void setAgentName(String agentName) {
    if (SIUtil.isNull(agentName)) agentName = "";
    this.agentName = agentName;
  }
  
  public boolean isCashFlg() {
    return this.cashFlg;
  }
  
  public void setCashFlg(boolean cashFlg) {
    this.cashFlg = cashFlg;
  }
  
  public String getStatementBranch() {
    return statementBranch;
  }
  
  public void setStatementBranch(String statementBranch) {
    if (SIUtil.isNull(statementBranch)) statementBranch = "";
    this.statementBranch = statementBranch;
  }
  
  public String getReceivableFlg() {
    return receivableFlg;
  }
  
  public void setReceivableFlg(String receivableflg) {
    if (SIUtil.isNull(receivableflg)) receivableflg = "";
    this.receivableFlg = receivableflg;
  }
  
  public String getOrderCodeList() {
    return orderCodeList;
  }
  
  public void setOrderCodeList(String orderCodeList) {
    if (SIUtil.isNull(orderCodeList)) orderCodeList = "";
    this.orderCodeList = orderCodeList;
  }
  
  public String getStorageCode() {
    return storageCode;
  }
  
  public void setStorageCode(String storageCode) {
    if (SIUtil.isNull(storageCode)) storageCode = "";
    this.storageCode = storageCode;
  }
  
  /**
   * <b>init</b> 入力したデータを基づいて、このbeansを設定します。
   * 
   * @param request クライアントからリクエスト
   * @param lUrlParam
   * @return なし
   * @throws なし
   */
  public void init(HttpServletRequest lRequest, SIURLParameter lUrlParam) {// 7.1.1 ST0236 修正
    this.setEncode(SIConfig.SIENCODE_SHIFT_JIS);
    this.searchFlg = true;
    // 7.1.1 ST0236 修正 ここから
    super.init(lRequest, lUrlParam);
    this.setOrderCodeTxt((String) lUrlParam.getParam("orderCodeTxt"));// 受注番号
    this.setCustPronNameTxt((String) lUrlParam.getParam("custPronNameTxt"));// 顧客名カナ
    this.setCustNameTxt((String) lUrlParam.getParam("custNameTxt"));// 顧客名
    this.setAllocateBranch((String) lUrlParam.getParam("allocateBranch"));// 出荷支店
    this.setInitDateYearFromCbo((String) lUrlParam.getParam("initDateYearFromCbo"));// 受注日の年(From)
    this.setInitDateMonthFromCbo((String) lUrlParam.getParam("initDateMonthFromCbo"));// 受注日の月(From)
    this.setInitDateDayFromCbo((String) lUrlParam.getParam("initDateDayFromCbo"));// 受注日の日(From)
    this.setInitDateYearToCbo((String) lUrlParam.getParam("initDateYearToCbo"));// 受注日の年(To)
    this.setInitDateMonthToCbo((String) lUrlParam.getParam("initDateMonthToCbo"));// 受注日の月(To)
    this.setInitDateDayToCbo((String) lUrlParam.getParam("initDateDayToCbo"));// 受注日の日(To)
    this.setReceiptFlgRdo((String) lUrlParam.getParam("receiptFlgRdo"));// 入金状況
    this.setShippmentFlgRdo((String) lUrlParam.getParam("shippmentFlgRdo"));// 出荷状況
    this.setShippmentDateYearFromCbo((String) lUrlParam.getParam("shippmentDateYearFromCbo"));// 出荷日の年(From)
    this.setShippmentDateMonthFromCbo((String) lUrlParam.getParam("shippmentDateMonthFromCbo"));// 出荷日の月(From)
    this.setShippmentDateDayFromCbo((String) lUrlParam.getParam("shippmentDateDayFromCbo"));// 出荷日の日(From)
    this.setShippmentDateYearToCbo((String) lUrlParam.getParam("shippmentDateYearToCbo"));// 出荷日の年(To)
    this.setShippmentDateMonthToCbo((String) lUrlParam.getParam("shippmentDateMonthToCbo"));// 出荷日の月(To)
    this.setShippmentDateDayToCbo((String) lUrlParam.getParam("shippmentDateDayToCbo"));// 出荷日の日(To)
    this.setBranchFlgCbo((String) lUrlParam.getParam("branchFlgCbo"));// 対応支店フラグ
    this.setBranchCode((String) lUrlParam.getParam("branchCode"));// 対応支店コード
    if (SIUtil.isNull(this.branchCode)) this.setBranchCode((String) lUrlParam.getParam("branchCode2"));// 対応支店コード履歴
    this.setChargeFlgCbo((String) lUrlParam.getParam("chargeFlgCbo"));// 担当者フラグ
    this.setChargeCode((String) lUrlParam.getParam("chargeCode"));// 担当者コード
    if (SIUtil.isNull(this.chargeCode)) this.setChargeCode((String) lUrlParam.getParam("chargeCode2"));// 担当者コード履歴
    this.setConsignFlgCbo((String) lUrlParam.getParam("consignFlgCbo"));// 委託フラグ
    this.setFirstOrderSel((String) lUrlParam.getParam("firstOrderSel"));// 並べ替え1
    this.setFirstOrderTxt((String) lUrlParam.getParam("firstOrderTxt"));// 並び順1
    this.setPdfType((String) lUrlParam.getParam("pdfType"));// PDFタイプ
    this.setIndividualCode((String) lUrlParam.getParam("individualCode"));// 在庫コード
    // 7.1.1 ST0236 修正 ここまで
    this.setOrderCodeList((String) lUrlParam.getParam("orderCodeList"));// 受注番号一括
    // 出荷日の初期値をセット
    SIDateTime date = new SIDateTime();
    this.setShippmentDateYearCbo(date.getYearStr());
    this.setShippmentDateMonthCbo(date.getMonthStr());
    this.setShippmentDateDayCbo(date.getDayStr());
    
    // 7.2.0 ST1034 追加 ここから
    this.setShopCodeTxt((String) lUrlParam.getParam("shopCodeTxt"));// ショップコード
    // ショップ検索フラグ
    if (SIUtil.isNotNull(this.getShopCodeTxt())) {
      this.setShopSearchFlg(true);
    } else {
      this.setShopSearchFlg(false);
    }
    // 7.2.0 ST1034 追加 ここまで
    
    // 7.2.0 ST0302 追加 ここから
    this.setOrderCodeFromTxt((String) lUrlParam.getParam("orderCodeFromTxt"));// 受注番号From
    this.setOrderCodeToTxt((String) lUrlParam.getParam("orderCodeToTxt")); // 受注番号To
    // 7.2.0 ST0302 追加 ここまで
    this.setCustCode((String) lUrlParam.getParam("custCode"));
    this.setTel((String) lUrlParam.getParam("tel"));
    this.setEmailTxt((String) lUrlParam.getParam("emailTxt"));
    this.setCompanyName((String) lUrlParam.getParam("companyName"));
    this.setOrderRoute((String) lUrlParam.getParam("orderRoute"));
    this.setSelectShippmentDateYearCbo((String) lUrlParam.getParam("selectShippmentDateYearCbo"));// 出荷日の年(検索項目)
    this.setSelectShippmentDateMonthCbo((String) lUrlParam.getParam("selectShippmentDateMonthCbo"));// 出荷日の月(検索項目)
    this.setSelectShippmentDateDayCbo((String) lUrlParam.getParam("selectShippmentDateDayCbo"));// 出荷日の日(検索項目)
    this.setOrderStatusRdo((String) lUrlParam.getParam("orderStatusRdo"));
    this.setStatementBranch((String) lUrlParam.getParam("statementBranch"));
    this.setReceivableFlg((String) lUrlParam.getParam("receivableFlg"));// 取引条件
    this.setStorageCode((String) lUrlParam.getParam("storageCode"));// 預け先
  }
  
  public Collection getCollection(Connection lConnection) throws SIDBAccessException {
    return getCollection(lConnection, new SILogin());
  }
  
  /**
   * <b>getCollection</b> 条件に合ったレコードを検索して、結果のコネクションを作成して、戻します。
   * 
   * @param lConnection データベースへの接続コネクション
   * @return レコードのセット
   * @throws なし
   */
  public Collection getCollection(Connection lConnection, SILogin lLogin) throws SIDBAccessException {
    Statement lStatement = null;
    ResultSet lResultSet = null;
    SIShippment lBasic = new SIShippment();
    StringBuffer lSqlBuf = new StringBuffer();
    StringBuffer lCountBuf = new StringBuffer();
    StringBuffer lCommonBuf = new StringBuffer();
    Collection lResultColl = new ArrayList();
    
    String orderBranch = "";
    if (orderCodeTxt.split("-") != null && orderCodeTxt.split("-").length>1) {
      orderBranch = orderCodeTxt.split("-")[1];
    }
    
    if (!this.searchFlg) return lResultColl;
    
    lCountBuf.append("SELECT COUNT(DISTINCT aa.ordercode||'-'||bb.deliverycode||'-'||bb.detailcode) ");
    
    //EDBTG003-00 mod start
//    lSqlBuf.append("SELECT DISTINCT aa.OrderCode,bb.DeliveryCode,bb.detailcode,");
//    lSqlBuf.append("aa.CustName,cc.DeliveryAddressee, ");
//    lSqlBuf.append("aa.InitDateTime,aa.ReceiptDate, bb.DeliveryDate, ");
//    lSqlBuf.append("bb.ShippmentDate,cc.HomeFlg,bb.ShopCode,bb.ShopName,bb.purchaseprice, ");
    lSqlBuf.append("SELECT DISTINCT aa.OrderCode AS OrderCode, bb.DeliveryCode AS DeliveryCode, bb.detailcode,");
    lSqlBuf.append("aa.CustName AS CustName, cc.DeliveryAddressee AS DeliveryAddressee, ");
    lSqlBuf.append("aa.InitDateTime AS InitDateTime, aa.ReceiptDate AS ReceiptDate, bb.DeliveryDate AS DeliveryDate, ");
    lSqlBuf.append("bb.ShippmentDate AS ShippmentDate,cc.HomeFlg,bb.ShopCode,bb.ShopName,bb.purchaseprice, ");
    //EDBTG003-00 mod end
    lSqlBuf.append("bb.CmdtyName,aa.BranchCode,aa.ChargeCode,dd.ConsignGoodsFlg,bb.CmdtyCode,bb.IndividualCode,aa.status,aa.paymentflg,bb.registmaildate ");
    
    lCommonBuf.append("FROM orderlatestvw aa ");
    lCommonBuf.append(",orderdetailtbl bb ");
    if (SIUtil.isNotNull(orderBranch) && !orderBranch.equals("01")) {
      lCommonBuf.append("LEFT OUTER JOIN (SELECT ordercode,individualcode,outputordercode FROM shippmentrequesttbl  ");
      lCommonBuf.append("WHERE enabledflg=1 AND checkflg=1) req ");
      lCommonBuf.append("ON (bb.ordercode = req.ordercode AND bb.individualcode = req.individualcode) ");
    }
    lCommonBuf.append("LEFT OUTER JOIN (SELECT ordercode,individualcode,branchcode FROM orderallocationinfotbl) ee ");
    lCommonBuf.append("ON (bb.ordercode = ee.ordercode AND bb.individualcode = ee.individualcode), ");
    lCommonBuf.append("orderdeliverytbl cc,individualtbl dd,custtbl cust,cmdtymtbl ff ");
    lCommonBuf.append("WHERE aa.ordercode=bb.ordercode AND aa.ordercode=cc.ordercode AND bb.deliverycode=cc.deliverycode ");
    lCommonBuf.append("AND dd.cmdtycode=ff.cmdtycode ");
    lCommonBuf.append("AND aa.orderbranchcode=bb.orderbranchcode AND aa.orderbranchcode=cc.orderbranchcode ");
    if (SIUtil.isNotNull(orderBranch) && !orderBranch.equals("01")) {
      lCommonBuf.append(" AND bb.ordercode IN (SELECT ordercode FROM shippmentrequesttbl WHERE enabledflg=1 AND checkflg=1) ");
      lCommonBuf.append(" AND ee.branchcode='18' ");
    }
    lCommonBuf.append("AND bb.individualcode=dd.individualcode AND bb.cmdtycode=dd.cmdtycode ");
    lCommonBuf.append("AND aa.custcode=cust.custcode ");
    
    lCountBuf.append(lCommonBuf);
    lSqlBuf.append(lCommonBuf);
    
    // 検索の条件
    lCountBuf.append(this.conditionSQL);
    lSqlBuf.append(this.conditionSQL);
    // 出力順
    lSqlBuf.append(this.getOrderBySQL());
    log.debug("lSqlBuf=" + lSqlBuf.toString());
    // 実行
    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;
      
      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) {
        lBasic = new SIShippment();
        lBasic.setEncode(SIConfig.SIENCODE_NONE);
        lBasic.setOrderCode(lResultSet.getString("OrderCode"));// 受注番号
        lBasic.setDeliveryCode(lResultSet.getString("DeliveryCode"));// 受注配送先項番
        lBasic.setDetailCode(lResultSet.getString("DetailCode"));// 受注配送先項番
        lBasic.setShopName(lResultSet.getString("ShopName"));// 7.2.0 ST1034 追加
        lBasic.setCustName(lResultSet.getString("CustName"));// 顧客名
        lBasic.setDeliveryAddress(lResultSet.getString("DeliveryAddressee"));// 配送先宛名
        lBasic.setInitDate(SIDBUtil.getDateTime(lResultSet.getTimestamp("InitDateTime")));// 受注日
        lBasic.setReceiptDate(SIDBUtil.getDate(lResultSet.getTimestamp("receiptDate")));// 入金日
        lBasic.setDeliveryDate(SIDBUtil.getDate(lResultSet.getTimestamp("DeliveryDate")));// 配送希望日
        lBasic.setShippmentDate(SIDBUtil.getDate(lResultSet.getTimestamp("ShippmentDate")));// 出荷日
        lBasic.setHomeFlg(lResultSet.getString("HomeFlg"));// 自宅フラグ
        lBasic.setShopCode(lResultSet.getString("shopCode"));// ショップコード
        lBasic.setCmdtyCode(lResultSet.getString("CmdtyCode"));// 親コード
        lBasic.setIndividualCode(lResultSet.getString("IndividualCode"));// 在庫コード
        lBasic.setCmdtyName(lResultSet.getString("CmdtyName"));// 商品名
        lBasic.setBranchCode(lResultSet.getString("BranchCode"));// 対応支店コード
        lBasic.setChargeCode(lResultSet.getString("ChargeCode"));// 担当者コード
        lBasic.setConsignFlg(lResultSet.getString("ConsignGoodsFlg"));// 委託フラグ
        lBasic.setStatus(lResultSet.getString("status"));// 受注状態
        lBasic.setPaymentFlg(lResultSet.getString("paymentflg"));// 支払区分
        lBasic.setShippmentRegistMailDate(SIDBUtil.getDateTime(lResultSet.getTimestamp("registmaildate")));
        lBasic.setZero(SIUtil.isVariableCode((lBasic.getIndividualCode()))&&"0".equals(lResultSet.getString("purchaseprice")));
        lResultColl.add(lBasic);
        lIndex++;
      }
      for (int jj = lFromInx + lPageSize; jj < lRecordCount; jj++)
        lResultColl.add(null);
      
    } catch (Exception ex) {
      ex.printStackTrace();
      throw new SIDBAccessException(ex);
    } finally {
      SIDBUtil.close(lResultSet, lStatement);
    }
    return lResultColl;
  }
  
  /**
   * <b>initShippment</b> 入力したデータを基づいて、このbeansを設定します。
   * 
   * @param request クライアントからリクエスト
   * @param lUrlParam
   * @return なし
   * @throws なし
   */
  public void initShippment(HttpServletRequest lRequest, SIURLParameter lUrlParam) {// 7.1.1 ST0236 修正
    super.init(lRequest, lUrlParam);// 7.1.1 ST0236 修正
    this.setCheck(lRequest.getParameterValues("check"));
    this.setOrderCodeHid(lRequest.getParameterValues("orderCodeHid"));
    this.setHomeFlgHid(lRequest.getParameterValues("homeFlgHid"));
    this.setDeliveryCodeHid(lRequest.getParameterValues("deliveryCodeHid"));
    this.setDetailCodeHid(lRequest.getParameterValues("detailCodeHid"));
    this.setInitDateTimeHid(lRequest.getParameterValues("InitDateTimeHid"));
    this.setArrivalPlanDate(lRequest.getParameterValues("arrivalPlanDate"));
    this.setArrivalPlanTime(lRequest.getParameterValues("arrivalPlanTime"));
    this.setShippmentDateHid(lRequest.getParameterValues("shippmentDateHid"));// 7.3.0 PI-NES0501 追加
    this.setStatusHid(lRequest.getParameterValues("statusHid"));
    // 7.1.1 ST0236 修正 ここから
    this.setShippmentDateYearCbo((String) lUrlParam.getParam("shippmentDateYearCbo"));// 出荷日の年
    this.setShippmentDateMonthCbo((String) lUrlParam.getParam("shippmentDateMonthCbo"));// 出荷日の月
    this.setShippmentDateDayCbo((String) lUrlParam.getParam("shippmentDateDayCbo"));// 出荷日の日
    this.setPdfType((String) lUrlParam.getParam("pdfType"));// PDFタイプ
    this.setDeliType((String) lUrlParam.getParam("deliType"));// 宅配便タイプ
    this.setDeliveryOutputType((String) lUrlParam.getParam("deliveryOutputType"));// 納品書出力種類
    this.setShippmentCheck((String) lUrlParam.getParam("shippmentCheck"));// 出荷日同時設定
    this.setUpdateType((String) lUrlParam.getParam("updateType"));// 更新タイプ
    // 7.1.1 ST0236 修正 ここまで
    
    // 7.2.0 ST1034 追加 ここから
    if (this.getPdfType().equalsIgnoreCase(SIPDFConf.SIPDF_TYPE_SHIPPMENT)) {
      this.setDeliveryOutputType("5");
    }
    // 7.2.0 ST1034 追加 ここまで
    this.setDeliveryNumber((String) lUrlParam.getParam("deliveryNumber"));
    this.setAgentName((String) lUrlParam.getParam("agentName"));
    this.setCashFlg(SIUtil.isNotNull(((String) lUrlParam.getParam("cashFlg"))) && ((String) lUrlParam.getParam("cashFlg")).equals("1"));
  }
  
  /**
   * <b>validate</b> 入力したデータをチェックして、同時にSQLの条件文を作成します。
   * 
   * @param lRequest クライアントからのリクエスト
   * @return なし
   * @throws なし
   */
  public boolean validate(HttpServletRequest lRequest) {
    SICustomErrors errors = new SICustomErrors();
    SITableConditionManager lConditionMan = new SITableConditionManager();
    
    // 受注番号
    if (SIUtil.isNotNull(orderCodeTxt) ) {
      String[] temp = orderCodeTxt.split("-");
      if (temp.length==2) {
        SICheckValid.checkValid(errors, "受注番号", temp[0], SICheckDataConf.SICHECK_DATA_DIGIT_TYPE);
        SICheckValid.checkValid(errors, "受注番号枝番", temp[1], SICheckDataConf.SICHECK_DATA_DIGIT_TYPE);
        if (errors.isEmpty() && !temp[1].equals("01")) {
          lConditionMan.add(new SITableCondition("req", "OutputOrderCode", orderCodeTxt, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
        } else if (errors.isEmpty()) {
          lConditionMan.add(new SITableCondition("aa", "OrderCode", temp[0], SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
        }
      } else if (SICheckValid.checkValid(errors, "受注番号", orderCodeTxt, SICheckDataConf.SICHECK_DATA_DIGIT_TYPE)) {
        lConditionMan.add(new SITableCondition("aa", "OrderCode", orderCodeTxt, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
      }
    }
    if (SIUtil.isNotNull(orderCodeList)){
      String[] codeList = orderCodeList.split(",");
      StringBuffer codeListStr = new StringBuffer();
      for (int i=0;i<codeList.length;i++) {
        SICheckValid.checkValid(errors, "受注番号リスト["+String.valueOf(i+1)+"]", codeList[i], SICheckDataConf.SICHECK_DATA_DIGIT_TYPE);
        if (i>0) codeListStr.append(",");
        codeListStr.append(SIDBUtil.SQL2Str(codeList[i]));
      }
      if (SIUtil.isNull(codeListStr.toString())) errors.addError(new SICustomError("manager.message.freeword","一括検索する場合は受注番号を一件以上入力して下さい"));
      if (errors.isEmpty()) lConditionMan.add(new SITableCondition(" AND aa.ordercode IN("+codeListStr.toString()+") "));
    }
    
    // 顧客コード(完全一致)
    if (SIUtil.isNotNull(this.getCustCode()) && SICheckValid.checkValid(errors, "顧客コード", this.getCustCode(), SICheckDataConf.SICHECK_DATA_DIGIT_TYPE)
        && SICheckValid.checkValid(errors, "顧客コード", this.getCustCode(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 10)) {
      lConditionMan.add(new SITableCondition("aa", "custCode", this.getCustCode(), SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    }
    
    // 顧客名
    if (SIUtil.isNotNull(custNameTxt) && SICheckValid.checkValid(errors, "顧客名", custNameTxt, SICheckDataConf.SICHECK_DATA_ZENKAKU_TYPE)) {
      String[] custNameList = this.getCustNameTxt().split(" |　");
      for (int i=0;i<custNameList.length;i++) {
        lConditionMan.add(new SITableCondition("aa", "custName", custNameList[i], SIConfig.SICONDITION_TYPE_LIKE, SIConfig.SICONDITION_TYPE_AND));
      }
    }
    
    // 顧客名カナ
    if (SIUtil.isNotNull(custPronNameTxt) && SICheckValid.checkValid(errors, "顧客名カナ", custPronNameTxt, SICheckDataConf.SICHECK_DATA_ZENKAKU_KANA_TYPE)) {
      String[] custPronNameList = this.getCustPronNameTxt().split(" |　");
      for (int j=0;j<custPronNameList.length;j++) {
        lConditionMan.add(new SITableCondition("aa", "custPronName", custPronNameList[j], SIConfig.SICONDITION_TYPE_LIKE, SIConfig.SICONDITION_TYPE_AND));
      }
    }
    // 出荷支店
    if (SIUtil.isNotNull(allocateBranch)) {
      lConditionMan.add(new SITableCondition("ee", "BranchCode", allocateBranch, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    }
    
    // 在庫コード
    if (SIUtil.isNotNull(individualCode) && SICheckValid.checkValid(errors, "在庫コード", individualCode, SICheckDataConf.SICHECK_DATA_ALPHA_DIGIT_TYPE)) {
      // EDBTG003-00 nagayoshi mod start
//      lConditionMan.add(new SITableCondition("bb", "individualCode", individualCode, SIConfig.SICONDITION_TYPE_FRONTLIKE, SIConfig.SICONDITION_TYPE_AND));
      lConditionMan.add(new SITableCondition("(bb", "individualCode", individualCode, SIConfig.SICONDITION_TYPE_FRONTLIKE, SIConfig.SICONDITION_TYPE_AND));
      lConditionMan.add(new SITableCondition("bb", "setIndividualCode", individualCode, SIConfig.SICONDITION_TYPE_FRONTLIKE, SIConfig.SICONDITION_TYPE_OR));
      lConditionMan.add(new SITableCondition(")"));
      // EDBTG003-00 nagayoshi mod end
    }
    
    // 7.2.0 ST1034 追加 ここから
    // ショップコード
    if (SIUtil.isNotNull(shopCodeTxt) && SICheckValid.checkValid(errors, "ショップコード", shopCodeTxt, SICheckDataConf.SICHECK_DATA_ALPHA_DIGIT_TYPE)) {
      lConditionMan.add(new SITableCondition("bb", "SHOPCODE", shopCodeTxt, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    }
    // 7.2.0 ST1034 追加 ここまで
    
    // 7.2.0 ST0302 追加 ここから
    // 2006/07/24 kosuge 修正 start
    
    // 受注番号From
    if (SIUtil.isNotNull(orderCodeFromTxt) && SICheckValid.checkValid(errors, "受注番号", orderCodeFromTxt, SICheckDataConf.SICHECK_DATA_DIGIT_TYPE)) {
      lConditionMan.add(new SITableCondition("aa", "ORDERCODE", orderCodeFromTxt, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    }
    
    // 受注経路
    if (SIUtil.isNotNull(orderRoute) && SICheckValid.checkValid(errors, "受注経路", orderRoute, SICheckDataConf.SICHECK_DATA_ALPHA_DIGIT_TYPE)) {
        lConditionMan.add(new SITableCondition("aa", "ORDERROUTE", orderRoute, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    }
    
    /*
     * //受注番号To if (SIUtil.isNotNull(orderCodeToTxt) && SICheckValid.checkValid(errors, "受注番号To", orderCodeToTxt, SICheckDataConf.SICHECK_DATA_DIGIT_TYPE)) { lConditionMan.add(new
     * SITableCondition("aa", "ORDERCODE", orderCodeToTxt, SIConfig.SICONDITION_TYPE_LESS_EQUAL, SIConfig.SICONDITION_TYPE_AND)); } //受注番号大小 if (errors.isEmpty() &&
     * SIUtil.isNotNull(orderCodeFromTxt) && SIUtil.isNotNull(orderCodeToTxt) && !orderCodeFromTxt.equals(orderCodeToTxt)) { SICheckValid.checkValid(errors, "受注番号From", "受注番号To",
     * orderCodeFromTxt, orderCodeToTxt, SICheckDataConf.SICHECK_DATA_VALUE_LESS_TYPE); }
     */
    // 2006/07/24 kosuge 修正 end
    // 7.2.0 ST0302 追加 ここまで
    boolean initFrom = false;
    boolean initTo = false;
    
    // 受注日
    if (SIUtil.isNotNull(getInitDateFrom()) && SICheckValid.checkValid(errors, "受注日From", getInitDateFrom(), SICheckDataConf.SICHECK_DATA_DATE_TYPE)) initFrom=true;
    if (SIUtil.isNotNull(getInitDateTo()) && SICheckValid.checkValid(errors, "受注日To", getInitDateTo(), SICheckDataConf.SICHECK_DATA_DATE_TYPE)) initTo=true;
    if (initFrom&&initTo) {
      lConditionMan.add(new SITableCondition("AND aa.initDateTime BETWEEN "+SIDBUtil.SQL2Str(getInitDateFrom()+" 00:00:00")+" AND "+SIDBUtil.SQL2Str(getInitDateTo()+" 23:59:59")));
    } else if (initFrom) {
      lConditionMan.add(new SITableCondition("aa", "initDateTime", getInitDateFrom() + " 00:00:00", SIConfig.SICONDITION_TYPE_GREATER_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    } else if (initTo) {
      lConditionMan.add(new SITableCondition("aa", "initDateTime", getInitDateTo() + " 23:59:59", SIConfig.SICONDITION_TYPE_LESS_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    }
    
    // 受注日大小
    try {
      if (!SICheckUtil.dateEqual(this.getInitDateFrom(), this.getInitDateTo())) {
        SICheckValid.checkValid(errors, "受注日From", "受注日To", this.getInitDateFrom(), this.getInitDateTo(), SICheckDataConf.SICHECK_DATA_DATE_LESS_TYPE);// 7.1.1 ST0162 修正
      }
    } catch (Exception e) {}
    
    boolean shippmentFrom = false;
    boolean shippmentTo = false;
    // 出荷日
    if (SIUtil.isNotNull(getShippmentDateFrom()) && SICheckValid.checkValid(errors, "出荷日From", getShippmentDateFrom(), SICheckDataConf.SICHECK_DATA_DATE_TYPE)) shippmentFrom=true;
    if (SIUtil.isNotNull(getShippmentDateTo()) && SICheckValid.checkValid(errors, "出荷日To", getShippmentDateTo(), SICheckDataConf.SICHECK_DATA_DATE_TYPE)) shippmentTo=true;
    if (shippmentFrom&&shippmentTo) {
      lConditionMan.add(new SITableCondition("AND bb.shippmentDate BETWEEN "+SIDBUtil.SQL2Str(getShippmentDateFrom()+" 00:00:00")+" AND "+SIDBUtil.SQL2Str(getShippmentDateTo()+" 23:59:59")));
    } else if (shippmentFrom) {
      lConditionMan.add(new SITableCondition("bb", "shippmentDate", getShippmentDateFrom() + " 00:00:00", SIConfig.SICONDITION_TYPE_GREATER_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    } else if (shippmentTo) {
      lConditionMan.add(new SITableCondition("bb", "shippmentDate", getShippmentDateTo() + " 23:59:59", SIConfig.SICONDITION_TYPE_LESS_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    }
    
    // 出荷日大小
    try {
      if (!SICheckUtil.dateEqual(this.getShippmentDateFrom(), this.getShippmentDateTo())) {
        SICheckValid.checkValid(errors, "出荷日From", "出荷日To", this.getShippmentDateFrom(), this.getShippmentDateTo(), SICheckDataConf.SICHECK_DATA_DATE_LESS_TYPE);// 7.1.1 ST0162 修正
      }
    } catch (Exception e) {}
    
    // 入金状況
    if (SIUtil.isNotNull(receiptFlgRdo)) {
      if (receiptFlgRdo.equals("0")) {
        lConditionMan.add(new SITableCondition("aa", "receiptDate", "", SIConfig.SICONDITION_TYPE_IS_NULL, SIConfig.SICONDITION_TYPE_AND));
      } else if (receiptFlgRdo.equals("1")) {
        lConditionMan.add(new SITableCondition("aa", "receiptDate", "", SIConfig.SICONDITION_TYPE_IS_NOT_NULL, SIConfig.SICONDITION_TYPE_AND));
      }
    }
    
    // 出荷状況
    if (SIUtil.isNotNull(shippmentFlgRdo)) {
      if (shippmentFlgRdo.equals("0")) {
        lConditionMan.add(new SITableCondition("bb", "shippmentDate", "", SIConfig.SICONDITION_TYPE_IS_NULL, SIConfig.SICONDITION_TYPE_AND));
      } else if (shippmentFlgRdo.equals("1")) {
        lConditionMan.add(new SITableCondition("bb", "shippmentDate", "", SIConfig.SICONDITION_TYPE_IS_NOT_NULL, SIConfig.SICONDITION_TYPE_AND));
      } else if (shippmentFlgRdo.equals("2")) {
        lConditionMan.add(new SITableCondition("cc", "deliveryOutputFlg", "", SIConfig.SICONDITION_TYPE_IS_NULL, SIConfig.SICONDITION_TYPE_AND));
      } else if (shippmentFlgRdo.equals("3")) {
        lConditionMan.add(new SITableCondition("cc", "shippmentMailFlg", "0", SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
      }
    }
    // 出荷日
    if (SIUtil.isNotNull(this.getSelectShippmentDate()) && SICheckValid.checkValid(errors, "出荷日", this.getSelectShippmentDate(), SICheckDataConf.SICHECK_DATA_DATE_TYPE)) {
      lConditionMan.add(new SITableCondition("bb", "shippmentDate", this.getSelectShippmentDate(), SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    }
    // 電話番号
    if (SIUtil.isNotNull(this.getTel()) && SICheckValid.checkValid(errors, "電話番号", this.getTel(), SICheckDataConf.SICHECK_DATA_DIGIT_TYPE)) {
      lConditionMan.add(new SITableCondition(" AND (aa.tel like'%" + this.getTel() + "%' OR aa.storetel like'%" + this.getTel() + "%') "));
    }
    // 会社名
    if (SIUtil.isNotNull(this.getCompanyName()) && SICheckValid.checkValid(errors, "会社名", this.getCompanyName(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 100)) {
      lConditionMan.add(new SITableCondition("aa", "COMPANYNAME", this.getCompanyName(), SIConfig.SICONDITION_TYPE_LIKE, SIConfig.SICONDITION_TYPE_AND));
    }
    // メールアドレス
    if (SIUtil.isNotNull(this.getEmailTxt()) && SICheckValid.checkValid(errors, "メールアドレス", emailTxt, SICheckDataConf.SICHECK_DATA_ASCII_TYPE)
        && SICheckValid.checkValid(errors, "メールアドレス", this.getEmailTxt(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 128)) {
      lConditionMan.add(new SITableCondition("aa", "email", getEmailTxt(), SIConfig.SICONDITION_TYPE_LIKE, SIConfig.SICONDITION_TYPE_AND));
    }
    
    // 7.3.0 PI-NES0501 削除
    // 7.3.0 PI-NES0501 追加 ここから
    // 対応支店
    if (SIUtil.isNotNull(branchFlgCbo)) {
      if (branchFlgCbo.equals("1")) {
        lConditionMan.add(new SITableCondition("aa", "BranchCode", "", SIConfig.SICONDITION_TYPE_IS_NULL, SIConfig.SICONDITION_TYPE_AND));
      } else if (branchFlgCbo.equals("2")) {
        lConditionMan.add(new SITableCondition("aa", "BranchCode", this.branchCode, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
      }
    }
    // 担当者
    if (SIUtil.isNotNull(chargeFlgCbo)) {
      if (chargeFlgCbo.equals("1")) {
        lConditionMan.add(new SITableCondition("aa", "ChargeCode", "", SIConfig.SICONDITION_TYPE_IS_NULL, SIConfig.SICONDITION_TYPE_AND));
      } else if (chargeFlgCbo.equals("2")) {
        lConditionMan.add(new SITableCondition("aa", "ChargeCode", this.chargeCode, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
      }
    }
    // 委託フラグ
    if (SIUtil.isNotNull(consignFlgCbo)) {
      if (consignFlgCbo.equals("1")) {
        lConditionMan.add(new SITableCondition("dd", "ConsignGoodsFlg", "1", SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
      } else if (consignFlgCbo.equals("2")) {
        lConditionMan.add(new SITableCondition("dd", "ConsignGoodsFlg", "0", SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
      }
    }
    // 7.3.0 PI-NES0501 追加 ここまで
    
    // 受注状態
    if (SIUtil.isNotNull(orderStatusRdo)) {
      if (orderStatusRdo.equals("1")) {
        lConditionMan.add(new SITableCondition("aa", "status", "1", SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
      } else if (orderStatusRdo.equals("3")) {
        lConditionMan.add(new SITableCondition("aa", "status", "1", SIConfig.SICONDITION_TYPE_NOT_EQUAL, SIConfig.SICONDITION_TYPE_AND));
      }
    }
    
    // 取引条件
    if (SIUtil.isNotNull(this.getReceivableFlg())) {
      lConditionMan.add(new SITableCondition("cust", "Receivableflg", this.getReceivableFlg(), SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    }
    
    if (SIUtil.isNotNull(this.getStorageCode())) {
      lConditionMan.add(new SITableCondition("ff", "storagecode", this.getStorageCode(), SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));
    }
    
    if (!errors.isEmpty()) {
      lRequest.setAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY_BAK, errors);
      lConditionMan.add(new SITableCondition("dd", "ConsignGoodsFlg", "2", SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND));// エラー時のクリア用検索条件
    } else lRequest.removeAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY_BAK);
    
    // 条件文の設定
    this.conditionSQL = lConditionMan.getCondtionSQL();
    // 並び順文の作成
    this.makeOrderBySQL();
    
    return errors.isEmpty();
  }
  
  /**
   * <b>validate</b> 入力したデータをチェックして、同時にSQLの条件文を作成します。
   * 
   * @param lRequest クライアントからのリクエスト
   * @return なし
   * @throws なし
   */
  public boolean validateShippment(HttpServletRequest lRequest, Connection lConnection) {
    SILogin manLogin = SIHTMLUtil.getLogin(lRequest);
    SICustomErrors errors = new SICustomErrors();
    String record = "";
    SIDateTime recDate = new SIDateTime();
    try {
      record = SIDBUtil.getFirstData(lConnection, "SELECT MAX(season) FROM inventorytbl");
      if (SIUtil.isNotNull(record)) {
        recDate = new SIDateTime(SIDateTime.getDate(record.substring(0, 4), record.substring(4, 6), "01"), "yyyy/MM/dd");
        recDate.addMonth(1);
        if (SIUtil.isNotNull(getShippmentDate()) && SICheckUtil.dateLess(getShippmentDate(), recDate.getFullDate())) {
          errors.addError(new SICustomError("input.data.date.shippment.record"));
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
      errors.addError(new SICustomError("database.execute.error"));
    }
    
    // 出荷日の整合性チェック
    if (SIUtil.isNotNull(getShippmentDate())) {
      SICheckValid.checkValid(errors, "出荷日設定", getShippmentDate(), SICheckDataConf.SICHECK_DATA_DATE_TYPE);
    }
    
    // チェックボックスのチェック
    if (this.getCheck() == null || this.getCheck().length == 0) {
      if (manLogin.getUserCode().equals(SPUSER7)){
        errors.addError(new SICustomError("input.data.checkbox.require", "出荷日訂正"));
      }else{
        errors.addError(new SICustomError("input.data.checkbox.require", "出荷日設定"));
      }
    }
    
    // 受注日＜＝出荷日 && 設定済出荷日＜＝締処理翌月の１日の場合の変更禁止 && 返品・キャンセル禁止
    boolean datecheck = true;
    boolean datecheck2 = true;
    boolean statuscheck = true;
    boolean hacchucheck = true;//発注消し込みがないとダメ
    boolean hacchucheck2 = true;//仕入日より前の日付はダメ
    
    try {
      if (this.getCheck() != null && this.getCheck().length > 0) {
        for (int i = 0; i < this.getCheck().length; i++) {
          int j = Integer.parseInt(this.getCheck()[i]);
          String time = this.getInitDateTimeHid()[j];
          if (SIUtil.isNotNull(getShippmentDate()) && SICheckUtil.isDate(getShippmentDate())) {
            if (SICheckUtil.dateLess(getShippmentDate(), time)) datecheck = false;
          }
          SIOrderDetail detail = new SIOrderDetail(this.getOrderCodeHid()[j], this.getDeliveryCodeHid()[j], this.getDetailCodeHid()[j]);
          detail.reset(lConnection);
          if (SIUtil.isNotNull(record)) {
            if (SIUtil.isNotNull(detail.getShippmentDate())) {
              if (SICheckUtil.dateLess(detail.getShippmentDateF(), recDate.getFullDate())) datecheck2 = false;
            }
          }
          if (!this.getStatusHid()[j].equals("1")) statuscheck = false;
          
          StringBuffer lSql = new StringBuffer();
          lSql.append("SELECT b.shippmentdate FROM hacchutbl a,hacchudetailtbl b ");
          lSql.append("WHERE a.hacchucode=b.hacchucode AND a.layercode=b.layercode AND a.enabledflg='1' AND a.status='1' AND b.shipflg='0' ");
          lSql.append("AND a.ordercode=").append(SIDBUtil.SQL2Str(detail.getOrderCode()," "));
          lSql.append("AND b.individualcode=").append(SIDBUtil.SQL2Str(detail.getIndividualCode()," "));
          
          Statement lStatement = lConnection.createStatement();
          ResultSet lResultSet = lStatement.executeQuery(lSql.toString());
          if (lResultSet.next()) {
            String storeDate = SIDBUtil.getDate(lResultSet.getTimestamp("shippmentdate"));
            if (SIUtil.isNull(storeDate)&&SIUtil.isNotNull(getShippmentDate())) hacchucheck = false;
            else if (SIUtil.isNotNull(getShippmentDate())&&SICheckUtil.dateLess(getShippmentDate(), storeDate)) hacchucheck2 = false;
          }
          SIDBUtil.close(lResultSet, lStatement);
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
      errors.addError(new SICustomError("database.execute.error"));
    }
    if (!datecheck) errors.addError(new SICustomError("input.data.order.initdatetime", "出荷日"));
    if (!datecheck2) errors.addError(new SICustomError("input.data.date.shippment.record2"));
    if (!statuscheck) errors.addError(new SICustomError("manager.message.error.shippment.badstatus"));
    if (!hacchucheck) errors.addError(new SICustomError("manager.message.freeword","発注消し込みが済んでいない商品は出荷日設定できません"));
    if (!hacchucheck2) errors.addError(new SICustomError("manager.message.freeword","発注日より前の日付で出荷日設定できません"));
    
    if (!errors.isEmpty()) lRequest.setAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY, errors);
    else lRequest.removeAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY);
    
    return errors.isEmpty();
  }
  
  /**
   * <b>validate</b> 入力したデータをチェックして、同時にSQLの条件文を作成します。
   * 
   * @param lRequest クライアントからのリクエスト
   * @return なし
   * @throws なし
   */
  public boolean validateArrivalPlan(HttpServletRequest lRequest, Connection lConnection) {
    SICustomErrors errors = new SICustomErrors();
    
    // チェックボックスのチェック
    if (this.getCheck() == null || this.getCheck().length == 0) {
      errors.addError(new SICustomError("input.data.checkbox.require", "到着予定日時設定"));
    }
    if (this.getCheck() != null && this.getCheck().length > 0) {// 7.1.1 ST0187 修正
      // 7.1.1 ST0187 修正 ここから
      boolean lResult = false;
      boolean lInvalid = false;
      boolean statuscheck = true;
      for (int i = 0; i < this.getCheck().length; i++) {
        int check = Integer.parseInt(this.getCheck()[i]);
        SIOrderDelivery delivery = new SIOrderDelivery(this.getOrderCodeHid()[check], this.getDeliveryCodeHid()[check]);
        delivery.reset(lConnection);
        if (SIUtil.isNotNull(delivery.getShippmentDate())) lResult = true;
        else lInvalid = true;
        if (!this.getStatusHid()[check].equals("1")) statuscheck = false;
      }
      if (!lResult) errors.addError(new SICustomError("manager.app.section.require", "出荷日設定済み", "設定"));
      else if (lInvalid) {// 部分だけの設定の場合に
        lRequest.setAttribute(SIConfig.SIMESSAGE_ATTRIBUTE_RESULT_NAME, SIErrorFactory.getErrorMsg("manager.message.success.section", "出荷日設定済み", "設定"));
      } else {// 全部設定の場合に
        lRequest.setAttribute(SIConfig.SIMESSAGE_ATTRIBUTE_RESULT_NAME, SIErrorFactory.getErrorMsg("manager.message.success.modify"));
      }
      if (!statuscheck) errors.addError(new SICustomError("manager.message.error.shippment.badstatus"));
      // 7.1.1 ST0187 修正 ここまで
    }
    
    if (!errors.isEmpty()) lRequest.setAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY, errors);
    else lRequest.removeAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY);
    
    return errors.isEmpty();
  }
  
  /**
   * <b>validate</b> 入力したデータをチェックして、同時にSQLの条件文を作成します。
   * 
   * @param lRequest クライアントからのリクエスト
   * @return なし
   * @throws なし
   */
  public boolean validatePDF(HttpServletRequest lRequest) {
    return validatePDF(lRequest, false);
  }
  
  public boolean validatePDF2(HttpServletRequest lRequest,Connection lConnection) {
    if(SIUtil.isNull(this.getStatementBranch())) return true;
    SICustomErrors  errors = (SICustomErrors)lRequest.getAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY);
    if (errors==null) errors = new SICustomErrors();
    if (!errors.isEmpty()) return false;
    
    boolean outputflg = false;
    String check2 = "";
    for (int i = 0; i < check.length; i++) {
      StringBuffer str = new StringBuffer();
      str.append("SELECT SUM(CASE WHEN CASE WHEN b.branchcode IS NULL THEN a.branchcode ELSE b.branchcode END = ");
      str.append(SIDBUtil.SQL2Str(this.statementBranch)).append(" THEN 1 ELSE 0 END) ");
      str.append("FROM orderlatestvw a,orderdetaillatestvw c ");
      str.append("LEFT OUTER JOIN orderallocationinfotbl b ");
      str.append("ON b.ordercode=c.ordercode AND b.individualcode=c.individualcode ");
      str.append("WHERE c.ordercode=").append(SIDBUtil.SQL2Str(this.orderCodeHid[Integer.parseInt(check[i])]," "));
      str.append("AND c.deliverycode=").append(SIDBUtil.SQL2Str(this.deliveryCodeHid[Integer.parseInt(check[i])]," "));
      str.append("AND c.detailcode=").append(SIDBUtil.SQL2Str(this.detailCodeHid[Integer.parseInt(check[i])]," "));
      str.append("AND a.ordercode=c.ordercode ");
      str.append("AND b.individualcode=c.individualcode ");
      try{
        String flg = SIDBUtil.getFirstData(lConnection, str.toString());
        if (!"0".equals(flg)){
          outputflg = true;
          if (SIUtil.isNull(check2)) check2 = check[i];
          else check2 = check2 + "," + check[i];
        }
      }catch(Exception e){
        e.printStackTrace();
      }
    }
    if (!outputflg){
      errors.addError(new SICustomError("input.data.checkbox.require", "帳票出力を"));
      lRequest.setAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY, errors);
    }else{
      this.setCheck(check2.split(","));
    }
    
    return errors.isEmpty();
  }
  
  public boolean validatePDF(HttpServletRequest lRequest, boolean badStatusFlg) {
    SICustomErrors errors = new SICustomErrors();
    // チェックボックスのチェック
    if (this.getCheck() == null || this.getCheck().length == 0) {
      errors.addError(new SICustomError("input.data.checkbox.require", "帳票出力を"));
    }
    
    boolean statuscheck = true;
    for (int i = 0; i < check.length; i++) {
      /*
       * if(shippmentDateHid[Integer.parseInt(check[i])].equals("")){ if(badStatusFlg&&!this.getStatusHid()[Integer.parseInt(check[i])].equals("1"));//返品キャンセル可＋返品キャンセルの場合は日付チェック無視
       * else{ errors.addError(new SICustomError("manager.app.arrivalplan.check","")); break; } }
       */
      if (!this.getStatusHid()[Integer.parseInt(check[i])].equals("1")) statuscheck = false;
    }
    if (!statuscheck && !badStatusFlg) errors.addError(new SICustomError("manager.message.error.shippment.badstatus"));
    
    if (this.getPdfType().equals(SIPDFConf.SIPDF_TYPE_ORDER) && SIUtil.isNotNull(this.getShippmentCheck())) {
      // 出荷日の整合性チェック
      if (SIUtil.isNotNull(getShippmentDate())) {
        SICheckValid.checkValid(errors, "出荷日設定", getShippmentDate(), SICheckDataConf.SICHECK_DATA_DATE_TYPE);
      }
      
      // 受注日＜＝出荷日
      boolean datecheck = true;
      try {
        if (SIUtil.isNotNull(getShippmentDate()) && SICheckUtil.isDate(getShippmentDate()) && this.getCheck() != null) {
          for (int i = 0; i < this.getCheck().length; i++) {
            int j = Integer.parseInt(this.getCheck()[i]);
            String time = this.getInitDateTimeHid()[j];
            if (SICheckUtil.dateLess(getShippmentDate(), time)) {
              datecheck = false;
            }
          }
        }
      } catch (Exception e) {
        datecheck = false;
      }
      if (!datecheck) errors.addError(new SICustomError("input.data.order.initdatetime", "出荷日"));
    } else if (this.getPdfType().equals(SIPDFConf.SIPDF_TYPE_DELIVERY)) {
      if (SIUtil.isNull(this.getDeliType())) errors.addError(new SICustomError("input.data.select.require", "宅配便伝票の種類"));// 7.1.1 ST0162 修正
    }
    
    if (!errors.isEmpty()) lRequest.setAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY, errors);
    else lRequest.removeAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY);
    
    return errors.isEmpty();
  }
  
  /**
   * <b>validate</b> 入力したデータをチェックして、同時にSQLの条件文を作成します。
   * 
   * @param lRequest クライアントからのリクエスト
   * @return なし
   * @throws なし
   */
  public boolean validateMail(HttpServletRequest lRequest, Connection lConnection) {
    SICustomErrors errors = new SICustomErrors();
    // チェックボックスのチェック
    if (this.getCheck() == null || this.getCheck().length == 0) {
      errors.addError(new SICustomError("input.data.checkbox.require", "出荷報告メールを送信"));
    }
    
    // 出荷日の整合性チェック
    if (SIUtil.isNotNull(getShippmentDate())) {
      SICheckValid.checkValid(errors, "出荷日設定", getShippmentDate(), SICheckDataConf.SICHECK_DATA_DATE_TYPE);
    }
    
    // 受注日＜＝出荷日
    boolean datecheck = true;
    boolean statuscheck = true;
    try {
      if (SIUtil.isNotNull(getShippmentDate()) && SICheckUtil.isDate(getShippmentDate()) && this.getCheck() != null) {
        for (int i = 0; i < this.getCheck().length; i++) {
          int j = Integer.parseInt(this.getCheck()[i]);
          String time = this.getInitDateTimeHid()[j];
          if (SICheckUtil.dateLess(getShippmentDate(), time)) {
            datecheck = false;
          }
          if (!this.getStatusHid()[j].equals("1")) statuscheck = false;
        }
      }
    } catch (Exception e) {
      datecheck = false;
    }
    if (!datecheck) errors.addError(new SICustomError("input.data.order.initdatetime", "出荷日"));
    if (!statuscheck) errors.addError(new SICustomError("manager.message.error.shippment.badstatus"));
    
    // 出荷日がNullのレコードがあって、出荷日が設定されていないときはメールを送信できない。
    boolean shippmentFlg = true;
    if (this.getCheck() != null && SIUtil.isNull(getShippmentDate())) {
      for (int i = 0; i < this.getCheck().length; i++) {
        // 受注配送先情報を取得
        int count = Integer.parseInt(this.getCheck()[i]);
        SIOrderDelivery delivery = new SIOrderDelivery(this.getOrderCodeHid()[count], this.getDeliveryCodeHid()[count]);
        delivery.reset(lConnection);
        if (SIUtil.isNull(delivery.getShippmentDate())) {
          shippmentFlg = false;
          break;
        }
      }
    }
    if (!shippmentFlg) {
      errors.addError(new SICustomError("manager.app.shippment.mail"));
    }
    
    if (!errors.isEmpty()) lRequest.setAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY, errors);
    else lRequest.removeAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY);
    
    return errors.isEmpty();
  }
  
  public boolean validateMail2(HttpServletRequest lRequest, Connection lConnection) {
    SICustomErrors errors = new SICustomErrors();
    SILogin manLogin = SIHTMLUtil.getLogin(lRequest);
    // チェックボックスのチェック
    if (this.getCheck() == null || this.getCheck().length == 0) {
      if (manLogin.getUserCode().equals(SPUSER7)){
        errors.addError(new SICustomError("input.data.checkbox.require", "出荷消込"));
      }else{
        errors.addError(new SICustomError("input.data.checkbox.require", "出荷完了メールを送信"));
      }
    }
    
    boolean statuscheck = true;
    if (SIUtil.isNotNull(getShippmentDate()) && SICheckUtil.isDate(getShippmentDate()) && this.getCheck() != null) {
      for (int i = 0; i < this.getCheck().length; i++) {
        int j = Integer.parseInt(this.getCheck()[i]);
        if (!this.getStatusHid()[j].equals("1")) statuscheck = false;
      }
    }
    if (!statuscheck) errors.addError(new SICustomError("manager.message.error.shippment.badstatus"));
    
    SICheckValid.checkValid(errors, "運送会社", getAgentName(), SICheckDataConf.SICHECK_DATA_EMPTY_TYPE);
    //SICheckValid.checkValid(errors, "運送会社送り状問合せNo", SIStringUtil.replace(getDeliveryNumber(), "\r\n", ""), SICheckDataConf.SICHECK_DATA_ALPHA_DIGIT_TYPE);
    
    if (!errors.isEmpty()) lRequest.setAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY, errors);
    else lRequest.removeAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY);
    
    return errors.isEmpty();
  }
  
  /**
   * <b>makeOrderBySQL</b> 並び順文の作成
   * 
   * @param なし
   * @return なし
   * @throws なし
   */
  public void makeOrderBySQL() {
    int def = 0;
    
    // 第一の並び順
    try {
      def = Integer.parseInt(getFirstOrderTxt());
    } catch (Exception e) {
      def = 0;
    }
    this.setFirstOrderTxt(String.valueOf(def));
    this.setOrderBySQL(" ORDER BY " + this.firstOrderSel + " " + SIConfig.SIORDER_NAME[def] + ",OrderCode DESC ,DeliveryCode ASC,DetailCode ASC");
  }
  
  public static Collection getDeliveryTypeColl() {
    Collection lResultColl = new ArrayList();
    lResultColl.add(new SINameValue("佐川(元払)", SIConfig.SIDELIVERY_PDF_TYPE_SAGAWA_MOTO));
    lResultColl.add(new SINameValue("ヤマト(発払)", SIConfig.SIDELIVERY_PDF_TYPE_YAMATO_HATU));
    lResultColl.add(new SINameValue("ヤマト(着払)", SIConfig.SIDELIVERY_PDF_TYPE_YAMATO_TYAKU));
    return lResultColl;
  }
  
  public static Collection getArrivalPlanColl(String shippmentDate) {
    Collection lResultColl = new ArrayList();
    if (SIUtil.isNull(shippmentDate)) return lResultColl;
    try {
      SIDateTime date = new SIDateTime(shippmentDate, "yyyy/MM/dd");
      lResultColl.add(new SINameValue(date.getFullDate(), date.getFullDate()));
      for (int i = 0; i < 20; i++) {
        date.addDay(1);
        lResultColl.add(new SINameValue(date.getFullDate(), date.getFullDate()));
      }
    } catch (ParseException e) {
      lResultColl = new ArrayList();
    }
    return lResultColl;
  }
  
  /**
   * <b>getBranchCollection</b> 条件に合ったレコードを検索して、結果のコネクションを作成して、戻します。
   * 
   * @param lConnection データベースへの接続コネクション
   * @return レコードのセット
   * @throws SIDBAccessException
   */
  public Collection getBranchCollection(Connection lConnection) throws SIDBAccessException {
    StringBuffer lSqlBuf = new StringBuffer();
    
    // 基本のSQL
    lSqlBuf.append("SELECT BranchName,BranchCode FROM branchtbl a ");
    lSqlBuf.append("WHERE EXISTS (SELECT * FROM CHARGETBL b ");
    lSqlBuf.append("WHERE a.branchcode = b.belongingbranchcode) ");
    
    // 昇順に並べ替え
    lSqlBuf.append("ORDER BY BranchCode ASC");
    
    log.debug("getCollection:lSqlBuf=" + lSqlBuf.toString());
    
    Collection lResultColl = new ArrayList();
    try {
      lResultColl = SIDBUtil.getCollection(lConnection, lSqlBuf.toString());
    } catch (SIDBAccessException e) {
      e.printStackTrace();
    }
    return lResultColl;
  }
  
  /**
   * <b>getChargeCollection</b> 条件に合ったレコードを検索して、結果のコネクションを作成して、戻します。
   * 
   * @param lConnection データベースへの接続コネクション
   * @param branchCode 支店コード
   * @return レコードのセット
   * @throws SIDBAccessException
   */
  public Collection getChargeCollection(Connection lConnection, String branchCode) throws SIDBAccessException {
    StringBuffer lSqlBuf = new StringBuffer();
    
    // 基本のSQL
    lSqlBuf.append("SELECT ChargeName, ChargeCode ");
    lSqlBuf.append("FROM ChargeTbl ");
    if (SIUtil.isNotNull(branchCode)) {
      lSqlBuf.append("WHERE BelongingBranchCode = ").append(SIDBUtil.SQL2Str(branchCode));
    }
    
    // 昇順に並べ替え
    lSqlBuf.append(" ORDER BY ChargeCode ASC");
    
    log.debug("getCollection:lSqlBuf=" + lSqlBuf.toString());
    
    Collection lResultColl = new ArrayList();
    
    try {
      lResultColl = SIDBUtil.getCollection(lConnection, lSqlBuf.toString());
    } catch (SIDBAccessException e) {
      e.printStackTrace();
    }
    return lResultColl;
  }
  
  public static Collection getShipHistoryColl(Connection lConnection, String lOrderCode, String lDeliveryCode, String lDetailCode) {
    Statement lStatement = null;
    ResultSet lResultSet = null;
    Collection lResultColl = new ArrayList();
    String taxRate = SITax.getTaxRate(lConnection);
    
    StringBuffer lSqlBuf = new StringBuffer();
    
    // 在庫管理する商品の場合：最新の商品マスタの仕入れ価格
    // 在庫管理しない商品の場合：受注明細の仕入れ価格維持
    lSqlBuf.append("SELECT a.cmdtycode,a.individualcode,CASE WHEN d.branchcode IS NULL THEN b.purchaseprice ELSE a.purchaseprice END AS purchaseprice,a.processingexpence, ");
    lSqlBuf.append("c.chargecode,d.branchcode,d.orderallocationnumber,CASE WHEN d.branchcode IS NULL THEN c.taxrate ELSE tax(current_date) END AS taxrate ");
    lSqlBuf.append("FROM individualtbl a,orderdetailtbl b LEFT OUTER JOIN orderallocationinfotbl d ");
    lSqlBuf.append("ON (b.ordercode=d.ordercode AND b.detailcode=d.detailcode AND b.cmdtycode=d.cmdtycode AND b.individualcode=d.individualcode), ");
    lSqlBuf.append("ordertbl c ");
    lSqlBuf.append("WHERE b.ordercode=").append(SIDBUtil.SQL2Str(lOrderCode, " "));
    lSqlBuf.append("AND b.deliverycode=").append(SIDBUtil.SQL2Str(lDeliveryCode, " "));
    lSqlBuf.append("AND b.detailcode=").append(SIDBUtil.SQL2Str(lDetailCode, " "));
    lSqlBuf.append("AND b.ordercode=c.ordercode ");
    lSqlBuf.append("AND b.cmdtycode=a.cmdtycode ");
    lSqlBuf.append("AND b.individualcode=a.individualcode ");
    lSqlBuf.append("AND c.enabledflg='1' AND b.orderbranchcode=c.orderbranchcode ");
    
    try {
      lStatement = lConnection.createStatement();
      lResultSet = lStatement.executeQuery(lSqlBuf.toString());
      
      while (lResultSet.next()) {
        UIStockHistory lData = new UIStockHistory();
        String targetRate = lResultSet.getString("taxRate");
        lData.setCmdtyCode(lResultSet.getString("cmdtycode"));
        lData.setIndividualCode(lResultSet.getString("individualcode"));
        lData.setNewBranch(lResultSet.getString("branchcode"));
        lData.setNewCharge(lResultSet.getString("chargecode"));
        lData.setNewAmount(lResultSet.getString("orderallocationnumber"));
        if(!taxRate.equals(targetRate)){
          if (SIUtil.isNull(lResultSet.getString("purchaseprice"))) {
            lData.setPurchasePrice("0");
          } else {
            String pp = SIUtil.div_LD(lResultSet.getString("purchaseprice"), SIUtil.add_DL(SIUtil.div_DL(targetRate, "100"), "1"));
            lData.setPurchasePrice(String.valueOf(Math.ceil(Math.floor(Double.parseDouble(pp) * Double.parseDouble(SIUtil.add_DL(SIUtil.div_DL(taxRate, "100"), "1")) * 10000) / 10000)));
          }
          if (SIUtil.isNull(lResultSet.getString("processingexpence"))) {
            lData.setProcessingExpence("0");
          } else {
            String pe = SIUtil.div_LD(lResultSet.getString("processingexpence"), SIUtil.add_DL(SIUtil.div_DL(targetRate, "100"), "1"));
            lData.setProcessingExpence(String.valueOf(Math.ceil(Math.floor(Double.parseDouble(pe) * Double.parseDouble(SIUtil.add_DL(SIUtil.div_DL(taxRate, "100"), "1")) * 10000) / 10000)));
          }
        }else{
          if (SIUtil.isNull(lResultSet.getString("purchaseprice"))) lData.setPurchasePrice("0");
          else lData.setPurchasePrice(lResultSet.getString("purchaseprice"));
          if (SIUtil.isNull(lResultSet.getString("processingexpence"))) lData.setProcessingExpence("0");
          else lData.setProcessingExpence(lResultSet.getString("processingexpence"));
        }
        if (SIUtil.isNull(lResultSet.getString("branchcode"))) lData.setType("0");// 引当情報がない場合
        else lData.setType("1");
        lResultColl.add(lData);
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      SIDBUtil.close(lStatement,lResultSet);
    }
    return lResultColl;
  }
  
  public static Collection getShipDeleteColl(Connection lConnection, String lOrderCode, String lDeliveryCode, String lDetailCode) {
    Statement lStatement = null;
    ResultSet lResultSet = null;
    Collection lResultColl = new ArrayList();
    
    StringBuffer lSqlBuf = new StringBuffer();
    
    lSqlBuf.append("SELECT a.* FROM shiphistorytbl AS a,orderdetaillatestvw AS b ");
    lSqlBuf.append("WHERE b.ordercode=").append(SIDBUtil.SQL2Str(lOrderCode, " "));
    lSqlBuf.append("AND b.deliverycode=").append(SIDBUtil.SQL2Str(lDeliveryCode, " "));
    lSqlBuf.append("AND b.detailcode=").append(SIDBUtil.SQL2Str(lDetailCode, " "));
    lSqlBuf.append("AND a.ordercode=b.ordercode ");
    lSqlBuf.append("AND a.cmdtycode=b.cmdtycode ");
    lSqlBuf.append("AND a.individualcode=b.individualcode ");
    lSqlBuf.append("AND a.comment='受注'||b.ordercode||'-'||b.deliverycode||'-'||b.detailcode ");
    lSqlBuf.append("AND a.delflg='1' ");
    
    try {
      lStatement = lConnection.createStatement();
      lResultSet = lStatement.executeQuery(lSqlBuf.toString());
      
      while (lResultSet.next()) {
        UIStockHistory lData = new UIStockHistory();
        lData.setCmdtyCode(lResultSet.getString("cmdtycode"));
        lData.setIndividualCode(lResultSet.getString("individualcode"));
        lData.setDeleteNo(lResultSet.getString("shipnumber"));
        lData.setNewBranch(lResultSet.getString("shipbranch"));
        lData.setNewCharge(lResultSet.getString("shipcharge"));
        lData.setNewAmount(lResultSet.getString("amount"));
        lData.setPurchasePrice(lResultSet.getString("purchaseprice"));
        lData.setProcessingExpence(lResultSet.getString("processingexpence"));
        lData.setType(lResultSet.getString("shiptype"));
        lData.setInitDateTime(lResultSet.getString("initdatetime"));
        lResultColl.add(lData);
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      SIDBUtil.close(lStatement, lResultSet);
    }
    return lResultColl;
  }
  
  public static Collection getStoreDeleteColl(Connection lConnection, String lOrderCode, String lDeliveryCode, String lDetailCode) {
    Statement lStatement = null;
    ResultSet lResultSet = null;
    Collection lResultColl = new ArrayList();
    
    StringBuffer lSqlBuf = new StringBuffer();
    
    lSqlBuf.append("SELECT a.* FROM storehistorytbl AS a,orderdetaillatestvw AS b ");
    lSqlBuf.append("WHERE b.ordercode=").append(SIDBUtil.SQL2Str(lOrderCode, " "));
    lSqlBuf.append("AND b.deliverycode=").append(SIDBUtil.SQL2Str(lDeliveryCode, " "));
    lSqlBuf.append("AND b.detailcode=").append(SIDBUtil.SQL2Str(lDetailCode, " "));
    lSqlBuf.append("AND a.ordercode=b.ordercode ");
    lSqlBuf.append("AND a.cmdtycode=b.cmdtycode ");
    lSqlBuf.append("AND a.individualcode=b.individualcode ");
    lSqlBuf.append("AND a.delflg='1' ");
    
    try {
      lStatement = lConnection.createStatement();
      lResultSet = lStatement.executeQuery(lSqlBuf.toString());
      
      while (lResultSet.next()) {
        UIStockHistory lData = new UIStockHistory();
        lData.setCmdtyCode(lResultSet.getString("cmdtycode"));
        lData.setIndividualCode(lResultSet.getString("individualcode"));
        lData.setDeleteNo(lResultSet.getString("storenumber"));
        lData.setNewBranch(lResultSet.getString("storebranch"));
        lData.setNewCharge(lResultSet.getString("storecharge"));
        lData.setNewAmount(lResultSet.getString("amount"));
        lData.setPurchasePrice(lResultSet.getString("purchaseprice"));
        lData.setProcessingExpence(lResultSet.getString("processingexpence"));
        lData.setType(lResultSet.getString("storetype"));
        lData.setInitDateTime(lResultSet.getString("initdatetime"));
        lResultColl.add(lData);
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      SIDBUtil.close(lStatement, lResultSet);
    }
    return lResultColl;
  }
}