Spaces:
Sleeping

doluong6 commited on
Commit
2a0a511
·
verified ·
1 Parent(s): df5fac6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -1
app.py CHANGED
@@ -480,4 +480,40 @@ def doanh_thu_theo_thang():
480
  return doanh_thu
481
 
482
  except Exception as e:
483
- return {"error": str(e)}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
480
  return doanh_thu
481
 
482
  except Exception as e:
483
+ return {"error": str(e)}
484
+ @app.get("/doanh_thu_noi_bo")
485
+ def doanh_thu_noi_bo():
486
+ # Tải file từ dataset
487
+ file_path = hf_hub_download(
488
+ repo_id="doluong6/Quatest1",
489
+ filename="Theo doi DTNB & DT 2025.xlsx",
490
+ repo_type="dataset"
491
+ )
492
+
493
+ df = pd.read_excel(file_path, sheet_name="Nội bộ", header=None)
494
+
495
+ data = []
496
+ tong_chuyen_den = 0
497
+ tong_chuyen_di = 0
498
+
499
+ for row in df.itertuples(index=False):
500
+ phong = str(row[1]).strip() if len(row) > 6 else None # Cột B
501
+ chuyen_den = row[5] if isinstance(row[5], (int, float)) else 0 # Cột F
502
+ chuyen_di = row[6] if isinstance(row[6], (int, float)) else 0 # Cột G
503
+
504
+ if phong and phong != "None" and row[0] >= 4:
505
+ data.append({
506
+ "Phòng": phong,
507
+ "Chuyển đến": chuyen_den,
508
+ "Chuyển đi": chuyen_di
509
+ })
510
+ tong_chuyen_den += chuyen_den
511
+ tong_chuyen_di += chuyen_di
512
+
513
+ return {
514
+ "data": data,
515
+ "tong": {
516
+ "Tổng chuyển đến": tong_chuyen_den,
517
+ "Tổng chuyển đi": tong_chuyen_di
518
+ }
519
+ }