avg price in abstract report

This commit is contained in:
venbatechnologies@gmail.com 2018-12-29 14:44:40 +05:30
parent 87a8f13817
commit 52d7c6d166
2 changed files with 8 additions and 5 deletions

View File

@ -1374,14 +1374,15 @@ $endyr = $pieces['1'];
$subquery="SELECT
DISTINCT(p.MaterialCode) AS ProductID,Ref_No,Date(CreatedOn),mm.MaterialName,stock,MaterialType,Category,stockdate,mm.Category,ip.product_name,ip.product_id,
SUM(IF(p.Transaction_type='Add',Quantity,0)) AS Addition,
SUM(IF(p.Transaction_type='Reduce',Quantity,0)) AS Reduce,
SUM((IF(p.Transaction_type='Add',Quantity,0))-(IF(p.Transaction_type='Reduce',Quantity,0))) AS AvailableStock
SUM(IF(p.Transaction_type='Add',p.Quantity,0)) AS Addition,
SUM(IF(p.Transaction_type='Reduce',p.Quantity,0)) AS Reduce,
SUM((IF(p.Transaction_type='Add',p.Quantity,0))-(IF(p.Transaction_type='Reduce',p.Quantity,0))) AS AvailableStock,ROUND(AVG(Rate)) as Avg_rate
FROM
T_Material_stock_history AS p
left join T_MaterialMaster mm on mm.MaterialCode = p.MaterialCode
left join ip_products ip on ip.product_id=p.MaterialCode
left join T_PurchaseOrder_LineItem pol on pol.MaterialCode = mm.MaterialCode
";

View File

@ -234,6 +234,7 @@ $(function() {
<th>Total</th>
<th>Issue Stock</th>
<th>Closing Stock</th>
<th>Average Price</th>
<th></th>
</tr>
@ -371,6 +372,7 @@ $(function() {
<td><?php echo $total?></td>
<td><?php echo $ge->Reduce?></td>
<td><?php echo $FinalStock;?></td>
<td><?php echo $ge->Avg_rate;?></td>
<td><?php echo $MaterilCat;?></td>
</tr>
@ -449,7 +451,7 @@ $(document).ready(function() {
var groupColumn = 7;
var groupColumn = 8;
$.fn.dataTable.moment( 'DD-MM-YYYY' );
var table = $('#dataTableHistoriek').DataTable({
@ -490,7 +492,7 @@ buttons: [
api.column(groupColumn, {page:'current'} ).data().each( function ( group, i ) {
if ( last !== group ) {
$(rows).eq( i ).before(
'<tr class="group"><td style="background-color:#000333" colspan="7"><font color="#fff">'+group+'</font></td></tr>'
'<tr class="group"><td style="background-color:#000333" colspan="8"><font color="#fff">'+group+'</font></td></tr>'
);
last = group;