{% extends "base.html" %} {% from "_macros.html" import report_filters with context %} {% block title %}{{ t('Stock vs Invoices') }}{% endblock %} {% block content %}

{{ t('Stock vs Invoices') }}

{{ t('Month-end check: goods invoiced but not yet delivered or received, and the reverse. Clear these before closing so revenue and its cost of goods sold fall in the same month.') }}
{{ report_filters(f, False) }}
{{ t('As of') }} {{ f.date_to }}
{% for key, label, _ in sections %}
{{ t(label) }}
{{ data[key]|length }} {{ t('lines') }}
{% endfor %}
{% for key, label, help in sections %}

{{ t(label) }}

{{ t(help) }}
{% set ns = namespace(value=0, cost=0, curs=[]) %} {% for r in data[key] %} {% set cur = bmap[r.branch_id].currency %} {% set ns.value = ns.value + r.value %}{% set ns.cost = ns.cost + r.cost %}{% if cur not in ns.curs %}{% set ns.curs = ns.curs + [cur] %}{% endif %} {% else %}{% endfor %} {% if data[key] and ns.curs|length == 1 %} {% endif %}
{{ t('Branch') }}{{ t('Document') }}{{ t('Date') }}{{ t('Partner') }}{{ t('Product') }} {{ t('Quantity') }}{{ t('Value') }}{{ t('Estimated cost') }}
{{ bmap[r.branch_id].code }} {% if r.order_id %}{{ r.doc }}{% else %}{{ r.doc }}{% endif %} {{ r.date }}{{ nm({'name_en': r.pname_en, 'name_ar': r.pname_ar}) }} {{ r.pcode or '' }} {{ nm({'name_en': r.prname_en, 'name_ar': r.prname_ar}) }} {{ '%g' % r.qty }} {{ r.uom or '' }} {{ r.value|money(cur) }}{{ r.cost|money(cur) }}
{{ t('Nothing to clear.') }}
{{ t('Total') }}{{ ns.value|money(ns.curs[0]) }}{{ ns.cost|money(ns.curs[0]) }}
{% endfor %}

{{ t('Value is at the document price, excluding VAT. Estimated cost is at today\'s average cost of the branch.') }}

{% endblock %}