Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BI Som Connexio Api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Show more breadcrumbs
Coopdevs
Business Intelligence
Som Connexió
BI Som Connexio Api
Commits
8bd8ddeb
Commit
8bd8ddeb
authored
1 year ago
by
Jordi Isidro Llobet
Browse files
Options
Downloads
Patches
Plain Diff
correccions per facturació
parent
58d170bd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/models.py
+7
-4
7 additions, 4 deletions
app/models.py
with
7 additions
and
4 deletions
app/models.py
+
7
−
4
View file @
8bd8ddeb
...
...
@@ -4,6 +4,8 @@ from datetime import datetime
from
sqlalchemy
import
Boolean
,
Column
,
Integer
,
String
import
requests
from
pandas
import
DataFrame
import
json
import
time
from
.database
import
Base
...
...
@@ -80,9 +82,10 @@ def get_invoice_oc(con, billing_run_uuid):
group
=
df
.
groupby
(
by
=
'
group_code
'
)
for
x
in
group
:
d
=
datetime
.
today
()
# datetime.today().strftime('%Y-%m-%d')
data
=
{
"
groupCode
"
:
x
[
0
],
"
invoiceDate
"
:
date
time
.
today
().
strftime
(
'
%Y-%m-%d
'
),
"
invoiceDate
"
:
int
(
time
.
mktime
(
d
.
timetuple
())
),
"
invoiceLines
"
:
[],
}
df2
=
df
.
loc
[
df
[
'
group_code
'
]
==
x
[
0
]]
...
...
@@ -105,15 +108,15 @@ def get_invoice_oc(con, billing_run_uuid):
"
Content-Type
"
:
"
application/json
"
,
"
api-key
"
:
APIKEY
}
r
=
requests
.
post
(
url
=
API_ENDPOINT
,
data
=
data
,
headers
=
head
)
# TODO és necessari el return de les dades o amb un OK ja està bé?
r
=
requests
.
post
(
url
=
API_ENDPOINT
,
data
=
json
.
dumps
(
data
),
headers
=
head
)
return
'
OK
'
#[dict(zip(columns, t)) for t in registries]
def
invoice_generate_oc_pdf
(
con
,
invoice
):
qry
=
"
insert into external.invoice_generator (name_invoice, satus, dt_insert, dt_update) values (
'
{}
'
,
'
inici
'
, current_timestamp, current_timestamp)
"
.
format
(
invoice
)
qry
=
"
insert into external.invoice_generator (name_invoice, s
t
atus, dt_insert, dt_update) values (
'
{}
'
,
'
inici
'
, current_timestamp, current_timestamp)
"
.
format
(
invoice
)
con
.
execute
(
qry
)
con
.
commit
()
return
'
OK
'
def
get_invoice_oc_lines
(
con
,
invoice
):
...
...
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