This commit is contained in:
venbatechnologies 2018-07-18 10:39:24 +05:30
parent b24a58b44b
commit 5c210411dc
6 changed files with 339 additions and 168 deletions

View File

@ -37,7 +37,7 @@ class inwardgateregister extends BaseController
function viewIGRDetails() function viewIGRDetails()
{ {
$this->load->model('inwardgateregister_model');
$this->global['pageTitle'] = 'Siddharth : Inward Gate Register Details'; $this->global['pageTitle'] = 'Siddharth : Inward Gate Register Details';
$data['IGR']= $this->inwardgateregister_model->igrListing(); $data['IGR']= $this->inwardgateregister_model->igrListing();
@ -280,7 +280,7 @@ class inwardgateregister extends BaseController
function addloadfile() function addloadfile()
{ {
$upfiles = '';
$pono= $this->input->post('PONO'); $pono= $this->input->post('PONO');
$igr= $this->input->post('igr'); $igr= $this->input->post('igr');
@ -573,7 +573,7 @@ $prefile =array();
//echo $IGRNO; //echo $IGRNO;
$IGRItemStatus = REQITEM_NEW; $IGRItemStatus = REQITEM_NEW;
$TotalPendingQty = '';
for ($i = 1; $i <= $RowCount; $i++) for ($i = 1; $i <= $RowCount; $i++)
{ {
@ -590,6 +590,7 @@ $prefile =array();
//echo $QuantityAsPerInvoice; //echo $QuantityAsPerInvoice;
//echo $PendingQty.'ReceivedQty'.$ReceivedQty; //echo $PendingQty.'ReceivedQty'.$ReceivedQty;
//echo ' '; //echo ' ';
$TotalPendingQty = $TotalPendingQty + $PendingQty;
if(strlen($QuantityAsPerInvoice)>0 && $QuantityAsPerInvoice != '0') if(strlen($QuantityAsPerInvoice)>0 && $QuantityAsPerInvoice != '0')
{ {
@ -659,9 +660,8 @@ $prefile =array();
$this->inwardgateregister_model->addmaterialmaster($current_qty,$MaterialCode); $this->inwardgateregister_model->addmaterialmaster($current_qty,$MaterialCode);
$Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO,$MaterialCode); $Recqty = $this->inwardgateregister_model->getPOLineItemReceivedQty($PONO,$MaterialCode);
$ReceivedQuantity = 0.00; $ReceivedQuantity = 0.00;
if(count($Recqty)>0) if(count($Recqty)>0)
{ {
@ -680,7 +680,16 @@ $prefile =array();
} }
$this->inwardgateregister_model->UpdatePOMaster($PONO,$CreatedBy); $this->inwardgateregister_model->UpdatePOMaster($PONO,$CreatedBy);
if($TotalPendingQty == 0.00){
$Newstatus = array('Status'=>IGR_CREATED);
$this->inwardgateregister_model->POLineItemsupdatestatus($PONO,$Newstatus);
$this->inwardgateregister_model->pomasterupdatestatus($PONO,$Newstatus);
}
else{ /*echo 'error' ;*/ }
echo "<script>alert('Successfully Created IGR Number:$IGRNO'); window.location.href='viewIGRDetails';</script>"; echo "<script>alert('Successfully Created IGR Number:$IGRNO'); window.location.href='viewIGRDetails';</script>";
//echo 'Successfully Created IGR Number:'. $IGRNO; //echo 'Successfully Created IGR Number:'. $IGRNO;
} }

View File

@ -532,7 +532,11 @@ class report extends BaseController
$PONO= substr($PO,5); $PONO= substr($PO,5);
//echo $PONO; die; //echo $PONO; die;
$data = $this->dahsboard_Model->getfiles($PONO); $igrfile= $this->dahsboard_Model->getfiles($PONO);
// $igrfile = $this->inwardgateregister_model->viewIGRFile($IGRNO);
$billfile = $this->dahsboard_Model->viewIGRFile1($PONO);
$data = array_merge($igrfile,$billfile);
// print_r( $data);die; // print_r( $data);die;

View File

@ -49,6 +49,24 @@ function getfiles($PONO)
} }
function viewIGRFile1($PONO)
{
$this->db->distinct();
$this->db->select('igrm.file,igrm.PONO as pono'); //BillNo,IGRNO,FilePath,PONO
$this->db->from('T_IGR_Master igrm');
$this->db->where('igrm.PONO',$PONO);
$query = $this->db->get();
$result = $query->result();
// print_r($result);die;
//print_r($this->db->last_query());
return $result;
}
function selectigrfiles() function selectigrfiles()
{ {
$this->db->select('*'); $this->db->select('*');

View File

@ -128,6 +128,27 @@ return $afftectedRows;
}
function viewIGRFile1($IGRNO)
{
$this->db->distinct();
$this->db->select('igrm.file,igrm.PONO as pono'); //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();
$result = $query->result();
// print_r($result);die;
//print_r($this->db->last_query());
return $result;
} }
function getpurchaseorder() function getpurchaseorder()
@ -804,5 +825,32 @@ function getPOmaterial($PONO)
$r = $this->db->affected_rows(); $r = $this->db->affected_rows();
return $r; return $r;
} }
function getpolineqty($NewPO)
{
$this->db->select('sum(Quantity)as Qty,sum(ReceivedQuantity)as rec');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->where('PONO',$NewPO);
$query = $this->db->get();
return $query->result();
}
function POLineItemsupdatestatus($PONO,$Newstatus)
{
$this->db->where('PONO',$PONO);
$this->db->update('T_PurchaseOrder_LineItem',$Newstatus);
$update = $this->db->affected_rows();
return $update;
}
function pomasterupdatestatus($PONO,$Newstatus)
{
$this->db->where('PONO',$PONO);
$this->db->update('T_PurchaseOrder_Master',$Newstatus);
$update = $this->db->affected_rows();
return $update;
}
} }

