report yearwise and material master supplierwise
This commit is contained in:
parent
3824f47fd3
commit
e4e4cddfcd
@ -1547,56 +1547,73 @@ $sql.="group by pono,material_name,category,supplier_name,id.IGRItemNo";
|
||||
function ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat,$da,$po){
|
||||
|
||||
|
||||
$sql="select im.IGRNO as igrn,pm.POType as potype,im.PONO as pono,date_format(im.CreatedDate,'%d-%m-%Y') as created_date,TIME_FORMAT(im.CreatedDate,'%l:%i %p') as created_time,mm.MaterialName as material_name,mm.Category as category,sd.SupplierName as supplier_name,mm.UOM as UOM, sum(id.QuantityAsPerInvoice) as quantity,pl.Rate as rate,round(sum(id.QuantityAsPerInvoice) * pl.Rate,2) as value,if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate,date_format(im.MaterialRcvdDate,'%d-%m-%Y') as materialrcvddate,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) as sgst,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2) as cgst,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2) as igst,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2) as discount,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2) as freight,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2) as Package,
|
||||
// $sql="select im.IGRNO as igrn,pm.POType as potype,im.PONO as pono,date_format(im.CreatedDate,'%d-%m-%Y') as created_date,TIME_FORMAT(im.CreatedDate,'%l:%i %p') as created_time,mm.MaterialName as material_name,mm.Category as category,sd.SupplierName as supplier_name,mm.UOM as UOM, sum(id.QuantityAsPerInvoice) as quantity,pl.Rate as rate,round(sum(id.QuantityAsPerInvoice) * pl.Rate,2) as value,if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate,date_format(im.MaterialRcvdDate,'%d-%m-%Y') as materialrcvddate,
|
||||
// round(ifnull(if(POType = 'REVENUE',
|
||||
// sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
||||
// sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) as sgst,
|
||||
// round(ifnull(if(POType = 'REVENUE',
|
||||
// sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
|
||||
// sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2) as cgst,
|
||||
// round(ifnull(if(POType = 'REVENUE',
|
||||
// sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
|
||||
// sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2) as igst,
|
||||
// round(ifnull(if(POType = 'REVENUE',
|
||||
// sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
|
||||
// sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2) as discount,
|
||||
// round(ifnull(if(POType = 'REVENUE',
|
||||
// sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
|
||||
// sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2) as freight,
|
||||
// round(ifnull(if(POType = 'REVENUE',
|
||||
// sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2) as Package,
|
||||
|
||||
round((
|
||||
if(POType = 'IMPORT',sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
||||
if(POType = 'CAPITAL' && CapitalRange = 0,sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
||||
ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)))
|
||||
+ round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
|
||||
+ round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2)
|
||||
+ round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2)
|
||||
+ round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2)
|
||||
+ round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2)
|
||||
- round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
|
||||
im.file as ifile,pb.FilePath as file
|
||||
from T_IGR_Master im
|
||||
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
|
||||
join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
|
||||
join T_PurchaseOrder_Master pm on pm.PONO = pl.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
|
||||
left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
|
||||
// round((
|
||||
// if(POType = 'IMPORT',sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
||||
// if(POType = 'CAPITAL' && CapitalRange = 0,sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
||||
// ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)))
|
||||
// + round(ifnull(if(POType = 'REVENUE',
|
||||
// sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
||||
// sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
|
||||
// + round(ifnull(if(POType = 'REVENUE',
|
||||
// sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
|
||||
// sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2)
|
||||
// + round(ifnull(if(POType = 'REVENUE',
|
||||
// sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
|
||||
// sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2)
|
||||
// + round(ifnull(if(POType = 'REVENUE',
|
||||
// sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
|
||||
// sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2)
|
||||
// + round(ifnull(if(POType = 'REVENUE',
|
||||
// sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2)
|
||||
// - round(ifnull(if(POType = 'REVENUE',
|
||||
// sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
|
||||
// sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
|
||||
// im.file as ifile,pb.FilePath as file
|
||||
// from T_IGR_Master im
|
||||
// join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
|
||||
// join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
|
||||
// join T_PurchaseOrder_Master pm on pm.PONO = pl.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
|
||||
// left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
|
||||
$sql ="select im.IGRNO as igrn,pm.POType as potype,im.PONO as pono,date_format(im.CreatedDate,'%d-%m-%Y') as created_date,TIME_FORMAT(im.CreatedDate,'%l:%i %p') as created_time,mm.MaterialName as material_name,mm.Category as category,sd.SupplierName as supplier_name,mm.UOM as UOM, id.QuantityAsPerInvoice as quantity,pl.Rate as rate,round(id.QuantityAsPerInvoice * pl.Rate,2) as value,if(POType = 'IMPORT' or POType = 'CAPITAL',pm.ExchangeRate,0) as exchange_rate,date_format(im.MaterialRcvdDate,'%d-%m-%Y') as materialrcvddate,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
||||
(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) as sgst, round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
|
||||
(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2) as cgst, round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
|
||||
(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2) as igst, round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
|
||||
(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2) as discount,
|
||||
round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
|
||||
(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2) as freight,
|
||||
round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2) as Package,
|
||||
|
||||
round(( if(POType = 'IMPORT',(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
||||
if(POType = 'CAPITAL' && CapitalRange = 0,(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
||||
ifnull((id.QuantityAsPerInvoice * pl.Rate),0))) + round(ifnull(if(POType = 'REVENUE',
|
||||
(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
||||
(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) + round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity), (id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2) + round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity), (id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2) + round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity), (id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2) + round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2) - round(ifnull(if(POType = 'REVENUE', (id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity), (id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total, im.file as ifile,pb.FilePath as file from T_IGR_Master im join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode join T_PurchaseOrder_Master pm on pm.PONO = pl.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 left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
|
||||
|
||||
where pm.Status != 'ST030' ";
|
||||
|
||||
if ($cname!= ''){
|
||||
|
||||
@ -66,7 +66,7 @@ if(!empty($mms))
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td><span><?php $date = new DateTime($rel->Material_Date);echo $date->format('Y-m-d');?></span></td>
|
||||
<td><span><?php $date = new DateTime($rel->Material_Date);echo $date->format('d-m-Y');?></span></td>
|
||||
<td><span><?php echo $rel->SupplierID?></span></td>
|
||||
<td><span><?php echo $rel->SupplierName?></span></td>
|
||||
<td><span><?php echo $rel->MaterialCode?></span></td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user