diff --git a/application/config/routes.php b/application/config/routes.php index 8ee55d3e..02069f7e 100755 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -241,6 +241,7 @@ $route['Report_cumulative_inward'] = "report/icumulative"; $route['Report_cumulative_raw'] = "report/rawi_cumulative"; $route['Report_consolidate_category'] = "report/rawi_consolidate"; $route['Report_pending_purchase'] = "report/pending_purchase"; +$route['Report_purchase_attach'] = "report/iattach"; $route['cashbookreport']="report/cashbook"; $route['cashbookmonthlyexpenses']="report/monthexpenses"; $route['cashbookyearlyexpenses']="report/yearexpenses"; diff --git a/application/controllers/report.php b/application/controllers/report.php index c39398a4..f3101936 100755 --- a/application/controllers/report.php +++ b/application/controllers/report.php @@ -568,22 +568,58 @@ class report extends BaseController $ab=$this->input->get('ab'); $fa=substr($ab,0,-5); $aa=substr($ab,5,5); - $m=$this->input->get('month'); + $m=$this->input->get('m'); $frm = $this->input->get('frm'); $t = $this->input->get('t'); $sid=$this->input->get('sid'); $mid = $this->input->get('mid'); $d = $this->input->get('d'); + $da = $this->input->get('da'); + $po = $this->input->get('po'); //print_r($m);die(); $data['material']=$this->dahsboard_Model->material_name(); $data['cust']=$this->dahsboard_Model->customer_name(); $data['finyear']=$this->dahsboard_Model->report_finyear(); - $data['purchase']=$this->dahsboard_Model->ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat); + $data['purchase']=$this->dahsboard_Model->ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat,$da,$po); } $this->loadviews("Report_purchase_inward",$this->global,$data, NULL); + } + public function iattach() + { + + $this->global['pageTitle'] = 'Siddharth : Reports'; + if ($this->input->post('btn_submit')) { + $cname = $this->input->post('client_name'); + $ab=$this->input->post('financialyear'); + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + $m=$this->input->post('month'); + $frm = $this->input->post('from_date'); + $t = $this->input->post('to_date'); + //print_r($prod); + $data['material']=$this->dahsboard_Model->material_name(); + $data['cust']=$this->dahsboard_Model->customer_name(); + $data['finyear']=$this->dahsboard_Model->report_finyear(); + $data['purchase']=$this->dahsboard_Model->ireport_attachment($cname,$fa,$aa,$m,$frm,$t); + } + + $data['cust']=$this->dahsboard_Model->customer_name(); + $data['finyear']=$this->dahsboard_Model->report_finyear(); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_attach_inward",$this->global,$data, NULL); + } + + else + { + $this->loadViews("access", $this->global, $data, NULL); + } + + + } public function iyear_wise() { diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php index cb825df4..ad62a40a 100755 --- a/application/models/dahsboard_model.php +++ b/application/models/dahsboard_model.php @@ -1392,33 +1392,33 @@ group by supplier_name,material_name"; function ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$cat){ - $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, -ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterSGST),sum(distinct st.After_SGST)),0) as sgst, -ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterCGST),sum(distinct st.After_CGST)),0) as cgst, -ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IGST)),0) as igst, -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.AfterPackagingValue),0),0) 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,sum(id.QuantityAsPerInvoice) * pl.Rate 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(( - if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)), -if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)), -ifnull(sum(distinct id.QuantityAsPerInvoice * 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,pb.FilePath as file + 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))) ++ 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,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.PONO=pm.PONO +left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO where pm.Status != 'ST030' "; if ($cname!= ''){ @@ -1466,36 +1466,36 @@ $sql.="group by pono,material_name,category,supplier_name"; $query = $this->db->query($sql); return $query->result(); } - function ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat){ + function ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat,$da,$po){ - $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, -ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterSGST),sum(distinct st.After_SGST)),0) as sgst, -ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterCGST),sum(distinct st.After_CGST)),0) as cgst, -ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IGST)),0) as igst, -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.AfterPackagingValue),0),0) 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,sum(id.QuantityAsPerInvoice) * pl.Rate 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(( - if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)), -if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)), -ifnull(sum(distinct id.QuantityAsPerInvoice * 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,pb.FilePath as file + 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))) ++ 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,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.PONO=pm.PONO +left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO where pm.Status != 'ST030' "; if ($cname!= ''){ @@ -1549,6 +1549,16 @@ if ($cname!= ''){ $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."' "; + } @@ -1556,6 +1566,67 @@ if ($cname!= ''){ $sql.="group by pono,material_name,category,supplier_name"; // echo $m; // echo $sid; +//echo $sql; + $query = $this->db->query($sql); + return $query->result(); + } + function ireport_attachment($cname,$fa,$aa,$m,$frm,$t){ + + + $sql="select sd.SupplierID as sid,im.PONO as pono,pm.POType as potype,date_format(im.CreatedDate,'%d-%m-%Y') as created_date,sd.SupplierName as supplier_name, +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))) ++ 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,pb.FilePath as file1 +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."'"; + + } + + + + if ($fa and $aa != ''){ + + $sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')"; + + } + if ($m!= ''){ + + $sql.="and monthname(im.CreatedDate) = '".$m."'"; + + } + + if ($frm and $t != ''){ + $fromd= date("Y-m-d",strtotime($frm)); + $tod=date("Y-m-d",strtotime($t)); + + $sql.="and date(im.CreatedDate) >= '".$fromd."' + and date(im.CreatedDate) <= '".$tod."'"; + + } + + $sql.="group by pono"; +// echo $m; +// echo $sid; //echo $sql; $query = $this->db->query($sql); return $query->result(); diff --git a/application/views/Report_attach_inward.php b/application/views/Report_attach_inward.php new file mode 100644 index 00000000..517e1763 --- /dev/null +++ b/application/views/Report_attach_inward.php @@ -0,0 +1,365 @@ + + + + + + + + + +
+ +
+ +
+
+

