45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
from decimal import Decimal
|
|
from django_ledger.models import EstimateModel,EntityModel
|
|
from rich import print
|
|
from datetime import date
|
|
from inventory.models import VatRate
|
|
from inventory.utils import CarFinanceCalculator
|
|
|
|
|
|
def run():
|
|
# estimate = EstimateModel.objects.first()
|
|
# calculator = CarFinanceCalculator(estimate)
|
|
# finance_data = calculator.get_finance_data()
|
|
|
|
# print(finance_data)
|
|
# entity = EntityModel.objects.get(name="ismail")
|
|
# bs_report = entity.get_balance_sheet_statement(
|
|
# to_date=date(2025, 1, 1),
|
|
# save_pdf=False,
|
|
# filepath='./'
|
|
# )
|
|
|
|
# ic_report = entity.get_income_statement(
|
|
# from_date=date(2022, 1, 1),
|
|
# to_date=date(2022, 12, 31),
|
|
# save_pdf=False,
|
|
# filepath='./'
|
|
# )
|
|
|
|
# # print(bs_report)
|
|
# print(ic_report.get_report_data())
|
|
estimate = EstimateModel.objects.first()
|
|
calculator = CarFinanceCalculator(estimate)
|
|
finance_data = calculator.get_finance_data()
|
|
|
|
|
|
invoice_itemtxs = {
|
|
i.get("item_number"): {
|
|
"unit_cost": i.get("total_price"),
|
|
"quantity": i.get("quantity"),
|
|
"total_amount": i.get("total_vat"),
|
|
}
|
|
for i in finance_data.get("cars")
|
|
}
|
|
|
|
print(finance_data) |