partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 26a6cff99e1056800648715ead3ac0d0f9d54292
parent 8a63da507f85c116088c112d0b4379c48344ad80
Author: Felicitus <felicitus@felicitus.org>
Date:   Fri, 23 Dec 2011 10:03:03 +0100

Added support for a price per item/distributor

Diffstat:
Msrc/backend/de/RaumZeitLabor/PartKeepr/Part/PartDistributor.php | 31++++++++++++++++++++++++++++++-
Msrc/frontend/js/Components/Part/Editor/PartDistributorGrid.js | 13+++++++++++--
Msrc/frontend/js/Models/PartDistributor.js | 1+
3 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/src/backend/de/RaumZeitLabor/PartKeepr/Part/PartDistributor.php b/src/backend/de/RaumZeitLabor/PartKeepr/Part/PartDistributor.php @@ -42,6 +42,15 @@ class PartDistributor extends BaseEntity implements Serializable, Deserializable private $packagingUnit; /** + * Specifies the price of the part. Note that the price + * needs to be per item, not per packaging unit. + * + * @Column(type="decimal",precision=5, scale=2,nullable=true) + * @var float + */ + private $price; + + /** * Cretes a new part->distributor link. Initializes the packaging unit with a quantity of "1". * * @param Part $part The part @@ -131,6 +140,22 @@ class PartDistributor extends BaseEntity implements Serializable, Deserializable } /** + * Sets the price + * @param float $price + */ + public function setPrice ($price) { + echo "/** price set to ".$price." **/"; + $this->price = $price; + } + + /** + * Returns the price + */ + public function getPrice () { + return $this->price; + } + + /** * (non-PHPdoc) * @see de\RaumZeitLabor\PartKeepr\Util.Serializable::serialize() */ @@ -142,7 +167,8 @@ class PartDistributor extends BaseEntity implements Serializable, Deserializable "distributor_name" => $this->getDistributor()->getName(), "part_id" => $this->getPart()->getId(), "part_name" => $this->getPart()->getName(), - "packagingUnit" => $this->getPackagingUnit()); + "packagingUnit" => $this->getPackagingUnit(), + "price" => $this->getPrice()); } /** @@ -162,6 +188,9 @@ class PartDistributor extends BaseEntity implements Serializable, Deserializable case "packagingUnit": $this->setPackagingUnit($value); break; + case "price": + $this->setPrice($value); + break; } } } diff --git a/src/frontend/js/Components/Part/Editor/PartDistributorGrid.js b/src/frontend/js/Components/Part/Editor/PartDistributorGrid.js @@ -45,7 +45,7 @@ Ext.define('PartKeepr.PartDistributorGrid', { dataIndex: 'distributor_id', xtype: 'templatecolumn', tpl: '{distributor_name}', - flex: 0.4, + flex: 0.3, editor: { xtype:'DistributorComboBox', allowBlank:true @@ -54,7 +54,7 @@ Ext.define('PartKeepr.PartDistributorGrid', { { header: i18n("Order Number"), dataIndex: 'orderNumber', - flex: 0.4, + flex: 0.3, editor: { xtype:'textfield', allowBlank:true @@ -69,6 +69,15 @@ Ext.define('PartKeepr.PartDistributorGrid', { allowBlank:false, minValue: 1 } + },{ + header: i18n("Price per Item"), + dataIndex: 'price', + flex: 0.2, + editor: { + xtype:'numberfield', + allowDecimals: true, + allowBlank:true + } } ]; diff --git a/src/frontend/js/Models/PartDistributor.js b/src/frontend/js/Models/PartDistributor.js @@ -6,6 +6,7 @@ Ext.define("PartKeepr.PartDistributor", { { name: 'part_name', type: 'string' }, { name: 'distributor_id', type: 'int' }, { name: 'distributor_name', type: 'string' }, + { name: 'price', type: 'float' }, { name: 'orderNumber', type: 'string' }, { name: 'packagingUnit', type: 'int'} ],