igrmulfile

This commit is contained in:
venbatechnologies 2018-07-16 13:33:08 +05:30
parent cb36d55fa1
commit 5a0f62dd4f
11 changed files with 735 additions and 383 deletions

View File

@ -345,6 +345,7 @@ foreach ($igrvalue as $value) {
$NewPOno = array('PONO' =>$NewPO); $NewPOno = array('PONO' =>$NewPO);
// print_r($NewPOno); // print_r($NewPOno);
$this->purchaseorder_model->updateigrmaster($igrno,$NewPOno); $this->purchaseorder_model->updateigrmaster($igrno,$NewPOno);
$this->purchaseorder_model->updateigrfile($igrno,$NewPOno);
} }
@ -543,26 +544,51 @@ foreach ($igrvalue as $value) {
$RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList); $RevenueList = $this->purchaseorder_model->addRevenueTax($RevenueTaxList);
if($Quantity == $RecQtyvalue ) // if($Quantity == $RecQtyvalue )
{ // {
// $Newstatus = array('Status'=>IGR_CREATED);
// $this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus);
// $Newstat = array('Status'=>IGR_CREATED);
// $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat);
// }
// else if($Quantity != $RecQtyvalue )
// {
// $Newstatus = array('Status'=>POLINEITEM_IGRPARTIAL_CREATED);
// $this->purchaseorder_model->POLineItemsupdatestatus($NewPO,$Newstatus);
// $Newstat = array('Status'=>PO_RELEASED);
// $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat);
// }
}
$qty = $this->purchaseorder_model->getpolineqty($NewPO);
$ordqty ='';
$recqty ='';
// $POno='';
// sum(Quantity)as Qty,sum(ReceivedQuantity)as rec
// foreach ($qty as $qtyvalue)
// {
$ordqty = $qty[0]->Qty;
$recqty = $qty[0]->rec;
// $POno = $qtyvalue->PONO;
if($ordqty == $recqty)
{
$Newstatus = array('Status'=>IGR_CREATED); $Newstatus = array('Status'=>IGR_CREATED);
$this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus); $this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus);
$Newstat = array('Status'=>IGR_CREATED);
$this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat); $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstatus);
} }
else if($Quantity != $RecQtyvalue )
{
$Newstatus = array('Status'=>POLINEITEM_IGRPARTIAL_CREATED);
$this->purchaseorder_model->POLineItemsupdatestatus($NewPO,$Newstatus);
$Newstat = array('Status'=>PO_RELEASED);
$this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat);
}
}
echo 'Purchase Order Amended Successfully! PO Number Is: '.$PONO .'- New PO Number is'.$NewPO; echo 'Purchase Order Amended Successfully! PO Number Is: '.$PONO .'- New PO Number is'.$NewPO;
} }
@ -697,6 +723,8 @@ foreach ($igrvalue as $value) {
$NewPOno = array('PONO' =>$NewPO); $NewPOno = array('PONO' =>$NewPO);
// print_r($NewPOno); // print_r($NewPOno);
$this->purchaseorder_model->updateigrmaster($igrno,$NewPOno); $this->purchaseorder_model->updateigrmaster($igrno,$NewPOno);
$this->purchaseorder_model->updateigrfile($igrno,$NewPOno);
} }
@ -798,27 +826,52 @@ foreach ($igrvalue as $value) {
$ServiceTaxList = array('LineItemNo'=>$LineItemNo,'CGST'=>$CGST,'After_CGST'=>$AfterCGST,'SGST'=>$SGST,'After_SGST'=>$AfterSGST,'IGST'=>$IGST,'After_IGST'=>$AfterIGST,'otherallowance'=>$otherallowance, 'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt); $ServiceTaxList = array('LineItemNo'=>$LineItemNo,'CGST'=>$CGST,'After_CGST'=>$AfterCGST,'SGST'=>$SGST,'After_SGST'=>$AfterSGST,'IGST'=>$IGST,'After_IGST'=>$AfterIGST,'otherallowance'=>$otherallowance, 'TotalValue'=>$TotalOrderValue, 'CreatedBy'=>$updatedBy,'CreatedDate'=>$updateddt);
$ServiceList =$this->purchaseorder_model->addServiceTax($ServiceTaxList); $ServiceList =$this->purchaseorder_model->addServiceTax($ServiceTaxList);
if($Quantity == $RecQtyvalue ) // if($Quantity == $RecQtyvalue )
{ // {
$Newstatus = array('Status'=>IGR_CREATED); // $Newstatus = array('Status'=>IGR_CREATED);
$this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus); // $this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus);
$Newstat = array('Status'=>IGR_CREATED); // $Newstat = array('Status'=>IGR_CREATED);
$this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat); // $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat);
} // }
else if($Quantity != $RecQtyvalue ) // else if($Quantity != $RecQtyvalue )
{ // {
$Newstatus = array('Status'=>POLINEITEM_IGRPARTIAL_CREATED); // $Newstatus = array('Status'=>POLINEITEM_IGRPARTIAL_CREATED);
$this->purchaseorder_model->POLineItemsupdatestatus($NewPO,$Newstatus); // $this->purchaseorder_model->POLineItemsupdatestatus($NewPO,$Newstatus);
$Newstat = array('Status'=>PO_RELEASED); // $Newstat = array('Status'=>PO_RELEASED);
$this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat); // $this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstat);
} // }
} }
$qty = $this->purchaseorder_model->getpolineqty($NewPO);
$ordqty ='';
$recqty ='';
// $POno='';
// sum(Quantity)as Qty,sum(ReceivedQuantity)as rec
// foreach ($qty as $qtyvalue)
// {
$ordqty = $qty[0]->Qty;
$recqty = $qty[0]->rec;
// $POno = $qtyvalue->PONO;
if($ordqty == $recqty)
{
$Newstatus = array('Status'=>IGR_CREATED);
$this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus);
$this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstatus);
}
echo 'PO Number is'.$PONO . ' is Amended Successfully! - New Amended PO Number is '.$NewPO; echo 'PO Number is'.$PONO . ' is Amended Successfully! - New Amended PO Number is '.$NewPO;
} }
@ -987,6 +1040,7 @@ foreach ($igrvalue as $value) {
$NewPOno = array('PONO' =>$NewPO); $NewPOno = array('PONO' =>$NewPO);
// print_r($NewPOno); // print_r($NewPOno);
$this->purchaseorder_model->updateigrmaster($igrno,$NewPOno); $this->purchaseorder_model->updateigrmaster($igrno,$NewPOno);
$this->purchaseorder_model->updateigrfile($igrno,$NewPOno);
} }
@ -1214,7 +1268,32 @@ foreach ($igrvalue as $value) {
} }
} }
} }
$qty = $this->purchaseorder_model->getpolineqty($NewPO);
$ordqty ='';
$recqty ='';
// $POno='';
// sum(Quantity)as Qty,sum(ReceivedQuantity)as rec
// foreach ($qty as $qtyvalue)
// {
$ordqty = $qty[0]->Qty;
$recqty = $qty[0]->rec;
// $POno = $qtyvalue->PONO;
if($ordqty == $recqty)
{
$Newstatus = array('Status'=>IGR_CREATED);
$this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus);
$this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstatus);
}
echo 'Purchase Order'.$PONO.'Amended Successfully! New PO Number Is: '.$NewPO ; echo 'Purchase Order'.$PONO.'Amended Successfully! New PO Number Is: '.$NewPO ;
} }
@ -1370,6 +1449,7 @@ foreach ($igrvalue as $value) {
$NewPOno = array('PONO' =>$NewPO); $NewPOno = array('PONO' =>$NewPO);
// print_r($NewPOno); // print_r($NewPOno);
$this->purchaseorder_model->updateigrmaster($igrno,$NewPOno); $this->purchaseorder_model->updateigrmaster($igrno,$NewPOno);
$this->purchaseorder_model->updateigrfile($igrno,$NewPOno);
} }
@ -1577,8 +1657,33 @@ foreach ($igrvalue as $value) {
$ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'Grossdutypayable'=>$Grossdutypayable,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem,'FreightType'=>$FreightType,'NoOfTrip'=>$NoOfTrip,'FreightValue'=>$Freightrate,'AfterFreightValue'=>$Freightamount,'AssessableValue'=>$Assable,'SubTotal'=>$Subtotal,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'DutyImpact'=>$DutyImpact,'NetValue'=>$NetValue,'ClearingCharge'=>$ClearingCharge); $ImportTaxList = array('LineItemNo'=>$LineItemNo,'BasicPriceInMTon'=>$BasicPriceinmton,'ProductPrice'=>$Productprice,'LandingCharge'=>$LandingCharge,'AfterLandingCharge'=>$AfterLandingCharge,'CustomDuty'=>$CustomDuty,'AfterCustomDuty'=>$AfterCustomDuty,'CustomEdCess'=>$CustomEd,'CustomSHCess'=>$CustomSH,'CreatedBy'=>$CreateBy,'CreatedDate'=>$createddt,'Grossdutypayable'=>$Grossdutypayable,'CustomDutyExpensesPerKG'=>$CustomDutyExpensesPerKG,'QuantityKG'=>$QuantityKG,'AfterCustomSHCess'=>$AfterCustomSH,'AfterCustomEdCess'=>$AfterCustomEd,'TotalValue'=>$Totalvalueitem,'FreightType'=>$FreightType,'NoOfTrip'=>$NoOfTrip,'FreightValue'=>$Freightrate,'AfterFreightValue'=>$Freightamount,'AssessableValue'=>$Assable,'SubTotal'=>$Subtotal,'IGST'=>$Igst,'AfterIGST'=>$AfterIgst,'DutyImpact'=>$DutyImpact,'NetValue'=>$NetValue,'ClearingCharge'=>$ClearingCharge);
$ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList); $ImportList = $this->purchaseorder_model->addImportTax($ImportTaxList);
} }
$qty = $this->purchaseorder_model->getpolineqty($NewPO);
$ordqty ='';
$recqty ='';
// $POno='';
// sum(Quantity)as Qty,sum(ReceivedQuantity)as rec
// foreach ($qty as $qtyvalue)
// {
$ordqty = $qty[0]->Qty;
$recqty = $qty[0]->rec;
// $POno = $qtyvalue->PONO;
if($ordqty == $recqty)
{
$Newstatus = array('Status'=>IGR_CREATED);
$this->purchaseorder_model-> POLineItemsupdatestatus($NewPO,$Newstatus);
$this->purchaseorder_model->pomasterupdatestatus($NewPO,$Newstatus);
}
echo 'Purchase Order is'.$PONO.'Amended Successfully! New PO Number is: '.$NewPO ; echo 'Purchase Order is'.$PONO.'Amended Successfully! New PO Number is: '.$NewPO ;
} }

