In a previous post (at Business forums) I said that I'll share step by step deploying promotion module in smartPOS.
The basic stuff I'd like to have before deployement are the following :
* * Discount in % during a certain period
* * Discount in Money during a certain period
* * Buy nX get nY
* * Buy X get Discount Y n%
* * Buy nX and nY cheaper (product package)
* * Buy nX get nY
Here is what we did. Please note that to deploy this you need to get the source code of the 2.1 smartPOS version, also the 2.1 iDempiere version and the knowledge of compiling the project with a Java IDE (Netbeans & eclipse in my case) and playing with DB (Postgresql in my case)
2.define promotion in iDempiere. you can refer from adaxa documentation (attached)
* try directly inside iDempiere, make an Order with promotion that already defined, you'll get behaviour of Sales Order it always create one new line to substract total amount of sales and it noted as charge with account that you defined in Promotion windows.
3.SQL part
First thing is to create 2 tables : the one that will contain the promotion type (called promo_type) and the one that will contain the definition of the promo itself (called promo_header).
Promo_type Rules:
* Type are predefined and the code is built based on that.
* This table is used while filling a new promotion in Promotion Code field in iDempiere promotion windows
Promo_header Rules:
* ID : an autogenerated identifier field
* Name : the name of the discount/promo, the one that you named in iDempiere at Promotion windows header (adempiere.m_promotion)
* startdate/ enddate : Format is YYYYMMDD. you fill it in iDempiere on preCondition tab at startdate & enddate field
* starthour/endhour : Format is HH. You can only manage hour, not minute. Mandatory for having a discount working properly.
* Article : product_id which is defined as promo product in iDempiere on Promotion Group Windows at Group Line (adempiere.m_promotiongroup_line)
* Type : here you define the behaviour of your promotion.
* Qtymin / QtypMax / QtyStep : product qty scope of your promotion depending on the type. defined in iDempiere on Promotion Windows Qty Distribution
* Amountstep : denomination/ percentage discount that customer will get.
* promo_id, c_charge_id, bpgroup_id : ID refer to ID that defined from iDempiere.
4. Java Part
a. create new package com.openbravo.pos.promotion (source code attached)
b. next create class I named PromotionDao for pull data from ERP (source code attached)
c. Add Method in TicketLineInfo.java
In a previous post (at Business forums) I said that I'll share step by step deploying promotion module in smartPOS.
The basic stuff I'd like to have before deployement are the following :
* * Discount in % during a certain period
* * Discount in Money during a certain period
* * Buy nX get nY
* * Buy X get Discount Y n%
* * Buy nX and nY cheaper (product package)
* * Buy nX get nY
Here is what we did. Please note that to deploy this you need to get the source code of the 2.1 smartPOS version, also the 2.1 iDempiere version and the knowledge of compiling the project with a Java IDE (Netbeans & eclipse in my case) and playing with DB (Postgresql in my case)
1.activate promotion module in iDempiere using promotion validator. please refer to https://idempiere.atlassian.net/browse/IDEMPIERE-2117
2.define promotion in iDempiere. you can refer from adaxa documentation (attached)
* try directly inside iDempiere, make an Order with promotion that already defined, you'll get behaviour of Sales Order it always create one new line to substract total amount of sales and it noted as charge with account that you defined in Promotion windows.
3.SQL part
First thing is to create 2 tables : the one that will contain the promotion type (called promo_type) and the one that will contain the definition of the promo itself (called promo_header).
Promo_type Rules:
* Type are predefined and the code is built based on that.
* This table is used while filling a new promotion in Promotion Code field in iDempiere promotion windows
Promo_header Rules:
* ID : an autogenerated identifier field
* Name : the name of the discount/promo, the one that you named in iDempiere at Promotion windows header (adempiere.m_promotion)
* startdate/ enddate : Format is YYYYMMDD. you fill it in iDempiere on preCondition tab at startdate & enddate field
* starthour/endhour : Format is HH. You can only manage hour, not minute. Mandatory for having a discount working properly.
* Article : product_id which is defined as promo product in iDempiere on Promotion Group Windows at Group Line (adempiere.m_promotiongroup_line)
* Type : here you define the behaviour of your promotion.
* Qtymin / QtypMax / QtyStep : product qty scope of your promotion depending on the type. defined in iDempiere on Promotion Windows Qty Distribution
* Amountstep : denomination/ percentage discount that customer will get.
* promo_id, c_charge_id, bpgroup_id : ID refer to ID that defined from iDempiere.
Last edit: Edwin Kurniawan 2016-07-25
continue from part above
4. Java Part
a. create new package com.openbravo.pos.promotion (source code attached)
b. next create class I named PromotionDao for pull data from ERP (source code attached)
c. Add Method in TicketLineInfo.java
d. add some code/ script in JPanelTicket.java on refreshticket method
e. Add Synch Promo Button along side with Synchonize data button in SynchPanel.java
Last edit: Edwin Kurniawan 2016-07-25
Here is video result : smartPOS-ERP Promotion
we're developing promotion module referring to http://itsurgeries.blogspot.co.id/2011/11/openbravo-pos-230-promotion-management.html that wrote by Aurélien Escartin. thanks to him :)
Last edit: Edwin Kurniawan 2016-07-25
Thanks for sharing Edwin