changes in dashboard model
This commit is contained in:
parent
a34a9db3fb
commit
34e3f0a56a
@ -2,6 +2,14 @@
|
|||||||
|
|
||||||
class dahsboard_Model extends CI_Model
|
class dahsboard_Model extends CI_Model
|
||||||
{
|
{
|
||||||
|
function getUserCount()
|
||||||
|
{
|
||||||
|
|
||||||
|
$sql="select count(userId) as users FROM tbl_users where isDeleted ='0'";
|
||||||
|
$query =$this->db->query($sql);
|
||||||
|
return $query->result();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* HR DASHBOART Model START*/
|
/* HR DASHBOART Model START*/
|
||||||
@ -895,7 +903,6 @@ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IG
|
|||||||
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0) as discount,
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0) as discount,
|
||||||
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0) as freight,
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0) as freight,
|
||||||
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0) as Package,
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0) as Package,
|
||||||
ifnull(rt.Insurance,0) as insurance,
|
|
||||||
round((
|
round((
|
||||||
if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)),
|
if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)),
|
||||||
if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)),
|
if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)),
|
||||||
@ -905,7 +912,6 @@ ifnull(sum(pl.Quantity * pl.Rate),0)))
|
|||||||
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IGST)),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.AfterFreightValue),sum(distinct st.AfterFreightValue)),0)
|
||||||
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0)
|
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0)
|
||||||
+ ifnull(rt.Insurance,0)
|
|
||||||
- ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total
|
- ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total
|
||||||
FROM T_PurchaseOrder_Master pm
|
FROM T_PurchaseOrder_Master pm
|
||||||
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
|
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
|
||||||
@ -971,7 +977,6 @@ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IG
|
|||||||
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0) as discount,
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0) as discount,
|
||||||
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0) as freight,
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0) as freight,
|
||||||
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0) as Package,
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0) as Package,
|
||||||
ifnull(rt.Insurance,0) as insurance,
|
|
||||||
round((
|
round((
|
||||||
if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)),
|
if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)),
|
||||||
if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)),
|
if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)),
|
||||||
@ -981,7 +986,6 @@ ifnull(sum(pl.Quantity * pl.Rate),0)))
|
|||||||
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IGST)),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.AfterFreightValue),sum(distinct st.AfterFreightValue)),0)
|
||||||
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0)
|
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0)
|
||||||
+ ifnull(rt.Insurance,0)
|
|
||||||
- ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total
|
- ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total
|
||||||
FROM T_PurchaseOrder_Master pm
|
FROM T_PurchaseOrder_Master pm
|
||||||
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
|
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
|
||||||
@ -1131,7 +1135,8 @@ group by supplier_name,material_name";
|
|||||||
case pm.POType
|
case pm.POType
|
||||||
when 'IMPORT'
|
when 'IMPORT'
|
||||||
then ifnull((sum(distinct(pl.Quantity * pl.Rate) * pm.ExchangeRate)
|
then ifnull((sum(distinct(pl.Quantity * pl.Rate) * pm.ExchangeRate)
|
||||||
),0) + ifnull(rt.Insurance,0)
|
|
||||||
|
),0)
|
||||||
when 'CAPITAL'
|
when 'CAPITAL'
|
||||||
then sum(distinct if(pm.CapitalRange=0,(( pl.Quantity * pl.Rate) * pm.ExchangeRate),( pl.Quantity * pl.Rate)
|
then sum(distinct if(pm.CapitalRange=0,(( pl.Quantity * pl.Rate) * pm.ExchangeRate),( pl.Quantity * pl.Rate)
|
||||||
- st.Afterdiscountval))
|
- st.Afterdiscountval))
|
||||||
@ -1139,7 +1144,6 @@ then sum(distinct if(pm.CapitalRange=0,(( pl.Quantity * pl.Rate) * pm.ExchangeR
|
|||||||
+ ifnull(sum(distinct st.After_CGST),0)
|
+ ifnull(sum(distinct st.After_CGST),0)
|
||||||
+ ifnull(sum(distinct st.After_IGST),0)
|
+ ifnull(sum(distinct st.After_IGST),0)
|
||||||
+ ifnull(sum(distinct st.AfterFreightValue),0)
|
+ ifnull(sum(distinct st.AfterFreightValue),0)
|
||||||
+ ifnull(rt.Insurance,0)
|
|
||||||
|
|
||||||
|
|
||||||
when 'SERVICE'
|
when 'SERVICE'
|
||||||
@ -1148,7 +1152,6 @@ then ifnull(sum(distinct pl.Quantity * pl.Rate),0)
|
|||||||
+ ifnull(sum(distinct st.After_CGST),0)
|
+ ifnull(sum(distinct st.After_CGST),0)
|
||||||
+ ifnull(sum(distinct st.After_IGST),0)
|
+ ifnull(sum(distinct st.After_IGST),0)
|
||||||
+ ifnull(sum(distinct st.AfterFreightValue),0)
|
+ ifnull(sum(distinct st.AfterFreightValue),0)
|
||||||
+ ifnull(rt.Insurance,0)
|
|
||||||
- ifnull(sum(distinct st.Afterdiscountval),0)
|
- ifnull(sum(distinct st.Afterdiscountval),0)
|
||||||
|
|
||||||
when 'REVENUE'
|
when 'REVENUE'
|
||||||
@ -1159,7 +1162,6 @@ then ifnull(sum(distinct pl.Quantity * pl.Rate),0)
|
|||||||
+ ifnull(sum(distinct rt.AfterIGST),0)
|
+ ifnull(sum(distinct rt.AfterIGST),0)
|
||||||
+ ifnull(sum(distinct rt.AfterFreightValue),0)
|
+ ifnull(sum(distinct rt.AfterFreightValue),0)
|
||||||
+ ifnull(sum(distinct rt.AfterPackagingValue),0)
|
+ ifnull(sum(distinct rt.AfterPackagingValue),0)
|
||||||
+ ifnull(rt.Insurance,0)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
as total
|
as total
|
||||||
@ -1398,56 +1400,32 @@ group by supplier_name,material_name";
|
|||||||
function ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$cat){
|
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,
|
$sql="select im.IGRNO as igrn,im.PONO as pono,pm.POType as potype,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(distinct id.QuantityAsPerInvoice) as quantity,pl.Rate as rate,sum(distinct id.QuantityAsPerInvoice) * pl.Rate as value,if(POType = 'IMPORT' or POType = 'CAPITAL',sum(distinct pm.ExchangeRate),0) as exchange_rate,
|
||||||
round(ifnull(if(POType = 'REVENUE',
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterSGST),sum(distinct st.After_SGST)),0) as sgst,
|
||||||
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterCGST),sum(distinct st.After_CGST)),0) as cgst,
|
||||||
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) as sgst,
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IGST)),0) as igst,
|
||||||
round(ifnull(if(POType = 'REVENUE',
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0) as discount,
|
||||||
sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0) as freight,
|
||||||
sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2) as cgst,
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0) as Package,
|
||||||
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((
|
round((
|
||||||
if(POType = 'IMPORT',sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
||||||
if(POType = 'CAPITAL' && CapitalRange = 0,sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
||||||
ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)))
|
ifnull(sum(distinct id.QuantityAsPerInvoice * pl.Rate),0)))
|
||||||
+ round(ifnull(if(POType = 'REVENUE',
|
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterSGST),sum(distinct st.After_SGST)),0)
|
||||||
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterCGST),sum(distinct st.After_CGST)),0)
|
||||||
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
|
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IGST)),0)
|
||||||
+ round(ifnull(if(POType = 'REVENUE',
|
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0)
|
||||||
sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
|
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0)
|
||||||
sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2)
|
- ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total,pb.FilePath as file
|
||||||
+ 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,
|
|
||||||
pb.FilePath as file
|
|
||||||
from T_IGR_Master im
|
from T_IGR_Master im
|
||||||
|
join T_IGR_Details id on id.IGRNO = im.IGRNO
|
||||||
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
|
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
|
join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
|
||||||
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
|
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
|
||||||
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||||
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
|
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_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
|
||||||
left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
|
left join T_PurchaseOrder_BillUpload pb on pb.PONO=pm.PONO
|
||||||
where pm.Status != 'ST030' ";
|
where pm.Status != 'ST030' ";
|
||||||
|
|
||||||
if ($cname!= ''){
|
if ($cname!= ''){
|
||||||
@ -1495,59 +1473,35 @@ $sql.="group by pono,material_name,category,supplier_name";
|
|||||||
$query = $this->db->query($sql);
|
$query = $this->db->query($sql);
|
||||||
return $query->result();
|
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){
|
||||||
|
|
||||||
|
|
||||||
$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,
|
$sql="select im.IGRNO as igrn,im.PONO as pono,pm.POType as potype,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(distinct id.QuantityAsPerInvoice) as quantity,pl.Rate as rate,sum(distinct id.QuantityAsPerInvoice) * pl.Rate as value,if(POType = 'IMPORT' or POType = 'CAPITAL',sum(distinct pm.ExchangeRate),0) as exchange_rate,
|
||||||
round(ifnull(if(POType = 'REVENUE',
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterSGST),sum(distinct st.After_SGST)),0) as sgst,
|
||||||
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterCGST),sum(distinct st.After_CGST)),0) as cgst,
|
||||||
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) as sgst,
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IGST)),0) as igst,
|
||||||
round(ifnull(if(POType = 'REVENUE',
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0) as discount,
|
||||||
sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0) as freight,
|
||||||
sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2) as cgst,
|
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0) as Package,
|
||||||
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((
|
round((
|
||||||
if(POType = 'IMPORT',sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
||||||
if(POType = 'CAPITAL' && CapitalRange = 0,sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
||||||
ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)))
|
ifnull(sum(distinct id.QuantityAsPerInvoice * pl.Rate),0)))
|
||||||
+ round(ifnull(if(POType = 'REVENUE',
|
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterSGST),sum(distinct st.After_SGST)),0)
|
||||||
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterCGST),sum(distinct st.After_CGST)),0)
|
||||||
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
|
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IGST)),0)
|
||||||
+ round(ifnull(if(POType = 'REVENUE',
|
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0)
|
||||||
sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
|
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0)
|
||||||
sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2)
|
- ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total,pb.FilePath as file
|
||||||
+ 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,
|
|
||||||
pb.FilePath as file
|
|
||||||
from T_IGR_Master im
|
from T_IGR_Master im
|
||||||
|
join T_IGR_Details id on id.IGRNO = im.IGRNO
|
||||||
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
|
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
|
join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
|
||||||
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
|
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
|
||||||
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||||
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
|
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_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
|
||||||
left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
|
left join T_PurchaseOrder_BillUpload pb on pb.PONO=pm.PONO
|
||||||
where pm.Status != 'ST030' ";
|
where pm.Status != 'ST030' ";
|
||||||
|
|
||||||
if ($cname!= ''){
|
if ($cname!= ''){
|
||||||
@ -1601,16 +1555,6 @@ if ($cname!= ''){
|
|||||||
|
|
||||||
$sql.=" and mm.Category = '".$cat."' ";
|
$sql.=" and mm.Category = '".$cat."' ";
|
||||||
|
|
||||||
}
|
|
||||||
if ($da!= ''){
|
|
||||||
$ddd= date("Y-m-d",strtotime($da));
|
|
||||||
$sql.=" and date(im.CreatedDate) = '".$ddd."' ";
|
|
||||||
|
|
||||||
}
|
|
||||||
if ($po!= ''){
|
|
||||||
|
|
||||||
$sql.=" and im.PONO = '".$po."' ";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1622,6 +1566,8 @@ $sql.="group by pono,material_name,category,supplier_name";
|
|||||||
$query = $this->db->query($sql);
|
$query = $this->db->query($sql);
|
||||||
return $query->result();
|
return $query->result();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function ireport_attachment($cname,$fa,$aa,$m,$frm,$t){
|
function ireport_attachment($cname,$fa,$aa,$m,$frm,$t){
|
||||||
|
|
||||||
|
|
||||||
@ -1711,50 +1657,46 @@ group by material_name,supplier_name";
|
|||||||
|
|
||||||
case pm.POType
|
case pm.POType
|
||||||
when 'IMPORT'
|
when 'IMPORT'
|
||||||
then ifnull((sum((id.QuantityAsPerInvoice * pl.Rate) * pm.ExchangeRate)
|
then ifnull((sum(distinct(id.QuantityAsPerInvoice * pl.Rate) * pm.ExchangeRate)
|
||||||
+ ifnull(rt.Insurance,0)
|
|
||||||
|
|
||||||
),0)
|
),0)
|
||||||
when 'CAPITAL'
|
when 'CAPITAL'
|
||||||
then sum( if(pm.CapitalRange=0,(( id.QuantityAsPerInvoice * pl.Rate) * pm.ExchangeRate),( id.QuantityAsPerInvoice * pl.Rate)
|
then sum(distinct if(pm.CapitalRange=0,(( id.QuantityAsPerInvoice * pl.Rate) * pm.ExchangeRate),( id.QuantityAsPerInvoice * pl.Rate)
|
||||||
- st.Afterdiscountval))
|
- st.Afterdiscountval))
|
||||||
+ ifnull(sum(st.After_SGST),0)
|
+ ifnull(sum(distinct st.After_SGST),0)
|
||||||
+ ifnull(sum(st.After_CGST),0)
|
+ ifnull(sum(distinct st.After_CGST),0)
|
||||||
+ ifnull(sum(st.After_IGST),0)
|
+ ifnull(sum(distinct st.After_IGST),0)
|
||||||
+ ifnull(sum(st.AfterFreightValue),0)
|
+ ifnull(sum(distinct st.AfterFreightValue),0)
|
||||||
+ ifnull(rt.Insurance,0)
|
|
||||||
|
|
||||||
|
|
||||||
when 'SERVICE'
|
when 'SERVICE'
|
||||||
then ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)
|
then ifnull(sum(distinct id.QuantityAsPerInvoice * pl.Rate),0)
|
||||||
+ ifnull(sum(st.After_SGST),0)
|
+ ifnull(sum(distinct st.After_SGST),0)
|
||||||
+ ifnull(sum(st.After_CGST),0)
|
+ ifnull(sum(distinct st.After_CGST),0)
|
||||||
+ ifnull(sum(st.After_IGST),0)
|
+ ifnull(sum(distinct st.After_IGST),0)
|
||||||
+ ifnull(sum(st.AfterFreightValue),0)
|
+ ifnull(sum(distinct st.AfterFreightValue),0)
|
||||||
+ ifnull(rt.Insurance,0)
|
- ifnull(sum(distinct st.Afterdiscountval),0)
|
||||||
- ifnull(sum(st.Afterdiscountval),0)
|
|
||||||
|
|
||||||
when 'REVENUE'
|
when 'REVENUE'
|
||||||
then ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)
|
then ifnull(sum(distinct id.QuantityAsPerInvoice * pl.Rate),0)
|
||||||
- ifnull(sum(rt.AfterDiscount),0)
|
- ifnull(sum(distinct rt.AfterDiscount),0)
|
||||||
+ ifnull(sum(rt.AfterSGST),0)
|
+ ifnull(sum(distinct rt.AfterSGST),0)
|
||||||
+ ifnull(sum(rt.AfterCGST),0)
|
+ ifnull(sum(distinct rt.AfterCGST),0)
|
||||||
+ ifnull(sum(rt.AfterIGST),0)
|
+ ifnull(sum(distinct rt.AfterIGST),0)
|
||||||
+ ifnull(sum(rt.AfterFreightValue),0)
|
+ ifnull(sum(distinct rt.AfterFreightValue),0)
|
||||||
+ ifnull(sum(rt.AfterPackagingValue),0)
|
+ ifnull(sum(distinct rt.AfterPackagingValue),0)
|
||||||
+ ifnull(rt.Insurance,0)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
as total
|
as total
|
||||||
from T_IGR_Master im
|
from T_IGR_Master im
|
||||||
|
join T_IGR_Details id on id.IGRNO = im.IGRNO
|
||||||
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
|
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
|
join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
|
||||||
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
|
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
|
||||||
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||||
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
|
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_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
|
||||||
left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
|
left join T_PurchaseOrder_BillUpload pb on pb.PONO=pm.PONO
|
||||||
where pm.Status != 'ST030' ";
|
where pm.Status != 'ST030' ";
|
||||||
|
|
||||||
if ($cname!= ''){
|
if ($cname!= ''){
|
||||||
@ -2207,6 +2149,30 @@ if ($cname!= ''){
|
|||||||
$query = $this->db->query($sql);
|
$query = $this->db->query($sql);
|
||||||
return $query->result();
|
return $query->result();
|
||||||
|
|
||||||
|
}
|
||||||
|
function month_incexp_report($month,$year)
|
||||||
|
{
|
||||||
|
$sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,
|
||||||
|
ifnull(case
|
||||||
|
when tinc.type = 'PAYMENT'
|
||||||
|
then sum(tinc.total)
|
||||||
|
end,'0') as expense,
|
||||||
|
ifnull(case
|
||||||
|
when tinc.type = 'RECEIPT'
|
||||||
|
then sum(tinc.total)
|
||||||
|
end, '0') as income,
|
||||||
|
ifnull(case
|
||||||
|
when tinc.type = 'PAYMENT'
|
||||||
|
then tinc.towhom
|
||||||
|
end,'-') as paymentname,
|
||||||
|
ifnull(case
|
||||||
|
when tinc.type = 'RECEIPT'
|
||||||
|
then tinc.towhom
|
||||||
|
end, '-') as receiptname,
|
||||||
|
tinc.total,tinc.towhom,tinc.description,monthname(tinc.date)as month,tinc.type,tinc.account_code,ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code where month(tinc.date)= ".$month." and year(tinc.date)=".$year." group by tinc.account_code";
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
return $query->result();
|
||||||
|
|
||||||
}
|
}
|
||||||
//home--this year//
|
//home--this year//
|
||||||
function yearexpensereport($fa,$aa)
|
function yearexpensereport($fa,$aa)
|
||||||
@ -2217,7 +2183,8 @@ if ($cname!= ''){
|
|||||||
sum(total) as total
|
sum(total) as total
|
||||||
from t_income_expense
|
from t_income_expense
|
||||||
where date >= '".$fa."-04-01' and date <= '".$aa."-03-31'
|
where date >= '".$fa."-04-01' and date <= '".$aa."-03-31'
|
||||||
group by month ";
|
group by month
|
||||||
|
ORDER BY FIELD(month,'April','May','June','July','August','September','October','November','December','January', 'February', 'March')";
|
||||||
$query = $this->db->query($sql);
|
$query = $this->db->query($sql);
|
||||||
return $query->result();
|
return $query->result();
|
||||||
|
|
||||||
@ -2234,7 +2201,8 @@ if ($cname!= ''){
|
|||||||
|
|
||||||
function monthwise_data($value='')
|
function monthwise_data($value='')
|
||||||
{
|
{
|
||||||
$sql="SELECT type,Sum(total) as monthlydata FROM t_income_expense WHERE type = ? AND MONTH(date) = MONTH(curdate())";
|
$sql="SELECT type,Sum(total) as monthlydata FROM t_income_expense WHERE type = ? AND MONTH(date) = MONTH(curdate()) AND YEAR(date) = YEAR(curdate())";
|
||||||
|
//$sql="SELECT type,Sum(total) as monthlydata FROM resicoin_RIADev.t_income_expense WHERE type = ? AND MONTH(date) = MONTH(curdate()) And YEAR(date) = YEAR(curdate())"
|
||||||
$query = $this->db->query($sql,array($value));
|
$query = $this->db->query($sql,array($value));
|
||||||
return $query->result();
|
return $query->result();
|
||||||
|
|
||||||
@ -2447,5 +2415,60 @@ function INRSymbol()
|
|||||||
return $query->result();
|
return $query->result();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function daybeforetotal($yesterday){
|
||||||
|
$sql="select date,
|
||||||
|
sum(if(type = 'PAYMENT',total,0)) as payment_amt,
|
||||||
|
sum(if(type = 'RECEIPT',total,0)) as receipt_amt
|
||||||
|
from t_income_expense
|
||||||
|
where date = ? ";
|
||||||
|
$query = $this->db->query($sql,array($yesterday));
|
||||||
|
return $query->result();
|
||||||
|
}
|
||||||
|
|
||||||
|
function minmaxdatevalue(){
|
||||||
|
$sql="SELECT MAX(date) AS Max_Date, MIN(date) AS Min_Date
|
||||||
|
FROM t_income_expense";
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
return $query->result();
|
||||||
|
}
|
||||||
|
|
||||||
|
// function monthbeforetotal($mindate,$maxdate){
|
||||||
|
|
||||||
|
// $sql="SELECT
|
||||||
|
// sum(if(type = 'PAYMENT',total,0)) as payment_amt,
|
||||||
|
// sum(if(type = 'RECEIPT',total,0)) as receipt_amt
|
||||||
|
// FROM t_income_expense
|
||||||
|
// WHERE date BETWEEN ? AND ? ";
|
||||||
|
// $query = $this->db->query($sql,array($mindate,$maxdate));
|
||||||
|
// return $query->result();
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
function monthbeforetotal($month,$year){
|
||||||
|
|
||||||
|
$sql="SELECT month(date) as monthnum ,year(date) as yearnum,
|
||||||
|
sum(if(type = 'PAYMENT',total,0)) as payment_amt,
|
||||||
|
sum(if(type = 'RECEIPT',total,0)) as receipt_amt
|
||||||
|
FROM t_income_expense
|
||||||
|
WHERE
|
||||||
|
month(date) = '".$month."'and year(date) = '".$year."'";
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
return $query->result();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function yearbeforetotal($prefy,$fa){
|
||||||
|
$sql="SELECT
|
||||||
|
sum(if(type = 'PAYMENT',total,0)) as payment_amt,
|
||||||
|
sum(if(type = 'RECEIPT',total,0)) as receipt_amt
|
||||||
|
FROM t_income_expense
|
||||||
|
where date >= '".$prefy."-04-01' and date <= '".$fa."-03-31'";
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
return $query->result();
|
||||||
|
//print_r($query->result());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user