Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 198da055
authored
Nov 19, 2016
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfixes...
1 parent
4c45791b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
10 deletions
code/moya-beans/ejbModule/fi/codecrew/moya/beans/BillBean.java
code/moya-web/WebContent/neomap/moveplaces.xhtml
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/map/MapPlacechangeView.java
code/moya-web/src/main/java/fi/codecrew/moya/web/helper/ProductShopItemHelper.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/BillBean.java
View file @
198da05
...
...
@@ -372,7 +372,8 @@ public class BillBean implements BillBeanLocal {
BigDecimal
discountPrice
=
product
.
getPrice
();
for
(
Discount
disc
:
discountBean
.
getActiveDiscountsByProduct
(
product
,
count
,
bill
.
getSentDate
(),
bill
.
getUser
()))
{
BillLine
line
=
new
BillLine
(
bill
,
product
,
disc
,
discountPrice
,
count
);
discountPrice
=
discountPrice
.
subtract
(
line
.
getUnitPrice
());
// unitPrice is negative, so add. Do not subtract
discountPrice
=
discountPrice
.
add
(
line
.
getUnitPrice
());
bill
.
getBillLines
().
add
(
line
);
}
...
...
code/moya-web/WebContent/neomap/moveplaces.xhtml
View file @
198da05
...
...
@@ -79,7 +79,7 @@
<p:commandButton
rendered=
"#{ajaxMapView.canUserBuy()}"
value=
"#{i18n['mapPlacechange.commitMove']}"
action
Listener
=
"#{mapPlacechangeView.commitMove()}"
/>
action=
"#{mapPlacechangeView.commitMove()}"
/>
</h:form>
...
...
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/map/MapPlacechangeView.java
View file @
198da05
...
...
@@ -107,6 +107,9 @@ public class MapPlacechangeView extends GenericCDIView {
}
}
placebean
.
movePlaces
(
change
);
slots
=
null
;
initView
();
}
public
void
toggleDstPlace
()
{
...
...
code/moya-web/src/main/java/fi/codecrew/moya/web/helper/ProductShopItemHelper.java
View file @
198da05
...
...
@@ -45,18 +45,22 @@ public class ProductShopItemHelper extends GenericCDIView {
public
void
updateProductShopItemCount
(
ProductShopItem
item
)
{
if
(
item
.
getProduct
().
getMinBuyCount
()
>
0
&&
item
.
getCount
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
&&
item
.
getCount
().
compareTo
(
BigDecimal
.
valueOf
(
item
.
getProduct
().
getMinBuyCount
()))
<
0
)
{
item
.
setCount
(
BigDecimal
.
valueOf
(
item
.
getProduct
().
getMinBuyCount
()));
}
// Discounts or overridden price, you cannot get both
if
(
item
.
isOverrideUnitPrice
())
{
item
.
setInternalPrice
(
item
.
getOverriddenUnitPrice
().
multiply
(
item
.
getCount
()));
}
else
{
item
.
setInternalPrice
(
item
.
getProduct
().
getPrice
().
abs
().
multiply
(
item
.
getCount
()));
item
.
setInternalDiscounts
(
discountBean
.
getActiveDiscountsByProduct
(
item
.
getProduct
(),
item
.
getCount
(),
new
Date
(),
item
.
getUser
()));
item
.
setInternalDiscounts
(
discountBean
.
getActiveDiscountsByProduct
(
item
.
getProduct
(),
item
.
getCount
(),
new
Date
(),
item
.
getUser
()));
item
.
setInternalDiscountValues
(
new
HashMap
<
Integer
,
BigDecimal
>());
for
(
Discount
d
:
item
.
getDiscounts
())
{
for
(
Discount
d
:
item
.
getDiscounts
())
{
BigDecimal
newprice
=
item
.
getPrice
().
multiply
(
d
.
getPercentage
());
item
.
getInternalDiscountValues
().
put
(
d
.
getId
(),
item
.
getPrice
().
subtract
(
newprice
));
item
.
setInternalPrice
(
newprice
);
...
...
@@ -67,14 +71,10 @@ public class ProductShopItemHelper extends GenericCDIView {
public
void
setProductShopItemCount
(
ProductShopItem
item
,
BigDecimal
count
)
{
if
(
count
==
null
||
count
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
if
(
count
==
null
||
count
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
count
=
BigDecimal
.
ZERO
;
}
else
if
(
item
.
getProduct
().
getMinBuyCount
()
>
0
&&
count
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
&&
count
.
compareTo
(
BigDecimal
.
valueOf
(
item
.
getProduct
().
getMinBuyCount
()))
<
0
)
{
count
=
BigDecimal
.
valueOf
(
item
.
getProduct
().
getMinBuyCount
());
}
item
.
setCount
(
count
);
updateProductShopItemCount
(
item
);
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment