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);
// print_r($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);
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);
$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;
}
@ -697,6 +723,8 @@ foreach ($igrvalue as $value) {
$NewPOno = array('PONO' =>$NewPO);
// print_r($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);
$ServiceList =$this->purchaseorder_model->addServiceTax($ServiceTaxList);
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);
// $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);
// }
// 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);
$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;
}
@ -987,6 +1040,7 @@ foreach ($igrvalue as $value) {
$NewPOno = array('PONO' =>$NewPO);
// print_r($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 ;
}
@ -1370,6 +1449,7 @@ foreach ($igrvalue as $value) {
$NewPOno = array('PONO' =>$NewPO);
// print_r($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);
$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 ;
}

View File

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

View File

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

View File

@ -7,7 +7,7 @@ class dahsboard_Model extends CI_Model
/* HR DASHBOART Model START*/
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";
// $query =$this->db->query($sql,array($yes_date));
$this->db->select('count(*) as totemp');
@ -29,6 +29,19 @@ function getfile($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();
// print_r( $this->db->last_query());
$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()
{
@ -270,25 +297,25 @@ GROUP BY financial_year";
return $query->result();
}
function get_employee(){
$yes_date = date('Y-m-d',strtotime("-1 days"));
$sql = "select * from T_Employee_Details where date(created_date) <='".$yes_date."' and isActive =1";
$query = $this->db->query($sql);
return $query->result();
$yes_date = date('Y-m-d',strtotime("-1 days"));
$sql = "select * from T_Employee_Details where date(created_date) <='".$yes_date."' and isActive =1";
$query = $this->db->query($sql);
return $query->result();
}
function per($fa,$aa,$m)
{
//echo $m;
$cur_month = date('M');
//echo $cur_month;
if($cur_month == $m ){
$cur_date = date('d');
}else{
$cur_date = date('t',strtotime($m));
}
//echo $cur_date;die;
//echo $m;
$cur_month = date('M');
//echo $cur_month;
if($cur_month == $m ){
$cur_date = date('d');
}else{
$cur_date = date('t',strtotime($m));
}
//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
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
@ -600,7 +627,7 @@ function totalimportpo ()
function importbudgt ()
{
if (date('m') >= 4)
if (date('m') >= 4)
{
$yearl = date('Y').'-'.(date('Y')+1);
} else {
@ -616,7 +643,7 @@ function importbudgt ()
function capitalbud ()
{
if (date('m') >= 4)
if (date('m') >= 4)
{
$yearl = date('Y').'-'.(date('Y')+1);
} else {
@ -632,7 +659,7 @@ function capitalbud ()
function servicebudgt ()
{
if (date('m') >= 4)
if (date('m') >= 4)
{
$yearl = date('Y').'-'.(date('Y')+1);
} else {
@ -648,7 +675,7 @@ function servicebudgt ()
function revenuebudgt ()
{
if (date('m') >= 4)
if (date('m') >= 4)
{
$yearl = date('Y').'-'.(date('Y')+1);
} 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';
";
$query = $this->db->query($sql);
//echo $sql;
//echo $sql;
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'
group by Cost_Center_Code,BudgetYear,BudgetType";
$query = $this->db->query($sql);
//echo $sql;
//echo $sql;
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.AfterFreightValue),sum(distinct st.AfterFreightValue)),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
FROM T_PurchaseOrder_Master pm
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.AfterFreightValue),sum(distinct st.AfterFreightValue)),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
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
@ -1351,14 +1378,14 @@ if ($fa and $aa != ''){
return $query->result();
}
function report_cumulative(){
if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1);
} else {
$yearl = (date('Y')-1).'-'.date('Y');
}
$ab=$yearl;
$fa=substr($ab,0,-5);
$aa=substr($ab,5,5);
if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1);
} else {
$yearl = (date('Y')-1).'-'.date('Y');
}
$ab=$yearl;
$fa=substr($ab,0,-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
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){
if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1);
} else {
$yearl = (date('Y')-1).'-'.date('Y');
}
$ab=$yearl;
$fa=substr($ab,0,-5);
$aa=substr($ab,5,5);
$yearl = date('Y').'-'.(date('Y')+1);
} else {
$yearl = (date('Y')-1).'-'.date('Y');
}
$ab=$yearl;
$fa=substr($ab,0,-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
FROM T_PurchaseOrder_Master pm
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',
(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
im.file as ifile,pb.FilePath as file,infiles.FilePath as Infiles
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
@ -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_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
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' ";
if ($cname!= ''){
@ -1587,7 +1615,7 @@ ifnull((id.QuantityAsPerInvoice * pl.Rate),0)))
- 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
im.file as ifile,pb.FilePath as file,infiles.FilePath as Infiles
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
@ -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_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
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' ";
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){
$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
from igr
where status != 'ST030'
@ -1723,7 +1757,36 @@ if ($cname!= ''){
// echo $sid;
//echo $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){
@ -2240,39 +2303,12 @@ if ($cname!= ''){
}
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' ";
$sql="select sum(sgst) as sgst,sum(cgst) as cgst,sum(igst) as igst,sum(sgst + cgst + igst) as total from igr
where pono != 'null' ";
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));
$tod=date("Y-m-d",strtotime($t));
$sql.="and p.PODate >= '".$fromd."'
and p.PODate <= '".$tod."'";
$sql.="and materialrcvddate >= '".$fromd."'
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);
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."'
public function monthly_gst_sales($m=null,$frm=null,$t=null,$fa=null,$aa=null)
{
$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 * (iia.item_subtotal))/100),0))
as sgst,
sum(ifnull(((iia.item_subtotal) * cgst.tax_rate_percent)/100,0))
as cgst,
sum(ifnull((igst.tax_rate_percent * (iia.item_subtotal))/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
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
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 != ''){
}
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 != ''){
//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,'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 * (iia.item_subtotal))/100),0))
as sgst,
sum(ifnull(((iia.item_subtotal) * cgst.tax_rate_percent)/100,0))
as cgst,
sum(ifnull((igst.tax_rate_percent * (iia.item_subtotal))/100,0))
as igst,
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)))
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
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
where icf.invoice_custom_fieldid = '8' and ii.invoice_status_id != 1 and ii.invoice_status_id != 1 ";
if ($m!= ''){
$sql.=" and (ii.invoice_date_created >= '".$fa."-04-01' and ii.invoice_date_created <= '".$aa."-03-31')";
}
// echo $fromdate;
//echo $sql;
$sql.="group by doc_no,product_description";
$query = $this->db->query($sql);
return $query->result();
}
function purchase_gst($m,$frm,$t,$fa,$aa){
$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="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,
// echo $fromdate;
//echo $sql;
$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 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,
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((
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
if(POType = 'IMPORT',(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
if(POType = 'CAPITAL' && CapitalRange = 0,(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
ifnull((id.QuantityAsPerInvoice * pl.Rate),0)))
+ round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
(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_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' ";
left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
where pm.Status != 'ST030' ";
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));
$tod=date("Y-m-d",strtotime($t));
$sql.="and date(pm.PODate) >= '".$fromd."'
and date(pm.PODate) <= '".$tod."'";
$sql.="and date(materialrcvddate) >= '".$fromd."'
and date(materialrcvddate) <= '".$tod."'";
}
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;
$query = $this->db->query($sql);
return $query->result();
@ -2590,14 +2654,14 @@ $sql.="group by doc_no,material_name,supplier_name";
}
function yearwise_data($value='')
{
if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1);
} else {
$yearl = (date('Y')-1).'-'.date('Y');
}
$ab=$yearl;
$fa=substr($ab,0,-5);
$aa=substr($ab,5,5);
if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1);
} else {
$yearl = (date('Y')-1).'-'.date('Y');
}
$ab=$yearl;
$fa=substr($ab,0,-5);
$aa=substr($ab,5,5);
$sql="SELECT type,sum(total) as yearlydata from t_income_expense
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->select('*'); //BillNo,IGRNO,FilePath,PONO
$this->db->from('T_Inwardgateregister_fileupload');
$this->db->where('IGRNO',$IGRNO);
$this->db->select('igrm.file,igrf.*'); //BillNo,IGRNO,FilePath,PONO
$this->db->from('T_IGR_Master igrm');
$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();

View File

@ -180,6 +180,14 @@ function updateigrmaster($igrno,$NewPOno)
$insert_id = $this->db->affected_rows();
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)
{
@ -196,7 +204,7 @@ $this->db->where('PONO',$PONO);
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->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);
$update = $this->db->affected_rows();
return $update;
}
function pomasterupdatestatus($POno,$Newstat)
function pomasterupdatestatus($NewPO,$Newstatus)
{
$this->db->where('PONO',$POno);
$this->db->update('T_PurchaseOrder_Master',$Newstat);
$this->db->where('PONO',$NewPO);
$this->db->update('T_PurchaseOrder_Master',$Newstatus);
$update = $this->db->affected_rows();
return $update;
}

View File

@ -225,50 +225,61 @@
<th style="text-align:center">Attachments</th>
</tr>
</thead>
<tbody>
<tbody>
<?php if(!empty($purchase)){
$tot_tot = 0;
//print_r($purchase); return false;
foreach($purchase as $rel)
{
{
// print_r($rel);
// $newArray = array();
// foreach($multi as $array) {
// foreach($array as $k=>$v) {
// $newArray[$k] = $v;
// }
// }
?>
<tr>
<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>
<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['created_date'];?></span></td>
<td style="text-align:center"><span><?php echo $rel['materialrcvddate'];?></span></td>
<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>
<td style="text-align:right"><span><?php
$tot_tot= $tot_tot + round($rel->total,2);
echo $rel->total;
<td style="text-align:right">
<span><?php
$tot_tot= $tot_tot + round($rel['total'],2);
echo $rel['total'];
?></span></td>
<td style="text-align:center"><span>
<?php
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>
<?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 }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>
<?php } else {
echo 'N/A';
}
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>
<?php } elseif(!empty(sizeof($rel['Infiles'])) !=0){?>
<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{
echo "N/A";
}
?>
</span></td>
</tr>
<?php
}
}
?>
</tbody>
<tfoot width="100%">
@ -342,7 +353,7 @@ $("#Fileshow").modal("show");
'<td>' + item.BillNo+ '</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>'

