issues fixes

This commit is contained in:
venbatechnologies@gmail.com 2018-07-09 16:49:39 +05:30
parent f17ccdb5a6
commit 3f88e039fb
14 changed files with 552 additions and 317 deletions

View File

@ -320,7 +320,25 @@ class amendmentpurchaseorder extends BaseController
$APO=$this->purchaseorder_model->updateAmendPOMaster($PONO,$PODetail);
$LineItemStatus = REQITEM_NEW;
$igrvalue = $this->purchaseorder_model->selectigrmaster($PONO);
$po = '';
$igrno ='';
foreach ($igrvalue as $value) {
$igrno = $value->IGRNO;
$po =$value->PONO;
if($PONO == $po)
{
$NewPOno = array('PONO' =>$NewPO);
$this->purchaseorder_model->updateigrmaster($igrno,$NewPOno);
}
}
for ($i = 1; $i <= $RowCount; $i++)
{
@ -511,7 +529,24 @@ class amendmentpurchaseorder extends BaseController
$RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList);
}
}
$ordqty ='';
$recqty ='';
$qty = $this->purchaseorder_model->getpolineqty($NewPO);
$ordqty = $qty[0]->Qty;
$recqty = $qty[0]->rec;
if($ordqty == $recqty)
{
$Newstatus = array('Status'=>IGR_CREATED);
$this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus);
$Newstat = array('Status'=>IGR_CREATED);
$this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat);
}
echo 'Purchase Order Amended Successfully! PO Number Is: '.$PONO .'- New PO Number is'.$NewPO;
}
@ -853,7 +888,25 @@ class amendmentpurchaseorder extends BaseController
$LineItemStatus = REQITEM_NEW;
$igrvalue = $this->purchaseorder_model->selectigrmaster($PONO);
$po = '';
$igrno ='';
foreach ($igrvalue as $value) {
$igrno = $value->IGRNO;
$po =$value->PONO;
if($PONO == $po)
{
$NewPOno = array('PONO' =>$NewPO);
$this->purchaseorder_model->updateigrmaster($igrno,$NewPOno);
}
}
for ($i = 1; $i <= $RowCount; $i++)
{
@ -1076,6 +1129,24 @@ class amendmentpurchaseorder extends BaseController
}
$ordqty ='';
$recqty ='';
$qty = $this->purchaseorder_model->getpolineqty($NewPO);
$ordqty = $qty[0]->Qty;
$recqty = $qty[0]->rec;
if($ordqty == $recqty)
{
$Newstatus = array('Status'=>IGR_CREATED);
$this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus);
$Newstat = array('Status'=>IGR_CREATED);
$this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat);
}
echo 'Purchase Order'.$PONO.'Amended Successfully! New PO Number Is: '.$NewPO ;
}
@ -1201,6 +1272,24 @@ class amendmentpurchaseorder extends BaseController
$LineItemStatus = REQITEM_NEW;
$igrvalue = $this->purchaseorder_model->selectigrmaster($PONO);
$po = '';
$igrno ='';
foreach ($igrvalue as $value) {
$igrno = $value->IGRNO;
$po =$value->PONO;
if($PONO == $po)
{
$NewPOno = array('PONO' =>$NewPO);
$this->purchaseorder_model->updateigrmaster($igrno,$NewPOno);
}
}
for ($i = 1; $i <= $RowCount; $i++)
{
$CAD='';
@ -1403,6 +1492,24 @@ class amendmentpurchaseorder extends BaseController
}
$ordqty ='';
$recqty ='';
$qty = $this->purchaseorder_model->getpolineqty($NewPO);
$ordqty = $qty[0]->Qty;
$recqty = $qty[0]->rec;
if($ordqty == $recqty)
{
$Newstatus = array('Status'=>IGR_CREATED);
$this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus);
$Newstat = array('Status'=>IGR_CREATED);
$this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat);
}
echo 'Purchase Order is'.$PONO.'Amended Successfully! New PO Number is: '.$NewPO ;
}

View File

@ -86,6 +86,7 @@ class batchcard extends BaseController
{
$data['MaterialCode'] = $this->batchcard_model->getMaterial();
$data['Supplier'] = $this->batchcard_model->getSupplierlist();
$data['stock_value'] = $this->batchcard_model->getStockValue();
$this->global['pageTitle'] = $this->CompanyName.' : Material Adjustment';
$this->loadViews("materialadjustment", $this->global,$data,NULL);
}

View File

