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

import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;

import jp.co.sint.beans.mallmgr.UIOrderBasic;
import jp.co.sint.config.SIConfig;
import jp.co.sint.config.SIFlagConf;
import jp.co.sint.tools.SIDateTime;
import jp.co.sint.tools.SIUtil;

import org.apache.log4j.Category;

/**
 * @version $Id: SIOrder.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 10:49:52  Original
 */
public class SIOrderTbl extends UIOrderBasic{
  //ƒƒO—p‚ÌƒCƒ“ƒXƒ^ƒ“ƒX‚Ì¶¬
  private static Category log=Category.getInstance(SIConfig.SILOG4J_WEBSHOP_CATEGORY_NAME);
  
  //Žó’”z‘—æƒe[ƒuƒ‹
  private Collection orderDeliveryTbl = new ArrayList();
  
  //Žó’”Ô†
  private String orderCode="";
  
  //ŒÚ‹qƒR[ƒh
  private String custCode="";
  
  //–@lƒtƒ‰ƒO
  private String custCompanyFlg="0";
  
  //ŒÚ‹q–¼
  private String custName="";
  
  //ŒÚ‹q–¼ƒJƒi
  private String custPronName="";
  
  //EMAIL
  private String email="";
  
  //¿‹‘ˆ¶–¼
  private String orderAddressee="";
  
  //—X•Ö”Ô†1
  private String postCode1="";
  
  //—X•Ö”Ô†2
  private String postCode2="";
  
  //¿‹‘ZŠ1
  private String address1="";
  
  //¿‹‘ZŠ2
  private String address2="";
  
  //¿‹‘ZŠ3
  private String address3="";
  
  //‰ïŽÐ–¼
  private String companyName="";
  
  //“d˜b”Ô†
  private String tel="";
  
  //FAX”Ô†
  private String fax="";
  
  //Žx•¥•û–@–¼Ì
  private String payMethodName="";
  
  //Žó’“úŽž
  private String initDateTime="";
  
  //C³“úŽž
  private String updateDateTime="";
  
  //æŒã•¥‚¢ƒtƒ‰ƒO
  private String paymentFlg="0";
  
  //Žè”—¿(•K{)
  private String fee="0";
  
  //Žè”—¿Á”ïÅƒtƒ‰ƒO
  private String feeTaxFlg="";
  
  //Å—¦
  private String taxRate="0";
  
  //“ü‹à“ú
  private String receiptDate="";
  
  //“ü‹à“ú‚Ì”N
  private String receiptDateYear="";
  
  //“ü‹à“ú‚ÌŒŽ
  private String receiptDateMonth="";
  
  //“ü‹à“ú‚Ì“ú
  private String receiptDateDay="";
  
  //’lˆø‚«‡Œv
  private String sumOfDiscount="0";
  
  //ƒ|ƒCƒ“ƒgŽg—pŠz
  private String sumByPoint="0";
  
  //ƒ[ƒ‹‘—Mƒtƒ‰ƒO
  private String sendMailFlg="0";
  
  //ƒXƒe[ƒ^ƒX
  private String status="0";
  
  //˜A—Ž–€
  private String contactMsg="";
  
  //”õl
  private String memo="";
  
  //Žè”—¿(Åž‚Ý)
  private String feeInTax = "0";
  
  //¤•i‡Œv‰¿Ši
  private String itemTotalPrice="0";
  
  //‘——¿‡Œv‹àŠz
  private String deliveryTotalPrice="0";
  
  //ƒ|ƒCƒ“ƒgŽg—p‰Â”\‹àŠz
  private String payPointPrice="0";
  
  //‚¨Žx•¥‚¢‡ŒvŠz
  private String totalPrice="0";
  
  public SIOrderTbl(){}
  
  //setter of ”z‘—æî•ñ
  public void setOrderDeliveryTbl(Collection lOrderDeliveryTbl){
    this.orderDeliveryTbl = lOrderDeliveryTbl;
  }
  
  //setter of Žó’”Ô†
  public void setOrderCode(String lOrderCode){
    if (SIUtil.isNull(lOrderCode)) lOrderCode="";
    this.orderCode=SIUtil.changeTo(lOrderCode.trim(),this.encode);
  }
  
