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
0
Merge Requests
0
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
Alexis AOUN
third-party
Commits
ae0b9f20
Commit
ae0b9f20
authored
May 14, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix sales export
parent
4922c3e4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
10 deletions
+20
-10
models.py
sales/models.py
+3
-0
sales.css
sales/static/css/sales.css
+4
-0
sales.js
sales/static/js/sales.js
+10
-9
index.html
templates/sales/index.html
+3
-1
No files found.
sales/models.py
View file @
ae0b9f20
...
...
@@ -32,6 +32,9 @@ class CagetteSales(models.Model):
item
=
None
try
:
for
payment
in
payments
:
# POS session can contain payments from another day (closing session on next morning, ...)
if
payment
[
"date"
]
>=
date_from
and
payment
[
"date"
]
<=
date_to
:
# If the consecutive payment in the results is from the same partner on the same day, we consider it's the same basket
if
item
is
not
None
and
item
[
"partner_id"
][
0
]
==
payment
[
"partner_id"
][
0
]
and
item
[
"date"
]
==
payment
[
"date"
]:
res
[
len
(
res
)
-
1
][
"total_amount"
]
+=
round
(
float
(
payment
[
"amount"
]),
2
)
res
[
len
(
res
)
-
1
][
"payments"
]
.
append
({
...
...
sales/static/css/sales.css
View file @
ae0b9f20
...
...
@@ -21,3 +21,6 @@
border-radius
:
5px
;
}
.btn_export_movements
{
margin-top
:
10px
;
}
\ No newline at end of file
sales/static/js/sales.js
View file @
ae0b9f20
...
...
@@ -32,14 +32,13 @@ function display_orders(orders) {
if
(
orders_table
)
{
orders_table
.
destroy
();
}
console
.
log
(
orders
);
orders_table
=
$
(
'#orders_table'
).
DataTable
({
data
:
orders
,
columns
:[
{
data
:
"create_date"
,
title
:
"Date"
,
title
:
"Date
de vente
"
,
width
:
"10%"
},
{
...
...
@@ -61,7 +60,6 @@ function display_orders(orders) {
{
data
:
"payments"
,
title
:
"Paiements"
,
className
:
"dt-body-center"
,
orderable
:
false
,
render
:
function
(
data
)
{
let
res
=
'<ul>'
;
...
...
@@ -79,8 +77,15 @@ function display_orders(orders) {
"asc"
]
],
dom
:
'rtip'
,
iDisplayLength
:
25
,
buttons
:
[
{
extend
:
'excelHtml5'
,
text
:
'Export en Excel'
,
className
:
'btn--primary btn_export_movements'
}
],
dom
:
'<lr<t>ip><"clear"><B>'
,
iDisplayLength
:
100
,
language
:
{
url
:
'/static/js/datatables/french.json'
}
});
...
...
@@ -188,8 +193,4 @@ $(document).ready(function() {
event
.
preventDefault
();
get_sales
();
});
// $('#dates_selection_button').click(function() {
// get_sales();
// });
});
templates/sales/index.html
View file @
ae0b9f20
...
...
@@ -11,7 +11,9 @@
<script type="
text
/
javascript
"
src=
"{% static 'jquery-ui-1.12.1/jquery-ui.min.js' %}?v="
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/datatables/jquery.dataTables.min.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/datatables/dataTables.plugins.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/datatables/datatables.buttons.min.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/datatables/buttons.html5.min.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/datatables/jszip.min.js' %}"
></script>
{% endblock %}
{% block content %}
...
...
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