Skip to content

Commit

Permalink
Merge pull request #15 from it-can/master
Browse files Browse the repository at this point in the history
Added PurchaseEntry + some other changes
  • Loading branch information
stephangroen committed Oct 3, 2015
2 parents b44dfae + 1d68d5e commit c6c1a8b
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Picqer/Financials/Exact/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public function addDivisionNumberToApiUrl()
$this->division = $me->find()->CurrentDivision;
}

$this->client()->setBaseUrl($this->client()->getBaseUrl() . '/' . $this->division);
$this->client()->setBaseUrl($this->apiUrl . '/' . $this->division);
}

/**
Expand Down
12 changes: 9 additions & 3 deletions src/Picqer/Financials/Exact/Persistance/Storable.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ public function insert()

public function update()
{
return $this->connection()->put($this->url . "(guid'$this->primaryKey')", $this->json());
$key = $this->primaryKey;
$primarykey = $this->$key;

return $this->connection()->put($this->url . "(guid'$primarykey')", $this->json());
}

public function delete()
{
return $this->connection()->delete($this->url . "(guid'$this->primaryKey')");
$key = $this->primaryKey;
$primarykey = $this->$key;

return $this->connection()->delete($this->url . "(guid'$primarykey')");
}
}
}
53 changes: 53 additions & 0 deletions src/Picqer/Financials/Exact/PurchaseEntry.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php namespace Picqer\Financials\Exact;

class PurchaseEntry extends Model
{
use Query\Findable;
use Persistance\Storable;

protected $primaryKey = 'EntryID';

protected $purchaseEntryLines = [];

protected $fillable = [
'EntryID',
'BatchNumber',
'Currency',
'Description',
'Document',
'DueDate',
'EntryDate',
'EntryNumber',
'ExternalLinkReference',
'InvoiceNumber',
'Journal',
'OrderNumber',
'PaymentCondition',
'ProcessNumber',
'PurchaseEntryLines',
'Rate',
'ReportingPeriod',
'ReportingYear',
'Reversal',
'Supplier',
'VATAmountFC',
'YourRef',
];

public function addItem(array $array)
{
if ( ! isset($this->attributes['PurchaseEntryLines']) || $this->attributes['PurchaseEntryLines'] == null)
{
$this->attributes['PurchaseEntryLines'] = [];
}
if ( ! isset($array['LineNumber']))
{
$array['LineNumber'] = count($this->attributes['PurchaseEntryLines']) + 1;
}
$this->attributes['PurchaseEntryLines'][] = $array;
}


protected $url = 'purchaseentry/PurchaseEntries';

}
31 changes: 31 additions & 0 deletions src/Picqer/Financials/Exact/PurchaseEntryLine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php namespace Picqer\Financials\Exact;

class PurchaseEntryLine extends Model
{
use Query\Findable;
use Persistance\Storable;

protected $fillable = [
'ID',
'AmountFC',
'Asset',
'CostCenter',
'CostUnit',
'Description',
'EntryID',
'GLAccount',
'Notes',
'Project',
'Quantity',
'SerialNumber',
'Subscription',
'TrackingNumber',
'VATAmountFC',
'VATBaseAmountFC',
'VATCode',
'VATPercentage',
];

protected $url = 'purchaseentry/PurchaseEntryLines';

}
2 changes: 1 addition & 1 deletion src/Picqer/Financials/Exact/Transactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ class Transactions extends Model
'TypeDescription'
];

protected $url = 'financialtransaction/Transactions/';
protected $url = 'financialtransaction/Transactions';
}

0 comments on commit c6c1a8b

Please sign in to comment.