|
|
|
|
@ -72,19 +72,15 @@ $sql="select EmpID,CONCAT(FirstName,' ',LastName) as name FROM T_Employee_Detai
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function attyesterday($WH,$date)
|
|
|
|
|
function attyesterday($WH,$date)
|
|
|
|
|
{
|
|
|
|
|
//echo 'model' . $WH.'-'.$date;
|
|
|
|
|
// $sql="select EmpID,".$WH." from T_Attendance where Month_Year = ? and EmpID in (select EmpID from T_Attendance)" ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$sql="select att.EmpID,".$WH.",a.FirstName from T_Attendance as att
|
|
|
|
|
|
|
|
|
|
$yes_date = date('Y-m-d',strtotime("-1 days"));
|
|
|
|
|
$sql="select att.EmpID,ifnull(".$WH.",0)".$WH.",a.FirstName from T_Attendance as att
|
|
|
|
|
join T_Employee_Details as a on a.EmpID= att.EmpID
|
|
|
|
|
where Month_Year = ? and att.EmpID in (select EmpID from T_Attendance)";
|
|
|
|
|
where Month_Year = ? and att.EmpID in (select EmpID from T_Attendance) and date(a.Created_date) <= '".$yes_date."' and isActive=1";
|
|
|
|
|
$query = $this->db->query($sql,array($date));
|
|
|
|
|
// print_r($query->result());
|
|
|
|
|
//echo count($query->result());
|
|
|
|
|
return $query->result_array();
|
|
|
|
|
return $query->result_array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -266,26 +262,36 @@ GROUP BY financial_year";
|
|
|
|
|
return $query->result();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function get_employee(){
|
|
|
|
|
|
|
|
|
|
$yes_date = date('Y-m-d',strtotime("-1 days"));
|
|
|
|
|
$sql = "select * from T_Employee_Details where date(created_date) <='".$yes_date."' and isActive =1";
|
|
|
|
|
$query = $this->db->query($sql);
|
|
|
|
|
return $query->result();
|
|
|
|
|
}
|
|
|
|
|
function per($fa,$aa,$m)
|
|
|
|
|
{
|
|
|
|
|
$sql= "SELECT year.Eid as Eid,year.ename as ename,year.active as active,month.days as days,month.Days_Worked as worked,month.percentage as percentage,year.days as yday,year.workd as yworkd,year.percentage as ypercentage
|
|
|
|
|
//echo $m;
|
|
|
|
|
$cur_month = date('M');
|
|
|
|
|
//echo $cur_month;
|
|
|
|
|
if($cur_month == $m ){
|
|
|
|
|
|
|
|
|
|
$cur_date = date('d');
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
$cur_date = date('t',strtotime($m));
|
|
|
|
|
}
|
|
|
|
|
//echo $cur_date;die;
|
|
|
|
|
$sql= "SELECT month.Eid as Eid,month.ename as ename,month.active as active,month.days as monthdays,month.Days_Worked as monthworked,month.percentage as monthpercentage
|
|
|
|
|
from (select em.EmpID as Eid,concat(em.FirstName,'.',em.LastName) as ename,em.IsActive as active,at.NoofDays as days,
|
|
|
|
|
Days_Worked,round((Days_Worked/NoofDays*100)) as percentage from
|
|
|
|
|
Days_Worked,round((Days_Worked/".$cur_date."*100)) as percentage from
|
|
|
|
|
T_Employee_Details em
|
|
|
|
|
join T_Attendance at on at.EmpID = em.EmpID
|
|
|
|
|
where (Month_Year >= '".$fa."-04-01' and Month_Year <= '".$aa."-04-01') and monthname(Month_Year) = '".$m."'
|
|
|
|
|
) as month left join
|
|
|
|
|
(select em.EmpID as Eid,concat(em.FirstName,'.',em.LastName) as ename,em.IsActive as active,sum(at.NoofDays) as days,
|
|
|
|
|
sum(Days_Worked) workd,round((sum(Days_Worked)/sum(NoofDays)*100)) as percentage from
|
|
|
|
|
T_Employee_Details em
|
|
|
|
|
join T_Attendance at on at.EmpID = em.EmpID
|
|
|
|
|
where (Month_Year >= '".$fa."-04-01' and Month_Year <= '".$aa."-04-01')
|
|
|
|
|
group by Eid
|
|
|
|
|
) as year on year.Eid = month.Eid and year.ename = month.ename
|
|
|
|
|
group by Eid ";
|
|
|
|
|
) as month";
|
|
|
|
|
|
|
|
|
|
$query = $this->db->query($sql);
|
|
|
|
|
return $query->result();
|
|
|
|
|
return $query->result();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -376,32 +382,6 @@ $query = $this->db->query($sql);
|
|
|
|
|
return $query->result();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// function totalserviceamount()
|
|
|
|
|
// {
|
|
|
|
|
// $sql="select sum(BudgetAmount) as totalserviceamount from T_CostCenter_Budget where BudgetType='SERVICE'";
|
|
|
|
|
// $query = $this->db->query($sql);
|
|
|
|
|
// return $query->result();
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// function totalcapitalamount()
|
|
|
|
|
// {
|
|
|
|
|
// $sql="select sum(BudgetAmount) as totalcapitalamount from T_CostCenter_Budget where BudgetType='CAPITAL'";
|
|
|
|
|
// $query = $this->db->query($sql);
|
|
|
|
|
// return $query->result();
|
|
|
|
|
// }
|
|
|
|
|
// function totalimportamount()
|
|
|
|
|
// {
|
|
|
|
|
// $sql="select sum(BudgetAmount) as totalimportamount from T_CostCenter_Budget where BudgetType='IMPORT'";
|
|
|
|
|
// $query = $this->db->query($sql);
|
|
|
|
|
// return $query->result();
|
|
|
|
|
// }
|
|
|
|
|
// function totalrevenueamount()
|
|
|
|
|
// {
|
|
|
|
|
// $sql="select sum(BudgetAmount) as totalrevenueamount from T_CostCenter_Budget where BudgetType='REVENUE'";
|
|
|
|
|
// $query = $this->db->query($sql);
|
|
|
|
|
// return $query->result();
|
|
|
|
|
// }
|
|
|
|
|
//totalservice
|
|
|
|
|
function getTotalServicePoCount(){
|
|
|
|
|
$i=1;
|
|
|
|
|
if (date('m') >= 4)
|
|
|
|
|
@ -1183,7 +1163,8 @@ group by supplier_name,material_name";
|
|
|
|
|
|
|
|
|
|
case pm.POType
|
|
|
|
|
when 'IMPORT'
|
|
|
|
|
then ifnull((sum(distinct(pl.Quantity * pl.Rate) * pm.ExchangeRate)),0) + ifnull(rt.Insurance,0)
|
|
|
|
|
then ifnull((sum(distinct(pl.Quantity * pl.Rate) * pm.ExchangeRate)
|
|
|
|
|
),0) + ifnull(rt.Insurance,0)
|
|
|
|
|
when 'CAPITAL'
|
|
|
|
|
then sum(distinct if(pm.CapitalRange=0,(( pl.Quantity * pl.Rate) * pm.ExchangeRate),( pl.Quantity * pl.Rate)
|
|
|
|
|
- st.Afterdiscountval))
|
|
|
|
|
@ -1492,7 +1473,7 @@ ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)))
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
@ -1551,61 +1532,28 @@ $sql.="group by pono,material_name,category,supplier_name,id.IGRItemNo";
|
|
|
|
|
$query = $this->db->query($sql);
|
|
|
|
|
return $query->result();
|
|
|
|
|
}
|
|
|
|
|
function ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat,$da,$po){
|
|
|
|
|
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,
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
where pm.Status != 'ST030' ";
|
|
|
|
|
|
|
|
|
|
$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!= ''){
|
|
|
|
|
|
|
|
|
|
$sql.="and sd.SupplierName = '".$cname."'";
|
|
|
|
|
@ -1690,7 +1638,7 @@ $sql.="group by pono,material_name,category,supplier_name,id.IGRItemNo";
|
|
|
|
|
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'
|
|
|
|
|
@ -1700,9 +1648,25 @@ 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 != ''){
|
|
|
|
|
|
|
|
|
|
@ -1745,7 +1709,7 @@ if ($cname!= ''){
|
|
|
|
|
// group by month(CreatedDate)
|
|
|
|
|
// ";
|
|
|
|
|
//echo $sql;
|
|
|
|
|
$sql="select dat as CreatedDate,materialrcvddate,sum(quantity)as quantity,sum(value) as value,materialrcvddate
|
|
|
|
|
$sql="select materialrcvddate,sum(quantity)as quantity,sum(value) as value,materialrcvddate
|
|
|
|
|
from year_inward
|
|
|
|
|
where status != 'ST030' and date(materialrcvddate) >= '$a-04-01' and date(materialrcvddate) <= '$b-03-31'
|
|
|
|
|
group by month(materialrcvddate)";
|
|
|
|
|
@ -1879,31 +1843,31 @@ if ($cname!= ''){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$sql="select sid,mid,supplier_name,material_name,
|
|
|
|
|
SUM(IF(month(dat) = 4, quantity, 0)) AS April,
|
|
|
|
|
SUM(IF(month(dat) = 5, quantity, 0)) AS May,
|
|
|
|
|
SUM(IF(month(dat) = 6, quantity, 0)) AS June,
|
|
|
|
|
SUM(IF(month(dat) = 7, quantity, 0)) AS July,
|
|
|
|
|
SUM(IF(month(dat) = 8, quantity, 0)) AS August,
|
|
|
|
|
SUM(IF(month(dat) = 9, quantity, 0)) AS September,
|
|
|
|
|
SUM(IF(month(dat) = 10, quantity, 0)) AS October,
|
|
|
|
|
SUM(IF(month(dat) = 11, quantity, 0)) AS November,
|
|
|
|
|
SUM(IF(month(dat) = 12, quantity, 0)) AS December,
|
|
|
|
|
SUM(IF(month(dat) = 1, quantity, 0)) AS January,
|
|
|
|
|
SUM(IF(month(dat) = 2, quantity, 0)) AS February,
|
|
|
|
|
SUM(IF(month(dat) = 3, quantity, 0)) AS March,
|
|
|
|
|
sum(quantity) as qtotal,
|
|
|
|
|
SUM(IF(month(dat) = 4, value, 0)) AS vApril,
|
|
|
|
|
SUM(IF(month(dat) = 5, value, 0)) AS vMay,
|
|
|
|
|
SUM(IF(month(dat) = 6, value, 0)) AS vJune,
|
|
|
|
|
SUM(IF(month(dat) = 7, value, 0)) AS vJuly,
|
|
|
|
|
SUM(IF(month(dat) = 8, value, 0)) AS vAugust,
|
|
|
|
|
SUM(IF(month(dat) = 9, value, 0)) AS vSeptember,
|
|
|
|
|
SUM(IF(month(dat) = 10, value, 0)) AS vOctober,
|
|
|
|
|
SUM(IF(month(dat) = 11, value, 0)) AS vNovember,
|
|
|
|
|
SUM(IF(month(dat) = 12, value, 0)) AS vDecember,
|
|
|
|
|
SUM(IF(month(dat) = 1, value, 0)) AS vJanuary,
|
|
|
|
|
SUM(IF(month(dat) = 2, value, 0)) AS vFebruary,
|
|
|
|
|
SUM(IF(month(dat) = 3, value, 0)) AS vMarch,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 4, quantity, 0)) AS April,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 5, quantity, 0)) AS May,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 6, quantity, 0)) AS June,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 7, quantity, 0)) AS July,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 8, quantity, 0)) AS August,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 9, quantity, 0)) AS September,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 10, quantity, 0)) AS October,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 11, quantity, 0)) AS November,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 12, quantity, 0)) AS December,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 1, quantity, 0)) AS January,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 2, quantity, 0)) AS February,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 3, quantity, 0)) AS March,
|
|
|
|
|
sum(quantity) as qtotal,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 4, value, 0)) AS vApril,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 5, value, 0)) AS vMay,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 6, value, 0)) AS vJune,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 7, value, 0)) AS vJuly,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 8, value, 0)) AS vAugust,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 9, value, 0)) AS vSeptember,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 10, value, 0)) AS vOctober,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 11, value, 0)) AS vNovember,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 12, value, 0)) AS vDecember,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 1, value, 0)) AS vJanuary,
|
|
|
|
|
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
|
|
|
|
|
where status != 'ST030' ";
|
|
|
|
|
@ -2111,32 +2075,32 @@ if ($cname!= ''){
|
|
|
|
|
function rawi_report_consolidate($cname,$fa,$aa){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$sql="select sid,mid,category,supplier_name,material_name,
|
|
|
|
|
SUM(IF(month(dat) = 4, quantity, 0)) AS April,
|
|
|
|
|
SUM(IF(month(dat) = 5, quantity, 0)) AS May,
|
|
|
|
|
SUM(IF(month(dat) = 6, quantity, 0)) AS June,
|
|
|
|
|
SUM(IF(month(dat) = 7, quantity, 0)) AS July,
|
|
|
|
|
SUM(IF(month(dat) = 8, quantity, 0)) AS August,
|
|
|
|
|
SUM(IF(month(dat) = 9, quantity, 0)) AS September,
|
|
|
|
|
SUM(IF(month(dat) = 10, quantity, 0)) AS October,
|
|
|
|
|
SUM(IF(month(dat) = 11, quantity, 0)) AS November,
|
|
|
|
|
SUM(IF(month(dat) = 12, quantity, 0)) AS December,
|
|
|
|
|
SUM(IF(month(dat) = 1, quantity, 0)) AS January,
|
|
|
|
|
SUM(IF(month(dat) = 2, quantity, 0)) AS February,
|
|
|
|
|
SUM(IF(month(dat) = 3, quantity, 0)) AS March,
|
|
|
|
|
sum(quantity) as qtotal,
|
|
|
|
|
SUM(IF(month(dat) = 4, value, 0)) AS vApril,
|
|
|
|
|
SUM(IF(month(dat) = 5, value, 0)) AS vMay,
|
|
|
|
|
SUM(IF(month(dat) = 6, value, 0)) AS vJune,
|
|
|
|
|
SUM(IF(month(dat) = 7, value, 0)) AS vJuly,
|
|
|
|
|
SUM(IF(month(dat) = 8, value, 0)) AS vAugust,
|
|
|
|
|
SUM(IF(month(dat) = 9, value, 0)) AS vSeptember,
|
|
|
|
|
SUM(IF(month(dat) = 10, value, 0)) AS vOctober,
|
|
|
|
|
SUM(IF(month(dat) = 11, value, 0)) AS vNovember,
|
|
|
|
|
SUM(IF(month(dat) = 12, value, 0)) AS vDecember,
|
|
|
|
|
SUM(IF(month(dat) = 1, value, 0)) AS vJanuary,
|
|
|
|
|
SUM(IF(month(dat) = 2, value, 0)) AS vFebruary,
|
|
|
|
|
SUM(IF(month(dat) = 3, value, 0)) AS vMarch,
|
|
|
|
|
$sql="select sid,mid,category,supplier_name,material_name,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 4, quantity, 0)) AS April,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 5, quantity, 0)) AS May,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 6, quantity, 0)) AS June,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 7, quantity, 0)) AS July,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 8, quantity, 0)) AS August,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 9, quantity, 0)) AS September,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 10, quantity, 0)) AS October,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 11, quantity, 0)) AS November,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 12, quantity, 0)) AS December,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 1, quantity, 0)) AS January,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 2, quantity, 0)) AS February,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 3, quantity, 0)) AS March,
|
|
|
|
|
sum(quantity) as qtotal,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 4, value, 0)) AS vApril,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 5, value, 0)) AS vMay,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 6, value, 0)) AS vJune,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 7, value, 0)) AS vJuly,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 8, value, 0)) AS vAugust,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 9, value, 0)) AS vSeptember,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 10, value, 0)) AS vOctober,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 11, value, 0)) AS vNovember,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 12, value, 0)) AS vDecember,
|
|
|
|
|
SUM(IF(month(materialrcvddate) = 1, value, 0)) AS vJanuary,
|
|
|
|
|
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
|
|
|
|
|
where status != 'ST030' ";
|
|
|
|
|
|