'IGRissuefixed'
This commit is contained in:
parent
85c9b5f9bb
commit
98dbdd9a4d
@ -19,43 +19,33 @@ class inwardgateregister_model extends CI_Model
|
|||||||
function igrListing()
|
function igrListing()
|
||||||
{
|
{
|
||||||
|
|
||||||
//$this->db->select('igr.*,igrd.*,POM.DeliveryDate,sup.SupplierName,MM.MaterialName');
|
|
||||||
//$this->db->from('T_IGR_Master igr');
|
|
||||||
//$this->db->join('T_IGR_Details igrd','igrd.IGRNO = igr.IGRNO');
|
|
||||||
//$this->db->join('T_PurchaseOrder_Master POM ', 'igr.PONO = POM.PONO');
|
|
||||||
//$this->db->join('T_SupplierDetailsN sup', 'POM.SupplierID = sup.SupplierID');
|
|
||||||
//$this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = igrd.MaterialCode');
|
|
||||||
//$this->db->group_by('igr.IGRNO');
|
|
||||||
|
|
||||||
$this->db->select('igr.*, igrd.*,PO.DeliveryDate,sup.SupplierName');
|
$this->db->select('igr.*,PO.DeliveryDate,sup.SupplierName');
|
||||||
$this->db->from('T_IGR_Master igr');
|
$this->db->from('T_IGR_Master igr');
|
||||||
$this->db->join('T_IGR_Details igrd','igrd.IGRNO = igr.IGRNO','left');
|
$this->db->join('T_PurchaseOrder_Master PO','igr.PONO = PO.PONO');
|
||||||
$this->db->join('T_PurchaseOrder_Master PO','igr.PONO = PO.PONO','left');
|
$this->db->join('T_SupplierDetailsN` sup','PO.SupplierID = sup.SupplierID');
|
||||||
$this->db->join('T_MaterialMaster` MM','MM.MaterialCode = igrd.MaterialCode','left');
|
|
||||||
$this->db->join('T_SupplierDetailsN` sup','PO.SupplierID = sup.SupplierID','left');
|
|
||||||
|
|
||||||
|
|
||||||
$query = $this->db->get();
|
$query = $this->db->get();
|
||||||
//print_r( $this->db->last_query());
|
|
||||||
$result = $query->result();
|
$result = $query->result();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getpurchaseorder($pono='')
|
function getpurchaseorder()
|
||||||
{
|
{
|
||||||
|
$this->db->distinct();
|
||||||
$this->db->select('POM.PONO,POM.ServiceDescription,POM.DeliveryDate,sup.SupplierName,sup.Address');
|
$this->db->select('POM.PONO,POM.ServiceDescription,POM.DeliveryDate,sup.SupplierName,sup.Address');
|
||||||
$this->db->from('T_PurchaseOrder_Master POM');
|
$this->db->from('T_PurchaseOrder_Master POM');
|
||||||
$this->db->join('T_SupplierDetailsN sup', 'POM.SupplierID = sup.SupplierID','left');
|
$this->db->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO');
|
||||||
$this->db->where('status',"ST026",$pono);
|
$this->db->join('T_SupplierDetailsN sup', 'POM.SupplierID = sup.SupplierID');
|
||||||
|
$this->db->where('POM.Status',PO_RELEASED);
|
||||||
|
$this->db->where('POL.Status !=',IGR_CREATED);
|
||||||
|
$this->db->where('POL.Status !=',MRIR_CREATED);
|
||||||
|
|
||||||
//$this->db->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO','left');
|
|
||||||
//$this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = POL.MaterialCode','left');
|
|
||||||
//$this->db->where('PONO',$pono="PO0002" );
|
|
||||||
$query = $this->db->get();
|
$query = $this->db->get();
|
||||||
|
|
||||||
$result = $query->result();
|
$result = $query->result();
|
||||||
//print_r($result);
|
//print_r($this->db->last_query());
|
||||||
//$this->db->last_query();
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,20 +53,31 @@ class inwardgateregister_model extends CI_Model
|
|||||||
function viewpurchaseorder($PO)
|
function viewpurchaseorder($PO)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->db->select('POM.PONO,POL.MaterialCode,POL.Quantity,POL.PONO,MM.MaterialName,MM.UOM');
|
$subQuery ='SELECT POM.PONO,POL.MaterialCode,(CASE WHEN (POL.Quantity > igr.QuantityAsPerInvoice )
|
||||||
|
THEN ( POL.Quantity - igr.QuantityAsPerInvoice) ELSE POL.Quantity
|
||||||
|
END) as Quantity,POL.PONO,MM.MaterialName,MM.UOM
|
||||||
|
from T_PurchaseOrder_Master POM
|
||||||
|
left join T_PurchaseOrder_LineItem POL on POL.PONO = POM.PONO left join T_IGR_Details igr on igr.MaterialCode = POL.MaterialCode left join T_MaterialMaster MM
|
||||||
|
on MM.MaterialCode = POL.MaterialCode where POM.PONO=? and POL.Status not in(?,?) ';
|
||||||
|
|
||||||
|
$query = $this->db->query($subQuery, array($PO,IGR_CREATED,MRIR_CREATED));
|
||||||
|
|
||||||
|
// print_r($this->db->last_query());
|
||||||
|
return $query->result();
|
||||||
|
|
||||||
|
/* $this->db->select('POM.PONO,POL.MaterialCode,POL.Quantity,POL.PONO,MM.MaterialName,MM.UOM');
|
||||||
$this->db->from('T_PurchaseOrder_Master POM');
|
$this->db->from('T_PurchaseOrder_Master POM');
|
||||||
//$this->db->join('T_SupplierDetailsN sup', 'POM.SupplierID = sup.SupplierID','left');
|
|
||||||
$this->db->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO','left');
|
$this->db->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO','left');
|
||||||
$this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = POL.MaterialCode','left');
|
$this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = POL.MaterialCode','left');
|
||||||
$this->db->where('POM.PONO',$PO );
|
$this->db->where('POM.PONO',$PO );
|
||||||
|
|
||||||
//$this->db->where('PONO', $PO);
|
$this->db->where('POL.Status !=',POLINEITEM_IGR_CREATED );
|
||||||
$query = $this->db->get();
|
$query = $this->db->get();
|
||||||
|
|
||||||
$result = $query->result();
|
$result = $query->result();
|
||||||
|
|
||||||
$this->db->last_query();
|
$this->db->last_query();
|
||||||
return $result;
|
return $result; */
|
||||||
}
|
}
|
||||||
function addigrM($igrM)
|
function addigrM($igrM)
|
||||||
{
|
{
|
||||||
@ -103,7 +104,7 @@ class inwardgateregister_model extends CI_Model
|
|||||||
$this->db->insert('T_IGR_Details', $igrD);
|
$this->db->insert('T_IGR_Details', $igrD);
|
||||||
$insert_id = $this->db->affected_rows();
|
$insert_id = $this->db->affected_rows();
|
||||||
$this->db->trans_complete();
|
$this->db->trans_complete();
|
||||||
// print_r($this->db->last_query());
|
|
||||||
if($insert_id>0)
|
if($insert_id>0)
|
||||||
{
|
{
|
||||||
$subQuery = 'select max(IGRItemNo) as IGRItemNo from T_IGR_Details';
|
$subQuery = 'select max(IGRItemNo) as IGRItemNo from T_IGR_Details';
|
||||||
@ -118,21 +119,26 @@ class inwardgateregister_model extends CI_Model
|
|||||||
|
|
||||||
$this->db->select('igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity');
|
$this->db->select('igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity');
|
||||||
$this->db->from('T_IGR_Master igr');
|
$this->db->from('T_IGR_Master igr');
|
||||||
$this->db->join('T_IGR_Details igrd','igrd.IGRNO = igr.IGRNO','left');
|
$this->db->join('T_IGR_Details igrd','igrd.IGRNO = igr.IGRNO');
|
||||||
$this->db->join('T_PurchaseOrder_Master POM','igr.PONO = POM.PONO','left');
|
$this->db->join('T_PurchaseOrder_Master POM','igr.PONO = POM.PONO');
|
||||||
$this->db->join('T_PurchaseOrder_LineItem POL','POL.PONO = POM.PONO','left');
|
$this->db->join('T_PurchaseOrder_LineItem POL','POL.PONO = POM.PONO and POL.MaterialCode=igrd.MaterialCode');
|
||||||
|
$this->db->join('T_SupplierDetailsN sup', 'sup.SupplierID = POM.SupplierID');
|
||||||
$this->db->join('T_SupplierDetailsN sup', 'sup.SupplierID = POM.SupplierID','left');
|
$this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = igrd.MaterialCode');
|
||||||
|
|
||||||
$this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = igrd.MaterialCode','left');
|
|
||||||
$this->db->order_by('igr.IGRNO');
|
|
||||||
$this->db->where('igr.IGRNO',$IGRNO);
|
$this->db->where('igr.IGRNO',$IGRNO);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$query = $this->db->get();
|
$query = $this->db->get();
|
||||||
//print_r( $this->db->last_query());
|
//print_r( $this->db->last_query());
|
||||||
$result = $query->result();
|
$result = $query->result();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function UpdatePOLineItem($LineItem,$PONO,$MaterialCode)
|
||||||
|
{
|
||||||
|
$this->db->where('PONO', $PONO);
|
||||||
|
$this->db->where('MaterialCode', $MaterialCode);
|
||||||
|
$this->db->update('T_PurchaseOrder_LineItem', $LineItem);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
24
application/models/store_model.php
Normal file
24
application/models/store_model.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class store_model extends CI_Model
|
||||||
|
{
|
||||||
|
|
||||||
|
function viewStock()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->db->select('*');
|
||||||
|
$this->db->from('T_Store_Stockdetails ');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$query = $this->db->get();
|
||||||
|
//print_r( $this->db->last_query());
|
||||||
|
$result = $query->result();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user