  //setter of ŒÚ‹qƒR[ƒh
  public void setCustCode(String lCustCode){
    if (SIUtil.isNull(lCustCode)) lCustCode="";
    this.custCode=SIUtil.changeTo(lCustCode.trim(),this.encode);
  }
  
  //setter of –@lƒtƒ‰ƒO
  public void setCustCompanyFlg(String lCustCompanyFlg){
    if (SIUtil.isNull(lCustCompanyFlg)) lCustCompanyFlg="0";
    this.custCompanyFlg=SIUtil.changeTo(lCustCompanyFlg.trim(),this.encode);
  }
  
  //setter of ŒÚ‹q–¼
  public void setCustName(String lCustName){
    if (SIUtil.isNull(lCustName)) lCustName="";
    this.custName=SIUtil.changeTo(lCustName.trim(),this.encode);
  }
  
  //setter of ŒÚ‹q–¼ƒJƒi
  public void setCustPronName(String lCustPronName){
    if (SIUtil.isNull(lCustPronName)) lCustPronName="";
    this.custPronName=SIUtil.changeTo(lCustPronName.trim(),this.encode);
  }
  
  //setter of EMAIL
  public void setEmail(String lEmail){
    if (SIUtil.isNull(lEmail)) lEmail="";
    this.email=SIUtil.changeTo(lEmail.trim(),this.encode);
  }
  
  //setter of ¿‹‘ˆ¶–¼
  public void setOrderAddressee(String lOrderAddressee){
    if (SIUtil.isNull(lOrderAddressee)) lOrderAddressee="";
    this.orderAddressee=SIUtil.changeTo(lOrderAddressee.trim(),this.encode);
  }
  
  //setter of —X•Ö”Ô†1
  public void setPostCode1(String lPostCode1){
    if (SIUtil.isNull(lPostCode1)) lPostCode1="";
    this.postCode1=SIUtil.changeTo(lPostCode1.trim(),this.encode);
  }
  
  //setter of —X•Ö”Ô†2
  public void setPostCode2(String lPostCode2){
    if (SIUtil.isNull(lPostCode2)) lPostCode2="";
    this.postCode2=SIUtil.changeTo(lPostCode2.trim(),this.encode);
  }
  
  //setter of ¿‹‘ZŠ1
  public void setAddress1(String lAddress1){
    if (SIUtil.isNull(lAddress1)) lAddress1="";
    this.address1=SIUtil.changeTo(lAddress1.trim(),this.encode);
  }
  
  //setter of ¿‹‘ZŠ2
  public void setAddress2(String lAddress2){
    if (SIUtil.isNull(lAddress2)) lAddress2="";
    this.address2=SIUtil.changeTo(lAddress2.trim(),this.encode);
  }
  
  //setter of ¿‹‘ZŠ3
  public void setAddress3(String lAddress3){
    if (SIUtil.isNull(lAddress3)) lAddress3="";
    this.address3=SIUtil.changeTo(lAddress3.trim(),this.encode);
  }
  
  //setter of ‰ïŽÐ–¼
  public void setCompanyName(String lCompanyName){
    if (SIUtil.isNull(lCompanyName)) lCompanyName="";
    this.companyName=SIUtil.changeTo(lCompanyName.trim(),this.encode);
  }
  
  //setter of “d˜b”Ô†
  public void setTel(String lTel){
    if (SIUtil.isNull(lTel)) lTel="";
    this.tel=SIUtil.changeTo(lTel.trim(),this.encode);
  }
  
  //setter of FAX”Ô†
  public void setFax(String lFax){
    if (SIUtil.isNull(lFax)) lFax="";
    this.fax=SIUtil.changeTo(lFax.trim(),this.encode);
  }
  
  //setter of Žx•¥•û–@–¼Ì
  public void setPayMethodName(String lPayMethodName){
    if (SIUtil.isNull(lPayMethodName)) lPayMethodName="";
    this.payMethodName=SIUtil.changeTo(lPayMethodName.trim(),this.encode);
  }
  
