Spaces:
Sleeping
Sleeping
EL GHAFRAOUI AYOUB
commited on
Commit
·
2013b9e
1
Parent(s):
32dc8a3
- app/db/__pycache__/models.cpython-312.pyc +0 -0
- app/db/models.py +2 -1
- app/routes/__pycache__/invoices.cpython-312.pyc +0 -0
- app/routes/invoices.py +2 -1
- app/schemas/__pycache__/invoice.cpython-312.pyc +0 -0
- app/schemas/invoice.py +2 -1
- app/services/__pycache__/invoice_service.cpython-312.pyc +0 -0
- app/services/invoice_service.py +8 -4
- app/templates/index.html +6 -1
- sql_app.db +0 -0
app/db/__pycache__/models.cpython-312.pyc
CHANGED
Binary files a/app/db/__pycache__/models.cpython-312.pyc and b/app/db/__pycache__/models.cpython-312.pyc differ
|
|
app/db/models.py
CHANGED
@@ -16,6 +16,7 @@ class Invoice(Base):
|
|
16 |
client_name = Column(String)
|
17 |
client_phone = Column(String)
|
18 |
address = Column(String)
|
|
|
19 |
total_ht = Column(Float)
|
20 |
tax = Column(Float)
|
21 |
total_ttc = Column(Float)
|
@@ -40,4 +41,4 @@ class InvoiceItem(Base):
|
|
40 |
unit_price = Column(Float)
|
41 |
total_price = Column(Float)
|
42 |
|
43 |
-
invoice = relationship("Invoice", back_populates="items")
|
|
|
16 |
client_name = Column(String)
|
17 |
client_phone = Column(String)
|
18 |
address = Column(String)
|
19 |
+
ville = Column(String) # Add ville field
|
20 |
total_ht = Column(Float)
|
21 |
tax = Column(Float)
|
22 |
total_ttc = Column(Float)
|
|
|
41 |
unit_price = Column(Float)
|
42 |
total_price = Column(Float)
|
43 |
|
44 |
+
invoice = relationship("Invoice", back_populates="items")
|
app/routes/__pycache__/invoices.cpython-312.pyc
CHANGED
Binary files a/app/routes/__pycache__/invoices.cpython-312.pyc and b/app/routes/__pycache__/invoices.cpython-312.pyc differ
|
|
app/routes/invoices.py
CHANGED
@@ -44,6 +44,7 @@ async def create_new_invoice(
|
|
44 |
client_name=invoice.client_name,
|
45 |
client_phone=invoice.client_phone,
|
46 |
address=invoice.address,
|
|
|
47 |
total_ht=invoice.total_ht,
|
48 |
tax=invoice.tax,
|
49 |
total_ttc=invoice.total_ttc,
|
@@ -175,4 +176,4 @@ def reset_invoice_sequence(db: Session = Depends(get_db)):
|
|
175 |
return {"message": "Sequence reset successfully"}
|
176 |
except Exception as e:
|
177 |
db.rollback()
|
178 |
-
raise HTTPException(status_code=500, detail=str(e))
|
|
|
44 |
client_name=invoice.client_name,
|
45 |
client_phone=invoice.client_phone,
|
46 |
address=invoice.address,
|
47 |
+
ville=invoice.ville, # Add ville field
|
48 |
total_ht=invoice.total_ht,
|
49 |
tax=invoice.tax,
|
50 |
total_ttc=invoice.total_ttc,
|
|
|
176 |
return {"message": "Sequence reset successfully"}
|
177 |
except Exception as e:
|
178 |
db.rollback()
|
179 |
+
raise HTTPException(status_code=500, detail=str(e))
|
app/schemas/__pycache__/invoice.cpython-312.pyc
CHANGED
Binary files a/app/schemas/__pycache__/invoice.cpython-312.pyc and b/app/schemas/__pycache__/invoice.cpython-312.pyc differ
|
|
app/schemas/invoice.py
CHANGED
@@ -20,6 +20,7 @@ class InvoiceCreate(BaseModel):
|
|
20 |
client_name: str
|
21 |
client_phone: str
|
22 |
address: str
|
|
|
23 |
total_ht: float
|
24 |
tax: float
|
25 |
total_ttc: float
|
@@ -47,4 +48,4 @@ class InvoiceResponse(InvoiceCreate):
|
|
47 |
items: List[InvoiceItemResponse]
|
48 |
|
49 |
class Config:
|
50 |
-
from_attributes = True
|
|
|
20 |
client_name: str
|
21 |
client_phone: str
|
22 |
address: str
|
23 |
+
ville: str # Add ville field
|
24 |
total_ht: float
|
25 |
tax: float
|
26 |
total_ttc: float
|
|
|
48 |
items: List[InvoiceItemResponse]
|
49 |
|
50 |
class Config:
|
51 |
+
from_attributes = True
|
app/services/__pycache__/invoice_service.cpython-312.pyc
CHANGED
Binary files a/app/services/__pycache__/invoice_service.cpython-312.pyc and b/app/services/__pycache__/invoice_service.cpython-312.pyc differ
|
|
app/services/invoice_service.py
CHANGED
@@ -77,6 +77,7 @@ class InvoiceService:
|
|
77 |
data.client_name,
|
78 |
data.project,
|
79 |
data.address,
|
|
|
80 |
data.client_phone
|
81 |
]
|
82 |
|
@@ -114,7 +115,7 @@ class InvoiceService:
|
|
114 |
("Description", 150),
|
115 |
("Unité", 50),
|
116 |
("NBRE", 50),
|
117 |
-
("
|
118 |
("P.U", 60),
|
119 |
("Total HT", 170)
|
120 |
]
|
@@ -204,10 +205,13 @@ class InvoiceService:
|
|
204 |
]
|
205 |
|
206 |
for section_title, keyword in sections:
|
207 |
-
|
208 |
items = [i for i in data.items if keyword in i.description]
|
209 |
-
|
210 |
-
|
|
|
|
|
|
|
211 |
|
212 |
# NB box with text
|
213 |
nb_box_width = 200
|
|
|
77 |
data.client_name,
|
78 |
data.project,
|
79 |
data.address,
|
80 |
+
data.ville, # Add ville here
|
81 |
data.client_phone
|
82 |
]
|
83 |
|
|
|
115 |
("Description", 150),
|
116 |
("Unité", 50),
|
117 |
("NBRE", 50),
|
118 |
+
("ML/Qté", 60),
|
119 |
("P.U", 60),
|
120 |
("Total HT", 170)
|
121 |
]
|
|
|
205 |
]
|
206 |
|
207 |
for section_title, keyword in sections:
|
208 |
+
# Get items for this section
|
209 |
items = [i for i in data.items if keyword in i.description]
|
210 |
+
# Only draw section if it has items
|
211 |
+
if items:
|
212 |
+
draw_section_header2(section_title)
|
213 |
+
for item in items:
|
214 |
+
draw_item_row(item, indent=(keyword != "lfflflflf"))
|
215 |
|
216 |
# NB box with text
|
217 |
nb_box_width = 200
|
app/templates/index.html
CHANGED
@@ -145,7 +145,7 @@
|
|
145 |
.modal-header {
|
146 |
background-color: var(--primary-color);
|
147 |
color: white;
|
148 |
-
border-radius: var(--border-radius) var(--border-radius) 0 0;
|
149 |
}
|
150 |
|
151 |
.btn-close {
|
@@ -223,6 +223,10 @@
|
|
223 |
<label for="clientAddress" class="form-label">Adresse</label>
|
224 |
<input type="text" class="form-control" id="clientAddress" required>
|
225 |
</div>
|
|
|
|
|
|
|
|
|
226 |
<div class="mb-3">
|
227 |
<label for="plancher" class="form-label">PLANCHER</label>
|
228 |
<input type="text" class="form-control" id="plancher" placeholder="PH RDC" value="PH RDC">
|
@@ -795,6 +799,7 @@
|
|
795 |
client_name: document.querySelector("#clientName").value,
|
796 |
client_phone: document.querySelector("#clientPhone").value,
|
797 |
address: document.querySelector("#clientAddress").value,
|
|
|
798 |
total_ht: parseFloat(document.querySelector("#totalHT").value || 0),
|
799 |
tax: parseFloat(document.querySelector("#tax").value || 0),
|
800 |
total_ttc: parseFloat(document.querySelector("#totalTTC").value || 0),
|
|
|
145 |
.modal-header {
|
146 |
background-color: var(--primary-color);
|
147 |
color: white;
|
148 |
+
border-radius: var(--border-radius) var (--border-radius) 0 0;
|
149 |
}
|
150 |
|
151 |
.btn-close {
|
|
|
223 |
<label for="clientAddress" class="form-label">Adresse</label>
|
224 |
<input type="text" class="form-control" id="clientAddress" required>
|
225 |
</div>
|
226 |
+
<div class="mb-3">
|
227 |
+
<label for="ville" class="form-label">Ville</label>
|
228 |
+
<input type="text" class="form-control" id="ville" required>
|
229 |
+
</div>
|
230 |
<div class="mb-3">
|
231 |
<label for="plancher" class="form-label">PLANCHER</label>
|
232 |
<input type="text" class="form-control" id="plancher" placeholder="PH RDC" value="PH RDC">
|
|
|
799 |
client_name: document.querySelector("#clientName").value,
|
800 |
client_phone: document.querySelector("#clientPhone").value,
|
801 |
address: document.querySelector("#clientAddress").value,
|
802 |
+
ville: document.querySelector("#ville").value,
|
803 |
total_ht: parseFloat(document.querySelector("#totalHT").value || 0),
|
804 |
tax: parseFloat(document.querySelector("#tax").value || 0),
|
805 |
total_ttc: parseFloat(document.querySelector("#totalTTC").value || 0),
|
sql_app.db
CHANGED
Binary files a/sql_app.db and b/sql_app.db differ
|
|