View File

@ -266,6 +266,9 @@
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 } elseif(!empty($rel['ifile'])){?>
<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 } elseif(!empty(sizeof($rel['Infiles'])) !=0){?> <?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> <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>
@ -339,26 +342,70 @@ $("#Fileshow").modal("show");
success: function(data){ success: function(data){
//console.log((data)); //console.log((data));
// var trHTML = '';
// $.each($.parseJSON(data), function (i, item) {
var trHTML = ''; var trHTML = '';
var trHTML = '';
var FilePath ='';
var Filename = '';
var PONO ='';
var BillNO ='';
$.each($.parseJSON(data), function (i, item) { $.each($.parseJSON(data), function (i, item) {
if(item.file == null)
{ if(item.Remarks ==null)
{
//alert()
PONO =item.PONO;
BillNO =item.BillNo;
Filename =item.FilePath;
FilePath = "<?php echo base_url()?>uploads/Igrfiles/"+item.FilePath;
}else{
Filename ="BillDetails";
PONO =item.PONO;
FilePath = item.FilePath;
}
}else{
Filename = item.file;
PONO =item.pono;
BillNO = '-';
FilePath =item.file;
}
// i=i+1;
// trHTML += '<tr>' +
// '<td align="right">' + i + '</td>' +
// '<td>' + item.BillNo+ '</td>' +
// '<td>' + item.PONO+ '</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>'
// '</tr>';
if(Filename != null)
{
i=i+1; i=i+1;
trHTML += '<tr>' + trHTML += '<tr id='+i+'>' +
'<td align="right">' + i + '</td>' + '<td align="right">' + i + '</td>' +
'<td id="billno'+i+'">' + BillNO+ '</td>' +
'<td>' + PONO+ '</td>' +
'<td>' + item.BillNo+ '</td>' + '<td id="file'+i+'"><a target="_blank" href = '+FilePath+'>'+ Filename +'</a></td>' +
'<td>' + item.PONO+ '</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 name="filepathname" id="filepathname" onclick="openbillmodel('+i+');"><i class="fa fa-pencil"></i></td>' +
'</tr>'; '</tr>';
}
}); });

View File

@ -365,8 +365,8 @@ table.dataTable thead > tr > td.sorting {
<a target="_blank" class="yourlink" 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" class="yourlink" 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 } <?php }
else if(!empty($rel->ifile )) { ?><!-- else if for igr file --> else if(!empty($rel->ifile )) { ?><!-- else if for igr file -->
<a target="_blank" href="<?php echo base_url().''.$rel->ifile ?>" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"> <a target="_blank" class="yourlink" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View">
<button class="btn btn-info btn-sm">Download</button> <button class="btn btn-info btn-sm IGRfile" id="files<?php echo $rel->pono;?>">Download</button>
</a> </a>
<?php } else if (!empty($rel->Infiles)){ ?><!-- if for Inward po file --> <?php } else if (!empty($rel->Infiles)){ ?><!-- if for Inward po file -->
<a target="_blank" class="yourlink" 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" class="yourlink" 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>
@ -566,6 +566,7 @@ $('.splpofile').click(function() {
$('.IGRfile').click(function() { $('.IGRfile').click(function() {
var id = $(this).attr('id'); var id = $(this).attr('id');
$("#Fileshow").modal("show"); $("#Fileshow").modal("show");
$.ajax({ $.ajax({
data:{id:id}, data:{id:id},
@ -575,16 +576,60 @@ $('.IGRfile').click(function() {
var trHTML = ''; var trHTML = '';
var trHTML = '';
var FilePath ='';
var Filename = '';
var PONO ='';
var BillNO ='';
$.each($.parseJSON(data), function (i, item) { $.each($.parseJSON(data), function (i, item) {
if(item.file == null)
{ if(item.Remarks ==null)
{
//alert()
PONO =item.PONO;
BillNO =item.BillNo;
Filename =item.FilePath;
FilePath = "<?php echo base_url()?>uploads/Igrfiles/"+item.FilePath;
}else{
Filename ="BillDetails";
PONO =item.PONO;
FilePath = item.FilePath;
}
}else{
Filename = item.file;
PONO =item.pono;
BillNO = '-';
FilePath =item.file;
}
// i=i+1;
// trHTML += '<tr>' +
// '<td align="right">' + i + '</td>' +
// '<td>' + item.BillNo+ '</td>' +
// '<td>' + item.PONO+ '</td>' +
// '<td><a target="_blank" href = <?php echo base_url()?>uploads/Igrfiles/'+item.FilePath+'>'+ item.FilePath +'</a></td>' +
// '</tr>';
if(Filename != null)
{
i=i+1; i=i+1;
trHTML += '<tr>' + trHTML += '<tr id='+i+'>' +
'<td align="right">' + i + '</td>' + '<td align="right">' + i + '</td>' +
'<td>' + item.BillNo+ '</td>' + '<td id="billno'+i+'">' + BillNO+ '</td>' +
'<td>' + item.PONO+ '</td>' + '<td>' + PONO+ '</td>' +
'<td><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>' +
'</tr>'; '</tr>';
}
}); });
$("#tbleAppend1").empty(); $("#tbleAppend1").empty();