<?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.Order.Complete
 * @author      T.Shimano <shimano@fuco.jp>
 * @access      public
 */
class Admin_Itemmanage_Delivery_Complete
{
    //検索条件
    var $suppliercode;
    var $suppliermode;
    var $deliverydatefrom;
    var $deliverydateto;
    var $ordernumber;
    var $jancode;

    //チェック・品目コード・構成コード
    var $itemcd;
    var $structcd;
    var $stocktitlecd;
    
    //テーブル操作クラス
   	var $c_supplier;
    var $c_delivery;
    
    //入力値
    var $orderunitprice;
    var $ordernum;

    var $title;
   	var $pagename;

    function execute()
    {
        $this -> update();

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

        return 'success';
    }
    
    function update()
    {
        /*
        foreach($this -> stocktitlecd as $key => $item){
        	if($this -> itemcd[$key] == "" || $this -> structcd[$key] == "" || $this -> orderunitprice[$key] == "" || $this -> ordernum[$key] == ""){
        	    continue;
        	}else{
        	    $deliveryCnt  = $this -> c_delivery -> getOrderNumber($this->stocktitlecd[$key]);
                $orderCnt     = $this -> ordernum[$key];
        	    while(true){
                    //更新に最適なstockcdを取得
                    $stockcd = $this -> c_delivery -> getMinStockcd($this -> itemcd[$key], $this -> structcd[$key]);

                    //更新処理
        	        if($orderCnt > 0){
        	        	$this -> c_delivery -> updateDelivery($this -> itemcd[$key], $this -> structcd[$key], $stockcd, $this -> orderunitprice[$key]);
        	        	$orderCnt--;
        	        } else {
        	        	$this -> c_delivery -> updateNonDelivery($this -> itemcd[$key], $this -> structcd[$key], $stockcd);
        	        }
        	        $deliveryCnt--;
        	        if($deliveryCnt <= 0) break;
        	    }
        	}
        }
		*/
        $this -> c_delivery -> updateDelivery($this -> stocktitlecd, $this->ordernum, $this -> orderunitprice);
        
    }
}
?>
