supplier report issue fixed

This commit is contained in:
gandhimathi 2017-12-05 16:46:03 +05:30
parent 6c33db9a01
commit 07ced663c4
4 changed files with 86 additions and 40 deletions

View File

@ -503,21 +503,23 @@ TIME_FORMAT(pm.CreatedDate,'%l:%i %p') as created_time,
mm.MaterialName as material_name,sd.SupplierName as supplier_name,
ifnull(sum(pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(pl.Rate),0) as rate,
round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value,
if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate,
ifnull(if(POType = 'REVENUE',sum(rt.AfterSGST),sum(st.After_SGST)),0) as sgst,
ifnull(if(POType = 'REVENUE',sum(rt.AfterCGST),sum(st.After_CGST)),0) as cgst,
ifnull(if(POType = 'REVENUE',sum(rt.AfterIGST),sum(st.After_IGST)),0) as igst,
ifnull(if(POType = 'REVENUE',sum(rt.AfterDiscount),sum(st.Afterdiscountval)),0) as discount,
ifnull(if(POType = 'REVENUE',sum(rt.AfterFreightValue),sum(st.AfterFreightValue)),0) as freight,
ifnull(if(POType = 'REVENUE',sum(rt.AfterPackagingValue),0),0) as Package,
round((ifnull(sum(pl.Quantity * pl.Rate),0)
* ifnull(if(POType = 'IMPORT',sum(pm.ExchangeRate),0),0)
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterSGST),sum(st.After_SGST)),0)
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterCGST),sum(st.After_CGST)),0)
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterIGST),sum(st.After_IGST)),0)
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterFreightValue),sum(st.AfterFreightValue)),0)
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterPackagingValue),0),0)
- ifnull(if(POType = 'REVENUE',sum(rt.AfterDiscount),sum(st.Afterdiscountval)),0)),2) as total
round((
if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)),
if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)),
ifnull(sum(pl.Quantity * pl.Rate),0)))
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterSGST),sum(distinct st.After_SGST)),0)
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterCGST),sum(distinct st.After_CGST)),0)
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IGST)),0)
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0)
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0)
- ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
@ -575,26 +577,31 @@ TIME_FORMAT(pm.CreatedDate,'%l:%i %p') as created_time,
mm.MaterialName as material_name,sd.SupplierName as supplier_name,
ifnull(sum(pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(pl.Rate),0) as rate,
round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value,
if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate,
ifnull(if(POType = 'REVENUE',sum(rt.AfterSGST),sum(st.After_SGST)),0) as sgst,
ifnull(if(POType = 'REVENUE',sum(rt.AfterCGST),sum(st.After_CGST)),0) as cgst,
ifnull(if(POType = 'REVENUE',sum(rt.AfterIGST),sum(st.After_IGST)),0) as igst,
ifnull(if(POType = 'REVENUE',sum(rt.AfterDiscount),sum(st.Afterdiscountval)),0) as discount,
ifnull(if(POType = 'REVENUE',sum(rt.AfterFreightValue),sum(st.AfterFreightValue)),0) as freight,
ifnull(if(POType = 'REVENUE',sum(rt.AfterPackagingValue),0),0) as Package,
round((ifnull(sum(pl.Quantity * pl.Rate),0)
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterSGST),sum(st.After_SGST)),0)
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterCGST),sum(st.After_CGST)),0)
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterIGST),sum(st.After_IGST)),0)
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterFreightValue),sum(st.AfterFreightValue)),0)
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterPackagingValue),0),0)
- ifnull(if(POType = 'REVENUE',sum(rt.AfterDiscount),sum(st.Afterdiscountval)),0)),2) as total
FROM T_PurchaseOrder_Master pm
round((
if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)),
if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)),
ifnull(sum(pl.Quantity * pl.Rate),0)))
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterSGST),sum(distinct st.After_SGST)),0)
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterCGST),sum(distinct st.After_CGST)),0)
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IGST)),0)
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0)
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0)
- ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
where pm.Status != 'ST030' ";
where
pm.Status != 'ST030' ";
if ($cname!= ''){
@ -725,11 +732,46 @@ group by supplier_name,material_name";
function report_supplier($cname,$fa,$aa,$m,$frm,$t){
$sql="SELECT sd.SupplierID as sid,sd.SupplierName as supplier_name,count(pm.PONO) as counts,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value,round(sum(ifnull((pl.Quantity * pl.Rate),0) + ifnull(st.After_SGST,0) + ifnull(st.After_CGST,0) + ifnull(st.After_IGST,0)),2) as total
$sql="SELECT sd.SupplierID as sid,sd.SupplierName as supplier_name,count(pm.PONO) as counts,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value,
case pm.POType
when 'IMPORT'
then ifnull((sum(distinct(pl.Quantity * pl.Rate) * pm.ExchangeRate)
),0)
when 'CAPITAL'
then sum(distinct if(pm.CapitalRange=0,(( pl.Quantity * pl.Rate) * pm.ExchangeRate),( pl.Quantity * pl.Rate)
- st.Afterdiscountval))
+ ifnull(sum(distinct st.After_SGST),0)
+ ifnull(sum(distinct st.After_CGST),0)
+ ifnull(sum(distinct st.After_IGST),0)
+ ifnull(sum(distinct st.AfterFreightValue),0)
when 'SERVICE'
then ifnull(sum(distinct pl.Quantity * pl.Rate),0)
+ ifnull(sum(distinct st.After_SGST),0)
+ ifnull(sum(distinct st.After_CGST),0)
+ ifnull(sum(distinct st.After_IGST),0)
+ ifnull(sum(distinct st.AfterFreightValue),0)
- ifnull(sum(distinct st.Afterdiscountval),0)
when 'REVENUE'
then ifnull(sum(distinct pl.Quantity * pl.Rate),0)
- ifnull(sum(distinct rt.AfterDiscount),0)
+ ifnull(sum(distinct rt.AfterSGST),0)
+ ifnull(sum(distinct rt.AfterCGST),0)
+ ifnull(sum(distinct rt.AfterIGST),0)
+ ifnull(sum(distinct rt.AfterFreightValue),0)
+ ifnull(sum(distinct rt.AfterPackagingValue),0)
end
as total
FROM T_PurchaseOrder_Master pm
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
where
pm.Status != 'ST030' ";
@ -969,7 +1011,7 @@ group by supplier_name,material_name";
}
function departmentwise($sid='')
{
$sql="SELECT date,type,total,towhom,description,account_code FROM kasiram9_SIADEV.t_income_expense WHERE account_code = ?";
$sql="SELECT date,type,total,towhom,description,account_code FROM t_income_expense WHERE account_code = ?";
$query = $this->db->query($sql,array($sid));
//print_r($this->db->last_query());
return $query->result();
@ -977,7 +1019,7 @@ group by supplier_name,material_name";
}
function yearmonthwise($sid='')
{
$sql="SELECT date,type,total,description,towhom,account_code FROM kasiram9_SIADEV.t_income_expense WHERE monthname(date) = ? group by account_code";
$sql="SELECT date,type,total,description,towhom,account_code FROM t_income_expense WHERE monthname(date) = ? group by account_code";
$query = $this->db->query($sql,array($sid));
//print_r($this->db->last_query());
return $query->result();
@ -986,4 +1028,4 @@ group by supplier_name,material_name";
}
?>
?>zz

View File

@ -195,6 +195,7 @@ if(!empty($mms))
<th style="text-align:center">UOM</th>
<th style="text-align:center">Rate &nbsp;(<i class="fa fa-rupee "></i>)</th>
<th style="text-align:center">Value &nbsp;(<i class="fa fa-rupee " ></i>)</th>
<th style="text-align:center">Exchange Rate</th>
<th style="text-align:center">SGST &nbsp;(<i class="fa fa-rupee " ></i>)</th>
<th style="text-align:center">CGST &nbsp;(<i class="fa fa-rupee " ></i>)</th>
<th style="text-align:center">IGST &nbsp;(<i class="fa fa-rupee " ></i>)</th>
@ -210,6 +211,7 @@ if(!empty($mms))
$tot_qty = 0;
$tot_rate = 0;
$tot_value = 0;
$tot_ex = 0;
$tot_CGST = 0;
$tot_SCGT = 0.0000;
$tot_ICGT = 0;
@ -239,6 +241,9 @@ if(!empty($mms))
$tot_value= $tot_value + $rel->value;
echo $rel->value;?></span></td>
<td style="text-align:right"><span><?php
$tot_ex= $tot_ex + $rel->exchange_rate;
echo $rel->exchange_rate;?></span></td>
<td style="text-align:right"><span><?php
$tot_SCGT= $tot_SCGT + $rel->sgst;
echo $rel->sgst;?></span></td>
<td style="text-align:right"><span><?php
@ -257,8 +262,8 @@ if(!empty($mms))
$tot_pac= $tot_pac + $rel->Package;
echo $rel->Package;?></span></td>
<td style="text-align:right"><span><?php
$tot_tot= $tot_tot + $rel->total;
echo $rel->total;?></span></td>
$tot_tot= $tot_tot + round($rel->total,2);
echo round($rel->total,2);?></span></td>
@ -312,6 +317,16 @@ if(!empty($mms))
}
?>
</strong>
</td>
<td class="amount" style="text-align:right">
<strong>
<?php
{
echo $tot_ex;
}
?>
</strong>
</td>
<td class="amount" style="text-align:right">
<strong>

View File

@ -169,7 +169,7 @@ if(!empty($mms))
<th style="text-align:center">PO Count</th>
<th style="text-align:center">Quantity</th>
<th style="text-align:center">Value &nbsp;(<i class="fa fa-rupee "></i>)</th>
<th style="text-align:center">Total &nbsp;(<i class="fa fa-rupee "></i>)</th>
</tr>
</thead>
@ -199,9 +199,7 @@ if(!empty($mms))
<td style="text-align:right"><span><?php
$tot_value= $tot_value + $rel->value;
echo $rel->value;?></span></td>
<td style="text-align:right"><span><?php
$tot_tot= $tot_tot + $rel->total;
echo $rel->total;?></span></td>
@ -245,16 +243,7 @@ if(!empty($mms))
?>
</strong>
</td>
<td class="amount" style="text-align:right">
<strong>
<?php
{
echo $tot_tot;
}
?>
</strong>
</td>
</tr>

View File

@ -456,7 +456,7 @@ $(function() {
} ?>
<?php echo $DEPCode;
<?php //echo $DEPCode;
if( $role == ROLE_ADMIN && $DEPCode != HR) { ?>
<li class="treeview">