Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ADITO_Update_Upgrade
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Gitlab Maintenance 28.03.2025 | 20:00 - 23:00 MEZ
Show more breadcrumbs
xrm
ADITO_Update_Upgrade
Commits
e7d8d873
Commit
e7d8d873
authored
3 years ago
by
Benjamin Ulrich
Browse files
Options
Downloads
Patches
Plain Diff
[Projekt: xRM-Sales][TicketNr.: 1079248][Angebotspreis Bug]
parent
49f6a337
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
entity/Offeritem_entity/recordcontainers/db/onDBInsert.js
+11
-20
11 additions, 20 deletions
entity/Offeritem_entity/recordcontainers/db/onDBInsert.js
process/Offer_lib/process.js
+7
-3
7 additions, 3 deletions
process/Offer_lib/process.js
with
18 additions
and
23 deletions
entity/Offeritem_entity/recordcontainers/db/onDBInsert.js
+
11
−
20
View file @
e7d8d873
...
...
@@ -16,34 +16,25 @@ if(oid != "")
var
insertStatements
=
JSON
.
parse
(
vars
.
get
(
"
$field.itemInsertStatements
"
));
//insert statements get set by insertPartsList in the onvalueChanges of product_id and quantity
var
statements
=
[];
if
(
insertStatements
)
{
statements
=
statements
.
concat
(
insertStatements
);
}
//update offer price
var
vals
=
oiUtils
.
getNetAndVat
();
var
discountedVals
=
OfferItemUtils
.
getDiscountedNet
(
null
,
oid
,
discount
);
if
(
discountedVals
)
{
insertS
tatements
.
push
(
newWhere
(
"
OFFER
ITEM
.OFFERI
TEMI
D
"
,
rowdata
[
"
OFFERITEM.OFFER
ITEM
ID
"
]).
buildUpdateStatement
({
"
NET
"
:
vals
[
0
],
"
VAT
"
:
vals
[
1
],
"
DISCOUNTED_NET
"
:
discountedVals
[
0
],
"
DISCOUNTED_VAT
"
:
discountedVals
[
1
]
})
)
s
tatements
.
push
(
newWhere
(
"
OFFER.OFFERID
"
,
rowdata
[
"
OFFERITEM.OFFER
_
ID
"
]).
buildUpdateStatement
({
"
NET
"
:
vals
[
0
],
"
VAT
"
:
vals
[
1
],
"
DISCOUNTED_NET
"
:
discountedVals
[
0
],
"
DISCOUNTED_VAT
"
:
discountedVals
[
1
]
})
)
}
else
if
(
insertStatements
)
{
insertStatements
.
push
(
newWhere
(
"
OFFERITEMID
"
,
rowdata
[
"
OFFERITEM.OFFERITEMID
"
])
.
buildUpdateStatement
({
"
NET
"
:
vals
[
0
],
"
VAT
"
:
vals
[
1
]
})
)
statements
=
statements
.
concat
(
insertStatements
);
}
db
.
execute
(
statements
,
"
Data_alias
"
,
10000000
);
...
...
This diff is collapsed.
Click to expand it.
process/Offer_lib/process.js
+
7
−
3
View file @
e7d8d873
...
...
@@ -631,7 +631,7 @@ OfferItemUtils.getDiscountedNet = function(pExcludedIs, pOfferId, pDiscount, pEx
var
vat
=
0
;
var
vatExcluded
=
0
;
if
(
pOfferId
){
var
offeritemData
=
newSelect
(
"
QUANTITY, PRICE, DISCOUNT, VAT, OPTIONAL
"
)
var
offeritemData
=
newSelect
(
"
QUANTITY, PRICE, DISCOUNT, VAT, OPTIONAL
, ITEMPOSITION
"
)
.
from
(
"
OFFERITEM
"
)
.
where
(
"
OFFERITEM.OFFER_ID
"
,
pOfferId
)
.
andIfSet
(
"
OFFERITEM.GROUPCODEID
"
,
pExcludedProductgroups
,
SqlBuilder
.
NOT_IN
())
...
...
@@ -640,8 +640,12 @@ OfferItemUtils.getDiscountedNet = function(pExcludedIs, pOfferId, pDiscount, pEx
.
table
();
for
(
var
i
=
0
;
i
<
offeritemData
.
length
;
i
++
)
{
sum
=
eMath
.
addDec
(
sum
,
ItemUtils
.
prototype
.
getItemSum
(
offeritemData
[
i
][
0
],
offeritemData
[
i
][
1
],
offeritemData
[
i
][
2
],
offeritemData
[
i
][
4
]));
vat
=
eMath
.
addDec
(
vat
,
ItemUtils
.
prototype
.
getItemVAT
(
offeritemData
[
i
][
0
],
offeritemData
[
i
][
1
],
offeritemData
[
i
][
2
],
offeritemData
[
i
][
3
],
offeritemData
[
i
][
4
]));
if
(
!
offeritemData
[
i
][
5
].
toString
().
includes
(
"
.
"
)
//only top items
&&
offeritemData
[
i
][
4
]
==
"
0
"
)
//which are not optional
{
sum
=
eMath
.
addDec
(
sum
,
eMath
.
subDec
(
offeritemData
[
i
][
1
],
offeritemData
[
i
][
2
])
*
offeritemData
[
i
][
0
]);
vat
=
eMath
.
addDec
(
vat
,
offeritemData
[
i
][
3
]
*
eMath
.
subDec
(
offeritemData
[
i
][
1
],
offeritemData
[
i
][
2
])
*
offeritemData
[
i
][
0
]
/
100
);
}
}
sum
=
eMath
.
subDec
(
sum
,
eMath
.
divDec
(
eMath
.
mulDec
(
sum
,
pDiscount
),
"
100
"
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment