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
7e998dcf
Commit
7e998dcf
authored
1 year ago
by
Jordi Isidro Llobet
Browse files
Options
Downloads
Patches
Plain Diff
invoices_oc_generate_pdf
parent
192ed3ee
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/api.py
+10
-0
10 additions, 0 deletions
app/api.py
app/crud.py
+5
-1
5 additions, 1 deletion
app/crud.py
app/models.py
+6
-0
6 additions, 0 deletions
app/models.py
with
21 additions
and
1 deletion
app/api.py
+
10
−
0
View file @
7e998dcf
...
...
@@ -188,6 +188,16 @@ def read_invoices_oc_pdf(
values
=
crud
.
get_invoices_oc_pdf
(
db
,
invoice
)
return
values
@app.get
(
"
/invoices_oc_generate_pdf/
"
,
tags
=
[
"
Data
"
,
"
Invoice
"
])
def
invoice_genrate_pdf
(
invoice
:
str
,
current_user
:
schemas
.
ApiUser
=
Depends
(
get_current_active_user
),
db
:
Session
=
Depends
(
get_db
)
):
values
=
crud
.
invoices_generate_oc_pdf
(
db
,
invoice
)
return
values
@app.get
(
"
/invoices/{customer_id}
"
,
tags
=
[
"
Data
"
])
def
read_invoices_detail
(
...
...
This diff is collapsed.
Click to expand it.
app/crud.py
+
5
−
1
View file @
7e998dcf
...
...
@@ -6,7 +6,7 @@ from typing import Optional
from
.
import
models
,
schemas
from
app.utils
import
get_password_hash
,
verify_password
from
app.models
import
get_invoices
,
get_invoices_details
,
get_contracts_details
,
get_members_details
,
get_invoice_oc
,
get_invoice_oc_pdf
,
get_invoice_oc_lines
from
app.models
import
get_invoices
,
get_invoices_details
,
get_contracts_details
,
get_members_details
,
get_invoice_oc
,
get_invoice_oc_pdf
,
get_invoice_oc_lines
,
invoice_generate_oc_pdf
from
.config
import
ALGORITHM
,
SECRET_KEY
...
...
@@ -76,6 +76,10 @@ def get_invoices_oc_pdf(db, invoice):
url
=
get_invoice_oc_pdf
(
db
,
invoice
)
return
url
def
invoices_generate_oc_pdf
(
db
,
invoice
):
invoice_generate_oc_pdf
(
db
,
invoice
)
return
'
OK
'
def
get_invoice_metrics
(
db
,
partner_id
,
from_date
,
to_date
,
skip
,
limit
):
registries
=
get_invoices
(
db
,
partner_id
,
from_date
,
to_date
,
skip
,
limit
)
return
registries
...
...
This diff is collapsed.
Click to expand it.
app/models.py
+
6
−
0
View file @
7e998dcf
...
...
@@ -39,6 +39,12 @@ def get_invoice_oc(con, contract_codes,invoice):
return
[
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
)
con
.
execute
(
qry
)
con
.
commit
()
def
get_invoice_oc_lines
(
con
,
invoice
):
statement
=
"
select description_cat, code , sum(amount_without_tax) as preu, tax_percent
"
\
"
from external.opencell_invoices o
"
\
...
...
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