This commit is contained in:
venbatechnologies 2018-07-19 12:48:01 +05:30
parent 526a6acbb2
commit 8f0b886332
6 changed files with 334 additions and 303 deletions

View File

@ -14,50 +14,50 @@ class inwardgateregister extends BaseController
/** /**
* This is default constructor of the class * This is default constructor of the class
*/ */
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
$this->load->model('inwardgateregister_model'); $this->load->model('inwardgateregister_model');
$this->load->library('session'); $this->load->library('session');
$this->load->library('form_validation'); $this->load->library('form_validation');
$this->isLoggedIn(); $this->isLoggedIn();
} }
/** /**
* This function used to load the first screen of the user * This function used to load the first screen of the user
*/ */
public function index() public function index()
{ {
$this->global['pageTitle'] = 'Siddharth : Inward Gate Register'; $this->global['pageTitle'] = 'Siddharth : Inward Gate Register';
$this->loadViews("viewinwardgateregister", $this->global,NULL , NULL); $this->loadViews("viewinwardgateregister", $this->global,NULL , NULL);
} }
function viewIGRDetails() function viewIGRDetails()
{ {
$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();
$this->loadViews("viewIGRDetails",$this->global,$data,NULL); $this->loadViews("viewIGRDetails",$this->global,$data,NULL);
} }
function addinwardgateregister() function addinwardgateregister()
{ {
$this->load->model('inwardgateregister_model'); $this->load->model('inwardgateregister_model');
$this->global['pageTitle'] = 'Siddharth : Add Inward Gate Register'; $this->global['pageTitle'] = 'Siddharth : Add Inward Gate Register';
$data['PO_NO'] = $this->inwardgateregister_model->getpurchaseorder(); $data['PO_NO'] = $this->inwardgateregister_model->getpurchaseorder();
//print_r($data['PO_NO']); //print_r($data['PO_NO']);
$this->loadViews("inwardgateregister", $this->global, $data, NULL); $this->loadViews("inwardgateregister", $this->global, $data, NULL);
} }
@ -65,16 +65,16 @@ class inwardgateregister extends BaseController
function addoutwardgateregister() function addoutwardgateregister()
{ {
$this->load->model('inwardgateregister_model'); $this->load->model('inwardgateregister_model');
$this->global['pageTitle'] = 'Siddharth : Add Outward Gate Register'; $this->global['pageTitle'] = 'Siddharth : Add Outward Gate Register';
$data['Customer'] = $this->inwardgateregister_model->getCustomer(); $data['Customer'] = $this->inwardgateregister_model->getCustomer();
$data['Supplier'] = $this->inwardgateregister_model->getSupplier(); $data['Supplier'] = $this->inwardgateregister_model->getSupplier();
//$data['Invoice'] = $this->inwardgateregister_model->getInvoice(); //$data['Invoice'] = $this->inwardgateregister_model->getInvoice();
$data['storedmaterialcode'] = $this->inwardgateregister_model->getstoredmaterialcode(); $data['storedmaterialcode'] = $this->inwardgateregister_model->getstoredmaterialcode();
//print_r($data['PO_NO']); //print_r($data['PO_NO']);
$this->loadViews("ogr", $this->global, $data, NULL); $this->loadViews("ogr", $this->global, $data, NULL);
} }
@ -82,13 +82,13 @@ class inwardgateregister extends BaseController
function ViewOgr() function ViewOgr()
{ {
$this->load->model('inwardgateregister_model'); $this->load->model('inwardgateregister_model');
$this->global['pageTitle'] = 'Siddharth : View Outward Gate Register'; $this->global['pageTitle'] = 'Siddharth : View Outward Gate Register';
$data['OGR_Data'] = $this->inwardgateregister_model->getOGRData(); $data['OGR_Data'] = $this->inwardgateregister_model->getOGRData();
//print_r($data['OGR_Data']); //print_r($data['OGR_Data']);
$this->loadViews("ogrlist", $this->global, $data, NULL); $this->loadViews("ogrlist", $this->global, $data, NULL);
} }
@ -96,121 +96,121 @@ class inwardgateregister extends BaseController
function EditOGR() function EditOGR()
{ {
$OGRNO = $_GET['OGRNO']; $OGRNO = $_GET['OGRNO'];
$MRIRNO = $_GET['MRIRNO']; $MRIRNO = $_GET['MRIRNO'];
$this->global['pageTitle'] = 'Siddharth : View Outward Gate Register'; $this->global['pageTitle'] = 'Siddharth : View Outward Gate Register';
$data['OGR_Data'] = $this->inwardgateregister_model->getOGRDataforedit($OGRNO); $data['OGR_Data'] = $this->inwardgateregister_model->getOGRDataforedit($OGRNO);
$data['OGR_line'] = $this->inwardgateregister_model->getOGRlineDataforedit($OGRNO,$MRIRNO); $data['OGR_line'] = $this->inwardgateregister_model->getOGRlineDataforedit($OGRNO,$MRIRNO);
$this->loadViews("editogr", $this->global, $data, NULL); $this->loadViews("editogr", $this->global, $data, NULL);
} }
function GetInvoices() function GetInvoices()
{ {
$CustomerId = $this->input->post('customerId'); $CustomerId = $this->input->post('customerId');
$data = $this->inwardgateregister_model->getInvoice($CustomerId); $data = $this->inwardgateregister_model->getInvoice($CustomerId);
echo json_encode($data); echo json_encode($data);
} }
function GetPO() function GetPO()
{ {
$supplierId = $this->input->post('supplierId'); $supplierId = $this->input->post('supplierId');
$data = $this->inwardgateregister_model->getPO($supplierId); $data = $this->inwardgateregister_model->getPO($supplierId);
echo json_encode($data); echo json_encode($data);
} }
function getPODetails() function getPODetails()
{ {
$PONO = $this->input->post('PONO'); $PONO = $this->input->post('PONO');
$data = $this->inwardgateregister_model->getPODetails($PONO); $data = $this->inwardgateregister_model->getPODetails($PONO);
//$data['poout'] = $this->inwardgateregister_model->getPODetails($PONO); //$data['poout'] = $this->inwardgateregister_model->getPODetails($PONO);
echo json_encode($data); echo json_encode($data);
} }
function getMRIRDetails() function getMRIRDetails()
{ {
$MRIRno = $this->input->post('mrirno'); $MRIRno = $this->input->post('mrirno');
$PONO = $this->input->post('PONO'); $PONO = $this->input->post('PONO');
$materialcode = $this->input->post('materialcode'); $materialcode = $this->input->post('materialcode');
$data = $this->inwardgateregister_model->getPOMRIRDetails($MRIRno,$PONO,$materialcode); $data = $this->inwardgateregister_model->getPOMRIRDetails($MRIRno,$PONO,$materialcode);
//$data['outqty'] = $this->inwardgateregister_model->gettotalout($PONO,$materialcode); //$data['outqty'] = $this->inwardgateregister_model->gettotalout($PONO,$materialcode);
//$data['poout'] = $this->inwardgateregister_model->getPODetails($PONO); //$data['poout'] = $this->inwardgateregister_model->getPODetails($PONO);
echo json_encode($data); echo json_encode($data);
} }
function getMRIR() function getMRIR()
{ {
$MRIRno = $this->input->post('MRIRNO'); $MRIRno = $this->input->post('MRIRNO');
$PONO = $this->input->post('PONO'); $PONO = $this->input->post('PONO');
$data = $this->inwardgateregister_model->getPOMRIRMaterial($MRIRno,$PONO); $data = $this->inwardgateregister_model->getPOMRIRMaterial($MRIRno,$PONO);
//$data['poout'] = $this->inwardgateregister_model->getPODetails($PONO); //$data['poout'] = $this->inwardgateregister_model->getPODetails($PONO);
echo json_encode($data); echo json_encode($data);
} }
function getPOmrir() function getPOmrir()
{ {
$PONO = $this->input->post('PONO'); $PONO = $this->input->post('PONO');
$data = $this->inwardgateregister_model->getPOmrir($PONO); $data = $this->inwardgateregister_model->getPOmrir($PONO);
//$data['poout'] = $this->inwardgateregister_model->getPODetails($PONO); //$data['poout'] = $this->inwardgateregister_model->getPODetails($PONO);
echo json_encode($data); echo json_encode($data);
} }
function getPOmaterialDetails() function getPOmaterialDetails()
{ {
$PONO= $this->input->post('PONO'); $PONO= $this->input->post('PONO');
$materialcode= $this->input->post('materialcode'); $materialcode= $this->input->post('materialcode');
$data= $this->inwardgateregister_model->getPOmaterialDetails($PONO,$materialcode); $data= $this->inwardgateregister_model->getPOmaterialDetails($PONO,$materialcode);
echo json_encode($data); echo json_encode($data);
} }
function getPOmaterial() function getPOmaterial()
{ {
$PONO = $this->input->post('PONO'); $PONO = $this->input->post('PONO');
$data = $this->inwardgateregister_model->getPOmaterial($PONO); $data = $this->inwardgateregister_model->getPOmaterial($PONO);
//$data['poout'] = $this->inwardgateregister_model->getPODetails($PONO); //$data['poout'] = $this->inwardgateregister_model->getPODetails($PONO);
echo json_encode($data); echo json_encode($data);
} }
function getDateformat($Val) function getDateformat($Val)
{ {
$date = new DateTime($Val,new DateTimeZone('Asia/Kolkata')); $date = new DateTime($Val,new DateTimeZone('Asia/Kolkata'));
// print_r($date); // print_r($date);
$retDate = $date->format('Y-m-d H:i:s'); $retDate = $date->format('Y-m-d H:i:s');
return $retDate; return $retDate;
} }
function IGRITEM() function IGRITEM()
{ {
$PO = $this->input->post('id'); $PO = $this->input->post('id');
$CreatedBy = $this->session->userdata('userId'); $CreatedBy = $this->session->userdata('userId');
$this->inwardgateregister_model->UpdatePOMaster($PO,$CreatedBy); $this->inwardgateregister_model->UpdatePOMaster($PO,$CreatedBy);
$data = $this->inwardgateregister_model->viewpurchaseorder($PO); $data = $this->inwardgateregister_model->viewpurchaseorder($PO);
echo json_encode($data); echo json_encode($data);
} }
// function edituploadfile // function edituploadfile
// { // {
// //echo "INSIDE UPLOAFD"; // //echo "INSIDE UPLOAFD";
// //$this->load->library('upload') // //$this->load->library('upload')
// $pathinfo = pathinfo($_FILES['myfile']['name']); // $pathinfo = pathinfo($_FILES['myfile']['name']);
// $config['upload_path'] = 'uploads/Igrfiles/'; // $config['upload_path'] = 'uploads/Igrfiles/';
// $config['allowed_types'] = 'png|jpg|jpeg|pdf|docx'; // $config['allowed_types'] = 'png|jpg|jpeg|pdf|docx';
// $config['file_name'] = $_FILES['myfile']['name']; // $config['file_name'] = $_FILES['myfile']['name'];
@ -232,19 +232,19 @@ class inwardgateregister extends BaseController
// { // {
// $error = array('error' => $this->upload->display_errors()); // $error = array('error' => $this->upload->display_errors());
// $uploadfilename = ''; // $uploadfilename = '';
// print_r($error); // print_r($error);
// return 0; // return 0;
// } // }
// }
/*------------inwardateregister multiple file upload service------jun 11----------------------------*/
function adfile() // }
/*------------inwardateregister multiple file upload service------jun 11----------------------------*/
function adfile()
{ {
$picture = ''; $picture = '';
if(!empty($_FILES['file']['name'])) if(!empty($_FILES['file']['name']))
@ -260,7 +260,7 @@ class inwardgateregister extends BaseController
if($this->upload->do_upload('file')) if($this->upload->do_upload('file'))
{ {
echo "uploadif"; //echo "if conditioncheck file do_upload";
$uploadData = $this->upload->data(); $uploadData = $this->upload->data();
$picture = $uploadData['file_name']; $picture = $uploadData['file_name'];
} }
@ -285,6 +285,8 @@ class inwardgateregister extends BaseController
function addloadfile() function addloadfile()
{ {
//echo 'Add new file ';
$upfiles = ''; $upfiles = '';
$pono= $this->input->post('PONO'); $pono= $this->input->post('PONO');
@ -312,7 +314,7 @@ $fcount = 0;
{ {
//echo 'eqal'; //echo 'eqal';
//echo 'cm'.$fcount; // echo 'cm'.$fcount;
$fcount ++; $fcount ++;
//echo 'cp'.$fcount; //echo 'cp'.$fcount;
@ -323,7 +325,7 @@ $fcount = 0;
if($fcount == 0) if($fcount == 0)
{ {
//echo 'if'.$fcount; //echo 'if'.$fcount.'</br>';
if(!empty($new_file_name)) if(!empty($new_file_name))
{ {
@ -336,6 +338,7 @@ $fcount = 0;
//print_r($upfiles); //print_r($upfiles);
} }
} }
//echo 'filename'.$upfiles;
if( $upfiles > 0){ if( $upfiles > 0){
echo "file updated successfully!"; echo "file updated successfully!";
@ -709,56 +712,58 @@ $prefile =array();
//echo 'Successfully Created IGR Number:'. $IGRNO; //echo 'Successfully Created IGR Number:'. $IGRNO;
} }
function ViewIGR() function ViewIGR()
{ {
$IGRNO= $this->input->post('id'); $IGRNO= $this->input->post('id');
//print_r($IGRNO); //print_r($IGRNO);
$data = $this->inwardgateregister_model->viewigr($IGRNO); $data = $this->inwardgateregister_model->viewigr($IGRNO);
// print_r( $data); // print_r( $data);
echo json_encode($data); echo json_encode($data);
} }
function ViewIGRfile() function ViewIGRfile()
{ {
$IGRNO= $this->input->post('id'); $IGRNO= $this->input->post('id');
$data = $this->inwardgateregister_model->viewIGRFile($IGRNO); $igrfile = $this->inwardgateregister_model->viewIGRFile($IGRNO);
$billfile = $this->inwardgateregister_model->ViewIGRfile1($IGRNO);
$data = array_merge($igrfile,$billfile);
echo json_encode($data); echo json_encode($data);
} }
function UpdateIGR() function UpdateIGR()
{ {
$IGRNo = $this->input->post('igr'); $IGRNo = $this->input->post('igr');
$DeliveryChellan = $this->input->post('invdate'); $DeliveryChellan = $this->input->post('invdate');
$DeliveryChellanDate = $this->getDateformat($DeliveryChellan); $DeliveryChellanDate = $this->getDateformat($DeliveryChellan);
$Mat_Rcvd_Dt = $this->input->post('mrc'); $Mat_Rcvd_Dt = $this->input->post('mrc');
$MaterialRcvdDt = $this->getDateformat($Mat_Rcvd_Dt); $MaterialRcvdDt = $this->getDateformat($Mat_Rcvd_Dt);
$updateby = $this->session->userdata('userId'); $updateby = $this->session->userdata('userId');
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$updatedon = $dt->format('Y-m-d H:i:s'); $updatedon = $dt->format('Y-m-d H:i:s');
$igrarr = array('DeliveryChellanDate'=>$DeliveryChellanDate,'MaterialRcvdDate'=>$MaterialRcvdDt,'UpdateBY'=>$updateby,'UpdatedOn'=>$updatedon); $igrarr = array('DeliveryChellanDate'=>$DeliveryChellanDate,'MaterialRcvdDate'=>$MaterialRcvdDt,'UpdateBY'=>$updateby,'UpdatedOn'=>$updatedon);
$data = $this->inwardgateregister_model->updateigr($igrarr,$IGRNo); $data = $this->inwardgateregister_model->updateigr($igrarr,$IGRNo);
if($data > 0){ if($data > 0){
echo "Updated Succefully!"; echo "Updated Succefully!";
} }
else{ else{
echo "Not Updated!"; echo "Not Updated!";
} }
} }
function pageNotFound() function pageNotFound()
{ {
$this->global['pageTitle'] = 'Siddharth : 404 - Page Not Found'; $this->global['pageTitle'] = 'Siddharth : 404 - Page Not Found';
@ -771,161 +776,161 @@ $prefile =array();
function AddOgr() function AddOgr()
{ {
//echo "string"; //echo "string";
$type=$this->input->post('type'); $type=$this->input->post('type');
$Supplier = $this->input->post('sup'); $Supplier = $this->input->post('sup');
$Date = $this->input->post('Date'); $Date = $this->input->post('Date');
$vehicle =$this->input->post('Vehicle'); $vehicle =$this->input->post('Vehicle');
$driver = $this->input->post('drive'); $driver = $this->input->post('drive');
if($type == 1) if($type == 1)
{ {
$invoice =$this->input->post('invno'); $invoice =$this->input->post('invno');
$Otype='Invoice'; $Otype='Invoice';
$Status ='ST063'; $Status ='ST063';
$ogrmaster = array('OgrType'=>$Otype,'CreatedDate'=>$Date,'Driver'=>$driver $ogrmaster = array('OgrType'=>$Otype,'CreatedDate'=>$Date,'Driver'=>$driver
,'PONO_INV'=>$invoice,'VehicleNo'=>$vehicle,'Status'=>$Status); ,'PONO_INV'=>$invoice,'VehicleNo'=>$vehicle,'Status'=>$Status);
$addogrmaster= $this->inwardgateregister_model->AddOGR($ogrmaster); $addogrmaster= $this->inwardgateregister_model->AddOGR($ogrmaster);
$OGRNO = ''; $OGRNO = '';
if(count($addogrmaster)>0) if(count($addogrmaster)>0)
{ {
foreach($addogrmaster as $add) foreach($addogrmaster as $add)
{ {
$OGRNO = $add->OGRNO; $OGRNO = $add->OGRNO;
} }
} }
$itemcode =$this->input->post('itemcode'); $itemcode =$this->input->post('itemcode');
$Description = $this->input->post('Description'); $Description = $this->input->post('Description');
$invoutwardqty = $this->input->post('invoutwardqty'); $invoutwardqty = $this->input->post('invoutwardqty');
$Ogrline= array('OGRNO'=>$OGRNO,'MaterialCode'=>$itemcode,'OutwardQty'=>$invoutwardqty,'Status'=>$Status); $Ogrline= array('OGRNO'=>$OGRNO,'MaterialCode'=>$itemcode,'OutwardQty'=>$invoutwardqty,'Status'=>$Status);
$addOgrline = $this->inwardgateregister_model->AddOgrLine($Ogrline); $addOgrline = $this->inwardgateregister_model->AddOgrLine($Ogrline);
if((count($addogrmaster)>0)&&(count($addOgrline>0))) if((count($addogrmaster)>0)&&(count($addOgrline>0)))
{ {
echo "Saved Successfully OGR No is OGR".$OGRNO; echo "Saved Successfully OGR No is OGR".$OGRNO;
} }
} }
else if($type == 2) else if($type == 2)
{ {
$pono =$this->input->post('pono'); $pono =$this->input->post('pono');
$MRIRNO = $this->input->post('mrirno'); $MRIRNO = $this->input->post('mrirno');
$Otype='PO'; $Otype='PO';
$row= $this->input->post('rowcount'); $row= $this->input->post('rowcount');
$ogrmaster = array('OgrType'=>$Otype,'CreatedDate'=>$Date,'Driver'=>$driver $ogrmaster = array('OgrType'=>$Otype,'CreatedDate'=>$Date,'Driver'=>$driver
,'PONO_INV'=>$pono,'VehicleNo'=>$vehicle,'MRIRNO'=>$MRIRNO); ,'PONO_INV'=>$pono,'VehicleNo'=>$vehicle,'MRIRNO'=>$MRIRNO);
$addogrmaster= $this->inwardgateregister_model->AddOGR($ogrmaster); $addogrmaster= $this->inwardgateregister_model->AddOGR($ogrmaster);
$OGRNO = ''; $OGRNO = '';
if(count($addogrmaster)>0) if(count($addogrmaster)>0)
{ {
foreach($addogrmaster as $add) foreach($addogrmaster as $add)
{ {
$OGRNO = $add->OGRNO; $OGRNO = $add->OGRNO;
} }
} }
for($i=1;$i<=$row;$i++) for($i=1;$i<=$row;$i++)
{ {
$MaterialCode = $this->input->post('materialcode'.$i); $MaterialCode = $this->input->post('materialcode'.$i);
$OutwardQty = $this->input->post('outward'.$i); $OutwardQty = $this->input->post('outward'.$i);
$rejqty = $this->input->post('RejectedQty'.$i); $rejqty = $this->input->post('RejectedQty'.$i);
$pendingoutward = $this->input->post('pendingoutward'.$i); $pendingoutward = $this->input->post('pendingoutward'.$i);
$balance_Qty= $rejqty-$OutwardQty; $balance_Qty= $rejqty-$OutwardQty;
//$balance_Qty = $this->input->post('pendingoutward'.$i); //$balance_Qty = $this->input->post('pendingoutward'.$i);
$Outwardtotal = $OutwardQty; $Outwardtotal = $OutwardQty;
$allowed= $this->input->post('allowed'.$i); $allowed= $this->input->post('allowed'.$i);
if($MaterialCode != '' && $OutwardQty !='') if($MaterialCode != '' && $OutwardQty !='')
{ {
$polqty= $this->inwardgateregister_model->getPOLineItemReceivedQty($pono,$MaterialCode); $polqty= $this->inwardgateregister_model->getPOLineItemReceivedQty($pono,$MaterialCode);
$ReceivedQuantity = 0.00; $ReceivedQuantity = 0.00;
if(count($polqty)>0) if(count($polqty)>0)
{ {
foreach ($polqty as $key ) foreach ($polqty as $key )
{ {
$ReceivedQuantity=$key->ReceivedQuantity; $ReceivedQuantity=$key->ReceivedQuantity;
} }
} }
$totalReceivedqty = $ReceivedQuantity - $Outwardtotal; $totalReceivedqty = $ReceivedQuantity - $Outwardtotal;
$POMStatus=OGR_CREATED; $POMStatus=OGR_CREATED;
$POLineItem = array('ReceivedQuantity'=>$totalReceivedqty,'OGR_Status'=>$POMStatus); $POLineItem = array('ReceivedQuantity'=>$totalReceivedqty,'OGR_Status'=>$POMStatus);
$this->inwardgateregister_model->UpdatePOLineItem($POLineItem,$pono,$MaterialCode); $this->inwardgateregister_model->UpdatePOLineItem($POLineItem,$pono,$MaterialCode);
if($pendingoutward == 0) if($pendingoutward == 0)
{ {
$Status = OGR_COMPLETE; $Status = OGR_COMPLETE;
} }
else else
{ {
$Status = OGR_PARTIAL_COMPLETE; $Status = OGR_PARTIAL_COMPLETE;
} }
$Ogrline= array('OGRNO'=>$OGRNO,'MaterialCode'=>$MaterialCode,'OutwardQty'=>$Outwardtotal,'Status'=>$Status,'balance_Qty'=>$balance_Qty); $Ogrline= array('OGRNO'=>$OGRNO,'MaterialCode'=>$MaterialCode,'OutwardQty'=>$Outwardtotal,'Status'=>$Status,'balance_Qty'=>$balance_Qty);
$addOgrline = $this->inwardgateregister_model->AddOgrLine($Ogrline); $addOgrline = $this->inwardgateregister_model->AddOgrLine($Ogrline);
//print_r($addOgrline); //print_r($addOgrline);
$ogrlineno=''; $ogrlineno='';
$itemvalue=''; $itemvalue='';
$SupplierId=''; $SupplierId='';
$CreatedBy = $this->session->userdata('userId'); $CreatedBy = $this->session->userdata('userId');
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$createddt = $dt->format('Y-m-d H:i:s'); $createddt = $dt->format('Y-m-d H:i:s');
if(count($addogrmaster)>0) if(count($addogrmaster)>0)
{ {
$ogrlinearray= $this->inwardgateregister_model->getlastogrline(); $ogrlinearray= $this->inwardgateregister_model->getlastogrline();
foreach($ogrlinearray as $og) foreach($ogrlinearray as $og)
{ {
$ogrlineno = $og->OGRItemNO; $ogrlineno = $og->OGRItemNO;
} }
$polineitemvalue = $this->inwardgateregister_model->getitemvalue($pono,$MaterialCode); $polineitemvalue = $this->inwardgateregister_model->getitemvalue($pono,$MaterialCode);
foreach($polineitemvalue as $it) foreach($polineitemvalue as $it)
{ {
$itemvalue =$it->Rate; $itemvalue =$it->Rate;
$SupplierId =$it->SupplierID; $SupplierId =$it->SupplierID;
} }
} }
$historydetails = array('MaterialCode'=>$MaterialCode,'Transaction_type'=>"Reduce",'Ref_Type'=>"OGR",'Ref_No'=>$ogrlineno,'Quantity'=>$Outwardtotal,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt,'ItemValue'=>$itemvalue,'SupplierID'=>$SupplierId); $historydetails = array('MaterialCode'=>$MaterialCode,'Transaction_type'=>"Reduce",'Ref_Type'=>"OGR",'Ref_No'=>$ogrlineno,'Quantity'=>$Outwardtotal,'CreatedBy'=>$CreatedBy,'CreatedOn'=>$createddt,'ItemValue'=>$itemvalue,'SupplierID'=>$SupplierId);
$this->inwardgateregister_model->addmaterialhistory($historydetails); $this->inwardgateregister_model->addmaterialhistory($historydetails);
@ -951,7 +956,7 @@ $prefile =array();
$this->inwardgateregister_model->UpdateOGRMasterOGRStatus($OGRNO); $this->inwardgateregister_model->UpdateOGRMasterOGRStatus($OGRNO);
$this->inwardgateregister_model->UpdateMRIRMasterOGRStatus($MRIRNO,$OGRNO); $this->inwardgateregister_model->UpdateMRIRMasterOGRStatus($MRIRNO,$OGRNO);
@ -960,10 +965,10 @@ $prefile =array();
$premrirout=0; $premrirout=0;
if(!empty($mrirout)) if(!empty($mrirout))
{ {
foreach($mrirout as $mr) foreach($mrirout as $mr)
{ {
$premrirout= $mr->Ogr_Out_Qty; $premrirout= $mr->Ogr_Out_Qty;
} }
} }
$totmrirout= $premrirout+$Outwardtotal; $totmrirout= $premrirout+$Outwardtotal;
@ -980,24 +985,24 @@ $prefile =array();
} }
} }
if((count($addogrmaster)>0)&&(count($addOgrline)>0)) if((count($addogrmaster)>0)&&(count($addOgrline)>0))
{ {
echo "Saved Successfully OGR No is OGR".$OGRNO; echo "Saved Successfully OGR No is OGR".$OGRNO;
} }
} }
else if($type ==3) else if($type ==3)
{ {
$Otype='SERVICE'; $Otype='SERVICE';
$Status ='ST063'; $Status ='ST063';
$ogrmaster = array('OgrType'=>$Otype,'CreatedDate'=>$Date,'Driver'=>$driver,'VehicleNo'=>$vehicle,'Status'=>$Status); $ogrmaster = array('OgrType'=>$Otype,'CreatedDate'=>$Date,'Driver'=>$driver,'VehicleNo'=>$vehicle,'Status'=>$Status);
$addogrmaster= $this->inwardgateregister_model->AddOGR($ogrmaster); $addogrmaster= $this->inwardgateregister_model->AddOGR($ogrmaster);
@ -1008,36 +1013,36 @@ $prefile =array();
//echo count($addogrmaster); //echo count($addogrmaster);
if(count($addogrmaster)>0) if(count($addogrmaster)>0)
{ {
foreach($addogrmaster as $add) foreach($addogrmaster as $add)
{ {
$OGRNO = $add->OGRNO; $OGRNO = $add->OGRNO;
} }
} }
$material= $this->input->post('material'); $material= $this->input->post('material');
$name= $this->input->post('name'); $name= $this->input->post('name');
$pooutward= $this->input->post('pooutward'); $pooutward= $this->input->post('pooutward');
$destination= $this->input->post('destination'); $destination= $this->input->post('destination');
$Remarks= $this->input->post('Remark'); $Remarks= $this->input->post('Remark');
$Ogrline= array('OGRNO'=>$OGRNO,'MaterialCode'=>$material,'OutwardQty'=>$pooutward,'Destination'=>$destination,'Status'=>$Status,'SupplierID'=>$name,'Remark'=>$Remarks); $Ogrline= array('OGRNO'=>$OGRNO,'MaterialCode'=>$material,'OutwardQty'=>$pooutward,'Destination'=>$destination,'Status'=>$Status,'SupplierID'=>$name,'Remark'=>$Remarks);
//print_r($Ogrline); //print_r($Ogrline);
//die(); //die();
$addOgrline = $this->inwardgateregister_model->AddOgrLine($Ogrline); $addOgrline = $this->inwardgateregister_model->AddOgrLine($Ogrline);
if((count($addogrmaster)>0)&&(count($addOgrline>0))) if((count($addogrmaster)>0)&&(count($addOgrline>0)))
{ {
echo "Saved Successfully OGR No is OGR".$OGRNO; echo "Saved Successfully OGR No is OGR".$OGRNO;
} }
} }
} }

View File

@ -527,22 +527,25 @@ class report extends BaseController
function Viewnormaligrfiles() function Viewnormaligrfiles()
{ {
$PO= $this->input->post('id'); $igr= $this->input->post('id');
$PONO= $this->input->post('id1');
$PONO= substr($PO,5);
// $PONO= substr($PO,5);
//echo $PONO; die; //echo $PONO; die;
$igrfile= $this->dahsboard_Model->getfiles($PONO); $igrfile= $this->dahsboard_Model->getfiles($igr,$PONO);
// $igrfile = $this->inwardgateregister_model->viewIGRFile($IGRNO); // $igrfile = $this->inwardgateregister_model->viewIGRFile($IGRNO);
$billfile = $this->dahsboard_Model->viewIGRFile1($PONO); $billfile = $this->dahsboard_Model->viewIGRFile1($igr,$PONO);
$data = array_merge($igrfile,$billfile); $data = array_merge($igrfile,$billfile);
// print_r( $data);die; // print_r( $data);die;
echo json_encode($data); echo json_encode($data);
} }
public function ipurchase() public function ipurchase()
{ {

View File

@ -34,11 +34,12 @@ function getfile($PONO)
$result = $query->result_array(); $result = $query->result_array();
return $result; return $result;
} }
function getfiles($PONO) function getfiles($igr,$PONO)
{ {
//$this->db->distinct(); //$this->db->distinct();
$this->db->select('*'); $this->db->select('*');
$this->db->from('T_Inwardgateregister_fileupload'); $this->db->from('T_Inwardgateregister_fileupload');
$this->db->where('IGRNO',$igr);
$this->db->where('PONO',$PONO); $this->db->where('PONO',$PONO);
@ -49,11 +50,12 @@ function getfiles($PONO)
} }
function viewIGRFile1($PONO) function viewIGRFile1($igr,$PONO)
{ {
$this->db->distinct(); $this->db->distinct();
$this->db->select('igrm.file,igrm.PONO as pono'); //BillNo,IGRNO,FilePath,PONO $this->db->select('igrm.file,igrm.PONO as pono'); //BillNo,IGRNO,FilePath,PONO
$this->db->from('T_IGR_Master igrm'); $this->db->from('T_IGR_Master igrm');
$this->db->where('igrm.IGRNO',$igr);
$this->db->where('igrm.PONO',$PONO); $this->db->where('igrm.PONO',$PONO);
$query = $this->db->get(); $query = $this->db->get();
@ -1789,7 +1791,7 @@ if ($cname!= ''){
$tempArray['total'] = $value->total; $tempArray['total'] = $value->total;
$tempArray['created_date'] = $value->created_date; $tempArray['created_date'] = $value->created_date;
$tempArray['file'] = $value->file; $tempArray['file'] = $value->file;
$tempArray['ifile'] = $value->created_date; $tempArray['ifile'] = $value->ifile;
$tempArray['igrn'] =$value->igrn; $tempArray['igrn'] =$value->igrn;
$sqli ="select FilePath as Infiles from T_Inwardgateregister_fileupload where PONO =? and IGRNO =? "; $sqli ="select FilePath as Infiles from T_Inwardgateregister_fileupload where PONO =? and IGRNO =? ";

View File

@ -12,8 +12,8 @@
width: 50%; width: 50%;
float: right; float: right;
text-align: right; text-align: right;
} }
.dataTables_paginate { .dataTables_paginate {
width: 50%; width: 50%;
float: right; float: right;
text-align: right; text-align: right;
@ -260,18 +260,19 @@
?></span></td> ?></span></td>
<!-- $record->IGRNO.'-'.$record->PONO -->
<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="<?php echo $rel['igrn'].'-'.$rel['pono'];?>">Download</button></a>
<?php } elseif(!empty($rel['ifile'])){?> <?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> <a target="_blank" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm IGRfile" id="<?php echo $rel['igrn'].'-'.$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="<?php echo $rel['igrn'].'-'.$rel['pono'];?>">Download</button></a>
<?php }else{ <?php }else{
echo "N/A"; echo "N/A";
@ -333,9 +334,16 @@
$('.IGRfile').click(function() { $('.IGRfile').click(function() {
var id = $(this).attr('id'); var id = $(this).attr('id');
//alert(id);
var igr = id.substring(0, 9);
//alert(igr);
var po = id.substring(10, 33);
//alert(po);
$("#Fileshow").modal("show"); $("#Fileshow").modal("show");
$.ajax({ $.ajax({
data:{id:id}, data:{id:igr,id1:po},
type:"POST", type:"POST",
//dataType: 'json', //dataType: 'json',
url:"<?php echo base_url() ?>report/Viewnormaligrfiles", url:"<?php echo base_url() ?>report/Viewnormaligrfiles",
@ -364,12 +372,14 @@ $("#Fileshow").modal("show");
}else{ }else{
Filename ="BillDetails"; Filename ="BillDetails";
PONO =item.PONO; PONO =item.PONO;
BillNO =item.BillNo;
FilePath = item.FilePath; FilePath = item.FilePath;
} }
}else{ }else{
Filename = item.file; Filename = item.file;
PONO =item.pono; PONO =item.pono;
BillNO = '-'; BillNO = '-';
FilePath =item.file; FilePath =item.file;

View File

@ -4,7 +4,7 @@
$("#client_name").select2(); $("#client_name").select2();
$("#item_name").select2(); $("#item_name").select2();
}); });
</script> </script>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css">
@ -19,7 +19,7 @@
.dataTables_paginate { .dataTables_paginate {
width: 50%; width: 50%;
float: right; float: right;
text-align: right; text-align: right;
} }
div.dt-buttons { div.dt-buttons {
position: relative; position: relative;
@ -307,6 +307,7 @@ table.dataTable thead > tr > td.sorting {
$tot_tot = 0; $tot_tot = 0;
if(!empty($purchase)){ if(!empty($purchase)){
foreach($purchase as $key => $rel) foreach($purchase as $key => $rel)
//print_r($rel);
{ {
?> ?>
<tr id="lastvalue"> <tr id="lastvalue">
@ -362,14 +363,14 @@ table.dataTable thead > tr > td.sorting {
<td id="download<?php echo $key?>" style="text-align:center"><span> <td id="download<?php echo $key?>" style="text-align:center"><span>
<?php <?php
if(!empty($rel->file)){ ?><!-- if for Inward po file --> if(!empty($rel->file)){ ?><!-- 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 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="<?php echo $rel->igrn.'-'.$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" class="yourlink" 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 IGRfile" id="files<?php echo $rel->pono;?>">Download</button> <button class="btn btn-info btn-sm IGRfile" id="<?php echo $rel->igrn.'-'.$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="<?php echo $rel->igrn.'-'.$rel->pono;?>">Download</button></a>
<?php } else { echo 'N/A'; } ?><!-- both inwardpo file and Igr file empty means --> <?php } else { echo 'N/A'; } ?><!-- both inwardpo file and Igr file empty means -->
@ -535,6 +536,7 @@ $(document).ready(function() {
/** On click for Displaying File MOdal***/ /** On click for Displaying File MOdal***/
$('.splpofile').click(function() { $('.splpofile').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},
@ -567,9 +569,14 @@ $('.splpofile').click(function() {
$('.IGRfile').click(function() { $('.IGRfile').click(function() {
var id = $(this).attr('id'); var id = $(this).attr('id');
var igr = id.substring(0, 9);
//alert(igr);
var po = id.substring(10, 33);
$("#Fileshow").modal("show"); $("#Fileshow").modal("show");
$.ajax({ $.ajax({
data:{id:id},
data:{id:igr,id1:po},
type:"POST", type:"POST",
url:"<?php echo base_url() ?>report/Viewnormaligrfiles", url:"<?php echo base_url() ?>report/Viewnormaligrfiles",
success: function(data){ success: function(data){
@ -594,6 +601,7 @@ $('.IGRfile').click(function() {
}else{ }else{
Filename ="BillDetails"; Filename ="BillDetails";
PONO =item.PONO; PONO =item.PONO;
BillNO =item.BillNo;
FilePath = item.FilePath; FilePath = item.FilePath;
} }

View File

@ -8,7 +8,7 @@
.num{ .num{
text-align:right; text-align:right;
} }
.modal-content .modal-content
{ {
width:800px ! important; width:800px ! important;
} }
@ -394,6 +394,7 @@
else else
{ {
alert('Sorry Your File is Large To 2MB'); alert('Sorry Your File is Large To 2MB');
$('#billimag').val(''); $('#billimag').val('');
} }
} }
@ -498,6 +499,7 @@ $("#hiddenPONO").val(po);
}else{ }else{
Filename ="BillDetails"; Filename ="BillDetails";
PONO =item.PONO; PONO =item.PONO;
BillNO =item.BillNo;
FilePath = item.FilePath; FilePath = item.FilePath;
} }
@ -672,6 +674,8 @@ counter++;
if(bil_count>=6){ if(bil_count>=6){
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;
$('#addmorebutton').hide();
return false; return false;
} }
@ -697,7 +701,7 @@ counter++;
// '<button class="btn btn-danger remove remove_this" id="removebtn'+counterConstant+'" onclick="removeRow(this.id)"><i class="fa fa-trash"></i> Remove</button></div>'+ // '<button class="btn btn-danger remove remove_this" id="removebtn'+counterConstant+'" onclick="removeRow(this.id)"><i class="fa fa-trash"></i> Remove</button></div>'+
'<div class="col-md-2">'+ '<div class="col-md-2">'+
'<label><br><br></label>'+ '<label><br><br></label>'+
'<button class="btn btn-primary add add_this" id="addbtn" onclick="addRow()">ADD</button></div>'+ '<button class="btn btn-primary" type ="button" id="addbtn" onclick="addRow()">ADD</button></div>'+
'</div>'+ '</div>'+
'</div>'; '</div>';
@ -788,7 +792,7 @@ counter++;
success:function(data) { success:function(data) {
if(data){ if(data){
alert(data); alert(data);
window.location.reload();
$('.content').loader('hide'); $('.content').loader('hide');
// $('#spl').find('td').eq(5).text(filename[2]); // $('#spl').find('td').eq(5).text(filename[2]);
$('#billModel').modal('hide'); $('#billModel').modal('hide');
@ -798,4 +802,3 @@ counter++;
}); });
} }
</script> </script>