  //setter of Žó’“úŽž
  public void setInitDateTime(String lInitDateTime){
    if (SIUtil.isNull(lInitDateTime)) lInitDateTime="";
    this.initDateTime=SIUtil.changeTo(lInitDateTime.trim(),this.encode);
  }
  
  //setter of C³“úŽž
  public void setUpdateDateTime(String lUpdateDateTime){
    if (SIUtil.isNull(lUpdateDateTime)) lUpdateDateTime="";
    this.updateDateTime=SIUtil.changeTo(lUpdateDateTime.trim(),this.encode);
  }
  
  //setter of æŒã•¥‚¢ƒtƒ‰ƒO
  public void setPaymentFlg(String lPaymentFlg){
    if (SIUtil.isNull(lPaymentFlg)) lPaymentFlg="0";
    this.paymentFlg=SIUtil.changeTo(lPaymentFlg.trim(),this.encode);
  }
  
  //setter of Žè”—¿(•K{)
  public void setFee(String lFee){
    if (SIUtil.isNull(lFee)) lFee="0";
    this.fee=SIUtil.changeTo(lFee.trim(),this.encode);
  }
  
  //setter of Žè”—¿Á”ïÅ‹æ•ª
  public void setFeeTaxFlg(String lFeeTaxFlg){
    if (SIUtil.isNull(lFeeTaxFlg)) lFeeTaxFlg="";
    this.feeTaxFlg=SIUtil.changeTo(lFeeTaxFlg.trim(),this.encode);
  }
  
  //setter of Å—¦
  public void setTaxRate(String lTaxRate){
    if (SIUtil.isNull(lTaxRate)) lTaxRate="0";
    this.taxRate=SIUtil.changeTo(lTaxRate.trim(),this.encode);
  }
  
  //setter of “ü‹à“ú
  public void setReceiptDate(String lYear,String lMonth,String lDay){
    this.setReceiptDateYear(lYear);
    this.setReceiptDateMonth(lMonth);
    this.setReceiptDateDay(lDay);
  }
  
  //setter of “ü‹à“ú
  public void setReceiptDate(String lReceiptDate){
    if (SIUtil.isNull(lReceiptDate)) lReceiptDate="";
    else{
      try {
        SIDateTime lDateTime=new SIDateTime(lReceiptDate,SIConfig.SIDATE_FORMAT);
        setReceiptDate(lDateTime.getYearStr(),lDateTime.getMonthStr(),lDateTime.getDayStr());
      } catch (ParseException e) {
        e.printStackTrace();
      }
    }
    this.receiptDate=lReceiptDate;
  }
  
  //setter of “ü‹à“ú‚Ì”N
  public void setReceiptDateYear(String lReceiptDateYear){
    if (SIUtil.isNull(lReceiptDateYear)) this.receiptDateYear="";
    else this.receiptDateYear=lReceiptDateYear;
  }
  
  //setter of “ü‹à“ú‚ÌŒŽ
  public void setReceiptDateMonth(String lReceiptDateMonth){
    if (SIUtil.isNull(lReceiptDateMonth)) this.receiptDateMonth="";
    else this.receiptDateMonth=lReceiptDateMonth;
  }
  
  //setter of “ü‹à“ú‚Ì“ú
  public void setReceiptDateDay(String lReceiptDateDay){
    if (SIUtil.isNull(lReceiptDateDay)) this.receiptDateDay="";
    else this.receiptDateDay=lReceiptDateDay;
  }
  
  //setter of ’lˆø‚«‡Œv
  public void setSumOfDiscount(String lSumOfDiscount){
    if (SIUtil.isNull(lSumOfDiscount)) lSumOfDiscount="0";
    this.sumOfDiscount=SIUtil.changeTo(lSumOfDiscount.trim(),this.encode);
  }
  
  //setter of ƒ|ƒCƒ“ƒgŽg—pŠz
  public void setSumByPoint(String lSumByPoint){
    if (SIUtil.isNull(lSumByPoint)) lSumByPoint="0";
    this.sumByPoint=SIUtil.changeTo(lSumByPoint.trim(),this.encode);
  }
  