@ -77,6 +77,23 @@ class inwardgateregister extends BaseController
{
$PO = $this->input->post('id');
$CreatedBy = $this->session->userdata('userId');
$ordqty ='';
$recqty ='';
$qty = $this->inwardgateregister_model->getpolineqty($PO);
$ordqty = $qty[0]->Qty;
$recqty = $qty[0]->rec;
if($ordqty == $recqty)
{
$Newstatus = array('Status'=>IGR_CREATED);
$this->inwardgateregister_model-> POLineItemsupdatestatus($PO,$Newstatus);
$Newstat = array('Status'=>IGR_CREATED);
$this->inwardgateregister_model->pomasterupdatestatus($PO,$Newstat);
}
$this->inwardgateregister_model->UpdatePOMaster($PO,$CreatedBy);
$data = $this->inwardgateregister_model->viewpurchaseorder($PO);
echo json_encode($data);

View File

@ -1219,51 +1219,51 @@ class report extends BaseController
}
/** GST Monthly-report */
public function monthly_gst()
{
$this->global['pageTitle'] = $this->CompanyName.' : GST Monthly-Reports';
if ($this->input->post('btn_submit')) {
$m=$this->input->post('month');
$frm = $this->input->post('from_date');
$t = $this->input->post('to_date');
$ab=$this->input->post('financialyear');
$fa=substr($ab,0,-5);
$aa=substr($ab,5,5);
//print_r($prod);
$data['monthly_gst_purchase']=$this->dahsboard_Model->monthly_gst_purchase($m,$frm,$t,$fa,$aa);
$data['monthly_gst_sales']=$this->dahsboard_Model->monthly_gst_sales($m,$frm,$t,$fa,$aa);
public function monthly_gst()
{
$this->global['pageTitle'] = $this->CompanyName.' : GST Monthly-Reports';
if ($this->input->post('btn_submit')) {
$m=$this->input->post('month');
$frm = $this->input->post('from_date');
$t = $this->input->post('to_date');
$ab=$this->input->post('financialyear');
$fa=substr($ab,0,-5);
$aa=substr($ab,5,5);
//print_r($prod);
$data['monthly_gst_purchase']=$this->dahsboard_Model->monthly_gst_purchase($m,$frm,$t,$fa,$aa);
$data['monthly_gst_sales']=$this->dahsboard_Model->monthly_gst_sales($m,$frm,$t,$fa,$aa);
}
$data['finyear']=$this->dahsboard_Model->report_finyear();
$this->loadviews("Report_monthly_gst",$this->global,$data, NULL);
//print_r($data);die();
}
$data['finyear']=$this->dahsboard_Model->report_finyear();
$this->loadviews("Report_monthly_gst",$this->global,$data, NULL);
//print_r($data);die();
}
public function monthly_gst_table()
{
$this->global['pageTitle'] = $this->CompanyName.' : GST Monthly-Reports';
public function monthly_gst_table()
{
$this->global['pageTitle'] = $this->CompanyName.' : GST Monthly-Reports';
$m=$this->input->get('m');
$frm = $this->input->get('frm');
$t = $this->input->get('t');
$ab=$this->input->get('financialyear');
$fa=substr($ab,0,-5);
$aa=substr($ab,5,5);
// print_r($frm);
// print_r($t);
// print_r($m);die();
$data['monthly_gst_purchase']=$this->dahsboard_Model->purchase_gst($m,$frm,$t,$fa,$aa);
$data['monthly_gst_sales']=$this->dahsboard_Model->sales_gst($m,$frm,$t,$fa,$aa);
$this->loadviews("Report_monthly_gst_table",$this->global,$data, NULL);
//print_r($data);die();
}
$m=$this->input->get('m');
$frm = $this->input->get('frm');
$t = $this->input->get('t');
$ab=$this->input->get('financialyear');
$fa=substr($ab,0,-5);
$aa=substr($ab,5,5);
// print_r($frm);
// print_r($t);
// print_r($m);die();
$data['monthly_gst_purchase']=$this->dahsboard_Model->purchase_gst($m,$frm,$t,$fa,$aa);
$data['monthly_gst_sales']=$this->dahsboard_Model->sales_gst($m,$frm,$t,$fa,$aa);
$this->loadviews("Report_monthly_gst_table",$this->global,$data, NULL);
//print_r($data);die();
}
function Viewfiles()
{

View File

@ -18,6 +18,16 @@ class batchcard_model extends CI_Model
$supp = $this->db->get();
return $supp->result();
}
function getStockValue()
{
$this->db->select('MaterialCode,stock');
$this->db->from('T_MaterialMaster');
$supp = $this->db->get();
return $supp->result();
}
/*

View File

@ -2764,236 +2764,230 @@ function INRSymbol()
}
/** GST monthly-Report queries */
function monthly_gst_purchase($m,$frm,$t,$fa,$aa){
function monthly_gst_purchase($m,$frm,$t,$fa,$aa){
$sql="select g.doc_no,g.date,g.doc_type,g.hsn_code,sum(g.value) as value,sum(g.others) as others,sum(g.sgst) as sgst,sum(g.cgst) as cgst,sum(g.igst) as igst,sum(g.total) as total from
(SELECT pm.PONO as doc_no,date_format(pm.PODate,'%d-%m-%Y') as date,
'Purchase' as doc_type,mm.HSNCODE as hsn_code,
mm.MaterialName as material_name,sd.SupplierName as supplier_name,
round(ifnull(sum(distinct pl.Quantity * pl.Rate),0),2) 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.AfterPackagingValue),0),0)
+ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0)
+ifnull(rt.Insurance,0)
-ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)) as others,
round((
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))
,2) as total
FROM T_PurchaseOrder_Master pm
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' and pm.Status != 'ST056' and pm.Status != 'ST027'
group by doc_no,material_name,supplier_name) as g
left join T_PurchaseOrder_Master p on p.PONO = g.doc_no
where g.doc_no != 'null' ";
if ($m!= ''){
$sql.="and monthname(p.PODate) = '".$m."'";
}
if ($frm and $t != ''){
$fromd= date("Y-m-d",strtotime($frm));
$tod=date("Y-m-d",strtotime($t));
$sql.="and p.PODate >= '".$fromd."'
and p.PODate <= '".$tod."'";
}
if ($fa and $aa != ''){
$sql.=" and (p.PODate >= '".$fa."-04-01' and p.PODate <= '".$aa."-03-31')";
}
//echo $sql;
$query = $this->db->query($sql);
return $query->result();
}
public function monthly_gst_sales($m=null,$frm=null,$t=null,$fa=null,$aa=null)
{
$sql = "select ii.invoice_id as invoice_id,ii.invoice_number as invoice_number,date_format(ii.invoice_date_created,'%d-%m-%Y') as dates,
sum(ifnull(((sgst.tax_rate_percent * (iit.item_quantity * iit.item_price))/100),0))
as sgst,
sum(ifnull(((iit.item_quantity * iit.item_price) * cgst.tax_rate_percent)/100,0))
as cgst,
sum(ifnull((igst.tax_rate_percent * (iit.item_quantity * iit.item_price))/100,0))
as igst,
sum((ifnull(((sgst.tax_rate_percent * iia.item_subtotal)/100),0)
+
ifnull(((iia.item_subtotal * cgst.tax_rate_percent)/100),0)
+
ifnull(((igst.tax_rate_percent * iia.item_subtotal)/100),0)))
as total
from ip_invoices ii
join ip_invoice_custom icf on icf.invoice_id = ii.invoice_id
join ip_invoice_items iit on iit.invoice_id = ii.invoice_id
join ip_invoice_item_amounts iia on iia.item_id = iit.item_id
join ip_clients ic on ic.client_id = ii.client_id
join ip_products ip on ip.product_id = iit.item_product_id
left join ip_tax_rates sgst on sgst.tax_rate_id = iit.sgst_item_tax_rate_id
left join ip_tax_rates cgst on cgst.tax_rate_id = iit.cgst_item_tax_rate_id
left join ip_tax_rates igst on igst.tax_rate_id = iit.igst_item_tax_rate_id
where icf.invoice_custom_fieldid = '8' and ii.invoice_status_id != 1 ";
if ($m!= ''){
$sql.="and monthname(ii.invoice_date_created) = '".$m."'";
}
if ($frm and $t != ''){
$fromdate= date("Y-m-d",strtotime($frm));
$todate=date("Y-m-d",strtotime($t));
$sql.="and ii.invoice_date_created >= '".$fromdate."'
and ii.invoice_date_created <= '".$todate."'";
}
if ($fa and $aa != ''){
$sql.=" and (ii.invoice_date_created >= '".$fa."-04-01' and ii.invoice_date_created <= '".$aa."-03-31')";
}
//echo $sql;
$query = $this->db->query($sql);
return $query->result();
}
function sales_gst($m=null,$frm=null,$t=null,$fa=null,$aa=null)
{
$sql = "select ii.invoice_id as invoice_id,ii.client_id as client_id,ip.product_sku as hsn_code,ii.invoice_number as doc_no,date_format(ii.invoice_date_created,'%d-%m-%Y') as date,'Sales' as doc_type,TIME_FORMAT(ii.invoice_time_created,'%l:%i %p') as invoice_time_created,icf.invoice_custom_fieldvalue as vehicle_no,ip.product_description as product_description,concat(ic.client_name,'-',ic.client_surname)as client_name,sum(iit.item_quantity) as item_quantity,sum(iit.item_price) as item_price,sum(iia.item_subtotal) as value,
sum(ifnull(((sgst.tax_rate_percent * (iit.item_quantity * iit.item_price))/100),0))
as sgst,
sum(ifnull(((iit.item_quantity * iit.item_price) * cgst.tax_rate_percent)/100,0))
as cgst,
sum(ifnull((igst.tax_rate_percent * (iit.item_quantity * iit.item_price))/100,0))
as igst,
round(sum((iia.item_subtotal + ifnull(((sgst.tax_rate_percent * iia.item_subtotal)/100),0)
+
ifnull(((iia.item_subtotal * cgst.tax_rate_percent)/100),0)
+
ifnull(((igst.tax_rate_percent * iia.item_subtotal)/100),0))),2)
as total
from ip_invoices ii
join ip_invoice_custom icf on icf.invoice_id = ii.invoice_id
join ip_invoice_items iit on iit.invoice_id = ii.invoice_id
join ip_invoice_item_amounts iia on iia.item_id = iit.item_id
join ip_clients ic on ic.client_id = ii.client_id
join ip_products ip on ip.product_id = iit.item_product_id
left join ip_tax_rates sgst on sgst.tax_rate_id = iit.sgst_item_tax_rate_id
left join ip_tax_rates cgst on cgst.tax_rate_id = iit.cgst_item_tax_rate_id
left join ip_tax_rates igst on igst.tax_rate_id = iit.igst_item_tax_rate_id
where icf.invoice_custom_fieldid = '8' and ii.invoice_status_id != 1 ";
if ($m!= ''){
$sql.="and monthname(ii.invoice_date_created) = '".$m."'";
}
if ($frm and $t != ''){
$fromdate= date("Y-m-d",strtotime($frm));
$todate=date("Y-m-d",strtotime($t));
$sql.="and ii.invoice_date_created >= '".$fromdate."'
and ii.invoice_date_created <= '".$todate."'";
}
if ($fa and $aa != ''){
$sql.=" and (ii.invoice_date_created >= '".$fa."-04-01' and ii.invoice_date_created <= '".$aa."-03-31')";
}
$sql.="group by doc_no,product_description";
$query = $this->db->query($sql);
return $query->result();
}
function purchase_gst($m,$frm,$t,$fa,$aa){
$sql="SELECT pm.PONO as doc_no,pm.POType as potype,date_format(pm.PODate,'%d-%m-%Y') as date,
TIME_FORMAT(pm.PODate,'%l:%i %p') as created_time,'Purchase' as doc_type,mm.HSNCODE as hsn_code,
mm.MaterialName as material_name,sd.SupplierName as supplier_name,
ifnull(sum(distinct pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(distinct pl.Rate),0) as rate,
round(ifnull(sum(distinct pl.Quantity * pl.Rate),0),2) 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.AfterPackagingValue),0),0)
+ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0)
+ifnull(rt.Insurance,0)
-ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)) as others,
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(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
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' and pm.Status != 'ST056' and pm.Status != 'ST027' ";
if ($m!= ''){
$sql.="and monthname(pm.PODate) = '".$m."'";
}
if ($frm and $t != ''){
$fromd= date("Y-m-d",strtotime($frm));
$tod=date("Y-m-d",strtotime($t));
$sql.="and date(pm.PODate) >= '".$fromd."'
and date(pm.PODate) <= '".$tod."'";
}
if ($fa and $aa != ''){
$sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')";
}
$sql.="group by doc_no,material_name,supplier_name";
$query = $this->db->query($sql);
return $query->result();
}
$sql="select g.doc_no,g.date,g.doc_type,g.hsn_code,sum(g.value) as value,sum(g.others) as others,sum(g.sgst) as sgst,sum(g.cgst) as cgst,sum(g.igst) as igst,sum(g.total) as total from
(SELECT pm.PONO as doc_no,date_format(pm.PODate,'%d-%m-%Y') as date,
'Purchase' as doc_type,mm.HSNCODE as hsn_code,
mm.MaterialName as material_name,sd.SupplierName as supplier_name,
round(ifnull(sum(distinct pl.Quantity * pl.Rate),0),2) 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.AfterPackagingValue),0),0)
+ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0)
+ifnull(rt.Insurance,0)
-ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)) as others,
round((
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))
,2) as total
FROM T_PurchaseOrder_Master pm
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' and pm.Status != 'ST056' and pm.Status != 'ST027'
group by doc_no,material_name,supplier_name) as g
left join T_PurchaseOrder_Master p on p.PONO = g.doc_no
where g.doc_no != 'null' ";
if ($m!= ''){
$sql.="and monthname(p.PODate) = '".$m."'";
}
if ($frm and $t != ''){
$fromd= date("Y-m-d",strtotime($frm));
$tod=date("Y-m-d",strtotime($t));
$sql.="and p.PODate >= '".$fromd."'
and p.PODate <= '".$tod."'";
}
if ($fa and $aa != ''){
$sql.=" and (p.PODate >= '".$fa."-04-01' and p.PODate <= '".$aa."-03-31')";
}
//echo $sql;
$query = $this->db->query($sql);
return $query->result();
}
public function monthly_gst_sales($m=null,$frm=null,$t=null,$fa=null,$aa=null)
{
$sql = "select ii.invoice_id as invoice_id,ii.invoice_number as invoice_number,date_format(ii.invoice_date_created,'%d-%m-%Y') as dates,
sum(ifnull(((sgst.tax_rate_percent * (iit.item_quantity * iit.item_price))/100),0))
as sgst,
sum(ifnull(((iit.item_quantity * iit.item_price) * cgst.tax_rate_percent)/100,0))
as cgst,
sum(ifnull((igst.tax_rate_percent * (iit.item_quantity * iit.item_price))/100,0))
as igst,
sum((ifnull(((sgst.tax_rate_percent * iia.item_subtotal)/100),0)
+
ifnull(((iia.item_subtotal * cgst.tax_rate_percent)/100),0)
+
ifnull(((igst.tax_rate_percent * iia.item_subtotal)/100),0)))
as total
from ip_invoices ii
join ip_invoice_custom icf on icf.invoice_id = ii.invoice_id
join ip_invoice_items iit on iit.invoice_id = ii.invoice_id
join ip_invoice_item_amounts iia on iia.item_id = iit.item_id
join ip_clients ic on ic.client_id = ii.client_id
join ip_products ip on ip.product_id = iit.item_product_id
left join ip_tax_rates sgst on sgst.tax_rate_id = iit.sgst_item_tax_rate_id
left join ip_tax_rates cgst on cgst.tax_rate_id = iit.cgst_item_tax_rate_id
left join ip_tax_rates igst on igst.tax_rate_id = iit.igst_item_tax_rate_id
where icf.invoice_custom_fieldid = '8' and ii.invoice_status_id != 1 ";
if ($m!= ''){
$sql.="and monthname(ii.invoice_date_created) = '".$m."'";
}
if ($frm and $t != ''){
$fromdate= date("Y-m-d",strtotime($frm));
$todate=date("Y-m-d",strtotime($t));
$sql.="and ii.invoice_date_created >= '".$fromdate."'
and ii.invoice_date_created <= '".$todate."'";
}
if ($fa and $aa != ''){
$sql.=" and (ii.invoice_date_created >= '".$fa."-04-01' and ii.invoice_date_created <= '".$aa."-03-31')";
}
//echo $sql;
$query = $this->db->query($sql);
return $query->result();
}
function sales_gst($m=null,$frm=null,$t=null,$fa=null,$aa=null)
{
$sql = "select ii.invoice_id as invoice_id,ii.client_id as client_id,ip.product_sku as hsn_code,ii.invoice_number as doc_no,date_format(ii.invoice_date_created,'%d-%m-%Y') as date,'Sales' as doc_type,TIME_FORMAT(ii.invoice_time_created,'%l:%i %p') as invoice_time_created,icf.invoice_custom_fieldvalue as vehicle_no,ip.product_description as product_description,concat(ic.client_name,'-',ic.client_surname)as client_name,sum(iit.item_quantity) as item_quantity,sum(iit.item_price) as item_price,sum(iia.item_subtotal) as value,
sum(ifnull(((sgst.tax_rate_percent * (iit.item_quantity * iit.item_price))/100),0))
as sgst,
sum(ifnull(((iit.item_quantity * iit.item_price) * cgst.tax_rate_percent)/100,0))
as cgst,
sum(ifnull((igst.tax_rate_percent * (iit.item_quantity * iit.item_price))/100,0))
as igst,
round(sum((iia.item_subtotal + ifnull(((sgst.tax_rate_percent * iia.item_subtotal)/100),0)
+
ifnull(((iia.item_subtotal * cgst.tax_rate_percent)/100),0)
+
ifnull(((igst.tax_rate_percent * iia.item_subtotal)/100),0))),2)
as total
from ip_invoices ii
join ip_invoice_custom icf on icf.invoice_id = ii.invoice_id
join ip_invoice_items iit on iit.invoice_id = ii.invoice_id
join ip_invoice_item_amounts iia on iia.item_id = iit.item_id
join ip_clients ic on ic.client_id = ii.client_id
join ip_products ip on ip.product_id = iit.item_product_id
left join ip_tax_rates sgst on sgst.tax_rate_id = iit.sgst_item_tax_rate_id
left join ip_tax_rates cgst on cgst.tax_rate_id = iit.cgst_item_tax_rate_id
left join ip_tax_rates igst on igst.tax_rate_id = iit.igst_item_tax_rate_id
where icf.invoice_custom_fieldid = '8' and ii.invoice_status_id != 1 ";
if ($m!= ''){
$sql.="and monthname(ii.invoice_date_created) = '".$m."'";
}
if ($frm and $t != ''){
$fromdate= date("Y-m-d",strtotime($frm));
$todate=date("Y-m-d",strtotime($t));
$sql.="and ii.invoice_date_created >= '".$fromdate."'
and ii.invoice_date_created <= '".$todate."'";
}
if ($fa and $aa != ''){
$sql.=" and (ii.invoice_date_created >= '".$fa."-04-01' and ii.invoice_date_created <= '".$aa."-03-31')";
}
$sql.="group by doc_no,product_description";
$query = $this->db->query($sql);
return $query->result();
}
function purchase_gst($m,$frm,$t,$fa,$aa){
$sql="SELECT pm.PONO as doc_no,pm.POType as potype,date_format(pm.PODate,'%d-%m-%Y') as date,
TIME_FORMAT(pm.PODate,'%l:%i %p') as created_time,'Purchase' as doc_type,mm.HSNCODE as hsn_code,
mm.MaterialName as material_name,sd.SupplierName as supplier_name,
ifnull(sum(distinct pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(distinct pl.Rate),0) as rate,
round(ifnull(sum(distinct pl.Quantity * pl.Rate),0),2) 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.AfterPackagingValue),0),0)
+ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0)
+ifnull(rt.Insurance,0)
-ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)) as others,
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(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
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' and pm.Status != 'ST056' and pm.Status != 'ST027' ";
if ($m!= ''){
$sql.="and monthname(pm.PODate) = '".$m."'";
}
if ($frm and $t != ''){
$fromd= date("Y-m-d",strtotime($frm));
$tod=date("Y-m-d",strtotime($t));
$sql.="and date(pm.PODate) >= '".$fromd."'
and date(pm.PODate) <= '".$tod."'";
}
if ($fa and $aa != ''){
$sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')";
}
$sql.="group by doc_no,material_name,supplier_name";
$query = $this->db->query($sql);
return $query->result();
}
}
?>

