<?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     Seller.Itemexhibit.Refund.List
 * @author      T.Shimano <shimano@fuco.jp>
 * @access      public
 */
class Seller_Itemexhibit_Refund_List
{
	// DBインターフェイス 
    var $refund;
    
    // 検索結果
    var $data;
    var $count;
    var $subitem;
    
    // ユーザー情報 
    var $auth;
    
    /**
     * [[機能説明]]
     *
     * @access  public
     */
    function execute()
    {
    	 
    	$memberCd = $this -> auth -> getAuthData("membercd");
    	$where[][0] = " sd.sellercd = $memberCd ";
    	
    	$data = $this->refund->getRefundList(-1, 0, $where);
    	$this->count = array_pop($data);
    	
    	// 大きいまとまりである受注番号、受注日、購入者、手数料の情報を生成 
    	$this->data = array();
    	foreach($data as $key=>$val)
    	{
    	    $this->data[$val["orderno"]] = array(
    	    "orderno"=>$val["orderno"],
    	    "orderdate"=>$val["orderdate"],
    	    "ordernm"=>$val["ordernm"],
    	    "ordermember"=>$val["ordermember"],
    	    "sendbuyer"=>$val["sendbuyer"],
    	    "comission"=>$val["comission"],
    	    "subcount"=>0
    	    );
    	}
    	
    	// 細かい出品番号、タイトル、数量、金額の情報を生成 
    	foreach($data as $key=>$val)
    	{
    		$this->data[$val["orderno"]]["subdata"][] = array(
    		    "exno" => $val["exno"],
    		    "itemnm" => $val["itemnm"] ." ". $val["variationnm"],
    		    "count" => $val["count"],
    		    "price" => $val["price"],
    		    "rackid"=>$val["rackid"]
    		);
    		$this->data[$val["orderno"]]["subcount"]++;
    	}
    	
    	$log =& LogFactory::getLog();
    	$log->debug("Seller_Itemexhibit_Refund_Listが実行されました", "Seller_Itemexhibit_Refund_List#execute");
        return 'success';
    }
    
}
?>