<commit_before>{% extends 'admin/base.twig' %}

{% block content %}
    {% include 'cudi/admin/sale/financial/partials/navigation.twig' %}

    {% include 'cudi/admin/sale/financial/sold/partials/years.twig' %}

    {% include 'cudi/admin/sale/financial/sold/partials/navigation.twig' %}

    {% include 'admin/partials/flashMessenger.twig' %}

    <div id="controller_action">
        <h1>Article</h1>
        <p>Title: <b>{{ article.getMainArticle().getTitle() }}</b></p>
        <p>Author: <b>{{ article.getMainArticle().getAuthors() }}</b></p>
        <p>Publisher: <b>{{ article.getMainArticle().getPublishers() }}</b></p>
        <p>Barcode: <b>{{ article.getBarcode() }}</b></p>
        <p>Purchase Price: <b>&euro; {{ (article.getPurchasePrice()/100)|number_format(2) }}</b></p>
        <p>Sell Price: <b>&euro; {{ (article.getSellPrice()/100)|number_format(2) }}</b></p>
        <p>Article Type: <b>{{ article.getMainArticle().getType()|capitalize }}</b></p>
        <p>&nbsp;</p>

        {% if organizations|length > 1 %}<h2>Total</h2>{% endif %}
        <p>Number Sold: <b>{{ article.getNumberSold(activeAcademicYear) }}</b></p>
        <p>Number Sold to Members: <b>{{ article.getNumberSoldToMembers(activeAcademicYear) }}</b></p>
        <p>Number Sold with Discount: <b>{{ article.getNumberSoldWithDiscount(activeAcademicYear, 'member') }} Member/{{ article.getNumberSoldWithDiscount(activeAcademicYear, 'acco') }} Acco</b></p>
        <p>Total Purchase: <b>&euro; {{ (article.getNumberSold(activeAcademicYear)*article.getPurchasePrice()/100)|number_format(2) }}</b></p>
        <p>Total Revenue: <b>&euro; {{ (article.getTotalRevenue(activeAcademicYear)/100)|number_format(2) }}</b></p>

        {% if organizations|length > 1 %}
            {% set otherSold = article.getNumberSold(activeAcademicYear) %}
            {% set otherSoldToMembers = article.getNumberSoldToMembers(activeAcademicYear) %}
            {% set otherSoldWithDiscount_member = article.getNumberSoldWithDiscount(activeAcademicYear, 'member') %}
            {% set otherSoldWithDiscount_acco = article.getNumberSoldWithDiscount(activeAcademicYear, 'acco') %}
            {% set otherPurchased = article.getNumberSold(activeAcademicYear)*article.getPurchasePrice() %}
            {% set otherRevenue = article.getTotalRevenue(activeAcademicYear) %}

            {% for organization in organizations %}
                {% set otherSold = otherSold - article.getNumberSold(activeAcademicYear, organization) %}
                {% set otherSoldToMembers = otherSoldToMembers - article.getNumberSoldToMembers(activeAcademicYear, organization) %}
                {% set otherSoldWithDiscount_member = otherSoldWithDiscount_member - article.getNumberSoldWithDiscount(activeAcademicYear, 'member', organization) %}
                {% set otherSoldWithDiscount_acco = otherSoldWithDiscount_acco - article.getNumberSoldWithDiscount(activeAcademicYear, 'acco', organization) %}
                {% set otherPurchased = otherPurchased - article.getNumberSold(activeAcademicYear, organization)*article.getPurchasePrice() %}
                {% set otherRevenue = otherRevenue - article.getTotalRevenue(activeAcademicYear, organization) %}

                <h2>{{ organization.getName() }}</h2>
                <p>Number Sold: <b>{{ article.getNumberSold(activeAcademicYear, organization) }}</b></p>
                <p>Number Sold to Members: <b>{{ article.getNumberSoldToMembers(activeAcademicYear, organization) }}</b></p>
                <p>Number Sold with Discount: <b>{{ article.getNumberSoldWithDiscount(activeAcademicYear, 'member', organization) }} Member/{{ article.getNumberSoldWithDiscount(activeAcademicYear, 'acco', organization) }} Acco</b></p>
                <p>Total Purchase: <b>&euro; {{ (article.getNumberSold(activeAcademicYear, organization)*article.getPurchasePrice()/100)|number_format(2) }}</b></p>
                <p>Total Revenue: <b>&euro; {{ (article.getTotalRevenue(activeAcademicYear, organization)/100)|number_format(2) }}</b></p>
            {% endfor %}

            {% if otherOrganizationEnabled %}
                <h2>Other Organizations</h2>
                <p>Number Sold: <b>{{ otherSold }}</b></p>
                <p>Number Sold to Members: <b>{{ otherSoldToMembers }}</b></p>
                <p>Number Sold with Discount: <b>{{ otherSoldWithDiscount_member }} Member/{{ otherSoldWithDiscount_acco }} Acco</b></p>
                <p>Total Purchase: <b>&euro; {{ (otherPurchased/100)|number_format(2) }}</b></p>
                <p>Total Revenue: <b>&euro; {{ (otherRevenue/100)|number_format(2) }}</b></p>
            {% endif %}
        {% endif %}
        <br />

        <div id="sold_search" style="display:none;">
            <div style="padding:4px;text-align:right">
                Search:
                <select id="searchField">
                    <option value="person">Person</option>
                    <option value="organization">Organization</option>
                    <option value="discount">Discount</option>
                </select>
                is
                <input type="text" id="searchString" size="30" />
                <select id="searchStringOrganization" style="display: none">
                    {% for organization in organizations %}
                        <option value="organization-{{ organization.getId() }}">{{ organization.getName() }}</option>
                    {% endfor %}
                    <option value="organization-0">Other</option>
                </select>
            </div>

            <table class="full_width manage">
                <tr>
                    <th width="100px">Date</th>
                    <th width="100px">Sale Session</th>
                    <th>Person</th>
                    <th width="70px">Org.</th>
                    <th width="80px">Number</th>
                    <th width="70px">Sell Price</th>
                    <th width="70px">Discount</th>
                    <th width="70px" class="wider">Sale Type</th>
                </tr>
            </table>
        </div>

        <div id="default_page">
            <table class="full_width manage">
                <tr>
                    <th width="100px">Date</th>
                    <th width="100px">Sale Session</th>
                    <th>Person</th>
                    <th width="70px">Org.</th>
                    <th width="80px">Number</th>
                    <th width="70px">Sell Price</th>
                    <th width="70px">Discount</th>
                    <th width="70px" class="wider">Sale Type</th>
                </tr>

                {% for item in paginator %}
                    <tr class="item">
                        <td>{{ item.getTimestamp().format('d/m/Y H:i') }}</td>
                        <td>{{ item.getSession().getOpenDate().format('d/m/Y H:i') }}</td>
                        <td>{% if item.getType() == 'regular' %}{{ item.getPerson().getFullName() }}{% else %}{{ item.getPerson() }}{% endif %}</td>
                        <td>{{ item.getPerson().getOrganization(item.getSession().getAcademicYear()).getName() }}</td>
                        <td>{{ item.getNumber() }}</td>
                        <td>&euro; {{ (item.getPrice()/100)|number_format(2) }}</td>
                        <td>{{ item.getDiscountType() }}</td>
                        <td class="wider">{{ item.getType()|capitalize }}</td>
                    </tr>
                {% endfor %}
            </table>

            {% include 'admin/partials/paginationControl.twig' %}
        </div>
    </div>
{% endblock %}