View File

@ -213,16 +213,44 @@ class inwardgateregister_model extends CI_Model
return $query->result();
}
}
function addmaterialhistory($historydetails)
{
}
function getpolineqty($PO)
{
$this->db->select('sum(Quantity)as Qty,sum(ReceivedQuantity)as rec');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->where('PONO',$PO);
$this->db->trans_start();
$this->db->insert('T_Material_stock_history', $historydetails);
$insert_id = $this->db->affected_rows();
$this->db->trans_complete();
return true;
}
$query = $this->db->get();
return $query->result();
}
function POLineItemsupdatestatus($PO,$Newstatus)
{
$this->db->where('PONO',$PO);
$this->db->update('T_PurchaseOrder_LineItem',$Newstatus);
$update = $this->db->affected_rows();
return $update;
}
function pomasterupdatestatus($PO,$Newstat)
{
$this->db->where('PONO',$PO);
$this->db->update('T_PurchaseOrder_Master',$Newstat);
$update = $this->db->affected_rows();
return $update;
}
function addmaterialhistory($historydetails)
{
$this->db->trans_start();
$this->db->insert('T_Material_stock_history', $historydetails);
$insert_id = $this->db->affected_rows();
$this->db->trans_complete();
return true;
}
function getitemvalue($pono,$MaterialCode)
@ -544,10 +572,8 @@ class inwardgateregister_model extends CI_Model
$this->db->from('T_MRIR_Master');
$this->db->where('T_MRIR_Master.PONO',$PONO);
$this->db->where('T_MRIR_Master.OGRstatus !=',OGR_COMPLETE);
//$this->db->where('Status !=',IGR_CREATED);
$query = $this->db->get();
//print_r( $this->db->last_query());
//die();
$result = $query->result();
return $result;