Inward Summary

+ input->post('client_name')){ + $cl=$this->input->post('client_name'); + echo $cl; + echo ' '.' '; + } + + + if($this->input->post('financialyear')){ + $ab=$this->input->post('financialyear'); + echo '('.$ab.')'; + echo ' '; + + } + if($this->input->post('month')){ + $m=$this->input->post('month'); + echo '('.$m.')'; + echo ' '; + } + if($this->input->post('from_date') && $this->input->post('to_date')){ + $frm = $this->input->post('from_date'); + $t = $this->input->post('to_date'); + echo $frm.'-to-'.$t; + } + + ?>

+
+ + +
+ +
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + + + +
+
+ + +
+ +
+ + + + +
+ +
+

+ + +
+
+
+ + + +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PO NoDateSupplier NameTotal  ()Attachments
+ pono;?> + + created_date;?> + supplier_name;?> + total,2); + echo $rel->total; + ?> + file1)){ ?> + + +
Total   + + +  
+ +
+
+
+ +
+ +
+ + + + + + + + + + + + + \ No newline at end of file diff --git a/application/views/Report_purchase.php b/application/views/Report_purchase.php index 7a5db0d8..5b2b87f4 100755 --- a/application/views/Report_purchase.php +++ b/application/views/Report_purchase.php @@ -215,8 +215,8 @@ if(!empty($mms))
-
- +
+
diff --git a/application/views/Report_purchase_inward.php b/application/views/Report_purchase_inward.php index b5bcdaa5..449327f6 100755 --- a/application/views/Report_purchase_inward.php +++ b/application/views/Report_purchase_inward.php @@ -15,18 +15,19 @@ if(!empty($mms)) }); + @@ -49,7 +51,7 @@ if(!empty($mms))
-

Report - Purchase-Inward

+

Inward Details

input->post('client_name')){ $cl=$this->input->post('client_name'); @@ -214,8 +216,8 @@ if(!empty($mms))

-
-

PO No
+
+
@@ -481,9 +483,11 @@ if(!empty($mms)) // Set up your table $(document).ready(function() { table = $('#cc').DataTable( { + responsive: true, + "dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" + "<'row'<'col-md-6'><'col-md-6'>>" + -"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>", +"<'row'<'col-md-12't>><'row'<'col-md-2'i><'col-md-10'p>>", buttons: [ { diff --git a/application/views/Report_year_wise.php b/application/views/Report_year_wise.php index 3035f988..b78770c5 100755 --- a/application/views/Report_year_wise.php +++ b/application/views/Report_year_wise.php @@ -189,7 +189,18 @@ if(!empty($mms))
PO No