{% block content_script %}
    <script type="text/javascript">
        $(document).ready(function () {
            $('#searchStringOrganization').change(function (e) {
                $('#searchString').val($('#searchStringOrganization').val()).trigger('keyup');
            });

            $('#searchField').change(function (e) {
                if ($(this).val() == 'organization') {
                    $('#searchString').hide();
                    $('#searchStringOrganization').show().change();
                } else {
                    $('#searchString').show();
                    $('#searchStringOrganization').hide();
                }<commit_msg>add payment method to financial, article overview<commit_after>{% extends 'admin/base.twig' %}

{% block content %}
    {% include 'cudi/admin/sale/financial/partials/navigation.twig' %}

    {% include 'cudi/admin/sale/financial/sold/partials/years.twig' %}

    {% include 'cudi/admin/sale/financial/sold/partials/navigation.twig' %}

    {% include 'admin/partials/flashMessenger.twig' %}

    <div id="controller_action">
        <h1>Article</h1>
        <p>Title: <b>{{ article.getMainArticle().getTitle() }}</b></p>
        <p>Author: <b>{{ article.getMainArticle().getAuthors() }}</b></p>
        <p>Publisher: <b>{{ article.getMainArticle().getPublishers() }}</b></p>
        <p>Barcode: <b>{{ article.getBarcode() }}</b></p>
        <p>Purchase Price: <b>&euro; {{ (article.getPurchasePrice()/100)|number_format(2) }}</b></p>
        <p>Sell Price: <b>&euro; {{ (article.getSellPrice()/100)|number_format(2) }}</b></p>
        <p>Article Type: <b>{{ article.getMainArticle().getType()|capitalize }}</b></p>
        <p>&nbsp;</p>

        {% if organizations|length > 1 %}<h2>Total</h2>{% endif %}
        <p>Number Sold: <b>{{ article.getNumberSold(activeAcademicYear) }}</b></p>
        <p>Number Sold to Members: <b>{{ article.getNumberSoldToMembers(activeAcademicYear) }}</b></p>
        <p>Number Sold with Discount: <b>{{ article.getNumberSoldWithDiscount(activeAcademicYear, 'member') }} Member/{{ article.getNumberSoldWithDiscount(activeAcademicYear, 'acco') }} Acco</b></p>
        <p>Total Purchase: <b>&euro; {{ (article.getNumberSold(activeAcademicYear)*article.getPurchasePrice()/100)|number_format(2) }}</b></p>
        <p>Total Revenue: <b>&euro; {{ (article.getTotalRevenue(activeAcademicYear)/100)|number_format(2) }}</b></p>

        {% if organizations|length > 1 %}
            {% set otherSold = article.getNumberSold(activeAcademicYear) %}
            {% set otherSoldToMembers = article.getNumberSoldToMembers(activeAcademicYear) %}
            {% set otherSoldWithDiscount_member = article.getNumberSoldWithDiscount(activeAcademicYear, 'member') %}
            {% set otherSoldWithDiscount_acco = article.getNumberSoldWithDiscount(activeAcademicYear, 'acco') %}
            {% set otherPurchased = article.getNumberSold(activeAcademicYear)*article.getPurchasePrice() %}
            {% set otherRevenue = article.getTotalRevenue(activeAcademicYear) %}

            {% for organization in organizations %}
                {% set otherSold = otherSold - article.getNumberSold(activeAcademicYear, organization) %}
                {% set otherSoldToMembers = otherSoldToMembers - article.getNumberSoldToMembers(activeAcademicYear, organization) %}
                {% set otherSoldWithDiscount_member = otherSoldWithDiscount_member - article.getNumberSoldWithDiscount(activeAcademicYear, 'member', organization) %}
                {% set otherSoldWithDiscount_acco = otherSoldWithDiscount_acco - article.getNumberSoldWithDiscount(activeAcademicYear, 'acco', organization) %}
                {% set otherPurchased = otherPurchased - article.getNumberSold(activeAcademicYear, organization)*article.getPurchasePrice() %}
                {% set otherRevenue = otherRevenue - article.getTotalRevenue(activeAcademicYear, organization) %}

                <h2>{{ organization.getName() }}</h2>
                <p>Number Sold: <b>{{ article.getNumberSold(activeAcademicYear, organization) }}</b></p>
                <p>Number Sold to Members: <b>{{ article.getNumberSoldToMembers(activeAcademicYear, organization) }}</b></p>
                <p>Number Sold with Discount: <b>{{ article.getNumberSoldWithDiscount(activeAcademicYear, 'member', organization) }} Member/{{ article.getNumberSoldWithDiscount(activeAcademicYear, 'acco', organization) }} Acco</b></p>
                <p>Total Purchase: <b>&euro; {{ (article.getNumberSold(activeAcademicYear, organization)*article.getPurchasePrice()/100)|number_format(2) }}</b></p>
                <p>Total Revenue: <b>&euro; {{ (article.getTotalRevenue(activeAcademicYear, organization)/100)|number_format(2) }}</b></p>
            {% endfor %}

            {% if otherOrganizationEnabled %}
                <h2>Other Organizations</h2>
                <p>Number Sold: <b>{{ otherSold }}</b></p>
                <p>Number Sold to Members: <b>{{ otherSoldToMembers }}</b></p>
                <p>Number Sold with Discount: <b>{{ otherSoldWithDiscount_member }} Member/{{ otherSoldWithDiscount_acco }} Acco</b></p>
                <p>Total Purchase: <b>&euro; {{ (otherPurchased/100)|number_format(2) }}</b></p>
                <p>Total Revenue: <b>&euro; {{ (otherRevenue/100)|number_format(2) }}</b></p>
            {% endif %}
        {% endif %}
        <br />

        <div id="sold_search" style="display:none;">
            <div style="padding:4px;text-align:right">
                Search:
                <select id="searchField">
                    <option value="person">Person</option>
                    <option value="organization">Organization</option>
                    <option value="discount">Discount</option>
                </select>
                is
                <input type="text" id="searchString" size="30" />
                <select id="searchStringOrganization" style="display: none">
                    {% for organization in organizations %}
                        <option value="organization-{{ organization.getId() }}">{{ organization.getName() }}</option>
                    {% endfor %}
                    <option value="organization-0">Other</option>
                </select>
            </div>

            <table class="full_width manage">
                <tr>
                    <th width="100px">Date</th>
                    <th width="100px">Sale Session</th>
                    <th>Person</th>
                    <th width="70px">Org.</th>
                    <th width="80px">Number</th>
                    <th width="70px">Sell Price</th>
                    <th width="70px">Discount</th>
                    <th width="70px" class="wider">Sale Type</th>
                    <th width="100px" class="wider">Payment Type</th>
                </tr>
            </table>
        </div>

        <div id="default_page">
            <table class="full_width manage">
                <tr>
                    <th width="100px">Date</th>
                    <th width="100px">Sale Session</th>
                    <th>Person</th>
                    <th width="70px">Org.</th>
                    <th width="80px">Number</th>
                    <th width="70px">Sell Price</th>
                    <th width="70px">Discount</th>
                    <th width="70px" class="wider">Sale Type</th>
                    <th width="100px" class="wider">Payment Type</th>
                </tr>

                {% for item in paginator %}
                    <tr class="item">
                        <td>{{ item.getTimestamp().format('d/m/Y H:i') }}</td>
                        <td>{{ item.getSession().getOpenDate().format('d/m/Y H:i') }}</td>
                        <td>{% if item.getType() == 'regular' %}{{ item.getPerson().getFullName() }}{% else %}{{ item.getPerson() }}{% endif %}</td>
                        <td>{{ item.getPerson().getOrganization(item.getSession().getAcademicYear()).getName() }}</td>
                        <td>{{ item.getNumber() }}</td>
                        <td>&euro; {{ (item.getPrice()/100)|number_format(2) }}</td>
                        <td>{{ item.getDiscountType() }}</td>
                        <td class="wider">{{ item.getType()|capitalize }}</td>
                        <td class="wider">{{ item.getQueueItem().getPayMethod() }}</td>
                    </tr>
                {% endfor %}
            </table>

            {% include 'admin/partials/paginationControl.twig' %}
        </div>
    </div>
{% endblock %}

{% block content_script %}
    <script type="text/javascript">
        $(document).ready(function () {
            $('#searchStringOrganization').change(function (e) {
                $('#searchString').val($('#searchStringOrganization').val()).trigger('keyup');
            });

            $('#searchField').change(function (e) {
                if ($(this).val() == 'organization') {
                    $('#searchString').hide();
                    $('#searchStringOrganization').show().change();
                } else {
                    $('#searchString').show();
                    $('#searchStringOrganization').hide();
                }
{'fraction_non_alphanumeric': 0.16740114340161982, 'fraction_numerical': 0.010123868508813721, 'mean_word_length': 2.2747659906396254, 'pattern_counts': {'":': 0, '<': 371, '<?xml version=': 0, '>': 375, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '421566', 'n_tokens_mistral': 5261, 'n_tokens_neox': 4716, 'n_words': 780}