AhmadYarAI commited on
Commit
886a6a9
·
1 Parent(s): dce516f

feat: add invoice creation logic with SQLAlchemy

Browse files
Files changed (1) hide show
  1. api/invoices.py +4 -3
api/invoices.py CHANGED
@@ -64,7 +64,7 @@ def create_invoice(data: InvoiceCreate, db: Session = Depends(get_db)):
64
  }
65
 
66
 
67
- @router.get("/{invoice_id}")
68
  def get_invoice(invoice_id: int, db: Session = Depends(get_db)):
69
  # Look for the invoice and include its items
70
  invoice = db.query(Invoice).filter(Invoice.id == invoice_id).first()
@@ -78,10 +78,11 @@ def get_invoice(invoice_id: int, db: Session = Depends(get_db)):
78
  "clinic": invoice.clinic_name,
79
  "patient": invoice.patient_name,
80
  "total": invoice.total_amount,
 
81
  "items": [
82
  {
83
- "desc": item.description,
84
- "qty": item.quantity,
85
  "price": item.price_per_unit,
86
  "subtotal": item.total_price
87
  } for item in invoice.items
 
64
  }
65
 
66
 
67
+ @router.get("/{invoice_id}")
68
  def get_invoice(invoice_id: int, db: Session = Depends(get_db)):
69
  # Look for the invoice and include its items
70
  invoice = db.query(Invoice).filter(Invoice.id == invoice_id).first()
 
78
  "clinic": invoice.clinic_name,
79
  "patient": invoice.patient_name,
80
  "total": invoice.total_amount,
81
+ "date": invoice.date,
82
  "items": [
83
  {
84
+ "description": item.description,
85
+ "quantity": item.quantity,
86
  "price": item.price_per_unit,
87
  "subtotal": item.total_price
88
  } for item in invoice.items