diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php index d49bccad..00abcc4a 100755 --- a/application/models/dahsboard_model.php +++ b/application/models/dahsboard_model.php @@ -503,21 +503,23 @@ TIME_FORMAT(pm.CreatedDate,'%l:%i %p') as created_time, mm.MaterialName as material_name,sd.SupplierName as supplier_name, ifnull(sum(pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(pl.Rate),0) as rate, round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value, +if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate, ifnull(if(POType = 'REVENUE',sum(rt.AfterSGST),sum(st.After_SGST)),0) as sgst, ifnull(if(POType = 'REVENUE',sum(rt.AfterCGST),sum(st.After_CGST)),0) as cgst, ifnull(if(POType = 'REVENUE',sum(rt.AfterIGST),sum(st.After_IGST)),0) as igst, ifnull(if(POType = 'REVENUE',sum(rt.AfterDiscount),sum(st.Afterdiscountval)),0) as discount, ifnull(if(POType = 'REVENUE',sum(rt.AfterFreightValue),sum(st.AfterFreightValue)),0) as freight, ifnull(if(POType = 'REVENUE',sum(rt.AfterPackagingValue),0),0) as Package, -round((ifnull(sum(pl.Quantity * pl.Rate),0) -* ifnull(if(POType = 'IMPORT',sum(pm.ExchangeRate),0),0) -+ ifnull(if(POType = 'REVENUE',sum(rt.AfterSGST),sum(st.After_SGST)),0) -+ ifnull(if(POType = 'REVENUE',sum(rt.AfterCGST),sum(st.After_CGST)),0) -+ ifnull(if(POType = 'REVENUE',sum(rt.AfterIGST),sum(st.After_IGST)),0) -+ ifnull(if(POType = 'REVENUE',sum(rt.AfterFreightValue),sum(st.AfterFreightValue)),0) -+ ifnull(if(POType = 'REVENUE',sum(rt.AfterPackagingValue),0),0) - -- ifnull(if(POType = 'REVENUE',sum(rt.AfterDiscount),sum(st.Afterdiscountval)),0)),2) as total +round(( + if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)), +if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)), +ifnull(sum(pl.Quantity * pl.Rate),0))) ++ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterSGST),sum(distinct st.After_SGST)),0) ++ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterCGST),sum(distinct st.After_CGST)),0) ++ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IGST)),0) ++ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0) ++ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0) +- ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total FROM T_PurchaseOrder_Master pm left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode @@ -575,26 +577,31 @@ TIME_FORMAT(pm.CreatedDate,'%l:%i %p') as created_time, mm.MaterialName as material_name,sd.SupplierName as supplier_name, ifnull(sum(pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(pl.Rate),0) as rate, round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value, +if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate, ifnull(if(POType = 'REVENUE',sum(rt.AfterSGST),sum(st.After_SGST)),0) as sgst, ifnull(if(POType = 'REVENUE',sum(rt.AfterCGST),sum(st.After_CGST)),0) as cgst, ifnull(if(POType = 'REVENUE',sum(rt.AfterIGST),sum(st.After_IGST)),0) as igst, ifnull(if(POType = 'REVENUE',sum(rt.AfterDiscount),sum(st.Afterdiscountval)),0) as discount, ifnull(if(POType = 'REVENUE',sum(rt.AfterFreightValue),sum(st.AfterFreightValue)),0) as freight, ifnull(if(POType = 'REVENUE',sum(rt.AfterPackagingValue),0),0) as Package, -round((ifnull(sum(pl.Quantity * pl.Rate),0) -+ ifnull(if(POType = 'REVENUE',sum(rt.AfterSGST),sum(st.After_SGST)),0) -+ ifnull(if(POType = 'REVENUE',sum(rt.AfterCGST),sum(st.After_CGST)),0) -+ ifnull(if(POType = 'REVENUE',sum(rt.AfterIGST),sum(st.After_IGST)),0) -+ ifnull(if(POType = 'REVENUE',sum(rt.AfterFreightValue),sum(st.AfterFreightValue)),0) -+ ifnull(if(POType = 'REVENUE',sum(rt.AfterPackagingValue),0),0) -- ifnull(if(POType = 'REVENUE',sum(rt.AfterDiscount),sum(st.Afterdiscountval)),0)),2) as total -FROM T_PurchaseOrder_Master pm +round(( + if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)), +if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)), +ifnull(sum(pl.Quantity * pl.Rate),0))) ++ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterSGST),sum(distinct st.After_SGST)),0) ++ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterCGST),sum(distinct st.After_CGST)),0) ++ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IGST)),0) ++ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0) ++ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0) +- ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total + FROM T_PurchaseOrder_Master pm left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo -where pm.Status != 'ST030' "; +where +pm.Status != 'ST030' "; if ($cname!= ''){ @@ -725,11 +732,46 @@ group by supplier_name,material_name"; function report_supplier($cname,$fa,$aa,$m,$frm,$t){ - $sql="SELECT sd.SupplierID as sid,sd.SupplierName as supplier_name,count(pm.PONO) as counts,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value,round(sum(ifnull((pl.Quantity * pl.Rate),0) + ifnull(st.After_SGST,0) + ifnull(st.After_CGST,0) + ifnull(st.After_IGST,0)),2) as total + $sql="SELECT sd.SupplierID as sid,sd.SupplierName as supplier_name,count(pm.PONO) as counts,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value, + +case pm.POType +when 'IMPORT' +then ifnull((sum(distinct(pl.Quantity * pl.Rate) * pm.ExchangeRate) + +),0) +when 'CAPITAL' +then sum(distinct if(pm.CapitalRange=0,(( pl.Quantity * pl.Rate) * pm.ExchangeRate),( pl.Quantity * pl.Rate) +- st.Afterdiscountval)) ++ ifnull(sum(distinct st.After_SGST),0) ++ ifnull(sum(distinct st.After_CGST),0) ++ ifnull(sum(distinct st.After_IGST),0) ++ ifnull(sum(distinct st.AfterFreightValue),0) + + +when 'SERVICE' +then ifnull(sum(distinct pl.Quantity * pl.Rate),0) ++ ifnull(sum(distinct st.After_SGST),0) ++ ifnull(sum(distinct st.After_CGST),0) ++ ifnull(sum(distinct st.After_IGST),0) ++ ifnull(sum(distinct st.AfterFreightValue),0) +- ifnull(sum(distinct st.Afterdiscountval),0) + +when 'REVENUE' +then ifnull(sum(distinct pl.Quantity * pl.Rate),0) +- ifnull(sum(distinct rt.AfterDiscount),0) ++ ifnull(sum(distinct rt.AfterSGST),0) ++ ifnull(sum(distinct rt.AfterCGST),0) ++ ifnull(sum(distinct rt.AfterIGST),0) ++ ifnull(sum(distinct rt.AfterFreightValue),0) ++ ifnull(sum(distinct rt.AfterPackagingValue),0) + +end + as total FROM T_PurchaseOrder_Master pm -join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO -join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID +left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO +left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo +left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo where pm.Status != 'ST030' "; @@ -969,7 +1011,7 @@ group by supplier_name,material_name"; } function departmentwise($sid='') { - $sql="SELECT date,type,total,towhom,description,account_code FROM kasiram9_SIADEV.t_income_expense WHERE account_code = ?"; + $sql="SELECT date,type,total,towhom,description,account_code FROM t_income_expense WHERE account_code = ?"; $query = $this->db->query($sql,array($sid)); //print_r($this->db->last_query()); return $query->result(); @@ -977,7 +1019,7 @@ group by supplier_name,material_name"; } function yearmonthwise($sid='') { - $sql="SELECT date,type,total,description,towhom,account_code FROM kasiram9_SIADEV.t_income_expense WHERE monthname(date) = ? group by account_code"; + $sql="SELECT date,type,total,description,towhom,account_code FROM t_income_expense WHERE monthname(date) = ? group by account_code"; $query = $this->db->query($sql,array($sid)); //print_r($this->db->last_query()); return $query->result(); @@ -986,4 +1028,4 @@ group by supplier_name,material_name"; } -?> \ No newline at end of file +?>zz \ No newline at end of file diff --git a/application/views/Report_purchase.php b/application/views/Report_purchase.php index 759fb872..307e88cc 100755 --- a/application/views/Report_purchase.php +++ b/application/views/Report_purchase.php @@ -195,6 +195,7 @@ if(!empty($mms)) UOM Rate  () Value  () + Exchange Rate SGST  () CGST  () IGST  () @@ -210,6 +211,7 @@ if(!empty($mms)) $tot_qty = 0; $tot_rate = 0; $tot_value = 0; + $tot_ex = 0; $tot_CGST = 0; $tot_SCGT = 0.0000; $tot_ICGT = 0; @@ -239,6 +241,9 @@ if(!empty($mms)) $tot_value= $tot_value + $rel->value; echo $rel->value;?> exchange_rate; + echo $rel->exchange_rate;?> + sgst; echo $rel->sgst;?> Package; echo $rel->Package;?> total; - echo $rel->total;?> + $tot_tot= $tot_tot + round($rel->total,2); + echo round($rel->total,2);?> @@ -312,6 +317,16 @@ if(!empty($mms)) } ?> + + + + + diff --git a/application/views/Report_supplier.php b/application/views/Report_supplier.php index 9ca6beb0..360bcb0d 100755 --- a/application/views/Report_supplier.php +++ b/application/views/Report_supplier.php @@ -169,7 +169,7 @@ if(!empty($mms)) PO Count Quantity Value  () - Total  () + @@ -199,9 +199,7 @@ if(!empty($mms)) value; echo $rel->value;?> - total; - echo $rel->total;?> + @@ -245,16 +243,7 @@ if(!empty($mms)) ?> - - - - - diff --git a/application/views/includes/header.php b/application/views/includes/header.php index bb544f2c..844ffa38 100755 --- a/application/views/includes/header.php +++ b/application/views/includes/header.php @@ -456,7 +456,7 @@ $(function() { } ?> -