View File

@ -682,6 +682,7 @@ $prefile =array();
function ViewIGRfile() function ViewIGRfile()
{ {
$IGRNO= $this->input->post('id'); $IGRNO= $this->input->post('id');
$PO =$this->input->post('id1');
$data = $this->inwardgateregister_model->viewIGRFile($IGRNO); $data = $this->inwardgateregister_model->viewIGRFile($IGRNO);
echo json_encode($data); echo json_encode($data);

View File

@ -385,8 +385,12 @@ function edited(){
function CreatePOPrint() function CreatePOPrint()
{ {
$PONO = $_GET['PONO']; $PONO = $_GET['PONO'];
// print_r($PONO);
$ReqType = $_GET['ReqType']; $ReqType = $_GET['ReqType'];
// print_r($ReqType);
if($ReqType == SERVICE) if($ReqType == SERVICE)
{ {

View File

@ -7,7 +7,7 @@ class dahsboard_Model extends CI_Model
/* HR DASHBOART Model START*/ /* HR DASHBOART Model START*/
function totemp() function totemp()
{ {
$yes_date = date('Y-m-d',strtotime("-1 days")); $yes_date = date('Y-m-d',strtotime("-1 days"));
// $sql="select count(*) as emp_count from T_Employee_Details where date(T_Employee_Details.Created_date) <= ? and isActive = 1"; // $sql="select count(*) as emp_count from T_Employee_Details where date(T_Employee_Details.Created_date) <= ? and isActive = 1";
// $query =$this->db->query($sql,array($yes_date)); // $query =$this->db->query($sql,array($yes_date));
$this->db->select('count(*) as totemp'); $this->db->select('count(*) as totemp');
@ -29,6 +29,19 @@ function getfile($PONO)
$this->db->where('PONO',$PONO); $this->db->where('PONO',$PONO);
$query = $this->db->get();
// print_r( $this->db->last_query());
$result = $query->result_array();
return $result;
}
function getfiles($PONO)
{
//$this->db->distinct();
$this->db->select('*');
$this->db->from('T_Inwardgateregister_fileupload');
$this->db->where('PONO',$PONO);
$query = $this->db->get(); $query = $this->db->get();
// print_r( $this->db->last_query()); // print_r( $this->db->last_query());
$result = $query->result_array(); $result = $query->result_array();
@ -36,6 +49,20 @@ function getfile($PONO)
} }
function selectigrfiles()
{
$this->db->select('*');
$this->db->from('T_Inwardgateregister_fileupload');
//$this->db->where('PONO',$PONO);
$query = $this->db->get();
// print_r( $this->db->last_query());
$result = $query->result_array();
return $result;
}
function totloan() function totloan()
{ {
@ -270,25 +297,25 @@ GROUP BY financial_year";
return $query->result(); return $query->result();
} }
function get_employee(){ function get_employee(){
$yes_date = date('Y-m-d',strtotime("-1 days")); $yes_date = date('Y-m-d',strtotime("-1 days"));
$sql = "select * from T_Employee_Details where date(created_date) <='".$yes_date."' and isActive =1"; $sql = "select * from T_Employee_Details where date(created_date) <='".$yes_date."' and isActive =1";
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
function per($fa,$aa,$m) function per($fa,$aa,$m)
{ {
//echo $m; //echo $m;
$cur_month = date('M'); $cur_month = date('M');
//echo $cur_month; //echo $cur_month;
if($cur_month == $m ){ if($cur_month == $m ){
$cur_date = date('d'); $cur_date = date('d');
}else{ }else{
$cur_date = date('t',strtotime($m)); $cur_date = date('t',strtotime($m));
} }
//echo $cur_date;die; //echo $cur_date;die;
$sql= "SELECT month.Eid as Eid,month.ename as ename,month.active as active,month.days as monthdays,month.Days_Worked as monthworked,month.percentage as monthpercentage $sql= "SELECT month.Eid as Eid,month.ename as ename,month.active as active,month.days as monthdays,month.Days_Worked as monthworked,month.percentage as monthpercentage
from (select em.EmpID as Eid,concat(em.FirstName,'.',em.LastName) as ename,em.IsActive as active,at.NoofDays as days, from (select em.EmpID as Eid,concat(em.FirstName,'.',em.LastName) as ename,em.IsActive as active,at.NoofDays as days,
Days_Worked,round((Days_Worked/".$cur_date."*100)) as percentage from Days_Worked,round((Days_Worked/".$cur_date."*100)) as percentage from
@ -600,7 +627,7 @@ function totalimportpo ()
function importbudgt () function importbudgt ()
{ {
if (date('m') >= 4) if (date('m') >= 4)
{ {
$yearl = date('Y').'-'.(date('Y')+1); $yearl = date('Y').'-'.(date('Y')+1);
} else { } else {
@ -616,7 +643,7 @@ function importbudgt ()
function capitalbud () function capitalbud ()
{ {
if (date('m') >= 4) if (date('m') >= 4)
{ {
$yearl = date('Y').'-'.(date('Y')+1); $yearl = date('Y').'-'.(date('Y')+1);
} else { } else {
@ -632,7 +659,7 @@ function capitalbud ()
function servicebudgt () function servicebudgt ()
{ {
if (date('m') >= 4) if (date('m') >= 4)
{ {
$yearl = date('Y').'-'.(date('Y')+1); $yearl = date('Y').'-'.(date('Y')+1);
} else { } else {
@ -648,7 +675,7 @@ function servicebudgt ()
function revenuebudgt () function revenuebudgt ()
{ {
if (date('m') >= 4) if (date('m') >= 4)
{ {
$yearl = date('Y').'-'.(date('Y')+1); $yearl = date('Y').'-'.(date('Y')+1);
} else { } else {
@ -685,7 +712,7 @@ Util_Amount,0)) as ca
FROM cost_center where Status !='ST030' and date(PODate) >= '".$fa."-04-01' and date(PODate) <= '".$aa."-03-31'; FROM cost_center where Status !='ST030' and date(PODate) >= '".$fa."-04-01' and date(PODate) <= '".$aa."-03-31';
"; ";
$query = $this->db->query($sql); $query = $this->db->query($sql);
//echo $sql; //echo $sql;
return $query->result(); return $query->result();
} }
@ -849,9 +876,9 @@ FROM cost_center
where Status !='ST030' and date(PODate) >= '".$fa."-04-01' and date(PODate) <= '".$aa."-03-31' where Status !='ST030' and date(PODate) >= '".$fa."-04-01' and date(PODate) <= '".$aa."-03-31'
group by Cost_Center_Code,BudgetYear,BudgetType"; group by Cost_Center_Code,BudgetYear,BudgetType";
$query = $this->db->query($sql); $query = $this->db->query($sql);
//echo $sql; //echo $sql;
return $query->result(); return $query->result();
} }
@ -935,7 +962,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.AfterIGST),sum(distinct st.After_IGST)),0)
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0) + ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0)
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0) + ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0)
+ ifnull(rt.Insurance,0) + ifnull(rt.Insurance,0)
- ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total - ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total
FROM T_PurchaseOrder_Master pm FROM T_PurchaseOrder_Master pm
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
@ -1011,7 +1038,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.AfterIGST),sum(distinct st.After_IGST)),0)
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0) + ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0)
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0) + ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0)
+ ifnull(rt.Insurance,0) + ifnull(rt.Insurance,0)
- ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total - ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total
FROM T_PurchaseOrder_Master pm FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
@ -1351,14 +1378,14 @@ if ($fa and $aa != ''){
return $query->result(); return $query->result();
} }
function report_cumulative(){ function report_cumulative(){
if (date('m') >= 4) { if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1); $yearl = date('Y').'-'.(date('Y')+1);
} else { } else {
$yearl = (date('Y')-1).'-'.date('Y'); $yearl = (date('Y')-1).'-'.date('Y');
} }
$ab=$yearl; $ab=$yearl;
$fa=substr($ab,0,-5); $fa=substr($ab,0,-5);
$aa=substr($ab,5,5); $aa=substr($ab,5,5);
$sql="SELECT year.sid as sid,year.mid as mid,year.supplier_name as supplier_name,year.material_name as material_name,year.quantity as quantity,year.total as total,month.mquantity as mquantity,month.mtotal as mtotal,today.tquantity as tquantity,today.ttotal as ttotal $sql="SELECT year.sid as sid,year.mid as mid,year.supplier_name as supplier_name,year.material_name as material_name,year.quantity as quantity,year.total as total,month.mquantity as mquantity,month.mtotal as mtotal,today.tquantity as tquantity,today.ttotal as ttotal
FROM (SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total FROM (SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total
@ -1408,13 +1435,13 @@ group by supplier_name,material_name";
} }
function report_cum_year($sup=null,$mat=null){ function report_cum_year($sup=null,$mat=null){
if (date('m') >= 4) { if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1); $yearl = date('Y').'-'.(date('Y')+1);
} else { } else {
$yearl = (date('Y')-1).'-'.date('Y'); $yearl = (date('Y')-1).'-'.date('Y');
} }
$ab=$yearl; $ab=$yearl;
$fa=substr($ab,0,-5); $fa=substr($ab,0,-5);
$aa=substr($ab,5,5); $aa=substr($ab,5,5);
$sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal $sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal
FROM T_PurchaseOrder_Master pm FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
@ -1483,7 +1510,7 @@ ifnull((id.QuantityAsPerInvoice * pl.Rate),0)))
- round(ifnull(if(POType = 'REVENUE', - round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity), (id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total, (id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
im.file as ifile,pb.FilePath as file im.file as ifile,pb.FilePath as file,infiles.FilePath as Infiles
from T_IGR_Master im from T_IGR_Master im
left join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO left 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_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
@ -1493,6 +1520,7 @@ left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
left join T_Inwardgateregister_fileupload infiles on infiles.IGRNO = im.IGRNO
where pm.Status != 'ST030' "; where pm.Status != 'ST030' ";
if ($cname!= ''){ if ($cname!= ''){
@ -1587,7 +1615,7 @@ ifnull((id.QuantityAsPerInvoice * pl.Rate),0)))
- round(ifnull(if(POType = 'REVENUE', - round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity), (id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total, (id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
im.file as ifile,pb.FilePath as file im.file as ifile,pb.FilePath as file,infiles.FilePath as Infiles
from T_IGR_Master im from T_IGR_Master im
left join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO left 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_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
@ -1597,6 +1625,8 @@ left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
left join T_Inwardgateregister_fileupload infiles on infiles.IGRNO = im.IGRNO
where pm.Status != 'ST030' "; where pm.Status != 'ST030' ";
if ($cname!= ''){ if ($cname!= ''){
@ -1682,7 +1712,11 @@ $sql.="group by pono,material_name,category,supplier_name,id.IGRItemNo";
function ireport_attachment($cname,$fa,$aa,$m,$frm,$t){ function ireport_attachment($cname,$fa,$aa,$m,$frm,$t){
$sql="select pono,potype,date_format(created_date,'%d-%m-%Y') as created_date,date_format(materialrcvddate,'%d-%m-%Y') as materialrcvddate,supplier_name, // $sql="select pono,potype,date_format(created_date,'%d-%m-%Y') as created_date,date_format(materialrcvddate,'%d-%m-%Y') as materialrcvddate,supplier_name,
// sum(total) as total,file,ifile
// from igr
$sql="select pono,igrn,potype,date_format(created_date,'%d-%m-%Y') as created_date,date_format(materialrcvddate,'%d-%m-%Y') as materialrcvddate,supplier_name,
sum(total) as total,file,ifile sum(total) as total,file,ifile
from igr from igr
where status != 'ST030' where status != 'ST030'
@ -1723,7 +1757,36 @@ if ($cname!= ''){
// echo $sid; // echo $sid;
//echo $sql; //echo $sql;
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result();
$filequery = $query->result();
$resultArray = array();
foreach ($filequery as $value) {
$tempArray['pono'] = $value->pono;
$tempArray['potype'] =$value->potype;
$tempArray['supplier_name'] = $value->supplier_name;
$tempArray['materialrcvddate'] = $value->materialrcvddate;
$tempArray['total'] = $value->total;
$tempArray['created_date'] = $value->created_date;
$tempArray['file'] = $value->file;
$tempArray['ifile'] = $value->created_date;
$tempArray['igrn'] =$value->igrn;
$sqli ="select FilePath as Infiles from T_Inwardgateregister_fileupload where PONO =? and IGRNO =? ";
$querys = $this->db->query($sqli,array( $tempArray['pono'],$tempArray['igrn']));
$filepath = $querys->result();
$tempArray['Infiles'] = $filepath;
$resultArray[] = $tempArray;
}
return $resultArray;
} }
function ireport_year_wise($a,$b){ function ireport_year_wise($a,$b){
@ -2240,39 +2303,12 @@ if ($cname!= ''){
} }
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 $sql="select sum(sgst) as sgst,sum(cgst) as cgst,sum(igst) as igst,sum(sgst + cgst + igst) as total from igr
(SELECT pm.PONO as doc_no,date_format(pm.PODate,'%d-%m-%Y') as date, where pono != 'null' ";
'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!= ''){ if ($m!= ''){
$sql.="and monthname(p.PODate) = '".$m."'"; $sql.="and monthname(materialrcvddate) = '".$m."'";
} }
@ -2280,13 +2316,13 @@ where g.doc_no != 'null' ";
$fromd= date("Y-m-d",strtotime($frm)); $fromd= date("Y-m-d",strtotime($frm));
$tod=date("Y-m-d",strtotime($t)); $tod=date("Y-m-d",strtotime($t));
$sql.="and p.PODate >= '".$fromd."' $sql.="and materialrcvddate >= '".$fromd."'
and p.PODate <= '".$tod."'"; and materialrcvddate <= '".$tod."'";
} }
if ($fa and $aa != ''){ if ($fa and $aa != ''){
$sql.=" and (p.PODate >= '".$fa."-04-01' and p.PODate <= '".$aa."-03-31')"; $sql.=" and (materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')";
} }
@ -2295,159 +2331,187 @@ where g.doc_no != 'null' ";
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
public function monthly_gst_sales($m=null,$frm=null,$t=null,$fa=null,$aa=null) 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, $sql = "select ii.invoice_id as invoice_id,ifnull(iii.invnum,'-') as parent_invoice_id,ii.client_id as client_id,ii.invoice_number as invoice_number,date_format(ii.invoice_date_created,'%d-%m-%Y') as dates,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 item_subtotal,
sum(ifnull(((sgst.tax_rate_percent * (iit.item_quantity * iit.item_price))/100),0)) sum(ifnull(((sgst.tax_rate_percent * (iia.item_subtotal))/100),0))
as sgst, as sgst,
sum(ifnull(((iit.item_quantity * iit.item_price) * cgst.tax_rate_percent)/100,0)) sum(ifnull(((iia.item_subtotal) * cgst.tax_rate_percent)/100,0))
as cgst, as cgst,
sum(ifnull((igst.tax_rate_percent * (iit.item_quantity * iit.item_price))/100,0)) sum(ifnull((igst.tax_rate_percent * (iia.item_subtotal))/100,0))
as igst, as igst,
sum((ifnull(((sgst.tax_rate_percent * iia.item_subtotal)/100),0) sum((ifnull(((sgst.tax_rate_percent * iia.item_subtotal)/100),0)
+ +
ifnull(((iia.item_subtotal * cgst.tax_rate_percent)/100),0) ifnull(((iia.item_subtotal * cgst.tax_rate_percent)/100),0)
+ +
ifnull(((igst.tax_rate_percent * iia.item_subtotal)/100),0))) ifnull(((igst.tax_rate_percent * iia.item_subtotal)/100),0)))
as total as total
from ip_invoices ii from ip_invoices ii
join ip_invoice_custom icf on icf.invoice_id = ii.invoice_id 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_items iit on iit.invoice_id = ii.invoice_id
join ip_invoice_item_amounts iia on iia.item_id = iit.item_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_clients ic on ic.client_id = ii.client_id
join ip_products ip on ip.product_id = iit.item_product_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 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 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 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 "; left join (select inv.invoice_id as inv_id,inv.invoice_number,iii.invnum from ip_invoices inv
left join
(select ii.invoice_id as ii,ii.invoice_number as invnum,ic.invoice_number as icnum,ic.creditinvoice_parent_id as cp from ip_invoices as ii
left join ip_invoices as ic on ii.invoice_id = ic.creditinvoice_parent_id) as iii
on iii.icnum = inv.invoice_number) as iii on iii.inv_id = ii.invoice_id
if ($m!= ''){ where icf.invoice_custom_fieldid = '8' and ii.invoice_status_id != 1 ";
$sql.="and monthname(ii.invoice_date_created) = '".$m."'";
}
if ($m!= ''){
if ($frm and $t != ''){
$fromdate= date("Y-m-d",strtotime($frm)); $sql.="and monthname(ii.invoice_date_created) = '".$m."'";
$todate=date("Y-m-d",strtotime($t));
}
$sql.="and ii.invoice_date_created >= '".$fromdate."'
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."'"; and ii.invoice_date_created <= '".$todate."'";
} }
if ($fa and $aa != ''){ if ($fa and $aa != ''){
$sql.=" and (ii.invoice_date_created >= '".$fa."-04-01' and ii.invoice_date_created <= '".$aa."-03-31')"; $sql.=" and (ii.invoice_date_created >= '".$fa."-04-01' and ii.invoice_date_created <= '".$aa."-03-31')";
} }
//echo $sql; //echo $sql;
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
function sales_gst($m=null,$frm=null,$t=null,$fa=null,$aa=null) 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, $sql = "select ii.invoice_id as invoice_id,'Sales' as doc_type,ip.product_sku as hsn_code,ifnull(iii.invnum,'-') as parent_invoice_id,ii.client_id as client_id,ii.invoice_number as doc_no,date_format(ii.invoice_date_created,'%d-%m-%Y') as date,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)) sum(ifnull(((sgst.tax_rate_percent * (iia.item_subtotal))/100),0))
as sgst, as sgst,
sum(ifnull(((iit.item_quantity * iit.item_price) * cgst.tax_rate_percent)/100,0)) sum(ifnull(((iia.item_subtotal) * cgst.tax_rate_percent)/100,0))
as cgst, as cgst,
sum(ifnull((igst.tax_rate_percent * (iit.item_quantity * iit.item_price))/100,0)) sum(ifnull((igst.tax_rate_percent * (iia.item_subtotal))/100,0))
as igst, as igst,
round(sum((iia.item_subtotal + ifnull(((sgst.tax_rate_percent * iia.item_subtotal)/100),0) 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(((iia.item_subtotal * cgst.tax_rate_percent)/100),0)
+ +
ifnull(((igst.tax_rate_percent * iia.item_subtotal)/100),0))),2) ifnull(((igst.tax_rate_percent * iia.item_subtotal)/100),0)))
as total as total
from ip_invoices ii from ip_invoices ii
join ip_invoice_custom icf on icf.invoice_id = ii.invoice_id 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_items iit on iit.invoice_id = ii.invoice_id
join ip_invoice_item_amounts iia on iia.item_id = iit.item_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_clients ic on ic.client_id = ii.client_id
join ip_products ip on ip.product_id = iit.item_product_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 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 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 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 "; left join (select inv.invoice_id as inv_id,inv.invoice_number,iii.invnum from ip_invoices inv
left join
(select ii.invoice_id as ii,ii.invoice_number as invnum,ic.invoice_number as icnum,ic.creditinvoice_parent_id as cp from ip_invoices as ii
left join ip_invoices as ic on ii.invoice_id = ic.creditinvoice_parent_id) as iii
if ($m!= ''){ on iii.icnum = inv.invoice_number) as iii on iii.inv_id = ii.invoice_id
where icf.invoice_custom_fieldid = '8' and ii.invoice_status_id != 1 and ii.invoice_status_id != 1 ";
$sql.="and monthname(ii.invoice_date_created) = '".$m."'";
}
if ($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.="and monthname(ii.invoice_date_created) = '".$m."'";
} }
if ($frm and $t != ''){
// echo $fromdate; $fromdate= date("Y-m-d",strtotime($frm));
//echo $sql; $todate=date("Y-m-d",strtotime($t));
$sql.="group by doc_no,product_description";
$query = $this->db->query($sql); $sql.="and ii.invoice_date_created >= '".$fromdate."'
return $query->result(); and ii.invoice_date_created <= '".$todate."'";
}
} if ($fa and $aa != ''){
function purchase_gst($m,$frm,$t,$fa,$aa){
$sql.=" and (ii.invoice_date_created >= '".$fa."-04-01' and ii.invoice_date_created <= '".$aa."-03-31')";
}
$sql="SELECT pm.PONO as doc_no,pm.POType as potype,date_format(pm.PODate,'%d-%m-%Y') as date, // echo $fromdate;
TIME_FORMAT(pm.PODate,'%l:%i %p') as created_time,'Purchase' as doc_type,mm.HSNCODE as hsn_code, //echo $sql;
mm.MaterialName as material_name,sd.SupplierName as supplier_name, $sql.="group by doc_no,product_description";
ifnull(sum(distinct pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(distinct pl.Rate),0) as rate, $query = $this->db->query($sql);
round(ifnull(sum(distinct pl.Quantity * pl.Rate),0),2) as value, return $query->result();
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, function purchase_gst($m,$frm,$t,$fa,$aa){
(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) $sql="select im.IGRNO as igrn,pm.POType as potype,im.PONO as doc_no,'Purchase' as doc_type,mm.HSNCODE as hsn_code,mm.MaterialName as material_name,mm.Category as category,sd.SupplierName as supplier_name,mm.UOM as UOM, id.QuantityAsPerInvoice as quantity,pl.Rate as rate,round(id.QuantityAsPerInvoice * pl.Rate,2) as value,if(POType = 'IMPORT' or POType = 'CAPITAL',pm.ExchangeRate,0) as exchange_rate,date_format(im.MaterialRcvdDate,'%d-%m-%Y') as date,
-ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)) as others, round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) as sgst,
round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2) as cgst,
round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2) as igst,
(round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2)
+ round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2)
- round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)) as others,
round(( round((
if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)), if(POType = 'IMPORT',(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)), if(POType = 'CAPITAL' && CapitalRange = 0,(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
ifnull(sum(pl.Quantity * pl.Rate),0))) ifnull((id.QuantityAsPerInvoice * pl.Rate),0)))
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterSGST),sum(distinct st.After_SGST)),0) + round(ifnull(if(POType = 'REVENUE',
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterCGST),sum(distinct st.After_CGST)),0) (id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IGST)),0) (id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0) + round(ifnull(if(POType = 'REVENUE',
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0) (id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
+ ifnull(rt.Insurance,0) (id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2)
- ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total + round(ifnull(if(POType = 'REVENUE',
FROM T_PurchaseOrder_Master pm (id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO (id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2)
- round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
im.file as ifile,pb.FilePath as file
from T_IGR_Master im
left 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_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
where left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' "; where pm.Status != 'ST030' ";
if ($m!= ''){ if ($m!= ''){
$sql.="and monthname(pm.PODate) = '".$m."'"; $sql.="and monthname(materialrcvddate) = '".$m."'";
} }
@ -2455,18 +2519,18 @@ pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' ";
$fromd= date("Y-m-d",strtotime($frm)); $fromd= date("Y-m-d",strtotime($frm));
$tod=date("Y-m-d",strtotime($t)); $tod=date("Y-m-d",strtotime($t));
$sql.="and date(pm.PODate) >= '".$fromd."' $sql.="and date(materialrcvddate) >= '".$fromd."'
and date(pm.PODate) <= '".$tod."'"; and date(materialrcvddate) <= '".$tod."'";
} }
if ($fa and $aa != ''){ if ($fa and $aa != ''){
$sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')"; $sql.=" and (materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')";
} }
$sql.="group by doc_no,material_name,supplier_name"; $sql.="group by doc_no,material_name,category,supplier_name,id.IGRItemNo";
//echo $sql; //echo $sql;
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
@ -2590,14 +2654,14 @@ $sql.="group by doc_no,material_name,supplier_name";
} }
function yearwise_data($value='') function yearwise_data($value='')
{ {
if (date('m') >= 4) { if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1); $yearl = date('Y').'-'.(date('Y')+1);
} else { } else {
$yearl = (date('Y')-1).'-'.date('Y'); $yearl = (date('Y')-1).'-'.date('Y');
} }
$ab=$yearl; $ab=$yearl;
$fa=substr($ab,0,-5); $fa=substr($ab,0,-5);
$aa=substr($ab,5,5); $aa=substr($ab,5,5);
$sql="SELECT type,sum(total) as yearlydata from t_income_expense $sql="SELECT type,sum(total) as yearlydata from t_income_expense
where where
@ -3052,5 +3116,4 @@ function getDailyOpeningAmt($yesterday){
} }
} }
?> ?>

