public function add(array $data)
    {
        $defaults = array(
            "description" => null,
            "price"       => null,
            "discount"    => null,
            "qty"         => 1,
            "unit"        => null
        );

        $merged = array_merge($defaults, $data);

        $line = $this->create($this->quotationHandle);

        if( isset($merged['product']) )
        {
            $this->product($line, $merged['product']);
            unset( $merged['product'] );
        }

        foreach( $merged as $name => $value )
        {
            if( is_null($value) )
                continue;

            switch($name)
            {
                case 'description':
                    $this->description($line, $value);
                    break;
                case 'price':
                    $this->price($line, $value);
                    break;
                case 'discount':
                    $this->discount($line, $value);
                    break;
                case 'qty':
                    $this->qty($line, $value);
                    break;
                case 'unit':
                    $this->unit($line, $value);
                    break;
            }
        }
    }
public function add(array $data)
    {
        $defaults = array(
            "description" => null,
            "price"       => null,
            "discount"    => null,
            "qty"         => 1,
            "unit"        => null
        );

        $merged = array_merge($defaults, $data);

        $line = $this->create($this->quotationHandle);

        if( isset($merged['product']) )
        {
            $this->product($line, $merged['product']);
            unset( $merged['product'] );
        }

        foreach( $merged as $name => $value )
        {
            if( is_null($value) )
                continue;

            switch($name)
            {
                case 'description':
                    $this->description($line, $value);
                    break;
                case 'price':
                    $this->price($line, $value);
                    break;
                case 'discount':
                    $this->discount($line, $value);
                    break;
                case 'qty':
                    $this->qty($line, $value);
                    break;
                case 'unit':
                    $this->unit($line, $value);
                    break;
            }
        }
    }
public function add ( array $ data ) { $ defaults = array ( "description" => null , "price" => null , "discount" => null , "qty" => 1 , "unit" => null ) ; $ merged = array_merge ( $ defaults , $ data ) ; $ line = $ this -> create ( $ this -> quotationHandle ) ; if ( isset ( $ merged [ 'product' ] ) ) { $ this -> product ( $ line , $ merged [ 'product' ] ) ; unset ( $ merged [ 'product' ] ) ; } foreach ( $ merged as $ name => $ value ) { if ( is_null ( $ value ) ) continue ; switch ( $ name ) { case 'description' : $ this -> description ( $ line , $ value ) ; break ; case 'price' : $ this -> price ( $ line , $ value ) ; break ; case 'discount' : $ this -> discount ( $ line , $ value ) ; break ; case 'qty' : $ this -> qty ( $ line , $ value ) ; break ; case 'unit' : $ this -> unit ( $ line , $ value ) ; break ; } } }
Create new Quotation line from data
@param array $data
Create new Quotation line from data