
{% extends 'base.html' %}
{% load static %}
{% block title %}
  Search Transactions
{% endblock %}

{% block extra_css %}
  <link rel="stylesheet" href="{% static 'CSS/search_income_expences_transaction.css' %}">
{% endblock %}

{% block head %}
  Search Sales Report
{% endblock %}

{% block header %}
  Search Transactions by Date
{% endblock %}

{% block content %}
  <form method="GET">
    <label>Select Date:</label>
    <input type="date" name="date" value="{{ date }}" />
    <button type="submit">Search</button>
  </form>

  {% if transactions %}
    <h3>RESULT FOR: {{ date }}</h3>

    <p>
      <b>Total Soda Sold:</b> {{ total_soda_sold }}
    </p>
    <p>
      <b>Total Water Sold:</b> {{ total_water_sold }}
    </p>
    <p>
      <b>Total Income:</b> {{ total_price }} TZS
    </p>
    <p>
      <b>Total Expenditure:</b> {{ total_expenditure }} TZS
    </p>
    <p>
      <b>Cash Amount:</b> {{ cash_amount }} TZS
    </p>

    <h3>Transaction Details</h3>
    <table border="1">
      <tr>
    
        <th>Car_id</th>
        <th>Soda</th>
        <th>Water</th>
        <th>total_price</th>
        <th>Date</th>
      </tr>
      {% for t in transactions %}
        <tr>
       
          <td>{{ t.car_id }}</td>
          <td>{{ t.soda_amount }}</td>
          <td>{{ t.water_amount }}</td>
          <td>{{ t.total_price }}</td>
          <td>{{ t.created_on }}</td>
        </tr>
      {% endfor %}
    </table>
  {% else %}
    <p>Please Search For Relevant Date Data.</p>
  {% endif %}
{% endblock %}
