Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selfmade class returns old price #73

Closed
sefaYavuz opened this issue Sep 16, 2016 · 3 comments
Closed

Selfmade class returns old price #73

sefaYavuz opened this issue Sep 16, 2016 · 3 comments

Comments

@sefaYavuz
Copy link

sefaYavuz commented Sep 16, 2016

Hi,

I've made a class named SalesItemPrice which I use to retrieve the sales price for an item, but the price returned is an old price. The price returned is 65 and the price in Exact is 95.

The code for the class i've made:

<?php namespace Picqer\Financials\Exact;

/**
 * Class SalesItemPrice
 *
 * @package Picqer\Financials\Exact
 * @see https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=LogisticsSalesItemPrices
 *
 * @property Guid $ID Primary key
 * @property Guid $Account ID of the customer
 * @property String $AccountName Name of the customer account
 * @property DateTime $Created Creation date
 * @property Guid $Creator User ID of creator
 * @property String $CreatorFullName Name of creator
 * @property String $Currency The currency of the price
 * @property String $DefaultItemUnit The default unit of the item
 * @property String $DefaultItemUnitDescription The description of the default item unit
 * @property Int32 $Division Division code
 * @property DateTime $EndDate Together with StartDate this determines if the item is active
 * @property Guid $Item Item ID
 * @property String $ItemCode Code of Item
 * @property String $ItemDescription Description of Item
 * @property DateTime $Modified Last modified date
 * @property Guid $Modifier User ID of modifier
 * @property String $ModifierFullName Name of modifier
 * @property Double $NumberOfItemsPerUnit This is the multiplication factor when going from default item unit to the unit of this price.For example if the default item unit is 'gram' and the price unit is 'kilogram' then the value of this property is 1000.
 * @property Double $Price The actual price of this sales item
 * @property Double $Quantity Minimum quantity to which the price is applicable
 * @property DateTime $StartDate Together with StartDate this determines if the item is active
 * @property String $Unit The unit code of the price
 * @property String $UnitDescription Description of the price unit
 */
class SalesItemPrice extends Model
{

    use Query\Findable;
    use Persistance\Storable;

    protected $fillable = [
        'ID',
        'Account',
        'AccountName',
        'Created',
        'Creator',
        'CreatorFullName',
        'Currency',
        'DefaultItemUnit',
        'DefaultItemUnitDescription',
        'Division',
        'EndDate',
        'Item',
        'ItemCode',
        'ItemDescription',
        'Modified',
        'Modifier',
        'ModifierFullName',
        'NumberOfItemsPerUnit',
        'Price',
        'Quantity',
        'StartDate',
        'Unit',
        'UnitDescription'
    ];

    protected $url = 'logistics/SalesItemPrices';

}

and here is the code that I use to retrieve the items:

$salesItemPrice = new \Picqer\Financials\Exact\SalesItemPrice($connection); $salesItemPrices = $salesItemPrice->filter('', '', 'Price, ItemCode');

Does anybody have any idea why it would return the old price and not the new one?

@stephangroen
Copy link
Member

No idea, the class should be filled with the info it retrieves from Exact.

@michielfb
Copy link

michielfb commented Sep 24, 2016

The endpoint you are using returns the price history of the item. The first price record is always set to 0. To get the current price you are beter off using this endpoint: /api/v1/{division}/read/logistics/SalesItemPrice?itemId={Edm.Guid}

@sefaYavuz
Copy link
Author

sefaYavuz commented Sep 28, 2016

Thanks, but I had sent an email to the Exact Support and they told me that it retrieved all the SalesItemPrices (even the old ones) and that I needed to check if the EndDate attribute value was null or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants