title: How to calculate total column value without query by Laravel or php?
body: <p><a href="https://i.stack.imgur.com/cAqCI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cAqCI.png" alt="enter image description here" /></a>Here above I want to Calculate Buying Total and selling Total in the current month . Suppose in November I want to calculate  sell row total , buying row total and buying-selling total count. How Can I do that . Please help...</p>
  <pre><code>**&lt;table id=&quot;datatable&quot; class=&quot;table table-striped table-bordered&quot;&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Date&lt;/th&gt;
              &lt;th&gt;Product Name&lt;/th&gt;
              &lt;th&gt;Quantity (Stock IN)&lt;/th&gt;
              &lt;th&gt;Buying Total&lt;/th&gt;
              &lt;th&gt;Stock&lt;/th&gt;
              &lt;th&gt;Selling Total&lt;/th&gt;
              &lt;th&gt;Profit (%)&lt;/th&gt;
  
          &lt;/tr&gt;
      &lt;/thead&gt;
  
  
      &lt;tbody&gt;
          @foreach($product_all as $row)
          &lt;tr&gt;
              &lt;td&gt;{{ $row-&gt;buying_date}}&lt;/td&gt;
              &lt;td&gt;{{ $row-&gt;product_name}}&lt;/td&gt;
              &lt;td&gt;{{ $row-&gt;stock_in }}&lt;/td&gt;
              &lt;td&gt;{{ $row-&gt;buying_price*$row-&gt;stock_in }}&lt;/td&gt; *********
              &lt;td&gt;{{ $row-&gt;total_stock }}&lt;/td&gt;
              
              &lt;td&gt;{{ $row-&gt;selling_price*($row-&gt;stock_in-$row-&gt;total_stock)}}&lt;/td&gt; ********
              
              &lt;td&gt;{{ ($row-&gt;buying_price*$row-&gt;stock_in) - ($row-&gt;selling_price*($row-&gt;stock_in-$row-&gt;total_stock)) }}&lt;/td&gt;
  
          &lt;/tr&gt;
         @endforeach
          
      &lt;/tbody&gt;
  
  &lt;/table&gt;**
  
  
  
  &lt;h4 style=&quot;color: #ff3939; text-align: center;&quot;&gt;November Total Invest : {{ #### }} &lt;span&gt; Sell : {{ #### }}&lt;/span&gt;&lt;/h4&gt;
  </code></pre>