endi.compute package¶
Subpackages¶
- endi.compute.price_study package
- Submodules
- endi.compute.price_study.ht_mode module
- endi.compute.price_study.supplier_ht_mode module
ProductSupplierHtComputerWorkItemSupplierHtComputerWorkItemSupplierHtComputer.full_cost_price()WorkItemSupplierHtComputer.full_flat_cost()WorkItemSupplierHtComputer.full_intermediate_price()WorkItemSupplierHtComputer.full_price_with_contribution()WorkItemSupplierHtComputer.full_price_with_insurance()WorkItemSupplierHtComputer.get_margin_rate()WorkItemSupplierHtComputer.work_unit_flat_cost()
- Module contents
- endi.compute.sage package
- Submodules
- endi.compute.sage.base module
- endi.compute.sage.expense module
BaseSageExpenseContributionExpenseExportProducerSageExpenseBaseSageExpenseBase.code_journalSageExpenseBase.company_nameSageExpenseBase.dateSageExpenseBase.get_line_libelle()SageExpenseBase.libelleSageExpenseBase.num_analytiqueSageExpenseBase.num_endiSageExpenseBase.num_feuilleSageExpenseBase.set_expense()SageExpenseBase.static_columnsSageExpenseBase.user_nameSageExpenseBase.variable_columns
SageExpenseMain
- endi.compute.sage.expense_payment module
ExpensePaymentExportProducerExpensePaymentExportProducer.get_book_entries()ExpensePaymentExportProducer.get_item_book_entries()ExpensePaymentExportProducer.get_modules()ExpensePaymentExportProducer.main_module_factoryExpensePaymentExportProducer.use_analyticExpensePaymentExportProducer.use_generalExpensePaymentExportProducer.waiver_module_factory
SageExpensePaymentMainSageExpensePaymentMain.code_journalSageExpensePaymentMain.code_taxeSageExpensePaymentMain.credit_bank()SageExpensePaymentMain.dateSageExpensePaymentMain.debit_user()SageExpensePaymentMain.libelleSageExpensePaymentMain.modeSageExpensePaymentMain.num_analytiqueSageExpensePaymentMain.referenceSageExpensePaymentMain.set_payment()SageExpensePaymentMain.static_columnsSageExpensePaymentMain.variable_columnsSageExpensePaymentMain.yield_entries()
SageExpensePaymentWaiver
- endi.compute.sage.invoice module
BaseInvoiceBookEntryFactoryBaseInvoiceBookEntryFactory.code_journalBaseInvoiceBookEntryFactory.company_nameBaseInvoiceBookEntryFactory.customer_labelBaseInvoiceBookEntryFactory.dateBaseInvoiceBookEntryFactory.libelleBaseInvoiceBookEntryFactory.num_endiBaseInvoiceBookEntryFactory.set_invoice()BaseInvoiceBookEntryFactory.static_columnsBaseInvoiceBookEntryFactory.task_nameBaseInvoiceBookEntryFactory.variable_columns
CustomBookEntryFactoryInternalCustomBookEntryFactoryInternalInvoiceExportProducerInternalSageFacturationInvoiceExportGroupperInvoiceExportProducerSageFacturationSageInvoiceSageRGClientSageRGInterne
- endi.compute.sage.payment module
InternalPaymentExportProducerInternalSagePaymentMainPaymentExportGroupperPaymentExportProducerSagePaymentBaseSagePaymentBase.code_journalSagePaymentBase.company_nameSagePaymentBase.customer_labelSagePaymentBase.dateSagePaymentBase.libelleSagePaymentBase.modeSagePaymentBase.num_analytiqueSagePaymentBase.referenceSagePaymentBase.set_payment()SagePaymentBase.static_columnsSagePaymentBase.task_nameSagePaymentBase.variable_columns
SagePaymentMainSagePaymentRemittanceSagePaymentTva
- endi.compute.sage.supplier_invoice module
InternalSageSupplierInvoiceMainInternalSupplierInvoiceExportProducerSageSupplierInvoiceSageSupplierInvoiceBaseSageSupplierInvoiceBase.code_journalSageSupplierInvoiceBase.company_nameSageSupplierInvoiceBase.dateSageSupplierInvoiceBase.num_analytiqueSageSupplierInvoiceBase.num_endiSageSupplierInvoiceBase.set_supplier_invoice()SageSupplierInvoiceBase.static_columnsSageSupplierInvoiceBase.supplier_labelSageSupplierInvoiceBase.user_nameSageSupplierInvoiceBase.variable_columns
SageSupplierInvoiceMainSupplierInvoiceExportProducer
- endi.compute.sage.supplier_invoice_payment module
BaseSageSupplierPaymentBaseSageSupplierPayment.code_journalBaseSageSupplierPayment.code_taxeBaseSageSupplierPayment.company_nameBaseSageSupplierPayment.dateBaseSageSupplierPayment.modeBaseSageSupplierPayment.num_analytiqueBaseSageSupplierPayment.num_endiBaseSageSupplierPayment.referenceBaseSageSupplierPayment.set_payment()BaseSageSupplierPayment.static_columnsBaseSageSupplierPayment.supplier_labelBaseSageSupplierPayment.user_nameBaseSageSupplierPayment.variable_columns
BaseSupplierPaymentExportInternalSageSupplierPaymentMainInternalSupplierPaymentExportProducerSageSupplierPaymentMainSageSupplierUserPaymentMainSageSupplierUserPaymentWaiverSupplierPaymentExportProducerSupplierUserPaymentExportProducer
- endi.compute.sage.utils module
- Module contents
- endi.compute.sage_generation_expert package
- Submodules
- endi.compute.sage_generation_expert.compute module
- Module contents
- endi.compute.sale_product package
- Submodules
- endi.compute.sale_product.ht_mode module
- endi.compute.sale_product.supplier_ht_mode module
SaleProductSupplierHtComputerSaleProductSupplierHtComputer.cost_price()SaleProductSupplierHtComputer.flat_cost()SaleProductSupplierHtComputer.get_general_overhead()SaleProductSupplierHtComputer.get_margin_rate()SaleProductSupplierHtComputer.intermediate_price()SaleProductSupplierHtComputer.price_with_contribution()SaleProductSupplierHtComputer.price_with_insurance()SaleProductSupplierHtComputer.unit_ht()SaleProductSupplierHtComputer.unit_ttc()
SaleProductWorkItemSupplierHtComputerSaleProductWorkItemSupplierHtComputer.full_cost_price()SaleProductWorkItemSupplierHtComputer.full_flat_cost()SaleProductWorkItemSupplierHtComputer.full_intermediate_price()SaleProductWorkItemSupplierHtComputer.full_price_with_contribution()SaleProductWorkItemSupplierHtComputer.full_price_with_insurance()SaleProductWorkItemSupplierHtComputer.get_margin_rate()
- endi.compute.sale_product.ttc_mode module
- Module contents
- endi.compute.task package
- Submodules
- endi.compute.task.common module
CommonDiscountLineComputeCommonGroupComputeCommonLineComputeCommonTaskComputeCommonTaskCompute.add_ht_by_tva()CommonTaskCompute.discount_total_ht()CommonTaskCompute.discount_total_ttc()CommonTaskCompute.floor()CommonTaskCompute.get_tvas()CommonTaskCompute.get_tvas_by_product()CommonTaskCompute.groups_total_ht()CommonTaskCompute.groups_total_ttc()CommonTaskCompute.post_ttc_total()CommonTaskCompute.total()CommonTaskCompute.total_due()CommonTaskCompute.total_ht()CommonTaskCompute.total_ht_rate()CommonTaskCompute.total_ttc()CommonTaskCompute.tva_amount()CommonTaskCompute.tva_ht_parts()CommonTaskCompute.tva_native_parts()CommonTaskCompute.tva_ttc_parts()
EstimationComputeInvoiceCompute
- endi.compute.task.task_ht module
DiscountLineComputeGroupComputeLineComputeTaskComputeTaskCompute.expenses_amount()TaskCompute.get_expense_ht()TaskCompute.get_expenses_tva()TaskCompute.get_tvas()TaskCompute.get_tvas_by_product()TaskCompute.no_tva()TaskCompute.total()TaskCompute.total_ht()TaskCompute.total_ttc()TaskCompute.tva_amount()TaskCompute.tva_ht_parts()TaskCompute.tva_native_parts()TaskCompute.tva_ttc_parts()
get_default_tva()
- endi.compute.task.task_ttc module
- Module contents
Submodules¶
endi.compute.base_line module¶
endi.compute.expense module¶
Expense computing tool
- class endi.compute.expense.ExpenseCompute¶
Bases :
object- get_lines(category='0')¶
Return all expense lines (lines and kmlines)
- get_lines_by_type(category='0')¶
Return expense lines grouped by treasury code
- get_total(category=None)¶
- property is_void¶
- kmlines = ()¶
- lines = ()¶
- paid()¶
- payments = ()¶
- topay()¶
- property total¶
- property total_ht¶
- property total_km¶
- property total_tva¶
endi.compute.math_utils module¶
Math utilities used for computing
- endi.compute.math_utils.amount(value, precision=2)¶
Convert a float value as an integer amount to store it in a database :param value: float value to convert :param precision: number of dot translation to make
>>> amount(195.65) 19565
- endi.compute.math_utils.compute_floored_ht_from_ttc(ttc: int, tva_rate: int) int¶
Compute the HT from TTC using the approximative method (multiplication_mode)
- endi.compute.math_utils.compute_genuine_ht_from_ttc(ttc: int, tva_rate: int) int¶
Compute the HT from TTC using the genuine calculation method (division_mode)
- endi.compute.math_utils.compute_ht_from_ttc(ttc, tva_rate, float_format=True, division_mode=False)¶
Compute ht from ttc
This function has two modes :
multiplication (default) : use legal coefficients (lower math precision, rounding in favor of TVA) is based on legal basis rather than math precision. https://bofip.impots.gouv.fr/bofip/1380-PGP.html/identifiant=BOI-TVA-LIQ-10-20140919
division : use division, better math precision, at risk of less reproductable computation and rounding errors. Use it when you want to try reversing a computation that have already been done the other way (HT→TTC) (may not work 100% of cases though).
Results should be used at line level, not at total level, or inconsistencies may arise.
- Eg (pseudo-code):
VALID: total_ht = sum([compute_ht_from_ttc(line.ttc) for line in lines])
INVALID: total_ht = compute_ht_from_ttc(sum([line.ttc for line in lines]))
- Paramètres:
ttc (float) – ttc value in float format (by default)
tva_rate (integer) – the tva rate value in integer format (tva_rate *
100) :param bool float_format: Is ttc in the float format (real ttc value) :param division_mode: Use the division mode
- Renvoie:
the value in integer format or in float format regarding
float_format
- endi.compute.math_utils.compute_ht_from_ttc_in_int(ttc: int, tva_rate: int, division_mode: bool = False) int¶
Compute HT from TTC using the appropriate calculation mode (see below function)
- endi.compute.math_utils.compute_tva(ht, tva_rate)¶
Compute the tva for the given ht
- endi.compute.math_utils.compute_tva_from_ttc(ttc: Union[float, int], tva_rate: int, float_format: bool = True) Union[float, int]¶
This function is based on legal basis rather than math precision https://bofip.impots.gouv.fr/bofip/1380-PGP.html/identifiant=BOI-TVA-LIQ-10-20140919
Results should be used at line level, not at total level, or errors will appear and may cumulate :
- Eg (pseudo-code):
VALID: total_tva = sum([compute_tva_from_ttc(line.ttc) for line in lines])
INVALID: total_tva = compute_tva_from_ttc(sum([line.ttc for line in lines]))
- Paramètres:
ttc – ttc value in float format (by default)
tva_rate – the tva rate value in integer format (tva_rate * 100)
float_format – Is ttc in the float format (real ttc value)
- Renvoie:
the value in integer format or in float format regarding float_format
- endi.compute.math_utils.convert_to_float(value: ~typing.Any, default: ~typing.Any = <endi.compute.math_utils.NullValue object>) float¶
Try to convert the given value object to a float
>>> convert_to_float("15.25") 15.25
- endi.compute.math_utils.convert_to_int(value: ~typing.Any, default: ~typing.Optional[~typing.Any] = <endi.compute.math_utils.NullValue object>) Optional[int]¶
Convert a value to an integer
- Paramètres:
value – The value to convert
default – if provided will be returned if the conversion fails
- Lève:
Usage
>>> convert_to_int("15") 15 >>> convert_to_int("not an int", 15) 15
- endi.compute.math_utils.dec_round(dec, precision, round_floor=False)¶
Return a decimal object rounded to precision
- endi.compute.math_utils.floor(value, round_floor=False)¶
floor a float value :param value: float value to be rounded :param bool round_floor: Should the data be floor rounded ? :return: an integer
>>> floor(296.9999999) 297
- endi.compute.math_utils.floor_to_precision(value: Union[int, float, Decimal], round_floor=False, precision=2, dialect_precision=5) int¶
- floor a value in its int representation:
>>> floor_to_precision(296999) 297000
>>> floor_to_precision(296999, round_floor=True) 296000
amounts are of the form : value * 10 ** dialect_precision it allows to store dialect_precision numbers after comma for intermediary amounts for totals we want precision numbers
- Paramètres:
floatting part of our value
- endi.compute.math_utils.integer_to_amount(value, precision=2, default=<endi.compute.math_utils.NullValue object>) float¶
Convert an integer value to a float with precision numbers after comma
- endi.compute.math_utils.percent(part, total, default=<endi.compute.math_utils.NullValue object>) float¶
Return the percentage of total represented by part if default is provided, the ZeroDivisionError is handled
- endi.compute.math_utils.percentage(value, _percent) int¶
Return the value of the « percent » percent of the original « value » Truncate the result.
>>> percentage(100.1, 50) 50
- endi.compute.math_utils.round(float_, precision, round_floor=False)¶
Return a float object rounded to precision :param float float_: the object to round :param int precision: the number of decimals we want after the comma :param bool round_floor: Should the data be floor rounded ?
- endi.compute.math_utils.str_to_float(value: ~typing.Any, default: ~typing.Any = <endi.compute.math_utils.NullValue object>) float¶
Convert a string to a float cleaning all non numeric information
>>> str_to_float("15dede,25") 15.25
- endi.compute.math_utils.str_to_int(value: ~typing.Any, default=<endi.compute.math_utils.NullValue object>) Optional[int]¶
convert a string to an integer cleaning all non numeric information
Usage
>>> str_to_int("abc12,56") 1256
- endi.compute.math_utils.translate_integer_precision(value, from_precision=5, to_precision=2)¶
Translate an integer value from precision 5 to precision 2
- e.g>>> translate_integer_precision(150111)
… 150
endi.compute.parser module¶
Numeric expression parser
parser = NumericParser() parser.eval(« 2 * 15 / 22 »)
- class endi.compute.parser.NumericStringFloatReducer¶
Bases :
objectReduce a parsed numeric string to a float value
By doing the math!
Expects input in the format of NumericStringParser output.
Eg: transforms [« 1.2 », « + », « 1 »] to 2.2
Does not support brace vars (eg: [« 1.2 » + « {fubar}])
- functions = {'abs': <built-in function abs>, 'round': <built-in function round>, 'trunc': <function NumericStringFloatReducer.<lambda>>}¶
- operators = {'*': <built-in function mul>, '+': <built-in function add>, '-': <built-in function sub>, '/': <built-in function truediv>}¶
endi.compute.supplier_invoice module¶
endi.compute.supplier_order module¶
- class endi.compute.supplier_order.SupplierOrderCompute¶
Bases :
objectHandles numbers as decimal stored as int with 2 decimals.
Attributs utilisés pour le calcul:
lines : SupplierOrderLine[] cae_percentage: int
- class endi.compute.supplier_order.SupplierOrderLineCompute¶
Bases :
BaseLineCompute