Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* Adjusted billing agreement fields

* Added fiscal year & invoice type to Invoice
* Added an InvoiceItem interface
  • Loading branch information...
commit 2008221278dfeebab60ad9b20fb5e8c5923929dd 1 parent 3f21e81
@inspiran inspiran authored iampersistent committed
View
3  lib/Vespolina/Entity/Billing/BillingAgreement.php
@@ -2,8 +2,9 @@
namespace Vespolina\Entity\Billing;
use Doctrine\Common\Collections\ArrayCollection;
-use Vespolina\Entity\Order\OrderInterface;
+use Vespolina\Entity\Billing\BillingAgreementInterface;
use Vespolina\Entity\Partner\PartnerInterface;
+use Vespolina\Entity\Order\OrderInterface;
class BillingAgreement implements BillingAgreementInterface
{
View
36 lib/Vespolina/Entity/Billing/BillingRequest.php
@@ -34,9 +34,11 @@ class BillingRequest implements BillingRequestInterface
const STATE_PAID = 'paid'; //Cancelled by administration
const STATE_CLOSED = 'closed'; //(optional) processing after payment received was completed
+ protected $consumption;
protected $createdAt;
protected $billingAgreements;
protected $billingDate;
+ protected $id;
protected $plannedBillingDate;
protected $owner;
protected $paymentProfile;
@@ -51,6 +53,11 @@ public function __construct()
$this->consumption = array();
}
+ public function getId()
+ {
+ return $this->id;
+ }
+
public function addBillingAgreement(BillingAgreementInterface $billingAgreement)
{
$this->billingAgreements[] = $billingAgreement;
@@ -110,17 +117,6 @@ public function isBlocked()
return $this->state == self::STATE_BLOCKED;
}
-
-
- public function autoSetCreatedAt()
- {
- if (null === $this->createdAt) {
- $this->createdAt = new \DateTime();
- }
-
- return $this;
- }
-
/**
* @param \DateTime $date
* @return $this
@@ -226,4 +222,22 @@ public function getState()
{
return $this->state;
}
+
+ public function autoSetCreatedAt()
+ {
+ if (null === $this->createdAt) {
+ $this->createdAt = new \DateTime();
+ }
+ $this->autoSetUpdatedAt();
+
+ return $this;
+ }
+
+ public function autoSetUpdatedAt()
+ {
+ $this->updatedAt = new \DateTime();
+
+ return $this;
+ }
+
}
View
9 lib/Vespolina/Entity/Billing/BillingRequestInterface.php
@@ -57,15 +57,6 @@ function getConsumption();
function setConsumption(array $consumption);
/**
- * Return the partner we would like to bill
- *
- * @return \Vespolina\Entity\Partner\PartnerInterface
- */
- function getOwner();
-
- function setOwner(PartnerInterface $partner);
-
- /**
* Return the start of period we are billing for
*
* @return \DateTime
View
75 lib/Vespolina/Entity/Invoice/Invoice.php
@@ -21,15 +21,23 @@
*/
class Invoice implements InvoiceInterface
{
+
+ const TYPE_STANDARD = 'standard'; //Default invoice, to be paid
+ const TYPE_PRO_FORMA = 'pro_forma'; //Legal pro forma document, already paid when the entity was created
+ const TYPE_CREDIT_MEMO = 'credit_memo'; //Invoice to credit the customer
+
+ protected $createdAt;
protected $dueDate;
protected $id;
protected $issuedDate;
+ protected $fiscalYear;
protected $orders;
protected $partner;
+ protected $paymentTerms;
protected $payment;
- protected $periodEnd;
- protected $periodStart;
- protected $previousInvoice;
+ protected $reference; //eg. sales or purchase order #
+ protected $type;
+ protected $updatedAt;
public function __construct() {
$this->orders = new ArrayCollection();
@@ -58,6 +66,18 @@ public function getDueDate()
return $this->dueDate;
}
+ public function setFiscalYear($fiscalYear)
+ {
+ $this->fiscalYear = $fiscalYear;
+ }
+
+ public function getFiscalYear()
+ {
+ return $this->fiscalYear;
+ }
+
+
+
/**
* @inheritdoc
*/
@@ -177,57 +197,16 @@ public function getPayment()
return $this->payment;
}
- /**
- * @inheritdoc
- */
- public function setPeriodEnd(\DateTime $periodEnd)
+ public function setType($type)
{
- $this->periodEnd = $periodEnd;
-
- return $this;
+ $this->type = $type;
}
- /**
- * @inheritdoc
- */
- public function getPeriodEnd()
+ public function getType()
{
- return $this->periodEnd;
+ return $this->type;
}
- /**
- * @inheritdoc
- */
- public function setPeriodStart(\DateTime $periodStart)
- {
- $this->periodStart = $periodStart;
- return $this;
- }
- /**
- * @inheritdoc
- */
- public function getPeriodStart()
- {
- return $this->periodStart;
- }
-
- /**
- * @inheritdoc
- */
- public function setPreviousInvoice(InvoiceInterface $previousInvoice)
- {
- $this->previousInvoice = $previousInvoice;
-
- return $this;
- }
-
- /**
- * @inheritdoc
- */
- public function getPreviousInvoice()
- {
- return $this->previousInvoice;
- }
}
View
59 lib/Vespolina/Entity/Invoice/InvoiceInterface.php
@@ -34,6 +34,21 @@ function setDueDate(\DateTime $dueDate);
function getDueDate();
/**
+ * Set the fiscal year to which this invoice should be posted to
+ *
+ * (eg. you can have an invoice created in January 2014 which should go to fiscal year 2013)
+ * @param $fiscalYear
+ * @return mixed
+ */
+ function setFiscalYear($fiscalYear);
+
+ /**
+ * Return the fiscal year
+ *
+ * @return mixed
+ */
+ function getFiscalYear();
+ /**
* Set the issued date of this invoice
*
* @param \DateTime $issuedDate
@@ -124,48 +139,4 @@ function setPayment($payment);
*/
function getPayment();
- /**
- * Set the end of the billing period for this invoice
- *
- * @param \DateTime $periodEnd
- * @return $this
- */
- function setPeriodEnd(\DateTime $periodEnd);
-
- /**
- * Return the end of the billing period of this invoice
- *
- * @return \DateTime
- */
- function getPeriodEnd();
-
- /**
- * Set the start of the billing period for this invoice
- *
- * @param \DateTime $periodEnd
- * @return $this
- */
- function setPeriodStart(\DateTime $periodStart);
-
- /**
- * Return the start of the billing period of this invoice
- *
- * @return \DateTime
- */
- function getPeriodStart();
-
- /**
- * Set previously created Invoice for the Partner, can be used for reporting
- *
- * @param \Vespolina\Entity\Partner\InvoiceInterface $previousInvoice
- * @return $this
- */
- function setPreviousInvoice(InvoiceInterface $previousInvoice);
-
- /**
- * Return the previous invoice for the Partner
- *
- * @return \Vespolina\Entity\Partner\InvoiceInterface
- */
- function getPreviousInvoice();
}
View
50 lib/Vespolina/Entity/Invoice/InvoiceItemInterface.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * (c) 2012-2013 Vespolina Project http://www.vespolina-project.org
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Vespolina\Entity\Invoice;
+
+use Vespolina\Entity\Partner\PartnerInterface;
+use Vespolina\Entity\Pricing\PricingSetInterface;
+use Vespolina\Entity\Product\ProductInterface;
+
+/**
+ * An interface for an invoice item.
+ *
+ * It differs from an order item because an invoice item doesn't necessarily to be linked to an order(item)
+ * nor does it needs to be linked to an actual product.
+ *
+ * @author Daniel Kucharski <daniel@xerias.be>
+ */
+interface InvoiceItemInterface
+{
+
+ function getItemNumber();
+
+ function setItemNumber($itemNumber);
+
+ function getDescription();
+
+ function setDescription($description);
+
+ function getQuantity();
+
+ function setQuantity($quantity);
+
+ function getProduct();
+
+ function setProduct(ProductInterface $product);
+
+ function getProductDescription();
+
+ function setProductDescription($productDescription);
+
+ function getPricingSet();
+
+ function setPricingSet(PricingSetInterface $pricingSet);
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.