View File

@ -92,6 +92,51 @@ $myfile=$this->db->affected_rows();
return $myfile;
}
function updateigrmaster($igrno,$NewPOno)
{
$this->db->where('IGRNO',$igrno);
$this->db->update('T_IGR_Master',$NewPOno);
$insert_id = $this->db->affected_rows();
return $insert_id;
}
function selectigrmaster($PONO)
{
$this->db->select('*');
$this->db->from('T_IGR_Master');
$this->db->where('PONO',$PONO);
$query = $this->db->get();
return $query->result();
}
function getpolineqty($NewPO)
{
$this->db->select('sum(Quantity)as Qty,sum(ReceivedQuantity)as rec');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->where('PONO',$NewPO);
$query = $this->db->get();
return $query->result();
}
function POLineItemsupdatestatus($POno,$Newstatus)
{
$this->db->where('PONO',$POno);
$this->db->update('T_PurchaseOrder_LineItem',$Newstatus);
$update = $this->db->affected_rows();
return $update;
}
function pomasterupdatestatus($POno,$Newstat)
{
$this->db->where('PONO',$POno);
$this->db->update('T_PurchaseOrder_Master',$Newstat);
$update = $this->db->affected_rows();
return $update;
}
function getfunction($pono)

View File

@ -230,27 +230,33 @@
<td style="text-align:center"><span><?php echo $rel->doc_type;?></span></td>
<td style="text-align:center"><span><?php echo $rel->hsn_code;?></span></td>
<td style="text-align:right"><span><?php
$tot_val= $tot_val + round($rel->value,2);
//$tot_val= $tot_val + round($rel->value,2);
$tot_val= $tot_val + $rel->value;
echo $rel->value;
?></span></td>
<td style="text-align:right"><span><?php
$tot_oth= $tot_oth + round($rel->others,2);
//$tot_oth= $tot_oth + round($rel->others,2);
$tot_oth= $tot_oth + $rel->others;
echo $rel->others;
?></span></td>
<td style="text-align:right"><span><?php
$tot_sgst= $tot_sgst + round($rel->sgst,2);
//$tot_sgst= $tot_sgst + round($rel->sgst,2);
$tot_sgst= $tot_sgst + $rel->sgst;
echo $rel->sgst;
?></span></td>
<td style="text-align:right"><span><?php
$tot_cgst= $tot_cgst + round($rel->cgst,2);
//$tot_cgst= $tot_cgst + round($rel->cgst,2);
$tot_cgst= $tot_cgst + $rel->cgst;
echo $rel->cgst;
?></span></td>
<td style="text-align:right"><span><?php
$tot_igst= $tot_igst + round($rel->igst,2);
//$tot_igst= $tot_igst + round($rel->igst,2);
$tot_igst= $tot_igst + $rel->igst;
echo $rel->igst;
?></span></td>
<td style="text-align:right"><span><?php
$tot_tot= $tot_tot + round($rel->total,2);
//$tot_tot= $tot_tot + round($rel->total,2);
$tot_tot= $tot_tot + $rel->total;
echo $rel->total;
?></span></td>
@ -294,7 +300,8 @@
<strong>
<?php
{
echo number_format($tot_sgst,2,'.','');
//echo number_format($tot_sgst,2,'.','');
echo $tot_sgst;
}