View File

@ -112,12 +112,32 @@ return $afftectedRows;
function viewIGRFile($IGRNO) // function viewIGRFile($IGRNO)
// {
// $this->db->distinct();
// $this->db->select('*'); //BillNo,IGRNO,FilePath,PONO
// $this->db->from('T_Inwardgateregister_fileupload');
// $this->db->where('IGRNO',$IGRNO);
// $query = $this->db->get();
// $result = $query->result();
// // print_r($result);die;
// //print_r($this->db->last_query());
// return $result;
// }
function viewIGRFile($IGRNO)
{ {
$this->db->distinct(); $this->db->distinct();
$this->db->select('*'); //BillNo,IGRNO,FilePath,PONO $this->db->select('igrm.file,igrf.*'); //BillNo,IGRNO,FilePath,PONO
$this->db->from('T_Inwardgateregister_fileupload'); $this->db->from('T_IGR_Master igrm');
$this->db->where('IGRNO',$IGRNO); $this->db->join('T_Inwardgateregister_fileupload igrf','igrm.IGRNO = igrf.IGRNO','left');
//$this->db->join('T_IGR_Details igrd','igrm.IGRNO = igrd.IGRNO','left');
$this->db->where('igrm.IGRNO',$IGRNO);
$query = $this->db->get(); $query = $this->db->get();

View File

@ -180,6 +180,14 @@ function updateigrmaster($igrno,$NewPOno)
$insert_id = $this->db->affected_rows(); $insert_id = $this->db->affected_rows();
return $insert_id; return $insert_id;
} }
function updateigrfile($igrno,$NewPOno)
{
$this->db->where('IGRNO',$igrno);
$this->db->update('T_Inwardgateregister_fileupload',$NewPOno);
$insert_id = $this->db->affected_rows();
return $insert_id;
}
function selectigrmaster($PONO) function selectigrmaster($PONO)
{ {
@ -196,7 +204,7 @@ $this->db->where('PONO',$PONO);
function getpolineqty($NewPO) function getpolineqty($NewPO)
{ {
$this->db->select('*'); $this->db->select('sum(Quantity)as Qty,sum(ReceivedQuantity)as rec');
$this->db->from('T_PurchaseOrder_LineItem'); $this->db->from('T_PurchaseOrder_LineItem');
$this->db->where('PONO',$NewPO); $this->db->where('PONO',$NewPO);
@ -205,19 +213,19 @@ function getpolineqty($NewPO)
} }
function POLineItemsupdatestatus($POno,$Newstatus) function POLineItemsupdatestatus($NewPO,$Newstatus)
{ {
$this->db->where('PONO',$POno); $this->db->where('PONO',$NewPO);
$this->db->update('T_PurchaseOrder_LineItem',$Newstatus); $this->db->update('T_PurchaseOrder_LineItem',$Newstatus);
$update = $this->db->affected_rows(); $update = $this->db->affected_rows();
return $update; return $update;
} }
function pomasterupdatestatus($POno,$Newstat) function pomasterupdatestatus($NewPO,$Newstatus)
{ {
$this->db->where('PONO',$POno); $this->db->where('PONO',$NewPO);
$this->db->update('T_PurchaseOrder_Master',$Newstat); $this->db->update('T_PurchaseOrder_Master',$Newstatus);
$update = $this->db->affected_rows(); $update = $this->db->affected_rows();
return $update; return $update;
} }

View File

@ -225,50 +225,61 @@
<th style="text-align:center">Attachments</th> <th style="text-align:center">Attachments</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php if(!empty($purchase)){ <?php if(!empty($purchase)){
$tot_tot = 0; $tot_tot = 0;
//print_r($purchase); return false;
foreach($purchase as $rel) foreach($purchase as $rel)
{ {
// print_r($rel);
// $newArray = array();
// foreach($multi as $array) {
// foreach($array as $k=>$v) {
// $newArray[$k] = $v;
// }
// }
?> ?>
<tr> <tr>
<td><span> <td><span>
<a href="<?php echo base_url().'purchaseorder/CreatePOPrint?PONO='.$rel->pono.'&ReqType='.$rel->potype; ?>"><?php echo $rel->pono;?></a> <a href="<?php echo base_url().'purchaseorder/CreatePOPrint?PONO='.$rel['pono'],'&ReqType='.$rel['potype']; ?>"><?php echo $rel['pono'];?></a>
</span></td> </span></td>
<td style="text-align:center"><span><?php echo $rel->created_date;?></span></td> <td style="text-align:center"><span><?php echo $rel['created_date'];?></span></td>
<td style="text-align:center"><span><?php echo $rel->materialrcvddate;?></span></td> <td style="text-align:center"><span><?php echo $rel['materialrcvddate'];?></span></td>
<td><span> <td><span>
<a href="<?= base_url() ?>report/ilink_purchase?po=<?php echo $rel->pono;?>"><?php echo $rel->supplier_name;?> </a> <a href="<?= base_url() ?>report/ilink_purchase?po=<?php echo $rel['pono'];?>"><?php echo $rel['supplier_name'];?> </a>
</span></td> </span></td>
<td style="text-align:right"><span><?php <td style="text-align:right">
$tot_tot= $tot_tot + round($rel->total,2); <span><?php
echo $rel->total; $tot_tot= $tot_tot + round($rel['total'],2);
echo $rel['total'];
?></span></td> ?></span></td>
<td style="text-align:center"><span> <td style="text-align:center"><span>
<?php <?php
if(!empty($rel->file)){ ?> if(!empty($rel['file'])){ ?>
<a target="_blank" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm splpofile" id="files<?php echo $rel->pono;?>">Download</button></a> <a target="_blank" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm splpofile" id="files<?php echo $rel['pono'];?>">Download</button></a>
<?php }else if(!empty($rel->ifile)) { ?>
<a target="_blank" href="<?php echo base_url().''. $rel->ifile ?>" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm">Download</button></a> <?php } elseif(!empty(sizeof($rel['Infiles'])) !=0){?>
<?php }else if(!empty($rel->Infiles)){ ?>
<a target="_blank" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm IGRfile" id="files<?php echo $rel->pono;?>">Download</button></a> <a target="_blank" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm IGRfile" id="files<?php echo $rel['pono'];?>">Download</button></a>
<?php } else {
<?php }else{
echo 'N/A'; echo "N/A";
} }
?> ?>
</span></td> </span></td>
</tr> </tr>
<?php <?php
}
}
?> ?>
</tbody> </tbody>
<tfoot width="100%"> <tfoot width="100%">
@ -342,7 +353,7 @@ $("#Fileshow").modal("show");
'<td>' + item.BillNo+ '</td>' + '<td>' + item.BillNo+ '</td>' +
'<td>' + item.PONO+ '</td>' + '<td>' + item.PONO+ '</td>' +
'<td><a target="_blank" href = <?php echo base_url()?>uploads/BillFiles/'+item.FilePath+'>'+ item.FilePath +'</a></td>' + '<td><a target="_blank" href = <?php echo base_url()?>uploads/Igrfiles/'+item.FilePath+'>'+ item.FilePath +'</a></td>' +
// '<td>' +item.FilePath+"<?php echo base_url().'uploads/BillFiles/'?>"> +'</td>' // '<td>' +item.FilePath+"<?php echo base_url().'uploads/BillFiles/'?>"> +'</td>'

View File

@ -582,7 +582,7 @@ $('.IGRfile').click(function() {
'<td align="right">' + i + '</td>' + '<td align="right">' + i + '</td>' +
'<td>' + item.BillNo+ '</td>' + '<td>' + item.BillNo+ '</td>' +
'<td>' + item.PONO+ '</td>' + '<td>' + item.PONO+ '</td>' +
'<td><a target="_blank" href = <?php echo base_url()?>uploads/BillFiles/'+item.FilePath+'>'+ item.FilePath +'</a></td>' + '<td><a target="_blank" href = <?php echo base_url()?>uploads/Igrfiles/'+item.FilePath+'>'+ item.FilePath +'</a></td>' +
'</tr>'; '</tr>';
}); });

View File

@ -8733,21 +8733,22 @@ else{
var div = document.createElement('div'); var div = document.createElement('div');
div.id = "divid"+counter; div.id = "divid"+counter;
div.className="row"; div.className="row";
div.innerHTML='<div class="col-md-15">'+ div.innerHTML='<div class="col-md-12">'+
'<div class="col-md-3">'+ '<div class="col-md-4">'+
'<label><br></label>'+ '<label><br></label>'+
'<input type="file" name="browseFiles'+counterConstant+'" id="imag" onchange="Copyfilename(this.name); "><br>'+ '<input type="file" name="browseFiles'+counterConstant+'" id="imag" onchange="Copyfilename(this.name); "><br>'+
'</div>'+ '</div>'+
'<div class="col-md-2">'+
'<label><br><br></label>'+
'<button class="btn btn-primary remove remove_this" id="removebtn'+counter+'" onclick="removeRow(this.id)"><i class="fa fa-"></i> - </button></div>'+
'</div>'+
'<div class="col-md-3">'+ '<div class="col-md-1" style="margin-top:-3%;">'+
'<label><br><br></label>'+ '<label><br><br></label>'+
'<button class="btn btn-primary" onclick="addRow('+counter+')"id="addbtn1" ><i class="fa fa-"></i>+</button></div>'+ '<button class="btn btn-primary" type="button" onclick="addRow('+counter+')"id="addbtn1" ><i class="fa fa-plus-square"></i></button></div>'+
'</div>'+
'<div class="col-md-1" style="margin-top:-3%;">'+
'<label><br><br></label>'+
'<button class="btn btn-danger remove remove_this" id="removebtn'+counter+'" onclick="removeRow(this.id)"><i class="fa fa-minus-square"></i> </button></div>'+
'</div>'; '</div>';
$('#newdiv').append(div); $('#newdiv').append(div);
@ -8814,21 +8815,22 @@ else{
var div = document.createElement('div'); var div = document.createElement('div');
div.id = "divid"+counter; div.id = "divid"+counter;
div.className="row"; div.className="row";
div.innerHTML='<div class="col-md-15">'+ div.innerHTML='<div class="col-md-12">'+
'<div class="col-md-3">'+ '<div class="col-md-4">'+
'<label><br></label>'+ '<label><br></label>'+
'<input type="file" name="browseFiles'+counterConstant+'" id="imag" onchange="Copyfilename(this.name); "><br>'+ '<input type="file" name="browseFiles'+counterConstant+'" id="imag" onchange="Copyfilename(this.name); "><br>'+
'</div>'+ '</div>'+
'<div class="col-md-2">'+
'<label><br><br></label>'+
'<button class="btn btn-primary remove remove_this" id="removebtn'+counter+'" onclick="removeRow(this.id)"><i class="fa fa-"></i> - </button></div>'+
'</div>'+
'<div class="col-md-3">'+ '<div class="col-md-1" style="margin-top:-3%;">'+
'<label><br><br></label>'+ '<label><br><br></label>'+
'<button class="btn btn-primary" id="addbtn'+counter+'" onclick="addRow('+counter+')"><i class="fa fa-"></i>+</button></div>'+ '<button class="btn btn-primary" type="button" id="addbtn'+counter+'" onclick="addRow('+counter+')"><i class="fa fa-plus-square"></i></button></div>'+
'<div class="col-md-1" style="margin-top:-3%;">'+
'<label><br><br></label>'+
'<button class="btn btn-danger remove remove_this" id="removebtn'+counter+'" onclick="removeRow(this.id)"><i class="fa fa-minus-square"></i> </button></div>'+
'</div>'+ '</div>'+
@ -8861,8 +8863,12 @@ div.innerHTML='<div class="col-md-15">'+
function rfilealert() function rfilealert()
{ {
//alert(counterConstant);
var file = $('#imag').val();
//var file = $('#imag').val(); //var file = $('#imag').val();
var file = $('#imag'+counterConstant).val();
// alert(file);
if (file=='') if (file=='')
{ {
@ -8899,20 +8905,6 @@ function Copyfilename(id)
} }
// function removeRow(input) {
// var number = input.replace(/[^0-9]+/ig,"");
// if(counter >= 1){
// counter--;
// $("#divid"+number).remove();
// $('#hidecounter').val(counter);
// }
// }
function removeRow(input) { function removeRow(input) {
// alert(input); // alert(input);
var number = input.replace(/[^0-9]+/ig,""); var number = input.replace(/[^0-9]+/ig,"");
@ -8968,20 +8960,22 @@ else{
var div = document.createElement('div'); var div = document.createElement('div');
div.id = "divid"+counters; div.id = "divid"+counters;
div.className="row"; div.className="row";
div.innerHTML='<div class="col-md-15">'+ div.innerHTML='<div class="col-md-12">'+
'<div class="col-md-3">'+ '<div class="col-md-4" >'+
'<label><br></label>'+ '<label><br></label>'+
'<input type="file" id="images1" name="browseFiles'+counterConstants+'" onchange="Copyfilenames(this.name);"><br>'+ '<input type="file" id="images1" name="browseFiles'+counterConstants+'" onchange="Copyfilenames(this.name);"><br>'+
'</div>'+ '</div>'+
'<div class="col-md-2">'+
'<div class="col-md-1" >'+
'<label><br><br></label>'+ '<label><br><br></label>'+
'<button class="btn btn-danger remove remove_this" id="removebtns'+counters+'" onclick="removeRows(this.id)"><i class="fa fa-trash"></i> Remove</button></div>'+ '<button class="btn btn-primary" type="button" onclick="addRows('+counters+')"id="addbtns1" ><i class="fa fa-plus-square"></i></button></div>'+
'</div>'+
'<div class="col-md-3">'+ '<div class="col-md-1" >'+
'<label><br><br></label>'+ '<label><br><br></label>'+
'<button class="btn btn-primary" onclick="addRows('+counters+')"id="addbtns1" ><i class="fa fa-"></i>+</button></div>'+ '<button class="btn btn-danger remove remove_this" id="removebtns'+counters+'" onclick="removeRows(this.id)"><i class="fa fa-minus-square"></i></button></div>'+
'</div>'+
'</div>'; '</div>';
$('#newsdiv').append(div); $('#newsdiv').append(div);
@ -9035,23 +9029,26 @@ else{
var div = document.createElement('div'); var div = document.createElement('div');
div.id = "divid"+counters; div.id = "divid"+counters;
div.className="row"; div.className="row";
div.innerHTML='<div class="col-md-15">'+ div.innerHTML='<div class="col-md-12">'+
'<div class="col-md-3">'+ '<div class="col-md-4">'+
'<label><br></label>'+ '<label><br></label>'+
'<input type="file" name="browseFiles'+counterConstants+'" id="images1" onchange="Copyfilename(this.name); "><br>'+ '<input type="file" name="browseFiles'+counterConstants+'" id="images1" onchange="Copyfilename(this.name); "><br>'+
'</div>'+ '</div>'+
'<div class="col-md-2">'+ // '<div class="col-md-2">'+
'<label><br><br></label>'+ // '<label><br><br></label>'+
'<button class="btn btn-danger remove remove_this" id="removebtns'+counters+'" onclick="removeRows(this.id)"><i class="fa fa-trash"></i> Remove</button></div>'+ // '<button class="btn btn-danger remove remove_this" id="removebtns'+counters+'" onclick="removeRows(this.id)"><i class="fa fa-"></i>-</button></div>'+
'</div>'+ // '</div>'+
'<div class="col-md-3">'+ '<div class="col-md-1" >'+
'<label><br><br></label>'+ '<label><br><br></label>'+
'<button class="btn btn-primary" id="addbtns'+counters+'" onclick="addRows('+counters+')"><i class="fa fa-"></i>+</button></div>'+ '<button class="btn btn-primary" type="button" id="addbtns'+counters+'" onclick="addRows('+counters+')"><i class="fa fa-plus-square"></i></button></div>'+
'</div>'+
'<div class="col-md-1" >'+
'<label><br><br></label>'+
'<button class="btn btn-danger remove remove_this" id="removebtns'+counters+'" onclick="removeRows(this.id)"><i class="fa fa-minus-square"></i></button></div>'+
'</div>'+
'</div>'; '</div>';
@ -9082,8 +9079,8 @@ div.innerHTML='<div class="col-md-15">'+
function sfilealert() function sfilealert()
{ {
//alert(counterConstants);
var file1 = $('#images1'+counterConstants).val(); var file1 = $('#images1').val();
//$('input[name='+id+']')[0].files[0].size; //$('input[name='+id+']')[0].files[0].size;
if (file1=='') if (file1=='')
{ {

View File

@ -1,4 +1,4 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.3.4/jquery.inputmask.bundle.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.3.4/jquery.inputmask.bundle.min.js"></script>
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script> <script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script> <script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
@ -232,6 +232,7 @@ Inputmask("A{2,3} 9{1,2} A{1,2} 9{4}").mask($("#VehicleNo"));
<div class="col-md-1 col-md-offset-10"> <div class="col-md-1 col-md-offset-10">
<button class="btn btn-primary" id='IGRLink' type="submit" name='IGRLink' onclick="filecheck();">Generate IGR</button> <button class="btn btn-primary" id='IGRLink' type="submit" name='IGRLink' onclick="filecheck();">Generate IGR</button>
@ -452,11 +453,15 @@ function validate()
//alert(data); //alert(data);
var trHTML = ''; var trHTML = '';
var j=0;
$.each(JSON.parse(data), function (i, item) { $.each(JSON.parse(data), function (i, item) {
if(item.PendingQty != 0){
i=i+1; i=i+1;
j=j+1;
trHTML += '<tr>' + trHTML += '<tr>' +
'<td align="right">' + i + '</td>' + '<td align="right">' + j + '</td>' +
'<td name="MaterialName" id="MaterialCode" >' + item.MaterialCode + '</td>' + '<td name="MaterialName" id="MaterialCode" >' + item.MaterialCode + '</td>' +
'<td>' + item.MaterialName + '</td>' + '<td>' + item.MaterialName + '</td>' +
'<td name="UOM">' + item.UOM + '</td>' + '<td name="UOM">' + item.UOM + '</td>' +
@ -515,7 +520,22 @@ $('<input>').attr({
$('#QuantityAsPerInvoice'+i).attr('readonly', 'true'); $('#QuantityAsPerInvoice'+i).attr('readonly', 'true');
// $('#txtEditFreight').attr('readonly', 'true'); // $('#txtEditFreight').attr('readonly', 'true');
} }
$("#IGRLink").show();
} else{
if(JSON.parse(data).length == 1 && item.PendingQty == 0){
$("#IGRLink").hide();
//alert('The Order is new completed!!');
}
}
}); });
@ -535,6 +555,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 ?>'))
{ {
alert('The Order is completed!!'); alert('The Order is completed!!');
$("#IGRLink").hide(); $("#IGRLink").hide();
} }
else else
@ -682,21 +703,24 @@ else{
counterConstants++; counterConstants++;
var div = document.createElement('div'); var div = document.createElement('div');
div.id = "divid"+counterConstants; div.id = "divid"+counters;
div.className="row"; div.className="row";
div.innerHTML='<div class="col-md-12">'+ div.innerHTML='<div class="col-md-12">'+
// '<div class="col-md-3">'+
// '<label>File Name</label>'+
// '<input type="text" id="maint_filename'+counterConstant+'" name="filename'+counterConstant+'" class="form-control" onkeypress="return false;" readonly/>'+
// '</div>'+
'<div class="col-md-3">'+ '<div class="col-md-3">'+
'<label><br></label>'+ '<label><br></label>'+
'<input type="file" id="images" name="browseFiles'+counterConstants+'" onchange="Copyfilenames(this.name);"><br>'+ '<input type="file" id="images" name="browseFiles'+counterConstants+'" onchange="Copyfilenames(this.name);"><br>'+
'</div>'+ '</div>'+
'<div class="col-md-2">'+
'<div class="col-md-1">'+
'<label><br><br></label>'+ '<label><br><br></label>'+
'<button class="btn btn-danger remove remove_this" id="removebtn'+counterConstants+'" onclick="removeRows(this.id)"><i class="fa fa-trash"></i> Remove</button></div>'+ '<button class="btn btn-primary" type ="button" onclick="addRow('+counters+')"id="addbtn1" ><i class="fa fa-plus-square"></i></button></div>'+
'</div>'+
'<div class="col-md-1">'+
'<label><br><br></label>'+
'<button class="btn btn-danger remove remove_this" type ="button" id="removebtn'+counters+'" onclick="removeRows(this.id)"><i class="fa fa-minus-square"></i> </button></div>'+
'</div>'; '</div>';
$('#newsdiv').append(div); $('#newsdiv').append(div);
@ -705,7 +729,15 @@ div.innerHTML='<div class="col-md-12">'+
$('#hidecounters').val(counters); $('#hidecounters').val(counters);
$('#hideconstants').val(counterConstants); $('#hideconstants').val(counterConstants);
if(counters > 1){
alert("Add button click here");//this allows only 5 files;
return false;
}
else {
$('#addemorebutton').hide();
}
@ -713,13 +745,78 @@ div.innerHTML='<div class="col-md-12">'+
} }
}); });
function addRow(inputs)
{ if(inputs <5){
if(inputs ==0){
inputs = inputs+1;
$("#addbtn"+inputs).hide();
$("#removebtn"+inputs).hide();
}else{
$("#addbtn"+inputs).hide();
$("#removebtn"+inputs).hide();
}
}else{
$("#addbtn"+inputs).show();
$("#removebtn"+inputs).show();
}
// alert(s);
if(counters>4){
alert("No more files to add");//this allows only 5 files;
return false;
}
else{
counters++;
counterConstants++;
//alert("count"+counterConstants);
var div = document.createElement('div');
div.id = "divid"+counters;
div.className="row";
div.innerHTML='<div class="col-md-12">'+
'<div class="col-md-3">'+
'<label><br></label>'+
'<input type="file" name="browseFiles'+counterConstants+'" id="images1" onchange="Copyfilenames(this.name); "><br>'+
'</div>'+
'<div class="col-md-1">'+
'<label><br><br></label>'+
'<button class="btn btn-primary" type ="button" id="addbtn'+counters+'" onclick="addRow('+counters+')"><i class="fa fa-plus-square"></i></button></div>'+
'<div class="col-md-1">'+
'<label><br><br></label>'+
'<button class="btn btn-danger remove remove_this" type ="button" id="removebtn'+counters+'" onclick="removeRows(this.id)"><i class="fa fa-minus-square"></i></button></div>'+
'</div>'+
'</div>';
$('#newsdiv').append(div);
$('#hidecounters').val(counters);
$('#hideconstants').val(counterConstants);
if(counters > 1){
//alert("Next File choose + button click here");//this allows only 5 files;
//return false;
$('#addbtn').hide();
$("#removebtn").hide();
}
else {
$('#addemorebutton').hide();
}
}
}
function filecheck() function filecheck()
{ {
//alert(counterConstants); //alert(counterConstants);
var file1 = $('#images'+counterConstants).val(); var file1 = $('#images').val();
//alert(myfile); //alert(myfile);
@ -772,16 +869,33 @@ function Copyfilenames(id)
function removeRows(input) {
var number = input.replace(/[^0-9]+/ig,"");
if(counters>= 1){
function removeRows(inputs) {
// alert(input);
var number = inputs.replace(/[^0-9]+/ig,"");
//alert(number);
if(counters >= 1){
counters --; counters --;
$("#divid"+number).remove(); $("#divid"+number).remove();
$('#hidecounter').val(counters); $('#hidecounters').val(counters);
}
var rm_count = $("#hideconstants").val();
if(counters !=0){
if(number != rm_count){
// alert("if");
$("#addbtn"+counters).show();
$("#removebtn"+counters).show();
}else{
//alert('else');
$("#addbtn"+counters).show();
$("#removebtn"+counters).show();
}
}else{
$("#addemorebutton").show();
} }
} }
</script> </script>

View File

@ -21,8 +21,8 @@
<div class="box-header"> <div class="box-header">
<CENTER><h3 class="box-title">Siddharth Industries -View Inward Gate Register</h3></CENTER> <CENTER><h3 class="box-title">Siddharth Industries -View Inward Gate Register</h3></CENTER>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12 text-right" style="margin-bottom:-3%;"> <div class="col-md-12 text-right" style="margin-bottom:-3%;">
<div class="form-group"> <div class="form-group">
@ -83,7 +83,7 @@
<!-- <a target="_blank" href="<?php echo base_url().$record->file ?>"><i class="fa fa-download" ></i></a> --> <!-- <a target="_blank" href="<?php echo base_url().$record->file ?>"><i class="fa fa-download" ></i></a> -->
<a target="_blank" data-toggle="modal" data-target="#Fileshow" data-id="<%=index%>" title="Attachment Available for Download/View" data-userid="<?php echo $record->IGRNO ?>"><button class="btn btn-info btn-sm " >Download</button></a> <a target="_blank" data-toggle="modal" data-target="#Fileshow" data-id="<%=index%>" title="Attachment Available for Download/View" data-userid="<?php echo $record->IGRNO.'-'.$record->PONO ?>"><button class="btn btn-info btn-sm " >Download</button></a>
<?php <?php
} }
@ -138,7 +138,8 @@
<button type="button" class="close" data-dismiss="modal">&times;</button> <button type="button" class="close" data-dismiss="modal">&times;</button>
<center><h4>Inward Gate File Details</h4></center> <!-- IGR number should display here--> <center><h4>Inward Gate File Details</h4></center> <!-- IGR number should display here-->
</div> </div>
<!-- Table to show the line item of po --> <!-- Table to show the line item of po -->
<div id="contents" > </div> <div id="contents" > </div>
@ -147,7 +148,7 @@
<tr> <tr>
<th>SNo</th> <th>SNo</th>
<th>BillNO</th> <th>BillNO</th>
<th>IGRNO</th> <th>PONO</th>
<th>FileName</th> <th>FileName</th>
<th>Action</th> <th>Action</th>
@ -449,13 +450,23 @@ $("#Fileshow").on("shown.bs.modal",function(e) {
var id = $(e.relatedTarget).data('userid'); var id = $(e.relatedTarget).data('userid');
// alert(id); // alert(id);
$("#hiddenIGRNO").val(id);
// SIA/2018-2019/10243.01
// IGRNO0505
var igr = id.substring(0, 9);
// alert(igr);
var po = id.substring(10, 33);
//alert(po);
$("#hiddenIGRNO").val(igr);
$("#hiddenPONO").val(po);
if(id !=''){ if(id !=''){
$.ajax({ $.ajax({
data:{id:id}, data:{id:igr,id1:po},
type:"POST", type:"POST",
//dataType: 'json', //dataType: 'json',
url:"<?php echo base_url() ?>inwardgateregister/ViewIGRfile", url:"<?php echo base_url() ?>inwardgateregister/ViewIGRfile",
@ -467,16 +478,33 @@ $("#hiddenIGRNO").val(id);
var trHTML = ''; var trHTML = '';
var FilePath ='';
var Filename = '';
$.each(JSON.parse(file), function (i, item) $.each(JSON.parse(file), function (i, item)
{ {
if(item.file == null)
{ if(item.Remarks ==null)
{
//alert()
Filename =item.FilePath;
FilePath = "<?php echo base_url()?>uploads/Igrfiles/"+item.FilePath;
}else{
Filename ="BillDetails";
FilePath = item.FilePath;
}
}else{
Filename = item.file;
FilePath =item.file;
}
i=i+1; i=i+1;
trHTML += '<tr id='+i+'>' + trHTML += '<tr id='+i+'>' +
'<td align="right">' + i + '</td>' + '<td align="right">' + i + '</td>' +
'<td id="billno'+i+'">' + item.BillNo+ '</td>' + '<td id="billno'+i+'">' + item.BillNo+ '</td>' +
'<td>' + item.IGRNO+ '</td>' + '<td>' + item.PONO+ '</td>' +
'<td id="file'+i+'"><a target="_blank" href = <?php echo base_url()?>uploads/Igrfiles/'+item.FilePath+'>'+ item.FilePath +'</a></td>' +
'<td id="file'+i+'"><a target="_blank" href = '+FilePath+'>'+ Filename +'</a></td>' +
'<td name="filepathname" id="filepathname" onclick="openbillmodel('+i+');"><i class="fa fa-pencil"></i></td>' + '<td name="filepathname" id="filepathname" onclick="openbillmodel('+i+');"><i class="fa fa-pencil"></i></td>' +
'</tr>'; '</tr>';
@ -530,13 +558,12 @@ $("#hiddenIGRNO").val(id);
<!-- script for table , It works under the datatable plugin--> <!-- script for table , It works under the datatable plugin-->
$(function () { $(function () {
$.fn.dataTable.moment( 'DD-MM-YYYY' ); $.fn.dataTable.moment( 'DD-MM-YYYY' );
$('#Inwardgateregistertable').DataTable({
$('#Inwardgateregistertable').DataTable({
"paging": true, "paging": true,
"lengthChange": true, "lengthChange": true,
"searching": true, "searching": true,
"ordering": true, "ordering": true,
"aaSorting": [[ 5, "desc" ]], "aaSorting": [[ 4, "desc" ]],
"info": true, "info": true,
"autoWidth": true "autoWidth": true
@ -625,9 +652,11 @@ $("#Igrshow").on("shown.bs.modal", function(e) {
counter++; counter++;
var bil_count = +counter + +file_count;
var bil_count = +counter+ +file_count;
// alert(bil_count);
// alert(file_count);
if(bil_count>=5){ if(bil_count>=5){
alert("You have to upload five files only");//this allows only 5 files; alert("You have to upload five files only");//this allows only 5 files;
@ -725,10 +754,10 @@ counter++;
// alert(file); // alert(file);
var PONO =$('#hiddenPONO').val(); var PONO =$('#hiddenPONO').val();
// alert(PONO); // alert(PONO);
var igr =$('#hiddenIGRNO').val(); var igr =$('#hiddenIGRNO').val();
// alert(igr); //alert(igr);
formData.append('file',file); formData.append('file',file);