View File

@ -582,7 +582,7 @@ $('.IGRfile').click(function() {
'<td align="right">' + i + '</td>' +
'<td>' + item.BillNo+ '</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>';
});

View File

@ -8733,21 +8733,22 @@ else{
var div = document.createElement('div');
div.id = "divid"+counter;
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>'+
'<input type="file" name="browseFiles'+counterConstant+'" id="imag" onchange="Copyfilename(this.name); "><br>'+
'</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>'+
'<button class="btn btn-primary" onclick="addRow('+counter+')"id="addbtn1" ><i class="fa fa-"></i>+</button></div>'+
'</div>'+
'<button class="btn btn-primary" type="button" onclick="addRow('+counter+')"id="addbtn1" ><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>';
$('#newdiv').append(div);
@ -8814,21 +8815,22 @@ else{
var div = document.createElement('div');
div.id = "divid"+counter;
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>'+
'<input type="file" name="browseFiles'+counterConstant+'" id="imag" onchange="Copyfilename(this.name); "><br>'+
'</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>'+
'<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>'+
@ -8861,8 +8863,12 @@ div.innerHTML='<div class="col-md-15">'+
function rfilealert()
{
//alert(counterConstant);
var file = $('#imag').val();
//var file = $('#imag').val();
var file = $('#imag'+counterConstant).val();
// alert(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) {
// alert(input);
var number = input.replace(/[^0-9]+/ig,"");
@ -8968,20 +8960,22 @@ else{
var div = document.createElement('div');
div.id = "divid"+counters;
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>'+
'<input type="file" id="images1" name="browseFiles'+counterConstants+'" onchange="Copyfilenames(this.name);"><br>'+
'</div>'+
'<div class="col-md-2">'+
'<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-trash"></i> Remove</button></div>'+
'</div>'+
'<div class="col-md-3">'+
'<button class="btn btn-primary" type="button" onclick="addRows('+counters+')"id="addbtns1" ><i class="fa fa-plus-square"></i></button></div>'+
'<div class="col-md-1" >'+
'<label><br><br></label>'+
'<button class="btn btn-primary" onclick="addRows('+counters+')"id="addbtns1" ><i class="fa fa-"></i>+</button></div>'+
'</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>';
$('#newsdiv').append(div);
@ -9035,23 +9029,26 @@ else{
var div = document.createElement('div');
div.id = "divid"+counters;
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>'+
'<input type="file" name="browseFiles'+counterConstants+'" id="images1" onchange="Copyfilename(this.name); "><br>'+
'</div>'+
'<div class="col-md-2">'+
'<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>'+
'</div>'+
// '<div class="col-md-2">'+
// '<label><br><br></label>'+
// '<button class="btn btn-danger remove remove_this" id="removebtns'+counters+'" onclick="removeRows(this.id)"><i class="fa fa-"></i>-</button></div>'+
// '</div>'+
'<div class="col-md-3">'+
'<div class="col-md-1" >'+
'<label><br><br></label>'+
'<button class="btn btn-primary" id="addbtns'+counters+'" onclick="addRows('+counters+')"><i class="fa fa-"></i>+</button></div>'+
'</div>'+
'<button class="btn btn-primary" type="button" id="addbtns'+counters+'" onclick="addRows('+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" id="removebtns'+counters+'" onclick="removeRows(this.id)"><i class="fa fa-minus-square"></i></button></div>'+
'</div>'+
'</div>';
@ -9082,8 +9079,8 @@ div.innerHTML='<div class="col-md-15">'+
function sfilealert()
{
var file1 = $('#images1'+counterConstants).val();
//alert(counterConstants);
var file1 = $('#images1').val();
//$('input[name='+id+']')[0].files[0].size;
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="<?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>
@ -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">
<button class="btn btn-primary" id='IGRLink' type="submit" name='IGRLink' onclick="filecheck();">Generate IGR</button>
@ -452,11 +453,15 @@ function validate()
//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>' +
@ -515,7 +520,22 @@ $('<input>').attr({
$('#QuantityAsPerInvoice'+i).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 ?>'))
{
alert('The Order is completed!!');
$("#IGRLink").hide();
}
else
@ -682,21 +703,24 @@ else{
counterConstants++;
var div = document.createElement('div');
div.id = "divid"+counterConstants;
div.id = "divid"+counters;
div.className="row";
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">'+
'<label><br></label>'+
'<input type="file" id="images" name="browseFiles'+counterConstants+'" onchange="Copyfilenames(this.name);"><br>'+
'</div>'+
'<div class="col-md-2">'+
'<div class="col-md-1">'+
'<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>'+
'</div>'+
'<button class="btn btn-primary" type ="button" onclick="addRow('+counters+')"id="addbtn1" ><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>';
$('#newsdiv').append(div);
@ -705,7 +729,15 @@ div.innerHTML='<div class="col-md-12">'+
$('#hidecounters').val(counters);
$('#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()
{
//alert(counterConstants);
var file1 = $('#images'+counterConstants).val();
var file1 = $('#images').val();
//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 --;
$("#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>

View File

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