  //setter of ƒ[ƒ‹‘—Mƒtƒ‰ƒO
  public void setSendMailFlg(String lSendMailFlg){
    if (SIUtil.isNull(lSendMailFlg)) lSendMailFlg="0";
    this.sendMailFlg=SIUtil.changeTo(lSendMailFlg.trim(),this.encode);
  }
  
  //setter of ƒXƒe[ƒ^ƒX
  public void setStatus(String lStatus){
    if (SIUtil.isNull(lStatus)) lStatus="0";
    this.status=SIUtil.changeTo(lStatus.trim(),this.encode);
  }
  
  //setter of ˜A—Ž–€
  public void setContactMsg(String lContactMsg){
    if (SIUtil.isNull(lContactMsg)) lContactMsg="";
    this.contactMsg=SIUtil.changeTo(lContactMsg.trim(),this.encode);
  }
  
  //setter of ”õl
  public void setMemo(String lMemo){
    if (SIUtil.isNull(lMemo)) lMemo="";
    this.memo=SIUtil.changeTo(lMemo.trim(),this.encode);
  }
  
  //setter of Žè”—¿(Åž‚Ý)
  public void setFeeInTax(String FeeInTax){
    if (SIUtil.isNull(FeeInTax)) FeeInTax="0";
    this.feeInTax=SIUtil.changeTo(FeeInTax.trim(),this.encode);
  }
  
  //setter of ¤•i‡Œv‰¿Ši
  public void setItemTotalPrice(String lItemTotalPrice){
    if (SIUtil.isNull(lItemTotalPrice)) lItemTotalPrice="0";
    this.itemTotalPrice=SIUtil.changeTo(lItemTotalPrice.trim(),this.encode);
  }
  
  //setter of ‘——¿‡Œv‹àŠz
  public void setDeliveryTotalPrice(String lDeliveryTotalPrice){
    if (SIUtil.isNull(lDeliveryTotalPrice)) lDeliveryTotalPrice="0";
    this.deliveryTotalPrice=SIUtil.changeTo(lDeliveryTotalPrice.trim(),this.encode);
  }
  
  //setter of ƒ|ƒCƒ“ƒgŽg—p‰Â”\‹àŠz
  public void setPayPointPrice(String lPayPointPrice){
    if (SIUtil.isNull(lPayPointPrice)) lPayPointPrice="0";
    this.payPointPrice=SIUtil.changeTo(lPayPointPrice.trim(),this.encode);
  }
  
  //setter of ‚¨Žx•¥‚¢‡ŒvŠz
  public void setTotalPrice(String lTotalPrice){
    if (SIUtil.isNull(lTotalPrice)) lTotalPrice="0";
    this.totalPrice=SIUtil.changeTo(lTotalPrice.trim(),this.encode);
  }
  
  //getter of ”z‘—æî•ñ
  public Collection getOrderDeliveryTbl(){
    return this.orderDeliveryTbl;
  }
  
  //getter of Žó’”Ô†
  public String getOrderCode(){
    return this.orderCode;
  }
  
  //getter of ŒÚ‹qƒR[ƒh
  public String getCustCode(){
    return this.custCode;
  }
  
  //getter of –@lƒtƒ‰ƒO
  public String getCustCompanyFlg(){
    return this.custCompanyFlg;
  }
  
  //getter of ŒÚ‹q–¼
  public String getCustName(){
    return this.custName;
  }
  
  //getter of ŒÚ‹q–¼ƒJƒi
  public String getCustPronName(){
    return this.custPronName;
  }
  
  //getter of EMAIL
  public String getEmail(){
    return this.email;
  }
  
  //getter of ¿‹‘ˆ¶–¼
  public String getOrderAddressee(){
    return this.orderAddressee;
  }
  
  //getter of —X•Ö”Ô†1
  public String getPostCode1(){
    return this.postCode1;
  }
  
  //getter of —X•Ö”Ô†2
  public String getPostCode2(){
    return this.postCode2;
  }
  
  //getter of —X•Ö”Ô†
  public String getPostCode(){
    if (SIUtil.isNotNull(getPostCode1())&&SIUtil.isNotNull(getPostCode2())){
      return getPostCode1()+"-"+getPostCode2();
    }else if (SIUtil.isNotNull(getPostCode1())||SIUtil.isNotNull(getPostCode2())){
      return getPostCode1()+getPostCode2();
    }else return "";
  }
  
