<odoo>
  <record id="action_report_pipeline" model="ir.actions.report">
        <field name="name">Pipeline Report</field>
        <field name="model">sos_case_diary</field>
        <field name="report_type">qweb-html</field>
        <field name="report_name">sos_sales.report_pipeline</field>
        <field name="report_file">sos_sales.report_pipeline</field>
        <field name="binding_model_id" eval="False"/>
        <field name="binding_type">report</field>
    </record>
<template id="report_pipeline">
    <t t-call="web.html_container">
        <t t-call="web.basic_layout">
        <link rel="stylesheet" href="/sos_inventory/static/src/css/style.css?v=7" />
         <div class="page">


                <br/>
                <div style="box-shadow: 0px 8px 24px rgba(27, 46, 94, 0.12) !important;
    padding: 12px;
    border: solid 1px #ccc;
    border-radius: 20px;">
<h6 style="text-align:center">PIPELINE REPORT</h6>
<div style="text-align:right; font-size:14px; margin-bottom:5px;">
<t t-if="from_date or to_date">
    <div>
        <p><b>Report Period : From</b> <t t-esc="from_date or 'N/A'"/> <b>To</b> <t t-esc="to_date or 'N/A'"/>.</p>
    </div>
</t>
    <b>Report generated on : </b> <t t-esc="report_generated_on"/>
</div>

  <table class="table_custom display">
    <thead style="background-color: lavender;">
        <tr>
        <th rowspan="2">S.No</th> 
        <th rowspan="2">Quote No</th>
            <th rowspan="2">Customer Name</th>
            <th rowspan="2">Product</th>
            <th rowspan="2">Location</th>
            <th rowspan="2">Sales Executive</th>
            <t t-set="month_count" t-value="len(data_by_month.keys())"/>
            <t t-if="data_by_month">
                <t t-foreach="data_by_month.keys()" t-as="month_year">
                    <th><t t-esc="month_year"/></th>
                </t>
            </t>
        </tr>
        <tr>
      
        <th style=" line-height: 2px; text-align: center;
    font-weight: normal;
    font-size: smaller;" t-att-colspan="month_count">Expected Order Value(In Lacs)</th>
        </tr>
    </thead>
<tbody>
  <t t-if="data_by_month">
   <t t-set="sno" t-value="1"/>
    <t t-foreach="data_by_month.items()" t-as="month_item">
      <t t-set="month" t-value="month_item[0]"/>
      <t t-set="records" t-value="month_item[1]"/>

      <t t-foreach="records" t-as="record">
        <tr>
        <td><t t-esc="sno"/></td>
        <td><t t-esc="record['quote_no']"/></td>
        <td><a t-att-href="'/web#id=%d&amp;model=sos_case_diary&amp;view_type=form' % record['record_id']" target="_blank">
    <t t-esc="record['customer_name']"/>
    <t t-if="record['end_customer_name']">/<t t-esc="record['end_customer_name']"/></t>
  </a></td>
            <td><t t-esc="record['products']"/></td>
           <td><t t-esc="record['customer_city']"/></td>
          <td><t t-esc="record['sales_person']"/></td>

          <t t-foreach="data_by_month.keys()" t-as="month_col">
            <td>
              <t t-if="month == month_col">
                <t t-esc="'₹ {:.2f}'.format(record['proposal_value'])"/>
              </t>
            </td>
          </t>
        </tr>
          <t t-set="sno" t-value="sno + 1"/>
      </t>
    </t>
  </t>
  <t t-if="totals_by_month">
    <tr>
        <td colspan="6" style="text-align:right; font-weight:bold;">Total</td>
        <t t-foreach="data_by_month.keys()" t-as="month_col">
            <td style="font-weight:bold;">
                <t t-esc="'₹ {:.2f}'.format(totals_by_month.get(month_col, 0.0))"/>
            </td>
        </t>
    </tr>
</t>

</tbody>




</table>





</div>
</div>
</t>
</t>
</template>


</odoo>
