diff --git a/application/config/routes.php b/application/config/routes.php
index 5eca5bbd..ee64ad85 100644
--- a/application/config/routes.php
+++ b/application/config/routes.php
@@ -243,7 +243,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['Report_Material_inward_Register'] ="user/getMaterialInwardRegister";
diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php
index 11fc59ef..f5810400 100755
--- a/application/controllers/cashbook.php
+++ b/application/controllers/cashbook.php
@@ -319,7 +319,7 @@ class cashbook extends BaseController
$pathinfo = pathinfo($_FILES['myfile']['name']);
$config['upload_path'] = 'uploads/cashbook/';
- $config['allowed_types'] = 'png|jpg|jpeg';
+ $config['allowed_types'] = 'png|jpg|jpeg|pdf';
$config['file_name'] = $_FILES['myfile']['name'];
//Load upload library and initialize configuration
@@ -451,7 +451,7 @@ class cashbook extends BaseController
{
$cashfile = $this->input->post('id');
$cashid = $this->input->post('ide');
- $filedata= $this->cashbook_model->deletefile($cashid);
+ $filedata= $this->cashbook_model->deletefile($cashid,$cashfile);
echo $filedata;
}
function Removepaymentdetails(){
diff --git a/application/controllers/report.php b/application/controllers/report.php
index 4956b45b..6bc45af6 100755
--- a/application/controllers/report.php
+++ b/application/controllers/report.php
@@ -610,7 +610,41 @@ class report extends BaseController
$this->loadviews("Report_purchase_inward",$this->global,$data, NULL);
- }
+ }
+
+
+ public function iattach()
+ {
+
+ $this->global['pageTitle'] = $this->CompanyName.' : 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()
{
$this->global['pageTitle'] = $this->CompanyName.' : Reports';
diff --git a/application/models/cashbook_model.php b/application/models/cashbook_model.php
index 29fff382..f90169eb 100755
--- a/application/models/cashbook_model.php
+++ b/application/models/cashbook_model.php
@@ -114,11 +114,13 @@ class cashbook_model extends CI_Model
}
- function deletefile($cashid)
+ function deletefile($cashid,$cashfile)
{
+
$sql="UPDATE t_income_expense SET document = NULL
WHERE id = ?";
- $query = $this->db->query($sql,array($cashid));
+ $query = $this->db->query($sql,array($cashid));
+ unlink("uploads/cashbook/".$cashfile);//this deletes the file on particular folder too
//print_r($this->db->last_query());
//echo $sql;
$r = $this->db->affected_rows();
diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php
index a87edc9b..7a6c04b5 100755
--- a/application/models/dahsboard_model.php
+++ b/application/models/dahsboard_model.php
@@ -1,15 +1,7 @@
- db->query($sql);
- return $query->result();
-
- }
/* HR DASHBOART Model START*/
@@ -903,6 +895,7 @@ 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.AfterFreightValue),sum(distinct st.AfterFreightValue)),0) as freight,
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0) as Package,
+ifnull(rt.Insurance,0) as insurance,
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)),
@@ -912,6 +905,7 @@ 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.AfterFreightValue),sum(distinct st.AfterFreightValue)),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
FROM T_PurchaseOrder_Master pm
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
@@ -977,6 +971,7 @@ 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.AfterFreightValue),sum(distinct st.AfterFreightValue)),0) as freight,
ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0) as Package,
+ifnull(rt.Insurance,0) as insurance,
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)),
@@ -986,6 +981,7 @@ 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.AfterFreightValue),sum(distinct st.AfterFreightValue)),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
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
@@ -1135,8 +1131,7 @@ group by supplier_name,material_name";
case pm.POType
when 'IMPORT'
then ifnull((sum(distinct(pl.Quantity * pl.Rate) * pm.ExchangeRate)
-
-),0)
+),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))
@@ -1144,6 +1139,7 @@ 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_IGST),0)
+ ifnull(sum(distinct st.AfterFreightValue),0)
++ ifnull(rt.Insurance,0)
when 'SERVICE'
@@ -1152,6 +1148,7 @@ then ifnull(sum(distinct pl.Quantity * pl.Rate),0)
+ ifnull(sum(distinct st.After_CGST),0)
+ ifnull(sum(distinct st.After_IGST),0)
+ ifnull(sum(distinct st.AfterFreightValue),0)
++ ifnull(rt.Insurance,0)
- ifnull(sum(distinct st.Afterdiscountval),0)
when 'REVENUE'
@@ -1162,6 +1159,7 @@ then ifnull(sum(distinct pl.Quantity * pl.Rate),0)
+ ifnull(sum(distinct rt.AfterIGST),0)
+ ifnull(sum(distinct rt.AfterFreightValue),0)
+ ifnull(sum(distinct rt.AfterPackagingValue),0)
++ ifnull(rt.Insurance,0)
end
as total
@@ -1400,32 +1398,56 @@ 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,round(sum(id.QuantityAsPerInvoice) * pl.Rate,2) as value,if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate,
+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(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)))
++ 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,
+pb.FilePath as file
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_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!= ''){
@@ -1473,35 +1495,59 @@ $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,round(sum(id.QuantityAsPerInvoice) * pl.Rate,2) as value,if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate,
+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(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)))
++ 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,
+pb.FilePath as file
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_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!= ''){
@@ -1555,6 +1601,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."' ";
+
}
@@ -1562,6 +1618,50 @@ 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 pono,potype,date_format(created_date,'%d-%m-%Y') as created_date,supplier_name,
+sum(total) as total,file
+from igr
+where status != 'ST030'
+";
+
+if ($cname!= ''){
+
+ $sql.="and supplier_name = '".$cname."'";
+
+ }
+
+
+
+ if ($fa and $aa != ''){
+
+ $sql.=" and (created_date >= '".$fa."-04-01' and created_date <= '".$aa."-03-31')";
+
+ }
+ if ($m!= ''){
+
+ $sql.="and monthname(created_date) = '".$m."'";
+
+ }
+
+ if ($frm and $t != ''){
+ $fromd= date("Y-m-d",strtotime($frm));
+ $tod=date("Y-m-d",strtotime($t));
+
+ $sql.="and date(created_date) >= '".$fromd."'
+ and date(created_date) <= '".$tod."'";
+
+ }
+
+ $sql.="group by pono";
+// echo $m;
+// echo $sid;
//echo $sql;
$query = $this->db->query($sql);
return $query->result();
@@ -1607,51 +1707,55 @@ group by material_name,supplier_name";
function ireport_supplier($cname,$fa,$aa,$m,$frm,$t){
- $sql="SELECT sd.SupplierID as sid,sd.SupplierName as supplier_name,count(im.PONO) as counts,ifnull(sum(id.QuantityAsPerInvoice),0) as quantity,round(ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0),2) as value,
+ $sql="SELECT sd.SupplierID as sid,sd.SupplierName as supplier_name,count(im.PONO) as counts,ifnull(sum(id.QuantityAsPerInvoice),0) as quantity,round(ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0),2) as value,
case pm.POType
when 'IMPORT'
-then ifnull((sum(distinct(id.QuantityAsPerInvoice * pl.Rate) * pm.ExchangeRate)
+then ifnull((sum((id.QuantityAsPerInvoice * pl.Rate) * pm.ExchangeRate)
++ ifnull(rt.Insurance,0)
),0)
when 'CAPITAL'
-then sum(distinct if(pm.CapitalRange=0,(( id.QuantityAsPerInvoice * pl.Rate) * pm.ExchangeRate),( id.QuantityAsPerInvoice * pl.Rate)
+then sum( if(pm.CapitalRange=0,(( id.QuantityAsPerInvoice * pl.Rate) * pm.ExchangeRate),( id.QuantityAsPerInvoice * 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)
++ ifnull(sum(st.After_SGST),0)
++ ifnull(sum(st.After_CGST),0)
++ ifnull(sum(st.After_IGST),0)
++ ifnull(sum(st.AfterFreightValue),0)
++ ifnull(rt.Insurance,0)
when 'SERVICE'
-then ifnull(sum(distinct id.QuantityAsPerInvoice * 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)
+then ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)
++ ifnull(sum(st.After_SGST),0)
++ ifnull(sum(st.After_CGST),0)
++ ifnull(sum(st.After_IGST),0)
++ ifnull(sum(st.AfterFreightValue),0)
++ ifnull(rt.Insurance,0)
+- ifnull(sum(st.Afterdiscountval),0)
when 'REVENUE'
-then ifnull(sum(distinct id.QuantityAsPerInvoice * 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)
+then ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)
+- ifnull(sum(rt.AfterDiscount),0)
++ ifnull(sum(rt.AfterSGST),0)
++ ifnull(sum(rt.AfterCGST),0)
++ ifnull(sum(rt.AfterIGST),0)
++ ifnull(sum(rt.AfterFreightValue),0)
++ ifnull(sum(rt.AfterPackagingValue),0)
++ ifnull(rt.Insurance,0)
end
as total
-from T_IGR_Master im
-join T_IGR_Details id on id.IGRNO = im.IGRNO
+from T_IGR_Master im
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
-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
-where pm.Status != 'ST030' ";
+ 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!= ''){
@@ -2103,42 +2207,17 @@ if ($cname!= ''){
$query = $this->db->query($sql);
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//
function yearexpensereport($fa,$aa)
- {
+ {
$sql="select monthname(date) as month,
sum(if(type='PAYMENT',total,0)) as exp,
sum(if(type='RECEIPT',total,0)) as inc,
sum(total) as total
from t_income_expense
where date >= '".$fa."-04-01' and date <= '".$aa."-03-31'
- group by month
- ORDER BY FIELD(month,'April','May','June','July','August','September','October','November','December','January', 'February', 'March')";
+ group by month ";
$query = $this->db->query($sql);
return $query->result();
@@ -2155,8 +2234,7 @@ if ($cname!= ''){
function monthwise_data($value='')
{
- $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())"
+ $sql="SELECT type,Sum(total) as monthlydata FROM t_income_expense WHERE type = ? AND MONTH(date) = MONTH(curdate())";
$query = $this->db->query($sql,array($value));
return $query->result();
@@ -2368,62 +2446,6 @@ function INRSymbol()
//echo $sql;
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());
-
- }
-
+ }
}
-?>
-
+?>
\ No newline at end of file
diff --git a/application/views/Report_attach_inward.php b/application/views/Report_attach_inward.php
new file mode 100755
index 00000000..b47cc73c
--- /dev/null
+++ b/application/views/Report_attach_inward.php
@@ -0,0 +1,369 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PO No
+ Date
+ Supplier Name
+ Total ( )
+ Attachments
+
+
+
+
+
+
+
+ pono;?>
+
+
+ created_date;?>
+
+ supplier_name;?>
+
+ total,2);
+ echo $rel->total;
+ ?>
+
+ file1)){ ?>
+ File Available
+
+
+
+
+
+
+
+
+
+
+ Total
+  
+  
+
+
+
+
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/application/views/Report_consolidate_m.php b/application/views/Report_consolidate_m.php
index 0f9178e2..d7ae71b3 100644
--- a/application/views/Report_consolidate_m.php
+++ b/application/views/Report_consolidate_m.php
@@ -26,19 +26,21 @@ if(!empty($mms))
}
.btn-success {
- background-color: #3c8dbc;
- border-color: #3c8dbc;
+ background-color: #5d0411;
+ border-color: #5d0411;
}
+
+
diff --git a/application/views/Report_consolidate_month.php b/application/views/Report_consolidate_month.php
index 4de28c69..7fe408c2 100644
--- a/application/views/Report_consolidate_month.php
+++ b/application/views/Report_consolidate_month.php
@@ -27,19 +27,21 @@ if(!empty($mms))
}
.btn-success {
- background-color: #3c8dbc;
- border-color: #3c8dbc;
+ background-color: #5d0411;
+ border-color: #5d0411;
}
+
+
diff --git a/application/views/Report_consolidate_y.php b/application/views/Report_consolidate_y.php
index 16958502..916b82c6 100644
--- a/application/views/Report_consolidate_y.php
+++ b/application/views/Report_consolidate_y.php
@@ -26,19 +26,21 @@ if(!empty($mms))
}
.btn-success {
- background-color: #3c8dbc;
- border-color: #3c8dbc;
+ background-color: #5d0411;
+ border-color: #5d0411;
}
+
+
diff --git a/application/views/Report_consolidate_year.php b/application/views/Report_consolidate_year.php
index 9cdc9ca7..aa7a2ead 100644
--- a/application/views/Report_consolidate_year.php
+++ b/application/views/Report_consolidate_year.php
@@ -26,20 +26,22 @@ if(!empty($mms))
float: right;
}
- .btn-success {
- background-color: #3c8dbc;
- border-color: #3c8dbc;
+ .btn-success {
+ background-color: #5d0411;
+ border-color: #5d0411;
}
+
+
diff --git a/application/views/Report_cumulative_day_raw.php b/application/views/Report_cumulative_day_raw.php
index 8a5302bc..f7a9bd36 100644
--- a/application/views/Report_cumulative_day_raw.php
+++ b/application/views/Report_cumulative_day_raw.php
@@ -32,6 +32,10 @@ if(!empty($mms))
+
+
+
+
@@ -150,7 +154,8 @@ if(!empty($mms))
-
+
+
diff --git a/application/views/Report_cumulative_month_raw.php b/application/views/Report_cumulative_month_raw.php
index 07a8fd19..b2c9d2ee 100644
--- a/application/views/Report_cumulative_month_raw.php
+++ b/application/views/Report_cumulative_month_raw.php
@@ -33,6 +33,10 @@ if(!empty($mms))
+
+
+
+
@@ -176,6 +180,8 @@ if(!empty($mms))
+
+
diff --git a/application/views/Report_cumulative_year_raw.php b/application/views/Report_cumulative_year_raw.php
index 25503c68..a6275c93 100644
--- a/application/views/Report_cumulative_year_raw.php
+++ b/application/views/Report_cumulative_year_raw.php
@@ -32,6 +32,10 @@ if(!empty($mms))
+
+
+
+
@@ -181,7 +185,8 @@ if(!empty($mms))
-
+
+
diff --git a/application/views/Report_month_wise.php b/application/views/Report_month_wise.php
index 6968aaa7..ed1878f5 100644
--- a/application/views/Report_month_wise.php
+++ b/application/views/Report_month_wise.php
@@ -26,8 +26,8 @@ if(!empty($mms))
}
.btn-success {
- background-color: #3c8dbc;
- border-color: #3c8dbc;
+ background-color: #5d0411;
+ border-color: #5d0411;
}
diff --git a/application/views/Report_month_wise_inward.php b/application/views/Report_month_wise_inward.php
index ae98589a..c019c1f8 100644
--- a/application/views/Report_month_wise_inward.php
+++ b/application/views/Report_month_wise_inward.php
@@ -32,6 +32,10 @@ if(!empty($mms))
+
+
+
+
@@ -126,6 +130,8 @@ if(!empty($mms))
+
+
diff --git a/application/views/addnewIncomeExpense.php b/application/views/addnewIncomeExpense.php
index 54a7d979..f16a0b04 100755
--- a/application/views/addnewIncomeExpense.php
+++ b/application/views/addnewIncomeExpense.php
@@ -198,7 +198,7 @@
@@ -343,7 +343,7 @@
File Upload:
-
+
diff --git a/application/views/editincomeexpenses.php b/application/views/editincomeexpenses.php
index 5e9ec47b..a0c4d410 100755
--- a/application/views/editincomeexpenses.php
+++ b/application/views/editincomeexpenses.php
@@ -213,13 +213,13 @@ if(!empty($PaymentMultiple))
@@ -443,10 +443,10 @@ if(!empty($PaymentMultiple))
@@ -577,6 +577,7 @@ if(type == "RECEIPT")
function readURL(input,id) {
//alert(id);
+ $("#strname").remove();
if (input.files && input.files[0]) {
var reader = new FileReader();
@@ -608,7 +609,7 @@ function readURL(input,id) {
function paymentreadURL(input) {
-
+ $("#strname").remove();
if (input.files && input.files[0]) {
var reader = new FileReader();
@@ -813,7 +814,7 @@ function GSTvalue(id)
{
$('#deleteflag').val(1);
- var file = "";
+ var file = "";
//var id2='';
var id2= $('#id1').val();
//alert(file);
@@ -826,8 +827,9 @@ $.ajax({
if(data==1)
{
$('#content').loader('hide');
- alert('Delete Successfully');
+ $("#strname").remove();
$('#receiptslip').attr('src', '');
+ alert('Delete Successfully');
//window.location ="cashbook/incomeExpenseList";
}
diff --git a/application/views/reportslink.php b/application/views/reportslink.php
index 691bff6f..754291fa 100644
--- a/application/views/reportslink.php
+++ b/application/views/reportslink.php
@@ -12,67 +12,69 @@
+
diff --git a/application/views/viewIndIncomeExpense.php b/application/views/viewIndIncomeExpense.php
index afe26570..4e6d68c3 100755
--- a/application/views/viewIndIncomeExpense.php
+++ b/application/views/viewIndIncomeExpense.php
@@ -1,4 +1,4 @@
-
+
+
+
+
+
@@ -136,8 +207,37 @@ if(!empty($data))
@@ -162,5 +262,105 @@ $(function () {
"autoWidth": true
});
+ //showPDF();
});
-
+
+// var __PDF_DOC,
+// __CURRENT_PAGE,
+// __TOTAL_PAGES,
+// __PAGE_RENDERING_IN_PROGRESS = 0,
+// __CANVAS = $('#pdf-canvas').get(0),
+// __CANVAS_CTX = __CANVAS.getContext('2d');
+
+// function showPDF() {
+
+// $("#pdf-loader").show();
+
+// PDFJS.getDocument({ url: }).then(function() {
+// __PDF_DOC = ;
+// __TOTAL_PAGES = __PDF_DOC.numPages;
+
+// // Hide the pdf loader and show pdf container in HTML
+// $("#pdf-loader").hide();
+// $("#pdf-contents").show();
+// $("#pdf-total-pages").text(__TOTAL_PAGES);
+
+// // Show the first page
+// showPage(1);
+// }).catch(function(error) {
+// // If error re-show the upload button
+// $("#pdf-loader").hide();
+// // $("#upload-button").show();
+
+// alert(error.message);
+// });;
+// }
+
+// function showPage(page_no) {
+// __PAGE_RENDERING_IN_PROGRESS = 1;
+// __CURRENT_PAGE = page_no;
+
+// // Disable Prev & Next buttons while page is being loaded
+// $("#pdf-next, #pdf-prev").attr('disabled', 'disabled');
+
+// // While page is being rendered hide the canvas and show a loading message
+// $("#pdf-canvas").hide();
+// $("#page-loader").show();
+
+// // Update current page in HTML
+// $("#pdf-current-page").text(page_no);
+
+// // Fetch the page
+// __PDF_DOC.getPage(page_no).then(function(page) {
+// // As the canvas is of a fixed width we need to set the scale of the viewport accordingly
+// var scale_required = __CANVAS.width / page.getViewport(1).width;
+
+// // Get viewport of the page at required scale
+// var viewport = page.getViewport(scale_required);
+
+// // Set canvas height
+// __CANVAS.height = viewport.height;
+
+// var renderContext = {
+// canvasContext: __CANVAS_CTX,
+// viewport: viewport
+// };
+
+// // Render the page contents in the canvas
+// page.render(renderContext).then(function() {
+// __PAGE_RENDERING_IN_PROGRESS = 0;
+
+// // Re-enable Prev & Next buttons
+// $("#pdf-next, #pdf-prev").removeAttr('disabled');
+
+// // Show the canvas and hide the page loader
+// $("#pdf-canvas").show();
+// $("#page-loader").hide();
+// });
+// });
+// }
+
+// // Upon click this should should trigger click on the #file-to-upload file input element
+// // This is better than showing the not-good-looking file input element
+// // $("#upload-button").on('click', function() {
+// // $("#file-to-upload").trigger('click');
+// // });
+
+// // When user chooses a PDF file
+// // $("#file-to-upload").on('change', function() {
+// // showPDF(URL.createObjectURL($("#file-to-upload").get(0).files[0]));
+// // });
+
+// // Previous page of the PDF
+// $("#pdf-prev").on('click', function() {
+// if(__CURRENT_PAGE != 1)
+// showPage(--__CURRENT_PAGE);
+// });
+
+// // Next page of the PDF
+// $("#pdf-next").on('click', function() {
+// if(__CURRENT_PAGE != __TOTAL_PAGES)
+// showPage(++__CURRENT_PAGE);
+// });
+
+
\ No newline at end of file