View File

@ -168,7 +168,8 @@ if(!empty($OGR_Data))
<div id="content"></div>
<div class="box">
<div class="box-header"><?php echo $pageTitle; ?></h3></center>
<div class="box-header">
<center><h3><?php echo $pageTitle; ?></h3></center>
</div>
<!-- /.box-header -->
<div class="box-body">
@ -207,7 +208,7 @@ if(!empty($OGR_Data))
</div>
</div>
<? print_r($OGR_Data); ?>
<div class="col-md-9" style="padding: 0px;">
<div class="col-md-12" style="padding: 0px;">
<div class="col-md-3">

View File

@ -449,13 +449,13 @@
<li>
<a href="<?php echo base_url(); ?>FinalProduct">
<i class="fa fa-dashboard"></i> <span>Final Product</span>
<i class="fa fa-bar-chart"></i> <span>Final Product</span>
</a>
</li>
<li>
<a href="<?php echo base_url(); ?>FinalProductHistory">
<i class="fa fa-dashboard"></i> <span>Finished Product History</span>
<i class="fa fa-bar-chart"></i> <span>Finished Product History</span>
</a>
</li>
@ -463,20 +463,20 @@
<li>
<a href="<?php echo base_url(); ?>FinalProduct">
<i class="fa fa-dashboard"></i> <span>Final Product Listing</span>
<i class="fa fa-bar-chart"></i> <span>Final Product Listing</span>
</a>
</li>
<li>
<a href="<?php echo base_url(); ?>MaterailAdjustment">
<i class="fa fa-dashboard"></i> <span>Material Adjustment</span>
<i class="fa fa-adjust"></i> <span>Material Adjustment</span>
</a>
</li>
<li>
<a href="<?php echo base_url(); ?>MaterailAdjustmentlist">
<i class="fa fa-dashboard"></i> <span>Material Adjustment List</span>
<i class="fa fa-adjust"></i> <span>Material Adjustment List</span>
</a>
</li>
</ul></li>
@ -502,7 +502,7 @@ else{
<li>
<a href="<?php echo base_url(); ?>FinalProduct">
<i class="fa fa-dashboard"></i> <span>Final Product</span>
<i class="fa fa-bar-chart"></i> <span>Final Product</span>
</a>
</li>
@ -510,32 +510,32 @@ else{
<li>
<a href="<?php echo base_url(); ?>FinalProductHistory">
<i class="fa fa-dashboard"></i> <span>Finished Product History</span>
<i class="fa fa-bar-chart"></i> <span>Finished Product History</span>
</a>
</li>
<li>
<a href="<?php echo base_url(); ?>FinalProductlisting">
<i class="fa fa-dashboard"></i> <span>Final Product Listing</span>
<i class="fa fa-bar-chart"></i> <span>Final Product Listing</span>
</a>
</li>
<li>
<a href="<?php echo base_url(); ?>MaterailAdjustment">
<i class="fa fa-dashboard"></i> <span>Material Adjustment</span>
<i class="fa fa-adjust"></i> <span>Material Adjustment</span>
</a>
</li>
<li>
<a href="<?php echo base_url(); ?>MaterailAdjustmentlist">
<i class="fa fa-dashboard"></i> <span>Material Adjustment List</span>
<i class="fa fa-adjust"></i> <span>Material Adjustment List</span>
</a>
</li>
<li>
<a href="<?php echo base_url(); ?>MaterialHistory">
<i class="fa fa-dashboard"></i> <span>Material History</span>
<i class="fa fa-history"></i> <span>Material History</span>
</a>
</li>
</ul></li>

View File

@ -399,6 +399,7 @@ function validate()
$("#del").val(obj.DeliveryDate);
//$("#ser").val(obj.ServiceDescription);
status = obj.status;
ostatus= obj.OGR_Status;
}
});
@ -415,12 +416,13 @@ function validate()
$('#content').loader('hide');
//alert(data);
var trHTML = '';
var j=0;
$.each(JSON.parse(data), function (i, item) {
if(item.PendingQty !=0){
i=i+1;
j=j+1;
trHTML += '<tr>' +
'<td align="right">' + i + '</td>' +
'<td align="right">' + j + '</td>' +
'<td name="MaterialName" id="MaterialCode" >' + item.MaterialCode + '</td>' +
'<td>' + item.MaterialName + '</td>' +
'<td name="UOM">' + item.UOM + '</td>' +
@ -478,9 +480,12 @@ $('<input>').attr({
$('#QuantityAsPerInvoice'+i).attr('readonly', 'true');
// $('#txtEditFreight').attr('readonly', 'true');
}
$("#IGRLink").show();
$("#IGRLink").show();
}else{
$("#IGRLink").hide();
if(JSON.parse(data).length == 1 && item.PendingQty == 0){
$("#IGRLink").hide();
alert('The Order is completed!!');
}
}
});
@ -498,7 +503,7 @@ $('<input>').attr({
});
if(status == '<?php echo IGR_CREATED ?>' || status == '<?php echo MRIR_CREATED ?>' || status == '<?php echo MRIR_APPROVED ?>' )
if(status == '<?php echo IGR_CREATED ?>' || status == '<?php echo MRIR_CREATED ?>' || status == '<?php echo MRIR_APPROVED ?>')
{
swal('The Order is completed!!');
$("#IGRLink").hide();

View File

@ -7,7 +7,10 @@ $(function() {
$("#date").datepicker({
//maxDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
yearRange: '-100:+0'
});
});
@ -256,12 +259,29 @@ $(function() {
<script type="text/javascript">
var stock = <?php echo json_encode($stock_value, JSON_PRETTY_PRINT) ?>;
$('.getdetails').click(function()
{
var materialcode =$('#materialcode').val();
var date = $('#date').val();
var Supplier = $('#supplier').val();
var openqty = '';
$.each(stock,function(j,fnobj)
{
if(materialcode == fnobj.MaterialCode)
{
openqty = fnobj.stock == '' ? '0' : fnobj.stock;
console.log(openqty);
}
});
$('#content').loader('show');
$.ajax({
@ -291,11 +311,13 @@ $('.getdetails').click(function()
}
});
var resultantqty = parseFloat(addqty)- parseFloat(reduceqty);
//var resultantqty = parseFloat(addqty)- parseFloat(reduceqty);
var resultantqty = parseFloat(addqty)- parseFloat(reduceqty)+parseFloat(openqty);
if(isNaN(resultantqty))
{
$('#Qty_aspersystem').val(0);
//$('#Qty_aspersystem').val(0);
$('#Qty_aspersystem').val(openqty);
}
else
{

View File

@ -14,13 +14,13 @@
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<center><h3 class="box-title">Siddharth Industries-Outward Gate Entry List</h3></center>
<center><h3 class="box-title"><?php echo $pageTitle; ?></h3></center>
</div>
<!-- /.box-header -->
<div class="box-body">
<table id="example1" class="table table-bordered table-hover editableTable" style="font-size:12px;">
<thead>
<tr style="background-color:#ddf">
<tr>
<!-- <th>#</th> -->
<th>OGR No</th>
<th>Type</th>