Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-party
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
third-party
Commits
7a0149bc
Commit
7a0149bc
authored
Sep 03, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
always compute products qty not covered & days covered
parent
73da7a2c
Pipeline
#1282
passed with stage
in 1 minute 48 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
16 deletions
+12
-16
orders_helper.js
orders/static/js/orders_helper.js
+12
-16
No files found.
orders/static/js/orders_helper.js
View file @
7a0149bc
...
@@ -1252,25 +1252,21 @@ function _compute_product_data(product) {
...
@@ -1252,25 +1252,21 @@ function _compute_product_data(product) {
}
}
/* Coverage related data */
/* Coverage related data */
if
(
order_doc
.
coverage_days
!==
null
)
{
const
coverage_days
=
(
order_doc
.
coverage_days
!==
null
)
?
order_doc
.
coverage_days
:
0
;
let
qty_not_covered
=
0
;
let
qty_not_covered
=
0
;
let
days_covered
=
0
;
let
days_covered
=
0
;
if
(
product
.
daily_conso
!==
0
)
{
qty_not_covered
=
product
.
daily_conso
*
order_doc
.
coverage_days
-
product
.
qty_available
-
product
.
incoming_qty
-
purchase_qty
;
qty_not_covered
=
-
Math
.
ceil
(
qty_not_covered
);
// round up, so if a value is not fully covered display it
qty_not_covered
=
(
qty_not_covered
>
0
)
?
0
:
qty_not_covered
;
// only display qty not covered (neg value)
days_covered
=
(
product
.
qty_available
+
product
.
incoming_qty
+
purchase_qty
)
/
product
.
daily_conso
;
if
(
product
.
daily_conso
!==
0
)
{
days_covered
=
Math
.
floor
(
days_covered
);
qty_not_covered
=
product
.
daily_conso
*
coverage_days
-
product
.
qty_available
-
product
.
incoming_qty
-
purchase_qty
;
}
qty_not_covered
=
-
Math
.
ceil
(
qty_not_covered
);
// round up: display values that are not fully covered
qty_not_covered
=
(
qty_not_covered
>
0
)
?
0
:
qty_not_covered
;
// only display qty not covered (neg value)
item
.
qty_not_covered
=
qty_not_covered
;
days_covered
=
(
product
.
qty_available
+
product
.
incoming_qty
+
purchase_qty
)
/
product
.
daily_conso
;
item
.
days_covered
=
days_covered
;
days_covered
=
Math
.
floor
(
days_covered
);
}
else
{
item
.
qty_not_covered
=
'X'
;
item
.
days_covered
=
'X'
;
}
}
item
.
qty_not_covered
=
qty_not_covered
;
item
.
days_covered
=
days_covered
;
return
item
;
return
item
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment