project budget updated

This commit is contained in:
2024-11-20 12:04:02 +03:00
parent 48682b1914
commit 0b3e0c299c
26 changed files with 742 additions and 310 deletions

View File

@@ -650,3 +650,99 @@ class AccountRecords(CrudCollection):
# )
# )
# print("is all dues_type", payment_dict["dues_type"], paid_value)
class AccountRecordDecisionPaymentClosed(CrudCollection):
__tablename__ = "account_record_decision_payment_closed"
__exclude__fields__ = []
arc_currency: Mapped[str] = mapped_column(
String(5), nullable=False, comment="Unit of Currency"
)
arc_processing_time: Mapped[TIMESTAMP] = mapped_column(
TIMESTAMP, nullable=False, comment="Processing Time"
)
arc_currency_value: Mapped[float] = mapped_column(
Numeric(20, 6), nullable=False, comment="Currency Value"
)
decision_book_budgets_id: Mapped[int] = mapped_column(
ForeignKey("decision_book_budgets.id"), nullable=True
)
decision_book_budgets_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Budget UUID"
)
build_decision_book_payment_id: Mapped[int] = mapped_column(
ForeignKey("build_decision_book_payments.id")
)
build_decision_book_payment_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Build Decision Book Payment UU ID"
)
account_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"))
account_records_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Account Record UU ID"
)
__table_args__ = (
Index(
"_account_record_decision_payment_closed_ndx_00",
account_records_id,
build_decision_book_payment_id,
arc_processing_time,
),
Index(
"_account_record_decision_payment_closed_ndx_01",
build_decision_book_payment_id,
account_records_id,
arc_processing_time,
),
{"comment": "Account Record Decision Payment Closed Information"},
)
class AccountRecordExchanges(CrudCollection):
__tablename__ = "account_record_exchanges"
__exclude__fields__ = []
are_currency: Mapped[str] = mapped_column(
String(5), nullable=False, comment="Unit of Currency"
)
are_exchange_rate: Mapped[float] = mapped_column(
Numeric(18, 6), nullable=False, server_default="1"
)
usd_exchange_rate_value: Mapped[float] = mapped_column(
Numeric(18, 6),
nullable=True,
server_default="0",
comment="It will be written by multiplying the usd exchange rate with the current value result.",
)
eur_exchange_rate_value: Mapped[float] = mapped_column(
Numeric(18, 6),
nullable=True,
server_default="0",
comment="It will be written by multiplying the eur exchange rate with the current value result.",
)
gbp_exchange_rate_value: Mapped[float] = mapped_column(
Numeric(18, 6),
nullable=True,
server_default="0",
comment="It will be written by multiplying the gpd exchange rate with the current value result.",
)
cny_exchange_rate_value: Mapped[float] = mapped_column(
Numeric(18, 6),
nullable=True,
server_default="0",
comment="It will be written by multiplying the cny exchange rate with the current value result.",
)
account_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"))
account_records_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Account Record UU ID"
)
__table_args__ = (
Index("_account_record_exchanges_ndx_00", account_records_id),
{"comment": "Account Record Exchanges Information"},
)

View File