  //getter of ¿‹‘ZŠ1
  public String getAddress1(){
    return this.address1;
  }
  
  //getter of ¿‹‘ZŠ2
  public String getAddress2(){
    return this.address2;
  }
  
  //getter of ¿‹‘ZŠ3
  public String getAddress3(){
    return this.address3;
  }
  
  //getter of ¿‹‘ZŠ
  public String getAddress(){
    return this.getAddress1() + this.getAddress2() + this.getAddress3();
  }
  
  //getter of ‰ïŽÐ–¼
  public String getCompanyName(){
    return this.companyName;
  }
  
  //getter of “d˜b”Ô†
  public String getTel(){
    return this.tel;
  }
  
  //getter of FAX”Ô†
  public String getFax(){
    return this.fax;
  }
  
  //getter of Žx•¥•û–@–¼Ì
  public String getPayMethodName(){
    return this.payMethodName;
  }
  
  //getter of Žó’“úŽž
  public String getInitDateTime(){
    return this.initDateTime;
  }
  
  //getter of C³“úŽž
  public String getUpdateDateTime(){
    return this.updateDateTime;
  }
  
  //getter of æŒã•¥‚¢ƒtƒ‰ƒO
  public String getPaymentFlg(){
    return this.paymentFlg;
  }
  
  //getter of Žè”—¿(Å•Ê)
  public String getFee(){
    return this.fee;
  }
  
  //getter of Žè”—¿Á”ïÅ‹æ•ª
  public String getFeeTaxFlg(){
    return this.feeTaxFlg;
  }
  
  //getter of Å—¦
  public String getTaxRate(){
    return this.taxRate;
  }
  
  //getter of “ü‹à“ú
  public String getReceiptDate(){
    return SIDateTime.getDate(getReceiptDateYear(),getReceiptDateMonth(),getReceiptDateDay());
  }
  
  public String getReceiptDateYear(){
    return this.receiptDateYear;
  }
  
  public String getReceiptDateMonth(){
    return this.receiptDateMonth;
  }
  
  public String getReceiptDateDay(){
    return this.receiptDateDay;
  }
  
  //getter of ’lˆø‚«‡Œv
  public String getSumOfDiscount(){
    return this.sumOfDiscount;
  }
  
  //getter of ƒ|ƒCƒ“ƒgŽg—pŠz
  public String getSumByPoint(){
    return this.sumByPoint;
  }
  
  //getter of ƒ[ƒ‹‘—Mƒtƒ‰ƒO
  public String getSendMailFlg(){
    return this.sendMailFlg;
  }
  
  //getter of ƒXƒe[ƒ^ƒX
  public String getStatus(){
    return this.status;
  }
  
  //getter of ˜A—Ž–€
  public String getContactMsg(){
    return this.contactMsg;
  }
  
  //getter of ”õl
  public String getMemo(){
    return this.memo;
  }
  
  //getter of Žè”—¿(Åž‚Ý)
  public String getFeeInTax(){
    return this.feeInTax;
  }
  
  public String getFeeTaxName(){
    if (getFeeTaxFlg().equals("0")) return "("+SIFlagConf.SIFLAG_TAX_0 +")";
    else if (getFeeTaxFlg().equals("1")) return "("+SIFlagConf.SIFLAG_TAX_1 +")";
    else if (getFeeTaxFlg().equals("2")) return "("+SIFlagConf.SIFLAG_TAX_2 +")";
    else return "";
  }
  
  //getter of ¤•i‡Œv‰¿Ši
  public String getItemTotalPrice(){
    return this.itemTotalPrice;
  }
  
  //getter of ‘——¿‡Œv‹àŠz
  public String getDeliveryTotalPrice(){
    return this.deliveryTotalPrice;
  }
  
  //getter of ƒ|ƒCƒ“ƒgŽg—p‰Â”\‹àŠz
  public String getPayPointPrice(){
    return this.payPointPrice;
  }
  
  //getter of ‚¨Žx•¥‚¢‡ŒvŠz
  public String getTotalPrice(){
    return this.totalPrice;
  }
}