|
|
|
|
@ -1428,49 +1428,50 @@ group by supplier_name,material_name";
|
|
|
|
|
$query = $this->db->query($sql);
|
|
|
|
|
return $query->result();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$cat){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$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,
|
|
|
|
|
$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',
|
|
|
|
|
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
|
|
|
|
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) as sgst,
|
|
|
|
|
(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
|
|
|
|
(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,
|
|
|
|
|
(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
|
|
|
|
|
(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,
|
|
|
|
|
(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
|
|
|
|
|
(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,
|
|
|
|
|
(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
|
|
|
|
|
(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,
|
|
|
|
|
(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
|
|
|
|
|
(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,
|
|
|
|
|
(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)))
|
|
|
|
|
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',
|
|
|
|
|
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
|
|
|
|
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
|
|
|
|
|
(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
|
|
|
|
(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)
|
|
|
|
|
(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
|
|
|
|
|
(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)
|
|
|
|
|
(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
|
|
|
|
|
(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)
|
|
|
|
|
(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
|
|
|
|
|
(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2)
|
|
|
|
|
+ round(ifnull(if(POType = 'REVENUE',
|
|
|
|
|
sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2)
|
|
|
|
|
(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,
|
|
|
|
|
(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
|
|
|
|
|
left join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
|
|
|
|
|
@ -1538,20 +1539,53 @@ $sql.="group by pono,material_name,category,supplier_name,id.IGRItemNo";
|
|
|
|
|
$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.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),
|
|
|
|
|
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(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)),
|
|
|
|
|
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',
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
(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
|
|
|
|
|
left 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!= ''){
|
|
|
|
|
@ -1634,11 +1668,10 @@ $sql.="group by pono,material_name,category,supplier_name,id.IGRItemNo";
|
|
|
|
|
$query = $this->db->query($sql);
|
|
|
|
|
return $query->result();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ireport_attachment($cname,$fa,$aa,$m,$frm,$t){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** $sql="select pono,potype,date_format(created_date,'%d-%m-%Y') as created_date,date_format(materialrcvddate,'%d-%m-%Y') as materialrcvddate,supplier_name,
|
|
|
|
|
$sql="select pono,potype,date_format(created_date,'%d-%m-%Y') as created_date,date_format(materialrcvddate,'%d-%m-%Y') as materialrcvddate,supplier_name,
|
|
|
|
|
sum(total) as total,file,ifile
|
|
|
|
|
from igr
|
|
|
|
|
where status != 'ST030'
|
|
|
|
|
@ -1648,24 +1681,6 @@ if ($cname!= ''){
|
|
|
|
|
|
|
|
|
|
$sql.="and supplier_name = '".$cname."'";
|
|
|
|
|
|
|
|
|
|
}**/
|
|
|
|
|
|
|
|
|
|
$sql="select pm.Status AS status,sd.SupplierID AS sid,im.file AS ifile,pb.FilePath AS file,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,
|
|
|
|
|
date_format(im.MaterialRcvdDate,'%d-%m-%Y') as materialrcvddate,sd.SupplierName AS supplier_name,sum(id.QuantityAsPerInvoice) AS quantity,
|
|
|
|
|
round(((((((if((pm.POType = 'IMPORT'),sum((pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate))),if(((pm.POType = 'CAPITAL') and (pm.CapitalRange = 0)),sum((pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate))),ifnull(sum((id.QuantityAsPerInvoice * pl.Rate)),0))) + round(ifnull(if((pm.POType = 'REVENUE'),sum(((id.QuantityAsPerInvoice * rt.AfterSGST) / pl.Quantity)),sum(((id.QuantityAsPerInvoice * st.After_SGST) / pl.Quantity))),0),2)) + round(ifnull(if((pm.POType = 'REVENUE'),sum(((id.QuantityAsPerInvoice * rt.AfterCGST) / pl.Quantity)),sum(((id.QuantityAsPerInvoice * st.After_CGST) / pl.Quantity))),0),2)) + round(ifnull(if((pm.POType = 'REVENUE'),sum(((id.QuantityAsPerInvoice * rt.AfterIGST) / pl.Quantity)),sum(((id.QuantityAsPerInvoice * st.After_IGST) / pl.Quantity))),0),2)) + round(ifnull(if((pm.POType = 'REVENUE'),sum(((id.QuantityAsPerInvoice * rt.AfterFreightValue) / pl.Quantity)),sum(((id.QuantityAsPerInvoice * st.AfterFreightValue) / pl.Quantity))),0),2)) + round(ifnull(if((pm.POType = 'REVENUE'),sum(((id.QuantityAsPerInvoice * rt.AfterPackagingValue) / pl.Quantity)),0),0),2)) - round(ifnull(if((pm.POType = 'REVENUE'),sum(((id.QuantityAsPerInvoice * rt.AfterDiscount) / pl.Quantity)),sum(((id.QuantityAsPerInvoice * st.Afterdiscountval) / pl.Quantity))),0),2)),2) AS total
|
|
|
|
|
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.PONO = im.PONO)))
|
|
|
|
|
where (pm.Status <> 'ST030') ";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($cname!= ''){
|
|
|
|
|
|
|
|
|
|
$sql.="and sd.SupplierName = '".$cname."'";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($fa and $aa != ''){
|
|
|
|
|
@ -1709,8 +1724,8 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
// group by month(CreatedDate)
|
|
|
|
|
// ";
|
|
|
|
|
//echo $sql;
|
|
|
|
|
$sql="select materialrcvddate,sum(quantity)as quantity,sum(value) as value,materialrcvddate
|
|
|
|
|
from year_inward
|
|
|
|
|
$sql="select materialrcvddate,sum(quantity)as quantity,sum(value) as value
|
|
|
|
|
from igr
|
|
|
|
|
where status != 'ST030' and date(materialrcvddate) >= '$a-04-01' and date(materialrcvddate) <= '$b-03-31'
|
|
|
|
|
group by month(materialrcvddate)";
|
|
|
|
|
$query = $this->db->query($sql);
|
|
|
|
|
@ -1729,7 +1744,7 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
// where status != 'ST030' and month(dat)= ? and year(dat) = ?
|
|
|
|
|
// group by material_name,supplier_name";
|
|
|
|
|
$sql="select sid,mid,supplier_name,material_name,sum(quantity)as quantity,sum(value) as total,materialrcvddate
|
|
|
|
|
from year_inward
|
|
|
|
|
from igr
|
|
|
|
|
where status != 'ST030' and month(materialrcvddate)= ? and year(materialrcvddate) = ?
|
|
|
|
|
group by material_name,supplier_name";
|
|
|
|
|
$query = $this->db->query($sql,array($month,$year));
|
|
|
|
|
@ -1742,7 +1757,7 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
// where status != 'ST030' and date(dat) >= '$a-04-01' and date(dat) <= '$b-03-31'
|
|
|
|
|
// group by material_name,supplier_name";
|
|
|
|
|
$sql="select sid,mid,supplier_name,material_name,sum(quantity)as quantity,sum(value) as total,materialrcvddate
|
|
|
|
|
from year_inward
|
|
|
|
|
from igr
|
|
|
|
|
where status != 'ST030' and date(materialrcvddate) >= '$a-04-01' and date(materialrcvddate) <= '$b-03-31'
|
|
|
|
|
group by material_name,supplier_name";
|
|
|
|
|
$query = $this->db->query($sql,array());
|
|
|
|
|
@ -1792,14 +1807,13 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
end
|
|
|
|
|
as total,im.MaterialRcvdDate
|
|
|
|
|
from T_IGR_Master im
|
|
|
|
|
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
|
|
|
|
|
left 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!= ''){
|
|
|
|
|
@ -1869,7 +1883,7 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 2, value, 0)) AS vFebruary,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 3, value, 0)) AS vMarch,
|
|
|
|
|
sum(value) as vtotal
|
|
|
|
|
FROM year_inward
|
|
|
|
|
FROM igr
|
|
|
|
|
where status != 'ST030' ";
|
|
|
|
|
|
|
|
|
|
if ($cname!= ''){
|
|
|
|
|
@ -1896,9 +1910,9 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
function i_consolidate_month($m=null,$sid=null,$mid=null,$fa=null,$aa=null){
|
|
|
|
|
|
|
|
|
|
$sql="select sid,mid,supplier_name,material_name,sum(quantity) as quantity,sum(value) as total
|
|
|
|
|
from year_inward
|
|
|
|
|
from igr
|
|
|
|
|
where status != 'ST030' and
|
|
|
|
|
monthname(dat) = '".$m."' and sid = '".$sid."' and mid = '".$mid."' ";
|
|
|
|
|
monthname(materialrcvddate) = '".$m."' and sid = '".$sid."' and mid = '".$mid."' ";
|
|
|
|
|
if ($fa and $aa != ''){
|
|
|
|
|
|
|
|
|
|
//$sql.=" and (dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')";
|
|
|
|
|
@ -1913,7 +1927,7 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
function i_consolidate_year($sid=null,$mid=null,$fa=null,$aa=null){
|
|
|
|
|
|
|
|
|
|
$sql="select sid,mid,supplier_name,material_name,sum(quantity) as quantity,sum(value) as total
|
|
|
|
|
from year_inward
|
|
|
|
|
from igr
|
|
|
|
|
where status != 'ST030' and sid = '".$sid."' and mid = '".$mid."' ";
|
|
|
|
|
if ($fa and $aa != ''){
|
|
|
|
|
|
|
|
|
|
@ -1937,20 +1951,20 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
$aa=substr($ab,5,5);
|
|
|
|
|
$sql="SELECT year.sid as sid,year.mid as mid,year.supplier_name as supplier_name,year.material_name as material_name,year.quantity as quantity,year.total as total,month.mquantity as mquantity,month.mtotal as mtotal,today.tquantity as tquantity,today.ttotal as ttotal
|
|
|
|
|
FROM (SELECT sid,mid,supplier_name,material_name,sum(Quantity) as quantity,sum(value) as total,materialrcvddate
|
|
|
|
|
FROM year_inward
|
|
|
|
|
FROM igr
|
|
|
|
|
where status != 'ST030' and
|
|
|
|
|
(materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')
|
|
|
|
|
group by supplier_name,material_name
|
|
|
|
|
) as year left join
|
|
|
|
|
(SELECT sid,mid,supplier_name,material_name,sum(Quantity) as mquantity,sum(value) as mtotal
|
|
|
|
|
FROM year_inward
|
|
|
|
|
FROM igr
|
|
|
|
|
where status != 'ST030' and
|
|
|
|
|
month(materialrcvddate) = month(current_date())
|
|
|
|
|
group by supplier_name,material_name
|
|
|
|
|
) as month on month.supplier_name=year.supplier_name and month.material_name=year.material_name
|
|
|
|
|
left join
|
|
|
|
|
(SELECT sid,mid,supplier_name,material_name,sum(Quantity) as tquantity,sum(value) as ttotal
|
|
|
|
|
FROM year_inward
|
|
|
|
|
FROM igr
|
|
|
|
|
where status != 'ST030' and
|
|
|
|
|
date(materialrcvddate) = current_date()
|
|
|
|
|
group by supplier_name,material_name
|
|
|
|
|
@ -1963,7 +1977,7 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
function ireport_cum_month($sup=null,$mat=null){
|
|
|
|
|
|
|
|
|
|
$sql="SELECT sid,mid,supplier_name,material_name,sum(Quantity) as tquantity,sum(value) as ttotal
|
|
|
|
|
FROM year_inward
|
|
|
|
|
FROM igr
|
|
|
|
|
where status != 'ST030' and
|
|
|
|
|
month(materialrcvddate) = month(current_date()) and sid = '".$sup."' and mid = '".$mat."'
|
|
|
|
|
group by supplier_name,material_name";
|
|
|
|
|
@ -1980,7 +1994,7 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
$fa=substr($ab,0,-5);
|
|
|
|
|
$aa=substr($ab,5,5);
|
|
|
|
|
$sql="SELECT sid,mid,supplier_name,material_name,IF(Quantity IS NULL or Quantity = '', 0, sum(Quantity)) as tquantity,sum(value) as ttotal
|
|
|
|
|
FROM year_inward
|
|
|
|
|
FROM igr
|
|
|
|
|
where status != 'ST030' and
|
|
|
|
|
(materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')
|
|
|
|
|
and sid = '".$sup."' and mid= '".$mat."'
|
|
|
|
|
@ -1992,7 +2006,7 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
function ireport_cum_day($sup=null,$mat=null){
|
|
|
|
|
|
|
|
|
|
$sql="SELECT sid,mid,supplier_name,material_name,IF(Quantity IS NULL or Quantity = '', 0, sum(Quantity)) as tquantity,sum(value) as ttotal
|
|
|
|
|
FROM year_inward
|
|
|
|
|
FROM igr
|
|
|
|
|
where status != 'ST030' and
|
|
|
|
|
date(materialrcvddate) = current_date() and sid = '".$sup."' and mid = '".$mat."'
|
|
|
|
|
group by supplier_name,material_name";
|
|
|
|
|
@ -2010,20 +2024,20 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
$aa=substr($ab,5,5);
|
|
|
|
|
$sql="SELECT year.category as category,year.quantity as quantity,year.total as total,month.mquantity as mquantity,month.mtotal as mtotal,today.tquantity as tquantity,today.ttotal as ttotal
|
|
|
|
|
FROM (SELECT category,sum(Quantity) as quantity,sum(value) as total
|
|
|
|
|
FROM year_inward
|
|
|
|
|
FROM igr
|
|
|
|
|
where status != 'ST030' and
|
|
|
|
|
(materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')
|
|
|
|
|
group by category
|
|
|
|
|
) as year left join
|
|
|
|
|
(SELECT category,sum(Quantity) as mquantity,sum(value) as mtotal
|
|
|
|
|
FROM year_inward
|
|
|
|
|
FROM igr
|
|
|
|
|
where status != 'ST030' and
|
|
|
|
|
month(materialrcvddate) = month(current_date())
|
|
|
|
|
group by category
|
|
|
|
|
) as month on month.category=year.category
|
|
|
|
|
left join
|
|
|
|
|
(SELECT category,sum(Quantity) as tquantity,sum(value) as ttotal
|
|
|
|
|
FROM year_inward
|
|
|
|
|
FROM igr
|
|
|
|
|
where status != 'ST030' and
|
|
|
|
|
date(materialrcvddate) = current_date()
|
|
|
|
|
group by category
|
|
|
|
|
@ -2042,7 +2056,7 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
$fa=substr($ab,0,-5);
|
|
|
|
|
$aa=substr($ab,5,5);
|
|
|
|
|
$sql="SELECT category,sid,mid,supplier_name,material_name,IF(Quantity IS NULL or Quantity = '', 0, sum(Quantity)) as tquantity,sum(value) as ttotal
|
|
|
|
|
FROM year_inward
|
|
|
|
|
FROM igr
|
|
|
|
|
where status != 'ST030' and
|
|
|
|
|
(materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')
|
|
|
|
|
and category = '".$cat."'
|
|
|
|
|
@ -2054,7 +2068,7 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
function rawi_report_cum_month($cat=null){
|
|
|
|
|
|
|
|
|
|
$sql="SELECT category,sid,mid,supplier_name,material_name,IF(Quantity IS NULL or Quantity = '', 0, sum(Quantity)) as tquantity,sum(value) as ttotal
|
|
|
|
|
FROM year_inward
|
|
|
|
|
FROM igr
|
|
|
|
|
where status != 'ST030' and
|
|
|
|
|
month(materialrcvddate) = month(current_date()) and category = '".$cat."'
|
|
|
|
|
group by supplier_name,material_name";
|
|
|
|
|
@ -2064,7 +2078,7 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
function rawi_report_cum_day($cat=null){
|
|
|
|
|
|
|
|
|
|
$sql="SELECT category,sid,mid,supplier_name,material_name,IF(Quantity IS NULL or Quantity = '', 0, sum(Quantity)) as tquantity,sum(value) as ttotal
|
|
|
|
|
FROM year_inward
|
|
|
|
|
FROM igr
|
|
|
|
|
where status != 'ST030' and
|
|
|
|
|
date(materialrcvddate) = current_date() and category = '".$cat."'
|
|
|
|
|
group by supplier_name,material_name";
|
|
|
|
|
@ -2102,7 +2116,7 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 2, value, 0)) AS vFebruary,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 3, value, 0)) AS vMarch,
|
|
|
|
|
sum(value) as vtotal
|
|
|
|
|
FROM year_inward
|
|
|
|
|
FROM igr
|
|
|
|
|
where status != 'ST030' ";
|
|
|
|
|
|
|
|
|
|
if ($cname!= ''){
|
|
|
|
|
@ -2131,7 +2145,7 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
$sql="select category,sid,supplier_name,mid,material_name,
|
|
|
|
|
sum(Quantity) as quantity,
|
|
|
|
|
sum(value) as total
|
|
|
|
|
FROM year_inward
|
|
|
|
|
FROM igr
|
|
|
|
|
where status != 'ST030' and
|
|
|
|
|
monthname(materialrcvddate) = '".$m."' and category = '".$cat."' ";
|
|
|
|
|
if ($fa and $aa != ''){
|
|
|
|
|
@ -2149,7 +2163,7 @@ where (pm.Status <> 'ST030') ";
|
|
|
|
|
$sql="select category,sid,supplier_name,mid,material_name,
|
|
|
|
|
sum(Quantity) as quantity,
|
|
|
|
|
sum(value) as total
|
|
|
|
|
FROM year_inward
|
|
|
|
|
FROM igr
|
|
|
|
|
where status != 'ST030' and
|
|
|
|
|
category = '".$cat."' ";
|
|
|
|
|
if ($fa and $aa != ''){
|
|
|
|
|
|