@@ -0,0 +1,157 @@
from sqlalchemy import (
String,
ForeignKey,
Index,
SmallInteger,
Boolean,
TIMESTAMP,
Text,
Numeric,
Integer,
)
from sqlalchemy.orm import mapped_column, Mapped, relationship
from databases.sql_models.core_mixin import CrudCollection
class DecisionBookBudgetBooks(CrudCollection):
__tablename__ = "decision_book_budget_books"
__exclude__fields__ = []
country: Mapped[str] = mapped_column(String, nullable=False)
branch_type: Mapped[int] = mapped_column(SmallInteger, server_default="0")
company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"), nullable=False)
company_uu_id: Mapped[str] = mapped_column(String, nullable=False)
branch_id: Mapped[int] = mapped_column(ForeignKey("companies.id"), nullable=True)
branch_uu_id: Mapped[str] = mapped_column(
String, comment="Branch UU ID", nullable=True
)
build_decision_book_id: Mapped[int] = mapped_column(
ForeignKey("build_decision_book.id"), nullable=False
)
build_decision_book_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Build Decision Book UU ID"
)
__table_args__ = (
Index(
"_decision_book_budget_companies_book_ndx_00",
company_id,
CrudCollection.created_at,
),
{"comment": "budget Book Information"},
)
class DecisionBookBudgetCodes(CrudCollection):
__tablename__ = "decision_book_budget_codes"
__exclude__fields__ = []
budget_code: Mapped[str] = mapped_column(
String(48), nullable=False, comment="budget Code"
)
comment_line: Mapped[str] = mapped_column(
Text, nullable=False, comment="Comment Line"
)
build_decision_book_id: Mapped[int] = mapped_column(
ForeignKey("build_decision_book.id"), nullable=True
)
build_decision_book_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Build Decision Book UU ID"
)
build_parts_id: Mapped[int] = mapped_column(
ForeignKey("build_parts.id"), nullable=True
)
build_parts_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Build Parts UU ID"
)
company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"), nullable=True)
company_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Company UU ID"
)
__table_args__ = (
Index("_decision_book_budget_codes_ndx_00", budget_code, "created_at"),
Index("_decision_book_budget_codes_ndx_01", company_id, "created_at"),
{"comment": "budget Book Information"},
)
class DecisionBookBudgetMaster(CrudCollection):
__tablename__ = "decision_book_budget_master"
__exclude__fields__ = []
budget_type: Mapped[str] = mapped_column(
String(50), nullable=False
) # Bütçe tipi (örneğin: Operasyonel, Yatırım)
currency: Mapped[str] = mapped_column(
String(8), server_default="TRY"
) # Bütçe para birimi
total_budget: Mapped[float] = mapped_column(
Numeric(10, 2), nullable=False
) # Toplam bütçe
tracking_period_id: Mapped[int] = mapped_column(
ForeignKey("api_enum_dropdown.id"), nullable=True
)
tracking_period_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Part Direction UUID"
)
budget_books_id: Mapped[int] = mapped_column(
Integer, ForeignKey("decision_book_budget_books.id"), nullable=False
)
budget_books_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Budget Books UU ID"
)
department_id: Mapped[int] = mapped_column(
Integer, ForeignKey("departments.id"), nullable=False
) # Departman ile ilişki
department_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Department UU ID"
)
__table_args__ = ({"comment": "budget Book Information"},)
class DecisionBookBudgets(CrudCollection):
__tablename__ = "decision_book_budgets"
__exclude__fields__ = []
process_date: Mapped[TIMESTAMP] = mapped_column(
TIMESTAMP, nullable=False
) # Başlangıç tarihi
budget_codes_id: Mapped[int] = mapped_column(
Integer, ForeignKey("decision_book_budget_codes.id"), nullable=False
)
total_budget: Mapped[float] = mapped_column(
Numeric(10, 2), nullable=False
) # Toplam bütçe
used_budget: Mapped[float] = mapped_column(
Numeric(10, 2), nullable=False, default=0.0
) # Kullanılan bütçe
remaining_budget: Mapped[float] = mapped_column(
Numeric(10, 2), nullable=False, default=0.0
) # Kullanılan bütçe
decision_book_budget_master_id: Mapped[int] = mapped_column(
Integer, ForeignKey("decision_book_budget_master.id"), nullable=False
)
decision_book_budget_master_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Decision Book Budget Master UU ID"
)
__table_args__ = (
Index(
"_decision_book_budgets_ndx_00",
decision_book_budget_master_uu_id,
process_date,
),
{"comment": "budget Book Information"},
)

View File

@@ -549,6 +549,7 @@ class BuildLivingSpace(CrudCollection):
occupant_type_uu_id: Mapped[str] = mapped_column(
String, nullable=False, comment="Occupant Type UUID"
)
__table_args__ = (
{"comment": "Living Space inside building parts that are related to people"},
)
@@ -574,7 +575,6 @@ class BuildLivingSpace(CrudCollection):
).data
related_service = Services.filter_by_one(
related_responsibility=occupant_type.occupant_code,
**Services.valid_record_dict,
).data
created_living_space.save_and_confirm()

View File

@@ -883,14 +883,14 @@ class BuildDecisionBookPayments(CrudCollection):
String, nullable=False, comment="Build Part UUID"
)
budget_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"), nullable=True)
budget_records_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Budget UUID"
)
accounting_id: Mapped[int] = mapped_column(ForeignKey("account_detail.id"), nullable=True)
accounting_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Accounting UUID"
)
# budget_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"), nullable=True)
# budget_records_uu_id: Mapped[str] = mapped_column(
# String, nullable=True, comment="Budget UUID"
# )
# accounting_id: Mapped[int] = mapped_column(ForeignKey("account_detail.id"), nullable=True)
# accounting_uu_id: Mapped[str] = mapped_column(
# String, nullable=True, comment="Accounting UUID"
# )
# receive_debit_id: Mapped[int] = mapped_column(ForeignKey("api_enum_dropdown.id"), nullable=True)
# receive_debit_uu_id: Mapped[str] = mapped_column(String, nullable=True, comment="Debit UUID")
@@ -920,11 +920,6 @@ class BuildDecisionBookPayments(CrudCollection):
process_date,
unique=True,
),
Index(
"build_decision_book_payments_detail_ndx_01",
budget_records_id,
process_date,
),
{"comment": "Payment Details of Decision Book Payments"},
)
@@ -1201,13 +1196,6 @@ class BuildDecisionBookProjectPerson(CrudCollection):
String, nullable=True, comment="Living Space UUID"
)
project_team_type_id: Mapped[int] = mapped_column(
ForeignKey("api_enum_dropdown.id"), nullable=True
)
project_team_type_uu_id: Mapped[str] = mapped_column(
String, nullable=True, comment="Management Type UUID"
)
__table_args__ = (
{"comment": "People that are attended to building project meetings."},
)
@@ -1245,6 +1233,7 @@ class BuildDecisionBookProjectItems(CrudCollection):
{"comment": "Project Items related to decision taken at building meetings"},
)
#
# class BuildDecisionBookPaymentsMaster(CrudCollection):
# """