<?php
/**
 * @copyright ONE/DEPO Project
 * @license   PHP License 3.01 <http://www.php.net/license/3_01.txt>
 */


/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * 商品マスタメンテ在庫確認
 *
 * @package     Admin.Itemmanage.Change.Stock.Check
 * @author      H.Watanabe <hiroshi.watanabe@netnee.jp>
 * @access      public
 */
class Admin_Itemmanage_Change_Stock_Insert_Check
{
    var $itemupdate;
    var $name;
    var $view;
    var $stockview;
    var $div;

    var $cd;
    var $structcd;
    var $stockcd;

    var $from;

    var $itemdiv;
    var $jancode;
    var $hinban;
    var $itemtitle;
    var $release_date_start;
    var $release_date_end;
    var $publish_date_start;
    var $publish_date_end;
    var $maker_capital;
    var $maker_name;
    var $media;
    var $cast;
    var $situation;
    var $photo_situation;
    var $publish_situation;
    var $sort;
    var $genre_select;

    var $updcnt;
    var $actionnm;

    var $itemnm;
    var $makeritemcd;
    var $medianm;
    var $makerprice;

    var $sellingprice;
    var $costprice;
    var $souryouprc;
    var $supplidiv;
    var $stocktitlecdcont;
    var $condition;

    var $stockstate;
    var $itemexp;

    var $stocktype;
    var $fromlist_salestartdate;
    var $fromlist_orderclosedate;

    /**
     * execute
     *
     * @access  public
     */
    function execute()
    {

        $log =& LogFactory::getLog();
        $log->debug("Admin_Itemmanage_Change_Stock_Checkが実行されました", "Admin_Itemmanage_Change_Stock_Check#execute");

        $div = (empty($this->div)) ? 2 : 1;

        return 'check_success';
    }


    /**
    * マスタより Name取得
    */
    function getSupplidivName()
    {
        return $this->itemupdate->getSupplidivName($this->supplidiv);
    }

    function getConditionName()
    {
        return $this->itemupdate->getConditionName($this->condition);
    }

    function getStockstateName()
    {
        return $this->itemupdate->getStockstateName($this->stockstate);
    }


    /**
    * マスタより エラー用リスト取得
    */
    function SupplidivList()
    {
        return $this->itemupdate->SupplidivList();
    }

    function ConditionList()
    {
        return $this->itemupdate->ConditionList();
    }

    function StockstateList()
    {
        $today = date("Y-m-d");

   if($this->fromlist_salestartdate and $this->fromlist_orderclosedate){
        if($this->fromlist_salestartdate <= $today or $this->fromlist_orderclosedate <= $today){
         $case = "1";
        }else{
        $case  = $this->stocktype;
          if(!$case) $case = 5;
        }
   }

   if(!$this->fromlist_orderclosedate)
        if($this->fromlist_salestartdate <= $today){
         $case = "1";
        }else{
        $case  = $this->stocktype;
           if(!$case) $case = 5;
        }

        // 発売日がNULL
        if (!$this->fromlist_salestartdate) {
            $case = "3";
        }

        return $this->itemupdate->StockstateListbyCase($case );
    }


}
?>
