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
a325f466
Commit
a325f466
authored
Dec 16, 2021
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#1495 add percent adjustment to compute needed products
parent
5e8434ac
Pipeline
#1663
passed with stage
in 1 minute 32 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
0 deletions
+37
-0
oders_helper_style.css
orders/static/css/oders_helper_style.css
+17
-0
orders_helper.js
orders/static/js/orders_helper.js
+15
-0
helper.html
templates/orders/helper.html
+5
-0
No files found.
orders/static/css/oders_helper_style.css
View file @
a325f466
...
@@ -197,6 +197,23 @@
...
@@ -197,6 +197,23 @@
border-radius
:
3px
;
border-radius
:
3px
;
}
}
#coverage_form
>
div
{
display
:
inline-block
;
float
:
left
;
}
#coverage_form
.input-wrapper
{
margin-right
:
3px
;
}
#coverage_days_input
,
#percent_adjust_input
{
display
:
block
;
}
#coverage_days_input
{
margin-bottom
:
3px
;
}
/* -- Table */
/* -- Table */
#products_table_filter
{
#products_table_filter
{
text-align
:
right
!important
;
text-align
:
right
!important
;
...
...
orders/static/js/orders_helper.js
View file @
a325f466
...
@@ -189,7 +189,14 @@ function add_product() {
...
@@ -189,7 +189,14 @@ function add_product() {
* Set the computed qty for the first supplier only.
* Set the computed qty for the first supplier only.
*/
*/
function
compute_products_coverage_qties
()
{
function
compute_products_coverage_qties
()
{
const
pc_adjust
=
$
(
'#percent_adjust_input'
).
val
();
let
coeff
=
1
;
if
(
!
isNaN
(
parseFloat
(
pc_adjust
)))
{
coeff
=
(
1
+
parseFloat
(
pc_adjust
)
/
100
);
}
if
(
order_doc
.
coverage_days
!=
null
)
{
if
(
order_doc
.
coverage_days
!=
null
)
{
order_doc
.
coeff
=
coeff
;
for
(
const
[
for
(
const
[
key
,
key
,
product
product
...
@@ -202,12 +209,16 @@ function compute_products_coverage_qties() {
...
@@ -202,12 +209,16 @@ function compute_products_coverage_qties() {
const
incoming_qty
=
product
.
incoming_qty
;
const
incoming_qty
=
product
.
incoming_qty
;
const
daily_conso
=
product
.
daily_conso
;
const
daily_conso
=
product
.
daily_conso
;
purchase_qty_for_coverage
=
order_doc
.
coverage_days
*
daily_conso
-
stock
-
incoming_qty
;
purchase_qty_for_coverage
=
order_doc
.
coverage_days
*
daily_conso
-
stock
-
incoming_qty
;
purchase_qty_for_coverage
=
(
purchase_qty_for_coverage
<
0
)
?
0
:
purchase_qty_for_coverage
;
purchase_qty_for_coverage
=
(
purchase_qty_for_coverage
<
0
)
?
0
:
purchase_qty_for_coverage
;
// Reduce to nb of packages to purchase
// Reduce to nb of packages to purchase
purchase_package_qty_for_coverage
=
purchase_qty_for_coverage
/
product
.
suppliersinfo
[
0
].
package_qty
;
purchase_package_qty_for_coverage
=
purchase_qty_for_coverage
/
product
.
suppliersinfo
[
0
].
package_qty
;
if
(
order_doc
.
coeff
!=
1
)
{
purchase_package_qty_for_coverage
*=
order_doc
.
coeff
;
}
// Round up to unit for all products
// Round up to unit for all products
purchase_package_qty_for_coverage
=
Math
.
ceil
(
purchase_package_qty_for_coverage
);
purchase_package_qty_for_coverage
=
Math
.
ceil
(
purchase_package_qty_for_coverage
);
...
@@ -1885,6 +1896,10 @@ function update_main_screen(params) {
...
@@ -1885,6 +1896,10 @@ function update_main_screen(params) {
$
(
"#coverage_days_input"
).
val
(
''
);
$
(
"#coverage_days_input"
).
val
(
''
);
}
}
if
(
order_doc
.
coeff
&&
order_doc
.
coeff
!=
1
)
{
$
(
"#percent_adjust_input"
).
val
(
-
Math
.
ceil
((
1
-
order_doc
.
coeff
)
*
100
));
}
if
(
order_doc
.
stats_date_period
!==
undefined
&&
order_doc
.
stats_date_period
!==
null
)
{
if
(
order_doc
.
stats_date_period
!==
undefined
&&
order_doc
.
stats_date_period
!==
null
)
{
$
(
"#stats_date_period_select"
).
val
(
order_doc
.
stats_date_period
);
$
(
"#stats_date_period_select"
).
val
(
order_doc
.
stats_date_period
);
}
else
{
}
else
{
...
...
templates/orders/helper.html
View file @
a325f466
...
@@ -93,8 +93,13 @@
...
@@ -93,8 +93,13 @@
</select>
</select>
</form>
</form>
<form
action=
"javascript:;"
id=
"coverage_form"
class=
"order_form_item"
>
<form
action=
"javascript:;"
id=
"coverage_form"
class=
"order_form_item"
>
<div
class=
"input-wrapper"
>
<input
type=
"number"
name=
"coverage_days"
id=
"coverage_days_input"
placeholder=
"Nb jours de couverture"
min=
"1"
>
<input
type=
"number"
name=
"coverage_days"
id=
"coverage_days_input"
placeholder=
"Nb jours de couverture"
min=
"1"
>
<input
type=
"number"
name=
"percent_adjustement"
id=
"percent_adjust_input"
placeholder=
"ajustement en % (+ ou -)"
>
</div>
<div>
<button
type=
"submit"
class=
'btn--primary'
>
Calculer les besoins
</button>
<i
class=
'main fa fa-info-circle fa-lg'
></i>
<button
type=
"submit"
class=
'btn--primary'
>
Calculer les besoins
</button>
<i
class=
'main fa fa-info-circle fa-lg'
></i>
</div>
</form>
</form>
</div>
</div>
...
...
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