52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
from django_ledger.models.invoice import InvoiceModel
|
|
from django_ledger.utils import accruable_net_summary
|
|
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")
|
|
# }
|
|
# invoice = InvoiceModel.objects.first()
|
|
entity = EntityModel.objects.filter(name="ismail").first()
|
|
invoice_qs = InvoiceModel.objects.for_entity(
|
|
entity_slug=entity.slug,
|
|
user_model=entity.admin,
|
|
).unpaid()
|
|
print(accruable_net_summary(invoice_qs)) |